Switch rsxx to use the nicer bio accounting helpers.

Signed-off-by: Christoph Hellwig <h...@lst.de>
Reviewed-by: Konstantin Khlebnikov <khlebni...@yandex-team.ru>
---
 drivers/lightnvm/pblk-cache.c |  8 +++-----
 drivers/lightnvm/pblk-read.c  | 11 ++++-------
 2 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/lightnvm/pblk-cache.c b/drivers/lightnvm/pblk-cache.c
index 5c1034c22197c..f185f1a000083 100644
--- a/drivers/lightnvm/pblk-cache.c
+++ b/drivers/lightnvm/pblk-cache.c
@@ -21,16 +21,14 @@
 void 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 long start_time;
        unsigned int bpos, pos;
        int nr_entries = pblk_get_secs(bio);
        int i, ret;
 
-       generic_start_io_acct(q, REQ_OP_WRITE, bio_sectors(bio),
-                             &pblk->disk->part0);
+       start_time = bio_start_io_acct(bio);
 
        /* 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
@@ -79,7 +77,7 @@ void pblk_write_to_cache(struct pblk *pblk, struct bio *bio,
        pblk_rl_inserted(&pblk->rl, nr_entries);
 
 out:
-       generic_end_io_acct(q, REQ_OP_WRITE, &pblk->disk->part0, start_time);
+       bio_end_io_acct(bio, start_time);
        pblk_write_should_kick(pblk);
 
        if (ret == NVM_IO_DONE)
diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c
index 8efd14e683dc4..140927ebf41e9 100644
--- a/drivers/lightnvm/pblk-read.c
+++ b/drivers/lightnvm/pblk-read.c
@@ -187,12 +187,11 @@ static void pblk_end_user_read(struct bio *bio, int error)
 static void __pblk_end_io_read(struct pblk *pblk, struct nvm_rq *rqd,
                               bool put_line)
 {
-       struct nvm_tgt_dev *dev = pblk->dev;
        struct pblk_g_ctx *r_ctx = nvm_rq_to_pdu(rqd);
        struct bio *int_bio = rqd->bio;
        unsigned long start_time = r_ctx->start_time;
 
-       generic_end_io_acct(dev->q, REQ_OP_READ, &pblk->disk->part0, 
start_time);
+       bio_end_io_acct(int_bio, start_time);
 
        if (rqd->error)
                pblk_log_read_err(pblk, rqd);
@@ -263,17 +262,15 @@ static void pblk_read_rq(struct pblk *pblk, struct nvm_rq 
*rqd, struct bio *bio,
 
 void pblk_submit_read(struct pblk *pblk, struct bio *bio)
 {
-       struct nvm_tgt_dev *dev = pblk->dev;
-       struct request_queue *q = dev->q;
        sector_t blba = pblk_get_lba(bio);
        unsigned int nr_secs = pblk_get_secs(bio);
        bool from_cache;
        struct pblk_g_ctx *r_ctx;
        struct nvm_rq *rqd;
        struct bio *int_bio, *split_bio;
+       unsigned long start_time;
 
-       generic_start_io_acct(q, REQ_OP_READ, bio_sectors(bio),
-                             &pblk->disk->part0);
+       start_time = bio_start_io_acct(bio);
 
        rqd = pblk_alloc_rqd(pblk, PBLK_READ);
 
@@ -283,7 +280,7 @@ void pblk_submit_read(struct pblk *pblk, struct bio *bio)
        rqd->end_io = pblk_end_io_read;
 
        r_ctx = nvm_rq_to_pdu(rqd);
-       r_ctx->start_time = jiffies;
+       r_ctx->start_time = start_time;
        r_ctx->lba = blba;
 
        if (pblk_alloc_rqd_meta(pblk, rqd)) {
-- 
2.26.2

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to