diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-03-15 02:33:21 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2022-03-15 02:33:21 -0400 |
commit | 3985f5f4eff86ee667da7da6e36ca2c346f56be3 (patch) | |
tree | e7717ff4123024977386a69a8bcdcfccf8c14d8c | |
parent | 62cdb94d54b37e9e1fb8c73d1fe2b8ab35a88d2f (diff) |
fixup! bcachefs: bch_sb_field_journal_v2
-rw-r--r-- | fs/bcachefs/journal.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c index 7a9afa85f1de..6ea6810337db 100644 --- a/fs/bcachefs/journal.c +++ b/fs/bcachefs/journal.c @@ -767,7 +767,6 @@ static int __bch2_set_nr_journal_buckets(struct bch_dev *ca, unsigned nr, bool new_fs, struct closure *cl) { struct bch_fs *c = ca->fs; - struct journal *j = &c->journal; struct journal_device *ja = &ca->journal; u64 *new_bucket_seq = NULL, *new_buckets = NULL; struct open_bucket **ob = NULL; @@ -780,8 +779,10 @@ static int __bch2_set_nr_journal_buckets(struct bch_dev *ca, unsigned nr, unsigned old_cur_idx = ja->cur_idx; int ret = 0; - bch2_journal_block(j); - bch2_journal_flush_all_pins(j); + if (c) { + bch2_journal_block(&c->journal); + bch2_journal_flush_all_pins(&c->journal); + } bu = kzalloc(nr_want * sizeof(*bu), GFP_KERNEL); ob = kzalloc(nr_want * sizeof(*ob), GFP_KERNEL); @@ -819,7 +820,7 @@ static int __bch2_set_nr_journal_buckets(struct bch_dev *ca, unsigned nr, * actually been added to the running filesystem: */ if (!new_fs) - spin_lock(&j->lock); + spin_lock(&c->journal.lock); memcpy(new_buckets, ja->buckets, ja->nr * sizeof(u64)); memcpy(new_bucket_seq, ja->bucket_seq, ja->nr * sizeof(u64)); @@ -860,9 +861,10 @@ static int __bch2_set_nr_journal_buckets(struct bch_dev *ca, unsigned nr, } if (!new_fs) - spin_unlock(&j->lock); + spin_unlock(&c->journal.lock); - bch2_journal_unblock(j); + if (c) + bch2_journal_unblock(&c->journal); if (ret) goto err; @@ -891,7 +893,8 @@ err: return ret; err_unblock: - bch2_journal_unblock(j); + if (c) + bch2_journal_unblock(&c->journal); goto err; } |