Commit 697e45b2 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

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: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent fff899b1
......@@ -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)
......
......@@ -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;
......
......@@ -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);
......
......@@ -442,11 +442,18 @@ static int bch2_extent_replay_key(struct bch_fs *c, enum btree_id btree_id,
* 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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment