Re: [Qemu-devel] [RFC PATCH v3 3/6] block/raw-posix: implement bdrv_preallocate

2013-12-22 Thread Hu Tao
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); > > + > > +/*

Re: [Qemu-devel] [RFC PATCH v3 3/6] block/raw-posix: implement bdrv_preallocate

2013-12-20 Thread Stefan Hajnoczi
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 <

[Qemu-devel] [RFC PATCH v3 3/6] block/raw-posix: implement bdrv_preallocate

2013-12-18 Thread Hu Tao
Signed-off-by: Hu Tao --- block/raw-posix.c | 34 ++ 1 file changed, 34 insertions(+) diff --git a/block/raw-posix.c b/block/raw-posix.c index 10c6b34..19181f2 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1160,6 +1160,39 @@ static int64_t raw_get_al