All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Josef Bacik <josef@toxicpanda.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 4/8] btrfs: cleanup the target logic in __btrfs_block_rsv_release
Date: Thu, 20 Jun 2019 11:23:36 +0300	[thread overview]
Message-ID: <3e9708a2-7316-08a4-6cb3-d81842e9b2ab@suse.com> (raw)
In-Reply-To: <20190619174724.1675-5-josef@toxicpanda.com>



On 19.06.19 г. 20:47 ч., Josef Bacik wrote:
> This works for all callers already, but if we wanted to use the helper
> for the global_block_rsv it would end up trying to refill itself.  Fix
> the logic to be able to be used no matter which block rsv is passed in
> to this helper.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
>  fs/btrfs/extent-tree.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index d6aff56337aa..6995edf887e1 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -4684,12 +4684,20 @@ u64 __btrfs_block_rsv_release(struct btrfs_fs_info *fs_info,
>  {
>  	struct btrfs_block_rsv *global_rsv = &fs_info->global_block_rsv;
>  	struct btrfs_block_rsv *delayed_rsv = &fs_info->delayed_refs_rsv;
> -	struct btrfs_block_rsv *target = delayed_rsv;
> +	struct btrfs_block_rsv *target = NULL;
>  
> -	if (target->full || target == block_rsv)
> +	/*
> +	 * If we are the delayed_rsv then push to the global rsv, otherwise dump
> +	 * into the delayed rsv if it is not full.
> +	 */
> +	if (block_rsv == delayed_rsv) {
>  		target = global_rsv;
> +	} else if (block_rsv != global_rsv) {
> +		if (!delayed_rsv->full)
> +			target = delayed_rsv;
> +	}

nit:

} else if (block_rsv != global_rsv && !delayed_rs->full) {

doesn't surpass the 80 character limit and IMO makes it a bit more
readable but it's minor.

Otherwise looks good.


>  
> -	if (block_rsv->space_info != target->space_info)
> +	if (target && block_rsv->space_info != target->space_info)
>  		target = NULL;
>  
>  	return block_rsv_release_bytes(fs_info, block_rsv, target, num_bytes,
> 

  reply	other threads:[~2019-06-20  8:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19 17:47 [PATCH 0/8] btrfs: move the block_rsv code out of extent-tree.c Josef Bacik
2019-06-19 17:47 ` [PATCH 1/8] btrfs: move btrfs_block_rsv definitions into it's own header Josef Bacik
2019-06-19 17:47 ` [PATCH 2/8] btrfs: export btrfs_block_rsv_add_bytes Josef Bacik
2019-06-19 17:47 ` [PATCH 3/8] btrfs: export __btrfs_block_rsv_release Josef Bacik
2019-06-19 17:47 ` [PATCH 4/8] btrfs: cleanup the target logic in __btrfs_block_rsv_release Josef Bacik
2019-06-20  8:23   ` Nikolay Borisov [this message]
2019-06-25 18:25     ` David Sterba
2019-06-19 17:47 ` [PATCH 5/8] btrfs: stop using block_rsv_release_bytes everywhere Josef Bacik
2019-06-20  8:32   ` Nikolay Borisov
2019-06-20 12:39     ` Josef Bacik
2019-06-19 17:47 ` [PATCH 6/8] btrfs: migrate the block-rsv code to block-rsv.c Josef Bacik
2019-06-19 17:47 ` [PATCH 7/8] btrfs: migrate the global_block_rsv helpers " Josef Bacik
2019-06-19 17:47 ` [PATCH 8/8] btrfs: export and migrate use_block_rsv/unuse_block_rsv Josef Bacik
2019-07-01 15:19 ` [PATCH 0/8] btrfs: move the block_rsv code out of extent-tree.c 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=3e9708a2-7316-08a4-6cb3-d81842e9b2ab@suse.com \
    --to=nborisov@suse.com \
    --cc=josef@toxicpanda.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.