提交 270938ba 编写于 作者: J Joe Thornber 提交者: Alasdair G Kergon

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: NJoe Thornber <ejt@redhat.com>
Signed-off-by: NMike Snitzer <snitzer@redhat.com>
Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
上级 10d2a9ff
...@@ -422,7 +422,6 @@ static void __setup_btree_details(struct dm_pool_metadata *pmd) ...@@ -422,7 +422,6 @@ static void __setup_btree_details(struct dm_pool_metadata *pmd)
pmd->details_info.value_type.equal = NULL; 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) static int __write_initial_superblock(struct dm_pool_metadata *pmd)
{ {
int r; int r;
...@@ -478,11 +477,7 @@ static int __write_initial_superblock(struct dm_pool_metadata *pmd) ...@@ -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->metadata_nr_blocks = cpu_to_le64(bdev_size >> SECTOR_TO_BLOCK_SHIFT);
disk_super->data_block_size = cpu_to_le32(pmd->data_block_size); disk_super->data_block_size = cpu_to_le32(pmd->data_block_size);
r = dm_tm_commit(pmd->tm, sblock); return dm_tm_commit(pmd->tm, sblock);
if (r)
return r;
return __begin_transaction(pmd);
bad_locked: bad_locked:
dm_bm_unlock(sblock); dm_bm_unlock(sblock);
...@@ -800,13 +795,11 @@ struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev, ...@@ -800,13 +795,11 @@ struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev,
return ERR_PTR(r); return ERR_PTR(r);
} }
if (!create) { r = __begin_transaction(pmd);
r = __begin_transaction(pmd); if (r < 0) {
if (r < 0) { if (dm_pool_metadata_close(pmd) < 0)
if (dm_pool_metadata_close(pmd) < 0) DMWARN("%s: dm_pool_metadata_close() failed.", __func__);
DMWARN("%s: dm_pool_metadata_close() failed.", __func__); return ERR_PTR(r);
return ERR_PTR(r);
}
} }
return pmd; return pmd;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册