]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Move the check for __superblock_all_zeroes from
authorJoe Thornber <ejt@redhat.com>
Tue, 24 Jul 2012 23:25:29 +0000 (09:25 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 24 Jul 2012 23:25:29 +0000 (09:25 +1000)
__create_persistent_data_objects() down to __open_or_format_metadata in
dm-thin-metadata.

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

index 83ce2fde8ed7e93f53c18b4b0076d38d1dd33cdb..e7b8ad78af4724fb872bc4346b17cbf1988c0f51 100644 (file)
@@ -596,9 +596,15 @@ bad:
 }
 
 static int __open_or_format_metadata(struct dm_pool_metadata *pmd,
-                                    int create)
+                                    int *create)
 {
-       if (create)
+       int r;
+
+       r = __superblock_all_zeroes(pmd->bm, create);
+       if (r)
+               return r;
+
+       if (*create)
                return __format_metadata(pmd);
        else
                return __open_metadata(pmd);
@@ -617,13 +623,7 @@ static int __create_persistent_data_objects(struct dm_pool_metadata *pmd,
                return PTR_ERR(pmd->bm);
        }
 
-       r = __superblock_all_zeroes(pmd->bm, create);
-       if (r) {
-               dm_block_manager_destroy(pmd->bm);
-               return r;
-       }
-
-       r = __open_or_format_metadata(pmd, *create);
+       r = __open_or_format_metadata(pmd, create);
        if (r)
                dm_block_manager_destroy(pmd->bm);