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 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html