* [PATCH] block: remove the boring judgment in blk_rq_map_bio_alloc()
@ 2026-01-15 11:43 Chaohai Chen
2026-01-15 17:18 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Chaohai Chen @ 2026-01-15 11:43 UTC (permalink / raw)
To: axboe; +Cc: linux-kernel, Chaohai Chen
There is no need to check the return value of bio_alloc_bioset().
Signed-off-by: Chaohai Chen <wdhh6@aliyun.com>
---
block/blk-map.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/block/blk-map.c b/block/blk-map.c
index 4533094d9458..f95b07ec3b88 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -46,14 +46,8 @@ static struct bio *blk_rq_map_bio_alloc(struct request *rq,
unsigned int nr_vecs, gfp_t gfp_mask)
{
struct block_device *bdev = rq->q->disk ? rq->q->disk->part0 : NULL;
- struct bio *bio;
- bio = bio_alloc_bioset(bdev, nr_vecs, rq->cmd_flags, gfp_mask,
- &fs_bio_set);
- if (!bio)
- return NULL;
-
- return bio;
+ return bio_alloc_bioset(bdev, nr_vecs, rq->cmd_flags, gfp_mask, &fs_bio_set);
}
/**
--
2.43.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] block: remove the boring judgment in blk_rq_map_bio_alloc()
2026-01-15 11:43 Chaohai Chen
@ 2026-01-15 17:18 ` Jens Axboe
0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2026-01-15 17:18 UTC (permalink / raw)
To: Chaohai Chen; +Cc: linux-kernel
On 1/15/26 4:43 AM, Chaohai Chen wrote:
> There is no need to check the return value of bio_alloc_bioset().
Boring judgement? I'm very confused, what on earth does that mean.
> diff --git a/block/blk-map.c b/block/blk-map.c
> index 4533094d9458..f95b07ec3b88 100644
> --- a/block/blk-map.c
> +++ b/block/blk-map.c
> @@ -46,14 +46,8 @@ static struct bio *blk_rq_map_bio_alloc(struct request *rq,
> unsigned int nr_vecs, gfp_t gfp_mask)
> {
> struct block_device *bdev = rq->q->disk ? rq->q->disk->part0 : NULL;
> - struct bio *bio;
>
> - bio = bio_alloc_bioset(bdev, nr_vecs, rq->cmd_flags, gfp_mask,
> - &fs_bio_set);
> - if (!bio)
> - return NULL;
> -
> - return bio;
> + return bio_alloc_bioset(bdev, nr_vecs, rq->cmd_flags, gfp_mask, &fs_bio_set);
> }
Presumably this means that nobody ever calls blk_rq_map_bio_alloc()
without __GFP_WAIT set in gfp_mask? Because otherwise this would be
broken. And this then further means that this should most likely be
checked.
All of this is absent from the commit message, which has zero details.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] block: remove the boring judgment in blk_rq_map_bio_alloc()
@ 2026-01-16 2:15 Chaohai Chen
2026-01-16 3:40 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Chaohai Chen @ 2026-01-16 2:15 UTC (permalink / raw)
To: axboe; +Cc: linux-kernel, linux-block, Chaohai Chen
There is no need to check the return value of bio_alloc_bioset().
Signed-off-by: Chaohai Chen <wdhh6@aliyun.com>
---
block/blk-map.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/block/blk-map.c b/block/blk-map.c
index 4533094d9458..f95b07ec3b88 100644
--- a/block/blk-map.c
+++ b/block/blk-map.c
@@ -46,14 +46,8 @@ static struct bio *blk_rq_map_bio_alloc(struct request *rq,
unsigned int nr_vecs, gfp_t gfp_mask)
{
struct block_device *bdev = rq->q->disk ? rq->q->disk->part0 : NULL;
- struct bio *bio;
- bio = bio_alloc_bioset(bdev, nr_vecs, rq->cmd_flags, gfp_mask,
- &fs_bio_set);
- if (!bio)
- return NULL;
-
- return bio;
+ return bio_alloc_bioset(bdev, nr_vecs, rq->cmd_flags, gfp_mask, &fs_bio_set);
}
/**
--
2.43.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] block: remove the boring judgment in blk_rq_map_bio_alloc()
2026-01-16 2:15 [PATCH] block: remove the boring judgment in blk_rq_map_bio_alloc() Chaohai Chen
@ 2026-01-16 3:40 ` Jens Axboe
0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2026-01-16 3:40 UTC (permalink / raw)
To: Chaohai Chen; +Cc: linux-kernel, linux-block
https://lore.kernel.org/all/2d73aaa4-9718-4285-ab3f-85e1fa3b40fa@kernel.dk/
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-01-16 3:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-16 2:15 [PATCH] block: remove the boring judgment in blk_rq_map_bio_alloc() Chaohai Chen
2026-01-16 3:40 ` Jens Axboe
-- strict thread matches above, loose matches on Subject: below --
2026-01-15 11:43 Chaohai Chen
2026-01-15 17:18 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox