Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4943715iob; Mon, 9 May 2022 05:24:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwK0QGyCCL+Wf3o0yzv0rmjTLIq75REJqeitSbYH7hYR3NzZR095ukdbfUThPWZTLaF721k X-Received: by 2002:a17:90a:fc8a:b0:1d8:ace3:70bc with SMTP id ci10-20020a17090afc8a00b001d8ace370bcmr26239205pjb.37.1652099081104; Mon, 09 May 2022 05:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652099081; cv=none; d=google.com; s=arc-20160816; b=SEUu9urwTHcO6LxF+hcyzRYwAgWFPgH/CLMK8YTbLYUWect9dN6irNcDo0Q7q288iy xlp+26tVKCJ98DmdLaFXP8yqACXhqHxX6O7p/ksgRTEZ6JQSiHAkc/DbHU4dLuTYC2HO xnkquzYlXDA+/1zcq9Ll1WAGy6x0Smci65f+mSgracTBo3BSkZk0QlttBfT1KKlPP07J kSEte7Qg5Myu4Nj/+gBmwOYMXQ6xe64tPHONjmB+taF3bIC25JQS3TXvJFKpLRVaKSnw PUX9auqXHrpdULuwaoBSSdsipSTBgdntjT9QXWBKcXraSR5Rhq5UpFbv8I0flf6H4Wh1 Eq3w== 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=LRw79LxnO+9lbHN5Ml0ZeqPIsgf1kk4KqFqaSsEFqNo=; b=UFzB6lHsdgYuhteJxPApjpEv5xsfsAHS/liv/1hhuppA46Y9g+FUXs9JE6NEWNy4XM /mcjVbHFfINW0M58auECYS14Gpk8/uu0PW4OflriAPbbevifxXBHZpC3tbTUEjvZY39v 9ACk+DCBR3A3Ac0hGGZd2/MPcCOm/NuxcBleUsBpon5Yyb0VgHvd6bpmz1PwtCnNFiWg V19mQK5Vk75QOkwkI1wUiOqSN0XKEPwAGirlWgkYsgHXBn4zgSZ0ii4SIM+odJf/uDL6 HAfjHKD6zb0bvbX5bkpjGe6UtdBmhMj5zYJpHHASQWykUTD5NkFIpn7kzsTiMNI/2qOa CTbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=enqvCLLH; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id b5-20020a170902d40500b0015cf9502127si9755822ple.267.2022.05.09.05.24.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 05:24:41 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=enqvCLLH; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9E9942421A4; Mon, 9 May 2022 04:56:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233542AbiEIMAg (ORCPT + 99 others); Mon, 9 May 2022 08:00:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233509AbiEIMAe (ORCPT ); Mon, 9 May 2022 08:00:34 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A779724218A for ; Mon, 9 May 2022 04:56:40 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220509115639euoutp0170e7c31b50826f28d973899bace22836~tbdTKvzem2342623426euoutp01B for ; Mon, 9 May 2022 11:56:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220509115639euoutp0170e7c31b50826f28d973899bace22836~tbdTKvzem2342623426euoutp01B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1652097399; bh=LRw79LxnO+9lbHN5Ml0ZeqPIsgf1kk4KqFqaSsEFqNo=; h=Date:Subject:To:CC:From:In-Reply-To:References:From; b=enqvCLLH4SeYtRwOftszp1xVyY2IeY2vfBGT/0OXMVifQ881bdIl84yQXa9igowxt IeDBapekR5etPpyxsZ3sdHWFnth9HxjvqdGv7p6znCA4TesCy7jzljpHybIAvnds7p Jp96xy2jU1USyCXe61JgEV+m/pAfki6Ef+e3XVVk= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220509115636eucas1p1ba44cde73ab43d615481bea150694fcf~tbdRLKZ0w1215112151eucas1p1s; Mon, 9 May 2022 11:56:36 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 8C.64.09887.47109726; Mon, 9 May 2022 12:56:36 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20220509115636eucas1p1d9d67f3b9235d3e46aaa11101bf4f991~tbdQzeA2G2169921699eucas1p1X; Mon, 9 May 2022 11:56:36 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20220509115636eusmtrp219909889bd5adfa8058b3746a9437256~tbdQwWRk81410514105eusmtrp2J; Mon, 9 May 2022 11:56:36 +0000 (GMT) X-AuditID: cbfec7f4-471ff7000000269f-fe-62790174fcd9 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id C2.02.09404.47109726; Mon, 9 May 2022 12:56:36 +0100 (BST) Received: from CAMSVWEXC01.scsc.local (unknown [106.1.227.71]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220509115636eusmtip1e0015a7f6905dc16565c6158d4e6d90e~tbdQiOQ_y0902209022eusmtip1T; Mon, 9 May 2022 11:56:36 +0000 (GMT) Received: from [106.110.32.130] (106.110.32.130) by CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 9 May 2022 12:56:34 +0100 Message-ID: <9f1385a3-b471-fcd9-2c0c-61f544fbc855@samsung.com> Date: Mon, 9 May 2022 13:56:28 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH v3 10/11] null_blk: allow non power of 2 zoned devices Content-Language: en-US To: Damien Le Moal , , , , , , CC: Chris Mason , Josef Bacik , , , , Jens Axboe , , , , , , Naohiro Aota , , Johannes Thumshirn , Sagi Grimberg , Alasdair Kergon , , Chaitanya Kulkarni , Keith Busch , , Luis Chamberlain From: Pankaj Raghav In-Reply-To: <9eb00b42-ca5b-c94e-319d-a0e102b99f02@opensource.wdc.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [106.110.32.130] X-ClientProxiedBy: CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) To CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) X-Brightmail-Tracker: H4sIAAAAAAAAA02Sf1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391UkCfGmJFZWpRblxxeV5qQWH2I0BYbRRGYp0eR8YKLNK4k3 NDMwNTQxszQwtTQzVhLn9SzoSBQSSE8sSc1OTS1ILYLpY+LglGpgEutdsvUh29SNayYI3bn3 XC3v6aKnx0zvfPf5q2d68d+BkI5jy+N9pI4xa0xJUpRuvcc1tdPIRyXifMRvz6/W3QY9Xya9 429XWcOcNIFRp+5Z++EeDVXtyNJLisonHt8QC2yd7igXahLx/HxpW8TupR133r0yTa5c67Lm kOweo56QH63/qiq/am256bbl8YvNBhsV90rZ67W+ySiIu6WTG7D6AKvaoU+b3Xlf3L5trmnZ 4qM1b3VUm99ix8cS1x4unJiU/ez89GzLCJFtQdHKzOYeWR+Pyiy2KnfYpRJ+cL7Wmw6lBPXY mpIHzQLMZ++KPZqwVvpGvNVWFruELVFTOGWOWVU17XiYovX1sGmxEktxRqKhFnNRcSIAtvwA yPwDAAA= X-CMS-MailID: 20220509115636eucas1p1d9d67f3b9235d3e46aaa11101bf4f991 X-Msg-Generator: CA X-RootMTR: 20220506081116eucas1p2cce67bbf30f4c9c4e6854965be41b098 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220506081116eucas1p2cce67bbf30f4c9c4e6854965be41b098 References: <20220506081105.29134-1-p.raghav@samsung.com> <20220506081105.29134-11-p.raghav@samsung.com> <39a80347-af70-8af0-024a-52f92e27a14a@opensource.wdc.com> <9eb00b42-ca5b-c94e-319d-a0e102b99f02@opensource.wdc.com> X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 2022-05-09 13:31, Damien Le Moal wrote: >>>> diff --git a/drivers/block/null_blk/zoned.c b/drivers/block/null_blk/zoned.c >>>> index dae54dd1a..00c34e65e 100644 >>>> --- a/drivers/block/null_blk/zoned.c >>>> +++ b/drivers/block/null_blk/zoned.c >>>> @@ -13,7 +13,10 @@ static inline sector_t mb_to_sects(unsigned long mb) >>>> >>>> static inline unsigned int null_zone_no(struct nullb_device *dev, sector_t sect) >>>> { >>>> - return sect >> ilog2(dev->zone_size_sects); >>>> + if (is_power_of_2(dev->zone_size_sects)) >>>> + return sect >> ilog2(dev->zone_size_sects); >>> >>> As a separate patch, I think we should really have ilog2(dev->zone_size_sects) >>> as a dev field to avoid doing this ilog2 for every call.. >>> >> I don't think that is possible because `zone_size_sects` can also be non >> po2. > > But when it is we can optimize that. All we need is add a "zone_size_sect_shift" > field that is initialized when zone_size_sects is set when the device is > created. Then, you can have code like: > > if (dev->zone_size_sect_shift)) > return sect >> dev->zone_size_sect_shift; > My only concern was confusing people who are reading the code where they might implicitly assume that it can only be po2 as we have shift_sects. Even though I am not sure if this optimization will directly add value looking at my experiments with the current change, I can fold this in with a comment on top of zone_size_sect_shifts variable stating that size can be npo2 and this variable is only meaningful for the po2 size scenario.