@@ -1077,29 +1077,21 @@ static unsigned long __part_start_io_acct(struct block_device *part,
}
/**
- * bio_start_io_acct_time - start I/O accounting for bio based drivers
+ * bio_start_io_acct_remapped - start I/O accounting for bio based drivers
* @bio: bio to start account for
* @start_time: start time that should be passed back to bio_end_io_acct().
- */
-void bio_start_io_acct_time(struct bio *bio, unsigned long start_time)
-{
- __part_start_io_acct(bio->bi_bdev, bio_sectors(bio),
- bio_op(bio), start_time);
-}
-EXPORT_SYMBOL_GPL(bio_start_io_acct_time);
-
-/**
- * bio_start_io_acct - start I/O accounting for bio based drivers
- * @bio: bio to start account for
+ * @orig_bdev: block device that I/O must be accounted to.
*
* Returns the start time that should be passed back to bio_end_io_acct().
*/
-unsigned long bio_start_io_acct(struct bio *bio)
+unsigned long bio_start_io_acct_remapped(struct bio *bio,
+ unsigned long start_time,
+ struct block_device *orig_bdev)
{
- return __part_start_io_acct(bio->bi_bdev, bio_sectors(bio),
- bio_op(bio), jiffies);
+ return __part_start_io_acct(orig_bdev, bio_sectors(bio),
+ bio_op(bio), start_time);
}
-EXPORT_SYMBOL_GPL(bio_start_io_acct);
+EXPORT_SYMBOL_GPL(bio_start_io_acct_remapped);
unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors,
unsigned int op)
@@ -489,7 +489,8 @@ static void start_io_acct(struct dm_io *io)
{
struct bio *bio = io->orig_bio;
- bio_start_io_acct_time(bio, io->start_time);
+ bio_start_io_acct_remapped(bio, io->start_time,
+ io->orig_bio->bi_bdev);
if (unlikely(dm_stats_used(&io->md->stats)))
dm_stats_account_io(&io->md->stats, bio_data_dir(bio),
@@ -1512,11 +1512,23 @@ unsigned long disk_start_io_acct(struct gendisk *disk, unsigned int sectors,
void disk_end_io_acct(struct gendisk *disk, unsigned int op,
unsigned long start_time);
-void bio_start_io_acct_time(struct bio *bio, unsigned long start_time);
-unsigned long bio_start_io_acct(struct bio *bio);
+unsigned long bio_start_io_acct_remapped(struct bio *bio,
+ unsigned long start_time,
+ struct block_device *orig_bdev);
void bio_end_io_acct_remapped(struct bio *bio, unsigned long start_time,
struct block_device *orig_bdev);
+/**
+ * bio_start_io_acct - start I/O accounting for bio based drivers
+ * @bio: bio to start account for
+ *
+ * Returns the start time that should be passed back to bio_end_io_acct().
+ */
+static inline unsigned long bio_start_io_acct(struct bio *bio)
+{
+ return bio_start_io_acct_remapped(bio, jiffies, bio->bi_bdev);
+}
+
/**
* bio_end_io_acct - end I/O accounting for bio based drivers
* @bio: bio to end account for
DM needs the ability to account a clone bio's IO to the original block_device. So add @orig_bdev argument to bio_start_io_acct_time. Rename bio_start_io_acct_time to bio_start_io_acct_remapped. Also, follow bio_end_io_acct and bio_end_io_acct_remapped pattern by moving bio_start_io_acct to blkdev.h and have it call bio_start_io_acct_remapped. Signed-off-by: Mike Snitzer <snitzer@redhat.com> --- block/blk-core.c | 24 ++++++++---------------- drivers/md/dm.c | 3 ++- include/linux/blkdev.h | 16 ++++++++++++++-- 3 files changed, 24 insertions(+), 19 deletions(-)