block: don't honor chunk sizes for data-less IO
authorJens Axboe <axboe@fb.com>
Fri, 29 May 2015 19:11:32 +0000 (13:11 -0600)
committerJens Axboe <axboe@fb.com>
Fri, 29 May 2015 19:11:32 +0000 (13:11 -0600)
We don't need to honor chunk sizes for IO that doesn't carry any
data.

Signed-off-by: Jens Axboe <axboe@fb.com>
include/linux/blkdev.h

index 9ded80da2c1658b868849940de88e0d34e217e5d..ccaa9aecd5930a360d217de49ef347d705e5d777 100644 (file)
@@ -903,7 +903,7 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
        if (unlikely(rq->cmd_type == REQ_TYPE_BLOCK_PC))
                return q->limits.max_hw_sectors;
 
-       if (!q->limits.chunk_sectors)
+       if (!q->limits.chunk_sectors || (rq->cmd_flags & REQ_DISCARD))
                return blk_queue_get_max_sectors(q, rq->cmd_flags);
 
        return min(blk_max_size_offset(q, blk_rq_pos(rq)),