Commit ff4cee08 authored by Josef Bacik's avatar Josef Bacik Committed by Jens Axboe

blk-iolatency: use q->nr_requests directly

We were using blk_queue_depth() assuming that it would return
nr_requests, but we hit a case in production on drives that had to have
NCQ turned off in order for them to not shit the bed which resulted in a
qd of 1, even though the nr_requests was much larger.  iolatency really
only cares about requests we are allowed to queue up, as any io that
get's onto the request list is going to be serviced soonish, so we want
to be throttling before the bio gets onto the request list.  To make
iolatency work as expected, simply use q->nr_requests instead of
blk_queue_depth() as that is what we actually care about.
Signed-off-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent f0a0cddd
...@@ -255,7 +255,7 @@ static void scale_cookie_change(struct blk_iolatency *blkiolat, ...@@ -255,7 +255,7 @@ static void scale_cookie_change(struct blk_iolatency *blkiolat,
struct child_latency_info *lat_info, struct child_latency_info *lat_info,
bool up) bool up)
{ {
unsigned long qd = blk_queue_depth(blkiolat->rqos.q); unsigned long qd = blkiolat->rqos.q->nr_requests;
unsigned long scale = scale_amount(qd, up); unsigned long scale = scale_amount(qd, up);
unsigned long old = atomic_read(&lat_info->scale_cookie); unsigned long old = atomic_read(&lat_info->scale_cookie);
unsigned long max_scale = qd << 1; unsigned long max_scale = qd << 1;
...@@ -295,7 +295,7 @@ static void scale_cookie_change(struct blk_iolatency *blkiolat, ...@@ -295,7 +295,7 @@ static void scale_cookie_change(struct blk_iolatency *blkiolat,
*/ */
static void scale_change(struct iolatency_grp *iolat, bool up) static void scale_change(struct iolatency_grp *iolat, bool up)
{ {
unsigned long qd = blk_queue_depth(iolat->blkiolat->rqos.q); unsigned long qd = iolat->blkiolat->rqos.q->nr_requests;
unsigned long scale = scale_amount(qd, up); unsigned long scale = scale_amount(qd, up);
unsigned long old = iolat->rq_depth.max_depth; unsigned long old = iolat->rq_depth.max_depth;
...@@ -857,7 +857,7 @@ static void iolatency_pd_init(struct blkg_policy_data *pd) ...@@ -857,7 +857,7 @@ static void iolatency_pd_init(struct blkg_policy_data *pd)
rq_wait_init(&iolat->rq_wait); rq_wait_init(&iolat->rq_wait);
spin_lock_init(&iolat->child_lat.lock); spin_lock_init(&iolat->child_lat.lock);
iolat->rq_depth.queue_depth = blk_queue_depth(blkg->q); iolat->rq_depth.queue_depth = blkg->q->nr_requests;
iolat->rq_depth.max_depth = UINT_MAX; iolat->rq_depth.max_depth = UINT_MAX;
iolat->rq_depth.default_depth = iolat->rq_depth.queue_depth; iolat->rq_depth.default_depth = iolat->rq_depth.queue_depth;
iolat->blkiolat = blkiolat; iolat->blkiolat = blkiolat;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment