@@ -1060,6 +1060,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
10601060 int i , disks = sh -> disks ;
10611061 struct stripe_head * head_sh = sh ;
10621062 struct bio_list pending_bios = BIO_EMPTY_LIST ;
1063+ struct r5dev * dev ;
10631064 bool should_defer ;
10641065
10651066 might_sleep ();
@@ -1094,8 +1095,9 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
10941095 op_flags |= REQ_SYNC ;
10951096
10961097again :
1097- bi = & sh -> dev [i ].req ;
1098- rbi = & sh -> dev [i ].rreq ; /* For writing to replacement */
1098+ dev = & sh -> dev [i ];
1099+ bi = & dev -> req ;
1100+ rbi = & dev -> rreq ; /* For writing to replacement */
10991101
11001102 rcu_read_lock ();
11011103 rrdev = rcu_dereference (conf -> disks [i ].replacement );
@@ -1171,8 +1173,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
11711173
11721174 set_bit (STRIPE_IO_STARTED , & sh -> state );
11731175
1174- bio_set_dev (bi , rdev -> bdev );
1175- bio_set_op_attrs (bi , op , op_flags );
1176+ bio_init (bi , rdev -> bdev , & dev -> vec , 1 , op | op_flags );
11761177 bi -> bi_end_io = op_is_write (op )
11771178 ? raid5_end_write_request
11781179 : raid5_end_read_request ;
@@ -1238,8 +1239,7 @@ static void ops_run_io(struct stripe_head *sh, struct stripe_head_state *s)
12381239
12391240 set_bit (STRIPE_IO_STARTED , & sh -> state );
12401241
1241- bio_set_dev (rbi , rrdev -> bdev );
1242- bio_set_op_attrs (rbi , op , op_flags );
1242+ bio_init (rbi , rrdev -> bdev , & dev -> rvec , 1 , op | op_flags );
12431243 BUG_ON (!op_is_write (op ));
12441244 rbi -> bi_end_io = raid5_end_write_request ;
12451245 rbi -> bi_private = sh ;
@@ -2294,7 +2294,6 @@ static struct stripe_head *alloc_stripe(struct kmem_cache *sc, gfp_t gfp,
22942294 int disks , struct r5conf * conf )
22952295{
22962296 struct stripe_head * sh ;
2297- int i ;
22982297
22992298 sh = kmem_cache_zalloc (sc , gfp );
23002299 if (sh ) {
@@ -2307,12 +2306,6 @@ static struct stripe_head *alloc_stripe(struct kmem_cache *sc, gfp_t gfp,
23072306 atomic_set (& sh -> count , 1 );
23082307 sh -> raid_conf = conf ;
23092308 sh -> log_start = MaxSector ;
2310- for (i = 0 ; i < disks ; i ++ ) {
2311- struct r5dev * dev = & sh -> dev [i ];
2312-
2313- bio_init (& dev -> req , NULL , & dev -> vec , 1 , 0 );
2314- bio_init (& dev -> rreq , NULL , & dev -> rvec , 1 , 0 );
2315- }
23162309
23172310 if (raid5_has_ppl (conf )) {
23182311 sh -> ppl_page = alloc_page (gfp );
@@ -2677,7 +2670,6 @@ static void raid5_end_read_request(struct bio * bi)
26772670 (unsigned long long )sh -> sector , i , atomic_read (& sh -> count ),
26782671 bi -> bi_status );
26792672 if (i == disks ) {
2680- bio_reset (bi , NULL , 0 );
26812673 BUG ();
26822674 return ;
26832675 }
@@ -2785,7 +2777,7 @@ static void raid5_end_read_request(struct bio * bi)
27852777 }
27862778 }
27872779 rdev_dec_pending (rdev , conf -> mddev );
2788- bio_reset (bi , NULL , 0 );
2780+ bio_uninit (bi );
27892781 clear_bit (R5_LOCKED , & sh -> dev [i ].flags );
27902782 set_bit (STRIPE_HANDLE , & sh -> state );
27912783 raid5_release_stripe (sh );
@@ -2823,7 +2815,6 @@ static void raid5_end_write_request(struct bio *bi)
28232815 (unsigned long long )sh -> sector , i , atomic_read (& sh -> count ),
28242816 bi -> bi_status );
28252817 if (i == disks ) {
2826- bio_reset (bi , NULL , 0 );
28272818 BUG ();
28282819 return ;
28292820 }
@@ -2860,7 +2851,7 @@ static void raid5_end_write_request(struct bio *bi)
28602851 if (sh -> batch_head && bi -> bi_status && !replacement )
28612852 set_bit (STRIPE_BATCH_ERR , & sh -> batch_head -> state );
28622853
2863- bio_reset (bi , NULL , 0 );
2854+ bio_uninit (bi );
28642855 if (!test_and_clear_bit (R5_DOUBLE_LOCKED , & sh -> dev [i ].flags ))
28652856 clear_bit (R5_LOCKED , & sh -> dev [i ].flags );
28662857 set_bit (STRIPE_HANDLE , & sh -> state );
0 commit comments