diff options
Diffstat (limited to 'src/backend/storage/aio/aio_io.c')
-rw-r--r-- | src/backend/storage/aio/aio_io.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/backend/storage/aio/aio_io.c b/src/backend/storage/aio/aio_io.c index 195276f630e..4d31392ddc7 100644 --- a/src/backend/storage/aio/aio_io.c +++ b/src/backend/storage/aio/aio_io.c @@ -188,3 +188,25 @@ pgaio_io_get_op_name(PgAioHandle *ioh) return NULL; /* silence compiler */ } + +/* + * Used to determine if an IO needs to be waited upon before the file + * descriptor can be closed. + */ +bool +pgaio_io_uses_fd(PgAioHandle *ioh, int fd) +{ + Assert(ioh->state >= PGAIO_HS_DEFINED); + + switch (ioh->op) + { + case PGAIO_OP_READV: + return ioh->op_data.read.fd == fd; + case PGAIO_OP_WRITEV: + return ioh->op_data.write.fd == fd; + case PGAIO_OP_INVALID: + return false; + } + + return false; /* silence compiler */ +} |