Commit 25b4b330 authored by Kent Overstreet's avatar Kent Overstreet

bcachefs: Inline fast path of check_pos_snapshot_overwritten()

This moves the slowpath of check_pos_snapshot_overwritten() to a
separate function, and inlines the fast path - helping performance on
btrees that don't use snapshot and for users that aren't using
snapshots.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent c23a9e08
......@@ -1113,7 +1113,7 @@ int __bch2_trans_commit(struct btree_trans *trans)
goto retry;
}
static int check_pos_snapshot_overwritten(struct btree_trans *trans,
static noinline int __check_pos_snapshot_overwritten(struct btree_trans *trans,
enum btree_id id,
struct bpos pos)
{
......@@ -1122,12 +1122,6 @@ static int check_pos_snapshot_overwritten(struct btree_trans *trans,
struct bkey_s_c k;
int ret;
if (!btree_type_has_snapshots(id))
return 0;
if (!snapshot_t(c, pos.snapshot)->children[0])
return 0;
bch2_trans_iter_init(trans, &iter, id, pos,
BTREE_ITER_NOT_EXTENTS|
BTREE_ITER_ALL_SNAPSHOTS);
......@@ -1153,6 +1147,18 @@ static int check_pos_snapshot_overwritten(struct btree_trans *trans,
return ret;
}
static inline int check_pos_snapshot_overwritten(struct btree_trans *trans,
enum btree_id id,
struct bpos pos)
{
if (!btree_type_has_snapshots(id) ||
pos.snapshot == U32_MAX ||
!snapshot_t(trans->c, pos.snapshot)->children[0])
return 0;
return __check_pos_snapshot_overwritten(trans, id, pos);
}
static noinline int extent_front_merge(struct btree_trans *trans,
struct btree_iter *iter,
struct bkey_s_c k,
......
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