[dpkg] 126/200: build: Disable disk pre-allocation by default

Ximin Luo infinity0 at debian.org
Wed Apr 5 15:17:27 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository dpkg.

commit 9d5e55d449a32a70158c81314649d312babd2684
Author: Guillem Jover <guillem at debian.org>
Date:   Thu Jan 26 13:44:31 2017 +0100

    build: Disable disk pre-allocation by default
    
    Contrary to what one would expect, this seems to be causing major issues
    in several "modern" filesystems, as it collides with the heuristics and
    optimizations that these try to perform.
    
    Disable this by default, but let the builder enable it again in case
    this is not a problem on certain systems.
---
 configure.ac     |  2 ++
 debian/changelog |  4 ++++
 lib/dpkg/fdio.c  |  9 +++++++++
 m4/dpkg-funcs.m4 | 15 +++++++++++++++
 4 files changed, 30 insertions(+)

diff --git a/configure.ac b/configure.ac
index 8799e1e..3bc6256 100644
--- a/configure.ac
+++ b/configure.ac
@@ -178,6 +178,7 @@ AS_IF([test "x$build_dselect" = "xyes"], [
 ])
 
 DPKG_USE_MMAP
+DPKG_USE_DISK_PREALLOCATE
 
 # Checks for the build machinery.
 AC_DEFINE([LIBDPKG_VOLATILE_API], [1], [Acknowledge the volatility of the API.])
@@ -228,6 +229,7 @@ Configuration:
     code coverage . . . . . . . . : $enable_coverage
     build shared libraries  . . . : $enable_shared
     mmap loaders  . . . . . . . . : $enable_mmap
+    disk pre-allocation . . . . . : $enable_disk_preallocate
     default dpkg-deb compressor . : $with_dpkg_deb_compressor
 
   Paths:
diff --git a/debian/changelog b/debian/changelog
index 7b7b296..feff819 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -33,6 +33,10 @@ dpkg (1.18.19) UNRELEASED; urgency=medium
     - Move control member file references from dpkg(1) to deb(5).
     - Fix typos in docs and code comments.
     - Document Auto-Built-Package field in deb-control(5).
+  * Build system:
+    - Disable disk pre-allocation by default, but let the builder re-enable
+      it via a new configure option. This has been causing major performance
+      issues on "modern" filesystems.
   * Packaging:
     - Add debsig-verify to dpkg Suggests. The code optionally supports this
       specific signed .deb verification program.
diff --git a/lib/dpkg/fdio.c b/lib/dpkg/fdio.c
index b98596e..8e61b5d 100644
--- a/lib/dpkg/fdio.c
+++ b/lib/dpkg/fdio.c
@@ -77,6 +77,7 @@ fd_write(int fd, const void *buf, size_t len)
 	return total;
 }
 
+#ifdef USE_DISK_PREALLOCATE
 #ifdef HAVE_F_PREALLOCATE
 static void
 fd_preallocate_setup(fstore_t *fs, int flags, off_t offset, off_t len)
@@ -152,3 +153,11 @@ fd_allocate_size(int fd, off_t offset, off_t len)
 
 	return rc;
 }
+#else
+int
+fd_allocate_size(int fd, off_t offset, off_t len)
+{
+	errno = ENOSYS;
+	return -1;
+}
+#endif
diff --git a/m4/dpkg-funcs.m4 b/m4/dpkg-funcs.m4
index e717683..80e76d6 100644
--- a/m4/dpkg-funcs.m4
+++ b/m4/dpkg-funcs.m4
@@ -106,6 +106,21 @@ AC_DEFUN([DPKG_USE_MMAP], [
   ])
 ])
 
+# DPKG_USE_DISK_PREALLOCATE
+# -------------------------
+# Define USE_DISK_PREALLOCATE if disk size pre-allocation is available
+# and it was requested.
+AC_DEFUN([DPKG_USE_DISK_PREALLOCATE], [
+  AC_ARG_ENABLE([disk-preallocate],
+    [AS_HELP_STRING([--enable-disk-preallocate],
+      [enable usage of disk size pre-allocation])],
+    [], [enable_disk_preallocate=no])
+
+  AS_IF([test "x$enable_disk_preallocate" = "xyes"], [
+    AC_DEFINE([USE_DISK_PREALLOCATE], [1], [Use disk size pre-allocation])
+  ])
+])
+
 # DPKG_CHECK_PROGNAME
 # -------------------
 # Check for system implementations of program name tracking.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list