summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDamien Le Moal <damien.lemoal@hgst.com>2016-07-20 21:40:47 -0600
committerJens Axboe <axboe@fb.com>2016-07-20 21:40:47 -0600
commit17007f3994cdb4643355c73f54f0adad006cf59e (patch)
treeac5aab0bf6211f1dc878872db5ec73f9b99bda5b /include
parent72ef799b3f14f4cb4c56ba3af6e6bdcbae6df368 (diff)
downloadlinux-17007f3994cdb4643355c73f54f0adad006cf59e.tar.bz2
block: Fix front merge check
For a front merge, the maximum number of sectors of the request must be checked against the front merge BIO sector, not the current sector of the request. Signed-off-by: Damien Le Moal <damien.lemoal@hgst.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/blkdev.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 9d84c98b5c79..48f05d768a53 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -922,7 +922,8 @@ static inline unsigned int blk_max_size_offset(struct request_queue *q,
(offset & (q->limits.chunk_sectors - 1));
}
-static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
+static inline unsigned int blk_rq_get_max_sectors(struct request *rq,
+ sector_t offset)
{
struct request_queue *q = rq->q;
@@ -932,7 +933,7 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
if (!q->limits.chunk_sectors || (req_op(rq) == REQ_OP_DISCARD))
return blk_queue_get_max_sectors(q, req_op(rq));
- return min(blk_max_size_offset(q, blk_rq_pos(rq)),
+ return min(blk_max_size_offset(q, offset),
blk_queue_get_max_sectors(q, req_op(rq)));
}