Update bcachefs sources to 7d0925084b bcachefs: opts.read_journal_only

This commit is contained in:
Kent Overstreet 2022-02-19 05:16:30 -05:00
parent 0dc018fe08
commit 6a935c784a
9 changed files with 20 additions and 52 deletions

View File

@ -1 +1 @@
da8056a215b89f229d33c89944d136190d71f2bc 7d0925084b6927ad8c631bde92fb1c41cc6270c2

View File

@ -507,8 +507,6 @@ struct bch_dev {
enum { enum {
/* startup: */ /* startup: */
BCH_FS_INITIALIZED,
BCH_FS_ALLOC_READ_DONE,
BCH_FS_ALLOC_CLEAN, BCH_FS_ALLOC_CLEAN,
BCH_FS_ALLOCATOR_RUNNING, BCH_FS_ALLOCATOR_RUNNING,
BCH_FS_ALLOCATOR_STOPPING, BCH_FS_ALLOCATOR_STOPPING,

View File

@ -555,14 +555,6 @@ bool bch2_btree_insert_key_cached(struct btree_trans *trans,
return true; 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, static unsigned long bch2_btree_key_cache_scan(struct shrinker *shrink,
struct shrink_control *sc) struct shrink_control *sc)
{ {

View File

@ -32,14 +32,6 @@ bool bch2_btree_insert_key_cached(struct btree_trans *,
struct btree_path *, struct bkey_i *); struct btree_path *, struct bkey_i *);
int bch2_btree_key_cache_flush(struct btree_trans *, int bch2_btree_key_cache_flush(struct btree_trans *,
enum btree_id, struct bpos); 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_exit(struct btree_key_cache *);
void bch2_fs_btree_key_cache_init_early(struct btree_key_cache *); void bch2_fs_btree_key_cache_init_early(struct btree_key_cache *);

View File

@ -352,11 +352,7 @@ struct btree_insert_entry {
unsigned long ip_allocated; unsigned long ip_allocated;
}; };
#ifndef CONFIG_LOCKDEP
#define BTREE_ITER_MAX 64 #define BTREE_ITER_MAX 64
#else
#define BTREE_ITER_MAX 32
#endif
struct btree_trans_commit_hook; struct btree_trans_commit_hook;
typedef int (btree_trans_commit_hook_fn)(struct btree_trans *, struct btree_trans_commit_hook *); typedef int (btree_trans_commit_hook_fn)(struct btree_trans *, struct btree_trans_commit_hook *);

View File

@ -987,6 +987,17 @@ int __bch2_trans_commit(struct btree_trans *trans)
if (trans->flags & BTREE_INSERT_GC_LOCK_HELD) if (trans->flags & BTREE_INSERT_GC_LOCK_HELD)
lockdep_assert_held(&c->gc_lock); lockdep_assert_held(&c->gc_lock);
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))) {
ret = bch2_trans_commit_get_rw_cold(trans);
if (ret)
goto out_reset;
}
memset(&trans->journal_preres, 0, sizeof(trans->journal_preres)); memset(&trans->journal_preres, 0, sizeof(trans->journal_preres));
trans->journal_u64s = trans->extra_journal_entry_u64s; trans->journal_u64s = trans->extra_journal_entry_u64s;
@ -997,29 +1008,6 @@ int __bch2_trans_commit(struct btree_trans *trans)
if (trans->journal_transaction_names) if (trans->journal_transaction_names)
trans->journal_u64s += JSET_ENTRY_LOG_U64s; trans->journal_u64s += JSET_ENTRY_LOG_U64s;
if (!(trans->flags & BTREE_INSERT_NOCHECK_RW) &&
unlikely(!percpu_ref_tryget(&c->writes))) {
ret = bch2_trans_commit_get_rw_cold(trans);
if (ret)
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
ret = bch2_trans_commit_run_triggers(trans);
if (ret)
goto out;
trans_for_each_update(trans, i) { trans_for_each_update(trans, i) {
BUG_ON(!i->path->should_be_locked); BUG_ON(!i->path->should_be_locked);

View File

@ -329,6 +329,11 @@ enum opt_type {
OPT_BOOL(), \ OPT_BOOL(), \
NO_SB_OPT, false, \ NO_SB_OPT, false, \
NULL, "Read all journal entries, not just dirty ones")\ 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, \ x(journal_transaction_names, u8, \
OPT_FS|OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME, \ OPT_FS|OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME, \
OPT_BOOL(), \ OPT_BOOL(), \

View File

@ -1054,6 +1054,9 @@ use_clean:
blacklist_seq = journal_seq = le64_to_cpu(clean->journal_seq) + 1; blacklist_seq = journal_seq = le64_to_cpu(clean->journal_seq) + 1;
} }
if (c->opts.read_journal_only)
goto out;
if (c->opts.reconstruct_alloc) { if (c->opts.reconstruct_alloc) {
c->sb.compat &= ~(1ULL << BCH_COMPAT_alloc_info); c->sb.compat &= ~(1ULL << BCH_COMPAT_alloc_info);
drop_alloc_keys(&c->journal_keys); drop_alloc_keys(&c->journal_keys);
@ -1111,8 +1114,6 @@ use_clean:
goto err; goto err;
bch_verbose(c, "stripes_read done"); 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 * If we're not running fsck, this ensures bch2_fsck_err() calls are
* instead interpreted as bch2_inconsistent_err() calls: * instead interpreted as bch2_inconsistent_err() calls:
@ -1297,7 +1298,6 @@ int bch2_fs_initialize(struct bch_fs *c)
} }
mutex_unlock(&c->sb_lock); 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_INITIAL_GC_DONE, &c->flags);
set_bit(BCH_FS_FSCK_DONE, &c->flags); set_bit(BCH_FS_FSCK_DONE, &c->flags);

View File

@ -455,9 +455,6 @@ int bch2_sb_to_fs(struct bch_fs *c, struct bch_sb *src)
__copy_super(&c->disk_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); ret = bch2_sb_replicas_to_cpu_replicas(c);
if (ret) if (ret)
return ret; return ret;