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.