From nobody Sat Dec 24 06:33:19 2022 X-Original-To: dev-commits-src-main@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 4NfDl33m1cz1J8Jp; Sat, 24 Dec 2022 06:33:19 +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 4NfDl33JDHz4Mm0; Sat, 24 Dec 2022 06:33:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671863599; 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=3MnBJ89jRfXZtRD2lkUwGO4nXkHwJBIO1SX8ZJCuS8Q=; b=RlCmtMfrozfOTjzP2FVr6LiYfgh89Aml4MhrIrpU4vum+Lwa/S68JVTzfWtVnidXXBoWh/ Pl7rZv2IyEM0JewovmHq1Ms7LYQvwekkWtDKp74V97qsuOzC5QAMS6+BqklyeDTCtJpz10 /dbetAsTJwdN7sd9B4ulCcw/B0/YbRrO8zafsCcfNEZF0divU0Z/tWXP7Of5X8Zlo2zNmJ jJpN6z/WsT9gdac7Bx9DVOtjEpQ4j0/zwPtBFRQ17TqgQSRSknmQmwv/AJFv3ddUigeZu0 zJkFo7qeTbISfE339hS6JrSqS8Aw5PfpPTiivMqBSF+vTKT3nAvzhtpGBMc/Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671863599; 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=3MnBJ89jRfXZtRD2lkUwGO4nXkHwJBIO1SX8ZJCuS8Q=; b=YumH6aHAYXigQIjYCfWyyNYTCfvYUMBhmdgDsaGva2twEd+CFmTKvmLY8aCXSKDpzhDuo+ Hp8Q8P1DMaCubSgqJQIQEqCDFvvcQzNZBdwZreYvrFqFpw7K0MQfYNdtrMtl9EgL4nq049 q76Fgtmzox3POfHPZU8PEzBOwIBGdP9QZ9UpoSAAYjzxPimPdyVB11ZfoSLz+F3Tn9bRYE aWK93A+niv1vKClRwMaPH1cyzhdoo9jDFWSF0stfOM627/6k5zy80EgOZ8923cVpaBAay5 f3eSphOkKZPazToQI45YlqsVlXkCK7s/UxxjYu7YY7J7KOk9EfYHSqbZpcZcuw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1671863599; a=rsa-sha256; cv=none; b=dBj9nX3jqF5xuw8j2DxXdzpkeSEWqXqPlE54Li425ljrgyG/lM4kcf1e5ZSjkmRc3b49aC gwCAsWLfgnYiUyPXBYfNe7CvAZVV2G9zRWCaEQT49g41VgJCvnrg9/t+I27J/GHn5gs7Xr SheYTd+/IlJbT7b9c6aYkhs3PE5iAKcVcns/SBxGdyxV6UJqR5ZHRZLZQzAb2p8HWxvBXC splXC3w7pEiq2KMSWXc54VAXrb/hsjMLD0xtVpZfalIZwqAR+xiv19cKHAdgaqdFY+glF1 SpnTfLO0t1Kx36n/k7U21FJbjDf55CRTIpsfYYJqZwdo8Za1n2lJ5gWdNX0Hxw== 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 4NfDl32Mwnz13mB; Sat, 24 Dec 2022 06:33:19 +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 2BO6XJBo012476; Sat, 24 Dec 2022 06:33:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2BO6XJv5012475; Sat, 24 Dec 2022 06:33:19 GMT (envelope-from git) Date: Sat, 24 Dec 2022 06:33:19 GMT Message-Id: <202212240633.2BO6XJv5012475@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 860399eb86cc - main - tmpfs: update changed/modified timestamps for truncates that do not change size List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 860399eb86cc431412bfbce0ab76c6652e5b6c07 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=860399eb86cc431412bfbce0ab76c6652e5b6c07 commit 860399eb86cc431412bfbce0ab76c6652e5b6c07 Author: Konstantin Belousov AuthorDate: 2022-12-24 00:11:05 +0000 Commit: Konstantin Belousov CommitDate: 2022-12-24 06:32:48 +0000 tmpfs: update changed/modified timestamps for truncates that do not change size While there, move all error checks into the common place at the start, and eliminate the 'out' label. PR: 268528 Analyzed and tested by: Mark Millard Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37866 --- sys/fs/tmpfs/tmpfs_subr.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index ef558c424914..7afabf6e4baa 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -2325,29 +2325,19 @@ tmpfs_itimes(struct vnode *vp, const struct timespec *acc, int tmpfs_truncate(struct vnode *vp, off_t length) { - int error; struct tmpfs_node *node; + int error; - node = VP_TO_TMPFS_NODE(vp); - - if (length < 0) { - error = EINVAL; - goto out; - } - - if (node->tn_size == length) { - error = 0; - goto out; - } - + if (length < 0) + return (EINVAL); if (length > VFS_TO_TMPFS(vp->v_mount)->tm_maxfilesize) return (EFBIG); - error = tmpfs_reg_resize(vp, length, FALSE); + node = VP_TO_TMPFS_NODE(vp); + error = node->tn_size == length ? 0 : tmpfs_reg_resize(vp, length, + FALSE); if (error == 0) node->tn_status |= TMPFS_NODE_CHANGED | TMPFS_NODE_MODIFIED; - -out: tmpfs_update(vp); return (error);