diff options
author | Michael Callahan <michaelcallahan@fb.com> | 2018-07-18 07:47:39 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-07-18 10:44:20 -0400 |
commit | ddcf35d397976421a4ec1d0d00fbcc027a8cb034 (patch) | |
tree | ebffc9e2971b6c7bc3223a1c584a9c81372a34bc /drivers/lightnvm | |
parent | dbae2c551377b6533a00c11fc7ede370100ab404 (diff) |
block: Add and use op_stat_group() for indexing disk_stat fields.
Add and use a new op_stat_group() function for indexing partition stat
fields rather than indexing them by rq_data_dir() or bio_data_dir().
This function works similarly to op_is_sync() in that it takes the
request::cmd_flags or bio::bi_opf flags and determines which stats
should et updated.
In addition, the second parameter to generic_start_io_acct() and
generic_end_io_acct() is now a REQ_OP rather than simply a read or
write bit and it uses op_stat_group() on the parameter to determine
the stat group.
Note that the partition in_flight counts are not part of the per-cpu
statistics and as such are not indexed via this function. It's now
indexed by op_is_write().
tj: Refreshed on top of v4.17. Updated to pass around REQ_OP.
Signed-off-by: Michael Callahan <michaelcallahan@fb.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Joshua Morris <josh.h.morris@us.ibm.com>
Cc: Philipp Reisner <philipp.reisner@linbit.com>
Cc: Matias Bjorling <mb@lightnvm.io>
Cc: Kent Overstreet <kent.overstreet@gmail.com>
Cc: Alasdair Kergon <agk@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm')
-rw-r--r-- | drivers/lightnvm/pblk-cache.c | 5 | ||||
-rw-r--r-- | drivers/lightnvm/pblk-read.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/drivers/lightnvm/pblk-cache.c b/drivers/lightnvm/pblk-cache.c index 77d811962818..f565a56b898a 100644 --- a/drivers/lightnvm/pblk-cache.c +++ b/drivers/lightnvm/pblk-cache.c | |||
@@ -27,7 +27,8 @@ int pblk_write_to_cache(struct pblk *pblk, struct bio *bio, unsigned long flags) | |||
27 | int nr_entries = pblk_get_secs(bio); | 27 | int nr_entries = pblk_get_secs(bio); |
28 | int i, ret; | 28 | int i, ret; |
29 | 29 | ||
30 | generic_start_io_acct(q, WRITE, bio_sectors(bio), &pblk->disk->part0); | 30 | generic_start_io_acct(q, REQ_OP_WRITE, bio_sectors(bio), |
31 | &pblk->disk->part0); | ||
31 | 32 | ||
32 | /* Update the write buffer head (mem) with the entries that we can | 33 | /* Update the write buffer head (mem) with the entries that we can |
33 | * write. The write in itself cannot fail, so there is no need to | 34 | * write. The write in itself cannot fail, so there is no need to |
@@ -75,7 +76,7 @@ retry: | |||
75 | pblk_rl_inserted(&pblk->rl, nr_entries); | 76 | pblk_rl_inserted(&pblk->rl, nr_entries); |
76 | 77 | ||
77 | out: | 78 | out: |
78 | generic_end_io_acct(q, WRITE, &pblk->disk->part0, start_time); | 79 | generic_end_io_acct(q, REQ_OP_WRITE, &pblk->disk->part0, start_time); |
79 | pblk_write_should_kick(pblk); | 80 | pblk_write_should_kick(pblk); |
80 | return ret; | 81 | return ret; |
81 | } | 82 | } |
diff --git a/drivers/lightnvm/pblk-read.c b/drivers/lightnvm/pblk-read.c index 26d414ae25b6..5a46d7f9302f 100644 --- a/drivers/lightnvm/pblk-read.c +++ b/drivers/lightnvm/pblk-read.c | |||
@@ -199,7 +199,7 @@ static void __pblk_end_io_read(struct pblk *pblk, struct nvm_rq *rqd, | |||
199 | struct bio *int_bio = rqd->bio; | 199 | struct bio *int_bio = rqd->bio; |
200 | unsigned long start_time = r_ctx->start_time; | 200 | unsigned long start_time = r_ctx->start_time; |
201 | 201 | ||
202 | generic_end_io_acct(dev->q, READ, &pblk->disk->part0, start_time); | 202 | generic_end_io_acct(dev->q, REQ_OP_READ, &pblk->disk->part0, start_time); |
203 | 203 | ||
204 | if (rqd->error) | 204 | if (rqd->error) |
205 | pblk_log_read_err(pblk, rqd); | 205 | pblk_log_read_err(pblk, rqd); |
@@ -461,7 +461,8 @@ int pblk_submit_read(struct pblk *pblk, struct bio *bio) | |||
461 | return NVM_IO_ERR; | 461 | return NVM_IO_ERR; |
462 | } | 462 | } |
463 | 463 | ||
464 | generic_start_io_acct(q, READ, bio_sectors(bio), &pblk->disk->part0); | 464 | generic_start_io_acct(q, REQ_OP_READ, bio_sectors(bio), |
465 | &pblk->disk->part0); | ||
465 | 466 | ||
466 | bitmap_zero(read_bitmap, nr_secs); | 467 | bitmap_zero(read_bitmap, nr_secs); |
467 | 468 | ||