Re: [PATCH 1/3] build: storage: fdatasync() is not supported in Mac OS X.

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

 



On Fri, Sep 16, 2011 at 02:14:14PM +0200, Peter Krempa wrote:
> This patch changes fdatasync() to fsync() to compile cleanly in OS X.
> ---
>  src/storage/storage_backend.c |    2 +-
>  src/storage/storage_driver.c  |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
> index d125504..ee39836 100644
> --- a/src/storage/storage_backend.c
> +++ b/src/storage/storage_backend.c
> @@ -208,7 +208,7 @@ virStorageBackendCopyToFD(virStorageVolDefPtr vol,
>          } while ((amtleft -= interval) > 0);
>      }
> 
> -    if (fdatasync(fd) < 0) {
> +    if (fsync(fd) < 0) {
>          ret = -errno;
>          virReportSystemError(errno, _("cannot sync data to file '%s'"),
>                               vol->target.path);
> diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
> index c05b74e..aea4c71 100644
> --- a/src/storage/storage_driver.c
> +++ b/src/storage/storage_driver.c
> @@ -1783,7 +1783,7 @@ storageWipeExtent(virStorageVolDefPtr vol,
>          remaining -= written;
>      }
> 
> -    if (fdatasync(fd) < 0) {
> +    if (fsync(fd) < 0) {
>          ret = -errno;
>          virReportSystemError(errno,
>                               _("cannot sync data to volume with path '%s'"),

  Unfortunately they don't have the same semantic, and I assume that
if we used fdatasync it was to avoid sync'ing all the metadata which
fsync does. The proper way would be to make a configure time check for
fdatasync and if not present fallback to fsync. A function in
util/file.[ch] called virFileDataSync(int fd) which would do
fdatasync(fd) if available and fsync(fd) as a fallback sounds to me
the best way to achieve this.
  I don't think we should really push this as-is, but if someone else
disagrees for the sake of 0.9.5 portability, fine. Or we can delay
0.9.5 until fixed for good (I planned to make rc3 within hours and
the final release Monday),

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]