[RFC/PATCH] cp: Add option to pre-allocate space for files

2012-05-11 Thread Mark
Hi, Here's a patch for cp which adds a new --preallocate option. When specified, cp allocates disk space for the destination file before writing data. It uses fallocate() with FALLOC_FL_KEEP_SIZE on Linux, falling back to posix_fallocate() if that fails. Benefits of preallocation: - Disk

Re: slow ls -l due to lgetxattr

2012-05-11 Thread Eric Blake
On 05/11/2012 09:25 AM, Aaron Davies wrote: `ls -l' (v. 8.12) is often brutally slow on our networked filesystems (nfs afs) at work (~40s for a 1500 file directory). stracing reveals that almost all the time (~4.5ms per call) is spent in lgetxattr, which doesn't even appear to be supported

Re: [RFC/PATCH] cp: Add option to pre-allocate space for files

2012-05-11 Thread Pádraig Brady
On 05/11/2012 04:03 PM, Mark wrote: Hi, Here's a patch for cp which adds a new --preallocate option. When specified, cp allocates disk space for the destination file before writing data. It uses fallocate() with FALLOC_FL_KEEP_SIZE on Linux, falling back to posix_fallocate() if that fails.

bug#9500: [RFC/PATCH] cp: Add option to pre-allocate space for files

2012-05-11 Thread Pádraig Brady
On 05/11/2012 04:03 PM, Mark wrote: Hi, Here's a patch for cp which adds a new --preallocate option. When specified, cp allocates disk space for the destination file before writing data. It uses fallocate() with FALLOC_FL_KEEP_SIZE on Linux, falling back to posix_fallocate() if that fails.

Re: [RFC/PATCH] cp: Add option to pre-allocate space for files

2012-05-11 Thread Mark
Hi, On Fri, May 11, 2012 16:45, Pádraig Brady wrote: On 05/11/2012 04:03 PM, Mark wrote: Here's a patch for cp which adds a new --preallocate option. When specified, cp allocates disk space for the destination file before ... To-do list: - Add --preallocate option to mv as well - Should

bug#11406: Bug? df uses f_bsize instead of f_frsize to calculate file system sizes

2012-05-11 Thread Paul Eggert
On 05/10/2012 04:04 PM, Nikolaus Rath wrote: But why isn't it du using statvfs instead of statfs? m4/fsusage.m4 says why: Do not use statvfs on systems with GNU libc on Linux, because that function stats all preceding entries in /proc/mounts, and that makes df hang if even one of the

bug#11406: Bug? df uses f_bsize instead of f_frsize to calculate file system sizes

2012-05-11 Thread Andreas Schwab
Paul Eggert egg...@cs.ucla.edu writes: On 05/10/2012 04:04 PM, Nikolaus Rath wrote: But why isn't it du using statvfs instead of statfs? m4/fsusage.m4 says why: Do not use statvfs on systems with GNU libc on Linux, because that function stats all preceding entries in /proc/mounts, and

bug#11406: Bug? df uses f_bsize instead of f_frsize to calculate file system sizes

2012-05-11 Thread Jim Meyering
Andreas Schwab wrote: Paul Eggert egg...@cs.ucla.edu writes: On 05/10/2012 04:04 PM, Nikolaus Rath wrote: But why isn't it du using statvfs instead of statfs? m4/fsusage.m4 says why: Do not use statvfs on systems with GNU libc on Linux, because that function stats all preceding entries

bug#11453: `ls` in coreutils-8.17 incorrectly shows broken symlinks in /

2012-05-11 Thread Mike Frysinger
coreutils-8.16 works fine (confirmed), and i don't recall seeing this bug before, so looks like a regression with 8.17 easy to show: $ sudo ln -s dev /foo $ ls --color=auto / ... foo wrongly shows up in blinky text indicating it's a broken symlink ... $ ls --color=auto /. ... foo correctly shows

bug#11453: `ls` in coreutils-8.17 incorrectly shows broken symlinks in /

2012-05-11 Thread Jim Meyering
Mike Frysinger wrote: coreutils-8.16 works fine (confirmed), and i don't recall seeing this bug before, so looks like a regression with 8.17 easy to show: $ sudo ln -s dev /foo $ ls --color=auto / ... foo wrongly shows up in blinky text indicating it's a broken symlink ... $ ls

bug#11453: `ls` in coreutils-8.17 incorrectly shows broken symlinks in /

2012-05-11 Thread Jim Meyering
Jim Meyering wrote: Mike Frysinger wrote: coreutils-8.16 works fine (confirmed), and i don't recall seeing this bug before, so looks like a regression with 8.17 easy to show: $ sudo ln -s dev /foo $ ls --color=auto / ... foo wrongly shows up in blinky text indicating it's a broken symlink

bug#9500: [RFC/PATCH] cp: Add option to pre-allocate space for files

2012-05-11 Thread Pádraig Brady
On 05/11/2012 06:40 PM, Mark wrote: Hi, On Fri, May 11, 2012 16:45, Pádraig Brady wrote: On 05/11/2012 04:03 PM, Mark wrote: Here's a patch for cp which adds a new --preallocate option. When specified, cp allocates disk space for the destination file before ... To-do list: - Add

bug#11453: `ls` in coreutils-8.17 incorrectly shows broken symlinks in /

2012-05-11 Thread Jim Meyering
Jim Meyering wrote: Jim Meyering wrote: Mike Frysinger wrote: coreutils-8.16 works fine (confirmed), and i don't recall seeing this bug before, so looks like a regression with 8.17 easy to show: $ sudo ln -s dev /foo $ ls --color=auto / ... foo wrongly shows up in blinky text indicating

bug#9500: [RFC/PATCH] cp: Add option to pre-allocate space for files

2012-05-11 Thread Mark
On Fri, May 11, 2012 20:19, Pádraig Brady wrote: On 05/11/2012 06:40 PM, Mark wrote: ... An interesting aside: I tried using cp to pre-allocate space for a very large file on an ext4 partition, much larger than the amount of free space. IMHO it would be best for the filesystem to fail

bug#9500: [RFC/PATCH] cp: Add option to pre-allocate space for files

2012-05-11 Thread Pádraig Brady
On 05/11/2012 08:45 PM, Mark wrote: On Fri, May 11, 2012 20:19, Pádraig Brady wrote: On 05/11/2012 06:40 PM, Mark wrote: ... An interesting aside: I tried using cp to pre-allocate space for a very large file on an ext4 partition, much larger than the amount of free space. IMHO it would be

bug#11406: Bug? df uses f_bsize instead of f_frsize to calculate file system sizes

2012-05-11 Thread Nikolaus Rath
On 05/11/2012 01:04 PM, Paul Eggert wrote: On 05/11/2012 03:42 AM, Jim Meyering wrote: it's not clear that there is even a problem with our current use of statfs on glibc-based Linux systems. Yes, I find it curious. GNU/Linux statvfs simply invokes statfs internally, right? So why should

bug#11406: Bug? df uses f_bsize instead of f_frsize to calculate file system sizes

2012-05-11 Thread Nikolaus Rath
On 05/11/2012 09:56 PM, Nikolaus Rath wrote: On 05/11/2012 01:04 PM, Paul Eggert wrote: On 05/11/2012 03:42 AM, Jim Meyering wrote: it's not clear that there is even a problem with our current use of statfs on glibc-based Linux systems. Yes, I find it curious. GNU/Linux statvfs simply

bug#11406: Bug? df uses f_bsize instead of f_frsize to calculate file system sizes

2012-05-11 Thread Paul Eggert
On 05/11/2012 06:56 PM, Nikolaus Rath wrote: Yes, this works: OK, thanks, I pushed that patch into gnulib, where coreutils should eventually pick it up. I just noticed that the stat command is affected by this as well: Ouch. Perhaps Padraig can look at that one -- this statvfs stuff is a