public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring/filetable: don't unnecessarily clear/reset bitmap
@ 2024-05-08 14:21 Jens Axboe
  0 siblings, 0 replies; only message in thread
From: Jens Axboe @ 2024-05-08 14:21 UTC (permalink / raw)
  To: io-uring

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]>

---

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;
 }
 
-- 
Jens Axboe


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-08 14:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-08 14:21 [PATCH] io_uring/filetable: don't unnecessarily clear/reset bitmap Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox