lightnvm: don't check for failure from mempool_alloc()
PATCH 1/1 lightnvm: don't check for failure from mempool_alloc()
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 <[email protected]>
--- drivers/lightnvm/rrpc.c | 9 --------- 1 file changed, 9 deletions(-)
drivers/lightnvm/rrpc.c +0 -9
@@ -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 );
Signature · 1 line
2.12.2
Quoted 30 lines · NeilBrown
mempool_alloc()cannot fail if the gfp flags allow it to sleep, and bothGFP_KERNELandGFP_NOIOallows for sleeping.So
rrpc_move_valid_pages()andrrpc_make_rq()don't need to test the return value.Signed-off-by NeilBrown <[email protected]>--- drivers/lightnvm/rrpc.c | 9 --------- 1 file changed, 9 deletions(-)drivers/lightnvm/rrpc.c +0
-4@@ -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) }
drivers/lightnvm/rrpc.c static blk_qc_t rrpc_make_rq(struct request_queue *q, struct bio *bio) · line 1008
Quoted 10 lines
drivers/lightnvm/rrpc.c +0
-5rqd =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.