@@ -759,7 +759,7 @@ static void flush_pending_writes(struct r1conf *conf)
759
759
while (bio ) { /* submit pending writes */
760
760
struct bio * next = bio -> bi_next ;
761
761
bio -> bi_next = NULL ;
762
- if (unlikely ((bio -> bi_rw & REQ_DISCARD ) &&
762
+ if (unlikely ((bio_op ( bio ) == REQ_OP_DISCARD ) &&
763
763
!blk_queue_discard (bdev_get_queue (bio -> bi_bdev ))))
764
764
/* Just ignore it */
765
765
bio_endio (bio );
@@ -1033,7 +1033,7 @@ static void raid1_unplug(struct blk_plug_cb *cb, bool from_schedule)
1033
1033
while (bio ) { /* submit pending writes */
1034
1034
struct bio * next = bio -> bi_next ;
1035
1035
bio -> bi_next = NULL ;
1036
- if (unlikely ((bio -> bi_rw & REQ_DISCARD ) &&
1036
+ if (unlikely ((bio_op ( bio ) == REQ_OP_DISCARD ) &&
1037
1037
!blk_queue_discard (bdev_get_queue (bio -> bi_bdev ))))
1038
1038
/* Just ignore it */
1039
1039
bio_endio (bio );
@@ -1053,12 +1053,11 @@ static void raid1_make_request(struct mddev *mddev, struct bio * bio)
1053
1053
int i , disks ;
1054
1054
struct bitmap * bitmap ;
1055
1055
unsigned long flags ;
1056
+ const int op = bio_op (bio );
1056
1057
const int rw = bio_data_dir (bio );
1057
1058
const unsigned long do_sync = (bio -> bi_rw & REQ_SYNC );
1058
1059
const unsigned long do_flush_fua = (bio -> bi_rw & (REQ_FLUSH | REQ_FUA ));
1059
- const unsigned long do_discard = (bio -> bi_rw
1060
- & (REQ_DISCARD | REQ_SECURE ));
1061
- const unsigned long do_same = (bio -> bi_rw & REQ_WRITE_SAME );
1060
+ const unsigned long do_sec = (bio -> bi_rw & REQ_SECURE );
1062
1061
struct md_rdev * blocked_rdev ;
1063
1062
struct blk_plug_cb * cb ;
1064
1063
struct raid1_plug_cb * plug = NULL ;
@@ -1166,7 +1165,7 @@ static void raid1_make_request(struct mddev *mddev, struct bio * bio)
1166
1165
mirror -> rdev -> data_offset ;
1167
1166
read_bio -> bi_bdev = mirror -> rdev -> bdev ;
1168
1167
read_bio -> bi_end_io = raid1_end_read_request ;
1169
- read_bio -> bi_rw = READ | do_sync ;
1168
+ bio_set_op_attrs ( read_bio , op , do_sync ) ;
1170
1169
read_bio -> bi_private = r1_bio ;
1171
1170
1172
1171
if (max_sectors < r1_bio -> sectors ) {
@@ -1376,8 +1375,7 @@ static void raid1_make_request(struct mddev *mddev, struct bio * bio)
1376
1375
conf -> mirrors [i ].rdev -> data_offset );
1377
1376
mbio -> bi_bdev = conf -> mirrors [i ].rdev -> bdev ;
1378
1377
mbio -> bi_end_io = raid1_end_write_request ;
1379
- mbio -> bi_rw =
1380
- WRITE | do_flush_fua | do_sync | do_discard | do_same ;
1378
+ bio_set_op_attrs (mbio , op , do_flush_fua | do_sync | do_sec );
1381
1379
mbio -> bi_private = r1_bio ;
1382
1380
1383
1381
atomic_inc (& r1_bio -> remaining );
@@ -1771,7 +1769,7 @@ static void end_sync_write(struct bio *bio)
1771
1769
static int r1_sync_page_io (struct md_rdev * rdev , sector_t sector ,
1772
1770
int sectors , struct page * page , int rw )
1773
1771
{
1774
- if (sync_page_io (rdev , sector , sectors << 9 , page , rw , false))
1772
+ if (sync_page_io (rdev , sector , sectors << 9 , page , rw , 0 , false))
1775
1773
/* success */
1776
1774
return 1 ;
1777
1775
if (rw == WRITE ) {
@@ -1825,7 +1823,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
1825
1823
rdev = conf -> mirrors [d ].rdev ;
1826
1824
if (sync_page_io (rdev , sect , s <<9 ,
1827
1825
bio -> bi_io_vec [idx ].bv_page ,
1828
- READ , false)) {
1826
+ REQ_OP_READ , 0 , false)) {
1829
1827
success = 1 ;
1830
1828
break ;
1831
1829
}
@@ -2030,7 +2028,7 @@ static void sync_request_write(struct mddev *mddev, struct r1bio *r1_bio)
2030
2028
!test_bit (MD_RECOVERY_SYNC , & mddev -> recovery ))))
2031
2029
continue ;
2032
2030
2033
- wbio -> bi_rw = WRITE ;
2031
+ bio_set_op_attrs ( wbio , REQ_OP_WRITE , 0 ) ;
2034
2032
wbio -> bi_end_io = end_sync_write ;
2035
2033
atomic_inc (& r1_bio -> remaining );
2036
2034
md_sync_acct (conf -> mirrors [i ].rdev -> bdev , bio_sectors (wbio ));
@@ -2090,7 +2088,7 @@ static void fix_read_error(struct r1conf *conf, int read_disk,
2090
2088
is_badblock (rdev , sect , s ,
2091
2089
& first_bad , & bad_sectors ) == 0 &&
2092
2090
sync_page_io (rdev , sect , s <<9 ,
2093
- conf -> tmppage , READ , false))
2091
+ conf -> tmppage , REQ_OP_READ , 0 , false))
2094
2092
success = 1 ;
2095
2093
else {
2096
2094
d ++ ;
@@ -2201,7 +2199,7 @@ static int narrow_write_error(struct r1bio *r1_bio, int i)
2201
2199
wbio = bio_clone_mddev (r1_bio -> master_bio , GFP_NOIO , mddev );
2202
2200
}
2203
2201
2204
- wbio -> bi_rw = WRITE ;
2202
+ bio_set_op_attrs ( wbio , REQ_OP_WRITE , 0 ) ;
2205
2203
wbio -> bi_iter .bi_sector = r1_bio -> sector ;
2206
2204
wbio -> bi_iter .bi_size = r1_bio -> sectors << 9 ;
2207
2205
@@ -2344,7 +2342,7 @@ static void handle_read_error(struct r1conf *conf, struct r1bio *r1_bio)
2344
2342
bio -> bi_iter .bi_sector = r1_bio -> sector + rdev -> data_offset ;
2345
2343
bio -> bi_bdev = rdev -> bdev ;
2346
2344
bio -> bi_end_io = raid1_end_read_request ;
2347
- bio -> bi_rw = READ | do_sync ;
2345
+ bio_set_op_attrs ( bio , REQ_OP_READ , do_sync ) ;
2348
2346
bio -> bi_private = r1_bio ;
2349
2347
if (max_sectors < r1_bio -> sectors ) {
2350
2348
/* Drat - have to split this up more */
@@ -2572,7 +2570,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
2572
2570
if (i < conf -> raid_disks )
2573
2571
still_degraded = 1 ;
2574
2572
} else if (!test_bit (In_sync , & rdev -> flags )) {
2575
- bio -> bi_rw = WRITE ;
2573
+ bio_set_op_attrs ( bio , REQ_OP_WRITE , 0 ) ;
2576
2574
bio -> bi_end_io = end_sync_write ;
2577
2575
write_targets ++ ;
2578
2576
} else {
@@ -2599,7 +2597,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
2599
2597
if (disk < 0 )
2600
2598
disk = i ;
2601
2599
}
2602
- bio -> bi_rw = READ ;
2600
+ bio_set_op_attrs ( bio , REQ_OP_READ , 0 ) ;
2603
2601
bio -> bi_end_io = end_sync_read ;
2604
2602
read_targets ++ ;
2605
2603
} else if (!test_bit (WriteErrorSeen , & rdev -> flags ) &&
@@ -2611,7 +2609,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr,
2611
2609
* if we are doing resync or repair. Otherwise, leave
2612
2610
* this device alone for this sync request.
2613
2611
*/
2614
- bio -> bi_rw = WRITE ;
2612
+ bio_set_op_attrs ( bio , REQ_OP_WRITE , 0 ) ;
2615
2613
bio -> bi_end_io = end_sync_write ;
2616
2614
write_targets ++ ;
2617
2615
}
0 commit comments