From owner-dev-commits-src-main@freebsd.org Sun Jan 3 01:24:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 322074BFB89; Sun, 3 Jan 2021 01:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D7gyh0wFGz3kwT; Sun, 3 Jan 2021 01:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12C6C1F519; Sun, 3 Jan 2021 01:24:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1031OCod088974; Sun, 3 Jan 2021 01:24:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1031OCSs088973; Sun, 3 Jan 2021 01:24:12 GMT (envelope-from git) Date: Sun, 3 Jan 2021 01:24:12 GMT Message-Id: <202101030124.1031OCSs088973@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: d189a74dfdcd - main - copy_file_range(2): add recommendation to use large "len" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d189a74dfdcd4a89c92a48ecbf8fcb6f6903f9b6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jan 2021 01:24:12 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d189a74dfdcd4a89c92a48ecbf8fcb6f6903f9b6 commit d189a74dfdcd4a89c92a48ecbf8fcb6f6903f9b6 Author: Rick Macklem AuthorDate: 2021-01-03 01:21:21 +0000 Commit: Rick Macklem CommitDate: 2021-01-03 01:21:21 +0000 copy_file_range(2): add recommendation to use large "len" PR#252358 reported a serious performance problem w.r.t. cp(1) when copying large non-sparse files. This problem appears to have been caused by cp(1) calling copy_file_range(2) with a small "len" argument. This patch adds a recommendation to use a large "len" value where possible, for performance reasons. Reviewed by: asomers Differential Revision: https://reviews.freebsd.org/D27935 --- lib/libc/sys/copy_file_range.2 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/libc/sys/copy_file_range.2 b/lib/libc/sys/copy_file_range.2 index a3f714f0e7e8..22106b397ef2 100644 --- a/lib/libc/sys/copy_file_range.2 +++ b/lib/libc/sys/copy_file_range.2 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 30, 2020 +.Dd January 2, 2021 .Dt COPY_FILE_RANGE 2 .Os .Sh NAME @@ -117,6 +117,15 @@ with .Dv SEEK_DATA arguments and this system call for the data ranges found. +.Pp +For best performance, call +.Fn copy_file_range +with the largest +.Fa len +value possible. +It is interruptible on most file systems, +so there is no penalty for using very large len values, even SSIZE_MAX. +.Pp .Sh RETURN VALUES If it succeeds, the call returns the number of bytes copied, which can be fewer than