diff options
| author | Joe Thornber <ejt@redhat.com> | 2017-11-08 06:09:38 -0500 |
|---|---|---|
| committer | Mike Snitzer <snitzer@redhat.com> | 2017-11-10 15:45:02 -0500 |
| commit | deb71918ae29e23ff7f4537f5ff654f8b6580af2 (patch) | |
| tree | 8c43506f892804b4ebc3cf004ae2b9e19ea29b1b | |
| parent | 1e72a8e809f030bd4e318a49c497ee38e47e82c1 (diff) | |
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: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
| -rw-r--r-- | drivers/md/dm-cache-policy-smq.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/md/dm-cache-policy-smq.c b/drivers/md/dm-cache-policy-smq.c index 42e5c4b59889..99fae819a0e7 100644 --- a/drivers/md/dm-cache-policy-smq.c +++ b/drivers/md/dm-cache-policy-smq.c | |||
| @@ -1158,13 +1158,13 @@ static void clear_pending(struct smq_policy *mq, struct entry *e) | |||
| 1158 | e->pending_work = false; | 1158 | e->pending_work = false; |
| 1159 | } | 1159 | } |
| 1160 | 1160 | ||
| 1161 | static void queue_writeback(struct smq_policy *mq) | 1161 | static void queue_writeback(struct smq_policy *mq, bool idle) |
| 1162 | { | 1162 | { |
| 1163 | int r; | 1163 | int r; |
| 1164 | struct policy_work work; | 1164 | struct policy_work work; |
| 1165 | struct entry *e; | 1165 | struct entry *e; |
| 1166 | 1166 | ||
| 1167 | e = q_peek(&mq->dirty, mq->dirty.nr_levels, !mq->migrations_allowed); | 1167 | e = q_peek(&mq->dirty, mq->dirty.nr_levels, idle); |
| 1168 | if (e) { | 1168 | if (e) { |
| 1169 | mark_pending(mq, e); | 1169 | mark_pending(mq, e); |
| 1170 | q_del(&mq->dirty, e); | 1170 | q_del(&mq->dirty, e); |
| @@ -1193,7 +1193,7 @@ static void queue_demotion(struct smq_policy *mq) | |||
| 1193 | e = q_peek(&mq->clean, mq->clean.nr_levels / 2, true); | 1193 | e = q_peek(&mq->clean, mq->clean.nr_levels / 2, true); |
| 1194 | if (!e) { | 1194 | if (!e) { |
| 1195 | if (!clean_target_met(mq, true)) | 1195 | if (!clean_target_met(mq, true)) |
| 1196 | queue_writeback(mq); | 1196 | queue_writeback(mq, false); |
| 1197 | return; | 1197 | return; |
| 1198 | } | 1198 | } |
| 1199 | 1199 | ||
| @@ -1429,7 +1429,7 @@ static int smq_get_background_work(struct dm_cache_policy *p, bool idle, | |||
| 1429 | r = btracker_issue(mq->bg_work, result); | 1429 | r = btracker_issue(mq->bg_work, result); |
| 1430 | if (r == -ENODATA) { | 1430 | if (r == -ENODATA) { |
| 1431 | if (!clean_target_met(mq, idle)) { | 1431 | if (!clean_target_met(mq, idle)) { |
| 1432 | queue_writeback(mq); | 1432 | queue_writeback(mq, idle); |
| 1433 | r = btracker_issue(mq->bg_work, result); | 1433 | r = btracker_issue(mq->bg_work, result); |
| 1434 | } | 1434 | } |
| 1435 | } | 1435 | } |
