diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-12-29 21:49:34 +0300 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-23 00:09:20 +0300 |
commit | d248ee5637d4cc7952e9e2ad5a6a9099b2d54c48 (patch) | |
tree | ea771f503657547c27ed1572ca9a532202204e6c | |
parent | 200472e91c6c6745e6ddf42d1b33265f84b26e68 (diff) | |
download | linux-d248ee5637d4cc7952e9e2ad5a6a9099b2d54c48.tar.xz |
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>
-rw-r--r-- | fs/bcachefs/btree_update.h | 2 | ||||
-rw-r--r-- | fs/bcachefs/btree_update_leaf.c | 6 | ||||
-rw-r--r-- | fs/bcachefs/ec.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/quota.c | 6 | ||||
-rw-r--r-- | fs/bcachefs/super.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/tests.c | 12 |
6 files changed, 17 insertions, 13 deletions
diff --git a/fs/bcachefs/btree_update.h b/fs/bcachefs/btree_update.h index a61b64fc0859..7d16c35112f3 100644 --- a/fs/bcachefs/btree_update.h +++ b/fs/bcachefs/btree_update.h @@ -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); diff --git a/fs/bcachefs/btree_update_leaf.c b/fs/bcachefs/btree_update_leaf.c index 50c9caa729ff..e3e5b17e9191 100644 --- a/fs/bcachefs/btree_update_leaf.c +++ b/fs/bcachefs/btree_update_leaf.c @@ -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)); } diff --git a/fs/bcachefs/ec.c b/fs/bcachefs/ec.c index 16e1fb845ce5..e18d2ecf7f07 100644 --- a/fs/bcachefs/ec.c +++ b/fs/bcachefs/ec.c @@ -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) diff --git a/fs/bcachefs/quota.c b/fs/bcachefs/quota.c index 8f8f4b0accd6..54bb2a454a5e 100644 --- a/fs/bcachefs/quota.c +++ b/fs/bcachefs/quota.c @@ -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; } diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c index 574c336e108b..d92bb50d0960 100644 --- a/fs/bcachefs/super.c +++ b/fs/bcachefs/super.c @@ -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) diff --git a/fs/bcachefs/tests.c b/fs/bcachefs/tests.c index 145b85320d22..0247309a25e6 100644 --- a/fs/bcachefs/tests.c +++ b/fs/bcachefs/tests.c @@ -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; |