All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Josef Bacik <josef@toxicpanda.com>,
	kernel-team@fb.com, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 5/8] btrfs: refactor the ticket wakeup code
Date: Mon, 19 Aug 2019 16:58:14 +0300	[thread overview]
Message-ID: <846e2e03-abef-301a-f69d-800265e3d9d6@suse.com> (raw)
In-Reply-To: <20190816141952.19369-6-josef@toxicpanda.com>



On 16.08.19 г. 17:19 ч., Josef Bacik wrote:
> Now that btrfs_space_info_add_old_bytes simply checks if we can make the
> reservation and updates bytes_may_use, there's no reason to have both
> helpers in place.  Factor out the ticket wakeup logic into it's own
> helper, make btrfs_space_info_add_old_bytes() update bytes_may_use and
> then call the wakeup helper, and replace all calls to
> btrfs_space_info_add_new_bytes() with the wakeup helper.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Generally looks good and much nicer than before, one small nit below,
when fixed you can add:

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

> ---
>  fs/btrfs/extent-tree.c |  4 ++--
>  fs/btrfs/space-info.c  | 53 +++---------------------------------------
>  fs/btrfs/space-info.h  | 19 ++++++++++-----
>  3 files changed, 18 insertions(+), 58 deletions(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 32f9473c8426..08c6fcfc418d 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -2863,8 +2863,8 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info,
>  			spin_unlock(&global_rsv->lock);
>  			/* Add to any tickets we may have */
>  			if (len)
> -				btrfs_space_info_add_new_bytes(fs_info,
> -						space_info, len);
> +				btrfs_try_to_wakeup_tickets(fs_info,
> +							    space_info);
>  		}
>  		spin_unlock(&space_info->lock);
>  	}
> diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
> index 5f123b36fdcd..8a1c7ada67cb 100644
> --- a/fs/btrfs/space-info.c
> +++ b/fs/btrfs/space-info.c
> @@ -131,9 +131,7 @@ void btrfs_update_space_info(struct btrfs_fs_info *info, u64 flags,
>  	found->bytes_readonly += bytes_readonly;
>  	if (total_bytes > 0)
>  		found->full = 0;
> -	btrfs_space_info_add_new_bytes(info, found,
> -				       total_bytes - bytes_used -
> -				       bytes_readonly);
> +	btrfs_try_to_wakeup_tickets(info, found);
>  	spin_unlock(&found->lock);
>  	*space_info = found;
>  }
> @@ -229,17 +227,13 @@ static int can_overcommit(struct btrfs_fs_info *fs_info,
>   * This is for space we already have accounted in space_info->bytes_may_use, so
>   * basically when we're returning space from block_rsv's.
>   */
> -void btrfs_space_info_add_old_bytes(struct btrfs_fs_info *fs_info,
> -				    struct btrfs_space_info *space_info,
> -				    u64 num_bytes)
> +void btrfs_try_to_wakeup_tickets(struct btrfs_fs_info *fs_info,
> +				 struct btrfs_space_info *space_info)
>  {
>  	struct list_head *head;
>  	enum btrfs_reserve_flush_enum flush = BTRFS_RESERVE_NO_FLUSH;
>  
> -	spin_lock(&space_info->lock);


Add an lockdep_assert_held(&space_info->lock);

<snip>

  reply	other threads:[~2019-08-19 13:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-16 14:19 [PATCH 0/8][v2] Rework reserve ticket handling Josef Bacik
2019-08-16 14:19 ` [PATCH 1/8] btrfs: do not allow reservations if we have pending tickets Josef Bacik
2019-08-19 12:54   ` Nikolay Borisov
2019-08-19 12:57     ` Josef Bacik
2019-08-16 14:19 ` [PATCH 2/8] btrfs: roll tracepoint into btrfs_space_info_update helper Josef Bacik
2019-08-16 14:19 ` [PATCH 3/8] btrfs: add space reservation tracepoint for reserved bytes Josef Bacik
2019-08-16 14:19 ` [PATCH 4/8] btrfs: rework btrfs_space_info_add_old_bytes Josef Bacik
2019-08-16 14:19 ` [PATCH 5/8] btrfs: refactor the ticket wakeup code Josef Bacik
2019-08-19 13:58   ` Nikolay Borisov [this message]
2019-08-16 14:19 ` [PATCH 6/8] btrfs: rework wake_all_tickets Josef Bacik
2019-08-19 14:49   ` Nikolay Borisov
2019-08-19 15:06     ` Josef Bacik
2019-08-20  7:51       ` Nikolay Borisov
2019-08-16 14:19 ` [PATCH 7/8] btrfs: fix may_commit_transaction to deal with no partial filling Josef Bacik
2019-08-20  8:20   ` Nikolay Borisov
2019-08-16 14:19 ` [PATCH 8/8] btrfs: remove orig_bytes from reserve_ticket Josef Bacik
2019-08-20  8:28   ` Nikolay Borisov
2019-08-21 14:07     ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=846e2e03-abef-301a-f69d-800265e3d9d6@suse.com \
    --to=nborisov@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.