From d9655e3f56647e46bfe7ccf070446d7c5e6031f6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?X=C4=ABc=C3=B2?= Date: Wed, 7 May 2014 12:59:39 +1700 Subject: [PATCH] Linux-only fdatasync() in 3c13bc --- e3/1d633dabf098cb86b909a2f91f48fe89a2d28c | 151 ++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 e3/1d633dabf098cb86b909a2f91f48fe89a2d28c diff --git a/e3/1d633dabf098cb86b909a2f91f48fe89a2d28c b/e3/1d633dabf098cb86b909a2f91f48fe89a2d28c new file mode 100644 index 000000000..8607a8bbf --- /dev/null +++ b/e3/1d633dabf098cb86b909a2f91f48fe89a2d28c @@ -0,0 +1,151 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 37A48431FC2 + for ; Tue, 6 May 2014 12:59:49 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.001 +X-Spam-Level: +X-Spam-Status: No, score=0.001 tagged_above=-999 required=5 + tests=[UNPARSEABLE_RELAY=0.001] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id KrOD6dt+-G2j for ; + Tue, 6 May 2014 12:59:42 -0700 (PDT) +Received: from mail.atelo.org (atelo.org [192.95.27.91]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 01CDE431FAF + for ; Tue, 6 May 2014 12:59:41 -0700 (PDT) +Received: from coyotlan.Tlalpan (ovo.atelo.org [192.168.1.7]); + by mail.atelo.org (OpenSMTPD) with ESMTP id e2586fe2; + for ; Tue, 6 May 2014 19:59:21 +0000 (UTC) +Received: from localhost (1001@localhost [local]); + by localhost (OpenSMTPD) with ESMTPA id efec25c4; + for ; Tue, 6 May 2014 12:59:39 -0700 (PDT) +Date: Tue, 6 May 2014 12:59:39 -0700 +From: =?utf-8?B?WMSrY8Oy?= +To: notmuch@notmuchmail.org +Subject: Linux-only fdatasync() in 3c13bc +Message-ID: <20140506195938.GA18213@coyotlan.Tlalpan> +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="k1lZvvs/B4yU6o8G" +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +User-Agent: Mutt/1.5.23 (2014-03-12) +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Tue, 06 May 2014 19:59:49 -0000 + + +--k1lZvvs/B4yU6o8G +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit + +Also, commit 3c13bc introduced a call to fdatasync() which is not +available on FreeBSD, and probably not either on MacOS at least. + +Best, + +-- +Xīcò + +--k1lZvvs/B4yU6o8G +Content-Type: text/x-diff; charset=us-ascii +Content-Disposition: attachment; + filename="0002-Compatibility-for-Linux-s-fdatasync.patch" + +>From e2b9520e69e52b35348d07eb53a6a88d1397fa3f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?X=C4=ABc=C3=B2?= +Date: Tue, 6 May 2014 12:56:03 -0700 +Subject: [PATCH 1/1] =?UTF-8?q?Compatibility=20for=20Linux=E2=80=99s=20fda?= + =?UTF-8?q?tasync().?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + configure | 7 +++++++ + notmuch-dump.c | 4 ++++ + 2 files changed, 11 insertions(+) + +diff --git a/configure b/configure +index 7204812..7bc602d 100755 +--- a/configure ++++ b/configure +@@ -271,6 +271,7 @@ EOF + errors=0 + + libdir_in_ldconfig=0 ++have_fdatasync=0 + + printf "Checking which platform we are on... " + uname=`uname` +@@ -294,6 +295,7 @@ elif [ $uname = "Linux" ] || [ $uname = "GNU" ] ; then + printf "$uname\n" + platform="$uname" + linker_resolves_library_dependencies=1 ++ have_fdatasync=1 + + printf "Checking for $libdir_expanded in ldconfig... " + ldconfig_paths=$(/sbin/ldconfig -N -X -v 2>/dev/null | sed -n -e 's,^\(/.*\):\( (.*)\)\?$,\1,p') +@@ -859,6 +861,9 @@ HAVE_D_TYPE = ${have_d_type} + # Whether the Xapian version in use supports compaction + HAVE_XAPIAN_COMPACT = ${have_xapian_compact} + ++# Optimized fsync() on Linux ++HAVE_FDATASYNC = ${have_fdatasync} ++ + # Whether the getpwuid_r function is standards-compliant + # (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS + # to enable the standards-compliant version -- needed for Solaris) +@@ -926,6 +931,7 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\ + -DSTD_GETPWUID=\$(STD_GETPWUID) \\ + -DSTD_ASCTIME=\$(STD_ASCTIME) \\ + -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT) \\ ++ -DHAVE_FDATASYNC=\$(HAVE_FDATASYNC) \\ + -DUTIL_BYTE_ORDER=\$(UTIL_BYTE_ORDER) + + CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\ +@@ -939,6 +945,7 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\ + -DSTD_GETPWUID=\$(STD_GETPWUID) \\ + -DSTD_ASCTIME=\$(STD_ASCTIME) \\ + -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT) \\ ++ -DHAVE_FDATASYNC=\$(HAVE_FDATASYNC) \\ + -DUTIL_BYTE_ORDER=\$(UTIL_BYTE_ORDER) + + CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS) +diff --git a/notmuch-dump.c b/notmuch-dump.c +index 2849eab..86b275a 100644 +--- a/notmuch-dump.c ++++ b/notmuch-dump.c +@@ -169,7 +169,11 @@ notmuch_database_dump (notmuch_database_t *notmuch, + } + + if (output_file_name) { ++#if HAVE_FDATASYNC + ret = fdatasync (outfd); ++#else ++ ret = fsync (outfd); ++#endif + if (ret) { + fprintf (stderr, "Error syncing %s to disk: %s\n", + name_for_error, strerror (errno)); +-- +1.9.2 + + +--k1lZvvs/B4yU6o8G-- -- 2.26.2