]> www.infradead.org Git - users/hch/misc.git/commit
ublk: inline __ublk_ch_uring_cmd()
authorCaleb Sander Mateos <csander@purestorage.com>
Fri, 8 Aug 2025 15:32:50 +0000 (09:32 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 3 Sep 2025 23:35:54 +0000 (17:35 -0600)
commit225dc96f35afce6ffe3d798ffc0064445847a63b
treee05ca9c6e3a9846db1ec8e9573f7ebb5a8b8cae5
parent4dbe13c78447450ee133fc3399ebcabe27a62164
ublk: inline __ublk_ch_uring_cmd()

ublk_ch_uring_cmd_local() is a thin wrapper around __ublk_ch_uring_cmd()
that copies the ublksrv_io_cmd from user-mapped memory to the stack
using READ_ONCE(). This ublksrv_io_cmd is passed by pointer to
__ublk_ch_uring_cmd() and __ublk_ch_uring_cmd() is a large function
unlikely to be inlined, so __ublk_ch_uring_cmd() will have to load the
ublksrv_io_cmd fields back from the stack. Inline __ublk_ch_uring_cmd()
into ublk_ch_uring_cmd_local() and load the ublksrv_io_cmd fields into
local variables with READ_ONCE(). This allows the compiler to delay
loading the fields until they are needed and choose whether to store
them in registers or on the stack.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250808153251.282107-1-csander@purestorage.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c