bcachefs: Change flags param to bch2_btree_delete_range to update_flags

It wasn't used as iter_flags (excepting the unit tests, which this patch
fixes), and the next patch is going to need to pass in
BTREE_TRIGGER_NORUN.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
Kent Overstreet 2022-03-05 18:23:47 -05:00 committed by Kent Overstreet
parent 61a66469a4
commit a9bae40fda
2 changed files with 12 additions and 14 deletions

View File

@ -1692,14 +1692,14 @@ int bch2_btree_delete_at(struct btree_trans *trans,
int bch2_btree_delete_range_trans(struct btree_trans *trans, enum btree_id id,
struct bpos start, struct bpos end,
unsigned iter_flags,
unsigned update_flags,
u64 *journal_seq)
{
struct btree_iter iter;
struct bkey_s_c k;
int ret = 0;
bch2_trans_iter_init(trans, &iter, id, start, BTREE_ITER_INTENT|iter_flags);
bch2_trans_iter_init(trans, &iter, id, start, BTREE_ITER_INTENT);
retry:
while ((bch2_trans_begin(trans),
(k = bch2_btree_iter_peek(&iter)).k) &&
@ -1740,9 +1740,9 @@ retry:
break;
}
ret = bch2_trans_update(trans, &iter, &delete, 0) ?:
ret = bch2_trans_update(trans, &iter, &delete, update_flags) ?:
bch2_trans_commit(trans, &disk_res, journal_seq,
BTREE_INSERT_NOFAIL);
BTREE_INSERT_NOFAIL);
bch2_disk_reservation_put(trans->c, &disk_res);
if (ret)
break;
@ -1764,10 +1764,10 @@ retry:
*/
int bch2_btree_delete_range(struct bch_fs *c, enum btree_id id,
struct bpos start, struct bpos end,
unsigned iter_flags,
unsigned update_flags,
u64 *journal_seq)
{
return bch2_trans_do(c, NULL, journal_seq, 0,
bch2_btree_delete_range_trans(&trans, id, start, end,
iter_flags, journal_seq));
update_flags, journal_seq));
}

View File

@ -15,15 +15,14 @@ static void delete_test_keys(struct bch_fs *c)
int ret;
ret = bch2_btree_delete_range(c, BTREE_ID_extents,
POS_MIN, SPOS_MAX,
BTREE_ITER_ALL_SNAPSHOTS,
SPOS(0, 0, U32_MAX), SPOS_MAX,
0,
NULL);
BUG_ON(ret);
ret = bch2_btree_delete_range(c, BTREE_ID_xattrs,
POS_MIN, SPOS_MAX,
BTREE_ITER_ALL_SNAPSHOTS,
NULL);
SPOS(0, 0, U32_MAX), SPOS_MAX,
0, NULL);
BUG_ON(ret);
}
@ -814,9 +813,8 @@ static int seq_delete(struct bch_fs *c, u64 nr)
int ret;
ret = bch2_btree_delete_range(c, BTREE_ID_xattrs,
POS_MIN, SPOS_MAX,
BTREE_ITER_ALL_SNAPSHOTS,
NULL);
SPOS(0, 0, U32_MAX), SPOS_MAX,
0, NULL);
if (ret)
bch_err(c, "error in seq_delete: %i", ret);
return ret;