Re: [PATCH 15/23] btrfs: use ticketing for data space reservations

David Sterba
2020-08-13T16:51:23Z

On Tue, Jul 21, 2020 at 10:22:26AM -0400, Josef Bacik wrote:
> +static void priority_reclaim_data_space(struct btrfs_fs_info *fs_info,
> + struct btrfs_space_info *space_info,
> + struct reserve_ticket *ticket,
> + const enum btrfs_flush_state *states,
> + int states_nr)
> +{
> + int flush_state = 0;
> + int commit_cycles = 2;
> +
> + while (!space_info->full) {
> + flush_space(fs_info, space_info, U64_MAX, ALLOC_CHUNK_FORCE);
> + spin_lock(&space_info->lock);
> + if (ticket->bytes == 0) {
> + spin_unlock(&space_info->lock);
> + return;
> + }
> + spin_unlock(&space_info->lock);
> + }

->full is checked unlocked, IIRC this is not a problem as it's sticky
once it's 1 then it won't change until the flushing is done and
everything else locks the space infos. So a comment would be good here.