diff options
author | Mike Snitzer <snitzer@redhat.com> | 2017-12-17 17:56:48 +0100 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2017-12-17 18:05:32 +0100 |
commit | f3986374f94951b0fec6980e5b2dd621c51b215c (patch) | |
tree | 28d3386e3d03ff025a2b72710824d57431cea36c /drivers/md | |
parent | dm: remove redundant mapped_device member from clone_info structure (diff) | |
download | linux-f3986374f94951b0fec6980e5b2dd621c51b215c.tar.xz linux-f3986374f94951b0fec6980e5b2dd621c51b215c.zip |
dm: simplify start of block stats accounting for bio-based
No apparent need to generic_start_io_acct() until before the IO is ready
for submission. start_io_acct() is the proper place to do this
accounting -- it is also where DM accounts for pending IO and, if
enabled, starts dm-stats accounting.
Replace start_io_acct()'s part_round_stats() with generic_start_io_acct().
This eliminates needing to take part_stat_lock() multiple times when
starting an IO on bio-based devices.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index e4213c4c7c9b..cbb4ae5051fc 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -599,16 +599,14 @@ static void start_io_acct(struct dm_io *io) { struct mapped_device *md = io->md; struct bio *bio = io->orig_bio; - int cpu; int rw = bio_data_dir(bio); io->start_time = jiffies; - cpu = part_stat_lock(); - part_round_stats(md->queue, cpu, &dm_disk(md)->part0); - part_stat_unlock(); + generic_start_io_acct(md->queue, rw, bio_sectors(bio), &dm_disk(md)->part0); + atomic_set(&dm_disk(md)->part0.in_flight[rw], - atomic_inc_return(&md->pending[rw])); + atomic_inc_return(&md->pending[rw])); if (unlikely(dm_stats_used(&md->stats))) dm_stats_account_io(&md->stats, bio_data_dir(bio), @@ -1556,15 +1554,12 @@ static void __split_and_process_bio(struct mapped_device *md, */ static blk_qc_t dm_make_request(struct request_queue *q, struct bio *bio) { - int rw = bio_data_dir(bio); struct mapped_device *md = q->queuedata; int srcu_idx; struct dm_table *map; map = dm_get_live_table(md, &srcu_idx); - generic_start_io_acct(q, rw, bio_sectors(bio), &dm_disk(md)->part0); - /* if we're suspended, we have to queue this io for later */ if (unlikely(test_bit(DMF_BLOCK_IO_FOR_SUSPEND, &md->flags))) { dm_put_live_table(md, srcu_idx); |