Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1619704

Re: [PATCH] lightnvm: don't check for failure from mempool_alloc()

From Matias Bjørling <mb@lightnvm.io>
Newsgroups linux.kernel
Subject Re: [PATCH] lightnvm: don't check for failure from mempool_alloc()
Date 2017-04-10 10:10 +0200
Message-ID <tuCyB-6zF-11@gated-at.bofh.it> (permalink)
References <tuwWd-2Px-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] lightnvm: don't check for failure from mempool_alloc() NeilBrown <neilb@suse.com> - 2017-04-10 04:10 +0200
  Re: [PATCH] lightnvm: don't check for failure from mempool_alloc() Matias Bjørling <mb@lightnvm.io> - 2017-04-10 10:10 +0200

csiph-web