From: Andres Freund Date: Tue, 12 Jan 2021 04:57:38 +0000 (-0800) Subject: aio: util: pass AIO to streaming write completion callback. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=2cf77aa02f45723ccaf049accfa97c3f7479357f;p=users%2Fandresfreund%2Fpostgres.git aio: util: pass AIO to streaming write completion callback. Not yet useful, because there's yet a way to access the result of the write. --- diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 7456ed536a..f67a26dae4 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -4535,7 +4535,7 @@ XLogNeedsFlush(XLogRecPtr record) } static void -XLogFileInitComplete(void *pgsw_private, void *write_private) +XLogFileInitComplete(void *pgsw_private, PgAioInProgress *aio, void *write_private) { } diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 6bbcde4083..075f255224 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -1832,7 +1832,7 @@ typedef struct BulkExtendBufferedState } BulkExtendBufferedState; static void -bulk_extend_undirty_complete(void *pgsw_private, void *write_private) +bulk_extend_undirty_complete(void *pgsw_private, PgAioInProgress *aio, void *write_private) { BulkExtendBufferedState *be_state = (BulkExtendBufferedState * ) pgsw_private; BulkExtendOneBuffer *ex_buf = (BulkExtendOneBuffer *) write_private; @@ -2488,7 +2488,7 @@ UnpinBuffer(BufferDesc *buf, bool fixOwner) } static void -buffer_sync_complete(void *pgsw_private, void *write_private) +buffer_sync_complete(void *pgsw_private, PgAioInProgress *aio, void *write_private) { WritebackContext *wb_context = (WritebackContext *) pgsw_private; BufferDesc *bufHdr = (BufferDesc *) write_private; diff --git a/src/backend/storage/ipc/aio_util.c b/src/backend/storage/ipc/aio_util.c index e4bf8192cb..afef091e78 100644 --- a/src/backend/storage/ipc/aio_util.c +++ b/src/backend/storage/ipc/aio_util.c @@ -157,7 +157,7 @@ pg_streaming_write_complete(PgAioOnCompletionLocalContext *ocb, PgAioInProgress dlist_push_tail(&pgsw->available, &this_write->node); /* call callback after all other handling so it can issue IO */ - pgsw->on_completion(pgsw->private_data, private_data); + pgsw->on_completion(pgsw->private_data, io, private_data); ereport(DEBUG3, errmsg("complete %zu", this_write - pgsw->all_items), errhidestmt(true), diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c index e197b78df3..6fc0a7c4f2 100644 --- a/src/backend/storage/smgr/md.c +++ b/src/backend/storage/smgr/md.c @@ -482,7 +482,7 @@ mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum, } static void -zeroextend_complete(void *pgsw_private, void *write_private) +zeroextend_complete(void *pgsw_private, PgAioInProgress *aio, void *write_private) { BlockNumber *latest = (BlockNumber *) write_private; } diff --git a/src/include/storage/aio.h b/src/include/storage/aio.h index ed8027f561..e826b2d2f4 100644 --- a/src/include/storage/aio.h +++ b/src/include/storage/aio.h @@ -151,7 +151,7 @@ extern char *pgaio_bounce_buffer_buffer(PgAioBounceBuffer *bb); * Helper to efficiently perform bulk writes. */ typedef struct pg_streaming_write pg_streaming_write; -typedef void (*pg_streaming_write_completed)(void *pgsw_private, void *write_private); +typedef void (*pg_streaming_write_completed)(void *pgsw_private, PgAioInProgress *aio, void *write_private); extern pg_streaming_write *pg_streaming_write_alloc(uint32 iodepth, void *private, pg_streaming_write_completed on_completion);