[Discuss] rsync v. cp in data migration
Tom Metro
tmetro+blu at gmail.com
Thu May 23 23:31:21 EDT 2013
Richard Pieri wrote:
> Generic cp(1) tries to mmap a complete file into RAM (with a hard-coded
> segment size limit). It then writes out the whole file (or segment) in
> one go. This leads to massive memory thrashing when lots of small files
> are being copied in sequence.
How about GNU cp, as found in Linux?
Source for the library used by cp makes no mention of mmap:
http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=blob;f=src/copy.c;h=c1c82730d4f115dad6f53154c6a34eb332958a91;hb=HEAD#l783
See copy_reg() for the most likely relevant function where buffers are
allocated and sparse_copy() for the lower-level function where read() is
called iteratively.
-Tom
--
Tom Metro
Venture Logic, Newton, MA, USA
"Enterprise solutions through open source."
Professional Profile: http://tmetro.venturelogic.com/
More information about the Discuss
mailing list