Bug#649913: Please use posix_fallocate
Jim Meyering j...@meyering.net writes: Goswin von Brederlow wrote: Package: coreutils Version: 8.5-1 Severity: normal File: /bin/cp when copying files the size of the resulting file is known (except in race conditions) beforehand and should be communicated to the filesystem using posix_fallocate(). This ensures there is enough space for the file and more importantly allows the filesystem to place the file better, idealy as on continious chunk, on the filesystem. Some care must be taken to ftruncate() the file to its smaller size if the source file has shrunk while copying. If the file has grown while copying one could posix_fallocate() to the new size repeadately till the full file is copied but it probably wouldn't hurt to ignore that case and just copy the remainder of the grown file without allocating space first. In upstream discussion, Pádraig Brady just wrote about precisely that: http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/23023/focus=23409 Good to know this isn't completly ignored. As a side note: This also applies to dd and might be much simpler to handle there since dd never uses sparse files. Dd should use fallocate() at least whenever it has a count=xxx. MfG Goswin -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#649913: Please use posix_fallocate
Package: coreutils Version: 8.5-1 Severity: normal File: /bin/cp Hi, when copying files the size of the resulting file is known (except in race conditions) beforehand and should be communicated to the filesystem using posix_fallocate(). This ensures there is enough space for the file and more importantly allows the filesystem to place the file better, idealy as on continious chunk, on the filesystem. Some care must be taken to ftruncate() the file to its smaller size if the source file has shrunk while copying. If the file has grown while copying one could posix_fallocate() to the new size repeadately till the full file is copied but it probably wouldn't hurt to ignore that case and just copy the remainder of the grown file without allocating space first. MfG Goswin -- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (666, 'unstable'), (500, 'unstable'), (500, 'stable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.39-rc7-xen-1 (SMP w/4 CPU cores) Locale: LANG=C, LC_CTYPE=de_DE (charmap=ISO-8859-1) Shell: /bin/sh linked to /bin/dash Versions of packages coreutils depends on: ii libacl1 2.2.51-3 Access control list shared library ii libattr1 1:2.4.46-3 Extended attribute shared library ii libc6 2.13-4 Embedded GNU C Library: Shared lib ii libselinux1 2.0.96-1 SELinux runtime shared libraries coreutils recommends no packages. coreutils suggests no packages. -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#649913: Please use posix_fallocate
Goswin von Brederlow wrote: Package: coreutils Version: 8.5-1 Severity: normal File: /bin/cp when copying files the size of the resulting file is known (except in race conditions) beforehand and should be communicated to the filesystem using posix_fallocate(). This ensures there is enough space for the file and more importantly allows the filesystem to place the file better, idealy as on continious chunk, on the filesystem. Some care must be taken to ftruncate() the file to its smaller size if the source file has shrunk while copying. If the file has grown while copying one could posix_fallocate() to the new size repeadately till the full file is copied but it probably wouldn't hurt to ignore that case and just copy the remainder of the grown file without allocating space first. In upstream discussion, Pádraig Brady just wrote about precisely that: http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/23023/focus=23409 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org