From nobody Mon Feb 07 09:50:53 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 910E419C1392; Mon, 7 Feb 2022 09:50:55 +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 4JshGj5Yppz3s6C; Mon, 7 Feb 2022 09:50:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644227455; 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=iawkTeMnn7BopcaZYD3ukPNJc+ypNy80j5YFn52CdXA=; b=pxbCXh4xcyiPoD3Ez8CUk+heFUbBayMVlCtqIfSl1tyTlPTdbJRfuc7eiL7KtEsx8gvBoh 4zJ8rEDnVZkrpA7zwp9xrlk+5l+Cmqyil76M32M2b6p95c1ML3kijHkC9VmxSKriWwQ+jW XU6VM+p0iAa1YWLXWeq/9Ygz9pjwXNuV8+Eb3GpuqXLG0L5mjTZmDT+1ZO7BwuTJDkds9V Qpr1cuMqAG2wL7UIEvhpmCu6fuJK2hQiVRt4GreSRbc6gO6PJz8BjxP2zNmzK8vI6vPrw1 RXLQIhOye3dPQjz5Xe6nP+pSI+MhObG9TitQHmdRrAxBUDmSrLskob8vcbsr3w== 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 6E8CE2362B; Mon, 7 Feb 2022 09:50:53 +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 2179orf0059032; Mon, 7 Feb 2022 09:50:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2179orbv059031; Mon, 7 Feb 2022 09:50:53 GMT (envelope-from git) Date: Mon, 7 Feb 2022 09:50:53 GMT Message-Id: <202202070950.2179orbv059031@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 8fcc0d7b3939 - stable/13 - ufs: Use IS_SNAPSHOT() 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: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8fcc0d7b393904702bef5cbe1b760454b02ce0fb Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644227455; 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=iawkTeMnn7BopcaZYD3ukPNJc+ypNy80j5YFn52CdXA=; b=EkUCTCJCZs/4EW3gB+OyJX9nQNzDj+0JuIhkqOtSQAMAE1o9SAVdb9nU5BviUbzP/UlQ+X Hf2Bse2TD23YoMQB95guNhSCxnr56cp5eIytBY9G+qzZCbEet3peM4yHlQky4Yxyu65JGi 6nKvEs0sCKvDsmFRf+A+SqFCdiLSrmnCBKKpvD86qB/ebratfmWNblN18sS+D5ArFbuY4O vZ3RKpWiCrq2bL+EiU3kQPIXzYtqKTURpksidmAMvVNoaZs250WoeJLpAM2yFSiNF4dHxA EtJpvqF5SRq9UBAHnkt/vXN30J0oNdG+F8z3Ck7ZJco06EsHWQUaxnlHY5MtUg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644227455; a=rsa-sha256; cv=none; b=ADh7yJeus6XYTbB/sA3ifByPoidEQQJIGXKbrvtO+3GnksnK6WutnDszWSFLpOxrc5qj6t vPvRfBbPV5lbn4OMSHKCu7M/OWx83U2do/P+f2kjiLrwsuZgnq0fZCP/F8HCdfYwivWuwG PRWQXfzpAnmNPOC8M/UzVkZUsjbA1JTaeWKsSDIHdZIfd4USHO+mgrh9SCYgBLNZPtKxFb MxSbiRUIEgYsbFd3HijYOEhrODLotahlcU9yTVkBLqeNaJ2H1AvCITZyIeWFl8K+h9hUPl XaSF2P6sxO5gd4O24UHQruHazAID8xAA25GJjBqZ4TDU6ngwt/LUTksDO1P1IQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8fcc0d7b393904702bef5cbe1b760454b02ce0fb commit 8fcc0d7b393904702bef5cbe1b760454b02ce0fb Author: Konstantin Belousov AuthorDate: 2022-01-20 13:17:59 +0000 Commit: Konstantin Belousov CommitDate: 2022-02-07 09:38:50 +0000 ufs: Use IS_SNAPSHOT() (cherry picked from commit 0cdc6033087ac28640fa750a4dc4676107d4f364) --- sys/ufs/ufs/ufs_bmap.c | 14 ++++++-------- sys/ufs/ufs/ufs_lookup.c | 5 ++--- sys/ufs/ufs/ufs_vnops.c | 10 +++++----- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/sys/ufs/ufs/ufs_bmap.c b/sys/ufs/ufs/ufs_bmap.c index b60c93fb9105..5b9a16782cf7 100644 --- a/sys/ufs/ufs/ufs_bmap.c +++ b/sys/ufs/ufs/ufs_bmap.c @@ -217,14 +217,12 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb) * return a request for a zeroed out buffer if attempts * are made to read a BLK_NOCOPY or BLK_SNAP block. */ - if ((ip->i_flags & SF_SNAPSHOT) && DIP(ip, i_db[bn]) > 0 && + if (IS_SNAPSHOT(ip) && DIP(ip, i_db[bn]) > 0 && DIP(ip, i_db[bn]) < ump->um_seqinc) { *bnp = -1; } else if (*bnp == 0) { - if (ip->i_flags & SF_SNAPSHOT) - *bnp = blkptrtodb(ump, bn * ump->um_seqinc); - else - *bnp = -1; + *bnp = IS_SNAPSHOT(ip) ? blkptrtodb(ump, + bn * ump->um_seqinc) : -1; } else if (runp) { ufs2_daddr_t bnb = bn; for (++bn; bn < UFS_NDADDR && *runp < maxrun && @@ -320,13 +318,13 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb) * return a request for a zeroed out buffer if attempts are made * to read a BLK_NOCOPY or BLK_SNAP block. */ - if ((ip->i_flags & SF_SNAPSHOT) && daddr > 0 && daddr < ump->um_seqinc){ + if (IS_SNAPSHOT(ip) && daddr > 0 && daddr < ump->um_seqinc){ *bnp = -1; return (0); } *bnp = blkptrtodb(ump, daddr); if (*bnp == 0) { - if (ip->i_flags & SF_SNAPSHOT) + if (IS_SNAPSHOT(ip)) *bnp = blkptrtodb(ump, bn * ump->um_seqinc); else *bnp = -1; @@ -367,7 +365,7 @@ ufs_bmap_seekdata(vp, offp) mp = vp->v_mount; ump = VFSTOUFS(mp); - if (vp->v_type != VREG || (ip->i_flags & SF_SNAPSHOT) != 0) + if (vp->v_type != VREG || IS_SNAPSHOT(ip)) return (EINVAL); if (*offp < 0 || *offp >= ip->i_size) return (ENXIO); diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c index fc78c017e2c6..bf21c4f57e12 100644 --- a/sys/ufs/ufs/ufs_lookup.c +++ b/sys/ufs/ufs/ufs_lookup.c @@ -1245,8 +1245,7 @@ out: * drop its snapshot reference so that it will be reclaimed * when last open reference goes away. */ - if (ip != NULL && (ip->i_flags & SF_SNAPSHOT) != 0 && - ip->i_effnlink == 0) + if (ip != NULL && IS_SNAPSHOT(ip) && ip->i_effnlink == 0) UFS_SNAPGONE(ip); return (error); } @@ -1320,7 +1319,7 @@ ufs_dirrewrite(dp, oip, newinum, newtype, isrmdir) * drop its snapshot reference so that it will be reclaimed * when last open reference goes away. */ - if ((oip->i_flags & SF_SNAPSHOT) != 0 && oip->i_effnlink == 0) + if (IS_SNAPSHOT(oip) && oip->i_effnlink == 0) UFS_SNAPGONE(oip); return (error); } diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index e962ef8ca48c..a1306fa18f58 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -702,7 +702,7 @@ ufs_setattr(ap) */ if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); - if ((ip->i_flags & SF_SNAPSHOT) != 0) + if (IS_SNAPSHOT(ip)) return (EPERM); break; default: @@ -726,7 +726,7 @@ ufs_setattr(ap) vap->va_birthtime.tv_sec != VNOVAL) { if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); - if ((ip->i_flags & SF_SNAPSHOT) != 0) + if (IS_SNAPSHOT(ip)) return (EPERM); error = vn_utimes_perm(vp, vap, cred, td); if (error != 0) @@ -754,8 +754,8 @@ ufs_setattr(ap) if (vap->va_mode != (mode_t)VNOVAL) { if (vp->v_mount->mnt_flag & MNT_RDONLY) return (EROFS); - if ((ip->i_flags & SF_SNAPSHOT) != 0 && (vap->va_mode & - (S_IXUSR | S_IWUSR | S_IXGRP | S_IWGRP | S_IXOTH | S_IWOTH))) + if (IS_SNAPSHOT(ip) && (vap->va_mode & (S_IXUSR | S_IWUSR | + S_IXGRP | S_IWGRP | S_IXOTH | S_IWOTH)) != 0) return (EPERM); error = ufs_chmod(vp, (int)vap->va_mode, cred, td); } @@ -1022,7 +1022,7 @@ ufs_remove(ap) error = ufs_dirremove(dvp, ip, ap->a_cnp->cn_flags, 0); if (ip->i_nlink <= 0) vp->v_vflag |= VV_NOSYNC; - if ((ip->i_flags & SF_SNAPSHOT) != 0) { + if (IS_SNAPSHOT(ip)) { /* * Avoid deadlock where another thread is trying to * update the inodeblock for dvp and is waiting on