diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index 147a785..12c1a87 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -98,8 +98,8 @@ def single_mapping(from, to = 4711) " \n" end -def range_mapping(mapping, length) - " \n" +def range_mapping(from, to, length) + " \n" end def xml_metadata(opts, units) @@ -108,9 +108,14 @@ def xml_metadata(opts, units) puts begin_superblock(opts[:blocksize], blocks) 0.step(opts[:thins] - 1) do |devid| puts begin_device(devid, opts[:thinsize]) - 0.step(blocks - 1) do |from| - puts single_mapping(from, to) - to += 1 + if opts[:range] + puts range_mapping(from, to, blocks) + to += blocks + else + 0.step(blocks - 1) do |from| + puts single_mapping(from, to) + to += 1 + end end puts end_device end diff --git a/thin-provisioning/thin_metadata_size b/thin-provisioning/thin_metadata_size index ef3abe4..0895af4 100755 --- a/thin-provisioning/thin_metadata_size +++ b/thin-provisioning/thin_metadata_size @@ -27,7 +27,7 @@ def init_units 'petabytes', 'pebibytes', 'exabytes', 'ebibytes', 'zetabytes', 'zebibytes', 'yottabytes', 'yobibytes' ] units[:factors] = [ 1, units[:bytes_per_sector] ] - 1.step(8) { |e| units[:factors] += [ 1024**e, 1000**e ] } + 1.step(8) { |e| units[:factors] += [ 1000**e, 1024**e ] } units end