bcachefs: let __bch2_btree_insert() pass in flags
This patch is prep work for the following patch. Signed-off-by: Daniel Hill <daniel@gluo.nz> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
76966dbfa9
commit
8ffa11a2c5
@ -673,7 +673,7 @@ int bch2_bucket_gens_init(struct bch_fs *c)
|
||||
ret = commit_do(&trans, NULL, NULL,
|
||||
BTREE_INSERT_NOFAIL|
|
||||
BTREE_INSERT_LAZY_RW,
|
||||
__bch2_btree_insert(&trans, BTREE_ID_bucket_gens, &g.k_i));
|
||||
__bch2_btree_insert(&trans, BTREE_ID_bucket_gens, &g.k_i, 0));
|
||||
if (ret)
|
||||
break;
|
||||
have_bucket_gens_key = false;
|
||||
@ -693,7 +693,7 @@ int bch2_bucket_gens_init(struct bch_fs *c)
|
||||
ret = commit_do(&trans, NULL, NULL,
|
||||
BTREE_INSERT_NOFAIL|
|
||||
BTREE_INSERT_LAZY_RW,
|
||||
__bch2_btree_insert(&trans, BTREE_ID_bucket_gens, &g.k_i));
|
||||
__bch2_btree_insert(&trans, BTREE_ID_bucket_gens, &g.k_i, 0));
|
||||
|
||||
bch2_trans_exit(&trans);
|
||||
|
||||
@ -1933,7 +1933,7 @@ static int bch2_dev_freespace_init(struct bch_fs *c, struct bch_dev *ca)
|
||||
freespace->k.p = k.k->p;
|
||||
freespace->k.size = k.k->size;
|
||||
|
||||
ret = __bch2_btree_insert(&trans, BTREE_ID_freespace, freespace) ?:
|
||||
ret = __bch2_btree_insert(&trans, BTREE_ID_freespace, freespace, 0) ?:
|
||||
bch2_trans_commit(&trans, NULL, NULL,
|
||||
BTREE_INSERT_LAZY_RW|
|
||||
BTREE_INSERT_NOFAIL);
|
||||
|
@ -58,7 +58,8 @@ int bch2_btree_delete_extent_at(struct btree_trans *, struct btree_iter *,
|
||||
unsigned, unsigned);
|
||||
int bch2_btree_delete_at(struct btree_trans *, struct btree_iter *, unsigned);
|
||||
|
||||
int __bch2_btree_insert(struct btree_trans *, enum btree_id, struct bkey_i *);
|
||||
int __bch2_btree_insert(struct btree_trans *, enum btree_id, struct bkey_i *,
|
||||
enum btree_update_flags);
|
||||
int bch2_btree_insert(struct bch_fs *, enum btree_id, struct bkey_i *,
|
||||
struct disk_reservation *, u64 *, int flags);
|
||||
|
||||
|
@ -1748,7 +1748,8 @@ void bch2_trans_commit_hook(struct btree_trans *trans,
|
||||
}
|
||||
|
||||
int __bch2_btree_insert(struct btree_trans *trans,
|
||||
enum btree_id id, struct bkey_i *k)
|
||||
enum btree_id id,
|
||||
struct bkey_i *k, enum btree_update_flags flags)
|
||||
{
|
||||
struct btree_iter iter;
|
||||
int ret;
|
||||
@ -1756,7 +1757,7 @@ int __bch2_btree_insert(struct btree_trans *trans,
|
||||
bch2_trans_iter_init(trans, &iter, id, bkey_start_pos(&k->k),
|
||||
BTREE_ITER_INTENT);
|
||||
ret = bch2_btree_iter_traverse(&iter) ?:
|
||||
bch2_trans_update(trans, &iter, k, 0);
|
||||
bch2_trans_update(trans, &iter, k, flags);
|
||||
bch2_trans_iter_exit(trans, &iter);
|
||||
return ret;
|
||||
}
|
||||
@ -1774,7 +1775,7 @@ int bch2_btree_insert(struct bch_fs *c, enum btree_id id,
|
||||
u64 *journal_seq, int flags)
|
||||
{
|
||||
return bch2_trans_do(c, disk_res, journal_seq, flags,
|
||||
__bch2_btree_insert(&trans, id, k));
|
||||
__bch2_btree_insert(&trans, id, k, 0));
|
||||
}
|
||||
|
||||
int bch2_btree_delete_extent_at(struct btree_trans *trans, struct btree_iter *iter,
|
||||
|
@ -222,7 +222,7 @@ slowpath:
|
||||
BTREE_INSERT_NOFAIL|
|
||||
BTREE_INSERT_JOURNAL_RECLAIM|
|
||||
JOURNAL_WATERMARK_reserved,
|
||||
__bch2_btree_insert(trans, i->btree, &i->k));
|
||||
__bch2_btree_insert(trans, i->btree, &i->k, 0));
|
||||
if (bch2_fs_fatal_err_on(ret, c, "%s: insert error %s", __func__, bch2_err_str(ret)))
|
||||
break;
|
||||
}
|
||||
|
@ -1224,7 +1224,8 @@ not_found:
|
||||
new->k.p = bkey_start_pos(p.k);
|
||||
new->k.p.offset += *idx - start;
|
||||
bch2_key_resize(&new->k, next_idx - *idx);
|
||||
ret = __bch2_btree_insert(trans, BTREE_ID_extents, &new->k_i);
|
||||
ret = __bch2_btree_insert(trans, BTREE_ID_extents, &new->k_i,
|
||||
0);
|
||||
}
|
||||
|
||||
*idx = next_idx;
|
||||
|
@ -1797,7 +1797,8 @@ static int check_root_trans(struct btree_trans *trans)
|
||||
ret = commit_do(trans, NULL, NULL,
|
||||
BTREE_INSERT_NOFAIL|
|
||||
BTREE_INSERT_LAZY_RW,
|
||||
__bch2_btree_insert(trans, BTREE_ID_subvolumes, &root_subvol.k_i));
|
||||
__bch2_btree_insert(trans, BTREE_ID_subvolumes,
|
||||
&root_subvol.k_i, 0));
|
||||
if (ret) {
|
||||
bch_err(c, "error writing root subvol: %s", bch2_err_str(ret));
|
||||
goto err;
|
||||
|
@ -592,7 +592,7 @@ static int rand_insert(struct bch_fs *c, u64 nr)
|
||||
k.k.p.snapshot = U32_MAX;
|
||||
|
||||
ret = commit_do(&trans, NULL, NULL, 0,
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k.k_i));
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k.k_i, 0));
|
||||
if (ret) {
|
||||
bch_err(c, "%s(): error %s", __func__, bch2_err_str(ret));
|
||||
break;
|
||||
@ -621,14 +621,14 @@ static int rand_insert_multi(struct bch_fs *c, u64 nr)
|
||||
}
|
||||
|
||||
ret = commit_do(&trans, NULL, NULL, 0,
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[0].k_i) ?:
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[1].k_i) ?:
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[2].k_i) ?:
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[3].k_i) ?:
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[4].k_i) ?:
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[5].k_i) ?:
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[6].k_i) ?:
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[7].k_i));
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[0].k_i, 0) ?:
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[1].k_i, 0) ?:
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[2].k_i, 0) ?:
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[3].k_i, 0) ?:
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[4].k_i, 0) ?:
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[5].k_i, 0) ?:
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[6].k_i, 0) ?:
|
||||
__bch2_btree_insert(&trans, BTREE_ID_xattrs, &k[7].k_i, 0));
|
||||
if (ret) {
|
||||
bch_err(c, "%s(): error %s", __func__, bch2_err_str(ret));
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user