All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pankaj Raghav <p.raghav@samsung.com>
To: axboe@kernel.dk, hch@lst.de, damien.lemoal@opensource.wdc.com,
	dsterba@suse.com, jaegeuk@kernel.org, bvanassche@acm.org,
	hare@suse.de
Cc: jonathan.derrick@linux.dev, jiangbo.365@bytedance.com,
	matias.bjorling@wdc.com, gost.dev@samsung.com,
	pankydev8@gmail.com, Pankaj Raghav <p.raghav@samsung.com>,
	Luis Chamberlain <mcgrof@kernel.org>,
	Naohiro Aota <naohiro.aota@wdc.com>,
	Johannes Thumshirn <jth@kernel.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 09/11] zonefs: allow non power of 2 zoned devices
Date: Thu,  5 May 2022 15:47:09 +0200	[thread overview]
Message-ID: <20220505134710.132630-10-p.raghav@samsung.com> (raw)
In-Reply-To: <20220505134710.132630-1-p.raghav@samsung.com>

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.

Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
---
 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 978a35c45..50a1e000c 100644
--- a/fs/zonefs/super.c
+++ b/fs/zonefs/super.c
@@ -451,10 +451,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,
@@ -1375,7 +1374,7 @@ static int zonefs_init_file_inode(struct inode *inode, struct blk_zone *zone,
 	struct zonefs_inode_info *zi = ZONEFS_I(inode);
 	int ret;
 
-	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;
@@ -1752,7 +1751,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 4b3de66c3..39895195c 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];
 
-- 
2.25.1


  parent reply	other threads:[~2022-05-05 13:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220505134710.132630-1-p.raghav@samsung.com>
     [not found] ` <CGME20220505134934eucas1p2de726a86c47310171425a17a7ce2858b@eucas1p2.samsung.com>
2022-05-05 13:47   ` [PATCH v2 01/11] block: make blkdev_nr_zones and blk_queue_zone_no generic for npo2 zsze Pankaj Raghav
     [not found] ` <CGME20220505135100eucas1p29e1b1452cc81a76460b938df339cb91a@eucas1p2.samsung.com>
2022-05-05 13:47   ` [PATCH v2 02/11] block: allow blk-zoned devices to have non-power-of-2 zone size Pankaj Raghav
     [not found] ` <CGME20220505135101eucas1p10477067397a4fdadf9fe7adbb26d1edc@eucas1p1.samsung.com>
2022-05-05 13:47   ` [PATCH v2 03/11] nvme: zns: Allow ZNS drives that have non-power_of_2 " Pankaj Raghav
     [not found] ` <CGME20220505135102eucas1p10efc01a623d97cbd6634943faa506353@eucas1p1.samsung.com>
2022-05-05 13:47   ` [PATCH v2 04/11] nvmet: Allow ZNS target to support non-power_of_2 zone sizes Pankaj Raghav
     [not found] ` <CGME20220505135104eucas1p1bed3e1e47255518296b4cb15ec0c042b@eucas1p1.samsung.com>
2022-05-05 13:47   ` [PATCH v2 05/11] btrfs: zoned: Cache superblock location in btrfs_zoned_device_info Pankaj Raghav
     [not found] ` <CGME20220505135105eucas1p1428258bde56a77a96d98509a2c0d5fe9@eucas1p1.samsung.com>
2022-05-05 13:47   ` [PATCH v2 06/11] btrfs: zoned: Make sb_zone_number function non power of 2 compatible Pankaj Raghav
     [not found] ` <CGME20220505135106eucas1p18d4d0bc1e5fb02375229b05b6dbdf92c@eucas1p1.samsung.com>
2022-05-05 13:47   ` [PATCH v2 07/11] btrfs: zoned: use generic btrfs zone helpers to support npo2 zoned devices Pankaj Raghav
     [not found] ` <CGME20220505135108eucas1p295ecfd1113baa72d7522416a761a983c@eucas1p2.samsung.com>
2022-05-05 13:47   ` [PATCH v2 08/11] btrfs: zoned: relax the alignment constraint for " Pankaj Raghav
     [not found] ` <CGME20220505135109eucas1p168fb7625ef67de5a1f98520cdd29311e@eucas1p1.samsung.com>
2022-05-05 13:47   ` Pankaj Raghav [this message]
     [not found] ` <CGME20220505135110eucas1p1fc49b2574920b9a2a274f9d77feb5d18@eucas1p1.samsung.com>
2022-05-05 13:47   ` [PATCH v2 10/11] null_blk: allow non power of 2 " Pankaj Raghav
     [not found] ` <CGME20220505135111eucas1p218b79f4b1e54bb3a24d2ec189ec445d1@eucas1p2.samsung.com>
2022-05-05 13:47   ` [PATCH v2 11/11] dm-zoned: ensure only power of 2 zone sizes are allowed Pankaj Raghav
2022-05-05 13:47     ` [dm-devel] " Pankaj Raghav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220505134710.132630-10-p.raghav@samsung.com \
    --to=p.raghav@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=dsterba@suse.com \
    --cc=gost.dev@samsung.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=jaegeuk@kernel.org \
    --cc=jiangbo.365@bytedance.com \
    --cc=jonathan.derrick@linux.dev \
    --cc=jth@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matias.bjorling@wdc.com \
    --cc=mcgrof@kernel.org \
    --cc=naohiro.aota@wdc.com \
    --cc=pankydev8@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.