Remove unused wait_event_info parameter in FileStartReadV()

Started by Bertrand Drouvotover 1 year ago3 messageshackers

Thread notes

1 note#refactor
hackorum-bot#refactor
hackorum-bot
1 day ago

@global #refactor

#refactor
Jump to latest
#1Bertrand Drouvot
bertranddrouvot.pg@gmail.com

Hi hackers,

While working on wait events related stuff, I noticed that the wait_event_info
parameter in FileStartReadV() is unused.

The unused parameter is there since 50cb7505b301, and I think it's ok to just
remove it (as it is set correctly in pgaio_io_perform_synchronously()).

PFA, a patch doing so.

BTW, out of curiosity I launched:

run-clang-tidy -checks="-*,misc-unused-parameters" | grep -c "warning: parameter.*is unused"
2008

That's quite a lot, but I did look at some of them randomly and they were
coming from callbacks (which can make sense). That might need a deeper analysis
though (to check if there are some outside of the callback cases).

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Attachments:

t51859_1
v1-0001-Remove-unused-wait_event_info-parameter-in-FileSt.patchtext/x-diff; charset=us-asciiDownload+3-5
#2Aleksander Alekseev
aleksander@timescale.com
In reply to: Bertrand Drouvot (#1)
Re: Remove unused wait_event_info parameter in FileStartReadV()

Hi Bertrand,

While working on wait events related stuff, I noticed that the wait_event_info
parameter in FileStartReadV() is unused.

The unused parameter is there since 50cb7505b301, and I think it's ok to just
remove it (as it is set correctly in pgaio_io_perform_synchronously()).

Any chance we should call pgstat_report_wait_start(wait_event_info)
instead similarly to other functions in fd.c?

--
Best regards,
Aleksander Alekseev

#3Bertrand Drouvot
bertranddrouvot.pg@gmail.com
In reply to: Aleksander Alekseev (#2)
Re: Remove unused wait_event_info parameter in FileStartReadV()

Hi Aleksander,

On Fri, Jul 04, 2025 at 01:16:02PM +0300, Aleksander Alekseev wrote:

Hi Bertrand,

While working on wait events related stuff, I noticed that the wait_event_info
parameter in FileStartReadV() is unused.

The unused parameter is there since 50cb7505b301, and I think it's ok to just
remove it (as it is set correctly in pgaio_io_perform_synchronously()).

Any chance we should call pgstat_report_wait_start(wait_event_info)
instead similarly to other functions in fd.c?

Thanks for looking at it!

I think that's fine because pgstat_report_wait_start(WAIT_EVENT_DATA_FILE_READ)
is actually called in pgaio_io_perform_synchronously().

We could call also call pgstat_report_wait_start(wait_event_info) prior to the
pgaio_io_start_readv() in FileStartReadV() (as I think you're suggesting) but I
think the closer to pg_preadv() the better.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com