f2fs: compress: add nocompress extensions support
authorFengnan Chang <changfengnan@vivo.com>
Tue, 8 Jun 2021 11:15:08 +0000 (19:15 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Fri, 2 Jul 2021 01:34:31 +0000 (18:34 -0700)
commit151b1982be5d9f4ca641687ee1a4bb4fba5d26cf
treecb2b5168d7a8297c2f29319baa09d639bf1da220
parentbf1c5bc21b879bcddc8cf0fe0e1c3110fc8d25d6
f2fs: compress: add nocompress extensions support

When we create a directory with enable compression, all file write into
directory will try to compress.But sometimes we may know, new file
cannot meet compression ratio requirements.
We need a nocompress extension to skip those files to avoid unnecessary
compress page test.

After add nocompress_extension, the priority should be:
dir_flag < comp_extention,nocompress_extension < comp_file_flag,
no_comp_file_flag.

Priority in between FS_COMPR_FL, FS_NOCOMP_FS, extensions:
   * compress_extension=so; nocompress_extension=zip; chattr +c dir;
     touch dir/foo.so; touch dir/bar.zip; touch dir/baz.txt; then foo.so
     and baz.txt should be compresse, bar.zip should be non-compressed.
     chattr +c dir/bar.zip can enable compress on bar.zip.
   * compress_extension=so; nocompress_extension=zip; chattr -c dir;
     touch dir/foo.so; touch dir/bar.zip; touch dir/baz.txt; then foo.so
     should be compresse, bar.zip and baz.txt should be non-compressed.
     chattr+c dir/bar.zip; chattr+c dir/baz.txt; can enable compress on
     bar.zip and baz.txt.

Signed-off-by: Fengnan Chang <changfengnan@vivo.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Documentation/filesystems/f2fs.rst
fs/f2fs/f2fs.h
fs/f2fs/namei.c
fs/f2fs/super.c