[dpkg] 43/200: libdpkg: Only preallocate disk size for files bigger than 16 KiB
Ximin Luo
infinity0 at debian.org
Wed Apr 5 15:17:12 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 a971ad91437af8880cad4703695dcf12ee45959b
Author: Guillem Jover <guillem at debian.org>
Date: Wed Nov 16 03:00:07 2016 +0100
libdpkg: Only preallocate disk size for files bigger than 16 KiB
Preallocating for very small fails causes some filesystems to degrade
performance. Do so only for "big enough" files.
Closes: #824636
---
debian/changelog | 2 ++
lib/dpkg/fdio.c | 4 +++-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index 5a8f8ba..78a3b48 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,8 @@ dpkg (1.18.15) UNRELEASED; urgency=medium
execution when we cannot infer the number of online processors on
unsupported or exotic systems. This should be a safer mode of operation.
Proposed by Simon McVittie <smcv at debian.org>.
+ * Only preallocate disk size in dpkg for unpacked files bigger than 16 KiB.
+ Closes: #824636
* Perl modules:
- Validate architecture arguments in Dpkg::Deps deps_parse().
Prompted by Johannes Schauer <josch at debian.org>.
diff --git a/lib/dpkg/fdio.c b/lib/dpkg/fdio.c
index 38781c8..b98596e 100644
--- a/lib/dpkg/fdio.c
+++ b/lib/dpkg/fdio.c
@@ -102,7 +102,9 @@ fd_allocate_size(int fd, off_t offset, off_t len)
{
int rc;
- if (len == 0)
+ /* Do not preallocate on very small files as that degrades performance
+ * on some filesystems. */
+ if (len < (4 * 4096) - 1)
return 0;
#if defined(HAVE_F_PREALLOCATE)
--
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