@@ -496,18 +496,17 @@ static void start_io_acct(struct dm_io *io)
496
496
false, 0 , & io -> stats_aux );
497
497
}
498
498
499
- static void end_io_acct (struct dm_io * io )
499
+ static void end_io_acct (struct mapped_device * md , struct bio * bio ,
500
+ unsigned long start_time , struct dm_stats_aux * stats_aux )
500
501
{
501
- struct mapped_device * md = io -> md ;
502
- struct bio * bio = io -> orig_bio ;
503
- unsigned long duration = jiffies - io -> start_time ;
502
+ unsigned long duration = jiffies - start_time ;
504
503
505
- bio_end_io_acct (bio , io -> start_time );
504
+ bio_end_io_acct (bio , start_time );
506
505
507
506
if (unlikely (dm_stats_used (& md -> stats )))
508
507
dm_stats_account_io (& md -> stats , bio_data_dir (bio ),
509
508
bio -> bi_iter .bi_sector , bio_sectors (bio ),
510
- true, duration , & io -> stats_aux );
509
+ true, duration , stats_aux );
511
510
512
511
/* nudge anyone waiting on suspend queue */
513
512
if (unlikely (wq_has_sleeper (& md -> wait )))
@@ -790,6 +789,8 @@ void dm_io_dec_pending(struct dm_io *io, blk_status_t error)
790
789
blk_status_t io_error ;
791
790
struct bio * bio ;
792
791
struct mapped_device * md = io -> md ;
792
+ unsigned long start_time = 0 ;
793
+ struct dm_stats_aux stats_aux ;
793
794
794
795
/* Push-back supersedes any I/O errors */
795
796
if (unlikely (error )) {
@@ -821,8 +822,10 @@ void dm_io_dec_pending(struct dm_io *io, blk_status_t error)
821
822
}
822
823
823
824
io_error = io -> status ;
824
- end_io_acct (io );
825
+ start_time = io -> start_time ;
826
+ stats_aux = io -> stats_aux ;
825
827
free_io (md , io );
828
+ end_io_acct (md , bio , start_time , & stats_aux );
826
829
827
830
if (io_error == BLK_STS_DM_REQUEUE )
828
831
return ;
0 commit comments