Enable F2FS compression in linux56

Hello @philm,
what do you think about enabling F2FS transparent compression in linux56?

CONFIG_F2FS_FS_COMPRESSION
CONFIG_F2FS_FS_LZ4
CONFIG_F2FS_FS_LZO

Are there known issues? Do you want me to try to build it myself first?
Regards

I would say that this is a decision users should make with config/boot parameters.
Enabling it so that it can be activated by parameters would be great.

(I understand the request in a way that compression on f2fs should be enabled per default)

1 Like

To be able to mount an F2FS partition with compress_algorithm=lz4 or compress_algorithm=lzo mount option you need those CONFIGs to be activated in the kernel at build time. This is possible of linux46 on.

1 Like

I build linux56 with those options enabled, it boots and has no issues. But I can't mount an f2fs partition with any compression options.

~ >>> sudo mount -o compress_algorithm=lz4 -t f2fs /dev/nvme0n1p6 /mnt                                                                                                   
mount: /mnt: wrong fs type, bad option, bad superblock on /dev/nvme0n1p6, missing codepage or helper program, or other error.

The partition was created with normal partitionmanager.
I thought to try creating a partition with command line:

~ >>> sudo mkfs.f2fs -l LINUX -O encrypt,compression -t 0 /dev/nvme0n1p6                                                                                              [1]
        Info: compression feature should always be enabled with extra attr feature

and the filesystem doesn't get created.
Any ideas?

Installed f2fs-tools on the OS that you want f2fs partition mounted?

Don't know about that. And perhaps it is the encryption.

f2fs-tools are installed on the system where I run the mount or mkfs.f2fs commands, even tried to complie the lastest version 1.13.0 myself. Maybe I need to compile some sort of unreleased version
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git
, but I don't know how to do it.
-O encryption alone doesn't give any error message.

To enable -O compression with mkfs.f2fs you also have to pass extra_attr option.
So, to successfully mkfs with compression and encryption you have to use -O encrypt,compression,extra_attr
This really should be mentioned somwhere else than just f2fs-devel mailing list.

1 Like

Btw, as of now, (experimental) linux56 from manjaro repos already has f2fs compression options (let's hope it'll keep them).
Also, current implementation of compression doesn't show anything to user. File sizes and disk usage will remain the same. FS-level optimizations such as "reduced data writes" are the only benefit that you'll get.

1 Like

I'm back to btrfs since a month. Will check your solution some day, thanks!

CONFIG_F2FS_FS_COMPRESSION=y
CONFIG_F2FS_FS_LZO=y
CONFIG_F2FS_FS_LZ4=y
CONFIG_F2FS_FS_ZSTD=y

is now on linux57 and linux58. Kudos @schinfo! Or was it from upstream?

I'm tempted to try F2FS encryption on a new install. Compression probably not.

1 Like

Forum kindly sponsored by