@@ -741,23 +741,33 @@ static inline bool rq_is_sync(struct request *rq)
return op_is_sync(rq->cmd_flags);
}
-static inline bool rq_mergeable(struct request *rq)
+static bool rq_mergeable_op(enum req_opf op)
{
- if (blk_rq_is_passthrough(rq))
- return false;
+ bool ret;
- if (req_op(rq) == REQ_OP_FLUSH)
+ if (blk_op_is_private(op) || blk_op_is_scsi(op))
return false;
- if (req_op(rq) == REQ_OP_WRITE_ZEROES)
- return false;
+ switch (op) {
+ case REQ_OP_FLUSH:
+ case REQ_OP_WRITE_ZEROES:
+ ret = false;
+ break;
+ default:
+ ret =true;
+ }
+ return ret;
+}
+static inline bool rq_mergeable(struct request *rq)
+{
if (rq->cmd_flags & REQ_NOMERGE_FLAGS)
return false;
+
if (rq->rq_flags & RQF_NOMERGE_FLAGS)
return false;
- return true;
+ return rq_mergeable_op(req_op(rq));
}
static inline bool blk_write_same_mergeable(struct bio *a, struct bio *b)
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com> --- include/linux/blkdev.h | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)