]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: kill flags param to bch2_subvolume_get()
authorKent Overstreet <kent.overstreet@linux.dev>
Thu, 5 Dec 2024 04:40:26 +0000 (23:40 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 21 Dec 2024 06:36:22 +0000 (01:36 -0500)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/dirent.c
fs/bcachefs/fs-common.c
fs/bcachefs/fs.c
fs/bcachefs/fsck.c
fs/bcachefs/snapshot.c
fs/bcachefs/subvolume.c
fs/bcachefs/subvolume.h

index 41813f9ce8315576df95798058b716a3bf7e3b12..600eee936f13653ed608de496793edb977df8629 100644 (file)
@@ -266,7 +266,7 @@ int bch2_dirent_read_target(struct btree_trans *trans, subvol_inum dir,
        } else {
                target->subvol  = le32_to_cpu(d.v->d_child_subvol);
 
-               ret = bch2_subvolume_get(trans, target->subvol, true, BTREE_ITER_cached, &s);
+               ret = bch2_subvolume_get(trans, target->subvol, true, &s);
 
                target->inum    = le64_to_cpu(s.inode);
        }
index dcaa47f68f31ec71362fdb265624e5608d316a9c..f8d27244e1d6a60bfaf34ff50743535edea561c1 100644 (file)
@@ -69,9 +69,7 @@ int bch2_create_trans(struct btree_trans *trans,
                if (!snapshot_src.inum) {
                        /* Inode wasn't specified, just snapshot: */
                        struct bch_subvolume s;
-
-                       ret = bch2_subvolume_get(trans, snapshot_src.subvol, true,
-                                                BTREE_ITER_cached, &s);
+                       ret = bch2_subvolume_get(trans, snapshot_src.subvol, true, &s);
                        if (ret)
                                goto err;
 
index c6e7df7c67fa565cc2f6d66225c306081b50b90a..3f83f131d0e818bfca7688ec68b66bf4394e2f03 100644 (file)
@@ -499,7 +499,7 @@ struct inode *bch2_vfs_inode_get(struct bch_fs *c, subvol_inum inum)
        struct bch_inode_unpacked inode_u;
        struct bch_subvolume subvol;
        int ret = lockrestart_do(trans,
-               bch2_subvolume_get(trans, inum.subvol, true, 0, &subvol) ?:
+               bch2_subvolume_get(trans, inum.subvol, true, &subvol) ?:
                bch2_inode_find_by_inum_trans(trans, inum, &inode_u)) ?:
                PTR_ERR_OR_ZERO(inode = bch2_inode_hash_init_insert(trans, inum, &inode_u, &subvol));
        bch2_trans_put(trans);
@@ -569,8 +569,7 @@ retry:
        inum.subvol = inode_u.bi_subvol ?: dir->ei_inum.subvol;
        inum.inum = inode_u.bi_inum;
 
-       ret   = bch2_subvolume_get(trans, inum.subvol, true,
-                                  BTREE_ITER_with_updates, &subvol) ?:
+       ret   = bch2_subvolume_get(trans, inum.subvol, true, &subvol) ?:
                bch2_trans_commit(trans, NULL, &journal_seq, 0);
        if (unlikely(ret)) {
                bch2_quota_acct(c, bch_qid(&inode_u), Q_INO, -1,
@@ -651,7 +650,7 @@ static struct bch_inode_info *bch2_lookup_trans(struct btree_trans *trans,
 
        struct bch_subvolume subvol;
        struct bch_inode_unpacked inode_u;
-       ret =   bch2_subvolume_get(trans, inum.subvol, true, 0, &subvol) ?:
+       ret =   bch2_subvolume_get(trans, inum.subvol, true, &subvol) ?:
                bch2_inode_find_by_inum_nowarn_trans(trans, inum, &inode_u) ?:
                PTR_ERR_OR_ZERO(inode = bch2_inode_hash_init_insert(trans, inum, &inode_u, &subvol));
 
index 1a5a07112779adfb868ee6d7e7e34d2cf5082657..1e00b2694db725825fccc260e047e8beb5687657 100644 (file)
@@ -109,7 +109,7 @@ static int subvol_lookup(struct btree_trans *trans, u32 subvol,
                         u32 *snapshot, u64 *inum)
 {
        struct bch_subvolume s;
-       int ret = bch2_subvolume_get(trans, subvol, false, 0, &s);
+       int ret = bch2_subvolume_get(trans, subvol, false, &s);
 
        *snapshot = le32_to_cpu(s.snapshot);
        *inum = le64_to_cpu(s.inode);
@@ -226,8 +226,7 @@ static int lookup_lostfound(struct btree_trans *trans, u32 snapshot,
        subvol_inum root_inum = { .subvol = le32_to_cpu(st.master_subvol) };
 
        struct bch_subvolume subvol;
-       ret = bch2_subvolume_get(trans, le32_to_cpu(st.master_subvol),
-                                false, 0, &subvol);
+       ret = bch2_subvolume_get(trans, le32_to_cpu(st.master_subvol), false, &subvol);
        bch_err_msg(c, ret, "looking up root subvol %u for snapshot %u",
                    le32_to_cpu(st.master_subvol), snapshot);
        if (ret)
@@ -1421,7 +1420,7 @@ static int check_inode(struct btree_trans *trans,
        if (u.bi_subvol) {
                struct bch_subvolume s;
 
-               ret = bch2_subvolume_get(trans, u.bi_subvol, false, 0, &s);
+               ret = bch2_subvolume_get(trans, u.bi_subvol, false, &s);
                if (ret && !bch2_err_matches(ret, ENOENT))
                        goto err;
 
index f368270d6d9bd282211a1b73158a258a70216393..99f04551831267b7f0b03e67810c803a2fa816b9 100644 (file)
@@ -570,8 +570,7 @@ static int check_snapshot_tree(struct btree_trans *trans,
                goto err;
        }
 
-       ret = bch2_subvolume_get(trans, le32_to_cpu(st.v->master_subvol),
-                                false, 0, &subvol);
+       ret = bch2_subvolume_get(trans, le32_to_cpu(st.v->master_subvol), false, &subvol);
        if (ret && !bch2_err_matches(ret, ENOENT))
                goto err;
 
@@ -811,7 +810,7 @@ static int check_snapshot(struct btree_trans *trans,
 
        if (should_have_subvol) {
                id = le32_to_cpu(s.subvol);
-               ret = bch2_subvolume_get(trans, id, 0, false, &subvol);
+               ret = bch2_subvolume_get(trans, id, false, &subvol);
                if (bch2_err_matches(ret, ENOENT))
                        bch_err(c, "snapshot points to nonexistent subvolume:\n  %s",
                                (bch2_bkey_val_to_text(&buf, c, k), buf.buf));
index 5e5ae405cb28782325e0293f50bcf1a12301916d..0e756e35c3d9d935052559eb0ab3586ed781c77c 100644 (file)
@@ -286,11 +286,11 @@ int bch2_subvol_has_children(struct btree_trans *trans, u32 subvol)
 static __always_inline int
 bch2_subvolume_get_inlined(struct btree_trans *trans, unsigned subvol,
                           bool inconsistent_if_not_found,
-                          int iter_flags,
                           struct bch_subvolume *s)
 {
        int ret = bch2_bkey_get_val_typed(trans, BTREE_ID_subvolumes, POS(0, subvol),
-                                         iter_flags, subvolume, s);
+                                         BTREE_ITER_cached|
+                                         BTREE_ITER_with_updates, subvolume, s);
        bch2_fs_inconsistent_on(bch2_err_matches(ret, ENOENT) &&
                                inconsistent_if_not_found,
                                trans->c, "missing subvolume %u", subvol);
@@ -299,16 +299,15 @@ bch2_subvolume_get_inlined(struct btree_trans *trans, unsigned subvol,
 
 int bch2_subvolume_get(struct btree_trans *trans, unsigned subvol,
                       bool inconsistent_if_not_found,
-                      int iter_flags,
                       struct bch_subvolume *s)
 {
-       return bch2_subvolume_get_inlined(trans, subvol, inconsistent_if_not_found, iter_flags, s);
+       return bch2_subvolume_get_inlined(trans, subvol, inconsistent_if_not_found, s);
 }
 
 int bch2_subvol_is_ro_trans(struct btree_trans *trans, u32 subvol)
 {
        struct bch_subvolume s;
-       int ret = bch2_subvolume_get_inlined(trans, subvol, true, 0, &s);
+       int ret = bch2_subvolume_get_inlined(trans, subvol, true, &s);
        if (ret)
                return ret;
 
@@ -328,7 +327,7 @@ int bch2_snapshot_get_subvol(struct btree_trans *trans, u32 snapshot,
        struct bch_snapshot snap;
 
        return  bch2_snapshot_lookup(trans, snapshot, &snap) ?:
-               bch2_subvolume_get(trans, le32_to_cpu(snap.subvol), true, 0, subvol);
+               bch2_subvolume_get(trans, le32_to_cpu(snap.subvol), true, subvol);
 }
 
 int __bch2_subvolume_get_snapshot(struct btree_trans *trans, u32 subvolid,
@@ -396,8 +395,7 @@ static int bch2_subvolumes_reparent(struct btree_trans *trans, u32 subvolid_to_d
        struct bch_subvolume s;
 
        return lockrestart_do(trans,
-                       bch2_subvolume_get(trans, subvolid_to_delete, true,
-                                  BTREE_ITER_cached, &s)) ?:
+                       bch2_subvolume_get(trans, subvolid_to_delete, true, &s)) ?:
                for_each_btree_key_commit(trans, iter,
                                BTREE_ID_subvolumes, POS_MIN, BTREE_ITER_prefetch, k,
                                NULL, NULL, BCH_TRANS_COMMIT_no_enospc,
index d53d292c22d7acf880e9cbeedc77c89d64f304bf..910f6196700e324497008c00051eea71a704c791 100644 (file)
@@ -24,7 +24,7 @@ int bch2_subvolume_trigger(struct btree_trans *, enum btree_id, unsigned,
 
 int bch2_subvol_has_children(struct btree_trans *, u32);
 int bch2_subvolume_get(struct btree_trans *, unsigned,
-                      bool, int, struct bch_subvolume *);
+                      bool, struct bch_subvolume *);
 int __bch2_subvolume_get_snapshot(struct btree_trans *, u32,
                                  u32 *, bool);
 int bch2_subvolume_get_snapshot(struct btree_trans *, u32, u32 *);