Skip to content

Commit a689efd

Browse files
calebsanderaxboe
authored andcommitted
ublk: don't access ublk_queue in ublk_check_fetch_buf()
Obtain the ublk device flags from ublk_device to avoid needing to access the ublk_queue, which may be a cache miss. 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>
1 parent 25c028a commit a689efd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/block/ublk_drv.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,14 +2190,14 @@ static int ublk_unregister_io_buf(struct io_uring_cmd *cmd,
21902190
return io_buffer_unregister_bvec(cmd, index, issue_flags);
21912191
}
21922192

2193-
static int ublk_check_fetch_buf(const struct ublk_queue *ubq, __u64 buf_addr)
2193+
static int ublk_check_fetch_buf(const struct ublk_device *ub, __u64 buf_addr)
21942194
{
2195-
if (ublk_need_map_io(ubq)) {
2195+
if (ublk_dev_need_map_io(ub)) {
21962196
/*
21972197
* FETCH_RQ has to provide IO buffer if NEED GET
21982198
* DATA is not enabled
21992199
*/
2200-
if (!buf_addr && !ublk_need_get_data(ubq))
2200+
if (!buf_addr && !ublk_dev_need_get_data(ub))
22012201
return -EINVAL;
22022202
} else if (buf_addr) {
22032203
/* User copy requires addr to be unset */
@@ -2340,7 +2340,7 @@ static int ublk_ch_uring_cmd_local(struct io_uring_cmd *cmd,
23402340
io = &ubq->ios[tag];
23412341
/* UBLK_IO_FETCH_REQ can be handled on any task, which sets io->task */
23422342
if (unlikely(_IOC_NR(cmd_op) == UBLK_IO_FETCH_REQ)) {
2343-
ret = ublk_check_fetch_buf(ubq, addr);
2343+
ret = ublk_check_fetch_buf(ub, addr);
23442344
if (ret)
23452345
goto out;
23462346
ret = ublk_fetch(cmd, ubq, io, addr);

0 commit comments

Comments
 (0)