linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans van Kranenburg <hans.van.kranenburg@mendix.com>
To: Martin Raiber <martin@urbackup.org>,
	Rohan Kadekodi <kadekodirohan@gmail.com>,
	linux-btrfs@vger.kernel.org
Cc: Vijaychidambaram Velayudhan Pillai <vijay@cs.utexas.edu>,
	Jayashree Mohan <jayashree2912@gmail.com>
Subject: Re: Regarding handling of file renames in Btrfs
Date: Sat, 16 Sep 2017 14:45:17 +0200	[thread overview]
Message-ID: <649a8567-20dc-de23-9920-95abc1513b31@mendix.com> (raw)
In-Reply-To: <0102015e8ab4b62a-8fdaae03-6fd2-41de-a0fa-a42c8b892445-000000@eu-west-1.amazonses.com>

On 09/16/2017 02:40 PM, Martin Raiber wrote:
> Hi,
> 
> On 16.09.2017 14:27 Hans van Kranenburg wrote:
>> On 09/10/2017 01:50 AM, Rohan Kadekodi wrote:
>>> I was trying to understand how file renames are handled in Btrfs. I
>>> read the code documentation, but had a problem understanding a few
>>> things.
>>>
>>> During a file rename, btrfs_commit_transaction() is called which is
>>> because Btrfs has to commit the whole FS before storing the
>>> information related to the new renamed file.
>> Can you point to which lines of code you're looking at?
>>
>>> It has to commit the FS
>>> because a rename first does an unlink, which is not recorded in the
>>> btrfs_rename() transaction and so is not logged in the log tree. Is my
>>> understanding correct? [...]
>> Can you also point to where exactly you see this happening? I'd also
>> like to understand more about this.
>>
>> The whole mail thread following this message continues about what a
>> transaction commit is and does etc, but the above question is never
>> answered I think.
>>
>> And I think it's an interesting question. Is a rename a "heavier"
>> operation relative to other file operations?
>>
> as far as I can see it only uses the log tree in some cases where the
> log tree was already used for the file or the parent directory. The
> cases are documented here
> https://github.com/torvalds/linux/blob/master/fs/btrfs/tree-log.c#L45 .
> So rename isn't much heavier than unlink+create.

Ah. I also see that the difficult situations are about moving a file to
another directory.

So, if I just rename a file in the same directory, that's even simpler.

-- 
Hans van Kranenburg

      reply	other threads:[~2017-09-16 12:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-09 23:50 Regarding handling of file renames in Btrfs Rohan Kadekodi
2017-09-10  1:32 ` Duncan
2017-09-10  6:41 ` Qu Wenruo
2017-09-10  6:45   ` Qu Wenruo
2017-09-10 14:32     ` Rohan Kadekodi
2017-09-11  1:48       ` Qu Wenruo
2017-09-10 14:34     ` Martin Raiber
2017-09-11  5:22       ` Qu Wenruo
2017-09-16 12:27 ` Hans van Kranenburg
2017-09-16 12:40   ` Martin Raiber
2017-09-16 12:45     ` Hans van Kranenburg [this message]

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=649a8567-20dc-de23-9920-95abc1513b31@mendix.com \
    --to=hans.van.kranenburg@mendix.com \
    --cc=jayashree2912@gmail.com \
    --cc=kadekodirohan@gmail.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=martin@urbackup.org \
    --cc=vijay@cs.utexas.edu \
    /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).