Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp453615ioo; Sat, 21 May 2022 04:15:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxu+QbB+VL5hrPc/0TUsU68YOvEE1gtVSQa5vL4q9w9IR9tvot9MJQ6Pzz4qdVxgli1ZAQ3 X-Received: by 2002:a17:906:794b:b0:6f4:85e1:d7f with SMTP id l11-20020a170906794b00b006f485e10d7fmr12113988ejo.6.1653131707124; Sat, 21 May 2022 04:15:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653131707; cv=none; d=google.com; s=arc-20160816; b=XRUmCw5hfTm8F4q57P6opB8YQtZ9GnQ4HalIHxA+6/pw1VMw3Vq1kJaS9DR/PBLYFW 8abwpDqdH2e3kmdfBJ2C0jTuqQO229hC0egHtu0rWyhV+6jCQSQu08HIRtFXjE7hBqDA Q/VYfBnGu/sFc9kIkruYrnFHtBcPJV4Ix+1owOPdGd1V0BHP5LAUJm+ymSD7LsdajSpT 8hkJmpyCZ8hV9y8oXZVmym5o/BkNUow3iWgOAdI7LXI0CFXN8j2N1Mk6IYpS2TWwIrWY sgNSu9u2dcbJtMY3SrrfSYio+4TYQ5NfGixRWyrWFn5Xcf0iP4H0Vajga5+0zrrsj+2V tq9w== 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=EDj6j9kMtVDfHH3Ex41sLPuCJwXBjQ9MILCkOs8LWTI=; b=ibfUM+4uYKyljJcPWi4+SiwXCEfxbC/o0L2YeCa9FQHD3HzoABY+GQlK0AUTuYzJTQ ZaLiAXDXs0AIt88qn7nmH8/xcCb4RWtODhOlFqBKSvsyCPtRgDcT0AFWwXo/uvJHwI92 JLg7YL1XYoRN1+y3bPiTvaCgZSEpy2uohF1oQtFP34WRsE+2knB8gKicw25l+1/ePr96 imchkfMyJ8+i/Mv5rsVkwgAP6txdCO6E4yALzhxkfrX4WCy7J3++i5EP+rCrzewtLMQ7 qbmY6SPBnwWs48OT/wFoFMWFlC24Of2p2mbsUxMILS2hQVz7OX1VHoJ/qtBknPgr22pB uWvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=kGUiVKPc; 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 gz12-20020a170906f2cc00b006f3786d89f6si11610064ejb.53.2022.05.21.04.14.41; Sat, 21 May 2022 04:15:07 -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=kGUiVKPc; 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 S241563AbiETJJc (ORCPT + 99 others); Fri, 20 May 2022 05:09:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347452AbiETJJ3 (ORCPT ); Fri, 20 May 2022 05:09:29 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDD1313C1E2 for ; Fri, 20 May 2022 02:09:27 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20220520090926euoutp0173815a57c77640dbb50a18f487409ef6~wxRc7RFxA1980019800euoutp01G for ; Fri, 20 May 2022 09:09:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20220520090926euoutp0173815a57c77640dbb50a18f487409ef6~wxRc7RFxA1980019800euoutp01G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1653037766; bh=EDj6j9kMtVDfHH3Ex41sLPuCJwXBjQ9MILCkOs8LWTI=; h=Date:Subject:To:CC:From:In-Reply-To:References:From; b=kGUiVKPcItz2XiHZ74bIYNO1u/vpDWI0Yrs43Jnkt/aQ4Z35We7eBY79PHrs7Y2ZB C52yHtVoZvofaf2AObEEW4bVtwWzd7jobCP1W4+zoYKp17JETYTOXtBlHaS+fidV3E Nbz97JHc9t7yu3Ij6M1+w/UJflMwV4Vwmo9jos9I= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20220520090926eucas1p1bc12b0a9dc442b78da3af9ddc2202325~wxRcsrHdB0182901829eucas1p19; Fri, 20 May 2022 09:09:26 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id B3.9D.10009.6CA57826; Fri, 20 May 2022 10:09:26 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20220520090925eucas1p26954f3932778b1e6d579d50095b3f138~wxRcJyMFD2110521105eucas1p2s; Fri, 20 May 2022 09:09:25 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20220520090925eusmtrp1b0e8eda967a664f924b0e66aa52a2ca9~wxRcI0pXY2190521905eusmtrp1Y; Fri, 20 May 2022 09:09:25 +0000 (GMT) X-AuditID: cbfec7f2-e95ff70000002719-49-62875ac6612c Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id EC.2D.09522.5CA57826; Fri, 20 May 2022 10:09:25 +0100 (BST) Received: from CAMSVWEXC01.scsc.local (unknown [106.1.227.71]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20220520090925eusmtip11d5b71aafeef920d4c670fe714700b5a~wxRb-0jrS1395113951eusmtip1U; Fri, 20 May 2022 09:09:25 +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; Fri, 20 May 2022 10:09:24 +0100 Message-ID: Date: Fri, 20 May 2022 11:09:23 +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 v4 08/13] btrfs:zoned: make sb for npo2 zone devices align with sb log offsets Content-Language: en-US To: Naohiro Aota CC: "axboe@kernel.dk" , "damien.lemoal@opensource.wdc.com" , "pankydev8@gmail.com" , "dsterba@suse.com" , "hch@lst.de" , "linux-nvme@lists.infradead.org" , "linux-fsdevel@vger.kernel.org" , "linux-btrfs@vger.kernel.org" , "jiangbo.365@bytedance.com" , "linux-block@vger.kernel.org" , "gost.dev@samsung.com" , "linux-kernel@vger.kernel.org" , "dm-devel@redhat.com" From: Pankaj Raghav In-Reply-To: <20220519075926.6h4ka3qbo3vv26ve@naota-xeon> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit 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+NgFrrEKsWRmVeSWpSXmKPExsWy7djP87rHotqTDPrnylusvtv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X+tlMTtnfcyc2/cSp1uG5YKSvZ+OqzK4 PhF8evlhzyGHuglXWur4VfY1zLLX4LxYqTk7fXKzrKCp0AvvL+fydE6IS86Wf82QL+FTuDk+ T+tS/8UHe6tPn1t52vTqn/UMgpY3d37ez73sB+O/+Nh/jUf1RBR1lViKMxINtZiLihMBGIST t5sDAAA= X-CMS-MailID: 20220520090925eucas1p26954f3932778b1e6d579d50095b3f138 X-Msg-Generator: CA X-RootMTR: 20220516165429eucas1p272c8b4325a488675f08f2d7016aa6230 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20220516165429eucas1p272c8b4325a488675f08f2d7016aa6230 References: <20220516165416.171196-1-p.raghav@samsung.com> <20220516165416.171196-9-p.raghav@samsung.com> <20220519075926.6h4ka3qbo3vv26ve@naota-xeon> X-Spam-Status: No, score=-8.3 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=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 5/19/22 09:59, Naohiro Aota wrote: >> + >> static int sb_log_location(struct block_device *bdev, struct blk_zone *zones, >> - int rw, u64 *bytenr_ret) >> + int rw, int mirror, u64 *bytenr_ret) >> { >> u64 wp; >> int ret; >> + bool zones_empty = false; >> >> if (zones[0].type == BLK_ZONE_TYPE_CONVENTIONAL) { >> *bytenr_ret = zones[0].start << SECTOR_SHIFT; >> @@ -775,13 +808,31 @@ static int sb_log_location(struct block_device *bdev, struct blk_zone *zones, >> if (ret != -ENOENT && ret < 0) >> return ret; >> >> + if (ret == -ENOENT) >> + zones_empty = true; >> + > > I think, we don't need this. We need to issue the zeroout when > zones[0]->cond == BLK_ZONE_COND_EMPTY && !is_power_of_2(...) after sending > ZONE_RESET if necessary. No? > Yeah. I added this extra check to cover all the cases possible. But you are right that it is enough to issue zeroout only for this condition: zones[0]->cond == BLK_ZONE_COND_EMPTY && !is_power_of_2(...) as both the zones empty is not likely to happen. >> if (rw == WRITE) { >> struct blk_zone *reset = NULL; >> + bool is_sb_offset_write_req = false; >> + u32 reset_zone_nr = -1; >> >> - if (wp == zones[0].start << SECTOR_SHIFT) >> + if (wp == zones[0].start << SECTOR_SHIFT) { >> reset = &zones[0]; >> - else if (wp == zones[1].start << SECTOR_SHIFT) >> + reset_zone_nr = 0;