diff options
author | Daniel Hill <daniel@gluo.nz> | 2023-11-27 23:37:44 +1300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-29 22:24:37 -0500 |
commit | d3f1eb18f25c415759e68699794731aabe7db727 (patch) | |
tree | 310a7299d0c746560f66116a21357dad75a28c4a | |
parent | 1a894c3da038994bbb117a0b4a3678c9e9f42e83 (diff) |
bcachefs: copygc shouldn't try moving buckets on errorcopygc_get_buckets
Signed-off-by: Daniel Hill <daniel@gluo.nz>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | fs/bcachefs/movinggc.c | 16 |
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; })); |