linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] null_blk: add unlikely for REQ_OP_DISACRD handling
@ 2019-07-02  3:20 Chaitanya Kulkarni
  2019-07-03  7:17 ` Minwoo Im
  2019-07-03 13:39 ` Jens Axboe
  0 siblings, 2 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2019-07-02  3:20 UTC (permalink / raw)
  To: linux-block; +Cc: Chaitanya Kulkarni

Since discard requests are not as common as read and write requests
mark REQ_OP_DISCARD condition unlikely in the null_handle_rq() and
null_handle_bio().

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/block/null_blk_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/null_blk_main.c b/drivers/block/null_blk_main.c
index 99328ded60d1..cbbbb89e89ab 100644
--- a/drivers/block/null_blk_main.c
+++ b/drivers/block/null_blk_main.c
@@ -1061,7 +1061,7 @@ static int null_handle_rq(struct nullb_cmd *cmd)
 
 	sector = blk_rq_pos(rq);
 
-	if (req_op(rq) == REQ_OP_DISCARD) {
+	if (unlikely(req_op(rq) == REQ_OP_DISCARD)) {
 		null_handle_discard(nullb, sector, blk_rq_bytes(rq));
 		return 0;
 	}
@@ -1095,7 +1095,7 @@ static int null_handle_bio(struct nullb_cmd *cmd)
 
 	sector = bio->bi_iter.bi_sector;
 
-	if (bio_op(bio) == REQ_OP_DISCARD) {
+	if (unlikely(bio_op(bio) == REQ_OP_DISCARD)) {
 		null_handle_discard(nullb, sector,
 			bio_sectors(bio) << SECTOR_SHIFT);
 		return 0;
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-04  0:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-02  3:20 [PATCH] null_blk: add unlikely for REQ_OP_DISACRD handling Chaitanya Kulkarni
2019-07-03  7:17 ` Minwoo Im
2019-07-03 13:39 ` Jens Axboe
2019-07-04  0:14   ` Chaitanya Kulkarni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).