Skip to contentSkip to conversation

md/raid1: remove unnecessary null checking

PATCH Applied Gou Hao 2 participants 2 messages Dec 14, 2023 – Dec 15, 2023 MD RAID

lore
Share & tools
lore

Gou Hao

author
#0 lore raw

PATCH 1/1 md/raid1: remove unnecessary null checking

If %__GFP_DIRECT_RECLAIM is set then bio_alloc_bioset will always be able to allocate a bio. See comment of bio_alloc_bioset.

---
 drivers/md/raid1.c | 2 --
 1 file changed, 2 deletions(-)
drivers/md/raid1.c +0 -2
index 35d12948e0a9..e77dc95d4a75 100644
@@ -1126,8 +1126,6 @@ static void alloc_behind_master_bio(struct r1bio *r1_bio,
 
 	behind_bio = bio_alloc_bioset(NULL, vcnt, 0, GFP_NOIO,
 				      &r1_bio->mddev->bio_set);
-	if (!behind_bio)
-		return;
 
 	/* discard op, we don't support writezero/writesame yet */
 	if (!bio_has_data(bio)) {
Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw
Quoted 5 lines · Gou Hao

If %__GFP_DIRECT_RECLAIM is set then bio_alloc_bioset will always be able to allocate a bio. See comment of bio_alloc_bioset.

Applied to md-next. Thanks!

Song

Quoted 21 lines
---
 drivers/md/raid1.c | 2 --
 1 file changed, 2 deletions(-)
drivers/md/raid1.c +0 -3
index 35d12948e0a9..e77dc95d4a75 100644
@@ -1126,8 +1126,6 @@ static void alloc_behind_master_bio(struct r1bio *r1_bio,
 
        behind_bio = bio_alloc_bioset(NULL, vcnt, 0, GFP_NOIO,
                                      &r1_bio->mddev->bio_set);
-       if (!behind_bio)
-               return;
 
        /* discard op, we don't support writezero/writesame yet */
        if (!bio_has_data(bio)) {
--

2.34.1