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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 safewrite in a
> > loop, just to avoid too large a memory allocation.
> 
> Yeah; I forgot the free().
> 
> My approach was to never allocate more than 500MiB. However we can call
> safezero() itself with less than 500M; is 200M OK?

  No IMHO that's definitely too big. Even 1MB is too much if you
can avoid it, please try to use mmap, if that dowsn't work then
use 1MB chunk,

  thanks,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]