From 283cc27cbdcfa96e5eff5243d861aba979e0c13f Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Wed, 26 Jun 2013 14:03:27 +0200 Subject: [PATCH 01/16] create_xml_data: fix nr_data_blocks --- thin-provisioning/create_xml_data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index 42942cb..0168b40 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -105,7 +105,7 @@ end def xml_metadata(opts, units) blocks, to = opts[:thinsize] / opts[:blocksize], 0 - puts begin_superblock(opts[:blocksize], blocks) + puts begin_superblock(opts[:blocksize], opts[:thins] * blocks) 0.step(opts[:thins] - 1) do |devid| puts begin_device(devid, opts[:thinsize]) if opts[:range] From 420c8ef868cfa74f20e506085ae2884675141d48 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Wed, 26 Jun 2013 14:22:03 +0200 Subject: [PATCH 02/16] create_xml_data: fix device and range_mapping --- thin-provisioning/create_xml_data | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index 0168b40..4fb5127 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -99,7 +99,7 @@ def single_mapping(from, to = 4711) end def range_mapping(from, to, length) - " \n" + " \n" end def xml_metadata(opts, units) @@ -107,7 +107,7 @@ def xml_metadata(opts, units) puts begin_superblock(opts[:blocksize], opts[:thins] * blocks) 0.step(opts[:thins] - 1) do |devid| - puts begin_device(devid, opts[:thinsize]) + puts begin_device(devid, blocks) if opts[:range] puts range_mapping(0, to, blocks) to += blocks From 0c715c652e6fa5c50ab962c77712773f06053f81 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Wed, 26 Jun 2013 14:59:25 +0200 Subject: [PATCH 03/16] thin_metadata_size,create_xml_data: fix units --- thin-provisioning/create_xml_data | 4 ++-- thin-provisioning/thin_metadata_size | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index 4fb5127..0b7438b 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -15,14 +15,14 @@ $prg = Pathname.new($0).basename def init_units units = {} units[:bytes_per_sector] = 512 - units[:chars] = "bsKkMmGgTtPpEeZzYy" + units[:chars] = "bskKmMgGtTpPeEzZyY" units[:strings] = [ 'bytes', 'sectors', 'kilobytes', 'kibibytes', 'megabytes', 'mebibytes', 'gigabytes', 'gibibytes', 'terabytes', 'tebibytes', 'petabytes', 'pebibytes', 'exabytes', 'ebibytes', 'zetabytes', 'zebibytes', 'yottabytes', 'yobibytes' ] units[:factors] = [ 1, units[:bytes_per_sector] ] - 1.step(8) { |e| units[:factors] += [ 1000**e, 1024**e ] } + 1.step(8) { |e| units[:factors] += [ 1024**e, 1000**e ] } units end diff --git a/thin-provisioning/thin_metadata_size b/thin-provisioning/thin_metadata_size index 0895af4..04e9eb7 100755 --- a/thin-provisioning/thin_metadata_size +++ b/thin-provisioning/thin_metadata_size @@ -20,14 +20,14 @@ $prg = Pathname.new($0).basename def init_units units = {} units[:bytes_per_sector] = 512 - units[:chars] = "bsKkMmGgTtPpEeZzYy" + units[:chars] = "bskKmMgGtTpPeEzZyY" units[:strings] = [ 'bytes', 'sectors', 'kilobytes', 'kibibytes', 'megabytes', 'mebibytes', 'gigabytes', 'gibibytes', 'terabytes', 'tebibytes', 'petabytes', 'pebibytes', 'exabytes', 'ebibytes', 'zetabytes', 'zebibytes', 'yottabytes', 'yobibytes' ] units[:factors] = [ 1, units[:bytes_per_sector] ] - 1.step(8) { |e| units[:factors] += [ 1000**e, 1024**e ] } + 1.step(8) { |e| units[:factors] += [ 1024**e, 1000**e ] } units end From 66d8dd4e282103c0a8276d59ba48ae743f6f1695 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Wed, 26 Jun 2013 16:02:05 +0200 Subject: [PATCH 04/16] thin_metadata_size: drop signe_mapping to = --- thin-provisioning/create_xml_data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index 0b7438b..f6b442e 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -94,7 +94,7 @@ def end_device " \n" end -def single_mapping(from, to = 4711) +def single_mapping(from, to) " \n" end From 0e8c0774154203c817a6991ef8aba6f5d3b3dd76 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Wed, 26 Jun 2013 18:06:07 +0200 Subject: [PATCH 05/16] thin_metadata_size: check for block size > 0 --- thin-provisioning/thin_metadata_size | 1 + 1 file changed, 1 insertion(+) diff --git a/thin-provisioning/thin_metadata_size b/thin-provisioning/thin_metadata_size index 04e9eb7..4d10c4f 100755 --- a/thin-provisioning/thin_metadata_size +++ b/thin-provisioning/thin_metadata_size @@ -37,6 +37,7 @@ end def check_opts(opts) abort "#{$prg} - 3 arguments required!" if opts.length < 3 + abort "#{$prg} - block size must be > 0" if opts[:blocksize] <= 0 abort "#{$prg} - poolsize must be much larger than blocksize" if opts[:poolsize] < opts[:blocksize] abort "#{$prg} - maximum number of thin provisioned devices must be > 0" if opts[:maxthins].nil? || opts[:maxthins] == 0 end From fbfc0817afebe554e9b35b892ac6476653e72572 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Wed, 26 Jun 2013 18:06:16 +0200 Subject: [PATCH 06/16] create_xml_data: support --size-variation and check for block size > 0 --- thin-provisioning/create_xml_data | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index f6b442e..50b7bfd 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -40,8 +40,10 @@ end def check_opts(opts) abort "#{$prg} - 3 arguments required!" if opts.length < 3 + abort "#{$prg} - block size must be > 0" if opts[:blocksize] <= 0 abort "#{$prg} - size must be much greater/equal blocksize" if opts[:thinsize] < opts[:blocksize] abort "#{$prg} - number of thin provisioned devices or snapshots must be > 0" if opts[:thins].nil? || opts[:thins] == 0 + abort "#{$prg} - size variation too large!" if !opts[:variation].nil? && (opts[:variation] > 2 * (opts[:thinsize] - opts[:blocksize])) end def parse_command_line(argv, units) @@ -62,6 +64,9 @@ def parse_command_line(argv, units) o.on("-t", "--thins #THINS", Integer, "Sum of thin devices and snapshots.") do |mt| opts[:thins] = mt end + o.on("-v", "--size-variation SIZE[#{units[:chars]}]", String, "Size variation of thin devices and snapshots.") do |sv| + opts[:variation] = to_sectors(sv, units) + end o.on("-h", "--help", "Output this help.") do puts o exit @@ -102,17 +107,26 @@ def range_mapping(from, to, length) " \n" end -def xml_metadata(opts, units) - blocks, to = opts[:thinsize] / opts[:blocksize], 0 +def blocks(opts) + opts[:thinsize] / opts[:blocksize] +end - puts begin_superblock(opts[:blocksize], opts[:thins] * blocks) - 0.step(opts[:thins] - 1) do |devid| - puts begin_device(devid, blocks) +def this_blocks(opts) + opts[:variation].nil? ? blocks(opts) : (2 * opts[:thinsize] - rand(opts[:variation])) / 2 / opts[:blocksize] +end + +def xml_metadata(opts, units) + to = 0 + + puts begin_superblock(opts[:blocksize], 2 * opts[:thins] * blocks(opts)) + 0.step(opts[:thins] - 1) do |dev_id| + b = this_blocks(opts) + puts begin_device(dev_id, b) if opts[:range] - puts range_mapping(0, to, blocks) - to += blocks + puts range_mapping(0, to, b) + to += b else - 0.step(blocks - 1) do |from| + 0.step(b - 1) do |from| puts single_mapping(from, to) to += 1 end From d87fa1e0eefb9d4185e2fef66a92b68eab3fa9c1 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Wed, 26 Jun 2013 14:03:27 +0200 Subject: [PATCH 07/16] create_xml_data: fix nr_data_blocks --- thin-provisioning/create_xml_data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index 42942cb..0168b40 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -105,7 +105,7 @@ end def xml_metadata(opts, units) blocks, to = opts[:thinsize] / opts[:blocksize], 0 - puts begin_superblock(opts[:blocksize], blocks) + puts begin_superblock(opts[:blocksize], opts[:thins] * blocks) 0.step(opts[:thins] - 1) do |devid| puts begin_device(devid, opts[:thinsize]) if opts[:range] From 8850204e8c1f85e76fb022c704ba1de19332e060 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Wed, 26 Jun 2013 14:22:03 +0200 Subject: [PATCH 08/16] create_xml_data: fix device and range_mapping --- thin-provisioning/create_xml_data | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index 0168b40..4fb5127 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -99,7 +99,7 @@ def single_mapping(from, to = 4711) end def range_mapping(from, to, length) - " \n" + " \n" end def xml_metadata(opts, units) @@ -107,7 +107,7 @@ def xml_metadata(opts, units) puts begin_superblock(opts[:blocksize], opts[:thins] * blocks) 0.step(opts[:thins] - 1) do |devid| - puts begin_device(devid, opts[:thinsize]) + puts begin_device(devid, blocks) if opts[:range] puts range_mapping(0, to, blocks) to += blocks From a54f7d18f84b729fd99fc918e9d6cb543c0f7eb4 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Wed, 26 Jun 2013 14:59:25 +0200 Subject: [PATCH 09/16] thin_metadata_size,create_xml_data: fix units --- thin-provisioning/create_xml_data | 4 ++-- thin-provisioning/thin_metadata_size | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index 4fb5127..0b7438b 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -15,14 +15,14 @@ $prg = Pathname.new($0).basename def init_units units = {} units[:bytes_per_sector] = 512 - units[:chars] = "bsKkMmGgTtPpEeZzYy" + units[:chars] = "bskKmMgGtTpPeEzZyY" units[:strings] = [ 'bytes', 'sectors', 'kilobytes', 'kibibytes', 'megabytes', 'mebibytes', 'gigabytes', 'gibibytes', 'terabytes', 'tebibytes', 'petabytes', 'pebibytes', 'exabytes', 'ebibytes', 'zetabytes', 'zebibytes', 'yottabytes', 'yobibytes' ] units[:factors] = [ 1, units[:bytes_per_sector] ] - 1.step(8) { |e| units[:factors] += [ 1000**e, 1024**e ] } + 1.step(8) { |e| units[:factors] += [ 1024**e, 1000**e ] } units end diff --git a/thin-provisioning/thin_metadata_size b/thin-provisioning/thin_metadata_size index 0895af4..04e9eb7 100755 --- a/thin-provisioning/thin_metadata_size +++ b/thin-provisioning/thin_metadata_size @@ -20,14 +20,14 @@ $prg = Pathname.new($0).basename def init_units units = {} units[:bytes_per_sector] = 512 - units[:chars] = "bsKkMmGgTtPpEeZzYy" + units[:chars] = "bskKmMgGtTpPeEzZyY" units[:strings] = [ 'bytes', 'sectors', 'kilobytes', 'kibibytes', 'megabytes', 'mebibytes', 'gigabytes', 'gibibytes', 'terabytes', 'tebibytes', 'petabytes', 'pebibytes', 'exabytes', 'ebibytes', 'zetabytes', 'zebibytes', 'yottabytes', 'yobibytes' ] units[:factors] = [ 1, units[:bytes_per_sector] ] - 1.step(8) { |e| units[:factors] += [ 1000**e, 1024**e ] } + 1.step(8) { |e| units[:factors] += [ 1024**e, 1000**e ] } units end From 4e0e2e30d3e21a35e4f475a9295d63552ccb761b Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Wed, 26 Jun 2013 16:02:05 +0200 Subject: [PATCH 10/16] thin_metadata_size: drop signe_mapping to = --- thin-provisioning/create_xml_data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index 0b7438b..f6b442e 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -94,7 +94,7 @@ def end_device " \n" end -def single_mapping(from, to = 4711) +def single_mapping(from, to) " \n" end From daf8cf490415350409a2e2bcaa035eee03d82eec Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Wed, 26 Jun 2013 18:06:07 +0200 Subject: [PATCH 11/16] thin_metadata_size: check for block size > 0 --- thin-provisioning/thin_metadata_size | 1 + 1 file changed, 1 insertion(+) diff --git a/thin-provisioning/thin_metadata_size b/thin-provisioning/thin_metadata_size index 04e9eb7..4d10c4f 100755 --- a/thin-provisioning/thin_metadata_size +++ b/thin-provisioning/thin_metadata_size @@ -37,6 +37,7 @@ end def check_opts(opts) abort "#{$prg} - 3 arguments required!" if opts.length < 3 + abort "#{$prg} - block size must be > 0" if opts[:blocksize] <= 0 abort "#{$prg} - poolsize must be much larger than blocksize" if opts[:poolsize] < opts[:blocksize] abort "#{$prg} - maximum number of thin provisioned devices must be > 0" if opts[:maxthins].nil? || opts[:maxthins] == 0 end From 8eb568619ebd713aa3423897aa56f7702069494c Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Wed, 26 Jun 2013 18:06:16 +0200 Subject: [PATCH 12/16] create_xml_data: support --size-variation and check for block size > 0 --- thin-provisioning/create_xml_data | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index f6b442e..50b7bfd 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -40,8 +40,10 @@ end def check_opts(opts) abort "#{$prg} - 3 arguments required!" if opts.length < 3 + abort "#{$prg} - block size must be > 0" if opts[:blocksize] <= 0 abort "#{$prg} - size must be much greater/equal blocksize" if opts[:thinsize] < opts[:blocksize] abort "#{$prg} - number of thin provisioned devices or snapshots must be > 0" if opts[:thins].nil? || opts[:thins] == 0 + abort "#{$prg} - size variation too large!" if !opts[:variation].nil? && (opts[:variation] > 2 * (opts[:thinsize] - opts[:blocksize])) end def parse_command_line(argv, units) @@ -62,6 +64,9 @@ def parse_command_line(argv, units) o.on("-t", "--thins #THINS", Integer, "Sum of thin devices and snapshots.") do |mt| opts[:thins] = mt end + o.on("-v", "--size-variation SIZE[#{units[:chars]}]", String, "Size variation of thin devices and snapshots.") do |sv| + opts[:variation] = to_sectors(sv, units) + end o.on("-h", "--help", "Output this help.") do puts o exit @@ -102,17 +107,26 @@ def range_mapping(from, to, length) " \n" end -def xml_metadata(opts, units) - blocks, to = opts[:thinsize] / opts[:blocksize], 0 +def blocks(opts) + opts[:thinsize] / opts[:blocksize] +end - puts begin_superblock(opts[:blocksize], opts[:thins] * blocks) - 0.step(opts[:thins] - 1) do |devid| - puts begin_device(devid, blocks) +def this_blocks(opts) + opts[:variation].nil? ? blocks(opts) : (2 * opts[:thinsize] - rand(opts[:variation])) / 2 / opts[:blocksize] +end + +def xml_metadata(opts, units) + to = 0 + + puts begin_superblock(opts[:blocksize], 2 * opts[:thins] * blocks(opts)) + 0.step(opts[:thins] - 1) do |dev_id| + b = this_blocks(opts) + puts begin_device(dev_id, b) if opts[:range] - puts range_mapping(0, to, blocks) - to += blocks + puts range_mapping(0, to, b) + to += b else - 0.step(blocks - 1) do |from| + 0.step(b - 1) do |from| puts single_mapping(from, to) to += 1 end From ab83844ffb89ec1ef5db19891f01c88b8635bd13 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Thu, 27 Jun 2013 15:04:57 +0200 Subject: [PATCH 13/16] create_xml_data: remove space in dev_id ouput --- thin-provisioning/create_xml_data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index 50b7bfd..6ef50d0 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -92,7 +92,7 @@ def end_superblock end def begin_device(devid, size) - " \n" + " \n" end def end_device From d0baf34139c5b80add70845928add008b1d832c7 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Thu, 27 Jun 2013 15:36:50 +0200 Subject: [PATCH 14/16] create_xml_data: adjust filed order to thin_dumo format; fix nr_data_blocks --- thin-provisioning/create_xml_data | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index 6ef50d0..a49eec5 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -100,11 +100,11 @@ def end_device end def single_mapping(from, to) - " \n" + " \n" end def range_mapping(from, to, length) - " \n" + " \n" end def blocks(opts) @@ -116,11 +116,17 @@ def this_blocks(opts) end def xml_metadata(opts, units) - to = 0 + nr_data_blocks, to = 0, 0 + blks = [] - puts begin_superblock(opts[:blocksize], 2 * opts[:thins] * blocks(opts)) + 0.step(opts[:thins] - 1) do + blks << this_blocks(opts) + nr_data_blocks += blks[-1] + end + + puts begin_superblock(opts[:blocksize], nr_data_blocks) 0.step(opts[:thins] - 1) do |dev_id| - b = this_blocks(opts) + b = blks.shift puts begin_device(dev_id, b) if opts[:range] puts range_mapping(0, to, b) From 2c3530515aa5d8bb0d533dcaf8374fe0acd5c158 Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Thu, 27 Jun 2013 15:57:12 +0200 Subject: [PATCH 15/16] create_xml_data: adjust to thinp_xml output --- thin-provisioning/create_xml_data | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index a49eec5..0a13000 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -84,7 +84,7 @@ def parse_command_line(argv, units) end def begin_superblock(blocksize, nr_data_blocks) - "\n" + "\n" end def end_superblock @@ -100,11 +100,11 @@ def end_device end def single_mapping(from, to) - " \n" + " \n" end def range_mapping(from, to, length) - " \n" + " \n" end def blocks(opts) From 4f320be8da79f5eaac8cd0051a55a9f34b4cf83c Mon Sep 17 00:00:00 2001 From: Heinz Mauelshagen Date: Fri, 28 Jun 2013 12:10:17 +0200 Subject: [PATCH 16/16] create_xml_data: fiddling --- thin-provisioning/create_xml_data | 38 ++++++++++++++----------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/thin-provisioning/create_xml_data b/thin-provisioning/create_xml_data index 0a13000..3d5e322 100755 --- a/thin-provisioning/create_xml_data +++ b/thin-provisioning/create_xml_data @@ -41,7 +41,7 @@ end def check_opts(opts) abort "#{$prg} - 3 arguments required!" if opts.length < 3 abort "#{$prg} - block size must be > 0" if opts[:blocksize] <= 0 - abort "#{$prg} - size must be much greater/equal blocksize" if opts[:thinsize] < opts[:blocksize] + abort "#{$prg} - thin size must be much greater/equal blocksize" if opts[:thinsize] < opts[:blocksize] abort "#{$prg} - number of thin provisioned devices or snapshots must be > 0" if opts[:thins].nil? || opts[:thins] == 0 abort "#{$prg} - size variation too large!" if !opts[:variation].nil? && (opts[:variation] > 2 * (opts[:thinsize] - opts[:blocksize])) end @@ -84,27 +84,27 @@ def parse_command_line(argv, units) end def begin_superblock(blocksize, nr_data_blocks) - "\n" + "" end def end_superblock - "\n" + "" end def begin_device(devid, size) - " \n" + " " end def end_device - " \n" + " " end def single_mapping(from, to) - " \n" + " " end def range_mapping(from, to, length) - " \n" + " " end def blocks(opts) @@ -116,28 +116,24 @@ def this_blocks(opts) end def xml_metadata(opts, units) - nr_data_blocks, to = 0, 0 - blks = [] + blks, dev_id, nr_data_blocks, to = [], 0, 0, 0 0.step(opts[:thins] - 1) do - blks << this_blocks(opts) - nr_data_blocks += blks[-1] + blks << (b = this_blocks(opts)) + nr_data_blocks += b end puts begin_superblock(opts[:blocksize], nr_data_blocks) - 0.step(opts[:thins] - 1) do |dev_id| - b = blks.shift - puts begin_device(dev_id, b) + blks.each do |b| if opts[:range] - puts range_mapping(0, to, b) - to += b + puts begin_device(dev_id, b), range_mapping(0, to, b), end_device else - 0.step(b - 1) do |from| - puts single_mapping(from, to) - to += 1 - end + puts begin_device(dev_id, b) + 0.step(b - 1) { |from| puts single_mapping(from, to + from) } + puts end_device end - puts end_device + dev_id += 1 + to += b end puts end_superblock end