Skip to content

Commit 340f634

Browse files
committed
io_uring/filetable: don't unnecessarily clear/reset bitmap
If we're updating an existing slot, we clear the slot bitmap only to set it again right after. Just leave the bit set rather than toggle it off and on, and move the unused slot setting into the branch of not already having a file occupy this slot. Signed-off-by: Jens Axboe <[email protected]>
1 parent 8a56530 commit 340f634

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

io_uring/filetable.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ static int io_install_fixed_file(struct io_ring_ctx *ctx, struct file *file,
8484
return ret;
8585

8686
file_slot->file_ptr = 0;
87-
io_file_bitmap_clear(&ctx->file_table, slot_index);
87+
} else {
88+
io_file_bitmap_set(&ctx->file_table, slot_index);
8889
}
8990

9091
*io_get_tag_slot(ctx->file_data, slot_index) = 0;
9192
io_fixed_file_set(file_slot, file);
92-
io_file_bitmap_set(&ctx->file_table, slot_index);
9393
return 0;
9494
}
9595

0 commit comments

Comments
 (0)