Re: [libvirt] [PATCH 1/2] Introduce posix_fallocate() to allocate disk space

2009-03-20 Thread Daniel P. Berrange
On Thu, Mar 19, 2009 at 08:17:53PM +0530, Amit Shah wrote: Using posix_fallocate() to allocate disk space and fill it with zeros is faster than writing the zeros block-by-block. Also, for backing file systems that support extents and the fallocate() syscall, this operation will give us a

[libvirt] [PATCH 1/2] Introduce posix_fallocate() to allocate disk space

2009-03-19 Thread Amit Shah
Using posix_fallocate() to allocate disk space and fill it with zeros is faster than writing the zeros block-by-block. Also, for backing file systems that support extents and the fallocate() syscall, this operation will give us a big speed boost. This also brings us the advantage of very less

[libvirt] [PATCH 1/2] Introduce posix_fallocate() to allocate disk space

2009-03-19 Thread Amit Shah
Using posix_fallocate() to allocate disk space and fill it with zeros is faster than writing the zeros block-by-block. Also, for backing file systems that support extents and the fallocate() syscall, this operation will give us a big speed boost. This also brings us the advantage of very less

Re: [libvirt] [PATCH 1/2] Introduce posix_fallocate() to allocate disk space

2009-03-19 Thread Amit Shah
On (Thu) Mar 19 2009 [10:39:05], Daniel P. Berrange wrote: On Thu, Mar 19, 2009 at 12:45:24PM +0530, Amit Shah wrote: diff --git a/src/util.c b/src/util.c index 66ad9a4..b69d33a 100644 --- a/src/util.c +++ b/src/util.c @@ -117,6 +117,26 @@ ssize_t safewrite(int fd, const void *buf,

Re: [libvirt] [PATCH 1/2] Introduce posix_fallocate() to allocate disk space

2009-03-19 Thread Daniel Veillard
On Thu, Mar 19, 2009 at 05:02:48PM +0530, Amit Shah wrote: On (Thu) Mar 19 2009 [10:39:05], Daniel P. Berrange wrote: char * buf = mmap(NULL, len, MAP_SHARED, MAP_ANONYMOUS, fd, offset) memset(buf, 0, len); munmap(buf, len); Or, do your calloc() of a 1 MB chunk, and then call

[libvirt] [PATCH 1/2] Introduce posix_fallocate() to allocate disk space

2009-03-19 Thread Amit Shah
Using posix_fallocate() to allocate disk space and fill it with zeros is faster than writing the zeros block-by-block. Also, for backing file systems that support extents and the fallocate() syscall, this operation will give us a big speed boost. This also brings us the advantage of very less