summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorSong Liu <songliubraving@fb.com>2016-11-30 16:57:54 -0800
committerShaohua Li <shli@fb.com>2016-12-02 12:03:52 -0800
commitf687a33ef02d3e0f13c4fa9e3b2e90f656bbfb26 (patch)
treed99bd62ff9389999b1e380087db5534b89e46f46 /drivers/md
parente8d7c33232e5fdfa761c3416539bc5b4acd12db5 (diff)
md/r5cache: run_no_space_stripes() when R5C_LOG_CRITICAL == 0
With writeback cache, we define log space critical as free_space < 2 * reclaim_required_space So the deassert of R5C_LOG_CRITICAL could happen when 1. free_space increases 2. reclaim_required_space decreases Currently, run_no_space_stripes() is called when 1 happens, but not (always) when 2 happens. With this patch, run_no_space_stripes() is call when R5C_LOG_CRITICAL is cleared. Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid5-cache.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c
index e786d4e555cc..c36f86b47252 100644
--- a/drivers/md/raid5-cache.c
+++ b/drivers/md/raid5-cache.c
@@ -370,6 +370,7 @@ static inline void r5c_update_log_state(struct r5l_log *log)
struct r5conf *conf = log->rdev->mddev->private;
sector_t free_space;
sector_t reclaim_space;
+ bool wake_reclaim = false;
if (!r5c_is_writeback(log))
return;
@@ -379,12 +380,18 @@ static inline void r5c_update_log_state(struct r5l_log *log)
reclaim_space = r5c_log_required_to_flush_cache(conf);
if (free_space < 2 * reclaim_space)
set_bit(R5C_LOG_CRITICAL, &conf->cache_state);
- else
+ else {
+ if (test_bit(R5C_LOG_CRITICAL, &conf->cache_state))
+ wake_reclaim = true;
clear_bit(R5C_LOG_CRITICAL, &conf->cache_state);
+ }
if (free_space < 3 * reclaim_space)
set_bit(R5C_LOG_TIGHT, &conf->cache_state);
else
clear_bit(R5C_LOG_TIGHT, &conf->cache_state);
+
+ if (wake_reclaim)
+ r5l_wake_reclaim(log, 0);
}
/*
@@ -1345,6 +1352,10 @@ static void r5c_do_reclaim(struct r5conf *conf)
spin_unlock(&conf->device_lock);
spin_unlock_irqrestore(&log->stripe_in_journal_lock, flags);
}
+
+ if (!test_bit(R5C_LOG_CRITICAL, &conf->cache_state))
+ r5l_run_no_space_stripes(log);
+
md_wakeup_thread(conf->mddev->thread);
}
@@ -2401,6 +2412,7 @@ void r5c_finish_stripe_write_out(struct r5conf *conf,
spin_unlock_irq(&conf->log->stripe_in_journal_lock);
sh->log_start = MaxSector;
atomic_dec(&conf->log->stripe_in_journal_count);
+ r5c_update_log_state(conf->log);
}
int