]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Rename bch_replicas_entry -> bch_replicas_entry_v1
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 9 Nov 2023 18:52:35 +0000 (13:52 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Mon, 1 Jan 2024 16:47:38 +0000 (11:47 -0500)
Prep work for introducing bch_replicas_entry_v2

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/bcachefs_format.h
fs/bcachefs/bcachefs_ioctl.h
fs/bcachefs/btree_gc.c
fs/bcachefs/buckets.c
fs/bcachefs/chardev.c
fs/bcachefs/ec_types.h
fs/bcachefs/replicas.c
fs/bcachefs/replicas.h
fs/bcachefs/replicas_types.h
fs/bcachefs/sb-clean.c

index 60b2264e019e39f5dca11b4f5684f9efc721a1ea..d2eb1bd0c8ee736d6cf0473fe1ca981e86f7bc9f 100644 (file)
@@ -1449,7 +1449,7 @@ struct bch_sb_field_replicas_v0 {
        struct bch_replicas_entry_v0 entries[];
 } __packed __aligned(8);
 
-struct bch_replicas_entry {
+struct bch_replicas_entry_v1 {
        __u8                    data_type;
        __u8                    nr_devs;
        __u8                    nr_required;
@@ -1461,7 +1461,7 @@ struct bch_replicas_entry {
 
 struct bch_sb_field_replicas {
        struct bch_sb_field     field;
-       struct bch_replicas_entry entries[];
+       struct bch_replicas_entry_v1 entries[];
 } __packed __aligned(8);
 
 /* BCH_SB_FIELD_quota: */
@@ -2210,7 +2210,7 @@ struct jset_entry_usage {
 struct jset_entry_data_usage {
        struct jset_entry       entry;
        __le64                  v;
-       struct bch_replicas_entry r;
+       struct bch_replicas_entry_v1 r;
 } __packed;
 
 struct jset_entry_clock {
index f05881f7e1135abe30771f20f19d98693844475d..934da1b0e37b2c05086b803da5187424dc7a7236 100644 (file)
@@ -237,7 +237,7 @@ struct bch_ioctl_data_event {
 
 struct bch_replicas_usage {
        __u64                   sectors;
-       struct bch_replicas_entry r;
+       struct bch_replicas_entry_v1 r;
 } __packed;
 
 static inline struct bch_replicas_usage *
index f53afa2acd8c7112008ca54016a7ec3d1ffa2776..2304a6ab0d0ce62b2da91d6faec406df2447e0f0 100644 (file)
@@ -1284,7 +1284,7 @@ static int bch2_gc_done(struct bch_fs *c,
                }
 
                for (i = 0; i < c->replicas.nr; i++) {
-                       struct bch_replicas_entry *e =
+                       struct bch_replicas_entry_v1 *e =
                                cpu_replicas_entry(&c->replicas, i);
 
                        if (metadata_only &&
index 5a91d3189fcf7ea95615d46dd11a9ad83f8e8363..dd794b63a358e286d6419747577f8c9dfa643bd6 100644 (file)
@@ -61,7 +61,7 @@ void bch2_fs_usage_initialize(struct bch_fs *c)
                usage->reserved += usage->persistent_reserved[i];
 
        for (i = 0; i < c->replicas.nr; i++) {
-               struct bch_replicas_entry *e =
+               struct bch_replicas_entry_v1 *e =
                        cpu_replicas_entry(&c->replicas, i);
 
                fs_usage_data_type_to_base(usage, e->data_type, usage->replicas[i]);
@@ -214,7 +214,7 @@ void bch2_fs_usage_to_text(struct printbuf *out,
        }
 
        for (i = 0; i < c->replicas.nr; i++) {
-               struct bch_replicas_entry *e =
+               struct bch_replicas_entry_v1 *e =
                        cpu_replicas_entry(&c->replicas, i);
 
                prt_printf(out, "\t");
@@ -345,7 +345,7 @@ static void bch2_dev_usage_update_m(struct bch_fs *c, struct bch_dev *ca,
 
 static inline int __update_replicas(struct bch_fs *c,
                                    struct bch_fs_usage *fs_usage,
-                                   struct bch_replicas_entry *r,
+                                   struct bch_replicas_entry_v1 *r,
                                    s64 sectors)
 {
        int idx = bch2_replicas_entry_idx(c, r);
@@ -359,7 +359,7 @@ static inline int __update_replicas(struct bch_fs *c,
 }
 
 static inline int update_replicas(struct bch_fs *c, struct bkey_s_c k,
-                       struct bch_replicas_entry *r, s64 sectors,
+                       struct bch_replicas_entry_v1 *r, s64 sectors,
                        unsigned journal_seq, bool gc)
 {
        struct bch_fs_usage *fs_usage;
@@ -454,7 +454,7 @@ int bch2_replicas_deltas_realloc(struct btree_trans *trans, unsigned more)
 }
 
 static inline int update_replicas_list(struct btree_trans *trans,
-                                       struct bch_replicas_entry *r,
+                                       struct bch_replicas_entry_v1 *r,
                                        s64 sectors)
 {
        struct replicas_delta_list *d;
index 4bb88aefed121f275582df94e3cea9dcdec7c58c..de3d82de9d290a07ff09d27d93bf5c98bfad7309 100644 (file)
@@ -444,7 +444,7 @@ static long bch2_ioctl_fs_usage(struct bch_fs *c,
        dst_end = (void *) arg->replicas + replica_entries_bytes;
 
        for (i = 0; i < c->replicas.nr; i++) {
-               struct bch_replicas_entry *src_e =
+               struct bch_replicas_entry_v1 *src_e =
                        cpu_replicas_entry(&c->replicas, i);
 
                /* check that we have enough space for one replicas entry */
index e2b02a82de321bb4612e79eb1034ed997e7f3f0f..976426da3a124aaeb7edd70747cd71e547558224 100644 (file)
@@ -5,7 +5,7 @@
 #include "bcachefs_format.h"
 
 struct bch_replicas_padded {
-       struct bch_replicas_entry       e;
+       struct bch_replicas_entry_v1    e;
        u8                              pad[BCH_BKEY_PTRS_MAX];
 };
 
index 2008fe8bf7060d0e4da522e723ce3ae6fbc42d9e..ccb776e045dc11e15bbc86ff11caa0c7259eac3a 100644 (file)
@@ -11,7 +11,7 @@ static int bch2_cpu_replicas_to_sb_replicas(struct bch_fs *,
 
 /* Replicas tracking - in memory: */
 
-static void verify_replicas_entry(struct bch_replicas_entry *e)
+static void verify_replicas_entry(struct bch_replicas_entry_v1 *e)
 {
 #ifdef CONFIG_BCACHEFS_DEBUG
        unsigned i;
@@ -26,7 +26,7 @@ static void verify_replicas_entry(struct bch_replicas_entry *e)
 #endif
 }
 
-void bch2_replicas_entry_sort(struct bch_replicas_entry *e)
+void bch2_replicas_entry_sort(struct bch_replicas_entry_v1 *e)
 {
        bubble_sort(e->devs, e->nr_devs, u8_cmp);
 }
@@ -53,7 +53,7 @@ static void bch2_replicas_entry_v0_to_text(struct printbuf *out,
 }
 
 void bch2_replicas_entry_to_text(struct printbuf *out,
-                                struct bch_replicas_entry *e)
+                                struct bch_replicas_entry_v1 *e)
 {
        unsigned i;
 
@@ -68,7 +68,7 @@ void bch2_replicas_entry_to_text(struct printbuf *out,
        prt_printf(out, "]");
 }
 
-int bch2_replicas_entry_validate(struct bch_replicas_entry *r,
+int bch2_replicas_entry_validate(struct bch_replicas_entry_v1 *r,
                                 struct bch_sb *sb,
                                 struct printbuf *err)
 {
@@ -98,7 +98,7 @@ bad:
 void bch2_cpu_replicas_to_text(struct printbuf *out,
                               struct bch_replicas_cpu *r)
 {
-       struct bch_replicas_entry *e;
+       struct bch_replicas_entry_v1 *e;
        bool first = true;
 
        for_each_cpu_replicas_entry(r, e) {
@@ -111,7 +111,7 @@ void bch2_cpu_replicas_to_text(struct printbuf *out,
 }
 
 static void extent_to_replicas(struct bkey_s_c k,
-                              struct bch_replicas_entry *r)
+                              struct bch_replicas_entry_v1 *r)
 {
        struct bkey_ptrs_c ptrs = bch2_bkey_ptrs_c(k);
        const union bch_extent_entry *entry;
@@ -131,7 +131,7 @@ static void extent_to_replicas(struct bkey_s_c k,
 }
 
 static void stripe_to_replicas(struct bkey_s_c k,
-                              struct bch_replicas_entry *r)
+                              struct bch_replicas_entry_v1 *r)
 {
        struct bkey_s_c_stripe s = bkey_s_c_to_stripe(k);
        const struct bch_extent_ptr *ptr;
@@ -144,7 +144,7 @@ static void stripe_to_replicas(struct bkey_s_c k,
                r->devs[r->nr_devs++] = ptr->dev;
 }
 
-void bch2_bkey_to_replicas(struct bch_replicas_entry *e,
+void bch2_bkey_to_replicas(struct bch_replicas_entry_v1 *e,
                           struct bkey_s_c k)
 {
        e->nr_devs = 0;
@@ -169,7 +169,7 @@ void bch2_bkey_to_replicas(struct bch_replicas_entry *e,
        bch2_replicas_entry_sort(e);
 }
 
-void bch2_devlist_to_replicas(struct bch_replicas_entry *e,
+void bch2_devlist_to_replicas(struct bch_replicas_entry_v1 *e,
                              enum bch_data_type data_type,
                              struct bch_devs_list devs)
 {
@@ -192,7 +192,7 @@ void bch2_devlist_to_replicas(struct bch_replicas_entry *e,
 static struct bch_replicas_cpu
 cpu_replicas_add_entry(struct bch_fs *c,
                       struct bch_replicas_cpu *old,
-                      struct bch_replicas_entry *new_entry)
+                      struct bch_replicas_entry_v1 *new_entry)
 {
        unsigned i;
        struct bch_replicas_cpu new = {
@@ -225,7 +225,7 @@ cpu_replicas_add_entry(struct bch_fs *c,
 }
 
 static inline int __replicas_entry_idx(struct bch_replicas_cpu *r,
-                                      struct bch_replicas_entry *search)
+                                      struct bch_replicas_entry_v1 *search)
 {
        int idx, entry_size = replicas_entry_bytes(search);
 
@@ -243,7 +243,7 @@ static inline int __replicas_entry_idx(struct bch_replicas_cpu *r,
 }
 
 int bch2_replicas_entry_idx(struct bch_fs *c,
-                           struct bch_replicas_entry *search)
+                           struct bch_replicas_entry_v1 *search)
 {
        bch2_replicas_entry_sort(search);
 
@@ -251,13 +251,13 @@ int bch2_replicas_entry_idx(struct bch_fs *c,
 }
 
 static bool __replicas_has_entry(struct bch_replicas_cpu *r,
-                                struct bch_replicas_entry *search)
+                                struct bch_replicas_entry_v1 *search)
 {
        return __replicas_entry_idx(r, search) >= 0;
 }
 
 bool bch2_replicas_marked(struct bch_fs *c,
-                         struct bch_replicas_entry *search)
+                         struct bch_replicas_entry_v1 *search)
 {
        bool marked;
 
@@ -374,7 +374,7 @@ err:
 static unsigned reserve_journal_replicas(struct bch_fs *c,
                                     struct bch_replicas_cpu *r)
 {
-       struct bch_replicas_entry *e;
+       struct bch_replicas_entry_v1 *e;
        unsigned journal_res_u64s = 0;
 
        /* nr_inodes: */
@@ -399,7 +399,7 @@ static unsigned reserve_journal_replicas(struct bch_fs *c,
 
 noinline
 static int bch2_mark_replicas_slowpath(struct bch_fs *c,
-                               struct bch_replicas_entry *new_entry)
+                               struct bch_replicas_entry_v1 *new_entry)
 {
        struct bch_replicas_cpu new_r, new_gc;
        int ret = 0;
@@ -464,7 +464,7 @@ err:
        goto out;
 }
 
-int bch2_mark_replicas(struct bch_fs *c, struct bch_replicas_entry *r)
+int bch2_mark_replicas(struct bch_fs *c, struct bch_replicas_entry_v1 *r)
 {
        return likely(bch2_replicas_marked(c, r))
                ? 0 : bch2_mark_replicas_slowpath(c, r);
@@ -515,7 +515,7 @@ int bch2_replicas_gc_end(struct bch_fs *c, int ret)
 
 int bch2_replicas_gc_start(struct bch_fs *c, unsigned typemask)
 {
-       struct bch_replicas_entry *e;
+       struct bch_replicas_entry_v1 *e;
        unsigned i = 0;
 
        lockdep_assert_held(&c->replicas_gc_lock);
@@ -590,7 +590,7 @@ retry:
        }
 
        for (i = 0; i < c->replicas.nr; i++) {
-               struct bch_replicas_entry *e =
+               struct bch_replicas_entry_v1 *e =
                        cpu_replicas_entry(&c->replicas, i);
 
                if (e->data_type == BCH_DATA_journal ||
@@ -621,7 +621,7 @@ retry:
 }
 
 int bch2_replicas_set_usage(struct bch_fs *c,
-                           struct bch_replicas_entry *r,
+                           struct bch_replicas_entry_v1 *r,
                            u64 sectors)
 {
        int ret, idx = bch2_replicas_entry_idx(c, r);
@@ -654,7 +654,7 @@ static int
 __bch2_sb_replicas_to_cpu_replicas(struct bch_sb_field_replicas *sb_r,
                                   struct bch_replicas_cpu *cpu_r)
 {
-       struct bch_replicas_entry *e, *dst;
+       struct bch_replicas_entry_v1 *e, *dst;
        unsigned nr = 0, entry_size = 0, idx = 0;
 
        for_each_replicas_entry(sb_r, e) {
@@ -692,7 +692,7 @@ __bch2_sb_replicas_v0_to_cpu_replicas(struct bch_sb_field_replicas_v0 *sb_r,
                nr++;
        }
 
-       entry_size += sizeof(struct bch_replicas_entry) -
+       entry_size += sizeof(struct bch_replicas_entry_v1) -
                sizeof(struct bch_replicas_entry_v0);
 
        cpu_r->entries = kcalloc(nr, entry_size, GFP_KERNEL);
@@ -703,7 +703,7 @@ __bch2_sb_replicas_v0_to_cpu_replicas(struct bch_sb_field_replicas_v0 *sb_r,
        cpu_r->entry_size       = entry_size;
 
        for_each_replicas_entry(sb_r, e) {
-               struct bch_replicas_entry *dst =
+               struct bch_replicas_entry_v1 *dst =
                        cpu_replicas_entry(cpu_r, idx++);
 
                dst->data_type  = e->data_type;
@@ -747,7 +747,7 @@ static int bch2_cpu_replicas_to_sb_replicas_v0(struct bch_fs *c,
 {
        struct bch_sb_field_replicas_v0 *sb_r;
        struct bch_replicas_entry_v0 *dst;
-       struct bch_replicas_entry *src;
+       struct bch_replicas_entry_v1 *src;
        size_t bytes;
 
        bytes = sizeof(struct bch_sb_field_replicas);
@@ -785,7 +785,7 @@ static int bch2_cpu_replicas_to_sb_replicas(struct bch_fs *c,
                                            struct bch_replicas_cpu *r)
 {
        struct bch_sb_field_replicas *sb_r;
-       struct bch_replicas_entry *dst, *src;
+       struct bch_replicas_entry_v1 *dst, *src;
        bool need_v1 = false;
        size_t bytes;
 
@@ -836,7 +836,7 @@ static int bch2_cpu_replicas_validate(struct bch_replicas_cpu *cpu_r,
                      memcmp, NULL);
 
        for (i = 0; i < cpu_r->nr; i++) {
-               struct bch_replicas_entry *e =
+               struct bch_replicas_entry_v1 *e =
                        cpu_replicas_entry(cpu_r, i);
 
                int ret = bch2_replicas_entry_validate(e, sb, err);
@@ -844,7 +844,7 @@ static int bch2_cpu_replicas_validate(struct bch_replicas_cpu *cpu_r,
                        return ret;
 
                if (i + 1 < cpu_r->nr) {
-                       struct bch_replicas_entry *n =
+                       struct bch_replicas_entry_v1 *n =
                                cpu_replicas_entry(cpu_r, i + 1);
 
                        BUG_ON(memcmp(e, n, cpu_r->entry_size) > 0);
@@ -881,7 +881,7 @@ static void bch2_sb_replicas_to_text(struct printbuf *out,
                                     struct bch_sb_field *f)
 {
        struct bch_sb_field_replicas *r = field_to_type(f, replicas);
-       struct bch_replicas_entry *e;
+       struct bch_replicas_entry_v1 *e;
        bool first = true;
 
        for_each_replicas_entry(r, e) {
@@ -943,7 +943,7 @@ const struct bch_sb_field_ops bch_sb_field_ops_replicas_v0 = {
 bool bch2_have_enough_devs(struct bch_fs *c, struct bch_devs_mask devs,
                           unsigned flags, bool print)
 {
-       struct bch_replicas_entry *e;
+       struct bch_replicas_entry_v1 *e;
        bool ret = true;
 
        percpu_down_read(&c->mark_lock);
@@ -1003,7 +1003,7 @@ unsigned bch2_sb_dev_has_data(struct bch_sb *sb, unsigned dev)
        replicas_v0 = bch2_sb_field_get(sb, replicas_v0);
 
        if (replicas) {
-               struct bch_replicas_entry *r;
+               struct bch_replicas_entry_v1 *r;
 
                for_each_replicas_entry(replicas, r)
                        for (i = 0; i < r->nr_devs; i++)
index f70a642775d1b2b8257caff0ed52c2f8b90016da..654a4b26d3a3c96e3ac0cecb9586de15828665f1 100644 (file)
@@ -6,28 +6,28 @@
 #include "eytzinger.h"
 #include "replicas_types.h"
 
-void bch2_replicas_entry_sort(struct bch_replicas_entry *);
+void bch2_replicas_entry_sort(struct bch_replicas_entry_v1 *);
 void bch2_replicas_entry_to_text(struct printbuf *,
-                                struct bch_replicas_entry *);
-int bch2_replicas_entry_validate(struct bch_replicas_entry *,
+                                struct bch_replicas_entry_v1 *);
+int bch2_replicas_entry_validate(struct bch_replicas_entry_v1 *,
                                 struct bch_sb *, struct printbuf *);
 void bch2_cpu_replicas_to_text(struct printbuf *, struct bch_replicas_cpu *);
 
-static inline struct bch_replicas_entry *
+static inline struct bch_replicas_entry_v1 *
 cpu_replicas_entry(struct bch_replicas_cpu *r, unsigned i)
 {
        return (void *) r->entries + r->entry_size * i;
 }
 
 int bch2_replicas_entry_idx(struct bch_fs *,
-                           struct bch_replicas_entry *);
+                           struct bch_replicas_entry_v1 *);
 
-void bch2_devlist_to_replicas(struct bch_replicas_entry *,
+void bch2_devlist_to_replicas(struct bch_replicas_entry_v1 *,
                              enum bch_data_type,
                              struct bch_devs_list);
-bool bch2_replicas_marked(struct bch_fs *, struct bch_replicas_entry *);
+bool bch2_replicas_marked(struct bch_fs *, struct bch_replicas_entry_v1 *);
 int bch2_mark_replicas(struct bch_fs *,
-                      struct bch_replicas_entry *);
+                      struct bch_replicas_entry_v1 *);
 
 static inline struct replicas_delta *
 replicas_delta_next(struct replicas_delta *d)
@@ -37,9 +37,9 @@ replicas_delta_next(struct replicas_delta *d)
 
 int bch2_replicas_delta_list_mark(struct bch_fs *, struct replicas_delta_list *);
 
-void bch2_bkey_to_replicas(struct bch_replicas_entry *, struct bkey_s_c);
+void bch2_bkey_to_replicas(struct bch_replicas_entry_v1 *, struct bkey_s_c);
 
-static inline void bch2_replicas_entry_cached(struct bch_replicas_entry *e,
+static inline void bch2_replicas_entry_cached(struct bch_replicas_entry_v1 *e,
                                              unsigned dev)
 {
        e->data_type    = BCH_DATA_cached;
@@ -59,7 +59,7 @@ int bch2_replicas_gc_start(struct bch_fs *, unsigned);
 int bch2_replicas_gc2(struct bch_fs *);
 
 int bch2_replicas_set_usage(struct bch_fs *,
-                           struct bch_replicas_entry *,
+                           struct bch_replicas_entry_v1 *,
                            u64);
 
 #define for_each_cpu_replicas_entry(_r, _i)                            \
index 5cfff489bbc34860e9e2a833617f9298653b255a..030324078bbab10eda32082a6443af297ea00871 100644 (file)
@@ -5,12 +5,12 @@
 struct bch_replicas_cpu {
        unsigned                nr;
        unsigned                entry_size;
-       struct bch_replicas_entry *entries;
+       struct bch_replicas_entry_v1 *entries;
 };
 
 struct replicas_delta {
        s64                     delta;
-       struct bch_replicas_entry r;
+       struct bch_replicas_entry_v1 r;
 } __packed;
 
 struct replicas_delta_list {
index c76ad8ea5e4a51c1fb82ea7ac5daf0a1e80a73e6..bc1d9808808d9a5db4dd790ea9d7d936ed733ca4 100644 (file)
@@ -235,7 +235,7 @@ void bch2_journal_super_entries_add_common(struct bch_fs *c,
        }
 
        for (i = 0; i < c->replicas.nr; i++) {
-               struct bch_replicas_entry *e =
+               struct bch_replicas_entry_v1 *e =
                        cpu_replicas_entry(&c->replicas, i);
                struct jset_entry_data_usage *u =
                        container_of(jset_entry_init(end, sizeof(*u) + e->nr_devs),