]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ublk: optimize ublk_user_copy() on daemon task
authorCaleb Sander Mateos <csander@purestorage.com>
Thu, 8 Jan 2026 09:19:39 +0000 (02:19 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 12 Jan 2026 16:16:38 +0000 (09:16 -0700)
commitbfe1255712a3b1c1f7418c5504a1bf53735d3848
tree10862163989d7883365cca80d162f99ba0b8b02d
parentb2503e936b598b993cb09005194dc77d2fa3f082
ublk: optimize ublk_user_copy() on daemon task

ublk user copy syscalls may be issued from any task, so they take a
reference count on the struct ublk_io to check whether it is owned by
the ublk server and prevent a concurrent UBLK_IO_COMMIT_AND_FETCH_REQ
from completing the request. However, if the user copy syscall is issued
on the io's daemon task, a concurrent UBLK_IO_COMMIT_AND_FETCH_REQ isn't
possible, so the atomic reference count dance is unnecessary. Check for
UBLK_IO_FLAG_OWNED_BY_SRV to ensure the request is dispatched to the
sever and obtain the request from ublk_io's req field instead of looking
it up on the tagset. Skip the reference count increment and decrement.
Commit 8a8fe42d765b ("ublk: optimize UBLK_IO_REGISTER_IO_BUF on daemon
task") made an analogous optimization for ublk zero copy buffer
registration.

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