diff options
author | Jens Axboe <axboe@kernel.dk> | 2024-05-08 00:09:02 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-05-08 17:27:45 +0300 |
commit | 340f634aa43d4172771a784da31e5d4c7c7d3126 (patch) | |
tree | ad4123a6492c49bd38f2de4900ad2abbfeef536d /io_uring/filetable.c | |
parent | 8a565304927fbd28c9f028c492b5c1714002cbab (diff) | |
download | linux-340f634aa43d4172771a784da31e5d4c7c7d3126.tar.xz |
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 <axboe@kernel.dk>
Diffstat (limited to 'io_uring/filetable.c')
-rw-r--r-- | io_uring/filetable.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/io_uring/filetable.c b/io_uring/filetable.c index 6e86e6188dbe..997c56d32ee6 100644 --- a/io_uring/filetable.c +++ b/io_uring/filetable.c @@ -84,12 +84,12 @@ static int io_install_fixed_file(struct io_ring_ctx *ctx, struct file *file, return ret; file_slot->file_ptr = 0; - io_file_bitmap_clear(&ctx->file_table, slot_index); + } else { + io_file_bitmap_set(&ctx->file_table, slot_index); } *io_get_tag_slot(ctx->file_data, slot_index) = 0; io_fixed_file_set(file_slot, file); - io_file_bitmap_set(&ctx->file_table, slot_index); return 0; } |