]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Add iter_flags arg to bch2_btree_delete_range()
authorKent Overstreet <kent.overstreet@gmail.com>
Wed, 29 Dec 2021 18:49:34 +0000 (13:49 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:20 +0000 (17:09 -0400)
Will be used by the new snapshot tests, to pass in
BTREE_ITER_ALL_SNAPSHOTS.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/btree_update.h
fs/bcachefs/btree_update_leaf.c
fs/bcachefs/ec.c
fs/bcachefs/quota.c
fs/bcachefs/super.c
fs/bcachefs/tests.c

index a61b64fc08596c7f167500bc0d9bc7794f1f3c06..7d16c35112f39b799a92436a659268f6ea601014 100644 (file)
@@ -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);
index 50c9caa729ff009ec7365b867fcac7b10a0ec00f..e3e5b17e9191d1b13c945627c4e0a721bf5b740f 100644 (file)
@@ -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));
 }
index 16e1fb845ce5e80c548bfd8e54c2cce6bc78c48c..e18d2ecf7f071f37954811d3f8556d4993473ebe 100644 (file)
@@ -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)
index 8f8f4b0accd6054a1b42787aad1c05fb5e0f3a27..54bb2a454a5e7a78db16a4de655455cb95340a35 100644 (file)
@@ -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;
        }
index 574c336e108ba64642cc8669b9e70c9d76353dcd..d92bb50d0960c7c2da3c368821307f53ed3ef46f 100644 (file)
@@ -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)
index 145b85320d228d63661155ccffdf4fd18b2c91a2..0247309a25e6278375dc3ca16be30889199d522d 100644 (file)
@@ -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;