summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorRitesh Harjani <riteshh@codeaurora.org>2016-12-01 08:36:16 -0700
committerJens Axboe <axboe@fb.com>2016-12-01 08:36:16 -0700
commite0c723000966ae285295caaa8cda914dfa177fa4 (patch)
treea8f77eed7a4536f599843f1f277253e85cb3933f /block
parentaf309226db916e2c6e08d3eba3fa5c34225200c4 (diff)
downloadop-kernel-dev-e0c723000966ae285295caaa8cda914dfa177fa4.zip
op-kernel-dev-e0c723000966ae285295caaa8cda914dfa177fa4.tar.gz
block: factor out req_set_nomerge
Factor out common code for setting REQ_NOMERGE flag which is being used out at certain places and make it a helper instead, req_set_nomerge(). Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org> Get rid of the inline. Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'block')
-rw-r--r--block/blk-merge.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c
index cf2848c..1002afd 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -501,6 +501,13 @@ int blk_rq_map_sg(struct request_queue *q, struct request *rq,
}
EXPORT_SYMBOL(blk_rq_map_sg);
+static void req_set_nomerge(struct request_queue *q, struct request *req)
+{
+ req->cmd_flags |= REQ_NOMERGE;
+ if (req == q->last_merge)
+ q->last_merge = NULL;
+}
+
static inline int ll_new_hw_segment(struct request_queue *q,
struct request *req,
struct bio *bio)
@@ -521,9 +528,7 @@ static inline int ll_new_hw_segment(struct request_queue *q,
return 1;
no_merge:
- req->cmd_flags |= REQ_NOMERGE;
- if (req == q->last_merge)
- q->last_merge = NULL;
+ req_set_nomerge(q, req);
return 0;
}
@@ -537,9 +542,7 @@ int ll_back_merge_fn(struct request_queue *q, struct request *req,
return 0;
if (blk_rq_sectors(req) + bio_sectors(bio) >
blk_rq_get_max_sectors(req, blk_rq_pos(req))) {
- req->cmd_flags |= REQ_NOMERGE;
- if (req == q->last_merge)
- q->last_merge = NULL;
+ req_set_nomerge(q, req);
return 0;
}
if (!bio_flagged(req->biotail, BIO_SEG_VALID))
@@ -561,9 +564,7 @@ int ll_front_merge_fn(struct request_queue *q, struct request *req,
return 0;
if (blk_rq_sectors(req) + bio_sectors(bio) >
blk_rq_get_max_sectors(req, bio->bi_iter.bi_sector)) {
- req->cmd_flags |= REQ_NOMERGE;
- if (req == q->last_merge)
- q->last_merge = NULL;
+ req_set_nomerge(q, req);
return 0;
}
if (!bio_flagged(bio, BIO_SEG_VALID))
OpenPOWER on IntegriCloud