mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
bcachefs: bch2_btree_insert_node() no longer uses lock_write_nofail
Now that we have an error path plumbed through, there's no need to be using bch2_btree_node_lock_write_nofail(). Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
a8eefbd324
commit
1ff7849f3b
@ -8,8 +8,8 @@
|
||||
struct bch_fs;
|
||||
struct btree;
|
||||
|
||||
void bch2_btree_node_lock_for_insert(struct btree_trans *, struct btree_path *,
|
||||
struct btree *);
|
||||
void bch2_btree_node_prep_for_write(struct btree_trans *,
|
||||
struct btree_path *, struct btree *);
|
||||
bool bch2_btree_bset_insert_key(struct btree_trans *, struct btree_path *,
|
||||
struct btree *, struct btree_node_iter *,
|
||||
struct bkey_i *);
|
||||
|
@ -1695,6 +1695,7 @@ static int bch2_btree_insert_node(struct btree_update *as, struct btree_trans *t
|
||||
int old_u64s = le16_to_cpu(btree_bset_last(b)->u64s);
|
||||
int old_live_u64s = b->nr.live_u64s;
|
||||
int live_u64s_added, u64s_added;
|
||||
int ret;
|
||||
|
||||
lockdep_assert_held(&c->gc_lock);
|
||||
BUG_ON(!btree_node_intent_locked(path, btree_node_root(c, b)->c.level));
|
||||
@ -1705,7 +1706,11 @@ static int bch2_btree_insert_node(struct btree_update *as, struct btree_trans *t
|
||||
if (!(local_clock() & 63))
|
||||
return btree_trans_restart(trans, BCH_ERR_transaction_restart_split_race);
|
||||
|
||||
bch2_btree_node_lock_for_insert(trans, path, b);
|
||||
ret = bch2_btree_node_lock_write(trans, path, &b->c);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
bch2_btree_node_prep_for_write(trans, path, b);
|
||||
|
||||
if (!bch2_btree_node_insert_fits(c, b, bch2_keylist_u64s(keys))) {
|
||||
bch2_btree_node_unlock_write(trans, path, b);
|
||||
|
@ -56,9 +56,9 @@ static inline bool same_leaf_as_next(struct btree_trans *trans,
|
||||
insert_l(&i[0])->b == insert_l(&i[1])->b;
|
||||
}
|
||||
|
||||
static inline void bch2_btree_node_prep_for_write(struct btree_trans *trans,
|
||||
struct btree_path *path,
|
||||
struct btree *b)
|
||||
inline void bch2_btree_node_prep_for_write(struct btree_trans *trans,
|
||||
struct btree_path *path,
|
||||
struct btree *b)
|
||||
{
|
||||
struct bch_fs *c = trans->c;
|
||||
|
||||
@ -77,14 +77,6 @@ static inline void bch2_btree_node_prep_for_write(struct btree_trans *trans,
|
||||
bch2_btree_init_next(trans, b);
|
||||
}
|
||||
|
||||
void bch2_btree_node_lock_for_insert(struct btree_trans *trans,
|
||||
struct btree_path *path,
|
||||
struct btree *b)
|
||||
{
|
||||
bch2_btree_node_lock_write_nofail(trans, path, &b->c);
|
||||
bch2_btree_node_prep_for_write(trans, path, b);
|
||||
}
|
||||
|
||||
/* Inserting into a given leaf node (last stage of insert): */
|
||||
|
||||
/* Handle overwrites and do insert, for non extents: */
|
||||
|
Loading…
Reference in New Issue
Block a user