diff mbox

[4/5] block: fix blk_rq_get_max_sectors for driver private requests

Message ID 1456938434-20387-5-git-send-email-hch@lst.de (mailing list archive)
State Accepted, archived
Delegated to: Jens Axboe
Headers show

Commit Message

Christoph Hellwig March 2, 2016, 5:07 p.m. UTC
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@lst.de>
Reported-by: Jeff Lien <Jeff.Lien@hgst.com>
Tested-by: Jeff Lien <Jeff.Lien@hgst.com>
---
 include/linux/blkdev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Keith Busch March 2, 2016, 7:17 p.m. UTC | #1
On Wed, Mar 02, 2016 at 06:07:13PM +0100, Christoph Hellwig wrote:
> 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@lst.de>
> Reported-by: Jeff Lien <Jeff.Lien@hgst.com>
> Tested-by: Jeff Lien <Jeff.Lien@hgst.com>
> ---

Looks good if we can depend on the enum order. Maybe a more explicit
check for the one type that does support checking chunk sectors instead:

	if (unlikely(rq->cmd_type != REQ_TYPE_FS))

But it looks fine as-is, too.

Reviewed-by: Keith Busch <keith.busch@intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Christoph Hellwig March 2, 2016, 9:18 p.m. UTC | #2
On Wed, Mar 02, 2016 at 07:17:05PM +0000, Keith Busch wrote:
> check for the one type that does support checking chunk sectors instead:
> 
> 	if (unlikely(rq->cmd_type != REQ_TYPE_FS))
> 
> But it looks fine as-is, too.

Yes, that's probably better in the long run.  Jens, can you fold the 
suggestion from Keith into the patch?
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jens Axboe March 2, 2016, 10:16 p.m. UTC | #3
On 03/02/2016 02:18 PM, Christoph Hellwig wrote:
> On Wed, Mar 02, 2016 at 07:17:05PM +0000, Keith Busch wrote:
>> check for the one type that does support checking chunk sectors instead:
>>
>> 	if (unlikely(rq->cmd_type != REQ_TYPE_FS))
>>
>> But it looks fine as-is, too.
>
> Yes, that's probably better in the long run.  Jens, can you fold the
> suggestion from Keith into the patch?

Too late to fold, but I fixed it separately.
diff mbox

Patch

diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index d7f6bca..f831dc0 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -895,7 +895,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_BLOCK_PC))
 		return q->limits.max_hw_sectors;
 
 	if (!q->limits.chunk_sectors || (rq->cmd_flags & REQ_DISCARD))