提交 e782eff5 编写于 作者: M Mike Snitzer

dm cache: avoid preallocation if no work in writeback_some_dirty_blocks()

Refactor writeback_some_dirty_blocks() to avoid prealloc_data_structs()
if the policy doesn't have any dirty blocks ready for writeback.
Signed-off-by: NMike Snitzer <snitzer@redhat.com>
上级 386cb7cd
...@@ -2061,7 +2061,6 @@ static void process_deferred_writethrough_bios(struct cache *cache) ...@@ -2061,7 +2061,6 @@ static void process_deferred_writethrough_bios(struct cache *cache)
static void writeback_some_dirty_blocks(struct cache *cache) static void writeback_some_dirty_blocks(struct cache *cache)
{ {
int r = 0;
dm_oblock_t oblock; dm_oblock_t oblock;
dm_cblock_t cblock; dm_cblock_t cblock;
struct prealloc structs; struct prealloc structs;
...@@ -2071,15 +2070,11 @@ static void writeback_some_dirty_blocks(struct cache *cache) ...@@ -2071,15 +2070,11 @@ static void writeback_some_dirty_blocks(struct cache *cache)
memset(&structs, 0, sizeof(structs)); memset(&structs, 0, sizeof(structs));
while (spare_migration_bandwidth(cache)) { while (spare_migration_bandwidth(cache)) {
if (prealloc_data_structs(cache, &structs)) if (policy_writeback_work(cache->policy, &oblock, &cblock, busy))
break; break; /* no work to do */
r = policy_writeback_work(cache->policy, &oblock, &cblock, busy);
if (r)
break;
r = get_cell(cache, oblock, &structs, &old_ocell); if (prealloc_data_structs(cache, &structs) ||
if (r) { get_cell(cache, oblock, &structs, &old_ocell)) {
policy_set_dirty(cache->policy, oblock); policy_set_dirty(cache->policy, oblock);
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册