diff --git a/fs_mgr/fs_mgr_format.cpp b/fs_mgr/fs_mgr_format.cpp index 7be024f52..778c0c1c2 100644 --- a/fs_mgr/fs_mgr_format.cpp +++ b/fs_mgr/fs_mgr_format.cpp @@ -121,7 +121,7 @@ static int format_ext4(const std::string& fs_blkdev, const std::string& fs_mnt_p } static int format_f2fs(const std::string& fs_blkdev, uint64_t dev_sz, bool crypt_footer, - bool needs_projid, bool needs_casefold) { + bool needs_projid, bool needs_casefold, bool fs_compress) { if (!dev_sz) { int rc = get_dev_sz(fs_blkdev, &dev_sz); if (rc) { @@ -147,6 +147,12 @@ static int format_f2fs(const std::string& fs_blkdev, uint64_t dev_sz, bool crypt args.push_back("-C"); args.push_back("utf8"); } + if (fs_compress) { + args.push_back("-O"); + args.push_back("compression"); + args.push_back("-O"); + args.push_back("extra_attr"); + } args.push_back(fs_blkdev.c_str()); args.push_back(size_str.c_str()); @@ -166,7 +172,7 @@ int fs_mgr_do_format(const FstabEntry& entry, bool crypt_footer) { if (entry.fs_type == "f2fs") { return format_f2fs(entry.blk_device, entry.length, crypt_footer, needs_projid, - needs_casefold); + needs_casefold, entry.fs_mgr_flags.fs_compress); } else if (entry.fs_type == "ext4") { return format_ext4(entry.blk_device, entry.mount_point, crypt_footer, needs_projid, entry.fs_mgr_flags.ext_meta_csum); diff --git a/fs_mgr/fs_mgr_fstab.cpp b/fs_mgr/fs_mgr_fstab.cpp index b218f21b2..0825a7716 100644 --- a/fs_mgr/fs_mgr_fstab.cpp +++ b/fs_mgr/fs_mgr_fstab.cpp @@ -178,6 +178,7 @@ void ParseFsMgrFlags(const std::string& flags, FstabEntry* entry) { CheckFlag("slotselect_other", slot_select_other); CheckFlag("fsverity", fs_verity); CheckFlag("metadata_csum", ext_meta_csum); + CheckFlag("fscompress", fs_compress); #undef CheckFlag diff --git a/fs_mgr/include_fstab/fstab/fstab.h b/fs_mgr/include_fstab/fstab/fstab.h index 79d940242..721640246 100644 --- a/fs_mgr/include_fstab/fstab/fstab.h +++ b/fs_mgr/include_fstab/fstab/fstab.h @@ -84,6 +84,7 @@ struct FstabEntry { bool slot_select_other : 1; bool fs_verity : 1; bool ext_meta_csum : 1; + bool fs_compress : 1; } fs_mgr_flags = {}; bool is_encryptable() const {