block/rsxx: use generic io stats accounting functions to simplify io stat accounting
authorGu Zheng <guz.fnst@cn.fujitsu.com>
Mon, 24 Nov 2014 03:05:27 +0000 (11:05 +0800)
committerJens Axboe <axboe@fb.com>
Mon, 24 Nov 2014 15:05:18 +0000 (08:05 -0700)
Use generic io stats accounting help functions (generic_{start,end}_io_acct)
to simplify io stat accounting.

Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
drivers/block/rsxx/dev.c

index 40ee7705df63a061863539a03b8df5555f799c93..ac8c62cb48751bd06e6cb27e44e8fc9c379c7182 100644 (file)
@@ -112,37 +112,16 @@ static const struct block_device_operations rsxx_fops = {
 
 static void disk_stats_start(struct rsxx_cardinfo *card, struct bio *bio)
 {
-       struct hd_struct *part0 = &card->gendisk->part0;
-       int rw = bio_data_dir(bio);
-       int cpu;
-
-       cpu = part_stat_lock();
-
-       part_round_stats(cpu, part0);
-       part_inc_in_flight(part0, rw);
-
-       part_stat_unlock();
+       generic_start_io_acct(bio_data_dir(bio), bio_sectors(bio),
+                            &card->gendisk->part0);
 }
 
 static void disk_stats_complete(struct rsxx_cardinfo *card,
                                struct bio *bio,
                                unsigned long start_time)
 {
-       struct hd_struct *part0 = &card->gendisk->part0;
-       unsigned long duration = jiffies - start_time;
-       int rw = bio_data_dir(bio);
-       int cpu;
-
-       cpu = part_stat_lock();
-
-       part_stat_add(cpu, part0, sectors[rw], bio_sectors(bio));
-       part_stat_inc(cpu, part0, ios[rw]);
-       part_stat_add(cpu, part0, ticks[rw], duration);
-
-       part_round_stats(cpu, part0);
-       part_dec_in_flight(part0, rw);
-
-       part_stat_unlock();
+       generic_end_io_acct(bio_data_dir(bio), &card->gendisk->part0,
+                          start_time);
 }
 
 static void bio_dma_done_cb(struct rsxx_cardinfo *card,