Skip to content

Commit 8d7c22a

Browse files
toshikanidjbw
authored andcommitted
libnvdimm: use generic iostat interfaces
nd_iostat_start() and nd_iostat_end() implement the same functionality that generic_start_io_acct() and generic_end_io_acct() already provide. Change nd_iostat_start() and nd_iostat_end() to call the generic iostat interfaces. There is no change in the nd interfaces. Signed-off-by: Toshi Kani <toshi.kani@hpe.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Dave Chinner <david@fromorbit.com> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 1001354 commit 8d7c22a

File tree

2 files changed

+9
-31
lines changed

2 files changed

+9
-31
lines changed

drivers/nvdimm/core.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -317,35 +317,6 @@ ssize_t nd_sector_size_store(struct device *dev, const char *buf,
317317
}
318318
}
319319

320-
void __nd_iostat_start(struct bio *bio, unsigned long *start)
321-
{
322-
struct gendisk *disk = bio->bi_bdev->bd_disk;
323-
const int rw = bio_data_dir(bio);
324-
int cpu = part_stat_lock();
325-
326-
*start = jiffies;
327-
part_round_stats(cpu, &disk->part0);
328-
part_stat_inc(cpu, &disk->part0, ios[rw]);
329-
part_stat_add(cpu, &disk->part0, sectors[rw], bio_sectors(bio));
330-
part_inc_in_flight(&disk->part0, rw);
331-
part_stat_unlock();
332-
}
333-
EXPORT_SYMBOL(__nd_iostat_start);
334-
335-
void nd_iostat_end(struct bio *bio, unsigned long start)
336-
{
337-
struct gendisk *disk = bio->bi_bdev->bd_disk;
338-
unsigned long duration = jiffies - start;
339-
const int rw = bio_data_dir(bio);
340-
int cpu = part_stat_lock();
341-
342-
part_stat_add(cpu, &disk->part0, ticks[rw], duration);
343-
part_round_stats(cpu, &disk->part0);
344-
part_dec_in_flight(&disk->part0, rw);
345-
part_stat_unlock();
346-
}
347-
EXPORT_SYMBOL(nd_iostat_end);
348-
349320
static ssize_t commands_show(struct device *dev,
350321
struct device_attribute *attr, char *buf)
351322
{

drivers/nvdimm/nd.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,17 @@ static inline bool nd_iostat_start(struct bio *bio, unsigned long *start)
377377
if (!blk_queue_io_stat(disk->queue))
378378
return false;
379379

380-
__nd_iostat_start(bio, start);
380+
*start = jiffies;
381+
generic_start_io_acct(bio_data_dir(bio),
382+
bio_sectors(bio), &disk->part0);
381383
return true;
382384
}
383-
void nd_iostat_end(struct bio *bio, unsigned long start);
385+
static inline void nd_iostat_end(struct bio *bio, unsigned long start)
386+
{
387+
struct gendisk *disk = bio->bi_bdev->bd_disk;
388+
389+
generic_end_io_acct(bio_data_dir(bio), &disk->part0, start);
390+
}
384391
static inline bool is_bad_pmem(struct badblocks *bb, sector_t sector,
385392
unsigned int len)
386393
{

0 commit comments

Comments
 (0)