summaryrefslogtreecommitdiff
path: root/fs/bcachefs/move_types.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-03-11 22:44:41 +0300
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-23 00:09:58 +0300
commit32de2ea0d5b7e2bc2a4eeac47e38aceb0ff25cc9 (patch)
treeb752d752a59ad1b8d32027ad6ffa6e9c42f7a4d1 /fs/bcachefs/move_types.h
parent6bdefe9c3900b3bb7a028486423520cdc975d9a8 (diff)
downloadlinux-32de2ea0d5b7e2bc2a4eeac47e38aceb0ff25cc9.tar.xz
bcachefs: Rhashtable based buckets_in_flight for copygc
Previously, copygc used a fifo for tracking buckets in flight - this had the disadvantage of being fixed size, since we pass references to elements into the move code. This restructures it to be a hash table and linked list, since with erasure coding we need to be able to pipeline across an arbitrary number of buckets. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/move_types.h')
-rw-r--r--fs/bcachefs/move_types.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/bcachefs/move_types.h b/fs/bcachefs/move_types.h
index 285ffdb762ac..baf1f8570b3f 100644
--- a/fs/bcachefs/move_types.h
+++ b/fs/bcachefs/move_types.h
@@ -16,9 +16,20 @@ struct bch_move_stats {
atomic64_t sectors_raced;
};
-struct move_bucket_in_flight {
+struct move_bucket_key {
struct bpos bucket;
u8 gen;
+};
+
+struct move_bucket {
+ struct move_bucket_key k;
+ unsigned sectors;
+};
+
+struct move_bucket_in_flight {
+ struct move_bucket_in_flight *next;
+ struct rhash_head hash;
+ struct move_bucket bucket;
atomic_t count;
};