mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 06:02:05 +00:00
bcachefs: minor bch2_btree_path_set_pos() optimization
bpos_eq() is cheaper than bpos_cmp() Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
4753bdeb26
commit
5ce8b92da0
@ -1221,8 +1221,10 @@ struct btree_path *__bch2_btree_path_make_mut(struct btree_trans *trans,
|
||||
struct btree_path * __must_check
|
||||
__bch2_btree_path_set_pos(struct btree_trans *trans,
|
||||
struct btree_path *path, struct bpos new_pos,
|
||||
bool intent, unsigned long ip, int cmp)
|
||||
bool intent, unsigned long ip)
|
||||
{
|
||||
int cmp = bpos_cmp(new_pos, path->pos);
|
||||
|
||||
bch2_trans_verify_not_in_restart(trans);
|
||||
EBUG_ON(!path->ref);
|
||||
|
||||
|
@ -176,17 +176,15 @@ bch2_btree_path_make_mut(struct btree_trans *trans,
|
||||
|
||||
struct btree_path * __must_check
|
||||
__bch2_btree_path_set_pos(struct btree_trans *, struct btree_path *,
|
||||
struct bpos, bool, unsigned long, int);
|
||||
struct bpos, bool, unsigned long);
|
||||
|
||||
static inline struct btree_path * __must_check
|
||||
bch2_btree_path_set_pos(struct btree_trans *trans,
|
||||
struct btree_path *path, struct bpos new_pos,
|
||||
bool intent, unsigned long ip)
|
||||
{
|
||||
int cmp = bpos_cmp(new_pos, path->pos);
|
||||
|
||||
return cmp
|
||||
? __bch2_btree_path_set_pos(trans, path, new_pos, intent, ip, cmp)
|
||||
return !bpos_eq(new_pos, path->pos)
|
||||
? __bch2_btree_path_set_pos(trans, path, new_pos, intent, ip)
|
||||
: path;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user