]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/super-io.h
cmd_set_passphrase: revoke the invalidated key
[bcachefs-tools-debian] / libbcachefs / super-io.h
index 3b425bed17c48c51a552ae0e2b8e73bde01a91c3..d51c0a19586fc09ac328d2c0292ccdfc12a85840 100644 (file)
@@ -9,6 +9,19 @@
 
 #include <asm/byteorder.h>
 
+static inline bool bch2_version_compatible(u16 version)
+{
+       return BCH_VERSION_MAJOR(version) <= BCH_VERSION_MAJOR(bcachefs_metadata_version_current) &&
+               version >= bcachefs_metadata_version_min;
+}
+
+void bch2_version_to_text(struct printbuf *, unsigned);
+unsigned bch2_latest_compatible_version(unsigned);
+
+u64 bch2_upgrade_recovery_passes(struct bch_fs *c,
+                                unsigned,
+                                unsigned);
+
 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 bch_sb_handle *,
                                          enum bch_sb_field_type, unsigned);
@@ -45,6 +58,7 @@ struct bch_sb_field_ops {
 static inline __le64 bch2_sb_magic(struct bch_fs *c)
 {
        __le64 ret;
+
        memcpy(&ret, &c->sb.uuid, sizeof(ret));
        return ret;
 }
@@ -75,20 +89,11 @@ static inline void bch2_check_set_feature(struct bch_fs *c, unsigned feat)
                __bch2_check_set_feature(c, feat);
 }
 
-/* BCH_SB_FIELD_journal: */
-
-static inline unsigned bch2_nr_journal_buckets(struct bch_sb_field_journal *j)
-{
-       return j
-               ? (__le64 *) vstruct_end(&j->field) - j->buckets
-               : 0;
-}
-
 /* BCH_SB_FIELD_members: */
 
 static inline bool bch2_member_exists(struct bch_member *m)
 {
-       return !bch2_is_zero(m->uuid.b, sizeof(uuid_le));
+       return !bch2_is_zero(&m->uuid, sizeof(m->uuid));
 }
 
 static inline bool bch2_dev_exists(struct bch_sb *sb,
@@ -112,21 +117,17 @@ static inline struct bch_member_cpu bch2_mi_to_cpu(struct bch_member *mi)
                .durability     = BCH_MEMBER_DURABILITY(mi)
                        ? BCH_MEMBER_DURABILITY(mi) - 1
                        : 1,
-               .valid          = !bch2_is_zero(mi->uuid.b, sizeof(uuid_le)),
+               .freespace_initialized = BCH_MEMBER_FREESPACE_INITIALIZED(mi),
+               .valid          = bch2_member_exists(mi),
        };
 }
 
-/* BCH_SB_FIELD_clean: */
-
-void bch2_journal_super_entries_add_common(struct bch_fs *,
-                                          struct jset_entry **, u64);
-
-int bch2_sb_clean_validate(struct bch_fs *, struct bch_sb_field_clean *, int);
-
-int bch2_fs_mark_dirty(struct bch_fs *);
-void bch2_fs_mark_clean(struct bch_fs *);
+void bch2_sb_maybe_downgrade(struct bch_fs *);
+void bch2_sb_upgrade(struct bch_fs *, unsigned);
 
 void bch2_sb_field_to_text(struct printbuf *, struct bch_sb *,
                           struct bch_sb_field *);
+void bch2_sb_layout_to_text(struct printbuf *, struct bch_sb_layout *);
+void bch2_sb_to_text(struct printbuf *, struct bch_sb *, bool, unsigned);
 
 #endif /* _BCACHEFS_SUPER_IO_H */