* [PATCH] btrfs: update outdated comment at btrfs_orphan_cleanup()
@ 2021-03-16 16:54 fdmanana
2021-03-16 19:41 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: fdmanana @ 2021-03-16 16:54 UTC (permalink / raw)
To: linux-btrfs
From: Filipe Manana <fdmanana@suse.com>
btrfs_orphan_cleanup() has a comment referring to find_dead_roots, but
function does not exists since commit cb517eabba4f10 ("Btrfs: cleanup the
similar code of the fs root read"). What we use now to find and load dead
roots is btrfs_find_orphan_roots(). So update the comment and make it a
bit more detailed about why we can not delete an orphan item for a root.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
fs/btrfs/inode.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index ddbac78c4abe..31717ef76a90 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3383,15 +3383,19 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
int is_dead_root = 0;
/*
- * this is an orphan in the tree root. Currently these
+ * This is an orphan in the tree root. Currently these
* could come from 2 sources:
- * a) a snapshot deletion in progress
+ * a) a root (snapshot/subvolume) deletion in progress
* b) a free space cache inode
- * We need to distinguish those two, as the snapshot
- * orphan must not get deleted.
- * find_dead_roots already ran before us, so if this
- * is a snapshot deletion, we should find the root
- * in the fs_roots radix tree.
+ * We need to distinguish those two, as the orphan item
+ * for a root must not get deleted before the deletion
+ * of the snapshot/subvolume's tree completes.
+ *
+ * btrfs_find_orphan_roots() ran before us, which has
+ * found all deleted roots and loaded them into
+ * fs_info->fs_roots_radix. So here we can find if an
+ * orphan item corresponds to a deleted root by looking
+ * up the root from that radix tree.
*/
spin_lock(&fs_info->fs_roots_radix_lock);
--
2.28.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] btrfs: update outdated comment at btrfs_orphan_cleanup()
2021-03-16 16:54 [PATCH] btrfs: update outdated comment at btrfs_orphan_cleanup() fdmanana
@ 2021-03-16 19:41 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2021-03-16 19:41 UTC (permalink / raw)
To: fdmanana; +Cc: linux-btrfs
On Tue, Mar 16, 2021 at 04:54:13PM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> btrfs_orphan_cleanup() has a comment referring to find_dead_roots, but
> function does not exists since commit cb517eabba4f10 ("Btrfs: cleanup the
> similar code of the fs root read"). What we use now to find and load dead
> roots is btrfs_find_orphan_roots(). So update the comment and make it a
> bit more detailed about why we can not delete an orphan item for a root.
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Added to misc-next, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-16 19:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-16 16:54 [PATCH] btrfs: update outdated comment at btrfs_orphan_cleanup() fdmanana
2021-03-16 19:41 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox