From patchwork Sat Jun 4 03:57:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 9154429 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DC07060865 for ; Sat, 4 Jun 2016 02:16:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CC48C2833E for ; Sat, 4 Jun 2016 02:16:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0E5D28352; Sat, 4 Jun 2016 02:16:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=2.0 tests=BAYES_00, RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7055728346 for ; Sat, 4 Jun 2016 02:16:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751021AbcFDCQa (ORCPT ); Fri, 3 Jun 2016 22:16:30 -0400 Received: from p3plsmtps2ded01.prod.phx3.secureserver.net ([208.109.80.58]:46401 "EHLO p3plsmtps2ded01.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750785AbcFDCQ3 (ORCPT ); Fri, 3 Jun 2016 22:16:29 -0400 Received: from linuxonhyperv.com ([72.167.245.219]) by : HOSTING RELAY : with SMTP id 915cb8UzlhbQ3915cbgSAH; Fri, 03 Jun 2016 19:13:28 -0700 x-originating-ip: 72.167.245.219 Received: by linuxonhyperv.com (Postfix, from userid 511) id DC67922B817E; Fri, 3 Jun 2016 20:58:00 -0700 (PDT) From: Long Li To: "James E.J. Bottomley" , "Martin K. Petersen" Cc: Long Li , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] sd: remove redundant check for BLK_DEF_MAX_SECTORS Date: Fri, 3 Jun 2016 20:57:58 -0700 Message-Id: <1465012678-32547-1-git-send-email-longli@microsoft.com> X-Mailer: git-send-email 1.7.4.1 X-CMAE-Envelope: MS4wfIRVXIijeNwmsCfRUgYqeBSV9k9fNc0tT0+MEGQ67XC4aAsx7uaLHacIy4hk9nh+kI5geAVDWnUjktTVphOGAxq3kRk9/QByzTrtZaQ7idmMhJK2bA/m lhBdgyzAZpfId+usj7tPtPtB5JILrr68uu2BTAzaEJ1iPizJQp1zuk4GUxR8IlN5TynPrhpucVSUATaGBSjYyrBR4CE1GnWjRXBJxi/LJO4H4Xptx+RPIPgD bVBrqQ+GQbx+v09YtaujsA7H9Mhs8zxC4Uu6OaEgu4i8mAZw/74jR7nNplfUEzWMG0nrflZumQ+NOM3gPnY17xxBYcewO+wppzo9ZdrLoqw= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP q->limits.max_sectors is already checked against BLK_DEF_MAX_SECTORS in __scsi_alloc_queue(), when it calls blk_queue_max_hw_sectors(). There is no need to check it again in sd. This change also allows a SCSI driver set an maximum sector size bigger than BLK_DEF_MAX_SECTORS, without returning values on optional VPD page 0xb0 "Block Limits". Signed-off-by: Long Li --- drivers/scsi/sd.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 60bff78..d8c4047 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2870,11 +2870,8 @@ static int sd_revalidate_disk(struct gendisk *disk) logical_to_bytes(sdp, sdkp->opt_xfer_blocks) >= PAGE_SIZE) { q->limits.io_opt = logical_to_bytes(sdp, sdkp->opt_xfer_blocks); rw_max = logical_to_sectors(sdp, sdkp->opt_xfer_blocks); - } else - rw_max = BLK_DEF_MAX_SECTORS; - - /* Combine with controller limits */ - q->limits.max_sectors = min(rw_max, queue_max_hw_sectors(q)); + q->limits.max_sectors = min(rw_max, queue_max_hw_sectors(q)); + } set_capacity(disk, logical_to_sectors(sdp, sdkp->capacity)); sd_config_write_same(sdkp);