Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2616586ioo; Tue, 24 May 2022 01:55:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6E2IiSkYeQZpJYD2kCCQVN3dnPu7IjB689+p8DFiwbi+c31ZNQH0czHR+GwerHH7bpuX7 X-Received: by 2002:a17:906:d54e:b0:6f6:3ea:8e7b with SMTP id cr14-20020a170906d54e00b006f603ea8e7bmr23676101ejc.292.1653382539933; Tue, 24 May 2022 01:55:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653382539; cv=none; d=google.com; s=arc-20160816; b=EJD2FIx8HBo2iOvcEXZMNnCMnC2cDOYSHqo5ar1FbwOyHXvwv5YIIYMDQ5hj6kBDhi AMa32wPFUaypiz8cDRLT//0TxNW8EwSbbDmk058bZw7biD+ZbDoIcbzKaG3/ck+UjtWF 0JDAX1ytMzXTrlDs9l+vU8RNRvvmhyo27i3xVyaEFQ2pz16Fizf5sBluePnm2IdNkUMQ pWm5f87uZFeG6til5nWPLtu7TbXa9z4lWQ738MkT1aIV0mhAHLD6BavRh3zk+EQGupwb 5gKrRNNKFWg/SSDkQOTvZ8GWGW555nFrHiieP+SPDA+AYsjNzIvlv6OL5j/ntFFLrEOR iiRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :in-reply-to:from:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature:dkim-filter; bh=M6Q16BfKCIzyTPg6hPOvIiMvm5i/d35FqYIBmnk7lQ4=; b=X8XMbbQF0maUzrtMEmog4eFTI/ryXFStJLnsWL5AzoH8fN7OmwlP/Lpq6Ingu3BlM5 Qi9al11oq0W7eu+xHV2rNNkyjmPu5SBQIX+U52bnoEJ5u+aH5kKQe/om3uMd60dIYhhe 94VPxRNsu22JacLTd3diIOc+Hur50N4jOi0z3YRpL6L9CucqWawtqgyIpaLZRzO+fZ3l 1NwQ+f1XeVdxeSU1XLgtGMpr1p/WhO5fLhZXWw2mzSK7ycaFpIXjdzkblD1d+Mk2rh3e c2O+TPNeYMhRuJDoAYWWIfRWiKlbllIIyvfPRvXesjDjK0MillvMNx6W5yOwrqD3p031 JVrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=KECRc2Hd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m4-20020aa7c2c4000000b0042ad1d67e7csi16305133edp.590.2022.05.24.01.55.12; Tue, 24 May 2022 01:55:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=KECRc2Hd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234407AbiEXHL4 (ORCPT + 99 others); Tue, 24 May 2022 03:11:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234890AbiEXHLD (ORCPT ); Tue, 24 May 2022 03:11:03 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 725E0939A1 for ; Tue, 24 May 2022 00:10:59 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220524071057euoutp010bbad9e2e94d11a0f274a8e12657bafa~x_PI2POJ32891128911euoutp01F for ; Tue, 24 May 2022 07:10:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220524071057euoutp010bbad9e2e94d11a0f274a8e12657bafa~x_PI2POJ32891128911euoutp01F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1653376257; bh=M6Q16BfKCIzyTPg6hPOvIiMvm5i/d35FqYIBmnk7lQ4=; h=Date:Subject:To:CC:From:In-Reply-To:References:From; b=KECRc2HdAM5LLjvfLQcZ8xjRSiyk/SUFgahMn15QA9TZiqUTqSYw5hXQ/tTlT4bM9 EQjZk/XoxcwnwmouaVkEdZCHdQ2jmR1GsKfSn9e12rZT4grjH1a6PNJPkPipil+P1L F65O9u2lKu0EDwA6CrPUr0puOxOCf55w8cF3E8OA= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220524071057eucas1p1855d95118ad4a2d9cc6b3eb43d9db154~x_PIlUqWT0268302683eucas1p1u; Tue, 24 May 2022 07:10:57 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 45.5C.09887.0058C826; Tue, 24 May 2022 08:10:57 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20220524071056eucas1p1fe9ca64e7d7910c9cf81eb952420a35a~x_PH8Sjm30651106511eucas1p1w; Tue, 24 May 2022 07:10:56 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220524071056eusmtrp19475774e768b4fc9b274dcfc332f4ab0~x_PH58txD0167801678eusmtrp1K; Tue, 24 May 2022 07:10:56 +0000 (GMT) X-AuditID: cbfec7f4-471ff7000000269f-c2-628c8500b490 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id FD.22.09404.0058C826; Tue, 24 May 2022 08:10:56 +0100 (BST) Received: from CAMSVWEXC01.scsc.local (unknown [106.1.227.71]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20220524071056eusmtip202bd84c83b9ad12b546a1192a494994e~x_PHu3Og71582015820eusmtip2C; Tue, 24 May 2022 07:10:56 +0000 (GMT) Received: from [192.168.8.130] (106.210.248.20) by CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 24 May 2022 08:10:54 +0100 Message-ID: <214e0c82-ce20-ba0f-77bd-21f3b83fd1f1@samsung.com> Date: Tue, 24 May 2022 09:10:53 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v5 2/7] block: allow blk-zoned devices to have non-power-of-2 zone size Content-Language: en-US To: Hannes Reinecke , , , , , CC: , , , , , , , , Luis Chamberlain From: Pankaj Raghav In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [106.210.248.20] X-ClientProxiedBy: CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) To CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrDKsWRmVeSWpSXmKPExsWy7djPc7qMrT1JBic+MFqsvtvPZvH77Hlm i73vZrNaXPjRyGSxZ9EkJouVq48yWTxZP4vZoufABxaLv133mCz23tK2uLxrDpvF/GVP2S1u THjKaNG28SujA5/HvxNr2Dwuny312LSqk81j85J6j903G9g8drbeZ/V4v+8qm8f6LVdZPDaf rvb4vEnOo/1AN1MAdxSXTUpqTmZZapG+XQJXxs+px9gKjg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4EAPABXj+lAwAA X-CMS-MailID: 20220524071056eucas1p1fe9ca64e7d7910c9cf81eb952420a35a X-Msg-Generator: CA X-RootMTR: 20220523161606eucas1p2676c4d47f9fcb145f69b29db1f04fe6e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220523161606eucas1p2676c4d47f9fcb145f69b29db1f04fe6e References: <20220523161601.58078-1-p.raghav@samsung.com> <20220523161601.58078-3-p.raghav@samsung.com> X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/24/22 07:19, Hannes Reinecke wrote: >> diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h >> index c4e4c7071b7b..f5c7a41032ba 100644 >> --- a/include/linux/blkdev.h >> +++ b/include/linux/blkdev.h >> @@ -676,6 +676,21 @@ static inline unsigned int >> blk_queue_zone_no(struct request_queue *q, >>       return div64_u64(sector, zone_sectors); >>   } >>   +static inline bool blk_queue_is_zone_start(struct request_queue *q, >> sector_t sec) >> +{ >> +    sector_t zone_sectors = blk_queue_zone_sectors(q); >> +    u64 remainder = 0; >> + >> +    if (!blk_queue_is_zoned(q)) >> +        return false; >> + > > Not sure if we need this here; surely blk_queue_zone_sectors() will > already barf, and none of the callers did this check. > I totally agree with you but all the other blk_queue_* functions had this defensive check and I didn't want to break that pattern: static inline unsigned int blk_queue_zone_no(struct request_queue *q, sector_t sector) { .... if (!blk_queue_is_zoned(q)) return 0; .... } >> +    if (is_power_of_2(zone_sectors)) >> +        return IS_ALIGNED(sec, zone_sectors); >> + And, if the chunk sectors is 0, then we will do the npo2 calculation resulting in a divide by zero even though chances of that happening is very very low as you pointed out. >> +    div64_u64_rem(sec, zone_sectors, &remainder); >> +    return remainder == 0; >> +} >> + >>   static inline bool blk_queue_zone_is_seq(struct request_queue *q, >>                        sector_t sector) >>   { >> @@ -722,6 +737,12 @@ static inline unsigned int >> blk_queue_zone_no(struct request_queue *q, >>   { >>       return 0; >>   } >> + >> +static inline bool blk_queue_is_zone_start(struct request_queue *q, >> sector_t sec) >> +{ >> +    return false; >> +} >> + >>   static inline unsigned int queue_max_open_zones(const struct >> request_queue *q) >>   { >>       return 0; > Otherwise looks good. > Thanks! > Cheers, > > Hannes