@@ -1203,7 +1203,8 @@ static void bch2_rbio_done(struct bch_read_bio *rbio)
12031203
12041204static void bch2_read_retry_nodecode (struct bch_fs * c , struct bch_read_bio * rbio ,
12051205 struct bvec_iter bvec_iter , u64 inode ,
1206- struct bch_devs_mask * avoid , unsigned flags )
1206+ struct bch_io_failures * failed ,
1207+ unsigned flags )
12071208{
12081209 struct btree_iter iter ;
12091210 BKEY_PADDED (k ) tmp ;
@@ -1237,7 +1238,7 @@ static void bch2_read_retry_nodecode(struct bch_fs *c, struct bch_read_bio *rbio
12371238 goto out ;
12381239 }
12391240
1240- ret = __bch2_read_extent (c , rbio , bvec_iter , k , avoid , flags );
1241+ ret = __bch2_read_extent (c , rbio , bvec_iter , k , failed , flags );
12411242 if (ret == READ_RETRY )
12421243 goto retry ;
12431244 if (ret )
@@ -1251,7 +1252,7 @@ static void bch2_read_retry_nodecode(struct bch_fs *c, struct bch_read_bio *rbio
12511252
12521253static void bch2_read_retry (struct bch_fs * c , struct bch_read_bio * rbio ,
12531254 struct bvec_iter bvec_iter , u64 inode ,
1254- struct bch_devs_mask * avoid , unsigned flags )
1255+ struct bch_io_failures * failed , unsigned flags )
12551256{
12561257 struct btree_iter iter ;
12571258 struct bkey_s_c k ;
@@ -1274,7 +1275,7 @@ static void bch2_read_retry(struct bch_fs *c, struct bch_read_bio *rbio,
12741275 (k .k -> p .offset - bvec_iter .bi_sector ) << 9 );
12751276 swap (bvec_iter .bi_size , bytes );
12761277
1277- ret = __bch2_read_extent (c , rbio , bvec_iter , k , avoid , flags );
1278+ ret = __bch2_read_extent (c , rbio , bvec_iter , k , failed , flags );
12781279 switch (ret ) {
12791280 case READ_RETRY :
12801281 goto retry ;
@@ -1310,14 +1311,12 @@ static void bch2_rbio_retry(struct work_struct *work)
13101311 struct bvec_iter iter = rbio -> bvec_iter ;
13111312 unsigned flags = rbio -> flags ;
13121313 u64 inode = rbio -> pos .inode ;
1313- struct bch_devs_mask avoid ;
1314+ struct bch_io_failures failed = { . nr = 0 } ;
13141315
13151316 trace_read_retry (& rbio -> bio );
13161317
1317- memset (& avoid , 0 , sizeof (avoid ));
1318-
13191318 if (rbio -> retry == READ_RETRY_AVOID )
1320- __set_bit ( rbio -> pick . ptr . dev , avoid . d );
1319+ bch2_mark_io_failure ( & failed , & rbio -> pick );
13211320
13221321 rbio -> bio .bi_status = 0 ;
13231322
@@ -1327,9 +1326,9 @@ static void bch2_rbio_retry(struct work_struct *work)
13271326 flags &= ~BCH_READ_MAY_PROMOTE ;
13281327
13291328 if (flags & BCH_READ_NODECODE )
1330- bch2_read_retry_nodecode (c , rbio , iter , inode , & avoid , flags );
1329+ bch2_read_retry_nodecode (c , rbio , iter , inode , & failed , flags );
13311330 else
1332- bch2_read_retry (c , rbio , iter , inode , & avoid , flags );
1331+ bch2_read_retry (c , rbio , iter , inode , & failed , flags );
13331332}
13341333
13351334static void bch2_rbio_error (struct bch_read_bio * rbio , int retry ,
@@ -1569,7 +1568,7 @@ static void bch2_read_endio(struct bio *bio)
15691568
15701569int __bch2_read_extent (struct bch_fs * c , struct bch_read_bio * orig ,
15711570 struct bvec_iter iter , struct bkey_s_c k ,
1572- struct bch_devs_mask * avoid , unsigned flags )
1571+ struct bch_io_failures * failed , unsigned flags )
15731572{
15741573 struct extent_ptr_decoded pick ;
15751574 struct bch_read_bio * rbio = NULL ;
@@ -1579,7 +1578,7 @@ int __bch2_read_extent(struct bch_fs *c, struct bch_read_bio *orig,
15791578 struct bpos pos = bkey_start_pos (k .k );
15801579 int pick_ret ;
15811580
1582- pick_ret = bch2_extent_pick_ptr (c , k , avoid , & pick );
1581+ pick_ret = bch2_extent_pick_ptr (c , k , failed , & pick );
15831582
15841583 /* hole or reservation - just zero fill: */
15851584 if (!pick_ret )
@@ -1750,7 +1749,7 @@ int __bch2_read_extent(struct bch_fs *c, struct bch_read_bio *orig,
17501749 rbio = bch2_rbio_free (rbio );
17511750
17521751 if (ret == READ_RETRY_AVOID ) {
1753- __set_bit ( pick . ptr . dev , avoid -> d );
1752+ bch2_mark_io_failure ( failed , & pick );
17541753 ret = READ_RETRY ;
17551754 }
17561755
0 commit comments