ext4: factor out ext4_free_ext_path()

Factor out ext4_free_ext_path() to free extent path. As after previous patch
'ext4_ext_drop_refs()' is only used in 'extents.c', so make it static.

Signed-off-by: Ye Bin <yebin10@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220924021211.3831551-3-yebin10@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
Ye Bin
2022-09-24 10:12:11 +08:00
committed by Theodore Ts'o
parent b6a750c019
commit 7ff5fddadd
7 changed files with 54 additions and 82 deletions

View File

@@ -32,8 +32,7 @@ get_ext_path(struct inode *inode, ext4_lblk_t lblock,
if (IS_ERR(path))
return PTR_ERR(path);
if (path[ext_depth(inode)].p_ext == NULL) {
ext4_ext_drop_refs(path);
kfree(path);
ext4_free_ext_path(path);
*ppath = NULL;
return -ENODATA;
}
@@ -106,8 +105,7 @@ mext_check_coverage(struct inode *inode, ext4_lblk_t from, ext4_lblk_t count,
}
ret = 1;
out:
ext4_ext_drop_refs(path);
kfree(path);
ext4_free_ext_path(path);
return ret;
}
@@ -691,8 +689,7 @@ out:
ext4_discard_preallocations(donor_inode, 0);
}
ext4_ext_drop_refs(path);
kfree(path);
ext4_free_ext_path(path);
ext4_double_up_write_data_sem(orig_inode, donor_inode);
unlock_two_nondirectories(orig_inode, donor_inode);