Skip to content

Commit 6942348

Browse files
author
Mikulas Patocka
committed
dm: remove useless test in alloc_multiple_bios
The test gfp_flag & GFP_NOWAIT was always true, because both GFP_NOIO and GFP_NOWAIT include the flag __GFP_KSWAPD_RECLAIM. Luckily, this oversight didn't result in any harm; the loop always started with "try = 0". This patch removes the faulty test and explicitly starts the loop with "try = 0" (so that we don't hold the mutex in the first iteration). Signed-off-by: Mikulas Patocka <[email protected]>
1 parent c3a1f2e commit 6942348

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

drivers/md/dm.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,12 +1479,12 @@ static void setup_split_accounting(struct clone_info *ci, unsigned int len)
14791479

14801480
static void alloc_multiple_bios(struct bio_list *blist, struct clone_info *ci,
14811481
struct dm_target *ti, unsigned int num_bios,
1482-
unsigned *len, gfp_t gfp_flag)
1482+
unsigned *len)
14831483
{
14841484
struct bio *bio;
1485-
int try = (gfp_flag & GFP_NOWAIT) ? 0 : 1;
1485+
int try;
14861486

1487-
for (; try < 2; try++) {
1487+
for (try = 0; try < 2; try++) {
14881488
int bio_nr;
14891489

14901490
if (try && num_bios > 1)
@@ -1508,8 +1508,7 @@ static void alloc_multiple_bios(struct bio_list *blist, struct clone_info *ci,
15081508
}
15091509

15101510
static unsigned int __send_duplicate_bios(struct clone_info *ci, struct dm_target *ti,
1511-
unsigned int num_bios, unsigned int *len,
1512-
gfp_t gfp_flag)
1511+
unsigned int num_bios, unsigned int *len)
15131512
{
15141513
struct bio_list blist = BIO_EMPTY_LIST;
15151514
struct bio *clone;
@@ -1526,7 +1525,7 @@ static unsigned int __send_duplicate_bios(struct clone_info *ci, struct dm_targe
15261525
* Using alloc_multiple_bios(), even if num_bios is 1, to consistently
15271526
* support allocating using GFP_NOWAIT with GFP_NOIO fallback.
15281527
*/
1529-
alloc_multiple_bios(&blist, ci, ti, num_bios, len, gfp_flag);
1528+
alloc_multiple_bios(&blist, ci, ti, num_bios, len);
15301529
while ((clone = bio_list_pop(&blist))) {
15311530
if (num_bios > 1)
15321531
dm_tio_set_flag(clone_to_tio(clone), DM_TIO_IS_DUPLICATE_BIO);
@@ -1564,7 +1563,7 @@ static void __send_empty_flush(struct clone_info *ci)
15641563

15651564
atomic_add(ti->num_flush_bios, &ci->io->io_count);
15661565
bios = __send_duplicate_bios(ci, ti, ti->num_flush_bios,
1567-
NULL, GFP_NOWAIT);
1566+
NULL);
15681567
atomic_sub(ti->num_flush_bios - bios, &ci->io->io_count);
15691568
}
15701569
} else {
@@ -1612,7 +1611,7 @@ static void __send_abnormal_io(struct clone_info *ci, struct dm_target *ti,
16121611
__max_io_len(ti, ci->sector, max_granularity, max_sectors));
16131612

16141613
atomic_add(num_bios, &ci->io->io_count);
1615-
bios = __send_duplicate_bios(ci, ti, num_bios, &len, GFP_NOIO);
1614+
bios = __send_duplicate_bios(ci, ti, num_bios, &len);
16161615
/*
16171616
* alloc_io() takes one extra reference for submission, so the
16181617
* reference won't reach 0 without the following (+1) subtraction
@@ -1849,7 +1848,7 @@ static blk_status_t __send_zone_reset_all_emulated(struct clone_info *ci,
18491848
* not go crazy with the clone allocation.
18501849
*/
18511850
alloc_multiple_bios(&blist, ci, ti, min(nr_reset, 32),
1852-
NULL, GFP_NOIO);
1851+
NULL);
18531852
}
18541853

18551854
/* Get a clone and change it to a regular reset operation. */
@@ -1881,7 +1880,7 @@ static void __send_zone_reset_all_native(struct clone_info *ci,
18811880
unsigned int bios;
18821881

18831882
atomic_add(1, &ci->io->io_count);
1884-
bios = __send_duplicate_bios(ci, ti, 1, NULL, GFP_NOIO);
1883+
bios = __send_duplicate_bios(ci, ti, 1, NULL);
18851884
atomic_sub(1 - bios, &ci->io->io_count);
18861885

18871886
ci->sector_count = 0;

0 commit comments

Comments
 (0)