Skip to content

Commit 44ec599

Browse files
author
Kent Overstreet
committed
bcachefs: Don't use the new_fs() bucket alloc path on an initialized fs
On a new filesystem or device we have to allocate the journal with a bump allocator, because allocation info isn't ready yet - but when hot-adding a device that doesn't have a journal, we don't want to use that path. Reported-by: [email protected] Signed-off-by: Kent Overstreet <[email protected]>
1 parent a0bd30e commit 44ec599

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

fs/bcachefs/journal.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ int bch2_set_nr_journal_buckets(struct bch_fs *c, struct bch_dev *ca,
10951095
return ret;
10961096
}
10971097

1098-
int bch2_dev_journal_alloc(struct bch_dev *ca)
1098+
int bch2_dev_journal_alloc(struct bch_dev *ca, bool new_fs)
10991099
{
11001100
unsigned nr;
11011101
int ret;
@@ -1117,7 +1117,7 @@ int bch2_dev_journal_alloc(struct bch_dev *ca)
11171117
min(1 << 13,
11181118
(1 << 24) / ca->mi.bucket_size));
11191119

1120-
ret = __bch2_set_nr_journal_buckets(ca, nr, true, NULL);
1120+
ret = __bch2_set_nr_journal_buckets(ca, nr, new_fs, NULL);
11211121
err:
11221122
bch_err_fn(ca, ret);
11231123
return ret;
@@ -1129,7 +1129,7 @@ int bch2_fs_journal_alloc(struct bch_fs *c)
11291129
if (ca->journal.nr)
11301130
continue;
11311131

1132-
int ret = bch2_dev_journal_alloc(ca);
1132+
int ret = bch2_dev_journal_alloc(ca, true);
11331133
if (ret) {
11341134
percpu_ref_put(&ca->io_ref);
11351135
return ret;

fs/bcachefs/journal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ bool bch2_journal_seq_pins_to_text(struct printbuf *, struct journal *, u64 *);
433433

434434
int bch2_set_nr_journal_buckets(struct bch_fs *, struct bch_dev *,
435435
unsigned nr);
436-
int bch2_dev_journal_alloc(struct bch_dev *);
436+
int bch2_dev_journal_alloc(struct bch_dev *, bool);
437437
int bch2_fs_journal_alloc(struct bch_fs *);
438438

439439
void bch2_dev_journal_stop(struct journal *, struct bch_dev *);

fs/bcachefs/super.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,7 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
17721772
if (ret)
17731773
goto err;
17741774

1775-
ret = bch2_dev_journal_alloc(ca);
1775+
ret = bch2_dev_journal_alloc(ca, true);
17761776
bch_err_msg(c, ret, "allocating journal");
17771777
if (ret)
17781778
goto err;
@@ -1932,7 +1932,7 @@ int bch2_dev_online(struct bch_fs *c, const char *path)
19321932
}
19331933

19341934
if (!ca->journal.nr) {
1935-
ret = bch2_dev_journal_alloc(ca);
1935+
ret = bch2_dev_journal_alloc(ca, false);
19361936
bch_err_msg(ca, ret, "allocating journal");
19371937
if (ret)
19381938
goto err;

0 commit comments

Comments
 (0)