blockdev: support using zeroinit filter
The zeroinit filter is used for cloning/mirroring and importing with target volumes that are known to produce zeros when reading parts that were not written before and can be helpful for performance. Since it is the target of the mirror, it won't have a 'throttle' node associated with it, but be added as a top node itself. Therefore, it requires an explicit node-name. Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
d8de36c992
commit
39867932ec
1 changed files with 7 additions and 0 deletions
|
|
@ -115,6 +115,8 @@ my sub get_node_name {
|
|||
$prefix = 'f';
|
||||
} elsif ($type eq 'file') {
|
||||
$prefix = 'e';
|
||||
} elsif ($type eq 'zeroinit') {
|
||||
$prefix = 'z';
|
||||
} else {
|
||||
die "unknown node type '$type'";
|
||||
}
|
||||
|
|
@ -347,6 +349,11 @@ sub generate_drive_blockdev {
|
|||
my $child = generate_file_blockdev($storecfg, $drive, $options);
|
||||
$child = generate_format_blockdev($storecfg, $drive, $child, $options);
|
||||
|
||||
if ($options->{'zero-initialized'}) {
|
||||
my $node_name = get_node_name('zeroinit', $drive_id, $drive->{file}, $options);
|
||||
$child = { driver => 'zeroinit', file => $child, 'node-name' => "$node_name" };
|
||||
}
|
||||
|
||||
# for fleecing and TPM backup, this is already the top node
|
||||
return $child if $options->{fleecing} || $options->{'tpm-backup'};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue