aboutsummaryrefslogtreecommitdiffstats
path: root/block/blk-wbt.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2018-02-05 15:16:56 -0500
committerJens Axboe <axboe@kernel.dk>2018-02-06 16:14:03 -0500
commit5235553d821433e1f4fa720fd025d2c4b7ee9994 (patch)
treeffb33398840277a538332805a98b0d8c376152c1 /block/blk-wbt.c
parent68c5735eaa5e680e701c9a2d1e3c7880bdf5ab66 (diff)
blk-wbt: account flush requests correctly
Mikulas reported a workload that saw bad performance, and figured out what it was due to various other types of requests being accounted as reads. Flush requests, for instance. Due to the high latency of those, we heavily throttle the writes to keep the latencies in balance. But they really should be accounted as writes. Fix this by checking the exact type of the request. If it's a read, account as a read, if it's a write or a flush, account as a write. Any other request we disregard. Previously everything would have been mistakenly accounted as reads. Reported-by: Mikulas Patocka <mpatocka@redhat.com> Cc: stable@vger.kernel.org # v4.12+ Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/blk-wbt.c')
-rw-r--r--block/blk-wbt.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index ae8de9780085..f92fc84b5e2c 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -697,7 +697,15 @@ u64 wbt_default_latency_nsec(struct request_queue *q)
697 697
698static int wbt_data_dir(const struct request *rq) 698static int wbt_data_dir(const struct request *rq)
699{ 699{
700 return rq_data_dir(rq); 700 const int op = req_op(rq);
701
702 if (op == REQ_OP_READ)
703 return READ;
704 else if (op == REQ_OP_WRITE || op == REQ_OP_FLUSH)
705 return WRITE;
706
707 /* don't account */
708 return -1;
701} 709}
702 710
703int wbt_init(struct request_queue *q) 711int wbt_init(struct request_queue *q)