提交 ffcbcb67 编写于 作者: H Heinz Mauelshagen 提交者: Mike Snitzer

dm cache: optimize commit_if_needed

Check commit_requested flag _before_ calling
dm_cache_changed_this_transaction() superfluously.

Also, be sure to set last_commit_jiffies _after_ dm_cache_commit()
completes.
Signed-off-by: NHeinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: NJoe Thornber <ejt@redhat.com>
Signed-off-by: NMike Snitzer <snitzer@redhat.com>
上级 40c57f47
......@@ -1234,15 +1234,17 @@ static int need_commit_due_to_time(struct cache *cache)
static int commit_if_needed(struct cache *cache)
{
if (dm_cache_changed_this_transaction(cache->cmd) &&
(cache->commit_requested || need_commit_due_to_time(cache))) {
int r = 0;
if ((cache->commit_requested || need_commit_due_to_time(cache)) &&
dm_cache_changed_this_transaction(cache->cmd)) {
atomic_inc(&cache->stats.commit_count);
cache->last_commit_jiffies = jiffies;
cache->commit_requested = false;
return dm_cache_commit(cache->cmd, false);
r = dm_cache_commit(cache->cmd, false);
cache->last_commit_jiffies = jiffies;
}
return 0;
return r;
}
static void process_deferred_bios(struct cache *cache)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册