]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/disk_groups.h
Disable pristine-tar option in gbp.conf, since there is no pristine-tar branch.
[bcachefs-tools-debian] / libbcachefs / disk_groups.h
index de915480514b10a4a4a692b84d00d9b5f6724b40..441826fff224369b79698442e6b314cf5331c02c 100644 (file)
@@ -2,6 +2,8 @@
 #ifndef _BCACHEFS_DISK_GROUPS_H
 #define _BCACHEFS_DISK_GROUPS_H
 
+#include "disk_groups_types.h"
+
 extern const struct bch_sb_field_ops bch_sb_field_ops_disk_groups;
 
 static inline unsigned disk_groups_nr(struct bch_sb_field_disk_groups *groups)
@@ -68,6 +70,14 @@ static inline struct bch_devs_mask target_rw_devs(struct bch_fs *c,
        return devs;
 }
 
+static inline bool bch2_target_accepts_data(struct bch_fs *c,
+                                           enum bch_data_type data_type,
+                                           u16 target)
+{
+       struct bch_devs_mask rw_devs = target_rw_devs(c, data_type, target);
+       return !bitmap_empty(rw_devs.d, BCH_SB_MEMBERS_MAX);
+}
+
 bool bch2_dev_in_target(struct bch_fs *, unsigned, unsigned);
 
 int bch2_disk_path_find(struct bch_sb_handle *, const char *);
@@ -75,16 +85,27 @@ int bch2_disk_path_find(struct bch_sb_handle *, const char *);
 /* Exported for userspace bcachefs-tools: */
 int bch2_disk_path_find_or_create(struct bch_sb_handle *, const char *);
 
-void bch2_disk_path_to_text(struct printbuf *, struct bch_sb *, unsigned);
+void bch2_disk_path_to_text(struct printbuf *, struct bch_fs *, unsigned);
+void bch2_disk_path_to_text_sb(struct printbuf *, struct bch_sb *, unsigned);
 
-int bch2_opt_target_parse(struct bch_fs *, const char *, u64 *);
+void bch2_target_to_text(struct printbuf *out, struct bch_fs *, unsigned);
+
+int bch2_opt_target_parse(struct bch_fs *, const char *, u64 *, struct printbuf *);
 void bch2_opt_target_to_text(struct printbuf *, struct bch_fs *, struct bch_sb *, u64);
 
+#define bch2_opt_target (struct bch_opt_fn) {          \
+       .parse          = bch2_opt_target_parse,        \
+       .to_text        = bch2_opt_target_to_text,      \
+}
+
 int bch2_sb_disk_groups_to_cpu(struct bch_fs *);
 
+int __bch2_dev_group_set(struct bch_fs *, struct bch_dev *, const char *);
 int bch2_dev_group_set(struct bch_fs *, struct bch_dev *, const char *);
 
 const char *bch2_sb_validate_disk_groups(struct bch_sb *,
                                         struct bch_sb_field *);
 
+void bch2_disk_groups_to_text(struct printbuf *, struct bch_fs *);
+
 #endif /* _BCACHEFS_DISK_GROUPS_H */