From 270938bac53b03b83b4b0b65b760f32975df72b1 Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Fri, 27 Jul 2012 15:08:11 +0100 Subject: [PATCH] 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 Signed-off-by: Mike Snitzer Signed-off-by: Alasdair G Kergon --- drivers/md/dm-thin-metadata.c | 19 ++++++------------- 1 file 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) pmd->details_info.value_type.equal = NULL; } -static int __begin_transaction(struct dm_pool_metadata *pmd); static int __write_initial_superblock(struct dm_pool_metadata *pmd) { int r; @@ -478,11 +477,7 @@ static int __write_initial_superblock(struct dm_pool_metadata *pmd) disk_super->metadata_nr_blocks = cpu_to_le64(bdev_size >> SECTOR_TO_BLOCK_SHIFT); disk_super->data_block_size = cpu_to_le32(pmd->data_block_size); - r = dm_tm_commit(pmd->tm, sblock); - if (r) - return r; - - return __begin_transaction(pmd); + return dm_tm_commit(pmd->tm, sblock); bad_locked: dm_bm_unlock(sblock); @@ -800,13 +795,11 @@ struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev, return ERR_PTR(r); } - if (!create) { - r = __begin_transaction(pmd); - if (r < 0) { - if (dm_pool_metadata_close(pmd) < 0) - DMWARN("%s: dm_pool_metadata_close() failed.", __func__); - return ERR_PTR(r); - } + r = __begin_transaction(pmd); + if (r < 0) { + if (dm_pool_metadata_close(pmd) < 0) + DMWARN("%s: dm_pool_metadata_close() failed.", __func__); + return ERR_PTR(r); } return pmd; -- 2.39.5