Skip to content

Commit be7962d

Browse files
calebsanderaxboe
authored andcommitted
ublk: don't access ublk_queue in ublk_check_commit_and_fetch()
For ublk servers with many ublk queues, accessing the ublk_queue in ublk_check_commit_and_fetch() is a frequent cache miss. Get the flags from the ublk_device instead, which is accessed earlier in ublk_ch_uring_cmd_local(). Signed-off-by: Caleb Sander Mateos <[email protected]> Reviewed-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 3576e60 commit be7962d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/block/ublk_drv.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2243,17 +2243,17 @@ static int ublk_fetch(struct io_uring_cmd *cmd, struct ublk_device *ub,
22432243
return ret;
22442244
}
22452245

2246-
static int ublk_check_commit_and_fetch(const struct ublk_queue *ubq,
2246+
static int ublk_check_commit_and_fetch(const struct ublk_device *ub,
22472247
struct ublk_io *io, __u64 buf_addr)
22482248
{
22492249
struct request *req = io->req;
22502250

2251-
if (ublk_need_map_io(ubq)) {
2251+
if (ublk_dev_need_map_io(ub)) {
22522252
/*
22532253
* COMMIT_AND_FETCH_REQ has to provide IO buffer if
22542254
* NEED GET DATA is not enabled or it is Read IO.
22552255
*/
2256-
if (!buf_addr && (!ublk_need_get_data(ubq) ||
2256+
if (!buf_addr && (!ublk_dev_need_get_data(ub) ||
22572257
req_op(req) == REQ_OP_READ))
22582258
return -EINVAL;
22592259
} else if (req_op(req) != REQ_OP_ZONE_APPEND && buf_addr) {
@@ -2381,7 +2381,7 @@ static int ublk_ch_uring_cmd_local(struct io_uring_cmd *cmd,
23812381
return ublk_daemon_register_io_buf(cmd, ub, q_id, tag, io, addr,
23822382
issue_flags);
23832383
case UBLK_IO_COMMIT_AND_FETCH_REQ:
2384-
ret = ublk_check_commit_and_fetch(ubq, io, addr);
2384+
ret = ublk_check_commit_and_fetch(ub, io, addr);
23852385
if (ret)
23862386
goto out;
23872387
io->res = result;

0 commit comments

Comments
 (0)