Skip to content

Commit 7b98c55

Browse files
committed
aio: Fix assertion, clarify README
The assertion wouldn't have triggered for a long while yet, but this won't accidentally fail to detect the issue if/when it occurs. Author: Matthias van de Meent <boekewurm+postgres@gmail.com> Discussion: https://postgr.es/m/CAEze2Wj-43JV4YufW23gm=Uwr7Lkj+p0yKctKHxNm1rwFC+_DQ@mail.gmail.com Backpatch-through: 18
1 parent 0e8c656 commit 7b98c55

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/backend/storage/aio/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pgaio_io_register_callbacks(ioh, PGAIO_HCB_SHARED_BUFFER_READV, 0);
9494
*
9595
* In this example we're reading only a single buffer, hence the 1.
9696
*/
97-
pgaio_io_set_handle_data_32(ioh, (uint32 *) buffer, 1);
97+
pgaio_io_set_handle_data_32(ioh, (uint32 *) &buffer, 1);
9898

9999
/*
100100
* Pass the AIO handle to lower-level function. When operating on the level of
@@ -119,8 +119,9 @@ pgaio_io_set_handle_data_32(ioh, (uint32 *) buffer, 1);
119119
* e.g. due to reaching a limit on the number of unsubmitted IOs, and even
120120
* complete before smgrstartreadv() returns.
121121
*/
122+
void *page = BufferGetBlock(buffer);
122123
smgrstartreadv(ioh, operation->smgr, forknum, blkno,
123-
BufferGetBlock(buffer), 1);
124+
&page, 1);
124125

125126
/*
126127
* To benefit from AIO, it is beneficial to perform other work, including

src/include/storage/aio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ typedef enum PgAioHandleCallbackID
201201
} PgAioHandleCallbackID;
202202

203203
#define PGAIO_HCB_MAX PGAIO_HCB_LOCAL_BUFFER_READV
204-
StaticAssertDecl(PGAIO_HCB_MAX <= (1 << PGAIO_RESULT_ID_BITS),
204+
StaticAssertDecl(PGAIO_HCB_MAX < (1 << PGAIO_RESULT_ID_BITS),
205205
"PGAIO_HCB_MAX is too big for PGAIO_RESULT_ID_BITS");
206206

207207

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy