Commit deb71918 authored by Joe Thornber's avatar Joe Thornber Committed by Mike Snitzer

dm cache policy smq: take origin idle status into account when queuing writebacks

If the origin device is idle try and writeback more data.
Signed-off-by: default avatarJoe Thornber <ejt@redhat.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
parent 1e72a8e8
...@@ -1158,13 +1158,13 @@ static void clear_pending(struct smq_policy *mq, struct entry *e) ...@@ -1158,13 +1158,13 @@ static void clear_pending(struct smq_policy *mq, struct entry *e)
e->pending_work = false; e->pending_work = false;
} }
static void queue_writeback(struct smq_policy *mq) static void queue_writeback(struct smq_policy *mq, bool idle)
{ {
int r; int r;
struct policy_work work; struct policy_work work;
struct entry *e; struct entry *e;
e = q_peek(&mq->dirty, mq->dirty.nr_levels, !mq->migrations_allowed); e = q_peek(&mq->dirty, mq->dirty.nr_levels, idle);
if (e) { if (e) {
mark_pending(mq, e); mark_pending(mq, e);
q_del(&mq->dirty, e); q_del(&mq->dirty, e);
...@@ -1193,7 +1193,7 @@ static void queue_demotion(struct smq_policy *mq) ...@@ -1193,7 +1193,7 @@ static void queue_demotion(struct smq_policy *mq)
e = q_peek(&mq->clean, mq->clean.nr_levels / 2, true); e = q_peek(&mq->clean, mq->clean.nr_levels / 2, true);
if (!e) { if (!e) {
if (!clean_target_met(mq, true)) if (!clean_target_met(mq, true))
queue_writeback(mq); queue_writeback(mq, false);
return; return;
} }
...@@ -1429,7 +1429,7 @@ static int smq_get_background_work(struct dm_cache_policy *p, bool idle, ...@@ -1429,7 +1429,7 @@ static int smq_get_background_work(struct dm_cache_policy *p, bool idle,
r = btracker_issue(mq->bg_work, result); r = btracker_issue(mq->bg_work, result);
if (r == -ENODATA) { if (r == -ENODATA) {
if (!clean_target_met(mq, idle)) { if (!clean_target_met(mq, idle)) {
queue_writeback(mq); queue_writeback(mq, idle);
r = btracker_issue(mq->bg_work, result); r = btracker_issue(mq->bg_work, result);
} }
} }
......
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