[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v13 2/6] block: don't convert file size to secto
From: |
Hu Tao |
Subject: |
Re: [Qemu-devel] [PATCH v13 2/6] block: don't convert file size to sector size |
Date: |
Fri, 5 Sep 2014 17:07:35 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Thu, Sep 04, 2014 at 11:57:58AM +0200, Kevin Wolf wrote:
> Am 29.08.2014 um 10:33 hat Hu Tao geschrieben:
> > and avoid converting it back later.
> >
> > Signed-off-by: Hu Tao <address@hidden>
>
> > diff --git a/block/raw-posix.c b/block/raw-posix.c
> > index 9c22e3f..abe0759 100644
> > --- a/block/raw-posix.c
> > +++ 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 = DIV_ROUND_UP(qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE,
> > 0),
> > - BDRV_SECTOR_SIZE);
> > + total_size = 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);
> >
> > fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
> > @@ -1394,7 +1394,7 @@ static int raw_create(const char *filename, QemuOpts
> > *opts, Error **errp)
> > #endif
> > }
> >
> > - if (ftruncate(fd, total_size * BDRV_SECTOR_SIZE) != 0) {
> > + if (ftruncate(fd, total_size) != 0) {
> > result = -errno;
> > error_setg_errno(errp, -result, "Could not resize file");
> > }
>
> You forgot changing hdev_create() in raw-posix. Doesn't make the patch
> less correct, but you may want to add it for v14.
Thanks, changed it too.
Regards,
Hu
>
> Kevin