linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liu Bo <bo.liu@linux.alibaba.com>
To: dsterba@suse.cz, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: remove duplicated btrfs_release_path in btrfs_unlink_subvol
Date: Wed, 15 Aug 2018 10:52:56 +0800	[thread overview]
Message-ID: <20180815025256.6fftocnncloellm3@rsjd01523.et2sqa> (raw)
In-Reply-To: <20180814104600.GE24025@twin.jikos.cz>

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

  reply	other threads:[~2018-08-15  5:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2018-08-15 11:48     ` David Sterba
2018-08-15 18:40       ` Liu Bo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180815025256.6fftocnncloellm3@rsjd01523.et2sqa \
    --to=bo.liu@linux.alibaba.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).