From: Joe Thornber Date: Fri, 27 Jul 2012 14:08:10 +0000 (+0100) Subject: dm thin metadata: lift some initialisation out of __open_or_format_metadata X-Git-Tag: firefly_0821_release~3680^2~2312^2~20 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6a0ebd31b6b504621254f5d453d618d36b0179a1;p=firefly-linux-kernel-4.4.55.git dm thin metadata: lift some initialisation out of __open_or_format_metadata Lift some initialisation out of __open_or_format_metadata in dm-thin-metadata. Signed-off-by: Joe Thornber Signed-off-by: Mike Snitzer Signed-off-by: Alasdair G Kergon --- diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index b646a71f6da9..ce487aada0d8 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c @@ -489,14 +489,11 @@ static int __open_or_format_metadata(struct dm_pool_metadata *pmd, } __setup_btree_details(pmd); - pmd->root = 0; - init_rwsem(&pmd->root_lock); - pmd->time = 0; + pmd->root = 0; pmd->details_root = 0; pmd->trans_id = 0; pmd->flags = 0; - INIT_LIST_HEAD(&pmd->thin_devices); return 0; @@ -710,6 +707,9 @@ struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev, return ERR_PTR(-ENOMEM); } + init_rwsem(&pmd->root_lock); + pmd->time = 0; + INIT_LIST_HEAD(&pmd->thin_devices); pmd->bdev = bdev; r = __create_persistent_data_objects(pmd, 0, &create);