From patchwork Tue Oct 10 20:54:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 9997727 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 0328B601AE for ; Tue, 10 Oct 2017 20:54:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA27E28703 for ; Tue, 10 Oct 2017 20:54:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DEBF828709; Tue, 10 Oct 2017 20:54:37 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 93AFD28703 for ; Tue, 10 Oct 2017 20:54:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933565AbdJJUyg (ORCPT ); Tue, 10 Oct 2017 16:54:36 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:6685 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933507AbdJJUy3 (ORCPT ); Tue, 10 Oct 2017 16:54:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1507668870; x=1539204870; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=P4JNP3JaWt4bLd7UlCwAz7Zf4XFRhufOqNYzdPcflWo=; b=fUwkFhQ5qd7JPAckI4Qhv0R8pU10ENkoLBhMT10E1TGYxaXsy+H1+XVz N8Nlfu+1NybOxQs1+cx3PP4UBhbin6vg0QCQVeV29Uon4tiUAHY7e76ok D0aYsmSvmlv9agaCS6khOIYAsoBwHCjeipUTM3RCBJUsHfG4AxxsnfdUX 5dn1CGgYSCeISgVwgLnJ92Z50nCwUXpy9C0wdvqhPIIcgJ3Tt1mvOpjFa /HaE33k+29VbEQbgod/L2THipsLcXSmOIvDXqSfWSf1dfOFOFsHgS8vPa bk4+09xlQnmcGJEzbTBXVdEa+j2HWXuxxBENycj1jR9MTWKn12mkVd2cd g==; X-IronPort-AV: E=Sophos;i="5.43,359,1503331200"; d="scan'208";a="57098095" Received: from sjappemgw11.hgst.com (HELO sjappemgw12.hgst.com) ([199.255.44.62]) by ob1.hgst.iphmx.com with ESMTP; 11 Oct 2017 04:54:29 +0800 Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by sjappemgw12.hgst.com with ESMTP; 10 Oct 2017 13:54:28 -0700 From: Damien Le Moal To: linux-scsi@vger.kernel.org, "Martin K . Petersen" Cc: Christoph Hellwig , Bart Van Assche Subject: [PATCH 3/5] scsi: sd_zbc: Rearrange code Date: Wed, 11 Oct 2017 05:54:23 +0900 Message-Id: <20171010205425.7376-4-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171010205425.7376-1-damien.lemoal@wdc.com> References: <20171010205425.7376-1-damien.lemoal@wdc.com> 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 Rearrange sd_zbc_setup() to include use_16_for_rw and use_10_for_rw assignments and move the calculation of sdkp->zone_shift together with the assignment of the verified zone_blocks value in sd_zbc_check_zone_size(). No functional change is introduced by this patch. Signed-off-by: Damien Le Moal Reviewed-by: Christoph Hellwig Reviewed-by: Bart Van Assche --- drivers/scsi/sd_zbc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c index 023f705ae235..7dbaf920679e 100644 --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -584,6 +584,7 @@ static int sd_zbc_check_zone_size(struct scsi_disk *sdkp) } sdkp->zone_blocks = zone_blocks; + sdkp->zone_shift = ilog2(zone_blocks); return 0; } @@ -591,10 +592,13 @@ static int sd_zbc_check_zone_size(struct scsi_disk *sdkp) static int sd_zbc_setup(struct scsi_disk *sdkp) { + /* READ16/WRITE16 is mandatory for ZBC disks */ + sdkp->device->use_16_for_rw = 1; + sdkp->device->use_10_for_rw = 0; + /* chunk_sectors indicates the zone size */ blk_queue_chunk_sectors(sdkp->disk->queue, logical_to_sectors(sdkp->device, sdkp->zone_blocks)); - sdkp->zone_shift = ilog2(sdkp->zone_blocks); sdkp->nr_zones = sdkp->capacity >> sdkp->zone_shift; if (sdkp->capacity & (sdkp->zone_blocks - 1)) sdkp->nr_zones++; @@ -657,10 +661,6 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buf) if (ret) goto err; - /* READ16/WRITE16 is mandatory for ZBC disks */ - sdkp->device->use_16_for_rw = 1; - sdkp->device->use_10_for_rw = 0; - return 0; err: