Re: [PATCH] btrfs: Turn fs_roots_radix in btrfs_fs_info into an XArray

David Sterba
2022-04-27T19:27:12Z

On Wed, Apr 27, 2022 at 04:51:07PM +0200, Gabriel Niebler wrote:
> > while (!list_empty(&fs_info->dead_roots)) {
> > [...]
> > - if (test_bit(BTRFS_ROOT_IN_RADIX, &gang[0]->state))
> > - btrfs_drop_and_free_fs_root(fs_info, gang[0]);
> > - btrfs_put_root(gang[0]);
> > + if (test_bit(BTRFS_ROOT_IN_RADIX, &root->state))
> > + btrfs_drop_and_free_fs_root(fs_info, root);
> > + btrfs_put_root(root);
>
> It occurs to me that BTRFS_ROOT_IN_RADIX should probably be renamed to
> something else within or following this patch...
>
> ... but what to rename it /to/?

Good point about the naming but I don't have a concrete idea. The naming
could reflect the status of the entry rather than where is it tracked.

> Naming things is hard. Here are some ideas I've had:
>
> BTRFS_ROOT_IN_XARRAY is obvious, but it also includes kind of a needless
> implementation detail.

This could be a fallback that at least follows the same pattern but yeah
it's not the best one.