Message ID | 20241007052122epcms2p8a7a733c92a8da751ac64af8a29de0303@epcms2p8 (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [f2fs-dev] libf2fs: Fix calculation of usable segments for single zoned | expand |
On 2024/10/7 13:21, Yonggil Song wrote: > There was a bug that did not subtract the super block area when calculating > the usable segments for a single zoned device with a conventional zone. > This bug resulted in incorrect the overprovision and reserved area. > > <256MiB legacy block + zoned block w/ 32MiB zone size> > Info: Overprovision ratio = 3.570% > Info: Overprovision segments = 656 (GC reserved = 560) > > <8 conventional zone + 1016 sequential zone w/ 32MiB zone size> > Info: Overprovision ratio = 3.700% > Info: Overprovision segments = 676 (GC reserved = 578) > > This patch fixes the bug by subtracting the super block area when there is > only one zoned device. > > Signed-off-by: Yonggil Song <yonggil.song@samsung.com> > --- > lib/libf2fs_zoned.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c > index 89ba5ad73a76..cc5c064b7e3e 100644 > --- a/lib/libf2fs_zoned.c > +++ b/lib/libf2fs_zoned.c > @@ -555,6 +555,11 @@ uint32_t f2fs_get_usable_segments(struct f2fs_super_block *sb) > } > usable_segs -= (get_sb(main_blkaddr) - get_sb(segment0_blkaddr)) >> > get_sb(log_blocks_per_seg); > + > + /* single zoned device needs to remove a super block area */ If we don't format zoned device, it doesn't need to do this? Thanks, > + if (c.ndevs == 1) > + usable_segs -= (get_sb(segment0_blkaddr) >> get_sb(log_blocks_per_seg));> + > return usable_segs; > #endif > return get_sb(segment_count_main);
…
> This patch fixes the bug by …
* How do you think about to choose another imperative wording
for an improved change description?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.12-rc2#n94
* Would you like to add any tags (like “Fixes” and “Cc”) accordingly?
Regards,
Markus
> On 2024/10/7 13:21, Yonggil Song wrote: > > There was a bug that did not subtract the super block area when calculating > > the usable segments for a single zoned device with a conventional zone. > > This bug resulted in incorrect the overprovision and reserved area. > > > > <256MiB legacy block + zoned block w/ 32MiB zone size> > > Info: Overprovision ratio = 3.570% > > Info: Overprovision segments = 656 (GC reserved = 560) > > > > <8 conventional zone + 1016 sequential zone w/ 32MiB zone size> > > Info: Overprovision ratio = 3.700% > > Info: Overprovision segments = 676 (GC reserved = 578) > > > > This patch fixes the bug by subtracting the super block area when there is > > only one zoned device. > > > > Signed-off-by: Yonggil Song <yonggil.song@samsung.com> > > --- > > lib/libf2fs_zoned.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c > > index 89ba5ad73a76..cc5c064b7e3e 100644 > > --- a/lib/libf2fs_zoned.c > > +++ b/lib/libf2fs_zoned.c > > @@ -555,6 +555,11 @@ uint32_t f2fs_get_usable_segments(struct f2fs_super_block *sb) > > } > > usable_segs -= (get_sb(main_blkaddr) - get_sb(segment0_blkaddr)) >> > > get_sb(log_blocks_per_seg); > > + > > + /* single zoned device needs to remove a super block area */ > > If we don't format zoned device, it doesn't need to do this? > > Thanks, > Yes, single zoned block only needs this. legacy block just return a segment_count_main. thanks. > > + if (c.ndevs == 1) > > + usable_segs -= (get_sb(segment0_blkaddr) >> get_sb(log_blocks_per_seg));> + > > return usable_segs; > > #endif > > return get_sb(segment_count_main);
> > On 2024/10/7 13:21, Yonggil Song wrote: > > > There was a bug that did not subtract the super block area when calculating > > > the usable segments for a single zoned device with a conventional zone. > > > This bug resulted in incorrect the overprovision and reserved area. > > > > > > <256MiB legacy block + zoned block w/ 32MiB zone size> > > > Info: Overprovision ratio = 3.570% > > > Info: Overprovision segments = 656 (GC reserved = 560) > > > > > > <8 conventional zone + 1016 sequential zone w/ 32MiB zone size> > > > Info: Overprovision ratio = 3.700% > > > Info: Overprovision segments = 676 (GC reserved = 578) > > > > > > This patch fixes the bug by subtracting the super block area when there is > > > only one zoned device. > > > > > > Signed-off-by: Yonggil Song <yonggil.song@samsung.com> > > > --- > > > lib/libf2fs_zoned.c | 5 +++++ > > > 1 file changed, 5 insertions(+) > > > > > > diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c > > > index 89ba5ad73a76..cc5c064b7e3e 100644 > > > --- a/lib/libf2fs_zoned.c > > > +++ b/lib/libf2fs_zoned.c > > > @@ -555,6 +555,11 @@ uint32_t f2fs_get_usable_segments(struct f2fs_super_block *sb) > > > } > > > usable_segs -= (get_sb(main_blkaddr) - get_sb(segment0_blkaddr)) >> > > > get_sb(log_blocks_per_seg); > > > + > > > + /* single zoned device needs to remove a super block area */ > > > > If we don't format zoned device, it doesn't need to do this? > > > > Thanks, > > > Yes, single zoned block only needs this. > > legacy block just return a segment_count_main. > > thanks. Sorry, I misunderstood. I'll resend v2 with zoned block checker. thanks. > > > + if (c.ndevs == 1) > > > + usable_segs -= (get_sb(segment0_blkaddr) >> get_sb(log_blocks_per_seg));> + > > > return usable_segs; > > > #endif > > > return get_sb(segment_count_main);
diff --git a/lib/libf2fs_zoned.c b/lib/libf2fs_zoned.c index 89ba5ad73a76..cc5c064b7e3e 100644 --- a/lib/libf2fs_zoned.c +++ b/lib/libf2fs_zoned.c @@ -555,6 +555,11 @@ uint32_t f2fs_get_usable_segments(struct f2fs_super_block *sb) } usable_segs -= (get_sb(main_blkaddr) - get_sb(segment0_blkaddr)) >> get_sb(log_blocks_per_seg); + + /* single zoned device needs to remove a super block area */ + if (c.ndevs == 1) + usable_segs -= (get_sb(segment0_blkaddr) >> get_sb(log_blocks_per_seg)); + return usable_segs; #endif return get_sb(segment_count_main);
There was a bug that did not subtract the super block area when calculating the usable segments for a single zoned device with a conventional zone. This bug resulted in incorrect the overprovision and reserved area. <256MiB legacy block + zoned block w/ 32MiB zone size> Info: Overprovision ratio = 3.570% Info: Overprovision segments = 656 (GC reserved = 560) <8 conventional zone + 1016 sequential zone w/ 32MiB zone size> Info: Overprovision ratio = 3.700% Info: Overprovision segments = 676 (GC reserved = 578) This patch fixes the bug by subtracting the super block area when there is only one zoned device. Signed-off-by: Yonggil Song <yonggil.song@samsung.com> --- lib/libf2fs_zoned.c | 5 +++++ 1 file changed, 5 insertions(+)