aboutsummaryrefslogtreecommitdiff
path: root/fs/bcachefs/movinggc.c
diff options
context:
space:
mode:
authorGravatar Daniel Hill <daniel@gluo.nz> 2023-11-27 23:37:44 +1300
committerGravatar Kent Overstreet <kent.overstreet@linux.dev> 2024-01-01 11:47:39 -0500
commita79e1b6dea0b98a66dc0d05fd8e470c18b164b52 (patch)
tree6b98e4b7462918f956aeac82b9b4a45013dec9d9 /fs/bcachefs/movinggc.c
parentbcachefs: Explicity go RW for fsck (diff)
downloadlinux-a79e1b6dea0b98a66dc0d05fd8e470c18b164b52.tar.gz
linux-a79e1b6dea0b98a66dc0d05fd8e470c18b164b52.tar.bz2
linux-a79e1b6dea0b98a66dc0d05fd8e470c18b164b52.zip
bcachefs: copygc shouldn't try moving buckets on error
Co-developed-by: Kent Overstreet <kent.overstreet@linux.dev> Signed-off-by: Daniel Hill <daniel@gluo.nz> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/movinggc.c')
-rw-r--r--fs/bcachefs/movinggc.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/fs/bcachefs/movinggc.c b/fs/bcachefs/movinggc.c
index 7155e2060d29..fd239a261aca 100644
--- a/fs/bcachefs/movinggc.c
+++ b/fs/bcachefs/movinggc.c
@@ -170,15 +170,23 @@ static int bch2_copygc_get_buckets(struct moving_context *ctxt,
saw++;
- if (!bch2_bucket_is_movable(trans, &b, lru_pos_time(k.k->p)))
+ ret2 = bch2_bucket_is_movable(trans, &b, lru_pos_time(k.k->p));
+ if (ret2 < 0)
+ goto err;
+
+ if (!ret2)
not_movable++;
else if (bucket_in_flight(buckets_in_flight, b.k))
in_flight++;
else {
- ret2 = darray_push(buckets, b) ?: buckets->nr >= nr_to_get;
- if (ret2 >= 0)
- sectors += b.sectors;
+ ret2 = darray_push(buckets, b);
+ if (ret2)
+ goto err;
+ sectors += b.sectors;
}
+
+ ret2 = buckets->nr >= nr_to_get;
+err:
ret2;
}));