bcachefs: Add iter_flags arg to bch2_btree_delete_range()
Will be used by the new snapshot tests, to pass in BTREE_ITER_ALL_SNAPSHOTS. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
200472e91c
commit
d248ee5637
@ -63,7 +63,7 @@ int bch2_btree_insert(struct bch_fs *, enum btree_id, struct bkey_i *,
|
||||
int bch2_btree_delete_range_trans(struct btree_trans *, enum btree_id,
|
||||
struct bpos, struct bpos, unsigned, u64 *);
|
||||
int bch2_btree_delete_range(struct bch_fs *, enum btree_id,
|
||||
struct bpos, struct bpos, u64 *);
|
||||
struct bpos, struct bpos, unsigned, u64 *);
|
||||
|
||||
int bch2_btree_node_rewrite(struct btree_trans *, struct btree_iter *,
|
||||
struct btree *, unsigned);
|
||||
|
@ -1475,7 +1475,7 @@ retry:
|
||||
*/
|
||||
delete.k.p = iter.pos;
|
||||
|
||||
if (btree_node_type_is_extents(id)) {
|
||||
if (iter.flags & BTREE_ITER_IS_EXTENTS) {
|
||||
unsigned max_sectors =
|
||||
KEY_SIZE_MAX & (~0 << trans->c->block_bits);
|
||||
|
||||
@ -1512,8 +1512,10 @@ retry:
|
||||
*/
|
||||
int bch2_btree_delete_range(struct bch_fs *c, enum btree_id id,
|
||||
struct bpos start, struct bpos end,
|
||||
unsigned iter_flags,
|
||||
u64 *journal_seq)
|
||||
{
|
||||
return bch2_trans_do(c, NULL, journal_seq, 0,
|
||||
bch2_btree_delete_range_trans(&trans, id, start, end, 0, journal_seq));
|
||||
bch2_btree_delete_range_trans(&trans, id, start, end,
|
||||
iter_flags, journal_seq));
|
||||
}
|
||||
|
@ -677,7 +677,7 @@ static int ec_stripe_delete(struct bch_fs *c, size_t idx)
|
||||
return bch2_btree_delete_range(c, BTREE_ID_stripes,
|
||||
POS(0, idx),
|
||||
POS(0, idx + 1),
|
||||
NULL);
|
||||
0, NULL);
|
||||
}
|
||||
|
||||
static void ec_stripe_delete_work(struct work_struct *work)
|
||||
|
@ -570,7 +570,7 @@ static int bch2_quota_remove(struct super_block *sb, unsigned uflags)
|
||||
ret = bch2_btree_delete_range(c, BTREE_ID_quotas,
|
||||
POS(QTYP_USR, 0),
|
||||
POS(QTYP_USR + 1, 0),
|
||||
NULL);
|
||||
0, NULL);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
@ -582,7 +582,7 @@ static int bch2_quota_remove(struct super_block *sb, unsigned uflags)
|
||||
ret = bch2_btree_delete_range(c, BTREE_ID_quotas,
|
||||
POS(QTYP_GRP, 0),
|
||||
POS(QTYP_GRP + 1, 0),
|
||||
NULL);
|
||||
0, NULL);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
@ -594,7 +594,7 @@ static int bch2_quota_remove(struct super_block *sb, unsigned uflags)
|
||||
ret = bch2_btree_delete_range(c, BTREE_ID_quotas,
|
||||
POS(QTYP_PRJ, 0),
|
||||
POS(QTYP_PRJ + 1, 0),
|
||||
NULL);
|
||||
0, NULL);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
@ -1484,7 +1484,7 @@ static int bch2_dev_remove_alloc(struct bch_fs *c, struct bch_dev *ca)
|
||||
return bch2_btree_delete_range(c, BTREE_ID_alloc,
|
||||
POS(ca->dev_idx, 0),
|
||||
POS(ca->dev_idx + 1, 0),
|
||||
NULL);
|
||||
0, NULL);
|
||||
}
|
||||
|
||||
int bch2_dev_remove(struct bch_fs *c, struct bch_dev *ca, int flags)
|
||||
|
@ -14,14 +14,14 @@ static void delete_test_keys(struct bch_fs *c)
|
||||
int ret;
|
||||
|
||||
ret = bch2_btree_delete_range(c, BTREE_ID_extents,
|
||||
SPOS(0, 0, U32_MAX),
|
||||
SPOS(0, U64_MAX, U32_MAX),
|
||||
POS_MIN, SPOS_MAX,
|
||||
BTREE_ITER_ALL_SNAPSHOTS,
|
||||
NULL);
|
||||
BUG_ON(ret);
|
||||
|
||||
ret = bch2_btree_delete_range(c, BTREE_ID_xattrs,
|
||||
SPOS(0, 0, U32_MAX),
|
||||
SPOS(0, U64_MAX, U32_MAX),
|
||||
POS_MIN, SPOS_MAX,
|
||||
BTREE_ITER_ALL_SNAPSHOTS,
|
||||
NULL);
|
||||
BUG_ON(ret);
|
||||
}
|
||||
@ -749,7 +749,9 @@ static int seq_delete(struct bch_fs *c, u64 nr)
|
||||
int ret;
|
||||
|
||||
ret = bch2_btree_delete_range(c, BTREE_ID_xattrs,
|
||||
SPOS(0, 0, U32_MAX), POS_MAX, NULL);
|
||||
POS_MIN, SPOS_MAX,
|
||||
BTREE_ITER_ALL_SNAPSHOTS,
|
||||
NULL);
|
||||
if (ret)
|
||||
bch_err(c, "error in seq_delete: %i", ret);
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user