btrfs: remove redundant root argument from fixup_inode_link_count()
[ Upstream commit 8befc61cbb
]
The root argument for fixup_inode_link_count() always matches the root of
the given inode, so remove the root argument and get it from the inode
argument. This also applies to the helpers count_inode_extrefs() and
count_inode_refs() used by fixup_inode_link_count() - they don't need the
root argument, as it always matches the root of the inode passed to them.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Stable-dep-of: 5f61b961599a ("btrfs: fix inode lookup error handling during log replay")
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit e6031107f397725a8959934a8548c2a7772c73e5)
This commit is contained in:
parent
1fdbd4a3af
commit
2c9c9a8305
|
@ -1504,8 +1504,7 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int count_inode_extrefs(struct btrfs_root *root,
|
||||
struct btrfs_inode *inode, struct btrfs_path *path)
|
||||
static int count_inode_extrefs(struct btrfs_inode *inode, struct btrfs_path *path)
|
||||
{
|
||||
int ret = 0;
|
||||
int name_len;
|
||||
|
@ -1519,8 +1518,8 @@ static int count_inode_extrefs(struct btrfs_root *root,
|
|||
struct extent_buffer *leaf;
|
||||
|
||||
while (1) {
|
||||
ret = btrfs_find_one_extref(root, inode_objectid, offset, path,
|
||||
&extref, &offset);
|
||||
ret = btrfs_find_one_extref(inode->root, inode_objectid, offset,
|
||||
path, &extref, &offset);
|
||||
if (ret)
|
||||
break;
|
||||
|
||||
|
@ -1548,8 +1547,7 @@ static int count_inode_extrefs(struct btrfs_root *root,
|
|||
return nlink;
|
||||
}
|
||||
|
||||
static int count_inode_refs(struct btrfs_root *root,
|
||||
struct btrfs_inode *inode, struct btrfs_path *path)
|
||||
static int count_inode_refs(struct btrfs_inode *inode, struct btrfs_path *path)
|
||||
{
|
||||
int ret;
|
||||
struct btrfs_key key;
|
||||
|
@ -1564,7 +1562,7 @@ static int count_inode_refs(struct btrfs_root *root,
|
|||
key.offset = (u64)-1;
|
||||
|
||||
while (1) {
|
||||
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
|
||||
ret = btrfs_search_slot(NULL, inode->root, &key, path, 0, 0);
|
||||
if (ret < 0)
|
||||
break;
|
||||
if (ret > 0) {
|
||||
|
@ -1616,9 +1614,9 @@ process_slot:
|
|||
* will free the inode.
|
||||
*/
|
||||
static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_root *root,
|
||||
struct inode *inode)
|
||||
{
|
||||
struct btrfs_root *root = BTRFS_I(inode)->root;
|
||||
struct btrfs_path *path;
|
||||
int ret;
|
||||
u64 nlink = 0;
|
||||
|
@ -1628,13 +1626,13 @@ static noinline int fixup_inode_link_count(struct btrfs_trans_handle *trans,
|
|||
if (!path)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = count_inode_refs(root, BTRFS_I(inode), path);
|
||||
ret = count_inode_refs(BTRFS_I(inode), path);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
nlink = ret;
|
||||
|
||||
ret = count_inode_extrefs(root, BTRFS_I(inode), path);
|
||||
ret = count_inode_extrefs(BTRFS_I(inode), path);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
||||
|
@ -1706,7 +1704,7 @@ static noinline int fixup_inode_link_counts(struct btrfs_trans_handle *trans,
|
|||
break;
|
||||
}
|
||||
|
||||
ret = fixup_inode_link_count(trans, root, inode);
|
||||
ret = fixup_inode_link_count(trans, inode);
|
||||
iput(inode);
|
||||
if (ret)
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue