aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/aio/aio_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage/aio/aio_io.c')
-rw-r--r--src/backend/storage/aio/aio_io.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/backend/storage/aio/aio_io.c b/src/backend/storage/aio/aio_io.c
index 4d31392ddc7..00e176135a6 100644
--- a/src/backend/storage/aio/aio_io.c
+++ b/src/backend/storage/aio/aio_io.c
@@ -210,3 +210,26 @@ pgaio_io_uses_fd(PgAioHandle *ioh, int fd)
return false; /* silence compiler */
}
+
+/*
+ * Return the iovec and its length. Currently only expected to be used by
+ * debugging infrastructure
+ */
+int
+pgaio_io_get_iovec_length(PgAioHandle *ioh, struct iovec **iov)
+{
+ Assert(ioh->state >= PGAIO_HS_DEFINED);
+
+ *iov = &pgaio_ctl->iovecs[ioh->iovec_off];
+
+ switch (ioh->op)
+ {
+ case PGAIO_OP_READV:
+ return ioh->op_data.read.iov_length;
+ case PGAIO_OP_WRITEV:
+ return ioh->op_data.write.iov_length;
+ default:
+ pg_unreachable();
+ return 0;
+ }
+}