All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Matias Bjørling" <mb@lightnvm.io>
To: NeilBrown <neilb@suse.com>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lightnvm: don't check for failure from mempool_alloc()
Date: Mon, 10 Apr 2017 10:02:25 +0200	[thread overview]
Message-ID: <a6f33ff5-28c7-3c85-f146-c1aeda2540bf@lightnvm.io> (raw)
In-Reply-To: <87k26txbfa.fsf@notabene.neil.brown.name>

On 04/10/2017 04:07 AM, NeilBrown wrote:
>
> mempool_alloc() cannot fail if the gfp flags allow it to
> sleep, and both GFP_KERNEL and GFP_NOIO allows for sleeping.
>
> So rrpc_move_valid_pages() and rrpc_make_rq() don't need to
> test the return value.
>
> Signed-off-by: NeilBrown <neilb@suse.com>
> ---
>  drivers/lightnvm/rrpc.c | 9 ---------
>  1 file changed, 9 deletions(-)
>
> diff --git a/drivers/lightnvm/rrpc.c b/drivers/lightnvm/rrpc.c
> index e00b1d7b976f..34f5f1cc9452 100644
> --- a/drivers/lightnvm/rrpc.c
> +++ b/drivers/lightnvm/rrpc.c
> @@ -318,10 +318,6 @@ static int rrpc_move_valid_pages(struct rrpc *rrpc, struct rrpc_block *rblk)
>  	}
>
>  	page = mempool_alloc(rrpc->page_pool, GFP_NOIO);
> -	if (!page) {
> -		bio_put(bio);
> -		return -ENOMEM;
> -	}
>
>  	while ((slot = find_first_zero_bit(rblk->invalid_pages,
>  					    nr_sec_per_blk)) < nr_sec_per_blk) {
> @@ -1007,11 +1003,6 @@ static blk_qc_t rrpc_make_rq(struct request_queue *q, struct bio *bio)
>  	}
>
>  	rqd = mempool_alloc(rrpc->rq_pool, GFP_KERNEL);
> -	if (!rqd) {
> -		pr_err_ratelimited("rrpc: not able to queue bio.");
> -		bio_io_error(bio);
> -		return BLK_QC_T_NONE;
> -	}
>  	memset(rqd, 0, sizeof(struct nvm_rq));
>
>  	err = rrpc_submit_io(rrpc, bio, rqd, NVM_IOTYPE_NONE);
>

This is great!, Thanks Neil.  Applied for 4.12.

      reply	other threads:[~2017-04-10  8:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-10  2:07 [PATCH] lightnvm: don't check for failure from mempool_alloc() NeilBrown
2017-04-10  8:02 ` 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=a6f33ff5-28c7-3c85-f146-c1aeda2540bf@lightnvm.io \
    --to=mb@lightnvm.io \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.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.