summaryrefslogtreecommitdiffstats
path: root/drivers/lightnvm/pblk-cache.c
diff options
context:
space:
mode:
authorJavier González <javier@cnexlabs.com>2018-01-05 14:16:20 +0100
committerJens Axboe <axboe@kernel.dk>2018-01-05 08:50:12 -0700
commit998ba62973132e886b0411f00bc66fbb31507e84 (patch)
tree9d883aff6821c4176a8c4daec6fd5f5ecfb426c1 /drivers/lightnvm/pblk-cache.c
parent30d82a8631428709c436ea5568bf68fe7cfaf8e8 (diff)
downloadlinux-998ba62973132e886b0411f00bc66fbb31507e84.tar.bz2
lightnvm: pblk: add iostat support
Since pblk registers its own block device, the iostat accounting is not automatically done for us. Therefore, add the necessary accounting logic to satisfy the iostat interface. Signed-off-by: Javier González <javier@cnexlabs.com> Signed-off-by: Matias Bjørling <m@bjorling.me> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm/pblk-cache.c')
-rw-r--r--drivers/lightnvm/pblk-cache.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/lightnvm/pblk-cache.c b/drivers/lightnvm/pblk-cache.c
index 0d227ef7d1b9..000fcad38136 100644
--- a/drivers/lightnvm/pblk-cache.c
+++ b/drivers/lightnvm/pblk-cache.c
@@ -19,12 +19,16 @@
int pblk_write_to_cache(struct pblk *pblk, struct bio *bio, unsigned long flags)
{
+ struct request_queue *q = pblk->dev->q;
struct pblk_w_ctx w_ctx;
sector_t lba = pblk_get_lba(bio);
+ unsigned long start_time = jiffies;
unsigned int bpos, pos;
int nr_entries = pblk_get_secs(bio);
int i, ret;
+ generic_start_io_acct(q, WRITE, bio_sectors(bio), &pblk->disk->part0);
+
/* Update the write buffer head (mem) with the entries that we can
* write. The write in itself cannot fail, so there is no need to
* rollback from here on.
@@ -67,6 +71,7 @@ retry:
pblk_rl_inserted(&pblk->rl, nr_entries);
out:
+ generic_end_io_acct(q, WRITE, &pblk->disk->part0, start_time);
pblk_write_should_kick(pblk);
return ret;
}