-#ifndef _BCACHE_SUPER_IO_H
-#define _BCACHE_SUPER_IO_H
+#ifndef _BCACHEFS_SUPER_IO_H
+#define _BCACHEFS_SUPER_IO_H
#include "extents.h"
#include "eytzinger.h"
#include <asm/byteorder.h>
struct bch_sb_field *bch2_sb_field_get(struct bch_sb *, enum bch_sb_field_type);
-struct bch_sb_field *bch2_sb_field_resize(struct bcache_superblock *,
- enum bch_sb_field_type, unsigned);
+struct bch_sb_field *bch2_sb_field_resize(struct bch_sb_handle *,
+ enum bch_sb_field_type, unsigned);
struct bch_sb_field *bch2_fs_sb_field_resize(struct bch_fs *,
enum bch_sb_field_type, unsigned);
} \
\
static inline struct bch_sb_field_##_name * \
-bch2_sb_resize_##_name(struct bcache_superblock *sb, unsigned u64s) \
+bch2_sb_resize_##_name(struct bch_sb_handle *sb, unsigned u64s) \
{ \
return field_to_type(bch2_sb_field_resize(sb, \
BCH_SB_FIELD_##_name, u64s), _name); \
.tier = BCH_MEMBER_TIER(mi),
.replacement = BCH_MEMBER_REPLACEMENT(mi),
.discard = BCH_MEMBER_DISCARD(mi),
+ .data_allowed = BCH_MEMBER_DATA_ALLOWED(mi),
.valid = !bch2_is_zero(mi->uuid.b, sizeof(uuid_le)),
};
}
int bch2_sb_to_fs(struct bch_fs *, struct bch_sb *);
int bch2_sb_from_fs(struct bch_fs *, struct bch_dev *);
-void bch2_free_super(struct bcache_superblock *);
-int bch2_super_realloc(struct bcache_superblock *, unsigned);
+void bch2_free_super(struct bch_sb_handle *);
+int bch2_super_realloc(struct bch_sb_handle *, unsigned);
const char *bch2_sb_validate_journal(struct bch_sb *,
struct bch_member_cpu);
-const char *bch2_sb_validate(struct bcache_superblock *);
+const char *bch2_sb_validate(struct bch_sb_handle *);
-const char *bch2_read_super(struct bcache_superblock *,
- struct bch_opts, const char *);
+const char *bch2_read_super(const char *, struct bch_opts,
+ struct bch_sb_handle *);
void bch2_write_super(struct bch_fs *);
+/* replicas: */
+
+/* iterate over bch_sb_field_replicas: */
+
+static inline struct bch_replicas_entry *
+replicas_entry_next(struct bch_replicas_entry *i)
+{
+ return (void *) i + offsetof(struct bch_replicas_entry, devs) + i->nr;
+}
+
+#define for_each_replicas_entry(_r, _i) \
+ for (_i = (_r)->entries; \
+ (void *) (_i) < vstruct_end(&(_r)->field) && (_i)->data_type;\
+ (_i) = replicas_entry_next(_i))
+
bool bch2_sb_has_replicas(struct bch_fs *, struct bkey_s_c_extent,
- enum bch_data_types);
+ enum bch_data_type);
int bch2_check_mark_super(struct bch_fs *, struct bkey_s_c_extent,
- enum bch_data_types);
+ enum bch_data_type);
struct replicas_status {
struct {
int bch2_replicas_gc_end(struct bch_fs *, int);
int bch2_replicas_gc_start(struct bch_fs *, unsigned);
-#endif /* _BCACHE_SUPER_IO_H */
+#endif /* _BCACHEFS_SUPER_IO_H */