From patchwork Wed Aug 3 09:47:55 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12935333
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by smtp.lore.kernel.org (Postfix) with ESMTP id BD702C25B07
for ; Wed, 3 Aug 2022 09:48:22 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S237574AbiHCJsU (ORCPT );
Wed, 3 Aug 2022 05:48:20 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59022 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S237525AbiHCJsP (ORCPT
); Wed, 3 Aug 2022 05:48:15 -0400
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF7371CB12
for ;
Wed, 3 Aug 2022 02:48:14 -0700 (PDT)
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20220803094812euoutp015a55c77213e5de6d2db6e9ea67b3e676~HzLtcr1Nf3234332343euoutp01f
for ;
Wed, 3 Aug 2022 09:48:12 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20220803094812euoutp015a55c77213e5de6d2db6e9ea67b3e676~HzLtcr1Nf3234332343euoutp01f
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1659520092;
bh=2l9t4o2MFdGXGYEr9szOD+OY2x6nysmCjdo7iJiFJ2A=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=oygDXWXdhS5//5n2wO4kaUTElYy+b38a8qHOU23nThmJMR9cq/3X8k1Kz57eWzmsW
iu+b9ApTpHw/EDpdjn4X5Z8HGHM/Zi+5a1F+UwU/TTj2D8UlhT87sVoZPEAQzVotw3
NJrLRn77cxVh2Rortwa4kZvN4/CTzQOnyuOB8W4g=
Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTP id
20220803094810eucas1p13ef520e51d3ca7b5822a11e2d1d1af1b~HzLrqKrSc1447714477eucas1p1G;
Wed, 3 Aug 2022 09:48:10 +0000 (GMT)
Received: from eucas1p1.samsung.com ( [182.198.249.206]) by
eusmges2new.samsung.com (EUCPMTA) with SMTP id 11.06.10067.A544AE26;
Wed, 3
Aug 2022 10:48:10 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p1.samsung.com (KnoxPortal) with ESMTPA id
20220803094810eucas1p1304a82ba94d0265c3f6a8a371e5127a7~HzLq8-nPY3109731097eucas1p1S;
Wed, 3 Aug 2022 09:48:10 +0000 (GMT)
Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220803094810eusmtrp2d87915093087080592522be7fa4346e1~HzLq8LrDT0972009720eusmtrp2d;
Wed, 3 Aug 2022 09:48:10 +0000 (GMT)
X-AuditID: cbfec7f4-dd7ff70000002753-4c-62ea445afc23
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms1.samsung.com (EUCPMTA) with SMTP id 10.EB.09095.9544AE26;
Wed, 3
Aug 2022 10:48:09 +0100 (BST)
Received: from localhost (unknown [106.210.248.112]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20220803094809eusmtip1d73b9053f698e1f43a7bd40d4f7d177b~HzLqlR4Nk2555925559eusmtip1j;
Wed, 3 Aug 2022 09:48:09 +0000 (GMT)
From: Pankaj Raghav
To: Johannes.Thumshirn@wdc.com, snitzer@kernel.org, axboe@kernel.dk,
damien.lemoal@opensource.wdc.com, agk@redhat.com, hch@lst.de
Cc: dm-devel@redhat.com, matias.bjorling@wdc.com, gost.dev@samsung.com,
linux-kernel@vger.kernel.org, pankydev8@gmail.com,
jaegeuk@kernel.org, hare@suse.de, linux-block@vger.kernel.org,
linux-nvme@lists.infradead.org, bvanassche@acm.org,
Pankaj Raghav ,
Luis Chamberlain
Subject: [PATCH v9 07/13] zonefs: allow non power of 2 zoned devices
Date: Wed, 3 Aug 2022 11:47:55 +0200
Message-Id: <20220803094801.177490-8-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220803094801.177490-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFnrMKsWRmVeSWpSXmKPExsWy7djPc7pRLq+SDA6c0LVYf+oYs8Xqu/1s
FtM+/GS2+H32PLPF3nezWS1uHtjJZLFn0SQmi5WrjzJZPFk/i9nib9c9Jou9t7QtLu+aw2Yx
f9lTdosJbV+ZLW5MeMpo8XlpC7vFmptPWSxO3JJ2EPK4fMXbY+esu+wel8+Wemxa1cnmsXlJ
vcfumw1sHjtb77N6vN93lc2jb8sqRo/Np6s9Pm+S82g/0M0UwBPFZZOSmpNZllqkb5fAlfFg
QmJBi2DFij/VDYyT+LoYOTkkBEwkjq34xdrFyMUhJLCCUeLY34VQzhdGiZf/PzFBOJ8ZJT71
rmeFabnz6jUzRGI5o8TN7n0sIAkhgZeMEl3zKrsYOTjYBLQkGjvZQWpEBJoZJe7+7QEbyyxw
gEni5pZbTCANwgIuEn+2/WAEsVkEVCUeTnkJNohXwEri8aVfjBDb5CVmXvrODmJzClhLTPn3
jxmiRlDi5MwnYPXMQDXNW2eDXSQhsJ1T4u2OdWwQzS4SXSueQdnCEq+Ob2GHsGUk/u+czwRh
V0s8vfEbqrmFUaJ/53o2kBckgLb1nckBMZkFNCXW79KHKHeUWD77HhNEBZ/EjbeCECfwSUza
Np0ZIswr0dEmBFGtJLHz5xOopRISl5vmsEDYHhKdv/6z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GUlywgNq+AlcTjS7+g
NshLzLz0nR3E5hSwlpjy7x8ziC0EVLPu7yxWiHpBiZMzn4D1MgPVN2+dzTyBUWAWktQsJKkF
jEyrGEVSS4tz03OLDfWKE3OLS/PS9ZLzczcxAmN327Gfm3cwznv1Ue8QIxMH4yFGCQ5mJRHe
Oy7Pk4R4UxIrq1KL8uOLSnNSiw8xmgLdPZFZSjQ5H5g88kriDc0MTA1NzCwNTC3NjJXEeT0L
OhKFBNITS1KzU1MLUotg+pg4OKUamGKr9Wa18c/aqVT53lNYiv2J/k6Pdub/U6MuhG9fpddu
cXvW1+O787ZEn16pvysqhzHBpnOhdFBW1vVzi40eMRn4bo2I1DLfdEPv4FPfxdrzTXpKt5+L
qLOKqz8189mLROUwdelniXO53iqs89h8L+S6u/qZTPUMhcLw/Qzaq02n/wtOO3X5tPGFuPTZ
9zSnsrl929M82XfWtB+3+/p69/1fGDIv5a3OrXm+bFbvNLiUllbKb//Q8/WayKscsY0fhW0y
gxKuM3BJWPOxVqocn7cgeZfQdhOO4w9lt0SueRb6K2mRWc+u+LI/XGxmoremL2hzCpihvGfn
6wPrXWfN4VgkPfHb7ScPf6fOsT+lma7EUpyRaKjFXFScCAAFxu0AZgMAAA==
X-CMS-MailID: 20220803094810eucas1p1304a82ba94d0265c3f6a8a371e5127a7
X-Msg-Generator: CA
X-RootMTR: 20220803094810eucas1p1304a82ba94d0265c3f6a8a371e5127a7
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220803094810eucas1p1304a82ba94d0265c3f6a8a371e5127a7
References: <20220803094801.177490-1-p.raghav@samsung.com>
Precedence: bulk
List-ID:
X-Mailing-List: linux-block@vger.kernel.org
The zone size shift variable is useful only if the zone sizes are known
to be power of 2. Remove that variable and use generic helpers from
block layer to calculate zone index in zonefs.
Acked-by: Damien Le Moal
Reviewed-by: Luis Chamberlain
Signed-off-by: Pankaj Raghav
---
fs/zonefs/super.c | 6 ++----
fs/zonefs/zonefs.h | 1 -
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
index 860f0b1032c6..e549ef16738c 100644
--- a/fs/zonefs/super.c
+++ b/fs/zonefs/super.c
@@ -476,10 +476,9 @@ 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 =
- zi->i_zone_size >> (sbi->s_zone_sectors_shift + SECTOR_SHIFT);
+ bdev_zone_no(sb->s_bdev, zi->i_zone_size >> SECTOR_SHIFT);
struct zonefs_ioerr_data err = {
.inode = inode,
.write = write,
@@ -1401,7 +1400,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;
@@ -1776,7 +1775,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 4b3de66c3233..39895195cda6 100644
--- a/fs/zonefs/zonefs.h
+++ b/fs/zonefs/zonefs.h
@@ -177,7 +177,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];