[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH v3 3/6] block/raw-posix: implement bdrv_prea
From: |
Hu Tao |
Subject: |
Re: [Qemu-devel] [RFC PATCH v3 3/6] block/raw-posix: implement bdrv_preallocate |
Date: |
Mon, 23 Dec 2013 09:45:32 +0800 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Fri, Dec 20, 2013 at 11:14:05AM +0100, Stefan Hajnoczi wrote:
> On Thu, Dec 19, 2013 at 10:27:38AM +0800, Hu Tao wrote:
> > +static int raw_preallocate2(int fd, int64_t offset, int64_t length)
> > +{
> > + int ret = -1;
> > +
> > + ret = fallocate(fd, 0, offset, length);
> > +
> > + /* fallback to posix_fallocate() if fallocate() is not supported */
> > + if (ret < 0 && (errno == ENOSYS || errno == EOPNOTSUPP)) {
> > + ret = posix_fallocate(fd, offset, length);
> > + }
> > +
> > + return ret;
>
> Return value semantics differ between the two functions:
> * fallocate - return 0 or -1 with errno set
> * posix_fallocate - return 0 or error number (without using errno!)
>
> Please make it consistent. Usually in QEMU we return 0 on success and
> -errno on failure.
Thanks for catching this!
- [Qemu-devel] [RFC PATCH v3 1/6] block: introduce prealloc_mode, (continued)
- [Qemu-devel] [RFC PATCH v3 1/6] block: introduce prealloc_mode, Hu Tao, 2013/12/18
- [Qemu-devel] [RFC PATCH v3 4/6] raw-posix: Add full image preallocation option, Hu Tao, 2013/12/18
- [Qemu-devel] [RFC PATCH v3 2/6] block: add BlockDriver.bdrv_preallocate., Hu Tao, 2013/12/18
- [Qemu-devel] [RFC PATCH v3 5/6] qcow2: implement bdrv_preallocate, Hu Tao, 2013/12/18
- [Qemu-devel] [RFC PATCH v3 3/6] block/raw-posix: implement bdrv_preallocate, Hu Tao, 2013/12/18
- [Qemu-devel] [RFC PATCH v3 6/6] qcow2: Add full image preallocation option, Hu Tao, 2013/12/18
- Re: [Qemu-devel] [RFC PATCH v3 0/6] qemu-img: add preallocation=full, Stefan Hajnoczi, 2013/12/20