mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-26 14:17:26 -04:00
btrfs: pass btrfs_inode to btrfs_inode_by_name
The function is for internal interfaces so we should use the btrfs_inode. Reviewed-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
5b7544cb06
commit
d1de429bce
1 changed files with 6 additions and 6 deletions
|
@ -5565,12 +5565,12 @@ no_delete:
|
||||||
* If no dir entries were found, returns -ENOENT.
|
* If no dir entries were found, returns -ENOENT.
|
||||||
* If found a corrupted location in dir entry, returns -EUCLEAN.
|
* If found a corrupted location in dir entry, returns -EUCLEAN.
|
||||||
*/
|
*/
|
||||||
static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
|
static int btrfs_inode_by_name(struct btrfs_inode *dir, struct dentry *dentry,
|
||||||
struct btrfs_key *location, u8 *type)
|
struct btrfs_key *location, u8 *type)
|
||||||
{
|
{
|
||||||
struct btrfs_dir_item *di;
|
struct btrfs_dir_item *di;
|
||||||
struct btrfs_path *path;
|
struct btrfs_path *path;
|
||||||
struct btrfs_root *root = BTRFS_I(dir)->root;
|
struct btrfs_root *root = dir->root;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct fscrypt_name fname;
|
struct fscrypt_name fname;
|
||||||
|
|
||||||
|
@ -5578,13 +5578,13 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
|
||||||
if (!path)
|
if (!path)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
ret = fscrypt_setup_filename(dir, &dentry->d_name, 1, &fname);
|
ret = fscrypt_setup_filename(&dir->vfs_inode, &dentry->d_name, 1, &fname);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* This needs to handle no-key deletions later on */
|
/* This needs to handle no-key deletions later on */
|
||||||
|
|
||||||
di = btrfs_lookup_dir_item(NULL, root, path, btrfs_ino(BTRFS_I(dir)),
|
di = btrfs_lookup_dir_item(NULL, root, path, btrfs_ino(dir),
|
||||||
&fname.disk_name, 0);
|
&fname.disk_name, 0);
|
||||||
if (IS_ERR_OR_NULL(di)) {
|
if (IS_ERR_OR_NULL(di)) {
|
||||||
ret = di ? PTR_ERR(di) : -ENOENT;
|
ret = di ? PTR_ERR(di) : -ENOENT;
|
||||||
|
@ -5597,7 +5597,7 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
|
||||||
ret = -EUCLEAN;
|
ret = -EUCLEAN;
|
||||||
btrfs_warn(root->fs_info,
|
btrfs_warn(root->fs_info,
|
||||||
"%s gets something invalid in DIR_ITEM (name %s, directory ino %llu, location(%llu %u %llu))",
|
"%s gets something invalid in DIR_ITEM (name %s, directory ino %llu, location(%llu %u %llu))",
|
||||||
__func__, fname.disk_name.name, btrfs_ino(BTRFS_I(dir)),
|
__func__, fname.disk_name.name, btrfs_ino(dir),
|
||||||
location->objectid, location->type, location->offset);
|
location->objectid, location->type, location->offset);
|
||||||
}
|
}
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
@ -5881,7 +5881,7 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
|
||||||
if (dentry->d_name.len > BTRFS_NAME_LEN)
|
if (dentry->d_name.len > BTRFS_NAME_LEN)
|
||||||
return ERR_PTR(-ENAMETOOLONG);
|
return ERR_PTR(-ENAMETOOLONG);
|
||||||
|
|
||||||
ret = btrfs_inode_by_name(dir, dentry, &location, &di_type);
|
ret = btrfs_inode_by_name(BTRFS_I(dir), dentry, &location, &di_type);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ERR_PTR(ret);
|
return ERR_PTR(ret);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue