Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

block_volume_format needlessly produces small wasteful f2fs partitions #6

Open
Lanchon opened this issue Apr 11, 2024 · 1 comment
Open

Comments

@Lanchon
Copy link

Lanchon commented Apr 11, 2024

the choice of FS in block_volume_format should be user configurable, as that piece of code cannot know what FS is better for each particular usage. but we have what we have...

but for the case of openwrt rootfs_data partitions, it is arguably making the wrong choice:

  • it chooses f2fs for partitions larger than 100MB. this is extremely wasteful: a 100MB f2fs partition has an overhead of about 40%! so you only get 60 usable megs out of your 100 megs, it's crazy. if auto switching is used at all, IMHO it should not cause overheads higher than 10%, so that would move the switch point to around 400 or 500 megs.

  • it is well known that f2fs suffers from corruption when subject to unclean shutdowns. it may be an acceptable risk for some battery-powered devices (which are unlikely to power off unexpectedly) such as phones, especially when benchmarks are given more importance than user's data by manufacturers, but it is a bad choice for devices that are typically always shutdown uncleanly, like openwrt routers. we probably do not see many corruption events only because the usual openwrt install writes so little to the disk; but then see next point...

  • the performance advantages (in time and write amplification/wear) of f2fs are noticeable when the FS is being written to heavily. there is no advantage to using f2fs (and real disadvantages) if you write little to it. this probably calls into question whether f2fs should be used automatically at all.

to recap: maybe always choose ext4. but if not, the cutoff point of 100MB should be raised significantly.

@Lanchon
Copy link
Author

Lanchon commented Apr 11, 2024

a suggestion...

fstools/libfstools/common.c

Lines 166 to 169 in 08cd708

if (use_f2fs(v, offset, bdev))
snprintf(str, sizeof(str), "mkfs.f2fs -q -f -l rootfs_data %s", v->blk);
else
snprintf(str, sizeof(str), "mkfs.ext4 -q -F -L rootfs_data %s", v->blk);

before calling use_f2fs, or possibly within that function, could you maybe check if both mkfs.* are available? if one is missing, just use the other.

this would let port authors choose for example ext4 by simply not including mkfs.f2fs in their builds.

PS. FYI:

root@OpenWrt:/# ll /usr/sbin/mkfs.*
lrwxrwxrwx    1 root     root             6 Apr 10 21:16 /usr/sbin/mkfs.ext2 -> mke2fs*
lrwxrwxrwx    1 root     root             6 Apr 10 21:16 /usr/sbin/mkfs.ext3 -> mke2fs*
lrwxrwxrwx    1 root     root             6 Apr 10 21:16 /usr/sbin/mkfs.ext4 -> mke2fs*
-rwxr-xr-x    1 root     root         33059 Apr 10 21:16 /usr/sbin/mkfs.f2fs*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant