[PATCH v3 1/2] bcache: remove dead code in detached_dev_do_request

zhangshida2026@163.com posted 2 patches 2 weeks ago
[PATCH v3 1/2] bcache: remove dead code in detached_dev_do_request
Posted by zhangshida2026@163.com 2 weeks ago
From: Shida Zhang <zhangshida@kylinos.cn>

bio_alloc_clone() with GFP_NOIO and a mempool will not return NULL.
Remove the unnecessary NULL check.

Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Shida Zhang <zhangshida@kylinos.cn>
---
 drivers/md/bcache/request.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index a02aecac05c..c2f38907a2a 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -1113,11 +1113,6 @@ static void detached_dev_do_request(struct bcache_device *d,
 
 	clone_bio = bio_alloc_clone(dc->bdev, orig_bio, GFP_NOIO,
 				    &d->bio_detached);
-	if (!clone_bio) {
-		orig_bio->bi_status = BLK_STS_RESOURCE;
-		bio_endio(orig_bio);
-		return;
-	}
 
 	ddip = container_of(clone_bio, struct detached_dev_io_private, bio);
 	/* Count on the bcache device */
-- 
2.34.1
Re: [PATCH v3 1/2] bcache: remove dead code in detached_dev_do_request
Posted by Christoph Hellwig 2 weeks ago
On Tue, Jan 27, 2026 at 04:21:11PM +0800, zhangshida2026@163.com wrote:
> From: Shida Zhang <zhangshida@kylinos.cn>
> 
> bio_alloc_clone() with GFP_NOIO and a mempool will not return NULL.
> Remove the unnecessary NULL check.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>