qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/3] Update the blkmirror block driver


From: Federico Simoncelli
Subject: Re: [Qemu-devel] [PATCH 2/3] Update the blkmirror block driver
Date: Thu, 23 Feb 2012 04:44:25 -0500 (EST)

----- Original Message -----
> From: "Paolo Bonzini" <address@hidden>
> To: "Federico Simoncelli" <address@hidden>
> Cc: address@hidden, address@hidden, address@hidden
> Sent: Thursday, February 23, 2012 8:18:28 AM
> Subject: Re: [PATCH 2/3] Update the blkmirror block driver
> 
> On 02/22/2012 06:13 PM, Federico Simoncelli wrote:
> > @@ -46,7 +46,7 @@ static int blkmirror_open(BlockDriverState *bs,
> > const char *filename, int flags)
> >      filename += strlen("blkmirror:");
> >  
> >      /* Parse the raw image filename */
> > -    filename2 = qemu_malloc(strlen(filename)+1);
> > +    filename2 = qemu_vmalloc(strlen(filename)+1);
> >      escape = 0;
> >      for (i = n = 0; i < strlen(filename); i++) {
> >          if (!escape && filename[i] == ':') {
> > @@ -66,11 +66,11 @@ static int blkmirror_open(BlockDriverState *bs,
> > const char *filename, int flags)
> >  
> >      m->bs[0] = bdrv_new("");
> >      if (m->bs[0] == NULL) {
> > -        free(filename2);
> > +        qemu_vfree(filename2);
> >          return -ENOMEM;
> >      }
> >      ret = bdrv_open(m->bs[0], filename2, flags, NULL);
> > -    free(filename2);
> > +    qemu_vfree(filename2);
> >      if (ret < 0) {
> >          return ret;
> >      }
> 
> These should be g_malloc and g_free.

Thanks!

> Also, please squash this patch in part 1.

Yes, I sent it as a separate patch to make it easier to review my
changes (if someone already reviewed Marcelo's patch).
Any comment on the BDRV_O_NO_BACKING flag I added? That's the real
trick I'm pulling here. It basically allows to open the second image
only for writing and it doesn't complain if the backing file is not
there yet (it will be copied during step 4).

-- 
Federico



reply via email to

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