[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH v3 4/6] block/nvme: add support for image creati

From: Maxim Levitsky
Subject: Re: [Qemu-block] [PATCH v3 4/6] block/nvme: add support for image creation
Date: Sun, 07 Jul 2019 12:03:00 +0300

On Fri, 2019-07-05 at 14:09 +0200, Max Reitz wrote:
> On 03.07.19 17:59, Maxim Levitsky wrote:
> > Tesed on a nvme device like that:
> > 
> > # create preallocated qcow2 image
> > $ qemu-img create -f qcow2 nvme://0000:06:00.0/1 10G -o 
> > preallocation=metadata
> > Formatting 'nvme://0000:06:00.0/1', fmt=qcow2 size=10737418240 
> > cluster_size=65536 preallocation=metadata lazy_refcounts=off 
> > refcount_bits=16
> > 
> > # create an empty qcow2 image
> > $ qemu-img create -f qcow2 nvme://0000:06:00.0/1 10G -o preallocation=off
> > Formatting 'nvme://0000:06:00.0/1', fmt=qcow2 size=10737418240 
> > cluster_size=65536 preallocation=off lazy_refcounts=off refcount_bits=16
> > 
> > Signed-off-by: Maxim Levitsky <address@hidden>
> > ---
> >  block/nvme.c | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 108 insertions(+)
> Hm.  I’m not quite sure I like this, because this is not image creation.

I fully agree with you, and the whole thing did felt kind of wrong.
I kind of think that bdrv_co_create_opts is kind of outdated for the purpose, 
with the nvme driver.
I think that it would be better if the bdrv_file_open just supported something 
like 'O_CREAT'.

I done this the mostly the same was as the file-posix does this on the block 
including that 'hack' of zeroing the first sector, for which I really don't 
know if this is the right solution.

> What we need is a general interface for formatting existing files.  I
> mean, we have that in QMP (blockdev-create), but the problem is that
> this doesn’t really translate to qemu-img create.
> I wonder whether it’s best to hack something up that makes
> bdrv_create_file() a no-op, or whether we should expose blockdev-create
> over qemu-img.  I’ll see how difficult the latter is, it sounds fun
> (famous last words).
For existing images, the 'bdrv_create_file' is already kind of a nop, other 
that zeroing the first sector,
which kind of makes sense, but probably best done on higher level than in each 

So these are my thoughts about this, thanks for the review!

Best regards,
        Maxim Levitsky

reply via email to

[Prev in Thread] Current Thread [Next in Thread]