]> git.hungrycats.org Git - linux/commitdiff
dm cache: only use overwrite optimisation for promotion when in writeback mode
authorJoe Thornber <ejt@redhat.com>
Thu, 27 Nov 2014 12:21:08 +0000 (12:21 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2015 18:30:18 +0000 (10:30 -0800)
commit f29a3147e251d7ae20d3194ff67f109d71e501b4 upstream.

Overwrite causes the cache block and origin blocks to diverge, which
is only allowed in writeback mode.

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-cache-target.c

index 7130505c242550f3321448094e5b110987ca5969..6f7086355691febd147a8850cea8e5f3fb5ab36d 100644 (file)
@@ -1070,7 +1070,8 @@ static void issue_copy(struct dm_cache_migration *mg)
 
                avoid = is_discarded_oblock(cache, mg->new_oblock);
 
-               if (!avoid && bio_writes_complete_block(cache, bio)) {
+               if (writeback_mode(&cache->features) &&
+                   !avoid && bio_writes_complete_block(cache, bio)) {
                        issue_overwrite(mg, bio);
                        return;
                }