* [PATCH] Btrfs: remove duplicated btrfs_release_path in btrfs_unlink_subvol @ 2018-08-14 2:47 Liu Bo 2018-08-14 10:46 ` David Sterba 0 siblings, 1 reply; 5+ messages in thread From: Liu Bo @ 2018-08-14 2:47 UTC (permalink / raw) To: linux-btrfs The btrfs_release_path() is just useless as path is only used in error handling. Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com> --- fs/btrfs/inode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index eba61bcb9bb3..5680e9c462a3 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -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) { -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Btrfs: remove duplicated btrfs_release_path in btrfs_unlink_subvol 2018-08-14 2:47 [PATCH] Btrfs: remove duplicated btrfs_release_path in btrfs_unlink_subvol Liu Bo @ 2018-08-14 10:46 ` David Sterba 2018-08-15 2:52 ` Liu Bo 0 siblings, 1 reply; 5+ messages in thread From: David Sterba @ 2018-08-14 10:46 UTC (permalink / raw) To: Liu Bo; +Cc: linux-btrfs On Tue, Aug 14, 2018 at 10:47:09AM +0800, Liu Bo wrote: > 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. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Btrfs: remove duplicated btrfs_release_path in btrfs_unlink_subvol 2018-08-14 10:46 ` David Sterba @ 2018-08-15 2:52 ` Liu Bo 2018-08-15 11:48 ` David Sterba 0 siblings, 1 reply; 5+ messages in thread From: Liu Bo @ 2018-08-15 2:52 UTC (permalink / raw) To: dsterba, linux-btrfs On Tue, Aug 14, 2018 at 12:46:00PM +0200, David Sterba wrote: > On Tue, Aug 14, 2018 at 10:47:09AM +0800, Liu Bo wrote: > > 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Btrfs: remove duplicated btrfs_release_path in btrfs_unlink_subvol 2018-08-15 2:52 ` Liu Bo @ 2018-08-15 11:48 ` David Sterba 2018-08-15 18:40 ` Liu Bo 0 siblings, 1 reply; 5+ messages in thread From: David Sterba @ 2018-08-15 11:48 UTC (permalink / raw) To: Liu Bo; +Cc: dsterba, linux-btrfs On Wed, Aug 15, 2018 at 10:52:56AM +0800, Liu Bo wrote: > On Tue, Aug 14, 2018 at 12:46:00PM +0200, David Sterba wrote: > > On Tue, Aug 14, 2018 at 10:47:09AM +0800, Liu Bo wrote: > > > 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, 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. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Btrfs: remove duplicated btrfs_release_path in btrfs_unlink_subvol 2018-08-15 11:48 ` David Sterba @ 2018-08-15 18:40 ` Liu Bo 0 siblings, 0 replies; 5+ messages in thread From: Liu Bo @ 2018-08-15 18:40 UTC (permalink / raw) To: David Sterba, Liu Bo, linux-btrfs On Wed, Aug 15, 2018 at 4:48 AM, David Sterba <dsterba@suse.cz> wrote: > On Wed, Aug 15, 2018 at 10:52:56AM +0800, Liu Bo wrote: >> On Tue, Aug 14, 2018 at 12:46:00PM +0200, David Sterba wrote: >> > On Tue, Aug 14, 2018 at 10:47:09AM +0800, Liu Bo wrote: >> > > 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, > > 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. Ah I see, sorry for the noise. thanks, liubo ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-08-15 21:34 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-08-14 2:47 [PATCH] Btrfs: remove duplicated btrfs_release_path in btrfs_unlink_subvol Liu Bo 2018-08-14 10:46 ` David Sterba 2018-08-15 2:52 ` Liu Bo 2018-08-15 11:48 ` David Sterba 2018-08-15 18:40 ` Liu Bo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).