[PATCH 3/3 Xenial SRU] block: fix blk_rq_get_max_sectors for driver private requests

Tim Gardner tim.gardner at canonical.com
Fri Jun 3 13:42:17 UTC 2016


From: Christoph Hellwig <hch at lst.de>

BugLink: http://bugs.launchpad.net/bugs/1588449

Driver private request types should not get the artifical cap for the
FS requests.  This is important to use the full device capabilities
for internal command or NVMe pass through commands.

Signed-off-by: Christoph Hellwig <hch at lst.de>
Reported-by: Jeff Lien <Jeff.Lien at hgst.com>
Tested-by: Jeff Lien <Jeff.Lien at hgst.com>
Reviewed-by: Keith Busch <keith.busch at intel.com>

Updated by me to use an explicit check for the one command type that
does support extended checking, instead of relying on the ordering
of the enum command values - as suggested by Keith.

Signed-off-by: Jens Axboe <axboe at fb.com>
(cherry picked from commit f21018427cb007a0894c36ad702990ab639cbbb4)
Signed-off-by: Tim Gardner <tim.gardner at canonical.com>
---
 include/linux/blkdev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 9ecdb59..42f4bcf 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -890,7 +890,7 @@ static inline unsigned int blk_rq_get_max_sectors(struct request *rq)
 {
 	struct request_queue *q = rq->q;
 
-	if (unlikely(rq->cmd_type == REQ_TYPE_BLOCK_PC))
+	if (unlikely(rq->cmd_type != REQ_TYPE_FS))
 		return q->limits.max_hw_sectors;
 
 	if (!q->limits.chunk_sectors || (rq->cmd_flags & REQ_DISCARD))
-- 
1.9.1





More information about the kernel-team mailing list