third_party_f2fs-tools/lib
Jaegeuk Kim f056fbeff0 resize.f2fs: fix wrong ovp calculation
beroal reported a mount failure due to broken valid_user_blocks.
[ 6890.647749] F2FS-fs (loop0): Wrong valid_user_blocks: 16040048,
user_block_count: 10016768

From fsck,

segment_count_main                      [0x    9a95 : 39573]
-> 39573 * 2MB = 78GB as user space

overprov_segment_count                  [0x    4e29 : 20009]
-> 20009 * 2MB = 40GB as overprovisioned space which user can't see.

But,
[FSCK] valid_block_count matching with CP             [Ok..] [0xf4c070]
-> 0xf4c070 = 16040048

valid_block_count                       [0x  f4c070 : 16040048]
-> So, this is correct.

It turns out resize.f2fs gave very large and wrong overprovisioning space
result in shortage of user blocks. The root cause was f2fs_get_usable_segments()
didn't consider resize case which needs segment_count_main from new superblock.

Fixes: f8410857b7 ("f2fs-tools: zns zone-capacity support")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2021-04-01 20:19:10 -07:00
..
libf2fs_io.c f2fs-tools:sload.f2fs compression support 2020-12-23 11:32:31 -08:00
libf2fs_zoned.c resize.f2fs: fix wrong ovp calculation 2021-04-01 20:19:10 -07:00
libf2fs.c libf2fs: fix memory leak caused by get_rootdev() 2021-03-01 20:22:56 -08:00
Makefile.am f2fs-tools: Add support for Casefolding 2019-08-27 14:51:05 -07:00
nls_utf8.c f2fs-tools: Add support for Casefolding 2019-08-27 14:51:05 -07:00
utf8data.h f2fs-tools: Add support for Casefolding 2019-08-27 14:51:05 -07:00