diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-09-26 17:49:34 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:10:16 -0400 |
commit | 4637429e3946d083eedde1668c17a4fadaf3c0b1 (patch) | |
tree | e963537ab982b1a82fa0aa33afab53713ce33fa7 /fs/bcachefs/super-io.h | |
parent | be47e0ba4fc92bd065ac0b7ad345913eea1bc6fc (diff) | |
download | linux-4637429e3946d083eedde1668c17a4fadaf3c0b1.tar.gz linux-4637429e3946d083eedde1668c17a4fadaf3c0b1.tar.bz2 linux-4637429e3946d083eedde1668c17a4fadaf3c0b1.zip |
bcachefs: bch2_sb_field_get() refactoring
Instead of using token pasting to generate methods for each superblock
section, just make the type a parameter to bch2_sb_field_get().
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/super-io.h')
-rw-r--r-- | fs/bcachefs/super-io.h | 30 |
1 files changed, 9 insertions, 21 deletions
diff --git a/fs/bcachefs/super-io.h b/fs/bcachefs/super-io.h index f7e9099931a7..b0d8584f475f 100644 --- a/fs/bcachefs/super-io.h +++ b/fs/bcachefs/super-io.h @@ -23,31 +23,19 @@ 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); -void bch2_sb_field_delete(struct bch_sb_handle *, enum bch_sb_field_type); - #define field_to_type(_f, _name) \ container_of_or_null(_f, struct bch_sb_field_##_name, field) -#define x(_name, _nr) \ -static inline struct bch_sb_field_##_name * \ -bch2_sb_get_##_name(struct bch_sb *sb) \ -{ \ - return field_to_type(bch2_sb_field_get(sb, \ - BCH_SB_FIELD_##_name), _name); \ -} \ - \ -static inline struct bch_sb_field_##_name * \ -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); \ -} +struct bch_sb_field *bch2_sb_field_get_id(struct bch_sb *, enum bch_sb_field_type); +#define bch2_sb_field_get(_sb, _name) \ + field_to_type(bch2_sb_field_get_id(_sb, BCH_SB_FIELD_##_name), _name) -BCH_SB_FIELDS() -#undef x +struct bch_sb_field *bch2_sb_field_resize_id(struct bch_sb_handle *, + enum bch_sb_field_type, unsigned); +#define bch2_sb_field_resize(_sb, _name, _u64s) \ + field_to_type(bch2_sb_field_resize_id(_sb, BCH_SB_FIELD_##_name, _u64s), _name) + +void bch2_sb_field_delete(struct bch_sb_handle *, enum bch_sb_field_type); extern const char * const bch2_sb_fields[]; |