Skip to content

Commit c5d2cdb

Browse files
committed
btrfs: pass dentry to btrfs_mksubvol() and btrfs_mksnapshot()
There's no reason to pass 'struct path' to btrfs_mksubvol(), though it's been like the since the first commit 76dda93 ("Btrfs: add snapshot/subvolume destroy ioctl"). We only use the dentry so we should pass it directly. Signed-off-by: David Sterba <dsterba@suse.com>
1 parent dbc9d2b commit c5d2cdb

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

fs/btrfs/ioctl.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -892,13 +892,13 @@ static inline int btrfs_may_create(struct mnt_idmap *idmap,
892892
* sys_mkdirat and vfs_mkdir, but we only do a single component lookup
893893
* inside this filesystem so it's quite a bit simpler.
894894
*/
895-
static noinline int btrfs_mksubvol(const struct path *parent,
895+
static noinline int btrfs_mksubvol(struct dentry *parent,
896896
struct mnt_idmap *idmap,
897897
struct qstr *qname, struct btrfs_root *snap_src,
898898
bool readonly,
899899
struct btrfs_qgroup_inherit *inherit)
900900
{
901-
struct inode *dir = d_inode(parent->dentry);
901+
struct inode *dir = d_inode(parent);
902902
struct btrfs_fs_info *fs_info = inode_to_fs_info(dir);
903903
struct dentry *dentry;
904904
struct fscrypt_str name_str = FSTR_INIT((char *)qname->name, qname->len);
@@ -908,7 +908,7 @@ static noinline int btrfs_mksubvol(const struct path *parent,
908908
if (ret == -EINTR)
909909
return ret;
910910

911-
dentry = lookup_one(idmap, qname, parent->dentry);
911+
dentry = lookup_one(idmap, qname, parent);
912912
ret = PTR_ERR(dentry);
913913
if (IS_ERR(dentry))
914914
goto out_unlock;
@@ -946,7 +946,7 @@ static noinline int btrfs_mksubvol(const struct path *parent,
946946
return ret;
947947
}
948948

949-
static noinline int btrfs_mksnapshot(const struct path *parent,
949+
static noinline int btrfs_mksnapshot(struct dentry *parent,
950950
struct mnt_idmap *idmap,
951951
struct qstr *qname,
952952
struct btrfs_root *root,
@@ -1208,7 +1208,7 @@ static noinline int __btrfs_ioctl_snap_create(struct file *file,
12081208
}
12091209

12101210
if (subvol) {
1211-
ret = btrfs_mksubvol(&file->f_path, idmap, &qname, NULL,
1211+
ret = btrfs_mksubvol(file_dentry(file), idmap, &qname, NULL,
12121212
readonly, inherit);
12131213
} else {
12141214
CLASS(fd, src)(fd);
@@ -1239,7 +1239,7 @@ static noinline int __btrfs_ioctl_snap_create(struct file *file,
12391239
*/
12401240
ret = -EINVAL;
12411241
} else {
1242-
ret = btrfs_mksnapshot(&file->f_path, idmap, &qname,
1242+
ret = btrfs_mksnapshot(file_dentry(file), idmap, &qname,
12431243
BTRFS_I(src_inode)->root,
12441244
readonly, inherit);
12451245
}

0 commit comments

Comments
 (0)