]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: pass struct btrfs_inode to btrfs_inode_inherit_props()
authorDavid Sterba <dsterba@suse.com>
Tue, 18 Feb 2025 00:19:47 +0000 (01:19 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 18 Mar 2025 19:35:44 +0000 (20:35 +0100)
Pass a struct btrfs_inode to btrfs_inherit_props() as it's an internal
interface, allowing to remove some use of BTRFS_I.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c
fs/btrfs/props.c
fs/btrfs/props.h

index 9a503be660e8eb1b70d92a05dacfad1edace4a53..84ee6e5c5a813f4a6ebbc660a516c6064171c90f 100644 (file)
@@ -6461,11 +6461,13 @@ int btrfs_create_new_inode(struct btrfs_trans_handle *trans,
                if (IS_ERR(parent)) {
                        ret = PTR_ERR(parent);
                } else {
-                       ret = btrfs_inode_inherit_props(trans, inode, parent);
+                       ret = btrfs_inode_inherit_props(trans, BTRFS_I(inode),
+                                                       BTRFS_I(parent));
                        iput(parent);
                }
        } else {
-               ret = btrfs_inode_inherit_props(trans, inode, dir);
+               ret = btrfs_inode_inherit_props(trans, BTRFS_I(inode),
+                                               BTRFS_I(dir));
        }
        if (ret) {
                btrfs_err(fs_info,
index 74d3217fc686b0f2d0d03bd9ccffc064050ffae2..16e84a2e24f4e065d8b35cdb51a26aefcdb0e74a 100644 (file)
@@ -386,16 +386,16 @@ static struct prop_handler prop_handlers[] = {
 };
 
 int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
-                             struct inode *inode, const struct inode *parent)
+                             struct btrfs_inode *inode,
+                             const struct btrfs_inode *parent)
 {
-       struct btrfs_root *root = BTRFS_I(inode)->root;
+       struct btrfs_root *root = inode->root;
        struct btrfs_fs_info *fs_info = root->fs_info;
        int ret;
        int i;
        bool need_reserve = false;
 
-       if (!test_bit(BTRFS_INODE_HAS_PROPS,
-                     &BTRFS_I(parent)->runtime_flags))
+       if (!test_bit(BTRFS_INODE_HAS_PROPS, &parent->runtime_flags))
                return 0;
 
        for (i = 0; i < ARRAY_SIZE(prop_handlers); i++) {
@@ -406,10 +406,10 @@ int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
                if (!h->inheritable)
                        continue;
 
-               if (h->ignore(BTRFS_I(inode)))
+               if (h->ignore(inode))
                        continue;
 
-               value = h->extract(parent);
+               value = h->extract(&parent->vfs_inode);
                if (!value)
                        continue;
 
@@ -417,7 +417,7 @@ int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
                 * This is not strictly necessary as the property should be
                 * valid, but in case it isn't, don't propagate it further.
                 */
-               ret = h->validate(BTRFS_I(inode), value, strlen(value));
+               ret = h->validate(inode, value, strlen(value));
                if (ret)
                        continue;
 
@@ -437,16 +437,15 @@ int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
                                return ret;
                }
 
-               ret = btrfs_setxattr(trans, inode, h->xattr_name, value,
+               ret = btrfs_setxattr(trans, &inode->vfs_inode, h->xattr_name, value,
                                     strlen(value), 0);
                if (!ret) {
-                       ret = h->apply(inode, value, strlen(value));
+                       ret = h->apply(&inode->vfs_inode, value, strlen(value));
                        if (ret)
-                               btrfs_setxattr(trans, inode, h->xattr_name,
+                               btrfs_setxattr(trans, &inode->vfs_inode, h->xattr_name,
                                               NULL, 0, 0);
                        else
-                               set_bit(BTRFS_INODE_HAS_PROPS,
-                                       &BTRFS_I(inode)->runtime_flags);
+                               set_bit(BTRFS_INODE_HAS_PROPS, &inode->runtime_flags);
                }
 
                if (need_reserve) {
index a0cc2a7a1e2e38cb4d97dd65bc4931a0e309d0c4..15d9a025c923db65193d5f6266d205e744adceed 100644 (file)
@@ -9,7 +9,6 @@
 #include <linux/types.h>
 #include <linux/compiler_types.h>
 
-struct inode;
 struct btrfs_inode;
 struct btrfs_path;
 struct btrfs_trans_handle;
@@ -26,7 +25,7 @@ bool btrfs_ignore_prop(const struct btrfs_inode *inode, const char *name);
 int btrfs_load_inode_props(struct btrfs_inode *inode, struct btrfs_path *path);
 
 int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
-                             struct inode *inode,
-                             const struct inode *dir);
+                             struct btrfs_inode *inode,
+                             const struct btrfs_inode *dir);
 
 #endif