]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/acl.c
Update bcachefs sources to 386f00b639 bcachefs: Snapshot creation, deletion
[bcachefs-tools-debian] / libbcachefs / acl.c
index 2146a63d1846353fbac2badd7e028a702bf24e84..f92b52e49254d32c34ae1316bb24e685011064fc 100644 (file)
@@ -229,7 +229,7 @@ retry:
        bch2_trans_begin(&trans);
 
        ret = bch2_hash_lookup(&trans, &iter, bch2_xattr_hash_desc,
-                       &hash, inode->v.i_ino,
+                       &hash, inode_inum(inode),
                        &X_SEARCH(acl_to_xattr_type(type), "", 0),
                        0);
        if (ret) {
@@ -259,11 +259,11 @@ out:
        return acl;
 }
 
-int bch2_set_acl_trans(struct btree_trans *trans,
+int bch2_set_acl_trans(struct btree_trans *trans, subvol_inum inum,
                       struct bch_inode_unpacked *inode_u,
-                      const struct bch_hash_info *hash_info,
                       struct posix_acl *acl, int type)
 {
+       struct bch_hash_info hash_info = bch2_hash_info_init(trans->c, inode_u);
        int ret;
 
        if (type == ACL_TYPE_DEFAULT &&
@@ -276,14 +276,14 @@ int bch2_set_acl_trans(struct btree_trans *trans,
                if (IS_ERR(xattr))
                        return PTR_ERR(xattr);
 
-               ret = bch2_hash_set(trans, bch2_xattr_hash_desc, hash_info,
-                                   inode_u->bi_inum, &xattr->k_i, 0);
+               ret = bch2_hash_set(trans, bch2_xattr_hash_desc, &hash_info,
+                                   inum, &xattr->k_i, 0);
        } else {
                struct xattr_search_key search =
                        X_SEARCH(acl_to_xattr_type(type), "", 0);
 
-               ret = bch2_hash_delete(trans, bch2_xattr_hash_desc, hash_info,
-                                      inode_u->bi_inum, &search);
+               ret = bch2_hash_delete(trans, bch2_xattr_hash_desc, &hash_info,
+                                      inum, &search);
        }
 
        return ret == -ENOENT ? 0 : ret;
@@ -297,7 +297,6 @@ int bch2_set_acl(struct user_namespace *mnt_userns,
        struct btree_trans trans;
        struct btree_iter inode_iter = { NULL };
        struct bch_inode_unpacked inode_u;
-       struct bch_hash_info hash_info;
        struct posix_acl *acl;
        umode_t mode;
        int ret;
@@ -308,7 +307,7 @@ retry:
        bch2_trans_begin(&trans);
        acl = _acl;
 
-       ret = bch2_inode_peek(&trans, &inode_iter, &inode_u, inode->v.i_ino,
+       ret = bch2_inode_peek(&trans, &inode_iter, &inode_u, inode_inum(inode),
                              BTREE_ITER_INTENT);
        if (ret)
                goto btree_err;
@@ -321,9 +320,7 @@ retry:
                        goto btree_err;
        }
 
-       hash_info = bch2_hash_info_init(c, &inode_u);
-
-       ret = bch2_set_acl_trans(&trans, &inode_u, &hash_info, acl, type);
+       ret = bch2_set_acl_trans(&trans, inode_inum(inode), &inode_u, acl, type);
        if (ret)
                goto btree_err;
 
@@ -352,7 +349,7 @@ err:
        return ret;
 }
 
-int bch2_acl_chmod(struct btree_trans *trans,
+int bch2_acl_chmod(struct btree_trans *trans, subvol_inum inum,
                   struct bch_inode_unpacked *inode,
                   umode_t mode,
                   struct posix_acl **new_acl)
@@ -366,7 +363,7 @@ int bch2_acl_chmod(struct btree_trans *trans,
        int ret;
 
        ret = bch2_hash_lookup(trans, &iter, bch2_xattr_hash_desc,
-                       &hash_info, inode->bi_inum,
+                              &hash_info, inum,
                        &X_SEARCH(KEY_TYPE_XATTR_INDEX_POSIX_ACL_ACCESS, "", 0),
                        BTREE_ITER_INTENT);
        if (ret)