* [PATCH] block: remove redundant req_op in blk_rq_is_passthrough
@ 2023-05-22 8:53 linan666
2023-05-22 9:31 ` Chaitanya Kulkarni
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: linan666 @ 2023-05-22 8:53 UTC (permalink / raw)
To: axboe
Cc: linux-block, linux-kernel, linan122, yukuai3, yi.zhang, houtao1,
yangerkun
From: Li Nan <linan122@huawei.com>
op &= REQ_OP_MASK in blk_op_is_passthrough() is exactly what req_op() do.
Therefore, it is redundant to call req_op() for blk_op_is_passthrough().
Signed-off-by: Li Nan <linan122@huawei.com>
---
include/linux/blk-mq.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
index d778cb6b2112..59b52ec155b1 100644
--- a/include/linux/blk-mq.h
+++ b/include/linux/blk-mq.h
@@ -201,7 +201,7 @@ static inline enum req_op req_op(const struct request *req)
static inline bool blk_rq_is_passthrough(struct request *rq)
{
- return blk_op_is_passthrough(req_op(rq));
+ return blk_op_is_passthrough(rq->cmd_flags);
}
static inline unsigned short req_get_ioprio(struct request *req)
--
2.31.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] block: remove redundant req_op in blk_rq_is_passthrough
2023-05-22 8:53 [PATCH] block: remove redundant req_op in blk_rq_is_passthrough linan666
@ 2023-05-22 9:31 ` Chaitanya Kulkarni
2023-05-23 6:19 ` Christoph Hellwig
2023-05-23 17:13 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2023-05-22 9:31 UTC (permalink / raw)
To: linan666, axboe
Cc: linux-block, linux-kernel, linan122, yukuai3, yi.zhang, houtao1,
yangerkun
On 5/22/23 01:53, linan666@huaweicloud.com wrote:
> From: Li Nan <linan122@huawei.com>
>
> op &= REQ_OP_MASK in blk_op_is_passthrough() is exactly what req_op() do.
> Therefore, it is redundant to call req_op() for blk_op_is_passthrough().
I couldn't understand commit log, feel free to ignore following
if others are okay with it :-
req_op() returns the REQ_OP_XXX with req->cmd_flags & REQ_OP_MASKS.
blk_op_is_passthrugh() masks op with REQ_OP_MASKS to compare
REQ_OP_XXX with passthrough requests REQ_OP_IN/REQ_OP_OUT.
245
246 static inline bool blk_op_is_passthrough(blk_opf_t op)
247 {
248 op &= REQ_OP_MASK;
249 return op == REQ_OP_DRV_IN || op == REQ_OP_DRV_OUT;
250 }
251
Passing req_op(rq) argument to blk_op_is_passthru() results in double
masking of request flags first in req_op() and again in
blk_op_is_passthrough().
Avoid that by passing req->cmd_flags instead of req_op(req) as
an argument to blk_op_is_passthrough() when it is called from
blk_rq_is_passthruough().
irrespective of above suggestion, looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] block: remove redundant req_op in blk_rq_is_passthrough
2023-05-22 8:53 [PATCH] block: remove redundant req_op in blk_rq_is_passthrough linan666
2023-05-22 9:31 ` Chaitanya Kulkarni
@ 2023-05-23 6:19 ` Christoph Hellwig
2023-05-23 17:13 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2023-05-23 6:19 UTC (permalink / raw)
To: linan666
Cc: axboe, linux-block, linux-kernel, linan122, yukuai3, yi.zhang,
houtao1, yangerkun
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] block: remove redundant req_op in blk_rq_is_passthrough
2023-05-22 8:53 [PATCH] block: remove redundant req_op in blk_rq_is_passthrough linan666
2023-05-22 9:31 ` Chaitanya Kulkarni
2023-05-23 6:19 ` Christoph Hellwig
@ 2023-05-23 17:13 ` Jens Axboe
2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2023-05-23 17:13 UTC (permalink / raw)
To: linan666
Cc: linux-block, linux-kernel, linan122, yukuai3, yi.zhang, houtao1,
yangerkun
On Mon, 22 May 2023 16:53:55 +0800, linan666@huaweicloud.com wrote:
> op &= REQ_OP_MASK in blk_op_is_passthrough() is exactly what req_op() do.
> Therefore, it is redundant to call req_op() for blk_op_is_passthrough().
>
>
Applied, thanks!
[1/1] block: remove redundant req_op in blk_rq_is_passthrough
commit: 712fd23a90eed6a73ea5135a500e59d30356d4f1
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-05-23 17:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22 8:53 [PATCH] block: remove redundant req_op in blk_rq_is_passthrough linan666
2023-05-22 9:31 ` Chaitanya Kulkarni
2023-05-23 6:19 ` Christoph Hellwig
2023-05-23 17:13 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®