From patchwork Fri Jan 6 08:33:14 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 40002
Return-Path:
Delivered-To: ouuuleilei@gmail.com
Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp714277wrt;
Fri, 6 Jan 2023 00:38:52 -0800 (PST)
X-Google-Smtp-Source:
AMrXdXuPOXVh/z90emSlJ/NlKd6ghvq4HobvgfO37ozhRnoMPEqkYLXd8cG2OVdYeWqz1RcoopnZ
X-Received: by 2002:a17:907:8b98:b0:840:a6a3:41c7 with SMTP id
tb24-20020a1709078b9800b00840a6a341c7mr49454020ejc.50.1672994332727;
Fri, 06 Jan 2023 00:38:52 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1672994332; cv=none;
d=google.com; s=arc-20160816;
b=nM2v2CPh8DVro4ktqTfw/592Qy69LNXtiBXaAwUhWEicw7yWzJMhF96I1KWmc/GTpL
4E8KvOCVMkSwxFYorZEmIJfhQDlbQjlME9777LOnGdDzjhlPhvcxuNMM6T86ggJGuXo+
PzWtf3YzXf8KJqkqZ+J1yhWVzN9RXu9UnLQRzORVA6w31AuB2AIQUdACD4jPl6vutBnj
BrZh7QfY5AjJVLAVcxZnHX41vD2+7/swCQpw4wXHpTZlXiM7zjrZSpw/zqPwWM/F9WMY
zyUSVh3GnnqI6nPdnFMReQYaT/prq4Scmf1sriUfOKv38kW0T+H3xw9XsU1faq09WKCJ
mTEQ==
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
:mime-version:in-reply-to:message-id:date:subject:cc:to:from
:dkim-signature:dkim-filter;
bh=LXXa5WqRMuw776PYfMbNhiRBXFUIY42wRgq3is6fToE=;
b=u3np/lHd52R/EYT0Hrl6KZZo/DVmAIv3gNWyGgB/qpyYoYYE6VLjuwXn28Ubfil5uT
g5aShD/mA774zGCWVLdSqK2NfRHeLZcb9mds7xsJxqOwe4JyS577u1AqhZFrBo8LI/O7
jDLECXUKYzqMb4jk+nvOfC6+nVhbNamwGdXDj3s8EMdpu2MsyOZGlasWulIVK2oflOJQ
h7fRcx0OslAZh3oM/VPXZ+H6wCEPnXjDzEmEq4AyACl06ZLnKDwVakvgGEIC4bE2b7gG
W9gVgtdvsTfT6kiZ6ajPRn1ReW9mOiMaPWiX/eGmMBOrfaL6KjXZ1BT6mSm5TX6Az+F5
VszQ==
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@samsung.com header.s=mail20170921
header.b=dfYx0haN;
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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20])
by mx.google.com with ESMTP id
e5-20020a170906844500b0084b895b6a22si480897ejy.947.2023.01.06.00.38.29;
Fri, 06 Jan 2023 00:38:52 -0800 (PST)
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=dfYx0haN;
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 S232489AbjAFIee (ORCPT + 99 others);
Fri, 6 Jan 2023 03:34:34 -0500
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48986 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S232452AbjAFId2 (ORCPT
);
Fri, 6 Jan 2023 03:33:28 -0500
Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com
[210.118.77.12])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE33F676CE
for ;
Fri, 6 Jan 2023 00:33:27 -0800 (PST)
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id
20230106083322euoutp02d97892875c4e17f854bb7d8a1a5dfacd~3qy6L_q652168121681euoutp02q
for ;
Fri, 6 Jan 2023 08:33:22 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com
20230106083322euoutp02d97892875c4e17f854bb7d8a1a5dfacd~3qy6L_q652168121681euoutp02q
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1672994003;
bh=LXXa5WqRMuw776PYfMbNhiRBXFUIY42wRgq3is6fToE=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=dfYx0haNy/Z/IHN2Jg15oeG3zyLR+5J6K4SMptCdBwRXbGvciBpxgPLCHxl5okyQT
jFH/oeA9BE98cmeKnb0avDbZ+s1xr5VtTkeLnliH6Ad9xTDeJtYmEEnoSe9md9liaw
QXOltcxuyS4Lln43dbMfeoEP0csvFtq2zs2WKkZ0=
Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTP id
20230106083322eucas1p1c3c3079982519376276cf618f4614634~3qy5RsdUQ1103011030eucas1p1F;
Fri, 6 Jan 2023 08:33:22 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges1new.samsung.com (EUCPMTA) with SMTP id 2F.93.56180.1DCD7B36;
Fri, 6
Jan 2023 08:33:21 +0000 (GMT)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
20230106083321eucas1p15e9087bcc62bc6a4f5a61467e1c98698~3qy44kw8g2243222432eucas1p1A;
Fri, 6 Jan 2023 08:33:21 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20230106083321eusmtrp2d3f5148d45e550f1ae35a15ae7e369b6~3qy436qaB1128211282eusmtrp2B;
Fri, 6 Jan 2023 08:33:21 +0000 (GMT)
X-AuditID: cbfec7f2-acbff7000000db74-9f-63b7dcd19fcb
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id AC.AB.52424.1DCD7B36;
Fri, 6
Jan 2023 08:33:21 +0000 (GMT)
Received: from localhost (unknown [106.210.248.66]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20230106083321eusmtip134788efdb299072ab1171e30bcf8eb04~3qy4l1qIF1412914129eusmtip1J;
Fri, 6 Jan 2023 08:33:21 +0000 (GMT)
From: Pankaj Raghav
To: axboe@kernel.dk
Cc: kernel@pankajraghav.com, linux-kernel@vger.kernel.org,
hare@suse.de, bvanassche@acm.org, snitzer@kernel.org,
dm-devel@redhat.com, damien.lemoal@opensource.wdc.com,
linux-nvme@lists.infradead.org, hch@lst.de,
linux-block@vger.kernel.org, gost.dev@samsung.com,
Pankaj Raghav
Subject: [PATCH 4/7] zonefs: use bdev_zone_no helper to calculate the zone
index
Date: Fri, 6 Jan 2023 09:33:14 +0100
Message-Id: <20230106083317.93938-5-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20230106083317.93938-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFjrGKsWRmVeSWpSXmKPExsWy7djPc7oX72xPNljYZWWx+m4/m8W0Dz+Z
LX6fPc9ssffdbFaLmwd2MlnsWTSJyWLl6qNMFmdefmax2HtL2+LyrjlsFvOXPWW3+Ly0hd3i
xC1pB16Py1e8PS6fLfXYtKqTzWPzknqP3Tcb2Dx2tt5n9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IAwAA
X-CMS-MailID: 20230106083321eucas1p15e9087bcc62bc6a4f5a61467e1c98698
X-Msg-Generator: CA
X-RootMTR: 20230106083321eucas1p15e9087bcc62bc6a4f5a61467e1c98698
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20230106083321eucas1p15e9087bcc62bc6a4f5a61467e1c98698
References: <20230106083317.93938-1-p.raghav@samsung.com>
X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,
DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,
RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS
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
X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?=
X-GMAIL-THRID: =?utf-8?q?1754261705763157969?=
X-GMAIL-MSGID: =?utf-8?q?1754261705763157969?=
Use bdev_zone_no() helper instead of opencoding the logic to find the
zone index.
Signed-off-by: Pankaj Raghav
---
fs/zonefs/super.c | 8 +++-----
fs/zonefs/zonefs.h | 1 -
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
index 2c53fbb8d918..c2ddc62e99dc 100644
--- a/fs/zonefs/super.c
+++ b/fs/zonefs/super.c
@@ -487,7 +487,6 @@ static void __zonefs_io_error(struct inode *inode, bool write)
{
struct zonefs_inode_info *zi = ZONEFS_I(inode);
struct super_block *sb = inode->i_sb;
- struct zonefs_sb_info *sbi = ZONEFS_SB(sb);
unsigned int noio_flag;
unsigned int nr_zones = 1;
struct zonefs_ioerr_data err = {
@@ -502,8 +501,8 @@ static void __zonefs_io_error(struct inode *inode, bool write)
* size is always larger than the device zone size.
*/
if (zi->i_zone_size > bdev_zone_sectors(sb->s_bdev))
- nr_zones = zi->i_zone_size >>
- (sbi->s_zone_sectors_shift + SECTOR_SHIFT);
+ nr_zones =
+ bdev_zone_no(sb->s_bdev, zi->i_zone_size >> SECTOR_SHIFT);
/*
* Memory allocations in blkdev_report_zones() can trigger a memory
@@ -1420,7 +1419,7 @@ static int zonefs_init_file_inode(struct inode *inode, struct blk_zone *zone,
struct zonefs_inode_info *zi = ZONEFS_I(inode);
int ret = 0;
- inode->i_ino = zone->start >> sbi->s_zone_sectors_shift;
+ inode->i_ino = bdev_zone_no(sb->s_bdev, zone->start);
inode->i_mode = S_IFREG | sbi->s_perm;
zi->i_ztype = type;
@@ -1804,7 +1803,6 @@ static int zonefs_fill_super(struct super_block *sb, void *data, int silent)
* interface constraints.
*/
sb_set_blocksize(sb, bdev_zone_write_granularity(sb->s_bdev));
- sbi->s_zone_sectors_shift = ilog2(bdev_zone_sectors(sb->s_bdev));
sbi->s_uid = GLOBAL_ROOT_UID;
sbi->s_gid = GLOBAL_ROOT_GID;
sbi->s_perm = 0640;
diff --git a/fs/zonefs/zonefs.h b/fs/zonefs/zonefs.h
index 1dbe78119ff1..703bc4505b29 100644
--- a/fs/zonefs/zonefs.h
+++ b/fs/zonefs/zonefs.h
@@ -179,7 +179,6 @@ struct zonefs_sb_info {
kgid_t s_gid;
umode_t s_perm;
uuid_t s_uuid;
- unsigned int s_zone_sectors_shift;
unsigned int s_nr_files[ZONEFS_ZTYPE_MAX];