Remove unused wait_event_info parameter in FileStartReadV()
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:
v1-0001-Remove-unused-wait_event_info-parameter-in-FileSt.patchtext/x-diff; charset=us-asciiDownload
From 367acfe3608f4450e32ea306068d61d2c74389b9 Mon Sep 17 00:00:00 2001
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Date: Fri, 4 Jul 2025 07:12:03 +0000
Subject: [PATCH v1] Remove unused wait_event_info parameter in
FileStartReadV()
The unused parameter is there since 50cb7505b301, and it's ok to just
remove it (as it is set correctly in pgaio_io_perform_synchronously()).
---
src/backend/storage/file/fd.c | 3 +--
src/backend/storage/smgr/md.c | 2 +-
src/include/storage/fd.h | 2 +-
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
index a4ec7959f31..ac0fd5606b2 100644
--- a/src/backend/storage/file/fd.c
+++ b/src/backend/storage/file/fd.c
@@ -2216,8 +2216,7 @@ retry:
int
FileStartReadV(PgAioHandle *ioh, File file,
- int iovcnt, off_t offset,
- uint32 wait_event_info)
+ int iovcnt, off_t offset)
{
int returnCode;
Vfd *vfdP;
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
index 2ccb0faceb5..733c61c1018 100644
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -1016,7 +1016,7 @@ mdstartreadv(PgAioHandle *ioh,
false);
pgaio_io_register_callbacks(ioh, PGAIO_HCB_MD_READV, 0);
- ret = FileStartReadV(ioh, v->mdfd_vfd, iovcnt, seekpos, WAIT_EVENT_DATA_FILE_READ);
+ ret = FileStartReadV(ioh, v->mdfd_vfd, iovcnt, seekpos);
if (ret != 0)
ereport(ERROR,
(errcode_for_file_access(),
diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h
index b77d8e5e30e..d687fc81728 100644
--- a/src/include/storage/fd.h
+++ b/src/include/storage/fd.h
@@ -111,7 +111,7 @@ extern void FileClose(File file);
extern int FilePrefetch(File file, off_t offset, off_t amount, uint32 wait_event_info);
extern ssize_t FileReadV(File file, const struct iovec *iov, int iovcnt, off_t offset, uint32 wait_event_info);
extern ssize_t FileWriteV(File file, const struct iovec *iov, int iovcnt, off_t offset, uint32 wait_event_info);
-extern int FileStartReadV(struct PgAioHandle *ioh, File file, int iovcnt, off_t offset, uint32 wait_event_info);
+extern int FileStartReadV(struct PgAioHandle *ioh, File file, int iovcnt, off_t offset);
extern int FileSync(File file, uint32 wait_event_info);
extern int FileZero(File file, off_t offset, off_t amount, uint32 wait_event_info);
extern int FileFallocate(File file, off_t offset, off_t amount, uint32 wait_event_info);
--
2.34.1
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
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