mirror of
https://github.com/t2linux/kernel.git
synced 2026-08-16 05:22:11 -07:00
dm: properly fix redundant bio-based IO accounting
commit b879f915bc48a18d4f4462729192435bb0f17052 upstream. Record the start_time for a bio but defer the starting block core's IO accounting until after IO is submitted using bio_start_io_acct_time(). This approach avoids the need to mess around with any of the individual IO stats in response to a bio_split() that follows bio submission. Reported-by: Bud Brown <bubrown@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: stable@vger.kernel.org Depends-on: e45c47d1f94e ("block: add bio_start_io_acct_time() to control start_time") Signed-off-by: Mike Snitzer <snitzer@redhat.com> Link: https://lore.kernel.org/r/20220128155841.39644-4-snitzer@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a7f5b1a95f
commit
59274a00b1
+3
-2
@@ -489,7 +489,7 @@ static void start_io_acct(struct dm_io *io)
|
||||
struct mapped_device *md = io->md;
|
||||
struct bio *bio = io->orig_bio;
|
||||
|
||||
io->start_time = bio_start_io_acct(bio);
|
||||
bio_start_io_acct_time(bio, io->start_time);
|
||||
if (unlikely(dm_stats_used(&md->stats)))
|
||||
dm_stats_account_io(&md->stats, bio_data_dir(bio),
|
||||
bio->bi_iter.bi_sector, bio_sectors(bio),
|
||||
@@ -535,7 +535,7 @@ static struct dm_io *alloc_io(struct mapped_device *md, struct bio *bio)
|
||||
io->md = md;
|
||||
spin_lock_init(&io->endio_lock);
|
||||
|
||||
start_io_acct(io);
|
||||
io->start_time = jiffies;
|
||||
|
||||
return io;
|
||||
}
|
||||
@@ -1550,6 +1550,7 @@ static void __split_and_process_bio(struct mapped_device *md,
|
||||
submit_bio_noacct(bio);
|
||||
}
|
||||
}
|
||||
start_io_acct(ci.io);
|
||||
|
||||
/* drop the extra reference count */
|
||||
dm_io_dec_pending(ci.io, errno_to_blk_status(error));
|
||||
|
||||
Reference in New Issue
Block a user