aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-03-25 16:20:56 +1100
committerNeilBrown <neilb@suse.de>2010-05-18 15:27:52 +1000
commit490773268cf64f68da2470e07b52c7944da6312d (patch)
treed394aafa7203c316db6b63f128b8894e18993fca /drivers/md/md.c
parentmd/raid5: small tidyup in raid5_align_endio (diff)
downloadlinux-dev-490773268cf64f68da2470e07b52c7944da6312d.tar.xz
linux-dev-490773268cf64f68da2470e07b52c7944da6312d.zip
md: move io accounting out of personalities into md_make_request
While I generally prefer letting personalities do as much as possible, given that we have a central md_make_request anyway we may as well use it to simplify code. Also this centralises knowledge of ->gendisk which will help later. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index c5a1b0725c9f..117663d2a4e5 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -214,8 +214,11 @@ static DEFINE_SPINLOCK(all_mddevs_lock);
*/
static int md_make_request(struct request_queue *q, struct bio *bio)
{
+ const int rw = bio_data_dir(bio);
mddev_t *mddev = q->queuedata;
int rv;
+ int cpu;
+
if (mddev == NULL || mddev->pers == NULL) {
bio_io_error(bio);
return 0;
@@ -236,7 +239,15 @@ static int md_make_request(struct request_queue *q, struct bio *bio)
}
atomic_inc(&mddev->active_io);
rcu_read_unlock();
+
rv = mddev->pers->make_request(q, bio);
+
+ cpu = part_stat_lock();
+ part_stat_inc(cpu, &mddev->gendisk->part0, ios[rw]);
+ part_stat_add(cpu, &mddev->gendisk->part0, sectors[rw],
+ bio_sectors(bio));
+ part_stat_unlock();
+
if (atomic_dec_and_test(&mddev->active_io) && mddev->suspended)
wake_up(&mddev->sb_wait);