From nobody Tue Sep 06 00:51:10 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MM6JZ70Lfz4bf6T; Tue, 6 Sep 2022 00:51:10 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4MM6JZ66nmz3xCQ; Tue, 6 Sep 2022 00:51:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662425470; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Qy2ue3AfmrEVQIMG7uXGBpXo2JHAwshwW/ODv9V5kAA=; b=hVdG9hCnAJdJhI3/kGgqs9vHAWwwCBII2NoSvtRXJFU2Fh5RpffCjNJ3i632Dz1CE6V2lx 9/N9+yI4tPoxeLj7XsrMUx2kT2Q+rt8Bc9f4RVUTtb0fcagOUzsThfbPv8W0UEL5fJVUcM PZce+Laq+IvgiIr82O7nGJnzQf8P6ZWyuVK2HmC4qI88xgBy2a0iaTbM+AzaYi9Iqs3zf5 5pUJ3j+zi/7ZyEqf3HLlSUlpnBWI1sJCasRzCiQe9zHGE3e3jni/2/xMlCrosjZE087dmI gtcUTSFl9qRurF1B87endloyRWGLXUQw3gncRNRpgo5bJ0//+HH/QNSYtFsG/w== 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 4MM6JZ5DlHz113F; Tue, 6 Sep 2022 00:51:10 +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 2860pAMY051952; Tue, 6 Sep 2022 00:51:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2860pAgC051951; Tue, 6 Sep 2022 00:51:10 GMT (envelope-from git) Date: Tue, 6 Sep 2022 00:51:10 GMT Message-Id: <202209060051.2860pAgC051951@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: e1ce45abcfa7 - stable/13 - cp: Fix build without VM_AND_BUFFER_CACHE_SYNCHRONIZED. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e1ce45abcfa78e77fec77eb6f326358edfb12dfd Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1662425470; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Qy2ue3AfmrEVQIMG7uXGBpXo2JHAwshwW/ODv9V5kAA=; b=U0Ik8FtJmriMa7UuGRoVYsxzstQF2bZ1M5AmU/aRuy5eyv3k8TB9rIR200eZZLSssaMFGY jNoXi6PApud7oBTMx68B+U96qgMe+Zs2qlhdBudP6vSCMGC3M/nPNcjAvnIJStrcO3gZMY QVdJla5ey+eLfOumNpp9iTfn2CHBuAZMStfqU9rJWZH29+x4BVTC4y3veHfOu76sVm7X5n gpQ+qcC1k2mWNC7n1IUT3ust2o8lZVKe5TnjGbX09xgbg0TjkUCFOpT9yAyukTZELMWoAw jNfHW24m4gfy1/jVIhjdKxCCEZUFJ4lHK7BZKnGcUZuJbPG8uaYKumRMoocZ0w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1662425470; a=rsa-sha256; cv=none; b=bBcdGe8nX3klwDsOv9VQYuBp2aoHwY7IssGwEoHySVfQW/yqjh6TZtDAR1HWk8p8P3HFRL VXrPZA4qk/N6z1K8Hjalih4lcOO1wGdV9tccFL37Mu+WZNLRYJ3ZOgWAHWAAxog7PN/R2E ZLyXDVxbassMMARFtUdzrYqqTntcTfQg0uaM1y6zB5M/iM/ZRuQFOZwBr3NpaOABQs2rOb xV/j+JSvJGTLR/zug94d0xd6HOIJWZXgHtduZKcuigHZyfZjvpOFjet8NF8PZDFt20o8ia FP/xh/feLEHNCmG6znaWbR7zT6ZpxMn2x3bHk+W6lIi0kIVNZaaNhWuoPLp9gg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=e1ce45abcfa78e77fec77eb6f326358edfb12dfd commit e1ce45abcfa78e77fec77eb6f326358edfb12dfd Author: Alexander Motin AuthorDate: 2022-08-30 14:51:21 +0000 Commit: Alexander Motin CommitDate: 2022-09-06 00:51:02 +0000 cp: Fix build without VM_AND_BUFFER_CACHE_SYNCHRONIZED. It allows to not use mmap() for small files, which is not helpful in case of ZFS. Should be no functional change. MFC after: 1 week (cherry picked from commit 35b7759c05cbc65c06d87141da79f0f80af0f458) --- bin/cp/utils.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/bin/cp/utils.c b/bin/cp/utils.c index e7ae0c9dd733..07de0495ba9e 100644 --- a/bin/cp/utils.c +++ b/bin/cp/utils.c @@ -99,13 +99,12 @@ copy_file(const FTSENT *entp, int dne) static char *buf = NULL; static size_t bufsize; struct stat *fs; - ssize_t rcount, wcount; - size_t wresid; + ssize_t wcount; off_t wtotal; int ch, checkch, from_fd, rval, to_fd; - char *bufp; #ifdef VM_AND_BUFFER_CACHE_SYNCHRONIZED - char *p; + size_t wresid; + char *bufp, *p; #endif int use_copy_file_range = 1; @@ -234,18 +233,18 @@ copy_file(const FTSENT *entp, int dne) wtotal = 0; do { if (use_copy_file_range) { - rcount = copy_file_range(from_fd, NULL, + wcount = copy_file_range(from_fd, NULL, to_fd, NULL, SSIZE_MAX, 0); - if (rcount < 0 && errno == EINVAL) { + if (wcount < 0 && errno == EINVAL) { /* Prob a non-seekable FD */ use_copy_file_range = 0; } } if (!use_copy_file_range) { - rcount = copy_fallback(from_fd, to_fd, + wcount = copy_fallback(from_fd, to_fd, buf, bufsize); } - wtotal += rcount; + wtotal += wcount; if (info) { info = 0; (void)fprintf(stderr, @@ -253,8 +252,8 @@ copy_file(const FTSENT *entp, int dne) entp->fts_path, to.p_path, cp_pct(wtotal, fs->st_size)); } - } while (rcount > 0); - if (rcount < 0) { + } while (wcount > 0); + if (wcount < 0) { warn("%s", entp->fts_path); rval = 1; }