@@ -1183,6 +1183,14 @@ static void bio_get_trace_info(struct btrfs_raid_bio *rbio, struct bio *bio,
1183
1183
trace_info -> stripe_nr = -1 ;
1184
1184
}
1185
1185
1186
+ static inline void bio_list_put (struct bio_list * bio_list )
1187
+ {
1188
+ struct bio * bio ;
1189
+
1190
+ while ((bio = bio_list_pop (bio_list )))
1191
+ bio_put (bio );
1192
+ }
1193
+
1186
1194
/* Generate PQ for one vertical stripe. */
1187
1195
static void generate_pq_vertical (struct btrfs_raid_bio * rbio , int sectornr )
1188
1196
{
@@ -1228,7 +1236,6 @@ static void generate_pq_vertical(struct btrfs_raid_bio *rbio, int sectornr)
1228
1236
static int rmw_assemble_write_bios (struct btrfs_raid_bio * rbio ,
1229
1237
struct bio_list * bio_list )
1230
1238
{
1231
- struct bio * bio ;
1232
1239
/* The total sector number inside the full stripe. */
1233
1240
int total_sector_nr ;
1234
1241
int sectornr ;
@@ -1317,8 +1324,7 @@ static int rmw_assemble_write_bios(struct btrfs_raid_bio *rbio,
1317
1324
1318
1325
return 0 ;
1319
1326
error :
1320
- while ((bio = bio_list_pop (bio_list )))
1321
- bio_put (bio );
1327
+ bio_list_put (bio_list );
1322
1328
return - EIO ;
1323
1329
}
1324
1330
@@ -1521,7 +1527,6 @@ static void submit_read_wait_bio_list(struct btrfs_raid_bio *rbio,
1521
1527
static int rmw_assemble_read_bios (struct btrfs_raid_bio * rbio ,
1522
1528
struct bio_list * bio_list )
1523
1529
{
1524
- struct bio * bio ;
1525
1530
int total_sector_nr ;
1526
1531
int ret = 0 ;
1527
1532
@@ -1548,8 +1553,7 @@ static int rmw_assemble_read_bios(struct btrfs_raid_bio *rbio,
1548
1553
return 0 ;
1549
1554
1550
1555
cleanup :
1551
- while ((bio = bio_list_pop (bio_list )))
1552
- bio_put (bio );
1556
+ bio_list_put (bio_list );
1553
1557
return ret ;
1554
1558
}
1555
1559
@@ -1946,7 +1950,6 @@ static int recover_sectors(struct btrfs_raid_bio *rbio)
1946
1950
static int recover_assemble_read_bios (struct btrfs_raid_bio * rbio ,
1947
1951
struct bio_list * bio_list )
1948
1952
{
1949
- struct bio * bio ;
1950
1953
int total_sector_nr ;
1951
1954
int ret = 0 ;
1952
1955
@@ -1988,16 +1991,13 @@ static int recover_assemble_read_bios(struct btrfs_raid_bio *rbio,
1988
1991
}
1989
1992
return 0 ;
1990
1993
error :
1991
- while ((bio = bio_list_pop (bio_list )))
1992
- bio_put (bio );
1993
-
1994
+ bio_list_put (bio_list );
1994
1995
return - EIO ;
1995
1996
}
1996
1997
1997
1998
static int recover_rbio (struct btrfs_raid_bio * rbio )
1998
1999
{
1999
2000
struct bio_list bio_list ;
2000
- struct bio * bio ;
2001
2001
int ret ;
2002
2002
2003
2003
/*
@@ -2023,9 +2023,7 @@ static int recover_rbio(struct btrfs_raid_bio *rbio)
2023
2023
ret = recover_sectors (rbio );
2024
2024
2025
2025
out :
2026
- while ((bio = bio_list_pop (& bio_list )))
2027
- bio_put (bio );
2028
-
2026
+ bio_list_put (& bio_list );
2029
2027
return ret ;
2030
2028
}
2031
2029
@@ -2198,7 +2196,6 @@ static void fill_data_csums(struct btrfs_raid_bio *rbio)
2198
2196
static int rmw_read_wait_recover (struct btrfs_raid_bio * rbio )
2199
2197
{
2200
2198
struct bio_list bio_list ;
2201
- struct bio * bio ;
2202
2199
int ret ;
2203
2200
2204
2201
bio_list_init (& bio_list );
@@ -2223,9 +2220,7 @@ static int rmw_read_wait_recover(struct btrfs_raid_bio *rbio)
2223
2220
ret = recover_sectors (rbio );
2224
2221
return ret ;
2225
2222
out :
2226
- while ((bio = bio_list_pop (& bio_list )))
2227
- bio_put (bio );
2228
-
2223
+ bio_list_put (& bio_list );
2229
2224
return ret ;
2230
2225
}
2231
2226
@@ -2496,7 +2491,6 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio, int need_check)
2496
2491
struct sector_ptr p_sector = { 0 };
2497
2492
struct sector_ptr q_sector = { 0 };
2498
2493
struct bio_list bio_list ;
2499
- struct bio * bio ;
2500
2494
int is_replace = 0 ;
2501
2495
int ret ;
2502
2496
@@ -2627,8 +2621,7 @@ static int finish_parity_scrub(struct btrfs_raid_bio *rbio, int need_check)
2627
2621
return 0 ;
2628
2622
2629
2623
cleanup :
2630
- while ((bio = bio_list_pop (& bio_list )))
2631
- bio_put (bio );
2624
+ bio_list_put (& bio_list );
2632
2625
return ret ;
2633
2626
}
2634
2627
@@ -2726,7 +2719,6 @@ static int recover_scrub_rbio(struct btrfs_raid_bio *rbio)
2726
2719
static int scrub_assemble_read_bios (struct btrfs_raid_bio * rbio ,
2727
2720
struct bio_list * bio_list )
2728
2721
{
2729
- struct bio * bio ;
2730
2722
int total_sector_nr ;
2731
2723
int ret = 0 ;
2732
2724
@@ -2767,8 +2759,7 @@ static int scrub_assemble_read_bios(struct btrfs_raid_bio *rbio,
2767
2759
}
2768
2760
return 0 ;
2769
2761
error :
2770
- while ((bio = bio_list_pop (bio_list )))
2771
- bio_put (bio );
2762
+ bio_list_put (bio_list );
2772
2763
return ret ;
2773
2764
}
2774
2765
@@ -2778,7 +2769,6 @@ static int scrub_rbio(struct btrfs_raid_bio *rbio)
2778
2769
struct bio_list bio_list ;
2779
2770
int sector_nr ;
2780
2771
int ret ;
2781
- struct bio * bio ;
2782
2772
2783
2773
bio_list_init (& bio_list );
2784
2774
@@ -2817,9 +2807,7 @@ static int scrub_rbio(struct btrfs_raid_bio *rbio)
2817
2807
return ret ;
2818
2808
2819
2809
cleanup :
2820
- while ((bio = bio_list_pop (& bio_list )))
2821
- bio_put (bio );
2822
-
2810
+ bio_list_put (& bio_list );
2823
2811
return ret ;
2824
2812
}
2825
2813
0 commit comments