]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
dm cache policy smq: take origin idle status into account when queuing writebacks
authorJoe Thornber <ejt@redhat.com>
Wed, 8 Nov 2017 11:09:38 +0000 (06:09 -0500)
committerMike Snitzer <snitzer@redhat.com>
Fri, 10 Nov 2017 20:45:02 +0000 (15:45 -0500)
If the origin device is idle try and writeback more data.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-cache-policy-smq.c

index 42e5c4b5988926461eaef613ba6eea92666ff768..99fae819a0e7d01893efb16fdcab22466119d351 100644 (file)
@@ -1158,13 +1158,13 @@ static void clear_pending(struct smq_policy *mq, struct entry *e)
        e->pending_work = false;
 }
 
-static void queue_writeback(struct smq_policy *mq)
+static void queue_writeback(struct smq_policy *mq, bool idle)
 {
        int r;
        struct policy_work work;
        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) {
                mark_pending(mq, e);
                q_del(&mq->dirty, e);
@@ -1193,7 +1193,7 @@ static void queue_demotion(struct smq_policy *mq)
        e = q_peek(&mq->clean, mq->clean.nr_levels / 2, true);
        if (!e) {
                if (!clean_target_met(mq, true))
-                       queue_writeback(mq);
+                       queue_writeback(mq, false);
                return;
        }
 
@@ -1429,7 +1429,7 @@ static int smq_get_background_work(struct dm_cache_policy *p, bool idle,
        r = btracker_issue(mq->bg_work, result);
        if (r == -ENODATA) {
                if (!clean_target_met(mq, idle)) {
-                       queue_writeback(mq);
+                       queue_writeback(mq, idle);
                        r = btracker_issue(mq->bg_work, result);
                }
        }