1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Support 16GB for thin pool metadata

Add some hack math to allow 16GB devices to be passed as thinpool metadata.
Since kernel has put in limit to not allow which are just bigger then
some predefined constant in kernel but not matching 16GB so any device bigger
is rejected.

FIXME: Current code still might need more tweaks to be more generic.
This commit is contained in:
Zdenek Kabelac 2012-03-02 21:53:17 +00:00
parent ffe898ca9f
commit 7162a25b0b

View File

@ -2968,7 +2968,15 @@ int dm_tree_node_add_thin_pool_target(struct dm_tree_node *node,
uint64_t low_water_mark, uint64_t low_water_mark,
unsigned skip_block_zeroing) unsigned skip_block_zeroing)
{ {
struct load_segment *seg; struct load_segment *seg, *mseg;
uint64_t devsize = 0;
/*
* Max supported size for thin pool metadata device
* Limitation is hardcoded into kernel and bigger
* device size is not accepted. (16978542592)
*/
const uint64_t max_metadata_size =
255ULL * (1 << 14) * (4096 / (1 << 9)) - 256 * 1024;
if (data_block_size < DM_THIN_MIN_DATA_BLOCK_SIZE) { if (data_block_size < DM_THIN_MIN_DATA_BLOCK_SIZE) {
log_error("Data block size %u is lower then %u sectors.", log_error("Data block size %u is lower then %u sectors.",
@ -2993,6 +3001,18 @@ int dm_tree_node_add_thin_pool_target(struct dm_tree_node *node,
if (!_link_tree_nodes(node, seg->metadata)) if (!_link_tree_nodes(node, seg->metadata))
return_0; return_0;
/* FIXME: more complex target may need more tweaks */
dm_list_iterate_items(mseg, &seg->metadata->props.segs) {
devsize += mseg->size;
if (devsize > max_metadata_size) {
log_debug("Ignoring %" PRIu64 " of device.",
devsize - max_metadata_size);
mseg->size -= (devsize - max_metadata_size);
devsize = max_metadata_size;
/* FIXME: drop remaining segs */
}
}
if (!(seg->pool = dm_tree_find_node_by_uuid(node->dtree, pool_uuid))) { if (!(seg->pool = dm_tree_find_node_by_uuid(node->dtree, pool_uuid))) {
log_error("Missing pool uuid %s.", pool_uuid); log_error("Missing pool uuid %s.", pool_uuid);
return 0; return 0;