Skip to content

Commit

Permalink
Fix AsyncIO reading seed queueing (#3940)
Browse files Browse the repository at this point in the history
Fixes a bug in AsyncIO where we queue reads after opening a file so our queue will always be saturated (or as saturated as possible).
Previous code was looping up to `availableJobsCount` not realizing `availableJobsCount` was also decreasing in each iteration, so instead of queueing 10 jobs we'd queue 5 (and instead of 2 we'd queue 1).
This PR fixes the loop to queue as long as `availableJobsCount` is not 0.
  • Loading branch information
yoniko committed Mar 11, 2024
1 parent a4db145 commit edab9ee
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions programs/fileio_asyncio.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,7 @@ static void AIO_ReadPool_enqueueRead(ReadPoolCtx_t* ctx) {
}

static void AIO_ReadPool_startReading(ReadPoolCtx_t* ctx) {
int i;
for (i = 0; i < ctx->base.availableJobsCount; i++) {
while(ctx->base.availableJobsCount) {
AIO_ReadPool_enqueueRead(ctx);
}
}
Expand Down

0 comments on commit edab9ee

Please # to comment.