aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-thin-metadata.c
diff options
context:
space:
mode:
authorJoe Thornber <ejt@redhat.com>2012-07-27 10:08:11 -0400
committerAlasdair G Kergon <agk@redhat.com>2012-07-27 10:08:11 -0400
commit270938bac53b03b83b4b0b65b760f32975df72b1 (patch)
treebee95595b9ada2de4e7a0d132ef4928ccc4dc263 /drivers/md/dm-thin-metadata.c
parent10d2a9ff7c37635619c4d03ca672ffbd58b9c3fa (diff)
dm thin metadata: lift __begin_transaction out of __write_initial_superblock
Lift the call to __begin_transaction out of __write_initial_superblock in dm-thin-metadata. Called higher up the call chain now. 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>
Diffstat (limited to 'drivers/md/dm-thin-metadata.c')
-rw-r--r--drivers/md/dm-thin-metadata.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
index 2c44c5c10987..934b3fc7bfc9 100644
--- a/drivers/md/dm-thin-metadata.c
+++ b/drivers/md/dm-thin-metadata.c
@@ -422,7 +422,6 @@ static void __setup_btree_details(struct dm_pool_metadata *pmd)
422 pmd->details_info.value_type.equal = NULL; 422 pmd->details_info.value_type.equal = NULL;
423} 423}
424 424
425static int __begin_transaction(struct dm_pool_metadata *pmd);
426static int __write_initial_superblock(struct dm_pool_metadata *pmd) 425static int __write_initial_superblock(struct dm_pool_metadata *pmd)
427{ 426{
428 int r; 427 int r;
@@ -478,11 +477,7 @@ static int __write_initial_superblock(struct dm_pool_metadata *pmd)
478 disk_super->metadata_nr_blocks = cpu_to_le64(bdev_size >> SECTOR_TO_BLOCK_SHIFT); 477 disk_super->metadata_nr_blocks = cpu_to_le64(bdev_size >> SECTOR_TO_BLOCK_SHIFT);
479 disk_super->data_block_size = cpu_to_le32(pmd->data_block_size); 478 disk_super->data_block_size = cpu_to_le32(pmd->data_block_size);
480 479
481 r = dm_tm_commit(pmd->tm, sblock); 480 return dm_tm_commit(pmd->tm, sblock);
482 if (r)
483 return r;
484
485 return __begin_transaction(pmd);
486 481
487bad_locked: 482bad_locked:
488 dm_bm_unlock(sblock); 483 dm_bm_unlock(sblock);
@@ -800,13 +795,11 @@ struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev,
800 return ERR_PTR(r); 795 return ERR_PTR(r);
801 } 796 }
802 797
803 if (!create) { 798 r = __begin_transaction(pmd);
804 r = __begin_transaction(pmd); 799 if (r < 0) {
805 if (r < 0) { 800 if (dm_pool_metadata_close(pmd) < 0)
806 if (dm_pool_metadata_close(pmd) < 0) 801 DMWARN("%s: dm_pool_metadata_close() failed.", __func__);
807 DMWARN("%s: dm_pool_metadata_close() failed.", __func__); 802 return ERR_PTR(r);
808 return ERR_PTR(r);
809 }
810 } 803 }
811 804
812 return pmd; 805 return pmd;