qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v13 1/6] block: round up file size to nearest se


From: Kevin Wolf
Subject: Re: [Qemu-devel] [PATCH v13 1/6] block: round up file size to nearest sector
Date: Thu, 4 Sep 2014 11:33:01 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 29.08.2014 um 14:50 hat Eric Blake geschrieben:
> On 08/29/2014 02:33 AM, Hu Tao wrote:
> > +++ b/block/raw-posix.c
> > @@ -1369,8 +1369,8 @@ static int raw_create(const char *filename, QemuOpts 
> > *opts, Error **errp)
> >      strstart(filename, "file:", &filename);
> >  
> >      /* Read out options */
> > -    total_size =
> > -        qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0) / BDRV_SECTOR_SIZE;
> > +    total_size = DIV_ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 
> > 0),
> > +                              BDRV_SECTOR_SIZE);
> >      nocow = qemu_opt_get_bool(opts, BLOCK_OPT_NOCOW, false);
> 
> Again, I'm okay with the idea of always treating guest images as aligned
> multiples of sectors.  But it's very easy to create an unaligned raw
> file, and pass that to qemu.  So even though we don't create such files
> via qemu-img, it's still worth ensuring that the code behaves correctly
> when such an image is used directly or as a backing file

The whole qemu block layer doesn't work well with unaligned images (and
the required alignment is always 512 because someone thought that using
512-byte units was a good interface). I want to fix that by converting
everything to byte granularity, but it's not the top priority.

Kevin

Attachment: pgpk_AZXW9Lay.pgp
Description: PGP signature


reply via email to

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