Skip to content

Commit 97a02be

Browse files
calebsanderaxboe
authored andcommitted
ublk: pass ublk_io to __ublk_complete_rq()
All callers of __ublk_complete_rq() already know the ublk_io. Pass it in to avoid looking it up again. Signed-off-by: Caleb Sander Mateos <[email protected]> Reviewed-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 122f638 commit 97a02be

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/block/ublk_drv.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ static blk_status_t ublk_setup_iod_zoned(struct ublk_queue *ubq,
529529

530530
#endif
531531

532-
static inline void __ublk_complete_rq(struct request *req);
532+
static inline void __ublk_complete_rq(struct request *req, struct ublk_io *io);
533533

534534
static dev_t ublk_chr_devt;
535535
static const struct class ublk_chr_class = {
@@ -738,7 +738,7 @@ static inline bool ublk_get_req_ref(struct ublk_io *io)
738738
static inline void ublk_put_req_ref(struct ublk_io *io, struct request *req)
739739
{
740740
if (refcount_dec_and_test(&io->ref))
741-
__ublk_complete_rq(req);
741+
__ublk_complete_rq(req, io);
742742
}
743743

744744
static inline bool ublk_sub_req_ref(struct ublk_io *io)
@@ -1146,10 +1146,9 @@ static inline struct ublk_uring_cmd_pdu *ublk_get_uring_cmd_pdu(
11461146
}
11471147

11481148
/* todo: handle partial completion */
1149-
static inline void __ublk_complete_rq(struct request *req)
1149+
static inline void __ublk_complete_rq(struct request *req, struct ublk_io *io)
11501150
{
11511151
struct ublk_queue *ubq = req->mq_hctx->driver_data;
1152-
struct ublk_io *io = &ubq->ios[req->tag];
11531152
unsigned int unmapped_bytes;
11541153
blk_status_t res = BLK_STS_OK;
11551154

@@ -1750,7 +1749,7 @@ static void __ublk_fail_req(struct ublk_device *ub, struct ublk_io *io,
17501749
blk_mq_requeue_request(req, false);
17511750
else {
17521751
io->res = -EIO;
1753-
__ublk_complete_rq(req);
1752+
__ublk_complete_rq(req, io);
17541753
}
17551754
}
17561755

@@ -2395,7 +2394,7 @@ static int ublk_ch_uring_cmd_local(struct io_uring_cmd *cmd,
23952394
if (req_op(req) == REQ_OP_ZONE_APPEND)
23962395
req->__sector = addr;
23972396
if (compl)
2398-
__ublk_complete_rq(req);
2397+
__ublk_complete_rq(req, io);
23992398

24002399
if (ret)
24012400
goto out;

0 commit comments

Comments
 (0)