]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Kill BTREE_TRIGGER_NOOVERWRITES
authorKent Overstreet <kent.overstreet@gmail.com>
Mon, 6 Jul 2020 21:02:37 +0000 (17:02 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:08:42 +0000 (17:08 -0400)
This is prep work for reworking the triggers machinery - we have
triggers that need to know both the old and the new key.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/btree_types.h
fs/bcachefs/buckets.c
fs/bcachefs/buckets.h
fs/bcachefs/recovery.c

index b9edf863e895ed58256734d0d2e4abf46075f8e8..dd272318fba1e6c7f006c19027a37a5478a74982 100644 (file)
@@ -595,7 +595,6 @@ static inline bool btree_iter_is_extents(struct btree_iter *iter)
 
 enum btree_trigger_flags {
        __BTREE_TRIGGER_NORUN,          /* Don't run triggers at all */
-       __BTREE_TRIGGER_NOOVERWRITES,   /* Don't run triggers on overwrites */
 
        __BTREE_TRIGGER_INSERT,
        __BTREE_TRIGGER_OVERWRITE,
@@ -608,7 +607,6 @@ enum btree_trigger_flags {
 };
 
 #define BTREE_TRIGGER_NORUN            (1U << __BTREE_TRIGGER_NORUN)
-#define BTREE_TRIGGER_NOOVERWRITES     (1U << __BTREE_TRIGGER_NOOVERWRITES)
 
 #define BTREE_TRIGGER_INSERT           (1U << __BTREE_TRIGGER_INSERT)
 #define BTREE_TRIGGER_OVERWRITE                (1U << __BTREE_TRIGGER_OVERWRITE)
index 4ea84cbac5d318afd65e36dff3c53a51efc7c513..8044cf26fd225337411b4a64a316cba700e32d2f 100644 (file)
@@ -1310,7 +1310,7 @@ int bch2_mark_key(struct bch_fs *c, struct bkey_s_c k,
        return ret;
 }
 
-inline int bch2_mark_overwrite(struct btree_trans *trans,
+static int bch2_mark_overwrite(struct btree_trans *trans,
                               struct btree_iter *iter,
                               struct bkey_s_c old,
                               struct bkey_i *new,
@@ -1384,9 +1384,6 @@ int bch2_mark_update(struct btree_trans *trans,
                fs_usage, trans->journal_res.seq,
                BTREE_TRIGGER_INSERT|flags);
 
-       if (unlikely(flags & BTREE_TRIGGER_NOOVERWRITES))
-               return 0;
-
        /*
         * For non extents, we only mark the new key, not the key being
         * overwritten - unless we're actually deleting:
@@ -1830,9 +1827,6 @@ int bch2_trans_mark_update(struct btree_trans *trans,
        if (ret)
                return ret;
 
-       if (unlikely(flags & BTREE_TRIGGER_NOOVERWRITES))
-               return 0;
-
        if (btree_iter_type(iter) == BTREE_ITER_CACHED) {
                struct bkey_cached *ck = (void *) iter->l[0].b;
 
index cea66c76850d151b29726a00f7f009ca94ca9762..b897162c5e13a68fb7e63cdb1c8557cdf22b04b7 100644 (file)
@@ -264,9 +264,6 @@ int bch2_mark_key(struct bch_fs *, struct bkey_s_c, unsigned, s64,
 int bch2_fs_usage_apply(struct bch_fs *, struct bch_fs_usage_online *,
                        struct disk_reservation *, unsigned);
 
-int bch2_mark_overwrite(struct btree_trans *, struct btree_iter *,
-                       struct bkey_s_c, struct bkey_i *,
-                       struct bch_fs_usage *, unsigned, bool);
 int bch2_mark_update(struct btree_trans *, struct btree_iter *,
                     struct bkey_i *, struct bch_fs_usage *, unsigned);
 
index 41b864dcdc39371ff5c98cf133a91331c19bc756..1695a609ecd91a6308a66c8d03c61973aa67ed6b 100644 (file)
@@ -442,11 +442,18 @@ retry:
                 * regular keys
                 */
                __bch2_btree_iter_set_pos(split_iter, split->k.p, false);
-               bch2_trans_update(&trans, split_iter, split, !remark
-                                 ? BTREE_TRIGGER_NORUN
-                                 : BTREE_TRIGGER_NOOVERWRITES);
+               bch2_trans_update(&trans, split_iter, split,
+                                 BTREE_TRIGGER_NORUN);
 
                bch2_btree_iter_set_pos(iter, split->k.p);
+
+               if (remark) {
+                       ret = bch2_trans_mark_key(&trans, bkey_i_to_s_c(split),
+                                                 0, split->k.size,
+                                                 BTREE_TRIGGER_INSERT);
+                       if (ret)
+                               goto err;
+               }
        } while (bkey_cmp(iter->pos, k->k.p) < 0);
 
        if (remark) {