bcachefs: rename version -> bversion
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 26 Sep 2024 19:49:17 +0000 (15:49 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 28 Sep 2024 01:46:35 +0000 (21:46 -0400)
give bversions a more distinct name, to aid in grepping

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
17 files changed:
fs/bcachefs/backpointers.c
fs/bcachefs/bcachefs_format.h
fs/bcachefs/bkey.h
fs/bcachefs/bkey_methods.c
fs/bcachefs/bkey_methods.h
fs/bcachefs/btree_gc.c
fs/bcachefs/btree_io.c
fs/bcachefs/btree_trans_commit.c
fs/bcachefs/data_update.c
fs/bcachefs/disk_accounting.c
fs/bcachefs/disk_accounting.h
fs/bcachefs/disk_accounting_types.h
fs/bcachefs/io_read.c
fs/bcachefs/io_write.c
fs/bcachefs/recovery.c
fs/bcachefs/reflink.c
fs/bcachefs/tests.c

index e11989a57ca0f2da479e04f2417f8a53d100419a..47455a85c90924ce9daa32556f0df9f15d00f19c 100644 (file)
@@ -501,7 +501,7 @@ found:
        prt_printf(&buf, "\n  %s ", bch2_btree_id_str(o_btree));
        bch2_bkey_val_to_text(&buf, c, extent2);
 
-       struct nonce nonce = extent_nonce(extent.k->version, p.crc);
+       struct nonce nonce = extent_nonce(extent.k->bversion, p.crc);
        struct bch_csum csum = bch2_checksum(c, p.crc.csum_type, nonce, data_buf, bytes);
        if (fsck_err_on(bch2_crc_cmp(csum, p.crc.csum),
                        trans, dup_backpointer_to_bad_csum_extent,
index 8c4addddd07e0967f0e64614ccab6ce84c48f688..203ee627cab5d5118b2bef3c17cf684dacebb66e 100644 (file)
@@ -217,7 +217,7 @@ struct bkey {
 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
        __u8            pad[1];
 
-       struct bversion version;
+       struct bversion bversion;
        __u32           size;           /* extent size, in sectors */
        struct bpos     p;
 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
@@ -328,8 +328,8 @@ enum bch_bkey_fields {
                bkey_format_field(OFFSET,       p.offset),              \
                bkey_format_field(SNAPSHOT,     p.snapshot),            \
                bkey_format_field(SIZE,         size),                  \
-               bkey_format_field(VERSION_HI,   version.hi),            \
-               bkey_format_field(VERSION_LO,   version.lo),            \
+               bkey_format_field(VERSION_HI,   bversion.hi),           \
+               bkey_format_field(VERSION_LO,   bversion.lo),           \
        },                                                              \
 })
 
index e34cb2bf329c54f4b297a6f4493b4f992a989c04..6e5092d4c62eb4e171cb3bf6cae3c5db31b18c68 100644 (file)
@@ -554,8 +554,8 @@ static inline void bch2_bkey_pack_test(void) {}
        x(BKEY_FIELD_OFFSET,            p.offset)                       \
        x(BKEY_FIELD_SNAPSHOT,          p.snapshot)                     \
        x(BKEY_FIELD_SIZE,              size)                           \
-       x(BKEY_FIELD_VERSION_HI,        version.hi)                     \
-       x(BKEY_FIELD_VERSION_LO,        version.lo)
+       x(BKEY_FIELD_VERSION_HI,        bversion.hi)                    \
+       x(BKEY_FIELD_VERSION_LO,        bversion.lo)
 
 struct bkey_format_state {
        u64 field_min[BKEY_NR_FIELDS];
index 88d8958281e80f8e8840917ab3f43e0f4a7684ef..e7ac227ba7e89594da975b6b25c576ba2488a17d 100644 (file)
@@ -289,7 +289,7 @@ void bch2_bkey_to_text(struct printbuf *out, const struct bkey *k)
 
                bch2_bpos_to_text(out, k->p);
 
-               prt_printf(out, " len %u ver %llu", k->size, k->version.lo);
+               prt_printf(out, " len %u ver %llu", k->size, k->bversion.lo);
        } else {
                prt_printf(out, "(null)");
        }
index 3df3dd2723a128f8ae11148e5d5ffeb01fe04edf..018fb72e32d398da175cdff0c373ecb785415288 100644 (file)
@@ -70,7 +70,7 @@ bool bch2_bkey_normalize(struct bch_fs *, struct bkey_s);
 static inline bool bch2_bkey_maybe_mergable(const struct bkey *l, const struct bkey *r)
 {
        return l->type == r->type &&
-               !bversion_cmp(l->version, r->version) &&
+               !bversion_cmp(l->bversion, r->bversion) &&
                bpos_eq(l->p, bkey_start_pos(r));
 }
 
index 40b08fef3c398dbbe0b66ae273933b5b29c48529..660d2fa02da21c93987c3bd0720891ad3e76bfc0 100644 (file)
@@ -601,15 +601,15 @@ static int bch2_gc_mark_key(struct btree_trans *trans, enum btree_id btree_id,
 
        if (initial) {
                BUG_ON(bch2_journal_seq_verify &&
-                      k.k->version.lo > atomic64_read(&c->journal.seq));
+                      k.k->bversion.lo > atomic64_read(&c->journal.seq));
 
                if (fsck_err_on(btree_id != BTREE_ID_accounting &&
-                               k.k->version.lo > atomic64_read(&c->key_version),
+                               k.k->bversion.lo > atomic64_read(&c->key_version),
                                trans, bkey_version_in_future,
                                "key version number higher than recorded %llu\n  %s",
                                atomic64_read(&c->key_version),
                                (bch2_bkey_val_to_text(&buf, c, k), buf.buf)))
-                       atomic64_set(&c->key_version, k.k->version.lo);
+                       atomic64_set(&c->key_version, k.k->bversion.lo);
        }
 
        if (mustfix_fsck_err_on(level && !bch2_dev_btree_bitmap_marked(c, k),
index 2a0420605bd7f27122af42498d8ea743822fa880..1c1448b52207bb92ab1f5c0725a63e83451f3fbb 100644 (file)
@@ -1223,7 +1223,7 @@ int bch2_btree_node_read_done(struct bch_fs *c, struct bch_dev *ca,
                ret = bch2_bkey_val_validate(c, u.s_c, READ);
                if (ret == -BCH_ERR_fsck_delete_bkey ||
                    (bch2_inject_invalid_keys &&
-                    !bversion_cmp(u.k->version, MAX_VERSION))) {
+                    !bversion_cmp(u.k->bversion, MAX_VERSION))) {
                        btree_keys_account_key_drop(&b->nr, 0, k);
 
                        i->u64s = cpu_to_le16(le16_to_cpu(i->u64s) - k->u64s);
index 145d82aed4ecb25133bec61af2d5cb3247556805..0989e2da6e56d6519dc756d94bf061d73597ab81 100644 (file)
@@ -684,10 +684,10 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags,
            !(flags & BCH_TRANS_COMMIT_no_journal_res)) {
                if (bch2_journal_seq_verify)
                        trans_for_each_update(trans, i)
-                               i->k->k.version.lo = trans->journal_res.seq;
+                               i->k->k.bversion.lo = trans->journal_res.seq;
                else if (bch2_inject_invalid_keys)
                        trans_for_each_update(trans, i)
-                               i->k->k.version = MAX_VERSION;
+                               i->k->k.bversion = MAX_VERSION;
        }
 
        h = trans->hooks;
@@ -709,9 +709,9 @@ bch2_trans_commit_write_locked(struct btree_trans *trans, unsigned flags,
                        if (jset_entry_is_key(entry) && entry->start->k.type == KEY_TYPE_accounting) {
                                struct bkey_i_accounting *a = bkey_i_to_accounting(entry->start);
 
-                               a->k.version = journal_pos_to_bversion(&trans->journal_res,
+                               a->k.bversion = journal_pos_to_bversion(&trans->journal_res,
                                                                (u64 *) entry - (u64 *) trans->journal_entries);
-                               BUG_ON(bversion_zero(a->k.version));
+                               BUG_ON(bversion_zero(a->k.bversion));
                                ret = bch2_accounting_mem_mod_locked(trans, accounting_i_to_s_c(a), BCH_ACCOUNTING_normal);
                                if (ret)
                                        goto revert_fs_usage;
index 757b9884ef558243cf8c44e2aab0c663f982f0a5..462b1a2fe1ad8d9c75841d9af4d0b1eaec0c551b 100644 (file)
@@ -639,7 +639,7 @@ int bch2_data_update_init(struct btree_trans *trans,
 
        bch2_write_op_init(&m->op, c, io_opts);
        m->op.pos       = bkey_start_pos(k.k);
-       m->op.version   = k.k->version;
+       m->op.version   = k.k->bversion;
        m->op.target    = data_opts.target;
        m->op.write_point = wp;
        m->op.nr_replicas = 0;
index 669214127c16a3f7d0b36f4c21e2593b6ed0e274..9ac45a607b9318a8b11cb0b19cb331ffce1bfc18 100644 (file)
@@ -291,7 +291,7 @@ static int __bch2_accounting_mem_insert(struct bch_fs *c, struct bkey_s_c_accoun
 
        struct accounting_mem_entry n = {
                .pos            = a.k->p,
-               .version        = a.k->version,
+               .bversion       = a.k->bversion,
                .nr_counters    = bch2_accounting_counters(a.k),
                .v[0]           = __alloc_percpu_gfp(n.nr_counters * sizeof(u64),
                                                     sizeof(u64), GFP_KERNEL),
@@ -636,7 +636,7 @@ int bch2_accounting_read(struct bch_fs *c)
                                                accounting_pos_cmp, &k.k->p);
 
                        bool applied = idx < acc->k.nr &&
-                               bversion_cmp(acc->k.data[idx].version, k.k->version) >= 0;
+                               bversion_cmp(acc->k.data[idx].bversion, k.k->bversion) >= 0;
 
                        if (applied)
                                continue;
@@ -644,7 +644,7 @@ int bch2_accounting_read(struct bch_fs *c)
                        if (i + 1 < &darray_top(*keys) &&
                            i[1].k->k.type == KEY_TYPE_accounting &&
                            !journal_key_cmp(i, i + 1)) {
-                               BUG_ON(bversion_cmp(i[0].k->k.version, i[1].k->k.version) >= 0);
+                               BUG_ON(bversion_cmp(i[0].k->k.bversion, i[1].k->k.bversion) >= 0);
 
                                i[1].journal_seq = i[0].journal_seq;
 
index 243bfb0975eab8a863af0f33f7b5b79b1665a148..4ea6c8a092bc11d75e77209f7b42ed86aeee1361 100644 (file)
@@ -36,8 +36,8 @@ static inline void bch2_accounting_accumulate(struct bkey_i_accounting *dst,
 
        for (unsigned i = 0; i < bch2_accounting_counters(&dst->k); i++)
                dst->v.d[i] += src.v->d[i];
-       if (bversion_cmp(dst->k.version, src.k->version) < 0)
-               dst->k.version = src.k->version;
+       if (bversion_cmp(dst->k.bversion, src.k->bversion) < 0)
+               dst->k.bversion = src.k->bversion;
 }
 
 static inline void fs_usage_data_type_to_base(struct bch_fs_usage_base *fs_usage,
index 1687a45177a7f5689887045aee2d9e0bc7a65258..b1982131b2066632b3882320459b434a57aa6300 100644 (file)
@@ -6,7 +6,7 @@
 
 struct accounting_mem_entry {
        struct bpos                             pos;
-       struct bversion                         version;
+       struct bversion                         bversion;
        unsigned                                nr_counters;
        u64 __percpu                            *v[2];
 };
index b2f50e74bb76e32036910e8e597cd96e2644ed5e..e4fc17c548fd556f056c01163a8bbddce3855421 100644 (file)
@@ -517,7 +517,7 @@ static int __bch2_rbio_narrow_crcs(struct btree_trans *trans,
        if ((ret = bkey_err(k)))
                goto out;
 
-       if (bversion_cmp(k.k->version, rbio->version) ||
+       if (bversion_cmp(k.k->bversion, rbio->version) ||
            !bch2_bkey_matches_ptr(c, k, rbio->pick.ptr, data_offset))
                goto out;
 
@@ -1031,7 +1031,7 @@ get_bio:
        rbio->read_pos          = read_pos;
        rbio->data_btree        = data_btree;
        rbio->data_pos          = data_pos;
-       rbio->version           = k.k->version;
+       rbio->version           = k.k->bversion;
        rbio->promote           = promote;
        INIT_WORK(&rbio->work, NULL);
 
index d3b5be7fd9bf60a85bc99d54f71d7604b9b2aaf0..b5fe9e0dc1557c7f52d18fbf60c791940043af32 100644 (file)
@@ -697,7 +697,7 @@ static void init_append_extent(struct bch_write_op *op,
        e = bkey_extent_init(op->insert_keys.top);
        e->k.p          = op->pos;
        e->k.size       = crc.uncompressed_size;
-       e->k.version    = version;
+       e->k.bversion   = version;
 
        if (crc.csum_type ||
            crc.compression_type ||
@@ -1544,7 +1544,7 @@ static void bch2_write_data_inline(struct bch_write_op *op, unsigned data_len)
 
        id = bkey_inline_data_init(op->insert_keys.top);
        id->k.p         = op->pos;
-       id->k.version   = op->version;
+       id->k.bversion  = op->version;
        id->k.size      = sectors;
 
        iter = bio->bi_iter;
index d1699aecc9fb6072986ef636660917b43d9a0468..c84295a072320beb18d5e91e888df4953ea1142e 100644 (file)
@@ -151,7 +151,7 @@ static int bch2_journal_replay_accounting_key(struct btree_trans *trans,
        struct bkey_s_c old = bch2_btree_path_peek_slot(btree_iter_path(trans, &iter), &u);
 
        /* Has this delta already been applied to the btree? */
-       if (bversion_cmp(old.k->version, k->k->k.version) >= 0) {
+       if (bversion_cmp(old.k->bversion, k->k->k.bversion) >= 0) {
                ret = 0;
                goto out;
        }
index e59c0abb47723bd2eb2b55a09f365061d0063586..f457925fa362ef4b1728dccfee99d17788c811b5 100644 (file)
@@ -367,7 +367,7 @@ static int bch2_make_extent_indirect(struct btree_trans *trans,
        r_v->k.type     = bkey_type_to_indirect(&orig->k);
        r_v->k.p        = reflink_iter.pos;
        bch2_key_resize(&r_v->k, orig->k.size);
-       r_v->k.version  = orig->k.version;
+       r_v->k.bversion = orig->k.bversion;
 
        set_bkey_val_bytes(&r_v->k, sizeof(__le64) + bkey_val_bytes(&orig->k));
 
index 01b768c9b7675f0053472812bb4ea43b8f3f5d8d..b2f209743afeb50861e772f3e714fb95823e8a6b 100644 (file)
@@ -394,7 +394,7 @@ static int insert_test_extent(struct bch_fs *c,
        k.k_i.k.p.offset = end;
        k.k_i.k.p.snapshot = U32_MAX;
        k.k_i.k.size = end - start;
-       k.k_i.k.version.lo = test_version++;
+       k.k_i.k.bversion.lo = test_version++;
 
        ret = bch2_btree_insert(c, BTREE_ID_extents, &k.k_i, NULL, 0, 0);
        bch_err_fn(c, ret);