Skip to content

Commit

Permalink
blk-wbt: account flush requests correctly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jens Axboe committed Feb 6, 2018
1 parent 68c5735 commit 5235553
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion block/blk-wbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5235553

Please sign in to comment.