From 0d7e3746ebec6211a63289800d563a790263bcee Mon Sep 17 00:00:00 2001 From: mycroft Date: Sun, 15 Aug 2004 21:34:14 +0000 Subject: [PATCH] Repair some FFS_EI code for ufsmount changes. --- sys/ufs/ufs/ufs_bmap.c | 40 ++++++++++++++++++++-------------------- sys/ufs/ufs/ufs_lookup.c | 14 ++++++-------- sys/ufs/ufs/ufs_vnops.c | 11 ++++++----- 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/sys/ufs/ufs/ufs_bmap.c b/sys/ufs/ufs/ufs_bmap.c index 2fd01717f159..fd31a45b61a8 100644 --- a/sys/ufs/ufs/ufs_bmap.c +++ b/sys/ufs/ufs/ufs_bmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_bmap.c,v 1.31 2004/08/15 07:19:58 mycroft Exp $ */ +/* $NetBSD: ufs_bmap.c,v 1.32 2004/08/15 21:34:14 mycroft Exp $ */ /* * Copyright (c) 1989, 1991, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.31 2004/08/15 07:19:58 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.32 2004/08/15 21:34:14 mycroft Exp $"); #include #include @@ -156,12 +156,12 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp, is_sequential) if (bn >= 0 && bn < NDADDR) { if (nump != NULL) *nump = 0; - if (ip->i_ump->um_fstype == UFS1) + if (ump->um_fstype == UFS1) daddr = (int32_t)ufs_rw32(ip->i_ffs1_db[bn], - UFS_MPNEEDSWAP(vp->v_mount)); + UFS_MPNEEDSWAP(ump)); else daddr = ufs_rw64(ip->i_ffs2_db[bn], - UFS_MPNEEDSWAP(vp->v_mount)); + UFS_MPNEEDSWAP(ump)); *bnp = blkptrtodb(ump, daddr); /* * Since this is FFS independent code, we are out of @@ -181,21 +181,21 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp, is_sequential) *bnp = -1; } } else if (runp) { - if (ip->i_ump->um_fstype == UFS1) { + if (ump->um_fstype == UFS1) { for (++bn; bn < NDADDR && *runp < maxrun && is_sequential(ump, (int32_t)ufs_rw32(ip->i_ffs1_db[bn - 1], - UFS_MPNEEDSWAP(vp->v_mount)), + UFS_MPNEEDSWAP(ump)), (int32_t)ufs_rw32(ip->i_ffs1_db[bn], - UFS_MPNEEDSWAP(vp->v_mount))); + UFS_MPNEEDSWAP(ump))); ++bn, ++*runp); } else { for (++bn; bn < NDADDR && *runp < maxrun && is_sequential(ump, ufs_rw64(ip->i_ffs2_db[bn - 1], - UFS_MPNEEDSWAP(vp->v_mount)), + UFS_MPNEEDSWAP(ump)), ufs_rw64(ip->i_ffs2_db[bn], - UFS_MPNEEDSWAP(vp->v_mount))); + UFS_MPNEEDSWAP(ump))); ++bn, ++*runp); } } @@ -211,12 +211,12 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp, is_sequential) num = *nump; /* Get disk address out of indirect block array */ - if (ip->i_ump->um_fstype == UFS1) + if (ump->um_fstype == UFS1) daddr = (int32_t)ufs_rw32(ip->i_ffs1_ib[xap->in_off], - UFS_MPNEEDSWAP(vp->v_mount)); + UFS_MPNEEDSWAP(ump)); else daddr = ufs_rw64(ip->i_ffs2_ib[xap->in_off], - UFS_MPNEEDSWAP(vp->v_mount)); + UFS_MPNEEDSWAP(ump)); for (bp = NULL, ++xap; --num; ++xap) { /* @@ -266,33 +266,33 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp, is_sequential) return (error); } } - if (ip->i_ump->um_fstype == UFS1) { + if (ump->um_fstype == UFS1) { daddr = (int32_t)ufs_rw32( ((int32_t *)bp->b_data)[xap->in_off], - UFS_MPNEEDSWAP(mp)); + UFS_MPNEEDSWAP(ump)); if (num == 1 && daddr && runp) { for (bn = xap->in_off + 1; bn < MNINDIR(ump) && *runp < maxrun && is_sequential(ump, (int32_t)ufs_rw32( ((int32_t *)bp->b_data)[bn-1], - UFS_MPNEEDSWAP(mp)), + UFS_MPNEEDSWAP(ump)), (int32_t)ufs_rw32( ((int32_t *)bp->b_data)[bn], - UFS_MPNEEDSWAP(mp))); + UFS_MPNEEDSWAP(ump))); ++bn, ++*runp); } } else { daddr = ufs_rw64(((int64_t *)bp->b_data)[xap->in_off], - UFS_MPNEEDSWAP(mp)); + UFS_MPNEEDSWAP(ump)); if (num == 1 && daddr && runp) { for (bn = xap->in_off + 1; bn < MNINDIR(ump) && *runp < maxrun && is_sequential(ump, ufs_rw64(((int64_t *)bp->b_data)[bn-1], - UFS_MPNEEDSWAP(mp)), + UFS_MPNEEDSWAP(ump)), ufs_rw64(((int64_t *)bp->b_data)[bn], - UFS_MPNEEDSWAP(mp))); + UFS_MPNEEDSWAP(ump))); ++bn, ++*runp); } } diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c index 6a23e23b3b28..b4238a560636 100644 --- a/sys/ufs/ufs/ufs_lookup.c +++ b/sys/ufs/ufs/ufs_lookup.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_lookup.c,v 1.58 2004/08/15 07:19:58 mycroft Exp $ */ +/* $NetBSD: ufs_lookup.c,v 1.59 2004/08/15 21:44:11 mycroft Exp $ */ /* * Copyright (c) 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.58 2004/08/15 07:19:58 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.59 2004/08/15 21:44:11 mycroft Exp $"); #include #include @@ -958,16 +958,14 @@ ufs_dirremove(dvp, ip, flags, isrmdir) int flags; int isrmdir; { - struct inode *dp; + struct inode *dp = VTOI(dvp); struct direct *ep; struct buf *bp; int error; #ifdef FFS_EI - const int needswap = UFS_MPNEEDSWAP(dvp->v_mount); + const int needswap = UFS_MPNEEDSWAP(dp->i_ump); #endif - dp = VTOI(dvp); - if (flags & DOWHITEOUT) { /* * Whiteout entry: set d_ino to WINO. @@ -1048,7 +1046,7 @@ ufs_dirrewrite(dp, oip, newinum, newtype, isrmdir, iflags) error = VOP_BLKATOFF(vdp, (off_t)dp->i_offset, (void *)&ep, &bp); if (error) return (error); - ep->d_ino = ufs_rw32(newinum, UFS_MPNEEDSWAP(vdp->v_mount)); + ep->d_ino = ufs_rw32(newinum, UFS_MPNEEDSWAP(dp->i_ump)); if (!FSFMT(vdp)) ep->d_type = newtype; oip->i_ffs_effnlink--; @@ -1157,7 +1155,7 @@ ufs_checkpath(source, target, cred) struct vnode *vp = ITOV(target); int error, rootino, namlen; struct dirtemplate dirbuf; - const int needswap = UFS_MPNEEDSWAP(vp->v_mount); + const int needswap = UFS_MPNEEDSWAP(target->i_ump); vp = ITOV(target); if (target->i_number == source->i_number) { diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 6f7fc3d7c557..8132b77a7176 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_vnops.c,v 1.119 2004/08/15 07:20:00 mycroft Exp $ */ +/* $NetBSD: ufs_vnops.c,v 1.120 2004/08/15 21:44:11 mycroft Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993, 1995 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.119 2004/08/15 07:20:00 mycroft Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.120 2004/08/15 21:44:11 mycroft Exp $"); #ifndef _LKM #include "opt_quota.h" @@ -140,16 +140,17 @@ ufs_mknod(void *v) ino = ip->i_number; ip->i_flag |= IN_ACCESS | IN_CHANGE | IN_UPDATE; if (vap->va_rdev != VNOVAL) { + struct ufsmount *ump = ip->i_ump; /* * Want to be able to use this to make badblock * inodes, so don't truncate the dev number. */ - if (ip->i_ump->um_fstype == UFS1) + if (ump->um_fstype == UFS1) ip->i_ffs1_rdev = ufs_rw32(vap->va_rdev, - UFS_MPNEEDSWAP(mp)); + UFS_MPNEEDSWAP(ump)); else ip->i_ffs2_rdev = ufs_rw64(vap->va_rdev, - UFS_MPNEEDSWAP(mp)); + UFS_MPNEEDSWAP(ump)); } /* * Remove inode so that it will be reloaded by VFS_VGET and