All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Matias Bjørling" <mb@lightnvm.io>
To: Wenwei Tao <ww.tao0320@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org
Subject: Re: [PATCH] lightnvm: place unlock sentence in the common path
Date: Fri, 4 Dec 2015 13:50:31 +0100	[thread overview]
Message-ID: <56618C17.7030705@lightnvm.io> (raw)
In-Reply-To: <1449232672-3464-1-git-send-email-ww.tao0320@gmail.com>

On 12/04/2015 01:37 PM, Wenwei Tao wrote:
> move spin_unlock(&vlun->lock) to common path to make
> the code more clean.
>
> Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
> ---
>   drivers/lightnvm/gennvm.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/lightnvm/gennvm.c b/drivers/lightnvm/gennvm.c
> index 35dde84..ce60254 100644
> --- a/drivers/lightnvm/gennvm.c
> +++ b/drivers/lightnvm/gennvm.c
> @@ -262,14 +262,11 @@ static struct nvm_block *gennvm_get_blk(struct nvm_dev *dev,
>   	if (list_empty(&lun->free_list)) {
>   		pr_err_ratelimited("gennvm: lun %u have no free pages available",
>   								lun->vlun.id);
> -		spin_unlock(&vlun->lock);
>   		goto out;
>   	}
>
> -	while (!is_gc && lun->vlun.nr_free_blocks < lun->reserved_blocks) {
> -		spin_unlock(&vlun->lock);
> +	if (!is_gc && lun->vlun.nr_free_blocks < lun->reserved_blocks)
>   		goto out;
> -	}
>
>   	blk = list_first_entry(&lun->free_list, struct nvm_block, list);
>   	list_move_tail(&blk->list, &lun->used_list);
> @@ -278,8 +275,8 @@ static struct nvm_block *gennvm_get_blk(struct nvm_dev *dev,
>   	lun->vlun.nr_free_blocks--;
>   	lun->vlun.nr_inuse_blocks++;
>
> -	spin_unlock(&vlun->lock);
>   out:
> +	spin_unlock(&vlun->lock);
>   	return blk;
>   }
>
>

Thanks Tao, applied.

      reply	other threads:[~2015-12-04 12:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-04 12:37 [PATCH] lightnvm: place unlock sentence in the common path Wenwei Tao
2015-12-04 12:50 ` Matias Bjørling [this message]

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=56618C17.7030705@lightnvm.io \
    --to=mb@lightnvm.io \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ww.tao0320@gmail.com \
    /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.