aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2008-08-25 06:56:14 -0400
committerJens Axboe <jens.axboe@oracle.com>2008-10-09 02:56:08 -0400
commit074a7aca7afa6f230104e8e65eba3420263714a5 (patch)
treef418313e45bd55be8156c8a3e8f9a216cf63058d /drivers/md/dm.c
parenteddb2e26b5ee3c5da68ba4bf1921ba20e2097bff (diff)
block: move stats from disk to part0
Move stats related fields - stamp, in_flight, dkstats - from disk to part0 and unify stat handling such that... * part_stat_*() now updates part0 together if the specified partition is not part0. ie. part_stat_*() are now essentially all_stat_*(). * {disk|all}_stat_*() are gone. * part_round_stats() is updated similary. It handles part0 stats automatically and disk_round_stats() is killed. * part_{inc|dec}_in_fligh() is implemented which automatically updates part0 stats for parts other than part0. * disk_map_sector_rcu() is updated to return part0 if no part matches. Combined with the above changes, this makes NULL special case handling in callers unnecessary. * Separate stats show code paths for disk are collapsed into part stats show code paths. * Rename disk_stat_lock/unlock() to part_stat_lock/unlock() While at it, reposition stat handling macros a bit and add missing parentheses around macro parameters. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/md/dm.c')
-rw-r--r--drivers/md/dm.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c
index 637806695bb9..327de03a5bdf 100644
--- a/drivers/md/dm.c
+++ b/drivers/md/dm.c
@@ -381,10 +381,10 @@ static void start_io_acct(struct dm_io *io)
381 381
382 io->start_time = jiffies; 382 io->start_time = jiffies;
383 383
384 cpu = disk_stat_lock(); 384 cpu = part_stat_lock();
385 disk_round_stats(cpu, dm_disk(md)); 385 part_round_stats(cpu, &dm_disk(md)->part0);
386 disk_stat_unlock(); 386 part_stat_unlock();
387 dm_disk(md)->in_flight = atomic_inc_return(&md->pending); 387 dm_disk(md)->part0.in_flight = atomic_inc_return(&md->pending);
388} 388}
389 389
390static int end_io_acct(struct dm_io *io) 390static int end_io_acct(struct dm_io *io)
@@ -395,12 +395,13 @@ static int end_io_acct(struct dm_io *io)
395 int pending, cpu; 395 int pending, cpu;
396 int rw = bio_data_dir(bio); 396 int rw = bio_data_dir(bio);
397 397
398 cpu = disk_stat_lock(); 398 cpu = part_stat_lock();
399 disk_round_stats(cpu, dm_disk(md)); 399 part_round_stats(cpu, &dm_disk(md)->part0);
400 disk_stat_add(cpu, dm_disk(md), ticks[rw], duration); 400 part_stat_add(cpu, &dm_disk(md)->part0, ticks[rw], duration);
401 disk_stat_unlock(); 401 part_stat_unlock();
402 402
403 dm_disk(md)->in_flight = pending = atomic_dec_return(&md->pending); 403 dm_disk(md)->part0.in_flight = pending =
404 atomic_dec_return(&md->pending);
404 405
405 return !pending; 406 return !pending;
406} 407}
@@ -899,10 +900,10 @@ static int dm_request(struct request_queue *q, struct bio *bio)
899 900
900 down_read(&md->io_lock); 901 down_read(&md->io_lock);
901 902
902 cpu = disk_stat_lock(); 903 cpu = part_stat_lock();
903 disk_stat_inc(cpu, dm_disk(md), ios[rw]); 904 part_stat_inc(cpu, &dm_disk(md)->part0, ios[rw]);
904 disk_stat_add(cpu, dm_disk(md), sectors[rw], bio_sectors(bio)); 905 part_stat_add(cpu, &dm_disk(md)->part0, sectors[rw], bio_sectors(bio));
905 disk_stat_unlock(); 906 part_stat_unlock();
906 907
907 /* 908 /*
908 * If we're suspended we have to queue 909 * If we're suspended we have to queue