bug-coreutils
[Top][All Lists]
Advanced

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

Optimal buffer size for copy


From: neillm
Subject: Optimal buffer size for copy
Date: Tue, 4 Nov 2003 16:59:56 -0600
User-agent: Mutt/1.5.4i

Hello,

I've ran into an issue with using the 'cp' tool.  In short, I was
wondering why the optimal buffer size (as noted in comments) for a
copy is the destination block size (as reported by fstat) instead of
the maximum of the source and destination block sizes.

Imagine the following scenario:

When copying a file from ext2 to a remote filesystem with a block size
of 4MB (instead of ~4K), the copy moves data quickly (in 4MB blocks).

When copying from a remote filesystem with a block size of 4MB to a
filesystem with a 4K blocksize, the copy is *very* slow (using *many*
small 4K blocks).

I realize that using the destination block size can allow for
optimizations for the destination filesystem, but didn't know if that
is necessarily the case.

The attached 1 line patch uses the maximum of the two block sizes and
fixes the problem I'm seeing.  Comments are appreciated.


Best regards,
-Neill.

Attachment: cp-use-max-stat-blksize.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]