Btrfs: remove duplicated btrfs_release_path in btrfs_unlink_subvol
PATCH 1/1 Btrfs: remove duplicated btrfs_release_path in btrfs_unlink_subvol
The btrfs_release_path() is just useless as path is only used in error handling.
--- fs/btrfs/inode.c | 1 - 1 file changed, 1 deletion(-)
fs/btrfs/inode.c +0 -1
@@ -4148,7 +4148,6 @@ static int btrfs_unlink_subvol(struct btrfs_trans_handle *trans,btrfs_release_path (path); index = key.offset; } -btrfs_release_path (path); ret =btrfs_delete_delayed_dir_index (trans, fs_info,BTRFS_I (dir), index);if (ret) {
Signature · 1 line
1.8.3.1
Quoted 1 line · Liu Bo
The
btrfs_release_path()is just useless as path is only used in error handling.
Where is it duplicated? And I don't think it's useless, while the changelog does not explain why and it's not obvious from the context. If the path is locked, then releasing it right after it's not needed makes sense. There are several potentially heavyweight operations between the release and final free.
Quoted 8 lines · David Sterba
Quoted 1 line · Liu Bo
The
btrfs_release_path()is just useless as path is only used in error handling.Where is it duplicated? And I don't think it's useless, while the changelog does not explain why and it's not obvious from the context. If the path is locked, then releasing it right after it's not needed makes sense. There are several potentially heavyweight operations between the release and final free.
I see, the diff context is a little bit misleading, the logic in btrfs_unlink_subvol() is like,
{
...
btrfs_delete_one_dir_name(path);
btrfs_release_path(path);
ret = btrfs_del_root_ref(); <<<< path is not used here.
if (ret < 0) {
btrfs_search_dir_index_item(path);
btrfs_release_path(path);
}
btrfs_release_path(path); <<<< path has been released anyway.
...
}thanks,
-liubo
Quoted 4 lines · Liu Bo
Quoted 3 lines · David Sterba
Quoted 1 line · Liu Bo
The
btrfs_release_path()is just useless as path is only used in error handling.
Quoted 8 lines
Quoted 5 lines
Where is it duplicated? And I don't think it's useless, while the changelog does not explain why and it's not obvious from the context. If the path is locked, then releasing it right after it's not needed makes sense. There are several potentially heavyweight operations between the release and final free.
I see, the diff context is a little bit misleading, the logic in
btrfs_unlink_subvol()is like,
Well, you based you patch on old code, the duplicate btrfs_release_path has been removed in 5b7d687ad5913a56b6a8788435d7a53990b4176d and was in the devel branches since like 2 weeks.
The patch removes the first release while it would could have been the other one to save some cycles when the branch with btrfs_search_dir_index_item is not taken.
Quoted 14 lines · David Sterba
Quoted 4 lines · Liu Bo
Quoted 3 lines · David Sterba
Quoted 1 line · Liu Bo
The
btrfs_release_path()is just useless as path is only used in error handling.Quoted 8 lines
Quoted 5 lines
Where is it duplicated? And I don't think it's useless, while the changelog does not explain why and it's not obvious from the context. If the path is locked, then releasing it right after it's not needed makes sense. There are several potentially heavyweight operations between the release and final free.
I see, the diff context is a little bit misleading, the logic in
btrfs_unlink_subvol()is like,
Quoted 7 lines
Well, you based you patch on old code, the duplicate
btrfs_release_pathhas been removed in5b7d687ad5913a56b6a8788435d7a53990b4176dand was in the devel branches since like 2 weeks.The patch removes the first release while it would could have been the other one to save some cycles when the branch with
btrfs_search_dir_index_itemis not taken.
Ah I see, sorry for the noise.
thanks,
liubo