[pve-devel] applied: [PATCH v2 storage] When resizing a ZFS volume, align size to 1M

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Dec 9 14:10:05 CET 2019


On 12/9/19 8:25 AM, Fabian Ebner wrote:
> The size is required to be a multiple of volblocksize. Make sure
> that the requirement is always met, so ZFS won't complain when we do
> things like 'qm resize 102 scsi1 +0.01G'.
> 
> Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
> ---
> 
> Changes from v1:
>     * Always align to 1M to avoid requesting volblocksize
> 
>  PVE/Storage/ZFSPoolPlugin.pm | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
> index 456fb40..42aeedb 100644
> --- a/PVE/Storage/ZFSPoolPlugin.pm
> +++ b/PVE/Storage/ZFSPoolPlugin.pm
> @@ -662,6 +662,12 @@ sub volume_resize {
>  
>      my $attr = $format eq 'subvol' ? 'refquota' : 'volsize';
>  
> +    # align size to 1M so we always have a valid multiple of the volume block size
> +    if ($format eq 'raw') {
> +	my $padding = (1024 - $new_size % 1024) % 1024;
> +	$new_size = $new_size + $padding;
> +    }
> +
>      $class->zfs_request($scfg, undef, 'set', "$attr=${new_size}k", "$scfg->{pool}/$vname");
>  
>      return $new_size;
> 

applied, thanks!




More information about the pve-devel mailing list