Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

block/rsxx: use generic io stats accounting functions to simplify io stat accounting

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>

authored by

Gu Zheng and committed by
Jens Axboe
fa573f72 18c0b223

+4 -25
+4 -25
drivers/block/rsxx/dev.c
··· 112 112 113 113 static void disk_stats_start(struct rsxx_cardinfo *card, struct bio *bio) 114 114 { 115 - struct hd_struct *part0 = &card->gendisk->part0; 116 - int rw = bio_data_dir(bio); 117 - int cpu; 118 - 119 - cpu = part_stat_lock(); 120 - 121 - part_round_stats(cpu, part0); 122 - part_inc_in_flight(part0, rw); 123 - 124 - part_stat_unlock(); 115 + generic_start_io_acct(bio_data_dir(bio), bio_sectors(bio), 116 + &card->gendisk->part0); 125 117 } 126 118 127 119 static void disk_stats_complete(struct rsxx_cardinfo *card, 128 120 struct bio *bio, 129 121 unsigned long start_time) 130 122 { 131 - struct hd_struct *part0 = &card->gendisk->part0; 132 - unsigned long duration = jiffies - start_time; 133 - int rw = bio_data_dir(bio); 134 - int cpu; 135 - 136 - cpu = part_stat_lock(); 137 - 138 - part_stat_add(cpu, part0, sectors[rw], bio_sectors(bio)); 139 - part_stat_inc(cpu, part0, ios[rw]); 140 - part_stat_add(cpu, part0, ticks[rw], duration); 141 - 142 - part_round_stats(cpu, part0); 143 - part_dec_in_flight(part0, rw); 144 - 145 - part_stat_unlock(); 123 + generic_end_io_acct(bio_data_dir(bio), &card->gendisk->part0, 124 + start_time); 146 125 } 147 126 148 127 static void bio_dma_done_cb(struct rsxx_cardinfo *card,