The branch main has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=2030ee0e1b17e45a162bba6a636e07886a9eb67c

commit 2030ee0e1b17e45a162bba6a636e07886a9eb67c
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2021-10-20 01:42:31 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2021-10-21 18:40:46 +0000

    ufs: remove write-only variables
    
    Mark variables as __diagused for invariant-only vars
    
    Reviewed by:    imp, mjg
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D32577
---
 sys/ufs/ffs/ffs_inode.c   |  6 ++----
 sys/ufs/ffs/ffs_softdep.c | 12 ++++--------
 sys/ufs/ffs/ffs_vfsops.c  |  5 ++---
 sys/ufs/ffs/ffs_vnops.c   |  4 ----
 4 files changed, 8 insertions(+), 19 deletions(-)

diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index 17a9dceeb654..4b31b4febcbd 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -244,8 +244,8 @@ ffs_truncate(vp, length, flags, cred)
        ufs2_daddr_t bn, lbn, lastblock, lastiblock[UFS_NIADDR];
        ufs2_daddr_t indir_lbn[UFS_NIADDR], oldblks[UFS_NDADDR + UFS_NIADDR];
        ufs2_daddr_t newblks[UFS_NDADDR + UFS_NIADDR];
-       ufs2_daddr_t count, blocksreleased = 0, datablocks, blkno;
-       struct bufobj *bo;
+       ufs2_daddr_t count, blocksreleased = 0, blkno;
+       struct bufobj *bo __diagused;
        struct fs *fs;
        struct buf *bp;
        struct ufsmount *ump;
@@ -297,10 +297,8 @@ ffs_truncate(vp, length, flags, cred)
        if (journaltrunc == 0 && DOINGSOFTDEP(vp) && length == 0)
                softdeptrunc = !softdep_slowdown(vp);
        extblocks = 0;
-       datablocks = DIP(ip, i_blocks);
        if (fs->fs_magic == FS_UFS2_MAGIC && ip->i_din2->di_extsize > 0) {
                extblocks = btodb(fragroundup(fs, ip->i_din2->di_extsize));
-               datablocks -= extblocks;
        }
        if ((flags & IO_EXT) && extblocks > 0) {
                if (length != 0)
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index ff55a918ade5..969f7554dd0a 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -5064,7 +5064,7 @@ softdep_setup_create(dp, ip)
        struct inode *ip;
 {
        struct inodedep *inodedep;
-       struct jaddref *jaddref;
+       struct jaddref *jaddref __diagused;
        struct vnode *dvp;
 
        KASSERT(MOUNTEDSOFTDEP(ITOVFS(dp)) != 0,
@@ -5205,11 +5205,9 @@ softdep_setup_rmdir(dp, ip)
        struct inode *dp;
        struct inode *ip;
 {
-       struct vnode *dvp;
 
        KASSERT(MOUNTEDSOFTDEP(ITOVFS(dp)) != 0,
            ("softdep_setup_rmdir called on non-softdep filesystem"));
-       dvp = ITOV(dp);
        ACQUIRE_LOCK(ITOUMP(dp));
        (void) inodedep_lookup_ip(ip);
        (void) inodedep_lookup_ip(dp);
@@ -5225,11 +5223,9 @@ softdep_setup_unlink(dp, ip)
        struct inode *dp;
        struct inode *ip;
 {
-       struct vnode *dvp;
 
        KASSERT(MOUNTEDSOFTDEP(ITOVFS(dp)) != 0,
            ("softdep_setup_unlink called on non-softdep filesystem"));
-       dvp = ITOV(dp);
        ACQUIRE_LOCK(ITOUMP(dp));
        (void) inodedep_lookup_ip(ip);
        (void) inodedep_lookup_ip(dp);
@@ -6424,7 +6420,7 @@ setup_allocindir_phase2(bp, ip, inodedep, aip, lbn)
        struct allocindir *aip; /* allocindir allocated by the above routines */
        ufs_lbn_t lbn;          /* Logical block number for this block. */
 {
-       struct fs *fs;
+       struct fs *fs __diagused;
        struct indirdep *indirdep;
        struct allocindir *oldaip;
        struct freefrag *freefrag;
@@ -10626,7 +10622,7 @@ initiate_write_inodeblock_ufs1(inodedep, bp)
 #ifdef INVARIANTS
        ufs_lbn_t prevlbn = 0;
 #endif
-       int deplist;
+       int deplist __diagused;
 
        if (inodedep->id_state & IOSTARTED)
                panic("initiate_write_inodeblock_ufs1: already started");
@@ -10798,7 +10794,7 @@ initiate_write_inodeblock_ufs2(inodedep, bp)
 #ifdef INVARIANTS
        ufs_lbn_t prevlbn = 0;
 #endif
-       int deplist;
+       int deplist __diagused;
 
        if (inodedep->id_state & IOSTARTED)
                panic("initiate_write_inodeblock_ufs2: already started");
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 94afcae05ba6..d1773402002e 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -347,7 +347,8 @@ ffs_mount(struct mount *mp)
        struct thread *td;
        struct ufsmount *ump = NULL;
        struct fs *fs;
-       int error, error1, flags;
+       int error, flags;
+       int error1 __diagused;
        uint64_t mntorflags, saved_mnt_flag;
        accmode_t accmode;
        struct nameidata ndp;
@@ -1613,11 +1614,9 @@ ffs_sync_lazy(mp)
 {
        struct vnode *mvp, *vp;
        struct inode *ip;
-       struct thread *td;
        int allerror, error;
 
        allerror = 0;
-       td = curthread;
        if ((mp->mnt_flag & MNT_NOATIME) != 0) {
 #ifdef QUOTA
                qsync(mp);
diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c
index a1657db9ece2..24bb39a3d48f 100644
--- a/sys/ufs/ffs/ffs_vnops.c
+++ b/sys/ufs/ffs/ffs_vnops.c
@@ -1399,7 +1399,6 @@ static int
 ffs_open_ea(struct vnode *vp, struct ucred *cred, struct thread *td)
 {
        struct inode *ip;
-       struct ufs2_dinode *dp;
        int error;
 
        ip = VTOI(vp);
@@ -1410,7 +1409,6 @@ ffs_open_ea(struct vnode *vp, struct ucred *cred, struct 
thread *td)
                ffs_unlock_ea(vp);
                return (0);
        }
-       dp = ip->i_din2;
        error = ffs_rdextattr(&ip->i_ea_area, vp, td);
        if (error) {
                ffs_unlock_ea(vp);
@@ -1994,7 +1992,6 @@ ffs_vput_pair(struct vop_vput_pair_args *ap)
        struct inode *dp, *ip;
        ino_t ip_ino;
        u_int64_t ip_gen;
-       off_t old_size;
        int error, vp_locked;
 
        dvp = ap->a_dvp;
@@ -2031,7 +2028,6 @@ ffs_vput_pair(struct vop_vput_pair_args *ap)
                VNASSERT(I_ENDOFF(dp) != 0 && I_ENDOFF(dp) < dp->i_size, dvp,
                    ("IN_ENDOFF set but I_ENDOFF() is not"));
                dp->i_flag &= ~IN_ENDOFF;
-               old_size = dp->i_size;
                error = UFS_TRUNCATE(dvp, (off_t)I_ENDOFF(dp), IO_NORMAL |
                    (DOINGASYNC(dvp) ? 0 : IO_SYNC), curthread->td_ucred);
                if (error != 0 && error != ERELOOKUP) {

Reply via email to