]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
Update bcachefs sources to 8436db7aac bcachefs: Drop alloc keys from journal when...
authorKent Overstreet <kent.overstreet@gmail.com>
Sun, 25 Oct 2020 01:21:56 +0000 (21:21 -0400)
committerKent Overstreet <kent.overstreet@gmail.com>
Sun, 25 Oct 2020 01:21:56 +0000 (21:21 -0400)
.bcachefs_revision
libbcachefs/recovery.c

index ace0a29349638ce1d8a3ea61ae64ae88acb27660..dc226f849e9c05cf2f76fe7f8c92f9e2dadd5167 100644 (file)
@@ -1 +1 @@
-13bb4cdf89c91a1e50d2416ede10c1f9cbaf0202
+8436db7aac9ced2118bf19b8f1bf3682f479d17e
index d70fa968db50d95c5fa63ced0c8080e14434d903..32fed6b81a526a6f83549bc05cf56ab5907fb7a9 100644 (file)
 
 #define QSTR(n) { { { .len = strlen(n) } }, .name = n }
 
+/* for -o reconstruct_alloc: */
+static void drop_alloc_keys(struct journal_keys *keys)
+{
+       size_t src, dst;
+
+       for (src = 0, dst = 0; src < keys->nr; src++)
+               if (keys->d[src].btree_id != BTREE_ID_ALLOC)
+                       keys->d[dst++] = keys->d[src];
+
+       keys->nr = dst;
+}
+
 /* iterate over keys read from the journal: */
 
 static struct journal_key *journal_key_search(struct journal_keys *journal_keys,
@@ -930,7 +942,6 @@ static int read_btree_roots(struct bch_fs *c)
                        continue;
                }
 
-
                if (r->error) {
                        __fsck_err(c, i == BTREE_ID_ALLOC
                                   ? FSCK_CAN_IGNORE : 0,
@@ -1027,6 +1038,11 @@ int bch2_fs_recovery(struct bch_fs *c)
                goto err;
        }
 
+       if (c->opts.reconstruct_alloc) {
+               c->sb.compat &= ~(1ULL << BCH_COMPAT_FEAT_ALLOC_INFO);
+               drop_alloc_keys(&c->journal_keys);
+       }
+
        ret = journal_replay_early(c, clean, &c->journal_entries);
        if (ret)
                goto err;