Commit d5f70c1f authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Write out alloc info more carefully

In flight btree updates could update alloc info until they're flushed -
so we have to try writing again after they've been flushed.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent ccaa61c9
...@@ -175,7 +175,7 @@ static void __bch2_fs_read_only(struct bch_fs *c) ...@@ -175,7 +175,7 @@ static void __bch2_fs_read_only(struct bch_fs *c)
{ {
struct bch_dev *ca; struct bch_dev *ca;
bool wrote; bool wrote;
unsigned i; unsigned i, clean_passes = 0;
int ret; int ret;
bch2_rebalance_stop(c); bch2_rebalance_stop(c);
...@@ -195,15 +195,15 @@ static void __bch2_fs_read_only(struct bch_fs *c) ...@@ -195,15 +195,15 @@ static void __bch2_fs_read_only(struct bch_fs *c)
goto allocator_not_running; goto allocator_not_running;
do { do {
ret = bch2_alloc_write(c, false, &wrote); ret = bch2_stripes_write(c, &wrote);
if (ret) { if (ret) {
bch2_fs_inconsistent(c, "error writing out alloc info %i", ret); bch2_fs_inconsistent(c, "error writing out stripes");
break; break;
} }
ret = bch2_stripes_write(c, &wrote); ret = bch2_alloc_write(c, false, &wrote);
if (ret) { if (ret) {
bch2_fs_inconsistent(c, "error writing out stripes"); bch2_fs_inconsistent(c, "error writing out alloc info %i", ret);
break; break;
} }
...@@ -221,7 +221,9 @@ static void __bch2_fs_read_only(struct bch_fs *c) ...@@ -221,7 +221,9 @@ static void __bch2_fs_read_only(struct bch_fs *c)
*/ */
closure_wait_event(&c->btree_interior_update_wait, closure_wait_event(&c->btree_interior_update_wait,
!bch2_btree_interior_updates_nr_pending(c)); !bch2_btree_interior_updates_nr_pending(c));
} while (wrote);
clean_passes = wrote ? 0 : clean_passes + 1;
} while (clean_passes < 2);
allocator_not_running: allocator_not_running:
for_each_member_device(ca, c, i) for_each_member_device(ca, c, i)
bch2_dev_allocator_stop(ca); bch2_dev_allocator_stop(ca);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment