[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] LUKS: support preallocation in qemu-img
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH] LUKS: support preallocation in qemu-img |
Date: |
Thu, 11 Jul 2019 16:12:34 +0200 |
User-agent: |
Mutt/1.11.3 (2019-02-01) |
Am 11.07.2019 um 15:50 hat Eric Blake geschrieben:
> On 7/11/19 7:24 AM, Max Reitz wrote:
>
> >>> So it isn’t just me who expects these to pre-initialize the image to 0.
> >>> Hm, although... I suppose @falloc technically does not specify whether
> >>> the data reads as zeroes. I kind of find it to be implied, but, well...
> >>
> >> I personally don't really think that zeros are important, but rather the
> >> level of allocation.
> >> posix_fallocate probably won't write the data blocks but rather only the
> >> inode metadata / used block bitmap/etc.
> >>
> >> On the other hand writing zeros (or anything else) will force the block
> >> layer to actually write to the underlying
> >> storage which could trigger lower layer allocation if the underlying
> >> storage is thin-provisioned.
> >>
> >> In fact IMHO, instead of writing zeros, it would be better to write random
> >> garbage instead (or have that as an even 'fuller'
> >> preallocation mode), since underlying storage might 'compress' the zeros.
> >
> > Which is actually an argument why you should just write zeroes on the
> > LUKS layer, because this will then turn into quasi-random data on the
> > protocol layer.
>
> We want preallocation to be fast (insofar as possible). Writing zeroes
> in LUKS is not fast, because it forces random data on the protocol
> layer; while writing zeroes on the protocol layer can be fast, even if
> it reads back as random on the LUKS layer. If you WANT to guarantee
> reading zeroes, that's image scrubbing, not preallocation. I think this
> patch is taking the right approach, of letting the underlying layer
> allocate data efficiently (but the burden is then on the underlying
> layer to actually allocate data, and not optimize by compressing zeroes
> into non-allocated storage).
Isn't letting the host efficiently preallocate things what we have
preallocation=falloc for? We implement preallocation=full as explicit
writes to make sure that no shortcuts are taken and things are _really_
preallocated throughout all layers. Not being efficient, but thorough is
almost like the whole point of the option.
So I'm inclined to think that writing zeros on the LUKS layer would be
right for full preallocation.
Kevin
signature.asc
Description: PGP signature
Re: [Qemu-devel] [PATCH] LUKS: support preallocation in qemu-img, Daniel P . Berrangé, 2019/07/11