On 2020/5/13 下午9:51, David Sterba wrote:
> On Wed, May 13, 2020 at 02:49:11PM +0800, Qu Wenruo wrote:
>>>> {
>>>> struct inode *inode = NULL;
>>>> struct btrfs_trans_handle *trans;
>>>> - struct btrfs_root *root;
>>>> + struct btrfs_root *root = fs_info->dreloc_root;
>>>
>>> So why haven't you added code in btrfs_get_fs_root to quickly return a
>>> refcounted root and instead reference it without incrementing the refcount?
>>
>> This is exactly the same as how we handle fs_root.
>> And since the lifespan of data reloc root will be the same as the fs, I
>> don't think there is any need for it to be grabbed each time we need it.
>
> I'd vote for some consistency in the refcounting, ie. even if it's for
> the same life span as the filesystem, set the reference.
>
OK, I'll call grab and put in next version.
Thanks,
Qu