summaryrefslogtreecommitdiffstats
path: root/drivers/block/zram
diff options
context:
space:
mode:
authorMichael Callahan <michaelcallahan@fb.com>2018-07-18 07:47:39 -0400
committerJens Axboe <axboe@kernel.dk>2018-07-18 10:44:20 -0400
commitddcf35d397976421a4ec1d0d00fbcc027a8cb034 (patch)
treeebffc9e2971b6c7bc3223a1c584a9c81372a34bc /drivers/block/zram
parentdbae2c551377b6533a00c11fc7ede370100ab404 (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/block/zram')
-rw-r--r--drivers/block/zram/zram_drv.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 78c29044684a..2907a8156aaf 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1277,11 +1277,10 @@ static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index,
1277 int offset, unsigned int op, struct bio *bio) 1277 int offset, unsigned int op, struct bio *bio)
1278{ 1278{
1279 unsigned long start_time = jiffies; 1279 unsigned long start_time = jiffies;
1280 int rw_acct = op_is_write(op) ? REQ_OP_WRITE : REQ_OP_READ;
1281 struct request_queue *q = zram->disk->queue; 1280 struct request_queue *q = zram->disk->queue;
1282 int ret; 1281 int ret;
1283 1282
1284 generic_start_io_acct(q, rw_acct, bvec->bv_len >> SECTOR_SHIFT, 1283 generic_start_io_acct(q, op, bvec->bv_len >> SECTOR_SHIFT,
1285 &zram->disk->part0); 1284 &zram->disk->part0);
1286 1285
1287 if (!op_is_write(op)) { 1286 if (!op_is_write(op)) {
@@ -1293,7 +1292,7 @@ static int zram_bvec_rw(struct zram *zram, struct bio_vec *bvec, u32 index,
1293 ret = zram_bvec_write(zram, bvec, index, offset, bio); 1292 ret = zram_bvec_write(zram, bvec, index, offset, bio);
1294 } 1293 }
1295 1294
1296 generic_end_io_acct(q, rw_acct, &zram->disk->part0, start_time); 1295 generic_end_io_acct(q, op, &zram->disk->part0, start_time);
1297 1296
1298 zram_slot_lock(zram, index); 1297 zram_slot_lock(zram, index);
1299 zram_accessed(zram, index); 1298 zram_accessed(zram, index);