summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2018-02-05 13:16:56 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-02-22 15:40:08 +0100
commitb5291a94daab104620a3be0b72fe1d7d493550f9 (patch)
treebef03bf7fa832aeee98858501218424a6c146780 /block
parentd301a3f8ab111db3ff1e257e7d953a5cdb85d445 (diff)
downloadlinux-b5291a94daab104620a3be0b72fe1d7d493550f9.tar.gz
linux-b5291a94daab104620a3be0b72fe1d7d493550f9.tar.bz2
linux-b5291a94daab104620a3be0b72fe1d7d493550f9.zip
blk-wbt: account flush requests correctly
commit 5235553d821433e1f4fa720fd025d2c4b7ee9994 upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'block')
-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)
static int wbt_data_dir(const struct request *rq)
{
- return rq_data_dir(rq);
+ const int op = req_op(rq);
+
+ if (op == REQ_OP_READ)
+ return READ;
+ else if (op == REQ_OP_WRITE || op == REQ_OP_FLUSH)
+ return WRITE;
+
+ /* don't account */
+ return -1;
}
int wbt_init(struct request_queue *q)