* [PATCH] f2fs-tools: remove power-of-two limitation of zoned device
@ 2023-05-31 17:52 Daeho Jeong
2023-06-06 1:04 ` [f2fs-dev] " Chao Yu
0 siblings, 1 reply; 2+ messages in thread
From: Daeho Jeong @ 2023-05-31 17:52 UTC (permalink / raw)
To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong
From: Daeho Jeong <daehojeong@google.com>
Remove power-of-two limitation for zoned device, since zoned devices
don't have it.
Signed-off-by: Daeho Jeong <daehojeong@google.com>
---
fsck/mount.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/fsck/mount.c b/fsck/mount.c
index 4c74888..851a62b 100644
--- a/fsck/mount.c
+++ b/fsck/mount.c
@@ -56,19 +56,17 @@ static int get_zone_idx_from_dev(struct f2fs_sb_info *sbi,
{
block_t seg_start_blkaddr = START_BLOCK(sbi, segno);
- return (seg_start_blkaddr - c.devices[dev_idx].start_blkaddr) >>
- log_base_2(sbi->segs_per_sec * sbi->blocks_per_seg);
+ return (seg_start_blkaddr - c.devices[dev_idx].start_blkaddr) /
+ (sbi->segs_per_sec * sbi->blocks_per_seg);
}
bool is_usable_seg(struct f2fs_sb_info *sbi, unsigned int segno)
{
- unsigned int secno = segno / sbi->segs_per_sec;
block_t seg_start = START_BLOCK(sbi, segno);
- block_t blocks_per_sec = sbi->blocks_per_seg * sbi->segs_per_sec;
unsigned int dev_idx = get_device_idx(sbi, segno);
unsigned int zone_idx = get_zone_idx_from_dev(sbi, segno, dev_idx);
- unsigned int sec_off = SM_I(sbi)->main_blkaddr >>
- log_base_2(blocks_per_sec);
+ unsigned int sec_start_blkaddr = START_BLOCK(sbi,
+ GET_SEG_FROM_SEC(sbi, segno / sbi->segs_per_sec));
if (zone_idx < c.devices[dev_idx].nr_rnd_zones)
return true;
@@ -76,7 +74,7 @@ bool is_usable_seg(struct f2fs_sb_info *sbi, unsigned int segno)
if (c.devices[dev_idx].zoned_model != F2FS_ZONED_HM)
return true;
- return seg_start < ((sec_off + secno) * blocks_per_sec) +
+ return seg_start < sec_start_blkaddr +
c.devices[dev_idx].zone_cap_blocks[zone_idx];
}
--
2.41.0.rc0.172.g3f132b7071-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs-tools: remove power-of-two limitation of zoned device
2023-05-31 17:52 [PATCH] f2fs-tools: remove power-of-two limitation of zoned device Daeho Jeong
@ 2023-06-06 1:04 ` Chao Yu
0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2023-06-06 1:04 UTC (permalink / raw)
To: Daeho Jeong, linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong
On 2023/6/1 1:52, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
>
> Remove power-of-two limitation for zoned device, since zoned devices
> don't have it.
>
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-06 1:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-31 17:52 [PATCH] f2fs-tools: remove power-of-two limitation of zoned device Daeho Jeong
2023-06-06 1:04 ` [f2fs-dev] " Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox