Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4076dc97 authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

fstab: support f2fs compression



Bug: 134580167
Change-Id: I9b1360cceb7b603c0596f3680d20dda4171b3836
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@google.com>
parent d956dd78
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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

+1 −0
Original line number Diff line number Diff line
@@ -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 {