Re: [PATCH 23/23] btrfs: do async reclaim for data reservations

Josef Bacik
2020-02-03T18:51:13Z

On 2/3/20 12:19 PM, Nikolay Borisov wrote:
>
>
> On 1.02.20 г. 0:36 ч., Josef Bacik wrote:
>> Now that we have the data ticketing stuff in place, move normal data
>> reservations to use an async reclaim helper to satisfy tickets. Before
>> we could have multiple tasks race in and both allocate chunks, resulting
>> in more data chunks than we would necessarily need. Serializing these
>> allocations and making a single thread responsible for flushing will
>> only allocate chunks as needed, as well as cut down on transaction
>> commits and other flush related activities.
>>
>> Priority reservations will still work as they have before, simply
>> trying to allocate a chunk until they can make their reservation.
>>
>> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
>
> Reviewed-by: Nikolay Borisov <nborisov@suse.com> but look below for one
> minor nit.
>
>> ---
>> fs/btrfs/ctree.h | 3 +-
>> fs/btrfs/disk-io.c | 2 +-
>> fs/btrfs/space-info.c | 123 ++++++++++++++++++++++++++++++------------
>> 3 files changed, 91 insertions(+), 37 deletions(-)
>>
>> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
>> index 865b24a1759e..709823a23c62 100644
>> --- a/fs/btrfs/ctree.h
>> +++ b/fs/btrfs/ctree.h
>> @@ -493,7 +493,7 @@ enum btrfs_orphan_cleanup_state {
>> ORPHAN_CLEANUP_DONE = 2,
>> };
>>
>> -void btrfs_init_async_reclaim_work(struct work_struct *work);
>> +void btrfs_init_async_reclaim_work(struct btrfs_fs_info *fs_info);
>
> nit: This doesn't bring much value apart from introducing yet another
> function, I'd rather have the 2 INIT_WORK calls open coded in init_fs_info.

Then I'd have to export the two reclaim functions, thats why this exists. Thanks,

Josef