freebsd-dev/bin/cp
Rick Macklem c98a764c68 cp(1): fix performance issue for large non-sparse file copies
PR252358 reported a serious performance problem when
copying a large non-sparse file on a UFS file system.
This problem seems to have been caused by a large
number of SEEK_HOLE operations, with one done
for each copy_file_range(2) call.

This patch modifies cp(1) to use a large (SSIZE_MAX)
len argument, reducing the number of system calls
and resolving the performance issue.

While here, convert the type of the "rcount" from "int"
to "ssize_t" so that it is consistent with that returned
by both read(2) and copy_file_range(2).

PR:	252358
Reviewed by:	asomers
Differential Revision:	https://reviews.freebsd.org/D27937
2021-01-02 16:58:43 -08:00
..
tests cp: tests: fix weird 20 insertion 2020-09-23 03:02:45 +00:00
cp.1 cp(1): Bugfixes for some issues reported by mandoc 2020-10-03 18:36:22 +00:00
cp.c fts_read: Handle error from a NULL return better. 2020-12-08 23:38:26 +00:00
extern.h General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
Makefile cp: add some basic tests 2020-09-23 03:01:14 +00:00
Makefile.depend DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
utils.c cp(1): fix performance issue for large non-sparse file copies 2021-01-02 16:58:43 -08:00