io_uring/filetable: don't unnecessarily clear/reset bitmap

JIRA: https://issues.redhat.com/browse/RHEL-64867

commit 340f634aa43d4172771a784da31e5d4c7c7d3126
Author: Jens Axboe <axboe@kernel.dk>
Date:   Tue May 7 15:09:02 2024 -0600

    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>

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
This commit is contained in:
Jeff Moyer 2024-05-07 15:09:02 -06:00
parent ce17df8151
commit b7fd7f39e1
1 changed files with 2 additions and 2 deletions

View File

@ -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;
}