Commit a8e45650 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

lightnvm/pblk: use bio_{start,end}_io_acct

Switch rsxx to use the nicer bio accounting helpers.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 421716bc
...@@ -21,16 +21,14 @@ ...@@ -21,16 +21,14 @@
void pblk_write_to_cache(struct pblk *pblk, struct bio *bio, void pblk_write_to_cache(struct pblk *pblk, struct bio *bio,
unsigned long flags) unsigned long flags)
{ {
struct request_queue *q = pblk->dev->q;
struct pblk_w_ctx w_ctx; struct pblk_w_ctx w_ctx;
sector_t lba = pblk_get_lba(bio); sector_t lba = pblk_get_lba(bio);
unsigned long start_time = jiffies; unsigned long start_time;
unsigned int bpos, pos; unsigned int bpos, pos;
int nr_entries = pblk_get_secs(bio); int nr_entries = pblk_get_secs(bio);
int i, ret; int i, ret;
generic_start_io_acct(q, REQ_OP_WRITE, bio_sectors(bio), start_time = bio_start_io_acct(bio);
&pblk->disk->part0);
/* Update the write buffer head (mem) with the entries that we can /* 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 * 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, ...@@ -79,7 +77,7 @@ void pblk_write_to_cache(struct pblk *pblk, struct bio *bio,
pblk_rl_inserted(&pblk->rl, nr_entries); pblk_rl_inserted(&pblk->rl, nr_entries);
out: 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); pblk_write_should_kick(pblk);
if (ret == NVM_IO_DONE) if (ret == NVM_IO_DONE)
......
...@@ -187,12 +187,11 @@ static void pblk_end_user_read(struct bio *bio, int error) ...@@ -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, static void __pblk_end_io_read(struct pblk *pblk, struct nvm_rq *rqd,
bool put_line) bool put_line)
{ {
struct nvm_tgt_dev *dev = pblk->dev;
struct pblk_g_ctx *r_ctx = nvm_rq_to_pdu(rqd); struct pblk_g_ctx *r_ctx = nvm_rq_to_pdu(rqd);
struct bio *int_bio = rqd->bio; struct bio *int_bio = rqd->bio;
unsigned long start_time = r_ctx->start_time; 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) if (rqd->error)
pblk_log_read_err(pblk, rqd); 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, ...@@ -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) 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); sector_t blba = pblk_get_lba(bio);
unsigned int nr_secs = pblk_get_secs(bio); unsigned int nr_secs = pblk_get_secs(bio);
bool from_cache; bool from_cache;
struct pblk_g_ctx *r_ctx; struct pblk_g_ctx *r_ctx;
struct nvm_rq *rqd; struct nvm_rq *rqd;
struct bio *int_bio, *split_bio; struct bio *int_bio, *split_bio;
unsigned long start_time;
generic_start_io_acct(q, REQ_OP_READ, bio_sectors(bio), start_time = bio_start_io_acct(bio);
&pblk->disk->part0);
rqd = pblk_alloc_rqd(pblk, PBLK_READ); rqd = pblk_alloc_rqd(pblk, PBLK_READ);
...@@ -283,7 +280,7 @@ void pblk_submit_read(struct pblk *pblk, struct bio *bio) ...@@ -283,7 +280,7 @@ void pblk_submit_read(struct pblk *pblk, struct bio *bio)
rqd->end_io = pblk_end_io_read; rqd->end_io = pblk_end_io_read;
r_ctx = nvm_rq_to_pdu(rqd); r_ctx = nvm_rq_to_pdu(rqd);
r_ctx->start_time = jiffies; r_ctx->start_time = start_time;
r_ctx->lba = blba; r_ctx->lba = blba;
if (pblk_alloc_rqd_meta(pblk, rqd)) { if (pblk_alloc_rqd_meta(pblk, rqd)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment