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

Commit d8f0bee4 authored by David Anderson's avatar David Anderson Committed by Automerger Merge Worker
Browse files

Merge "Enhance checkpoint=disable GC threshold fallback mechanism" am:...

Merge "Enhance checkpoint=disable GC threshold fallback mechanism" am: 2ed2f814 am: 9e72937f am: 4163fd7b

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

Change-Id: Ia112965c97b0708c6e36a7840de286f8be4bd4a6
parents 59c95678 4163fd7b
Loading
Loading
Loading
Loading
+12 −6
Original line number Original line Diff line number Diff line
@@ -790,20 +790,26 @@ static int __mount(const std::string& source, const std::string& target, const F
    int save_errno = 0;
    int save_errno = 0;
    int gc_allowance = 0;
    int gc_allowance = 0;
    std::string opts;
    std::string opts;
    std::string checkpoint_opts;
    bool try_f2fs_gc_allowance = is_f2fs(entry.fs_type) && entry.fs_checkpoint_opts.length() > 0;
    bool try_f2fs_gc_allowance = is_f2fs(entry.fs_type) && entry.fs_checkpoint_opts.length() > 0;
    bool try_f2fs_fallback = false;
    Timer t;
    Timer t;


    do {
    do {
        if (save_errno == EINVAL && try_f2fs_gc_allowance) {
        if (save_errno == EINVAL && (try_f2fs_gc_allowance || try_f2fs_fallback)) {
            PINFO << "Kernel does not support checkpoint=disable:[n]%, trying without.";
            PINFO << "Kernel does not support " << checkpoint_opts << ", trying without.";
            try_f2fs_gc_allowance = false;
            try_f2fs_gc_allowance = false;
            // Attempt without gc allowance before dropping.
            try_f2fs_fallback = !try_f2fs_fallback;
        }
        }
        if (try_f2fs_gc_allowance) {
        if (try_f2fs_gc_allowance) {
            opts = entry.fs_options + entry.fs_checkpoint_opts + ":" +
            checkpoint_opts = entry.fs_checkpoint_opts + ":" + std::to_string(gc_allowance) + "%";
                   std::to_string(gc_allowance) + "%";
        } else if (try_f2fs_fallback) {
            checkpoint_opts = entry.fs_checkpoint_opts;
        } else {
        } else {
            opts = entry.fs_options;
            checkpoint_opts = "";
        }
        }
        opts = entry.fs_options + checkpoint_opts;
        if (save_errno == EAGAIN) {
        if (save_errno == EAGAIN) {
            PINFO << "Retrying mount (source=" << source << ",target=" << target
            PINFO << "Retrying mount (source=" << source << ",target=" << target
                  << ",type=" << entry.fs_type << ", gc_allowance=" << gc_allowance << "%)=" << ret
                  << ",type=" << entry.fs_type << ", gc_allowance=" << gc_allowance << "%)=" << ret
@@ -814,7 +820,7 @@ static int __mount(const std::string& source, const std::string& target, const F
        save_errno = errno;
        save_errno = errno;
        if (try_f2fs_gc_allowance) gc_allowance += 10;
        if (try_f2fs_gc_allowance) gc_allowance += 10;
    } while ((ret && save_errno == EAGAIN && gc_allowance <= 100) ||
    } while ((ret && save_errno == EAGAIN && gc_allowance <= 100) ||
             (ret && save_errno == EINVAL && try_f2fs_gc_allowance));
             (ret && save_errno == EINVAL && (try_f2fs_gc_allowance || try_f2fs_fallback)));
    const char* target_missing = "";
    const char* target_missing = "";
    const char* source_missing = "";
    const char* source_missing = "";
    if (save_errno == ENOENT) {
    if (save_errno == ENOENT) {