aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-thin-metadata.c
diff options
context:
space:
mode:
authorJoe Thornber <ejt@redhat.com>2013-05-10 09:37:18 -0400
committerAlasdair G Kergon <agk@redhat.com>2013-05-10 09:37:18 -0400
commitb17446df2ebcaf32889376d90f4b9b2baebb2db6 (patch)
tree53d98c3dcb15542d90a6e39c5373a5ab41d47c02 /drivers/md/dm-thin-metadata.c
parent8c5008fac4af85c7a597c4e7f2c328ac90652bc2 (diff)
dm thin: refactor data dev resize
Refactor device size functions in preparation for similar metadata device resizing functions. Signed-off-by: Joe Thornber <ejt@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.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c
index 00cee02f8fc9..9452a489ed99 100644
--- a/drivers/md/dm-thin-metadata.c
+++ b/drivers/md/dm-thin-metadata.c
@@ -1645,12 +1645,12 @@ int dm_thin_get_highest_mapped_block(struct dm_thin_device *td,
1645 return r; 1645 return r;
1646} 1646}
1647 1647
1648static int __resize_data_dev(struct dm_pool_metadata *pmd, dm_block_t new_count) 1648static int __resize_space_map(struct dm_space_map *sm, dm_block_t new_count)
1649{ 1649{
1650 int r; 1650 int r;
1651 dm_block_t old_count; 1651 dm_block_t old_count;
1652 1652
1653 r = dm_sm_get_nr_blocks(pmd->data_sm, &old_count); 1653 r = dm_sm_get_nr_blocks(sm, &old_count);
1654 if (r) 1654 if (r)
1655 return r; 1655 return r;
1656 1656
@@ -1658,11 +1658,11 @@ static int __resize_data_dev(struct dm_pool_metadata *pmd, dm_block_t new_count)
1658 return 0; 1658 return 0;
1659 1659
1660 if (new_count < old_count) { 1660 if (new_count < old_count) {
1661 DMERR("cannot reduce size of data device"); 1661 DMERR("cannot reduce size of space map");
1662 return -EINVAL; 1662 return -EINVAL;
1663 } 1663 }
1664 1664
1665 return dm_sm_extend(pmd->data_sm, new_count - old_count); 1665 return dm_sm_extend(sm, new_count - old_count);
1666} 1666}
1667 1667
1668int dm_pool_resize_data_dev(struct dm_pool_metadata *pmd, dm_block_t new_count) 1668int dm_pool_resize_data_dev(struct dm_pool_metadata *pmd, dm_block_t new_count)
@@ -1671,7 +1671,7 @@ int dm_pool_resize_data_dev(struct dm_pool_metadata *pmd, dm_block_t new_count)
1671 1671
1672 down_write(&pmd->root_lock); 1672 down_write(&pmd->root_lock);
1673 if (!pmd->fail_io) 1673 if (!pmd->fail_io)
1674 r = __resize_data_dev(pmd, new_count); 1674 r = __resize_space_map(pmd->data_sm, new_count);
1675 up_write(&pmd->root_lock); 1675 up_write(&pmd->root_lock);
1676 1676
1677 return r; 1677 return r;