[PATCH 4.4 116/192] [PATCH 120/135] block: fix blk_rq_get_max_sectors for driver private requests

From: Greg Kroah-Hartman
Date: Mon Sep 12 2016 - 13:11:15 EST


4.4-stable review patch. If anyone has any objections, please let me know.

------------------

[ Upstream commit f21018427cb007a0894c36ad702990ab639cbbb4 ]

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@xxxxxx>
Reported-by: Jeff Lien <Jeff.Lien@xxxxxxxx>
Tested-by: Jeff Lien <Jeff.Lien@xxxxxxxx>
Reviewed-by: Keith Busch <keith.busch@xxxxxxxxx>

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@xxxxxx>
Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
include/linux/blkdev.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -890,7 +890,7 @@ static inline unsigned int blk_rq_get_ma
{
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))