Re: [PATCH 03/43] btrfs: make btrfs_find_orphan_roots use btrfs_get_fs_root

Nikolay Borisov
2020-01-20T17:36:57Z

On 17.01.20 г. 23:25 ч., Josef Bacik wrote:
> btrfs_find_orphan_roots has this weird thing where it looks up the root
> in cache to see if it is there before just reading the root. But the
> read it uses just reads the root, it doesn't do any of the init work, we

The first part of this sentence must be reworded since it's gibberish as
it is.

> do that by hand here. But this is unnecessary, all we really want is to
> see if the root still exists and add it to the dead roots list to be
> cleaned up, otherwise we delete the orphan item.
>
> Fix this by just using btrfs_get_fs_root directly with check_ref set to
> false so we get the orphan root items. Then we just handle in cache and
> out of cache roots the same, add them to the dead roots list and carry
> on.
>
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Other than that I agree that btrfs_get_fs_root already has the necessary
processing for orphan roots.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>