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

Commit b41ffef5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "fs_mgr: overlayfs: check if scratch device is ext4 dedupe" am: a22e74cd am: d84ccd64

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1234486

Change-Id: I7612a0c549258a420a0e53df8ff3a43b8750a3e7
parents 1d25b825 d84ccd64
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -809,15 +809,26 @@ bool fs_mgr_overlayfs_mount_scratch(const std::string& device_path, const std::s
    entry.fs_type = mnt_type;
    if ((mnt_type == "f2fs") && !f2fs) entry.fs_type = "ext4";
    if ((mnt_type == "ext4") && !ext4) entry.fs_type = "f2fs";
    entry.flags = MS_NOATIME;
    if (readonly) {
    entry.flags = MS_NOATIME | MS_RDONLY;
    auto mounted = true;
    if (!readonly) {
        if (entry.fs_type == "ext4") {
            // check if ext4 de-dupe
            entry.flags |= MS_RDONLY;
    } else {
            auto save_errno = errno;
            mounted = fs_mgr_do_mount_one(entry) == 0;
            if (mounted) {
                mounted = !fs_mgr_has_shared_blocks(entry.mount_point, entry.blk_device);
                fs_mgr_overlayfs_umount_scratch();
            }
            errno = save_errno;
        }
        entry.flags &= ~MS_RDONLY;
        fs_mgr_set_blk_ro(device_path, false);
    }
    entry.fs_mgr_flags.check = true;
    auto save_errno = errno;
    auto mounted = fs_mgr_do_mount_one(entry) == 0;
    if (mounted) mounted = fs_mgr_do_mount_one(entry) == 0;
    if (!mounted) {
        if ((entry.fs_type == "f2fs") && ext4) {
            entry.fs_type = "ext4";