Skip to content

Commit

Permalink
block/rsxx: use generic io stats accounting functions to simplify io …
Browse files Browse the repository at this point in the history
…stat accounting

Use generic io stats accounting help functions (generic_{start,end}_io_acct)
to simplify io stat accounting.

Signed-off-by: Gu Zheng <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Gu Zheng authored and axboe committed Nov 24, 2014
1 parent 18c0b22 commit fa573f7
Showing 1 changed file with 4 additions and 25 deletions.
29 changes: 4 additions & 25 deletions drivers/block/rsxx/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit fa573f7

Please sign in to comment.