From patchwork Tue Aug 16 13:15:30 2022
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 12944917
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 34979C25B0E
for ; Tue, 16 Aug 2022 13:16:00 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S235599AbiHPNP6 (ORCPT );
Tue, 16 Aug 2022 09:15:58 -0400
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45804 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S234805AbiHPNPu (ORCPT
);
Tue, 16 Aug 2022 09:15:50 -0400
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1F456173C
for ;
Tue, 16 Aug 2022 06:15:48 -0700 (PDT)
Received: from eucas1p2.samsung.com (unknown [182.198.249.207])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20220816131547euoutp01d5e750a06ecb5bdb8f1ed1ec57722ddb~L1ZqZGlgD0139901399euoutp01K
for ;
Tue, 16 Aug 2022 13:15:47 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20220816131547euoutp01d5e750a06ecb5bdb8f1ed1ec57722ddb~L1ZqZGlgD0139901399euoutp01K
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1660655747;
bh=2l9t4o2MFdGXGYEr9szOD+OY2x6nysmCjdo7iJiFJ2A=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=MgMRZtU2DkkDs7kBjuB0y+SrD21UrBtYAk5nAqcR/n7xykNigtyUpt9by5vYXNNEO
aB4ipyR+zNUmXGr7TxN3kO+5t/U4b63zUdt2AUVUejCt/vIjQGOp1r0xh2LgTXMgNn
DEcOWLIQ4x23tFXebZAOA+t96iLU2aVqLL5fUAMg=
Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTP id
20220816131545eucas1p28cf18191fdc6dd8930e5677125a18d3b~L1ZotJ89I1908319083eucas1p2h;
Tue, 16 Aug 2022 13:15:45 +0000 (GMT)
Received: from eucas1p2.samsung.com ( [182.198.249.207]) by
eusmges3new.samsung.com (EUCPMTA) with SMTP id 8F.65.09580.1889BF26;
Tue, 16
Aug 2022 14:15:45 +0100 (BST)
Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by
eucas1p2.samsung.com (KnoxPortal) with ESMTPA id
20220816131545eucas1p2cc7e6aad76abbe106a695f7396d38344~L1ZoHANYT3098130981eucas1p2D;
Tue, 16 Aug 2022 13:15:45 +0000 (GMT)
Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by
eusmtrp2.samsung.com (KnoxPortal) with ESMTP id
20220816131545eusmtrp2e20876f331f41415549ea0fe23d6a07a~L1ZoGO_zg0621306213eusmtrp2M;
Tue, 16 Aug 2022 13:15:45 +0000 (GMT)
X-AuditID: cbfec7f5-9c3ff7000000256c-e6-62fb98813cd2
Received: from eusmtip1.samsung.com ( [203.254.199.221]) by
eusmgms2.samsung.com (EUCPMTA) with SMTP id A0.31.09038.0889BF26;
Tue, 16
Aug 2022 14:15:44 +0100 (BST)
Received: from localhost (unknown [106.210.248.74]) by eusmtip1.samsung.com
(KnoxPortal) with ESMTPA id
20220816131544eusmtip1d1134ed1ce5b864a51b18f04079f7d8b~L1ZnuzEBj2502525025eusmtip15;
Tue, 16 Aug 2022 13:15:44 +0000 (GMT)
From: Pankaj Raghav
To: damien.lemoal@opensource.wdc.com, axboe@kernel.dk,
snitzer@kernel.org, hch@lst.de, agk@redhat.com
Cc: pankydev8@gmail.com, gost.dev@samsung.com, matias.bjorling@wdc.com,
hare@suse.de, bvanassche@acm.org, linux-kernel@vger.kernel.org,
dm-devel@redhat.com, linux-nvme@lists.infradead.org,
jaegeuk@kernel.org, Johannes.Thumshirn@wdc.com,
linux-block@vger.kernel.org, Pankaj Raghav ,
Luis Chamberlain
Subject: [PATCH v11 07/13] zonefs: allow non power of 2 zoned devices
Date: Tue, 16 Aug 2022 15:15:30 +0200
Message-Id: <20220816131536.189406-8-p.raghav@samsung.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220816131536.189406-1-p.raghav@samsung.com>
MIME-Version: 1.0
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFnrAKsWRmVeSWpSXmKPExsWy7djP87qNM34nGRxdr26x/tQxZovVd/vZ
LKZ9+Mls8fvseWaLve9ms1rcPLCTyWLPoklMFitXH2WyeLJ+FrPF3657TBZ7b2lbXN41h81i
/rKn7BYT2r4yW9yY8JTR4vPSFnaLNTefslicuCXtIORx+Yq3x85Zd9k9Lp8t9di0qpPNY/OS
eo/dNxvYPHa23mf1eL/vKptH35ZVjB6bT1d7fN4k59F+oJspgCeKyyYlNSezLLVI3y6BK+PB
hMSCFsGKFX+qGxgn8XUxcnJICJhInL57gKWLkYtDSGAFo8TB8+dZQBJCAl8YJVY260MkPjNK
3J52hwmmY9WDiWwQRcsZJV58c4IoesEo8aP1FlARBwebgJZEYyc7SI2IQLrElJaXYBuYBe4w
SZx6txUsISzgKnFqz0NmEJtFQFXi9tQXYAt4BawkWs98Z4RYJi8x89J3sHpOAWuJfw2rWCBq
BCVOznwCZjMD1TRvnc0MskBCYD2nxOW5F1lBjpAQcJG4dlgKYo6wxKvjW9ghbBmJ/zvnQz1T
LfH0xm+o3hZGif6d69kgeq0l+s7kgJjMApoS63fpQ5Q7Siy+sJcdooJP4sZbQYgL+CQmbZvO
DBHmlehoE4KoVpLY+fMJ1FIJictNc1ggbA+Jg/8/M01gVJyF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JW5PfQEW5xWwkmg98x1qgbzE
zEvfwQZxClhL/GtYxQJiCwHVtB27zAxRLyhxcuYTsDgzUH3z1tnMExgFZiFJzUKSWsDItIpR
JLW0ODc9t9hIrzgxt7g0L10vOT93EyMwbrcd+7llB+PKVx/1DjEycTAeYpTgYFYS4RV88SNJ
iDclsbIqtSg/vqg0J7X4EKMp0N0TmaVEk/OBiSOvJN7QzMDU0MTM0sDU0sxYSZzXs6AjUUgg
PbEkNTs1tSC1CKaPiYNTqoHJlmE+87pfaysvek3+oZJi+Oq0ml/oYbG3R0/9VRSqmtJ2elNP
/6xwxY1rvN5nzAjcrPJpikKUxpZXQmosBvdm73t3e1KJUtyfTIVjvb+t4xpm75xz/eicvNIv
aa8YoxJZj2b6/H1kdd3HQ/tk9zbtL7mPlQqFteL4Xz5gLe9T+pLWtILjG+v6h7/8Ha8qFIml
7l3s1xwZuEn7vNFZIbktb0sMWhXmTjgpdLlE58PVhcL7xZoME15O4w9XzRRZ2ZShuW/qtMTN
BwNlzrjdqf8/s1jmdfH2p0peWzcWRrh7mc1Vf5j4rjl439L9X/Yqp1U+vlLn3cDPfnfW5DeL
BTijt/y5U3TqWpzaytrXZgZ8SizFGYmGWsxFxYkAbgLaMGQDAAA=
X-CMS-MailID: 20220816131545eucas1p2cc7e6aad76abbe106a695f7396d38344
X-Msg-Generator: CA
X-RootMTR: 20220816131545eucas1p2cc7e6aad76abbe106a695f7396d38344
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20220816131545eucas1p2cc7e6aad76abbe106a695f7396d38344
References: <20220816131536.189406-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];