summaryrefslogtreecommitdiff
path: root/fs/bcachefs/replicas.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2018-10-30 14:32:47 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:11 -0400
commitaf9d3bc203c9ecb66f5ca344090b61722d9b755a (patch)
tree372e8caa25d74979bdb06964833602753b556442 /fs/bcachefs/replicas.h
parentc258f28ebab6be176f20173aac725092b39cbd2c (diff)
bcachefs: stripe support for replicas tracking
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/replicas.h')
-rw-r--r--fs/bcachefs/replicas.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/bcachefs/replicas.h b/fs/bcachefs/replicas.h
index d3d81a1a39cd..a343dd9cd97f 100644
--- a/fs/bcachefs/replicas.h
+++ b/fs/bcachefs/replicas.h
@@ -17,7 +17,7 @@ void bch2_cpu_replicas_to_text(struct printbuf *, struct bch_replicas_cpu *);
struct replicas_status {
struct {
- unsigned nr_online;
+ int redundancy;
unsigned nr_offline;
} replicas[BCH_DATA_NR];
};
@@ -27,7 +27,7 @@ struct replicas_status __bch2_replicas_status(struct bch_fs *,
struct replicas_status bch2_replicas_status(struct bch_fs *);
bool bch2_have_enough_devs(struct replicas_status, unsigned);
-unsigned bch2_replicas_online(struct bch_fs *, bool);
+int bch2_replicas_online(struct bch_fs *, bool);
unsigned bch2_dev_has_data(struct bch_fs *, struct bch_dev *);
int bch2_replicas_gc_end(struct bch_fs *, int);
@@ -46,8 +46,14 @@ int bch2_replicas_gc_start(struct bch_fs *, unsigned);
(void *) (_i) < vstruct_end(&(_r)->field) && (_i)->data_type;\
(_i) = replicas_entry_next(_i))
+#define for_each_replicas_entry_v0(_r, _i) \
+ for (_i = (_r)->entries; \
+ (void *) (_i) < vstruct_end(&(_r)->field) && (_i)->data_type;\
+ (_i) = replicas_entry_next(_i))
+
int bch2_sb_replicas_to_cpu_replicas(struct bch_fs *);
extern const struct bch_sb_field_ops bch_sb_field_ops_replicas;
+extern const struct bch_sb_field_ops bch_sb_field_ops_replicas_v0;
#endif /* _BCACHEFS_REPLICAS_H */