]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
Update bcachefs sources to 7d0925084b bcachefs: opts.read_journal_only
authorKent Overstreet <kent.overstreet@gmail.com>
Sat, 19 Feb 2022 10:16:30 +0000 (05:16 -0500)
committerKent Overstreet <kent.overstreet@gmail.com>
Sat, 19 Feb 2022 10:16:30 +0000 (05:16 -0500)
.bcachefs_revision
libbcachefs/bcachefs.h
libbcachefs/btree_key_cache.c
libbcachefs/btree_key_cache.h
libbcachefs/btree_types.h
libbcachefs/btree_update_leaf.c
libbcachefs/opts.h
libbcachefs/recovery.c
libbcachefs/super-io.c

index ca7bf7d18781c0efe03eeaf9c8db2b07d573de25..5165b9d2b99308532358b131aa9a4df176dc4769 100644 (file)
@@ -1 +1 @@
-da8056a215b89f229d33c89944d136190d71f2bc
+7d0925084b6927ad8c631bde92fb1c41cc6270c2
index 0e9689f6878afd3062710d9f6b4bd288bf8eef84..b018425394e51cd4a2c7e48846f0177e9190fdf0 100644 (file)
@@ -507,8 +507,6 @@ struct bch_dev {
 
 enum {
        /* startup: */
-       BCH_FS_INITIALIZED,
-       BCH_FS_ALLOC_READ_DONE,
        BCH_FS_ALLOC_CLEAN,
        BCH_FS_ALLOCATOR_RUNNING,
        BCH_FS_ALLOCATOR_STOPPING,
index 928aab61bcf6c25877700e61ec1e088523945653..167d177150c4807267f6fa5707feb21e742d9ab2 100644 (file)
@@ -555,14 +555,6 @@ bool bch2_btree_insert_key_cached(struct btree_trans *trans,
        return true;
 }
 
-#ifdef CONFIG_BCACHEFS_DEBUG
-void bch2_btree_key_cache_verify_clean(struct btree_trans *trans,
-                              enum btree_id id, struct bpos pos)
-{
-       BUG_ON(bch2_btree_key_cache_find(trans->c, id, pos));
-}
-#endif
-
 static unsigned long bch2_btree_key_cache_scan(struct shrinker *shrink,
                                           struct shrink_control *sc)
 {
index b3d241b134539e545a44557afd7fb16ebe87f4cf..fd29c14c562654a1a5cca2493ed28b717be9eed8 100644 (file)
@@ -32,14 +32,6 @@ bool bch2_btree_insert_key_cached(struct btree_trans *,
                        struct btree_path *, struct bkey_i *);
 int bch2_btree_key_cache_flush(struct btree_trans *,
                               enum btree_id, struct bpos);
-#ifdef CONFIG_BCACHEFS_DEBUG
-void bch2_btree_key_cache_verify_clean(struct btree_trans *,
-                               enum btree_id, struct bpos);
-#else
-static inline void
-bch2_btree_key_cache_verify_clean(struct btree_trans *trans,
-                               enum btree_id id, struct bpos pos) {}
-#endif
 
 void bch2_fs_btree_key_cache_exit(struct btree_key_cache *);
 void bch2_fs_btree_key_cache_init_early(struct btree_key_cache *);
index 9ae5c8d56b2a38187e9099e55b02e919794fad27..ae52ac96bbdad12a05f42d4a5e53aa76972012c7 100644 (file)
@@ -352,11 +352,7 @@ struct btree_insert_entry {
        unsigned long           ip_allocated;
 };
 
-#ifndef CONFIG_LOCKDEP
 #define BTREE_ITER_MAX         64
-#else
-#define BTREE_ITER_MAX         32
-#endif
 
 struct btree_trans_commit_hook;
 typedef int (btree_trans_commit_hook_fn)(struct btree_trans *, struct btree_trans_commit_hook *);
index 2e3818a5faf5361e7b155a9a547a0e8e30e40b9d..a08d36c0dc8d69044865471ffd8c2eabb7c13fc7 100644 (file)
@@ -987,15 +987,9 @@ int __bch2_trans_commit(struct btree_trans *trans)
        if (trans->flags & BTREE_INSERT_GC_LOCK_HELD)
                lockdep_assert_held(&c->gc_lock);
 
-       memset(&trans->journal_preres, 0, sizeof(trans->journal_preres));
-
-       trans->journal_u64s             = trans->extra_journal_entry_u64s;
-       trans->journal_preres_u64s      = 0;
-
-       trans->journal_transaction_names = READ_ONCE(c->opts.journal_transaction_names);
-
-       if (trans->journal_transaction_names)
-               trans->journal_u64s += JSET_ENTRY_LOG_U64s;
+       ret = bch2_trans_commit_run_triggers(trans);
+       if (ret)
+               goto out_reset;
 
        if (!(trans->flags & BTREE_INSERT_NOCHECK_RW) &&
            unlikely(!percpu_ref_tryget(&c->writes))) {
@@ -1004,21 +998,15 @@ int __bch2_trans_commit(struct btree_trans *trans)
                        goto out_reset;
        }
 
-#ifdef CONFIG_BCACHEFS_DEBUG
-       /*
-        * if BTREE_TRIGGER_NORUN is set, it means we're probably being called
-        * from the key cache flush code:
-        */
-       trans_for_each_update(trans, i)
-               if (!i->cached &&
-                   !(i->flags & BTREE_TRIGGER_NORUN))
-                       bch2_btree_key_cache_verify_clean(trans,
-                                       i->btree_id, i->k->k.p);
-#endif
+       memset(&trans->journal_preres, 0, sizeof(trans->journal_preres));
 
-       ret = bch2_trans_commit_run_triggers(trans);
-       if (ret)
-               goto out;
+       trans->journal_u64s             = trans->extra_journal_entry_u64s;
+       trans->journal_preres_u64s      = 0;
+
+       trans->journal_transaction_names = READ_ONCE(c->opts.journal_transaction_names);
+
+       if (trans->journal_transaction_names)
+               trans->journal_u64s += JSET_ENTRY_LOG_U64s;
 
        trans_for_each_update(trans, i) {
                BUG_ON(!i->path->should_be_locked);
index affe9233d708094c0ab032b170bda23f3deba763..bafacf6b46a2a962688bb49974d481ee136c6b62 100644 (file)
@@ -329,6 +329,11 @@ enum opt_type {
          OPT_BOOL(),                                                   \
          NO_SB_OPT,                    false,                          \
          NULL,         "Read all journal entries, not just dirty ones")\
+       x(read_journal_only,            u8,                             \
+         0,                                                            \
+         OPT_BOOL(),                                                   \
+         NO_SB_OPT,                    false,                          \
+         NULL,         "Only read the journal, skip the rest of recovery")\
        x(journal_transaction_names,    u8,                             \
          OPT_FS|OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME,                      \
          OPT_BOOL(),                                                   \
index 543db58ff4d6a087b57aae732da116ccd993998f..96f13f2e7a9ae063579b4218ee4477d05f373fc5 100644 (file)
@@ -1054,6 +1054,9 @@ use_clean:
                blacklist_seq = journal_seq = le64_to_cpu(clean->journal_seq) + 1;
        }
 
+       if (c->opts.read_journal_only)
+               goto out;
+
        if (c->opts.reconstruct_alloc) {
                c->sb.compat &= ~(1ULL << BCH_COMPAT_alloc_info);
                drop_alloc_keys(&c->journal_keys);
@@ -1111,8 +1114,6 @@ use_clean:
                goto err;
        bch_verbose(c, "stripes_read done");
 
-       set_bit(BCH_FS_ALLOC_READ_DONE, &c->flags);
-
        /*
         * If we're not running fsck, this ensures bch2_fsck_err() calls are
         * instead interpreted as bch2_inconsistent_err() calls:
@@ -1297,7 +1298,6 @@ int bch2_fs_initialize(struct bch_fs *c)
        }
        mutex_unlock(&c->sb_lock);
 
-       set_bit(BCH_FS_ALLOC_READ_DONE, &c->flags);
        set_bit(BCH_FS_INITIAL_GC_DONE, &c->flags);
        set_bit(BCH_FS_FSCK_DONE, &c->flags);
 
index 49dafdad77cd9d4bb7990b9f73687a754970d808..eae63184ead2330cd36e60eedbc401b3a0aade3d 100644 (file)
@@ -455,9 +455,6 @@ int bch2_sb_to_fs(struct bch_fs *c, struct bch_sb *src)
 
        __copy_super(&c->disk_sb, src);
 
-       if (BCH_SB_INITIALIZED(c->disk_sb.sb))
-               set_bit(BCH_FS_INITIALIZED, &c->flags);
-
        ret = bch2_sb_replicas_to_cpu_replicas(c);
        if (ret)
                return ret;