Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 291ecb9

Browse files
yonikohswong3i
authored andcommittedMar 27, 2024
Fix AsyncIO reading seed queueing (facebook#3940)
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.
1 parent 1fca6ce commit 291ecb9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed
 

‎programs/fileio_asyncio.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,7 @@ static void AIO_ReadPool_enqueueRead(ReadPoolCtx_t* ctx) {
514514
}
515515

516516
static void AIO_ReadPool_startReading(ReadPoolCtx_t* ctx) {
517-
int i;
518-
for (i = 0; i < ctx->base.availableJobsCount; i++) {
517+
while(ctx->base.availableJobsCount) {
519518
AIO_ReadPool_enqueueRead(ctx);
520519
}
521520
}

0 commit comments

Comments
 (0)
Please sign in to comment.