Merge "fstab: support f2fs compression" am: 8b8743462c

Change-Id: I8a640686eb0887a241ef3b03633a63db1535af37
This commit is contained in:
Jaegeuk Kim 2020-04-14 15:58:30 +00:00 committed by Automerger Merge Worker
commit ff643270e6
3 changed files with 10 additions and 2 deletions

View file

@ -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);

View file

@ -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

View file

@ -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 {