Re: [PATCH v2 3/3] virstoragefile: Refactor virStorageFileResize

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

 




On 08/22/2014 10:32 AM, Ján Tomko wrote:
> On 08/21/2014 06:51 PM, John Ferlan wrote:
>>
>>
<...snip...>

>> Hmm.. Perhaps a better way to do this would be to modify safezero() to
>> add a 4th boolean parameter "resize" and make the "safezero_mmap()" be
>> the false side and the check/call to SYS_fallocate() be the true side.
>> That way all the logic resides in virfile.c
> 
> How about 'fallback_to_mmap' instead of resize?
> 
> Or even simpler, we don't really need a different set of fallbacks for resize
> than the other uses. It seems the patch adding the preallocation to FileResize
> should have used safezero instead of reimplementing it.
> 
> (I also wonder if there are systems without posix_fallocate, but having the
> syscall...)
> 
> ACK to safezero implementation with all four methods:
> 
> int
> safezero(int fd, off_t offset, off_t len)
> {
>     if (virFileFdPosixFallocate(fd, offset, len) == 0)
>         return 0;
>     if (safezero_sys_fallocate(fd, offset, len) == 0)
>         return 0;
>     if (safezero_mmap(fd, offset, len) == 0)
>         return 0;
>     return safezero_slow(fd, offset, len);
> }

OK - I'll do this (although since virFileFdPosixFallocate only needs to
be local now, I'll rename it to safezero_posix_fallocate() and make it
static to the module as well as removing it from libvirt_private.syms).

John

--
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]