linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Regarding handling of file renames in Btrfs
@ 2017-09-09 23:50 Rohan Kadekodi
  2017-09-10  1:32 ` Duncan
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Rohan Kadekodi @ 2017-09-09 23:50 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Vijaychidambaram Velayudhan Pillai, Jayashree Mohan

Hello,

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. 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? If yes, my questions are as follows:

1. What does committing the whole FS mean? Blktrace shows that there
are 2       256KB writes, which are essentially writes to the data of
the root directory of the file system (which I found out through
btrfs-debug-tree). Is this equivalent to doing a shell sync, as the
same block groups are written during a shell sync too? Also, does it
imply that all the metadata held by the log tree is now checkpointed
to the respective trees?

2. Why are there 2 complete writes to the data held by the root
directory and not just 1? These writes are 256KB each, which is the
size of the extent allocated to the root directory

3. Why are the writes being done to the root directory of the file
system / subvolume and not just the parent directory where the unlink
happened?

It would be great if I could get the answers to these questions.

Thanks,
Rohan

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-09-16 12:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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).