From: Pankaj Raghav <p.raghav@samsung.com> 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 <p.raghav@samsung.com> Subject: [PATCH 4/7] zonefs: use bdev_zone_no helper to calculate the zone index Date: Fri, 6 Jan 2023 09:33:14 +0100 [thread overview] Message-ID: <20230106083317.93938-5-p.raghav@samsung.com> (raw) In-Reply-To: <20230106083317.93938-1-p.raghav@samsung.com> Use bdev_zone_no() helper instead of opencoding the logic to find the zone index. Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> --- 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]; -- 2.25.1
WARNING: multiple messages have this Message-ID (diff)
From: Pankaj Raghav <p.raghav@samsung.com> To: axboe@kernel.dk Cc: Pankaj Raghav <p.raghav@samsung.com>, bvanassche@acm.org, gost.dev@samsung.com, damien.lemoal@opensource.wdc.com, snitzer@kernel.org, linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, kernel@pankajraghav.com, dm-devel@redhat.com, hch@lst.de Subject: [dm-devel] [PATCH 4/7] zonefs: use bdev_zone_no helper to calculate the zone index Date: Fri, 6 Jan 2023 09:33:14 +0100 [thread overview] Message-ID: <20230106083317.93938-5-p.raghav@samsung.com> (raw) In-Reply-To: <20230106083317.93938-1-p.raghav@samsung.com> Use bdev_zone_no() helper instead of opencoding the logic to find the zone index. Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> --- 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]; -- 2.25.1 -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel
next prev parent reply other threads:[~2023-01-06 8:34 UTC|newest] Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <CGME20230106083318eucas1p1a2ab71a95ab2906b4651538c63a94ae2@eucas1p1.samsung.com> 2023-01-06 8:33 ` [PATCH 0/7] block zoned cleanups Pankaj Raghav 2023-01-06 8:33 ` [dm-devel] " Pankaj Raghav [not found] ` <CGME20230106083319eucas1p1e58f4ab0d3ff59a328a2da2922d76038@eucas1p1.samsung.com> 2023-01-06 8:33 ` [PATCH 1/7] block: remove superfluous check for request queue in bdev_is_zoned Pankaj Raghav 2023-01-06 8:33 ` [dm-devel] " Pankaj Raghav 2023-01-06 11:01 ` Damien Le Moal 2023-01-06 11:01 ` [dm-devel] " Damien Le Moal 2023-01-06 22:34 ` Bart Van Assche 2023-01-06 22:34 ` [dm-devel] " Bart Van Assche 2023-01-09 7:41 ` Chaitanya Kulkarni 2023-01-09 7:41 ` [dm-devel] " Chaitanya Kulkarni 2023-01-09 8:55 ` Johannes Thumshirn 2023-01-09 8:55 ` [dm-devel] " Johannes Thumshirn 2023-01-10 6:52 ` Christoph Hellwig 2023-01-10 6:52 ` [dm-devel] " Christoph Hellwig [not found] ` <CGME20230106083320eucas1p1f8de0c6ecf351738e8f0ee5f3390d94f@eucas1p1.samsung.com> 2023-01-06 8:33 ` [PATCH 2/7] block: add a new helper bdev_{is_zone_start, offset_from_zone_start} Pankaj Raghav 2023-01-06 8:33 ` [dm-devel] " Pankaj Raghav 2023-01-06 11:00 ` Damien Le Moal 2023-01-06 11:00 ` [dm-devel] " Damien Le Moal 2023-01-06 22:36 ` Bart Van Assche 2023-01-06 22:36 ` [dm-devel] " Bart Van Assche 2023-01-09 7:42 ` Chaitanya Kulkarni 2023-01-09 7:42 ` [dm-devel] " Chaitanya Kulkarni 2023-01-10 6:54 ` Christoph Hellwig 2023-01-10 6:54 ` [dm-devel] " Christoph Hellwig [not found] ` <CGME20230106083320eucas1p1d23de4ad21d0a7aecb74c549ebc7757c@eucas1p1.samsung.com> 2023-01-06 8:33 ` [PATCH 3/7] nvmet: introduce bdev_zone_no helper Pankaj Raghav 2023-01-06 8:33 ` [dm-devel] " Pankaj Raghav 2023-01-06 11:02 ` Damien Le Moal 2023-01-06 11:02 ` [dm-devel] " Damien Le Moal 2023-01-06 22:39 ` Bart Van Assche 2023-01-06 22:39 ` [dm-devel] " Bart Van Assche 2023-01-09 7:42 ` Chaitanya Kulkarni 2023-01-09 7:42 ` [dm-devel] " Chaitanya Kulkarni 2023-01-10 6:55 ` Christoph Hellwig 2023-01-10 6:55 ` [dm-devel] " Christoph Hellwig [not found] ` <CGME20230106083321eucas1p15e9087bcc62bc6a4f5a61467e1c98698@eucas1p1.samsung.com> 2023-01-06 8:33 ` Pankaj Raghav [this message] 2023-01-06 8:33 ` [dm-devel] [PATCH 4/7] zonefs: use bdev_zone_no helper to calculate the zone index Pankaj Raghav 2023-01-06 11:05 ` Damien Le Moal 2023-01-06 11:05 ` [dm-devel] " Damien Le Moal [not found] ` <CGME20230106083322eucas1p2414f1f7f121fbbd7a0e5e1b1b622f5c0@eucas1p2.samsung.com> 2023-01-06 8:33 ` [PATCH 5/7] dm-zoned: ensure only power of 2 zone sizes are allowed Pankaj Raghav 2023-01-06 8:33 ` [dm-devel] " Pankaj Raghav 2023-01-10 6:56 ` Christoph Hellwig 2023-01-10 6:56 ` [dm-devel] " Christoph Hellwig 2023-01-10 8:39 ` Pankaj Raghav 2023-01-10 8:39 ` [dm-devel] " Pankaj Raghav [not found] ` <CGME20230106083322eucas1p1ce3ca7b02ca87bb2be8543291e223338@eucas1p1.samsung.com> 2023-01-06 8:33 ` [PATCH 6/7] dm-zone: use generic helpers to calculate offset from zone start Pankaj Raghav 2023-01-06 8:33 ` [dm-devel] " Pankaj Raghav 2023-01-10 6:57 ` Christoph Hellwig 2023-01-10 6:57 ` [dm-devel] " Christoph Hellwig 2023-01-10 9:06 ` Pankaj Raghav 2023-01-10 9:06 ` [dm-devel] " Pankaj Raghav [not found] ` <CGME20230106083323eucas1p2f0f6d5d5c1c3713be35b841157ae463e@eucas1p2.samsung.com> 2023-01-06 8:33 ` [PATCH 7/7] dm: call dm_zone_endio after the target endio callback for zoned devices Pankaj Raghav 2023-01-06 8:33 ` [dm-devel] " Pankaj Raghav 2023-01-10 6:58 ` Christoph Hellwig 2023-01-10 6:58 ` [dm-devel] " Christoph Hellwig 2023-01-10 9:07 ` Pankaj Raghav 2023-01-10 9:07 ` [dm-devel] " Pankaj Raghav 2023-01-10 9:43 ` Christoph Hellwig 2023-01-10 9:43 ` [dm-devel] " Christoph Hellwig
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=20230106083317.93938-5-p.raghav@samsung.com \ --to=p.raghav@samsung.com \ --cc=axboe@kernel.dk \ --cc=bvanassche@acm.org \ --cc=damien.lemoal@opensource.wdc.com \ --cc=dm-devel@redhat.com \ --cc=gost.dev@samsung.com \ --cc=hare@suse.de \ --cc=hch@lst.de \ --cc=kernel@pankajraghav.com \ --cc=linux-block@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-nvme@lists.infradead.org \ --cc=snitzer@kernel.org \ /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: linkBe 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.