aboutsummaryrefslogtreecommitdiff
path: root/drivers/md/dm-thin-metadata.c
diff options
context:
space:
mode:
authorJoe Thornber <ejt@redhat.com>2012-07-27 15:08:08 +0100
committerAlasdair G Kergon <agk@redhat.com>2012-07-27 15:08:08 +0100
commit41675aea32949786cf002c4ab179b85144d3423b (patch)
treed721f9383bc9c7614106188f12e3781fe85dc3e4 /drivers/md/dm-thin-metadata.c
parent0ac55489d9e3898987b2ae305844cf2af86e6b8d (diff)
downloadlinaro-lsk-41675aea32949786cf002c4ab179b85144d3423b.tar.gz
dm thin metadata: factor __setup_btree_details out of init_pmd
Factor __setup_btree_details out of init_pmd 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>
Diffstat (limited to 'drivers/md/dm-thin-metadata.c')
-rw-r--r--drivers/md/dm-thin-metadata.c74
1 files changed, 39 insertions, 35 deletions
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
index 31f9827dfb5..82b82c318f1 100644
--- a/drivers/md/dm-thin-metadata.c
+++ b/drivers/md/dm-thin-metadata.c
@@ -371,6 +371,44 @@ static int superblock_all_zeroes(struct dm_block_manager *bm, int *result)
return dm_bm_unlock(b);
}
+static void __setup_btree_details(struct dm_pool_metadata *pmd)
+{
+ pmd->info.tm = pmd->tm;
+ pmd->info.levels = 2;
+ pmd->info.value_type.context = pmd->data_sm;
+ pmd->info.value_type.size = sizeof(__le64);
+ pmd->info.value_type.inc = data_block_inc;
+ pmd->info.value_type.dec = data_block_dec;
+ pmd->info.value_type.equal = data_block_equal;
+
+ memcpy(&pmd->nb_info, &pmd->info, sizeof(pmd->nb_info));
+ pmd->nb_info.tm = pmd->nb_tm;
+
+ pmd->tl_info.tm = pmd->tm;
+ pmd->tl_info.levels = 1;
+ pmd->tl_info.value_type.context = &pmd->info;
+ pmd->tl_info.value_type.size = sizeof(__le64);
+ pmd->tl_info.value_type.inc = subtree_inc;
+ pmd->tl_info.value_type.dec = subtree_dec;
+ pmd->tl_info.value_type.equal = subtree_equal;
+
+ pmd->bl_info.tm = pmd->tm;
+ pmd->bl_info.levels = 1;
+ pmd->bl_info.value_type.context = pmd->data_sm;
+ pmd->bl_info.value_type.size = sizeof(__le64);
+ pmd->bl_info.value_type.inc = data_block_inc;
+ pmd->bl_info.value_type.dec = data_block_dec;
+ pmd->bl_info.value_type.equal = data_block_equal;
+
+ pmd->details_info.tm = pmd->tm;
+ pmd->details_info.levels = 1;
+ pmd->details_info.value_type.context = NULL;
+ pmd->details_info.value_type.size = sizeof(struct disk_device_details);
+ pmd->details_info.value_type.inc = NULL;
+ pmd->details_info.value_type.dec = NULL;
+ pmd->details_info.value_type.equal = NULL;
+}
+
static int init_pmd(struct dm_pool_metadata *pmd,
struct dm_block_manager *bm,
dm_block_t nr_blocks, int create)
@@ -436,41 +474,7 @@ static int init_pmd(struct dm_pool_metadata *pmd,
goto bad_data_sm;
}
- pmd->info.tm = tm;
- pmd->info.levels = 2;
- pmd->info.value_type.context = pmd->data_sm;
- pmd->info.value_type.size = sizeof(__le64);
- pmd->info.value_type.inc = data_block_inc;
- pmd->info.value_type.dec = data_block_dec;
- pmd->info.value_type.equal = data_block_equal;
-
- memcpy(&pmd->nb_info, &pmd->info, sizeof(pmd->nb_info));
- pmd->nb_info.tm = pmd->nb_tm;
-
- pmd->tl_info.tm = tm;
- pmd->tl_info.levels = 1;
- pmd->tl_info.value_type.context = &pmd->info;
- pmd->tl_info.value_type.size = sizeof(__le64);
- pmd->tl_info.value_type.inc = subtree_inc;
- pmd->tl_info.value_type.dec = subtree_dec;
- pmd->tl_info.value_type.equal = subtree_equal;
-
- pmd->bl_info.tm = tm;
- pmd->bl_info.levels = 1;
- pmd->bl_info.value_type.context = pmd->data_sm;
- pmd->bl_info.value_type.size = sizeof(__le64);
- pmd->bl_info.value_type.inc = data_block_inc;
- pmd->bl_info.value_type.dec = data_block_dec;
- pmd->bl_info.value_type.equal = data_block_equal;
-
- pmd->details_info.tm = tm;
- pmd->details_info.levels = 1;
- pmd->details_info.value_type.context = NULL;
- pmd->details_info.value_type.size = sizeof(struct disk_device_details);
- pmd->details_info.value_type.inc = NULL;
- pmd->details_info.value_type.dec = NULL;
- pmd->details_info.value_type.equal = NULL;
-
+ __setup_btree_details(pmd);
pmd->root = 0;
init_rwsem(&pmd->root_lock);