diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-07-06 17:02:37 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:42 -0400 |
commit | 697e45b230d5523c5c119b1e6a868632def24451 (patch) | |
tree | 352c699ef7bf7e2a0b2d6eaafcc008e0256c2106 /fs/bcachefs | |
parent | fff899b1d90089a3c77a20dbe48bd44a00161a6b (diff) |
bcachefs: Kill BTREE_TRIGGER_NOOVERWRITES
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>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r-- | fs/bcachefs/btree_types.h | 2 | ||||
-rw-r--r-- | fs/bcachefs/buckets.c | 8 | ||||
-rw-r--r-- | fs/bcachefs/buckets.h | 3 | ||||
-rw-r--r-- | fs/bcachefs/recovery.c | 13 |
4 files changed, 11 insertions, 15 deletions
diff --git a/fs/bcachefs/btree_types.h b/fs/bcachefs/btree_types.h index b9edf863e895..dd272318fba1 100644 --- a/fs/bcachefs/btree_types.h +++ b/fs/bcachefs/btree_types.h @@ -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) diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c index 4ea84cbac5d3..8044cf26fd22 100644 --- a/fs/bcachefs/buckets.c +++ b/fs/bcachefs/buckets.c @@ -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; diff --git a/fs/bcachefs/buckets.h b/fs/bcachefs/buckets.h index cea66c76850d..b897162c5e13 100644 --- a/fs/bcachefs/buckets.h +++ b/fs/bcachefs/buckets.h @@ -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); diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c index 41b864dcdc39..1695a609ecd9 100644 --- a/fs/bcachefs/recovery.c +++ b/fs/bcachefs/recovery.c @@ -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) { |