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

[PATCH 1/2] Remove --enable-sync-sync codepath



Using sync() on unpack causes _all_ filesystems to be sync'd, which is
not so great when one of those is a thumb drive, mounted over a
network, or otherwise slow.  Remove the sync-instead-of-fsync codepath
to simplify maintenance.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 configure.ac     |    1 -
 debian/changelog |    4 ++++
 m4/dpkg-funcs.m4 |   28 ----------------------------
 src/archives.c   |    8 --------
 4 files changed, 4 insertions(+), 37 deletions(-)

diff --git a/configure.ac b/configure.ac
index b5d9df3..96c6c5e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -77,7 +77,6 @@ DPKG_DECL_SYS_SIGLIST
 # Checks for library functions.
 DPKG_FUNC_VA_COPY
 DPKG_FUNC_C99_SNPRINTF
-DPKG_FUNC_SYNC_SYNC
 DPKG_CHECK_DECL([offsetof], [stddef.h])
 DPKG_CHECK_DECL([WCOREDUMP], [sys/wait.h])
 DPKG_CHECK_DECL([TIOCNOTTY], [sys/ioctl.h])
diff --git a/debian/changelog b/debian/changelog
index 33f9454..e309591 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -23,6 +23,10 @@ dpkg (1.16.0) UNRELEASED; urgency=low
     Thanks to Oxan van Leeuwen <oxan@oxanvanleeuwen.nl> who wrote it
     as part of the Google Code In program.
 
+  [ Jonathan Nieder ]
+  * Remove support for use of synchronous sync(2), as it is too much
+    trouble to maintain.
+
   [ Updated programs translations ]
   * Swedish (Peter Krefting).
 
diff --git a/m4/dpkg-funcs.m4 b/m4/dpkg-funcs.m4
index 0877a4a..bc5ef6c 100644
--- a/m4/dpkg-funcs.m4
+++ b/m4/dpkg-funcs.m4
@@ -85,34 +85,6 @@ AC_DEFUN([DPKG_MMAP],
   ])
 ])
 
-# DPKG_FUNC_SYNC_SYNC
-# --------------------
-# Define USE_SYNC_SYNC if sync() is synchronous and it has been enabled
-# on configure
-AC_DEFUN([DPKG_FUNC_SYNC_SYNC],
-[
-  AC_REQUIRE([AC_CANONICAL_HOST])
-
-  AC_MSG_CHECKING([whether sync is synchronous])
-  AS_CASE([$host_os],
-          [linux-*], [dpkg_cv_sync_sync=yes],
-          [dpkg_cv_sync_sync=no])
-  AC_MSG_RESULT([$dpkg_cv_sync_sync])
-
-  AC_ARG_ENABLE([sync-sync],
-    AS_HELP_STRING([--enable-sync-sync],
-                   [enable usage of synchronous sync(2) if available]),
-    [],
-    [enable_sync_sync=no])
-  AC_MSG_CHECKING([whether to use synchronous sync])
-  AS_IF([test "x$dpkg_cv_sync_sync" = "xyes" &&
-         test "x$enable_sync_sync" = "xyes"],
-        [AC_DEFINE([USE_SYNC_SYNC], 1,
-                   [Define to 1 if sync(2) is synchronous])],
-        [enable_sync_sync=no])
-  AC_MSG_RESULT([$enable_sync_sync])
-])# DPKG_FUNC_SYNC_SYNC
-
 # DPKG_CHECK_COMPAT_FUNCS(LIST)
 # -----------------------
 # Check each function and define an automake conditional
diff --git a/src/archives.c b/src/archives.c
index 561a14f..d68f9d6 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -865,12 +865,6 @@ tar_deferred_extract(struct fileinlist *files, struct pkginfo *pkg)
   struct filenamenode *usenode;
   const char *usename;
 
-#if defined(USE_SYNC_SYNC)
-  debug(dbg_general, "deferred extract mass sync");
-  if (!fc_unsafe_io)
-    sync();
-#endif
-
   for (cfile = files; cfile; cfile = cfile->next) {
     debug(dbg_eachfile, "deferred extract of '%.255s'", cfile->namenode->name);
 
@@ -882,7 +876,6 @@ tar_deferred_extract(struct fileinlist *files, struct pkginfo *pkg)
 
     setupfnamevbs(usename);
 
-#if !defined(USE_SYNC_SYNC)
     if (cfile->namenode->flags & fnnf_deferred_fsync) {
       int fd;
 
@@ -898,7 +891,6 @@ tar_deferred_extract(struct fileinlist *files, struct pkginfo *pkg)
 
       cfile->namenode->flags &= ~fnnf_deferred_fsync;
     }
-#endif
 
     debug(dbg_eachfiledetail, "deferred extract needs rename");
 
-- 
1.7.2.3


Reply to: