mirror of https://github.com/torvalds/linux.git
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>
This commit is contained in:
parent
25c028aa79
commit
a689efd5fd
|
|
@ -2190,14 +2190,14 @@ static int ublk_unregister_io_buf(struct io_uring_cmd *cmd,
|
||||||
return io_buffer_unregister_bvec(cmd, index, issue_flags);
|
return io_buffer_unregister_bvec(cmd, index, issue_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ublk_check_fetch_buf(const struct ublk_queue *ubq, __u64 buf_addr)
|
static int ublk_check_fetch_buf(const struct ublk_device *ub, __u64 buf_addr)
|
||||||
{
|
{
|
||||||
if (ublk_need_map_io(ubq)) {
|
if (ublk_dev_need_map_io(ub)) {
|
||||||
/*
|
/*
|
||||||
* FETCH_RQ has to provide IO buffer if NEED GET
|
* FETCH_RQ has to provide IO buffer if NEED GET
|
||||||
* DATA is not enabled
|
* DATA is not enabled
|
||||||
*/
|
*/
|
||||||
if (!buf_addr && !ublk_need_get_data(ubq))
|
if (!buf_addr && !ublk_dev_need_get_data(ub))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
} else if (buf_addr) {
|
} else if (buf_addr) {
|
||||||
/* User copy requires addr to be unset */
|
/* User copy requires addr to be unset */
|
||||||
|
|
@ -2340,7 +2340,7 @@ static int ublk_ch_uring_cmd_local(struct io_uring_cmd *cmd,
|
||||||
io = &ubq->ios[tag];
|
io = &ubq->ios[tag];
|
||||||
/* UBLK_IO_FETCH_REQ can be handled on any task, which sets io->task */
|
/* UBLK_IO_FETCH_REQ can be handled on any task, which sets io->task */
|
||||||
if (unlikely(_IOC_NR(cmd_op) == UBLK_IO_FETCH_REQ)) {
|
if (unlikely(_IOC_NR(cmd_op) == UBLK_IO_FETCH_REQ)) {
|
||||||
ret = ublk_check_fetch_buf(ubq, addr);
|
ret = ublk_check_fetch_buf(ub, addr);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
ret = ublk_fetch(cmd, ubq, io, addr);
|
ret = ublk_fetch(cmd, ubq, io, addr);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue