dm thin: cleanup schedule_zero() to read more logically
authorMike Snitzer <snitzer@redhat.com>
Thu, 14 May 2015 15:28:37 +0000 (11:28 -0400)
committerMike Snitzer <snitzer@redhat.com>
Fri, 29 May 2015 18:18:58 +0000 (14:18 -0400)
The overwrite has only ever about optimizing away the need to zero a
block if the entire block was being overwritten.  As such it is only
relevant when zeroing is enabled.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Joe Thornber <ejt@redhat.com>
drivers/md/dm-thin.c

index c0fbb6c306b2c4e6f8e9c5c8ce4e6385a88dcd5d..c552df7b342086f1fadc142338fe441d1c091a2c 100644 (file)
@@ -1086,16 +1086,14 @@ static void schedule_zero(struct thin_c *tc, dm_block_t virt_block,
         * zeroing pre-existing data, we can issue the bio immediately.
         * Otherwise we use kcopyd to zero the data first.
         */
-       if (!pool->pf.zero_new_blocks)
+       if (pool->pf.zero_new_blocks) {
+               if (io_overwrites_block(pool, bio))
+                       remap_and_issue_overwrite(tc, bio, data_block, m);
+               else
+                       ll_zero(tc, m, data_block * pool->sectors_per_block,
+                               (data_block + 1) * pool->sectors_per_block);
+       } else
                process_prepared_mapping(m);
-
-       else if (io_overwrites_block(pool, bio))
-               remap_and_issue_overwrite(tc, bio, data_block, m);
-
-       else
-               ll_zero(tc, m,
-                       data_block * pool->sectors_per_block,
-                       (data_block + 1) * pool->sectors_per_block);
 }
 
 static void schedule_external_copy(struct thin_c *tc, dm_block_t virt_block,