~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/bcachefs/super-io.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _BCACHEFS_SUPER_IO_H
  3 #define _BCACHEFS_SUPER_IO_H
  4 
  5 #include "extents.h"
  6 #include "eytzinger.h"
  7 #include "super_types.h"
  8 #include "super.h"
  9 #include "sb-members.h"
 10 
 11 #include <asm/byteorder.h>
 12 
 13 static inline bool bch2_version_compatible(u16 version)
 14 {
 15         return BCH_VERSION_MAJOR(version) <= BCH_VERSION_MAJOR(bcachefs_metadata_version_current) &&
 16                 version >= bcachefs_metadata_version_min;
 17 }
 18 
 19 void bch2_version_to_text(struct printbuf *, unsigned);
 20 unsigned bch2_latest_compatible_version(unsigned);
 21 
 22 static inline size_t bch2_sb_field_bytes(struct bch_sb_field *f)
 23 {
 24         return le32_to_cpu(f->u64s) * sizeof(u64);
 25 }
 26 
 27 #define field_to_type(_f, _name)                                        \
 28         container_of_or_null(_f, struct bch_sb_field_##_name, field)
 29 
 30 struct bch_sb_field *bch2_sb_field_get_id(struct bch_sb *, enum bch_sb_field_type);
 31 #define bch2_sb_field_get(_sb, _name)                                   \
 32         field_to_type(bch2_sb_field_get_id(_sb, BCH_SB_FIELD_##_name), _name)
 33 
 34 struct bch_sb_field *bch2_sb_field_resize_id(struct bch_sb_handle *,
 35                                              enum bch_sb_field_type, unsigned);
 36 #define bch2_sb_field_resize(_sb, _name, _u64s)                         \
 37         field_to_type(bch2_sb_field_resize_id(_sb, BCH_SB_FIELD_##_name, _u64s), _name)
 38 
 39 struct bch_sb_field *bch2_sb_field_get_minsize_id(struct bch_sb_handle *,
 40                                         enum bch_sb_field_type, unsigned);
 41 #define bch2_sb_field_get_minsize(_sb, _name, _u64s)                            \
 42         field_to_type(bch2_sb_field_get_minsize_id(_sb, BCH_SB_FIELD_##_name, _u64s), _name)
 43 
 44 #define bch2_sb_field_nr_entries(_f)                                    \
 45         (_f ? ((bch2_sb_field_bytes(&_f->field) - sizeof(*_f)) /        \
 46                sizeof(_f->entries[0]))                                  \
 47             : 0)
 48 
 49 void bch2_sb_field_delete(struct bch_sb_handle *, enum bch_sb_field_type);
 50 
 51 extern const char * const bch2_sb_fields[];
 52 
 53 struct bch_sb_field_ops {
 54         int     (*validate)(struct bch_sb *, struct bch_sb_field *,
 55                             enum bch_validate_flags, struct printbuf *);
 56         void    (*to_text)(struct printbuf *, struct bch_sb *, struct bch_sb_field *);
 57 };
 58 
 59 static inline __le64 bch2_sb_magic(struct bch_fs *c)
 60 {
 61         __le64 ret;
 62 
 63         memcpy(&ret, &c->sb.uuid, sizeof(ret));
 64         return ret;
 65 }
 66 
 67 static inline __u64 jset_magic(struct bch_fs *c)
 68 {
 69         return __le64_to_cpu(bch2_sb_magic(c) ^ JSET_MAGIC);
 70 }
 71 
 72 static inline __u64 bset_magic(struct bch_fs *c)
 73 {
 74         return __le64_to_cpu(bch2_sb_magic(c) ^ BSET_MAGIC);
 75 }
 76 
 77 int bch2_sb_to_fs(struct bch_fs *, struct bch_sb *);
 78 int bch2_sb_from_fs(struct bch_fs *, struct bch_dev *);
 79 
 80 void bch2_free_super(struct bch_sb_handle *);
 81 int bch2_sb_realloc(struct bch_sb_handle *, unsigned);
 82 
 83 int bch2_read_super(const char *, struct bch_opts *, struct bch_sb_handle *);
 84 int bch2_read_super_silent(const char *, struct bch_opts *, struct bch_sb_handle *);
 85 int bch2_write_super(struct bch_fs *);
 86 void __bch2_check_set_feature(struct bch_fs *, unsigned);
 87 
 88 static inline void bch2_check_set_feature(struct bch_fs *c, unsigned feat)
 89 {
 90         if (!(c->sb.features & (1ULL << feat)))
 91                 __bch2_check_set_feature(c, feat);
 92 }
 93 
 94 bool bch2_check_version_downgrade(struct bch_fs *);
 95 void bch2_sb_upgrade(struct bch_fs *, unsigned);
 96 
 97 void __bch2_sb_field_to_text(struct printbuf *, struct bch_sb *,
 98                              struct bch_sb_field *);
 99 void bch2_sb_field_to_text(struct printbuf *, struct bch_sb *,
100                            struct bch_sb_field *);
101 void bch2_sb_layout_to_text(struct printbuf *, struct bch_sb_layout *);
102 void bch2_sb_to_text(struct printbuf *, struct bch_sb *, bool, unsigned);
103 
104 #endif /* _BCACHEFS_SUPER_IO_H */
105 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php