Skip to contentSkip to conversation

f2fs: remove unneeded check for error allocating bio_post_read_ctx

PATCH In review Eric Biggers 2 participants 2 messages Dec 31, 2019 – Jan 2, 2020

Subsystems (2)
lore
Share & tools
lore

Eric Biggers

author maintainer
#0 lore raw

PATCH 1/1 f2fs: remove unneeded check for error allocating bio_post_read_ctx

From: Eric Biggers <[email protected]>

Since allocating an object from a mempool never fails when __GFP_DIRECT_RECLAIM (which is included in GFP_NOFS) is set, the check for failure to allocate a bio_post_read_ctx is unnecessary. Remove it.

---
 fs/f2fs/data.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
fs/f2fs/data.c +1 -4
index 618a05bf356e..b52e1512f82e 100644
@@ -939,11 +939,8 @@ static struct bio *f2fs_grab_read_bio(struct inode *inode, block_t blkaddr,
 		post_read_steps |= 1 << STEP_VERITY;
 
 	if (post_read_steps) {
+		/* Due to the mempool, this never fails. */
 		ctx = mempool_alloc(bio_post_read_ctx_pool, GFP_NOFS);
-		if (!ctx) {
-			bio_put(bio);
-			return ERR_PTR(-ENOMEM);
-		}
 		ctx->bio = bio;
 		ctx->sbi = sbi;
 		ctx->enabled_steps = post_read_steps;
Signature · 1 line
2.24.1