qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] qemu-img create: add -o nocow option


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH] qemu-img create: add -o nocow option
Date: Wed, 4 Dec 2013 10:20:44 +0100

On Mon, Dec 2, 2013 at 4:54 AM, Chunyan Liu <address@hidden> wrote:
> 2013/11/25 Kevin Wolf <address@hidden>
>>
>> Am 21.11.2013 um 09:51 hat Stefan Hajnoczi geschrieben:
>> > On Thu, Nov 21, 2013 at 11:33:56AM +0800, Chunyan Liu wrote:
>> > > 2013/11/20 Stefan Hajnoczi <address@hidden>
>> > >
>> > > > On Wed, Nov 20, 2013 at 04:50:29PM +0800, Chunyan Liu wrote:
>> > > > >  block/cow.c               |   22 ++++++++++++++++++++++
>> > > > >  block/qcow.c              |   22 ++++++++++++++++++++++
>> > > > >  block/qcow2.c             |   22 ++++++++++++++++++++++
>> > > >
>> > > > I think you can avoid modifying all the image formats:
>> > > >
>> > > > .bdrv_create() functions pass options to bdrv_create_file().
>> > > > Therefore
>> > > > an image format like qcow2 does not need to parse the nocow option
>> > > > itself.  Only raw-posix.c:.bdrv_create() needs to know about the
>> > > > nocow
>> > > > option.
>> > > >
>> > > >
>> > > In existing code, options passed to bdrv_create_file contains no
>> > > option in
>> > > fact.
>> > >
>> > > And if we pass all options to bdrv_create_file directly, raw-posix.c:
>> > > .bdrv_create() will get NOCOW option but at the same time get SIZE
>> > > option,
>> > > it
>> > > will create a file with total size. For cow/qcow/qcow2, I suppose it's
>> > > not
>> > > expected? In current code, bdrv_create_file will create a zero-sized
>> > > image
>> > > for
>> > > cow/qcow/qcow2.
>> >
>> > I see what the problem is: the loop that parses options does options++.
>> > So by the time it has processed them the options pointer will be NULL or
>> > point to a terminator option (option->name == NULL).
>> >
>> > I was confused because there has been a patch series which changes
>> > .bdrv_create() option parsing.  But I forgot it hasn't been merged.
>> > https://lists.gnu.org/archive/html/qemu-devel/2013-08/msg01695.html
>> >
>> > Kevin: Have you looked at .bdrv_create() QEMUOptionParameter removal
>> > recently?  Otherwise I'm inclined to merge Chunyan's patch - we can
>> > always refactor the code later when QEMUOptionParameter is removed.
>>
>> No, I haven't. I think the QemuOpts conversion series was relatively
>> close, but it seems nobody is working on it any more. Someone should
>> probably pick it up and finish it.
>
>
> Hi, Kevin & Stefan,
> About the nocow option, according to current status, how should we proceed?
> Any
> further work needs to do?

We talked on IRC about rebasing the QEMUOptionParameter series.  Let's
get the in so the 'nocow' change can be made cleanly.

Stefan



reply via email to

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