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
pgpf__br3CiMI.pgp
Description: PGP signature