@@ -541,7 +541,6 @@ static void __bch2_read_endio(struct work_struct *work)
541
541
struct bch_read_bio * rbio =
542
542
container_of (work , struct bch_read_bio , work );
543
543
struct bch_fs * c = rbio -> c ;
544
- struct bch_dev * ca = bch2_dev_bkey_exists (c , rbio -> pick .ptr .dev );
545
544
struct bio * src = & rbio -> bio ;
546
545
struct bio * dst = & bch2_rbio_parent (rbio )-> bio ;
547
546
struct bvec_iter dst_iter = rbio -> bvec_iter ;
@@ -647,13 +646,15 @@ static void __bch2_read_endio(struct work_struct *work)
647
646
prt_str (& buf , "data " );
648
647
bch2_csum_err_msg (& buf , crc .csum_type , rbio -> pick .crc .csum , csum );
649
648
650
- bch_err_inum_offset_ratelimited (ca ,
651
- rbio -> read_pos .inode ,
652
- rbio -> read_pos .offset << 9 ,
653
- "data %s" , buf .buf );
649
+ struct bch_dev * ca = rbio -> have_ioref ? bch2_dev_have_ref (c , rbio -> pick .ptr .dev ) : NULL ;
650
+ if (ca ) {
651
+ bch_err_inum_offset_ratelimited (ca ,
652
+ rbio -> read_pos .inode ,
653
+ rbio -> read_pos .offset << 9 ,
654
+ "data %s" , buf .buf );
655
+ bch2_io_error (ca , BCH_MEMBER_ERROR_checksum );
656
+ }
654
657
printbuf_exit (& buf );
655
-
656
- bch2_io_error (ca , BCH_MEMBER_ERROR_checksum );
657
658
bch2_rbio_error (rbio , READ_RETRY_AVOID , BLK_STS_IOERR );
658
659
goto out ;
659
660
decompression_err :
@@ -675,7 +676,7 @@ static void bch2_read_endio(struct bio *bio)
675
676
struct bch_read_bio * rbio =
676
677
container_of (bio , struct bch_read_bio , bio );
677
678
struct bch_fs * c = rbio -> c ;
678
- struct bch_dev * ca = bch2_dev_bkey_exists (c , rbio -> pick .ptr .dev );
679
+ struct bch_dev * ca = rbio -> have_ioref ? bch2_dev_have_ref (c , rbio -> pick .ptr .dev ) : NULL ;
679
680
struct workqueue_struct * wq = NULL ;
680
681
enum rbio_context context = RBIO_CONTEXT_NULL ;
681
682
@@ -687,17 +688,21 @@ static void bch2_read_endio(struct bio *bio)
687
688
if (!rbio -> split )
688
689
rbio -> bio .bi_end_io = rbio -> end_io ;
689
690
690
- if (bch2_dev_inum_io_err_on (bio -> bi_status , ca , BCH_MEMBER_ERROR_read ,
691
- rbio -> read_pos .inode ,
692
- rbio -> read_pos .offset ,
693
- "data read error: %s" ,
694
- bch2_blk_status_to_str (bio -> bi_status ))) {
691
+ if (bio -> bi_status ) {
692
+ if (ca ) {
693
+ bch_err_inum_offset_ratelimited (ca ,
694
+ rbio -> read_pos .inode ,
695
+ rbio -> read_pos .offset ,
696
+ "data read error: %s" ,
697
+ bch2_blk_status_to_str (bio -> bi_status ));
698
+ bch2_io_error (ca , BCH_MEMBER_ERROR_read );
699
+ }
695
700
bch2_rbio_error (rbio , READ_RETRY_AVOID , bio -> bi_status );
696
701
return ;
697
702
}
698
703
699
704
if (((rbio -> flags & BCH_READ_RETRY_IF_STALE ) && race_fault ()) ||
700
- dev_ptr_stale (ca , & rbio -> pick .ptr )) {
705
+ ( ca && dev_ptr_stale (ca , & rbio -> pick .ptr ) )) {
701
706
trace_and_count (c , read_reuse_race , & rbio -> bio );
702
707
703
708
if (rbio -> flags & BCH_READ_RETRY_IF_STALE )
0 commit comments