Reduce size of ufs inode.
Remove redunand i_dev and i_fs pointers, which are available as ip->i_ump->um_dev and ip->i_ump->um_fs, and reorder members by size to reduce padding. To compensate added derefences, the most often i_ump access to differentiate between UFS1 and UFS2 dinode layout is removed, by addition of the new i_flag IN_UFS2. Overall, this actually reduces the amount of memory dereferences. On 64bit machine, original struct inode size is 176, reduced to 152 bytes with the change. Tested by: pho (previous version) Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
This commit is contained in:
parent
cb9813432a
commit
e1db68971e
@ -163,13 +163,13 @@ ffs_alloc(ip, lbn, bpref, size, flags, cred, bnp)
|
||||
#endif
|
||||
|
||||
*bnp = 0;
|
||||
fs = ip->i_fs;
|
||||
ump = ip->i_ump;
|
||||
ump = ITOUMP(ip);
|
||||
fs = ump->um_fs;
|
||||
mtx_assert(UFS_MTX(ump), MA_OWNED);
|
||||
#ifdef INVARIANTS
|
||||
if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0) {
|
||||
printf("dev = %s, bsize = %ld, size = %d, fs = %s\n",
|
||||
devtoname(ip->i_dev), (long)fs->fs_bsize, size,
|
||||
devtoname(ump->um_dev), (long)fs->fs_bsize, size,
|
||||
fs->fs_fsmnt);
|
||||
panic("ffs_alloc: bad size");
|
||||
}
|
||||
@ -260,9 +260,9 @@ ffs_realloccg(ip, lbprev, bprev, bpref, osize, nsize, flags, cred, bpp)
|
||||
int64_t delta;
|
||||
|
||||
vp = ITOV(ip);
|
||||
fs = ip->i_fs;
|
||||
ump = ITOUMP(ip);
|
||||
fs = ump->um_fs;
|
||||
bp = NULL;
|
||||
ump = ip->i_ump;
|
||||
gbflags = (flags & BA_UNMAPPED) != 0 ? GB_UNMAPPED : 0;
|
||||
|
||||
mtx_assert(UFS_MTX(ump), MA_OWNED);
|
||||
@ -273,7 +273,7 @@ ffs_realloccg(ip, lbprev, bprev, bpref, osize, nsize, flags, cred, bpp)
|
||||
(u_int)nsize > fs->fs_bsize || fragoff(fs, nsize) != 0) {
|
||||
printf(
|
||||
"dev = %s, bsize = %ld, osize = %d, nsize = %d, fs = %s\n",
|
||||
devtoname(ip->i_dev), (long)fs->fs_bsize, osize,
|
||||
devtoname(ump->um_dev), (long)fs->fs_bsize, osize,
|
||||
nsize, fs->fs_fsmnt);
|
||||
panic("ffs_realloccg: bad size");
|
||||
}
|
||||
@ -288,7 +288,7 @@ retry:
|
||||
}
|
||||
if (bprev == 0) {
|
||||
printf("dev = %s, bsize = %ld, bprev = %jd, fs = %s\n",
|
||||
devtoname(ip->i_dev), (long)fs->fs_bsize, (intmax_t)bprev,
|
||||
devtoname(ump->um_dev), (long)fs->fs_bsize, (intmax_t)bprev,
|
||||
fs->fs_fsmnt);
|
||||
panic("ffs_realloccg: bad bprev");
|
||||
}
|
||||
@ -383,7 +383,7 @@ retry:
|
||||
break;
|
||||
default:
|
||||
printf("dev = %s, optim = %ld, fs = %s\n",
|
||||
devtoname(ip->i_dev), (long)fs->fs_optim, fs->fs_fsmnt);
|
||||
devtoname(ump->um_dev), (long)fs->fs_optim, fs->fs_fsmnt);
|
||||
panic("ffs_realloccg: bad optim");
|
||||
/* NOTREACHED */
|
||||
}
|
||||
@ -391,7 +391,7 @@ retry:
|
||||
if (bno > 0) {
|
||||
bp->b_blkno = fsbtodb(fs, bno);
|
||||
if (!DOINGSOFTDEP(vp))
|
||||
ffs_blkfree(ump, fs, ip->i_devvp, bprev, (long)osize,
|
||||
ffs_blkfree(ump, fs, ump->um_devvp, bprev, (long)osize,
|
||||
ip->i_number, vp->v_type, NULL);
|
||||
delta = btodb(nsize - osize);
|
||||
DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + delta);
|
||||
@ -490,7 +490,7 @@ ffs_reallocblks(ap)
|
||||
* These devices are flash and therefore work less well with this
|
||||
* optimization. Also skip if reallocblks has been disabled globally.
|
||||
*/
|
||||
ump = VTOI(ap->a_vp)->i_ump;
|
||||
ump = ap->a_vp->v_mount->mnt_data;
|
||||
if (ump->um_candelete || doreallocblks == 0)
|
||||
return (ENOSPC);
|
||||
|
||||
@ -529,8 +529,8 @@ ffs_reallocblks_ufs1(ap)
|
||||
|
||||
vp = ap->a_vp;
|
||||
ip = VTOI(vp);
|
||||
fs = ip->i_fs;
|
||||
ump = ip->i_ump;
|
||||
ump = ITOUMP(ip);
|
||||
fs = ump->um_fs;
|
||||
/*
|
||||
* If we are not tracking block clusters or if we have less than 4%
|
||||
* free blocks left, then do not attempt to cluster. Running with
|
||||
@ -727,7 +727,7 @@ ffs_reallocblks_ufs1(ap)
|
||||
#endif
|
||||
for (blkno = newblk, i = 0; i < len; i++, blkno += fs->fs_frag) {
|
||||
if (!DOINGSOFTDEP(vp))
|
||||
ffs_blkfree(ump, fs, ip->i_devvp,
|
||||
ffs_blkfree(ump, fs, ump->um_devvp,
|
||||
dbtofsb(fs, buflist->bs_children[i]->b_blkno),
|
||||
fs->fs_bsize, ip->i_number, vp->v_type, NULL);
|
||||
buflist->bs_children[i]->b_blkno = fsbtodb(fs, blkno);
|
||||
@ -778,8 +778,8 @@ ffs_reallocblks_ufs2(ap)
|
||||
|
||||
vp = ap->a_vp;
|
||||
ip = VTOI(vp);
|
||||
fs = ip->i_fs;
|
||||
ump = ip->i_ump;
|
||||
ump = ITOUMP(ip);
|
||||
fs = ump->um_fs;
|
||||
/*
|
||||
* If we are not tracking block clusters or if we have less than 4%
|
||||
* free blocks left, then do not attempt to cluster. Running with
|
||||
@ -975,7 +975,7 @@ ffs_reallocblks_ufs2(ap)
|
||||
#endif
|
||||
for (blkno = newblk, i = 0; i < len; i++, blkno += fs->fs_frag) {
|
||||
if (!DOINGSOFTDEP(vp))
|
||||
ffs_blkfree(ump, fs, ip->i_devvp,
|
||||
ffs_blkfree(ump, fs, ump->um_devvp,
|
||||
dbtofsb(fs, buflist->bs_children[i]->b_blkno),
|
||||
fs->fs_bsize, ip->i_number, vp->v_type, NULL);
|
||||
buflist->bs_children[i]->b_blkno = fsbtodb(fs, blkno);
|
||||
@ -1040,8 +1040,8 @@ ffs_valloc(pvp, mode, cred, vpp)
|
||||
|
||||
*vpp = NULL;
|
||||
pip = VTOI(pvp);
|
||||
fs = pip->i_fs;
|
||||
ump = pip->i_ump;
|
||||
ump = ITOUMP(pip);
|
||||
fs = ump->um_fs;
|
||||
|
||||
UFS_LOCK(ump);
|
||||
reclaimed = 0;
|
||||
@ -1114,10 +1114,12 @@ dup_alloc:
|
||||
ip->i_flag = 0;
|
||||
(*vpp)->v_vflag = 0;
|
||||
(*vpp)->v_type = VNON;
|
||||
if (fs->fs_magic == FS_UFS2_MAGIC)
|
||||
if (fs->fs_magic == FS_UFS2_MAGIC) {
|
||||
(*vpp)->v_op = &ffs_vnodeops2;
|
||||
else
|
||||
ip->i_flag |= IN_UFS2;
|
||||
} else {
|
||||
(*vpp)->v_op = &ffs_vnodeops1;
|
||||
}
|
||||
return (0);
|
||||
noinodes:
|
||||
if (reclaimed == 0) {
|
||||
@ -1158,8 +1160,8 @@ ffs_dirpref(pip)
|
||||
u_int mincg, minndir;
|
||||
u_int maxcontigdirs;
|
||||
|
||||
mtx_assert(UFS_MTX(pip->i_ump), MA_OWNED);
|
||||
fs = pip->i_fs;
|
||||
mtx_assert(UFS_MTX(ITOUMP(pip)), MA_OWNED);
|
||||
fs = ITOFS(pip);
|
||||
|
||||
avgifree = fs->fs_cstotal.cs_nifree / fs->fs_ncg;
|
||||
avgbfree = fs->fs_cstotal.cs_nbfree / fs->fs_ncg;
|
||||
@ -1307,8 +1309,8 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap)
|
||||
ufs2_daddr_t pref;
|
||||
|
||||
KASSERT(indx <= 0 || bap != NULL, ("need non-NULL bap"));
|
||||
mtx_assert(UFS_MTX(ip->i_ump), MA_OWNED);
|
||||
fs = ip->i_fs;
|
||||
mtx_assert(UFS_MTX(ITOUMP(ip)), MA_OWNED);
|
||||
fs = ITOFS(ip);
|
||||
/*
|
||||
* Allocation of indirect blocks is indicated by passing negative
|
||||
* values in indx: -1 for single indirect, -2 for double indirect,
|
||||
@ -1412,8 +1414,8 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap)
|
||||
ufs2_daddr_t pref;
|
||||
|
||||
KASSERT(indx <= 0 || bap != NULL, ("need non-NULL bap"));
|
||||
mtx_assert(UFS_MTX(ip->i_ump), MA_OWNED);
|
||||
fs = ip->i_fs;
|
||||
mtx_assert(UFS_MTX(ITOUMP(ip)), MA_OWNED);
|
||||
fs = ITOFS(ip);
|
||||
/*
|
||||
* Allocation of indirect blocks is indicated by passing negative
|
||||
* values in indx: -1 for single indirect, -2 for double indirect,
|
||||
@ -1526,12 +1528,12 @@ ffs_hashalloc(ip, cg, pref, size, rsize, allocator)
|
||||
ufs2_daddr_t result;
|
||||
u_int i, icg = cg;
|
||||
|
||||
mtx_assert(UFS_MTX(ip->i_ump), MA_OWNED);
|
||||
mtx_assert(UFS_MTX(ITOUMP(ip)), MA_OWNED);
|
||||
#ifdef INVARIANTS
|
||||
if (ITOV(ip)->v_mount->mnt_kern_flag & MNTK_SUSPENDED)
|
||||
panic("ffs_hashalloc: allocation on suspended filesystem");
|
||||
#endif
|
||||
fs = ip->i_fs;
|
||||
fs = ITOFS(ip);
|
||||
/*
|
||||
* 1: preferred cylinder group
|
||||
*/
|
||||
@ -1589,8 +1591,8 @@ ffs_fragextend(ip, cg, bprev, osize, nsize)
|
||||
int i, error;
|
||||
u_int8_t *blksfree;
|
||||
|
||||
ump = ip->i_ump;
|
||||
fs = ip->i_fs;
|
||||
ump = ITOUMP(ip);
|
||||
fs = ump->um_fs;
|
||||
if (fs->fs_cs(fs, cg).cs_nffree < numfrags(fs, nsize - osize))
|
||||
return (0);
|
||||
frags = numfrags(fs, nsize);
|
||||
@ -1600,8 +1602,8 @@ ffs_fragextend(ip, cg, bprev, osize, nsize)
|
||||
return (0);
|
||||
}
|
||||
UFS_UNLOCK(ump);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, NOCRED, &bp);
|
||||
error = bread(ump->um_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, NOCRED, &bp);
|
||||
if (error)
|
||||
goto fail;
|
||||
cgp = (struct cg *)bp->b_data;
|
||||
@ -1673,13 +1675,13 @@ ffs_alloccg(ip, cg, bpref, size, rsize)
|
||||
int i, allocsiz, error, frags;
|
||||
u_int8_t *blksfree;
|
||||
|
||||
ump = ip->i_ump;
|
||||
fs = ip->i_fs;
|
||||
ump = ITOUMP(ip);
|
||||
fs = ump->um_fs;
|
||||
if (fs->fs_cs(fs, cg).cs_nbfree == 0 && size == fs->fs_bsize)
|
||||
return (0);
|
||||
UFS_UNLOCK(ump);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, NOCRED, &bp);
|
||||
error = bread(ump->um_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, NOCRED, &bp);
|
||||
if (error)
|
||||
goto fail;
|
||||
cgp = (struct cg *)bp->b_data;
|
||||
@ -1775,8 +1777,8 @@ ffs_alloccgblk(ip, bp, bpref, size)
|
||||
u_int8_t *blksfree;
|
||||
int i, cgbpref;
|
||||
|
||||
fs = ip->i_fs;
|
||||
ump = ip->i_ump;
|
||||
ump = ITOUMP(ip);
|
||||
fs = ump->um_fs;
|
||||
mtx_assert(UFS_MTX(ump), MA_OWNED);
|
||||
cgp = (struct cg *)bp->b_data;
|
||||
blksfree = cg_blksfree(cgp);
|
||||
@ -1861,12 +1863,12 @@ ffs_clusteralloc(ip, cg, bpref, len)
|
||||
int32_t *lp;
|
||||
u_int8_t *blksfree;
|
||||
|
||||
fs = ip->i_fs;
|
||||
ump = ip->i_ump;
|
||||
ump = ITOUMP(ip);
|
||||
fs = ump->um_fs;
|
||||
if (fs->fs_maxcluster[cg] < len)
|
||||
return (0);
|
||||
UFS_UNLOCK(ump);
|
||||
if (bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize,
|
||||
if (bread(ump->um_devvp, fsbtodb(fs, cgtod(fs, cg)), (int)fs->fs_cgsize,
|
||||
NOCRED, &bp))
|
||||
goto fail_lock;
|
||||
cgp = (struct cg *)bp->b_data;
|
||||
@ -1965,8 +1967,8 @@ getinobuf(struct inode *ip, u_int cg, u_int32_t cginoblk, int gbflags)
|
||||
{
|
||||
struct fs *fs;
|
||||
|
||||
fs = ip->i_fs;
|
||||
return (getblk(ip->i_devvp, fsbtodb(fs, ino_to_fsba(fs,
|
||||
fs = ITOFS(ip);
|
||||
return (getblk(ITODEVVP(ip), fsbtodb(fs, ino_to_fsba(fs,
|
||||
cg * fs->fs_ipg + cginoblk)), (int)fs->fs_bsize, 0, 0,
|
||||
gbflags));
|
||||
}
|
||||
@ -1997,13 +1999,13 @@ ffs_nodealloccg(ip, cg, ipref, mode, unused)
|
||||
int error, start, len, i;
|
||||
u_int32_t old_initediblk;
|
||||
|
||||
fs = ip->i_fs;
|
||||
ump = ip->i_ump;
|
||||
ump = ITOUMP(ip);
|
||||
fs = ump->um_fs;
|
||||
check_nifree:
|
||||
if (fs->fs_cs(fs, cg).cs_nifree == 0)
|
||||
return (0);
|
||||
UFS_UNLOCK(ump);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
error = bread(ump->um_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, NOCRED, &bp);
|
||||
if (error) {
|
||||
brelse(bp);
|
||||
@ -2101,7 +2103,7 @@ gotit:
|
||||
* to it, then leave it unchanged as the other thread
|
||||
* has already set it correctly.
|
||||
*/
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
error = bread(ump->um_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, NOCRED, &bp);
|
||||
UFS_LOCK(ump);
|
||||
ACTIVECLEAR(fs, cg);
|
||||
@ -2166,7 +2168,8 @@ ffs_blkfree_cg(ump, fs, devvp, bno, size, inum, dephd)
|
||||
cg = dtog(fs, bno);
|
||||
if (devvp->v_type == VREG) {
|
||||
/* devvp is a snapshot */
|
||||
dev = VTOI(devvp)->i_devvp->v_rdev;
|
||||
MPASS(devvp->v_mount->mnt_data == ump);
|
||||
dev = ump->um_devvp->v_rdev;
|
||||
cgblkno = fragstoblks(fs, cgtod(fs, cg));
|
||||
} else {
|
||||
/* devvp is a normal disk device */
|
||||
@ -2396,7 +2399,7 @@ ffs_checkblk(ip, bno, size)
|
||||
int i, error, frags, free;
|
||||
u_int8_t *blksfree;
|
||||
|
||||
fs = ip->i_fs;
|
||||
fs = ITOFS(ip);
|
||||
if ((u_int)size > fs->fs_bsize || fragoff(fs, size) != 0) {
|
||||
printf("bsize = %ld, size = %ld, fs = %s\n",
|
||||
(long)fs->fs_bsize, size, fs->fs_fsmnt);
|
||||
@ -2404,7 +2407,7 @@ ffs_checkblk(ip, bno, size)
|
||||
}
|
||||
if ((u_int)bno >= fs->fs_size)
|
||||
panic("ffs_checkblk: bad block %jd", (intmax_t)bno);
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, dtog(fs, bno))),
|
||||
error = bread(ITODEVVP(ip), fsbtodb(fs, cgtod(fs, dtog(fs, bno))),
|
||||
(int)fs->fs_cgsize, NOCRED, &bp);
|
||||
if (error)
|
||||
panic("ffs_checkblk: cg bread failed");
|
||||
@ -2438,6 +2441,7 @@ ffs_vfree(pvp, ino, mode)
|
||||
ino_t ino;
|
||||
int mode;
|
||||
{
|
||||
struct ufsmount *ump;
|
||||
struct inode *ip;
|
||||
|
||||
if (DOINGSOFTDEP(pvp)) {
|
||||
@ -2445,8 +2449,8 @@ ffs_vfree(pvp, ino, mode)
|
||||
return (0);
|
||||
}
|
||||
ip = VTOI(pvp);
|
||||
return (ffs_freefile(ip->i_ump, ip->i_fs, ip->i_devvp, ino, mode,
|
||||
NULL));
|
||||
ump = VFSTOUFS(pvp->v_mount);
|
||||
return (ffs_freefile(ump, ump->um_fs, ump->um_devvp, ino, mode, NULL));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2473,7 +2477,8 @@ ffs_freefile(ump, fs, devvp, ino, mode, wkhd)
|
||||
cg = ino_to_cg(fs, ino);
|
||||
if (devvp->v_type == VREG) {
|
||||
/* devvp is a snapshot */
|
||||
dev = VTOI(devvp)->i_devvp->v_rdev;
|
||||
MPASS(devvp->v_mount->mnt_data == ump);
|
||||
dev = ump->um_devvp->v_rdev;
|
||||
cgbno = fragstoblks(fs, cgtod(fs, cg));
|
||||
} else {
|
||||
/* devvp is a normal disk device */
|
||||
@ -3056,7 +3061,7 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS)
|
||||
break;
|
||||
AUDIT_ARG_VNODE1(vp);
|
||||
ip = VTOI(vp);
|
||||
if (ip->i_ump->um_fstype == UFS1)
|
||||
if (I_IS_UFS1(ip))
|
||||
error = copyin((void *)(intptr_t)cmd.size, ip->i_din1,
|
||||
sizeof(struct ufs1_dinode));
|
||||
else
|
||||
@ -3076,7 +3081,7 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS)
|
||||
error = EPERM;
|
||||
break;
|
||||
}
|
||||
if (VTOI(vp)->i_ump != ump) {
|
||||
if (ITOUMP(VTOI(vp)) != ump) {
|
||||
error = EINVAL;
|
||||
break;
|
||||
}
|
||||
@ -3173,11 +3178,11 @@ buffered_write(fp, uio, active_cred, flags, td)
|
||||
return (EINVAL);
|
||||
}
|
||||
ip = VTOI(vp);
|
||||
if (ip->i_devvp != devvp) {
|
||||
if (ITODEVVP(ip) != devvp) {
|
||||
vput(vp);
|
||||
return (EINVAL);
|
||||
}
|
||||
fs = ip->i_fs;
|
||||
fs = ITOFS(ip);
|
||||
vput(vp);
|
||||
foffset_lock_uio(fp, uio, flags);
|
||||
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
|
||||
|
@ -111,8 +111,8 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, int size,
|
||||
|
||||
ip = VTOI(vp);
|
||||
dp = ip->i_din1;
|
||||
fs = ip->i_fs;
|
||||
ump = ip->i_ump;
|
||||
fs = ITOFS(ip);
|
||||
ump = ITOUMP(ip);
|
||||
lbn = lblkno(fs, startoffset);
|
||||
size = blkoff(fs, startoffset) + size;
|
||||
reclaimed = 0;
|
||||
@ -548,7 +548,7 @@ fail:
|
||||
}
|
||||
lbns_remfree++;
|
||||
#endif
|
||||
ffs_blkfree(ump, fs, ip->i_devvp, *blkp, fs->fs_bsize,
|
||||
ffs_blkfree(ump, fs, ump->um_devvp, *blkp, fs->fs_bsize,
|
||||
ip->i_number, vp->v_type, NULL);
|
||||
}
|
||||
return (error);
|
||||
@ -584,8 +584,8 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, int size,
|
||||
|
||||
ip = VTOI(vp);
|
||||
dp = ip->i_din2;
|
||||
fs = ip->i_fs;
|
||||
ump = ip->i_ump;
|
||||
fs = ITOFS(ip);
|
||||
ump = ITOUMP(ip);
|
||||
lbn = lblkno(fs, startoffset);
|
||||
size = blkoff(fs, startoffset) + size;
|
||||
reclaimed = 0;
|
||||
@ -1141,7 +1141,7 @@ fail:
|
||||
}
|
||||
lbns_remfree++;
|
||||
#endif
|
||||
ffs_blkfree(ump, fs, ip->i_devvp, *blkp, fs->fs_bsize,
|
||||
ffs_blkfree(ump, fs, ump->um_devvp, *blkp, fs->fs_bsize,
|
||||
ip->i_number, vp->v_type, NULL);
|
||||
}
|
||||
return (error);
|
||||
|
@ -92,8 +92,8 @@ ffs_update(vp, waitfor)
|
||||
if ((ip->i_flag & IN_MODIFIED) == 0 && waitfor == 0)
|
||||
return (0);
|
||||
ip->i_flag &= ~(IN_LAZYACCESS | IN_LAZYMOD | IN_MODIFIED);
|
||||
fs = ip->i_fs;
|
||||
if (fs->fs_ronly && ip->i_ump->um_fsckpid == 0)
|
||||
fs = ITOFS(ip);
|
||||
if (fs->fs_ronly && ITOUMP(ip)->um_fsckpid == 0)
|
||||
return (0);
|
||||
/*
|
||||
* If we are updating a snapshot and another process is currently
|
||||
@ -110,7 +110,7 @@ ffs_update(vp, waitfor)
|
||||
if (IS_SNAPSHOT(ip))
|
||||
flags = GB_LOCK_NOWAIT;
|
||||
loop:
|
||||
error = breadn_flags(ip->i_devvp,
|
||||
error = breadn_flags(ITODEVVP(ip),
|
||||
fsbtodb(fs, ino_to_fsba(fs, ip->i_number)),
|
||||
(int) fs->fs_bsize, 0, 0, 0, NOCRED, flags, &bp);
|
||||
if (error != 0) {
|
||||
@ -143,7 +143,7 @@ loop:
|
||||
softdep_update_inodeblock(ip, bp, waitfor);
|
||||
else if (ip->i_effnlink != ip->i_nlink)
|
||||
panic("ffs_update: bad link cnt");
|
||||
if (ip->i_ump->um_fstype == UFS1) {
|
||||
if (I_IS_UFS1(ip)) {
|
||||
*((struct ufs1_dinode *)bp->b_data +
|
||||
ino_to_fsbo(fs, ip->i_number)) = *ip->i_din1;
|
||||
/* XXX: FIX? The entropy here is desirable, but the harvesting may be expensive */
|
||||
@ -197,8 +197,8 @@ ffs_truncate(vp, length, flags, cred)
|
||||
off_t osize;
|
||||
|
||||
ip = VTOI(vp);
|
||||
fs = ip->i_fs;
|
||||
ump = ip->i_ump;
|
||||
ump = VFSTOUFS(vp->v_mount);
|
||||
fs = ump->um_fs;
|
||||
bo = &vp->v_bufobj;
|
||||
|
||||
ASSERT_VOP_LOCKED(vp, "ffs_truncate");
|
||||
@ -270,7 +270,7 @@ ffs_truncate(vp, length, flags, cred)
|
||||
for (i = 0; i < NXADDR; i++) {
|
||||
if (oldblks[i] == 0)
|
||||
continue;
|
||||
ffs_blkfree(ump, fs, ip->i_devvp, oldblks[i],
|
||||
ffs_blkfree(ump, fs, ITODEVVP(ip), oldblks[i],
|
||||
sblksize(fs, osize, i), ip->i_number,
|
||||
vp->v_type, NULL);
|
||||
}
|
||||
@ -346,7 +346,7 @@ ffs_truncate(vp, length, flags, cred)
|
||||
if (error)
|
||||
return (error);
|
||||
indiroff = (lbn - NDADDR) % NINDIR(fs);
|
||||
if (ip->i_ump->um_fstype == UFS1)
|
||||
if (I_IS_UFS1(ip))
|
||||
blkno = ((ufs1_daddr_t *)(bp->b_data))[indiroff];
|
||||
else
|
||||
blkno = ((ufs2_daddr_t *)(bp->b_data))[indiroff];
|
||||
@ -518,7 +518,7 @@ ffs_truncate(vp, length, flags, cred)
|
||||
blocksreleased += count;
|
||||
if (lastiblock[level] < 0) {
|
||||
DIP_SET(ip, i_ib[level], 0);
|
||||
ffs_blkfree(ump, fs, ip->i_devvp, bn,
|
||||
ffs_blkfree(ump, fs, ump->um_devvp, bn,
|
||||
fs->fs_bsize, ip->i_number,
|
||||
vp->v_type, NULL);
|
||||
blocksreleased += nblocks;
|
||||
@ -539,7 +539,7 @@ ffs_truncate(vp, length, flags, cred)
|
||||
continue;
|
||||
DIP_SET(ip, i_db[i], 0);
|
||||
bsize = blksize(fs, ip, i);
|
||||
ffs_blkfree(ump, fs, ip->i_devvp, bn, bsize, ip->i_number,
|
||||
ffs_blkfree(ump, fs, ump->um_devvp, bn, bsize, ip->i_number,
|
||||
vp->v_type, NULL);
|
||||
blocksreleased += btodb(bsize);
|
||||
}
|
||||
@ -571,7 +571,7 @@ ffs_truncate(vp, length, flags, cred)
|
||||
* required for the storage we're keeping.
|
||||
*/
|
||||
bn += numfrags(fs, newspace);
|
||||
ffs_blkfree(ump, fs, ip->i_devvp, bn,
|
||||
ffs_blkfree(ump, fs, ump->um_devvp, bn,
|
||||
oldspace - newspace, ip->i_number, vp->v_type, NULL);
|
||||
blocksreleased += btodb(oldspace - newspace);
|
||||
}
|
||||
@ -630,7 +630,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
|
||||
ufs2_daddr_t *countp;
|
||||
{
|
||||
struct buf *bp;
|
||||
struct fs *fs = ip->i_fs;
|
||||
struct fs *fs;
|
||||
struct vnode *vp;
|
||||
caddr_t copy = NULL;
|
||||
int i, nblocks, error = 0, allerror = 0;
|
||||
@ -638,7 +638,9 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
|
||||
ufs2_daddr_t blkcount, factor, blocksreleased = 0;
|
||||
ufs1_daddr_t *bap1 = NULL;
|
||||
ufs2_daddr_t *bap2 = NULL;
|
||||
# define BAP(ip, i) (((ip)->i_ump->um_fstype == UFS1) ? bap1[i] : bap2[i])
|
||||
#define BAP(ip, i) (I_IS_UFS1(ip) ? bap1[i] : bap2[i])
|
||||
|
||||
fs = ITOFS(ip);
|
||||
|
||||
/*
|
||||
* Calculate index in current block of last
|
||||
@ -686,7 +688,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
|
||||
return (error);
|
||||
}
|
||||
|
||||
if (ip->i_ump->um_fstype == UFS1)
|
||||
if (I_IS_UFS1(ip))
|
||||
bap1 = (ufs1_daddr_t *)bp->b_data;
|
||||
else
|
||||
bap2 = (ufs2_daddr_t *)bp->b_data;
|
||||
@ -694,7 +696,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
|
||||
copy = malloc(fs->fs_bsize, M_TEMP, M_WAITOK);
|
||||
bcopy((caddr_t)bp->b_data, copy, (u_int)fs->fs_bsize);
|
||||
for (i = last + 1; i < NINDIR(fs); i++)
|
||||
if (ip->i_ump->um_fstype == UFS1)
|
||||
if (I_IS_UFS1(ip))
|
||||
bap1[i] = 0;
|
||||
else
|
||||
bap2[i] = 0;
|
||||
@ -705,7 +707,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
|
||||
if (error)
|
||||
allerror = error;
|
||||
}
|
||||
if (ip->i_ump->um_fstype == UFS1)
|
||||
if (I_IS_UFS1(ip))
|
||||
bap1 = (ufs1_daddr_t *)copy;
|
||||
else
|
||||
bap2 = (ufs2_daddr_t *)copy;
|
||||
@ -725,7 +727,7 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp)
|
||||
allerror = error;
|
||||
blocksreleased += blkcount;
|
||||
}
|
||||
ffs_blkfree(ip->i_ump, fs, ip->i_devvp, nb, fs->fs_bsize,
|
||||
ffs_blkfree(ITOUMP(ip), fs, ITODEVVP(ip), nb, fs->fs_bsize,
|
||||
ip->i_number, vp->v_type, NULL);
|
||||
blocksreleased += nblocks;
|
||||
}
|
||||
@ -759,6 +761,6 @@ int
|
||||
ffs_rdonly(struct inode *ip)
|
||||
{
|
||||
|
||||
return (ip->i_ump->um_fs->fs_ronly != 0);
|
||||
return (ITOFS(ip)->fs_ronly != 0);
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ ffs_rawread_readahead(struct vnode *vp,
|
||||
bsize = vp->v_mount->mnt_stat.f_iosize;
|
||||
|
||||
ip = VTOI(vp);
|
||||
dp = ip->i_devvp;
|
||||
dp = ITODEVVP(ip);
|
||||
|
||||
iolen = ((vm_offset_t) udata) & PAGE_MASK;
|
||||
bp->b_bcount = len;
|
||||
@ -440,7 +440,7 @@ ffs_rawread(struct vnode *vp,
|
||||
|
||||
/* Only handle sector aligned reads */
|
||||
ip = VTOI(vp);
|
||||
secsize = ip->i_devvp->v_bufobj.bo_bsize;
|
||||
secsize = ITODEVVP(ip)->v_bufobj.bo_bsize;
|
||||
if ((uio->uio_offset & (secsize - 1)) == 0 &&
|
||||
(uio->uio_resid & (secsize - 1)) == 0) {
|
||||
|
||||
@ -460,7 +460,7 @@ ffs_rawread(struct vnode *vp,
|
||||
}
|
||||
|
||||
partialbytes = ((unsigned int) ip->i_size) %
|
||||
ip->i_fs->fs_bsize;
|
||||
ITOFS(ip)->fs_bsize;
|
||||
blockbytes = (int) filebytes - partialbytes;
|
||||
if (blockbytes > 0) {
|
||||
skipbytes = uio->uio_resid -
|
||||
|
@ -302,7 +302,7 @@ restart:
|
||||
vp = nd.ni_vp;
|
||||
vp->v_vflag |= VV_SYSTEM;
|
||||
ip = VTOI(vp);
|
||||
devvp = ip->i_devvp;
|
||||
devvp = ITODEVVP(ip);
|
||||
/*
|
||||
* Allocate and copy the last block contents so as to be able
|
||||
* to set size to that of the filesystem.
|
||||
@ -587,7 +587,7 @@ loop:
|
||||
}
|
||||
}
|
||||
snaplistsize += 1;
|
||||
if (xp->i_ump->um_fstype == UFS1)
|
||||
if (I_IS_UFS1(xp))
|
||||
error = expunge_ufs1(vp, xp, copy_fs, fullacct_ufs1,
|
||||
BLK_NOCOPY, 1);
|
||||
else
|
||||
@ -620,7 +620,7 @@ loop:
|
||||
goto out1;
|
||||
}
|
||||
xp = VTOI(xvp);
|
||||
if (xp->i_ump->um_fstype == UFS1)
|
||||
if (I_IS_UFS1(xp))
|
||||
error = expunge_ufs1(vp, xp, copy_fs, fullacct_ufs1,
|
||||
BLK_NOCOPY, 0);
|
||||
else
|
||||
@ -706,7 +706,7 @@ out1:
|
||||
TAILQ_FOREACH(xp, &sn->sn_head, i_nextsnap) {
|
||||
if (xp == ip)
|
||||
break;
|
||||
if (xp->i_ump->um_fstype == UFS1)
|
||||
if (I_IS_UFS1(xp))
|
||||
error = expunge_ufs1(vp, xp, fs, snapacct_ufs1,
|
||||
BLK_SNAP, 0);
|
||||
else
|
||||
@ -735,7 +735,7 @@ out1:
|
||||
* blocks marked as used in the snapshot bitmaps. Also, collect
|
||||
* the list of allocated blocks in i_snapblklist.
|
||||
*/
|
||||
if (ip->i_ump->um_fstype == UFS1)
|
||||
if (I_IS_UFS1(ip))
|
||||
error = expunge_ufs1(vp, ip, copy_fs, mapacct_ufs1,
|
||||
BLK_SNAP, 0);
|
||||
else
|
||||
@ -887,9 +887,9 @@ cgaccount(cg, vp, nbp, passno)
|
||||
int error, len, loc, indiroff;
|
||||
|
||||
ip = VTOI(vp);
|
||||
fs = ip->i_fs;
|
||||
error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, KERNCRED, &bp);
|
||||
fs = ITOFS(ip);
|
||||
error = bread(ITODEVVP(ip), fsbtodb(fs, cgtod(fs, cg)),
|
||||
(int)fs->fs_cgsize, KERNCRED, &bp);
|
||||
if (error) {
|
||||
brelse(bp);
|
||||
return (error);
|
||||
@ -899,7 +899,7 @@ cgaccount(cg, vp, nbp, passno)
|
||||
brelse(bp);
|
||||
return (EIO);
|
||||
}
|
||||
UFS_LOCK(ip->i_ump);
|
||||
UFS_LOCK(ITOUMP(ip));
|
||||
ACTIVESET(fs, cg);
|
||||
/*
|
||||
* Recomputation of summary information might not have been performed
|
||||
@ -908,7 +908,7 @@ cgaccount(cg, vp, nbp, passno)
|
||||
* fsck is slightly more consistent.
|
||||
*/
|
||||
fs->fs_cs(fs, cg) = cgp->cg_cs;
|
||||
UFS_UNLOCK(ip->i_ump);
|
||||
UFS_UNLOCK(ITOUMP(ip));
|
||||
bcopy(bp->b_data, nbp->b_data, fs->fs_cgsize);
|
||||
if (fs->fs_cgsize < fs->fs_bsize)
|
||||
bzero(&nbp->b_data[fs->fs_cgsize],
|
||||
@ -952,7 +952,7 @@ cgaccount(cg, vp, nbp, passno)
|
||||
}
|
||||
indiroff = 0;
|
||||
}
|
||||
if (ip->i_ump->um_fstype == UFS1) {
|
||||
if (I_IS_UFS1(ip)) {
|
||||
if (ffs_isblock(fs, cg_blksfree(cgp), loc))
|
||||
((ufs1_daddr_t *)(ibp->b_data))[indiroff] =
|
||||
BLK_NOCOPY;
|
||||
@ -1257,7 +1257,7 @@ mapacct_ufs1(vp, oldblkp, lastblkp, fs, lblkno, expungetype)
|
||||
*ip->i_snapblklist++ = lblkno;
|
||||
if (blkno == BLK_SNAP)
|
||||
blkno = blkstofrags(fs, lblkno);
|
||||
ffs_blkfree(ip->i_ump, fs, vp, blkno, fs->fs_bsize, inum,
|
||||
ffs_blkfree(ITOUMP(ip), fs, vp, blkno, fs->fs_bsize, inum,
|
||||
vp->v_type, NULL);
|
||||
}
|
||||
return (0);
|
||||
@ -1541,7 +1541,7 @@ mapacct_ufs2(vp, oldblkp, lastblkp, fs, lblkno, expungetype)
|
||||
*ip->i_snapblklist++ = lblkno;
|
||||
if (blkno == BLK_SNAP)
|
||||
blkno = blkstofrags(fs, lblkno);
|
||||
ffs_blkfree(ip->i_ump, fs, vp, blkno, fs->fs_bsize, inum,
|
||||
ffs_blkfree(ITOUMP(ip), fs, vp, blkno, fs->fs_bsize, inum,
|
||||
vp->v_type, NULL);
|
||||
}
|
||||
return (0);
|
||||
@ -1565,7 +1565,7 @@ ffs_snapgone(ip)
|
||||
* Find snapshot in incore list.
|
||||
*/
|
||||
xp = NULL;
|
||||
sn = ip->i_devvp->v_rdev->si_snapdata;
|
||||
sn = ITODEVVP(ip)->v_rdev->si_snapdata;
|
||||
if (sn != NULL)
|
||||
TAILQ_FOREACH(xp, &sn->sn_head, i_nextsnap)
|
||||
if (xp == ip)
|
||||
@ -1578,8 +1578,8 @@ ffs_snapgone(ip)
|
||||
/*
|
||||
* Delete snapshot inode from superblock. Keep list dense.
|
||||
*/
|
||||
fs = ip->i_fs;
|
||||
ump = ip->i_ump;
|
||||
ump = ITOUMP(ip);
|
||||
fs = ump->um_fs;
|
||||
UFS_LOCK(ump);
|
||||
for (snaploc = 0; snaploc < FSMAXSNAP; snaploc++)
|
||||
if (fs->fs_snapinum[snaploc] == ip->i_number)
|
||||
@ -1611,8 +1611,8 @@ ffs_snapremove(vp)
|
||||
struct snapdata *sn;
|
||||
|
||||
ip = VTOI(vp);
|
||||
fs = ip->i_fs;
|
||||
devvp = ip->i_devvp;
|
||||
fs = ITOFS(ip);
|
||||
devvp = ITODEVVP(ip);
|
||||
/*
|
||||
* If active, delete from incore list (this snapshot may
|
||||
* already have been in the process of being deleted, so
|
||||
@ -1646,7 +1646,7 @@ ffs_snapremove(vp)
|
||||
if (dblk == BLK_NOCOPY || dblk == BLK_SNAP)
|
||||
DIP_SET(ip, i_db[blkno], 0);
|
||||
else if ((dblk == blkstofrags(fs, blkno) &&
|
||||
ffs_snapblkfree(fs, ip->i_devvp, dblk, fs->fs_bsize,
|
||||
ffs_snapblkfree(fs, ITODEVVP(ip), dblk, fs->fs_bsize,
|
||||
ip->i_number, vp->v_type, NULL))) {
|
||||
DIP_SET(ip, i_blocks, DIP(ip, i_blocks) -
|
||||
btodb(fs->fs_bsize));
|
||||
@ -1664,14 +1664,14 @@ ffs_snapremove(vp)
|
||||
else
|
||||
last = fs->fs_size - blkno;
|
||||
for (loc = 0; loc < last; loc++) {
|
||||
if (ip->i_ump->um_fstype == UFS1) {
|
||||
if (I_IS_UFS1(ip)) {
|
||||
dblk = ((ufs1_daddr_t *)(ibp->b_data))[loc];
|
||||
if (dblk == 0)
|
||||
continue;
|
||||
if (dblk == BLK_NOCOPY || dblk == BLK_SNAP)
|
||||
((ufs1_daddr_t *)(ibp->b_data))[loc]= 0;
|
||||
else if ((dblk == blkstofrags(fs, blkno) &&
|
||||
ffs_snapblkfree(fs, ip->i_devvp, dblk,
|
||||
ffs_snapblkfree(fs, ITODEVVP(ip), dblk,
|
||||
fs->fs_bsize, ip->i_number, vp->v_type,
|
||||
NULL))) {
|
||||
ip->i_din1->di_blocks -=
|
||||
@ -1686,7 +1686,7 @@ ffs_snapremove(vp)
|
||||
if (dblk == BLK_NOCOPY || dblk == BLK_SNAP)
|
||||
((ufs2_daddr_t *)(ibp->b_data))[loc] = 0;
|
||||
else if ((dblk == blkstofrags(fs, blkno) &&
|
||||
ffs_snapblkfree(fs, ip->i_devvp, dblk,
|
||||
ffs_snapblkfree(fs, ITODEVVP(ip), dblk,
|
||||
fs->fs_bsize, ip->i_number, vp->v_type, NULL))) {
|
||||
ip->i_din2->di_blocks -= btodb(fs->fs_bsize);
|
||||
((ufs2_daddr_t *)(ibp->b_data))[loc] = 0;
|
||||
@ -1781,7 +1781,7 @@ retry:
|
||||
if (error)
|
||||
break;
|
||||
indiroff = (lbn - NDADDR) % NINDIR(fs);
|
||||
if (ip->i_ump->um_fstype == UFS1)
|
||||
if (I_IS_UFS1(ip))
|
||||
blkno=((ufs1_daddr_t *)(ibp->b_data))[indiroff];
|
||||
else
|
||||
blkno=((ufs2_daddr_t *)(ibp->b_data))[indiroff];
|
||||
@ -1806,7 +1806,7 @@ retry:
|
||||
if (lbn < NDADDR) {
|
||||
DIP_SET(ip, i_db[lbn], BLK_NOCOPY);
|
||||
ip->i_flag |= IN_CHANGE | IN_UPDATE;
|
||||
} else if (ip->i_ump->um_fstype == UFS1) {
|
||||
} else if (I_IS_UFS1(ip)) {
|
||||
((ufs1_daddr_t *)(ibp->b_data))[indiroff] =
|
||||
BLK_NOCOPY;
|
||||
bdwrite(ibp);
|
||||
@ -1854,7 +1854,7 @@ retry:
|
||||
}
|
||||
if (lbn < NDADDR) {
|
||||
DIP_SET(ip, i_db[lbn], bno);
|
||||
} else if (ip->i_ump->um_fstype == UFS1) {
|
||||
} else if (I_IS_UFS1(ip)) {
|
||||
((ufs1_daddr_t *)(ibp->b_data))[indiroff] = bno;
|
||||
bdwrite(ibp);
|
||||
} else {
|
||||
@ -2136,7 +2136,7 @@ ffs_bp_snapblk(devvp, bp)
|
||||
sn = devvp->v_rdev->si_snapdata;
|
||||
if (sn == NULL || TAILQ_FIRST(&sn->sn_head) == NULL)
|
||||
return (0);
|
||||
fs = TAILQ_FIRST(&sn->sn_head)->i_fs;
|
||||
fs = ITOFS(TAILQ_FIRST(&sn->sn_head));
|
||||
lbn = fragstoblks(fs, dbtofsb(fs, bp->b_blkno));
|
||||
snapblklist = sn->sn_blklist;
|
||||
upper = sn->sn_listsize - 1;
|
||||
@ -2263,7 +2263,7 @@ ffs_copyonwrite(devvp, bp)
|
||||
return (0); /* No snapshot */
|
||||
}
|
||||
ip = TAILQ_FIRST(&sn->sn_head);
|
||||
fs = ip->i_fs;
|
||||
fs = ITOFS(ip);
|
||||
lbn = fragstoblks(fs, dbtofsb(fs, bp->b_blkno));
|
||||
snapblklist = sn->sn_blklist;
|
||||
upper = sn->sn_listsize - 1;
|
||||
@ -2337,7 +2337,7 @@ ffs_copyonwrite(devvp, bp)
|
||||
if (error)
|
||||
break;
|
||||
indiroff = (lbn - NDADDR) % NINDIR(fs);
|
||||
if (ip->i_ump->um_fstype == UFS1)
|
||||
if (I_IS_UFS1(ip))
|
||||
blkno=((ufs1_daddr_t *)(ibp->b_data))[indiroff];
|
||||
else
|
||||
blkno=((ufs2_daddr_t *)(ibp->b_data))[indiroff];
|
||||
@ -2493,15 +2493,19 @@ readblock(vp, bp, lbn)
|
||||
{
|
||||
struct inode *ip = VTOI(vp);
|
||||
struct bio *bip;
|
||||
struct fs *fs;
|
||||
|
||||
ip = VTOI(vp);
|
||||
fs = ITOFS(ip);
|
||||
|
||||
bip = g_alloc_bio();
|
||||
bip->bio_cmd = BIO_READ;
|
||||
bip->bio_offset = dbtob(fsbtodb(ip->i_fs, blkstofrags(ip->i_fs, lbn)));
|
||||
bip->bio_offset = dbtob(fsbtodb(fs, blkstofrags(fs, lbn)));
|
||||
bip->bio_data = bp->b_data;
|
||||
bip->bio_length = bp->b_bcount;
|
||||
bip->bio_done = NULL;
|
||||
|
||||
g_io_request(bip, ip->i_devvp->v_bufobj.bo_private);
|
||||
g_io_request(bip, ITODEVVP(ip)->v_bufobj.bo_private);
|
||||
bp->b_error = biowait(bip, "snaprdb");
|
||||
g_destroy_bio(bip);
|
||||
return (bp->b_error);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -74,7 +74,7 @@ ffs_blkatoff(vp, offset, res, bpp)
|
||||
int bsize, error;
|
||||
|
||||
ip = VTOI(vp);
|
||||
fs = ip->i_fs;
|
||||
fs = ITOFS(ip);
|
||||
lbn = lblkno(fs, offset);
|
||||
bsize = blksize(fs, ip, lbn);
|
||||
|
||||
@ -102,7 +102,7 @@ ffs_load_inode(bp, ip, fs, ino)
|
||||
ino_t ino;
|
||||
{
|
||||
|
||||
if (ip->i_ump->um_fstype == UFS1) {
|
||||
if (I_IS_UFS1(ip)) {
|
||||
*ip->i_din1 =
|
||||
*((struct ufs1_dinode *)bp->b_data + ino_to_fsbo(fs, ino));
|
||||
ip->i_mode = ip->i_din1->di_mode;
|
||||
|
@ -1652,7 +1652,6 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags)
|
||||
struct ufsmount *ump;
|
||||
struct buf *bp;
|
||||
struct vnode *vp;
|
||||
struct cdev *dev;
|
||||
int error;
|
||||
|
||||
error = vfs_hash_get(mp, ino, flags, curthread, vpp, NULL, NULL);
|
||||
@ -1676,7 +1675,6 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags)
|
||||
*/
|
||||
|
||||
ump = VFSTOUFS(mp);
|
||||
dev = ump->um_dev;
|
||||
fs = ump->um_fs;
|
||||
ip = uma_zalloc(uma_inode, M_WAITOK | M_ZERO);
|
||||
|
||||
@ -1697,11 +1695,10 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags)
|
||||
vp->v_bufobj.bo_bsize = fs->fs_bsize;
|
||||
ip->i_vnode = vp;
|
||||
ip->i_ump = ump;
|
||||
ip->i_fs = fs;
|
||||
ip->i_dev = dev;
|
||||
ip->i_number = ino;
|
||||
ip->i_ea_refs = 0;
|
||||
ip->i_nextclustercg = -1;
|
||||
ip->i_flag = fs->fs_magic == FS_UFS1_MAGIC ? 0 : IN_UFS2;
|
||||
#ifdef QUOTA
|
||||
{
|
||||
int i;
|
||||
@ -1738,7 +1735,7 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags)
|
||||
*vpp = NULL;
|
||||
return (error);
|
||||
}
|
||||
if (ip->i_ump->um_fstype == UFS1)
|
||||
if (I_IS_UFS1(ip))
|
||||
ip->i_din1 = uma_zalloc(uma_ufs1, M_WAITOK);
|
||||
else
|
||||
ip->i_din2 = uma_zalloc(uma_ufs2, M_WAITOK);
|
||||
@ -1753,10 +1750,8 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags)
|
||||
* Initialize the vnode from the inode, check for aliases.
|
||||
* Note that the underlying vnode may have changed.
|
||||
*/
|
||||
if (ip->i_ump->um_fstype == UFS1)
|
||||
error = ufs_vinit(mp, &ffs_fifoops1, &vp);
|
||||
else
|
||||
error = ufs_vinit(mp, &ffs_fifoops2, &vp);
|
||||
error = ufs_vinit(mp, I_IS_UFS1(ip) ? &ffs_fifoops1 : &ffs_fifoops2,
|
||||
&vp);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
*vpp = NULL;
|
||||
|
@ -244,7 +244,7 @@ ffs_syncvnode(struct vnode *vp, int waitfor, int flags)
|
||||
error = 0;
|
||||
passes = 0;
|
||||
wait = false; /* Always do an async pass first. */
|
||||
lbn = lblkno(ip->i_fs, (ip->i_size + ip->i_fs->fs_bsize - 1));
|
||||
lbn = lblkno(ITOFS(ip), (ip->i_size + ITOFS(ip)->fs_bsize - 1));
|
||||
BO_LOCK(bo);
|
||||
loop:
|
||||
TAILQ_FOREACH(bp, &bo->bo_dirty.bv_hd, b_bobufs)
|
||||
@ -518,7 +518,7 @@ ffs_read(ap)
|
||||
if (orig_resid == 0)
|
||||
return (0);
|
||||
KASSERT(uio->uio_offset >= 0, ("ffs_read: uio->uio_offset < 0"));
|
||||
fs = ip->i_fs;
|
||||
fs = ITOFS(ip);
|
||||
if (uio->uio_offset < ip->i_size &&
|
||||
uio->uio_offset >= fs->fs_maxfilesize)
|
||||
return (EOVERFLOW);
|
||||
@ -741,7 +741,7 @@ ffs_write(ap)
|
||||
|
||||
KASSERT(uio->uio_resid >= 0, ("ffs_write: uio->uio_resid < 0"));
|
||||
KASSERT(uio->uio_offset >= 0, ("ffs_write: uio->uio_offset < 0"));
|
||||
fs = ip->i_fs;
|
||||
fs = ITOFS(ip);
|
||||
if ((uoff_t)uio->uio_offset + uio->uio_resid > fs->fs_maxfilesize)
|
||||
return (EFBIG);
|
||||
/*
|
||||
@ -905,7 +905,7 @@ ffs_extread(struct vnode *vp, struct uio *uio, int ioflag)
|
||||
int error;
|
||||
|
||||
ip = VTOI(vp);
|
||||
fs = ip->i_fs;
|
||||
fs = ITOFS(ip);
|
||||
dp = ip->i_din2;
|
||||
|
||||
#ifdef INVARIANTS
|
||||
@ -1059,7 +1059,7 @@ ffs_extwrite(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *ucred)
|
||||
int blkoffset, error, flags, size, xfersize;
|
||||
|
||||
ip = VTOI(vp);
|
||||
fs = ip->i_fs;
|
||||
fs = ITOFS(ip);
|
||||
dp = ip->i_din2;
|
||||
|
||||
#ifdef INVARIANTS
|
||||
@ -1231,7 +1231,7 @@ ffs_rdextattr(u_char **p, struct vnode *vp, struct thread *td, int extra)
|
||||
u_char *eae;
|
||||
|
||||
ip = VTOI(vp);
|
||||
fs = ip->i_fs;
|
||||
fs = ITOFS(ip);
|
||||
dp = ip->i_din2;
|
||||
easize = dp->di_extsize;
|
||||
if ((uoff_t)easize + extra > NXADDR * fs->fs_bsize)
|
||||
@ -1385,8 +1385,7 @@ struct vop_strategy_args {
|
||||
|
||||
vp = ap->a_vp;
|
||||
lbn = ap->a_bp->b_lblkno;
|
||||
if (VTOI(vp)->i_fs->fs_magic == FS_UFS2_MAGIC &&
|
||||
lbn < 0 && lbn >= -NXADDR)
|
||||
if (I_IS_UFS2(VTOI(vp)) && lbn < 0 && lbn >= -NXADDR)
|
||||
return (VOP_STRATEGY_APV(&ufs_vnodeops, ap));
|
||||
if (vp->v_type == VFIFO)
|
||||
return (VOP_STRATEGY_APV(&ufs_fifoops, ap));
|
||||
@ -1462,7 +1461,7 @@ vop_deleteextattr {
|
||||
u_char *eae, *p;
|
||||
|
||||
ip = VTOI(ap->a_vp);
|
||||
fs = ip->i_fs;
|
||||
fs = ITOFS(ip);
|
||||
|
||||
if (ap->a_vp->v_type == VCHR || ap->a_vp->v_type == VBLK)
|
||||
return (EOPNOTSUPP);
|
||||
@ -1665,7 +1664,7 @@ vop_setextattr {
|
||||
u_char *eae, *p;
|
||||
|
||||
ip = VTOI(ap->a_vp);
|
||||
fs = ip->i_fs;
|
||||
fs = ITOFS(ip);
|
||||
|
||||
if (ap->a_vp->v_type == VCHR || ap->a_vp->v_type == VBLK)
|
||||
return (EOPNOTSUPP);
|
||||
|
@ -66,14 +66,25 @@
|
||||
struct inode {
|
||||
TAILQ_ENTRY(inode) i_nextsnap; /* snapshot file list. */
|
||||
struct vnode *i_vnode;/* Vnode associated with this inode. */
|
||||
struct ufsmount *i_ump;/* Ufsmount point associated with this inode. */
|
||||
u_int32_t i_flag; /* flags, see below */
|
||||
struct cdev *i_dev; /* Device associated with the inode. */
|
||||
struct ufsmount *i_ump;/* Ufsmount point associated with this inode. */
|
||||
struct dquot *i_dquot[MAXQUOTAS]; /* Dquot structures. */
|
||||
union {
|
||||
struct dirhash *dirhash; /* Hashing for large directories. */
|
||||
daddr_t *snapblklist; /* Collect expunged snapshot blocks. */
|
||||
} i_un;
|
||||
/*
|
||||
* The real copy of the on-disk inode.
|
||||
*/
|
||||
union {
|
||||
struct ufs1_dinode *din1; /* UFS1 on-disk dinode. */
|
||||
struct ufs2_dinode *din2; /* UFS2 on-disk dinode. */
|
||||
} dinode_u;
|
||||
|
||||
ino_t i_number; /* The identity of the inode. */
|
||||
u_int32_t i_flag; /* flags, see below */
|
||||
int i_effnlink; /* i_nlink when I/O completes */
|
||||
|
||||
struct fs *i_fs; /* Associated filesystem superblock. */
|
||||
struct dquot *i_dquot[MAXQUOTAS]; /* Dquot structures. */
|
||||
|
||||
/*
|
||||
* Side effects; used during directory lookup.
|
||||
*/
|
||||
@ -82,11 +93,6 @@ struct inode {
|
||||
doff_t i_diroff; /* Offset in dir, where we found last entry. */
|
||||
doff_t i_offset; /* Offset of free space in directory. */
|
||||
|
||||
union {
|
||||
struct dirhash *dirhash; /* Hashing for large directories. */
|
||||
daddr_t *snapblklist; /* Collect expunged snapshot blocks. */
|
||||
} i_un;
|
||||
|
||||
int i_nextclustercg; /* last cg searched for cluster */
|
||||
|
||||
/*
|
||||
@ -100,20 +106,13 @@ struct inode {
|
||||
/*
|
||||
* Copies from the on-disk dinode itself.
|
||||
*/
|
||||
u_int16_t i_mode; /* IFMT, permissions; see below. */
|
||||
int16_t i_nlink; /* File link count. */
|
||||
u_int64_t i_size; /* File byte count. */
|
||||
u_int32_t i_flags; /* Status flags (chflags). */
|
||||
u_int64_t i_gen; /* Generation number. */
|
||||
u_int32_t i_flags; /* Status flags (chflags). */
|
||||
u_int32_t i_uid; /* File owner. */
|
||||
u_int32_t i_gid; /* File group. */
|
||||
/*
|
||||
* The real copy of the on-disk inode.
|
||||
*/
|
||||
union {
|
||||
struct ufs1_dinode *din1; /* UFS1 on-disk dinode. */
|
||||
struct ufs2_dinode *din2; /* UFS2 on-disk dinode. */
|
||||
} dinode_u;
|
||||
u_int16_t i_mode; /* IFMT, permissions; see below. */
|
||||
int16_t i_nlink; /* File link count. */
|
||||
};
|
||||
/*
|
||||
* These flags are kept in i_flag.
|
||||
@ -123,39 +122,58 @@ struct inode {
|
||||
#define IN_UPDATE 0x0004 /* Modification time update request. */
|
||||
#define IN_MODIFIED 0x0008 /* Inode has been modified. */
|
||||
#define IN_NEEDSYNC 0x0010 /* Inode requires fsync. */
|
||||
#define IN_LAZYMOD 0x0040 /* Modified, but don't write yet. */
|
||||
#define IN_LAZYACCESS 0x0100 /* Process IN_ACCESS after the
|
||||
#define IN_LAZYMOD 0x0020 /* Modified, but don't write yet. */
|
||||
#define IN_LAZYACCESS 0x0040 /* Process IN_ACCESS after the
|
||||
suspension finished */
|
||||
#define IN_EA_LOCKED 0x0200
|
||||
#define IN_EA_LOCKWAIT 0x0400
|
||||
#define IN_EA_LOCKED 0x0080
|
||||
#define IN_EA_LOCKWAIT 0x0100
|
||||
|
||||
#define IN_TRUNCATED 0x0800 /* Journaled truncation pending. */
|
||||
#define IN_TRUNCATED 0x0200 /* Journaled truncation pending. */
|
||||
|
||||
#define IN_UFS2 0x0400 /* UFS2 vs UFS1 */
|
||||
|
||||
#define i_devvp i_ump->um_devvp
|
||||
#define i_umbufobj i_ump->um_bo
|
||||
#define i_dirhash i_un.dirhash
|
||||
#define i_snapblklist i_un.snapblklist
|
||||
#define i_din1 dinode_u.din1
|
||||
#define i_din2 dinode_u.din2
|
||||
|
||||
#ifdef _KERNEL
|
||||
|
||||
#define ITOUMP(ip) ((ip)->i_ump)
|
||||
#define ITODEV(ip) (ITOUMP(ip)->um_dev)
|
||||
#define ITODEVVP(ip) (ITOUMP(ip)->um_devvp)
|
||||
#define ITOFS(ip) (ITOUMP(ip)->um_fs)
|
||||
#define ITOVFS(ip) ((ip)->i_vnode->v_mount)
|
||||
|
||||
static inline bool
|
||||
I_IS_UFS1(const struct inode *ip)
|
||||
{
|
||||
|
||||
return ((ip->i_flag & IN_UFS2) == 0);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
I_IS_UFS2(const struct inode *ip)
|
||||
{
|
||||
|
||||
return ((ip->i_flag & IN_UFS2) != 0);
|
||||
}
|
||||
|
||||
/*
|
||||
* The DIP macro is used to access fields in the dinode that are
|
||||
* not cached in the inode itself.
|
||||
*/
|
||||
#define DIP(ip, field) \
|
||||
(((ip)->i_ump->um_fstype == UFS1) ? \
|
||||
(ip)->i_din1->d##field : (ip)->i_din2->d##field)
|
||||
#define DIP_SET(ip, field, val) do { \
|
||||
if ((ip)->i_ump->um_fstype == UFS1) \
|
||||
(ip)->i_din1->d##field = (val); \
|
||||
else \
|
||||
(ip)->i_din2->d##field = (val); \
|
||||
#define DIP(ip, field) (I_IS_UFS1(ip) ? (ip)->i_din1->d##field : \
|
||||
(ip)->i_din2->d##field)
|
||||
#define DIP_SET(ip, field, val) do { \
|
||||
if (I_IS_UFS1(ip)) \
|
||||
(ip)->i_din1->d##field = (val); \
|
||||
else \
|
||||
(ip)->i_din2->d##field = (val); \
|
||||
} while (0)
|
||||
|
||||
#define SHORTLINK(ip) \
|
||||
(((ip)->i_ump->um_fstype == UFS1) ? \
|
||||
(caddr_t)(ip)->i_din1->di_db : (caddr_t)(ip)->i_din2->di_db)
|
||||
#define SHORTLINK(ip) (I_IS_UFS1(ip) ? \
|
||||
(caddr_t)(ip)->i_din1->di_db : (caddr_t)(ip)->i_din2->di_db)
|
||||
#define IS_SNAPSHOT(ip) ((ip)->i_flags & SF_SNAPSHOT)
|
||||
|
||||
/*
|
||||
|
@ -184,7 +184,7 @@ ufs_getacl_nfs4_internal(struct vnode *vp, struct acl *aclp, struct thread *td)
|
||||
*/
|
||||
printf("ufs_getacl_nfs4(): Loaded invalid ACL ("
|
||||
"%d bytes), inumber %ju on %s\n", len,
|
||||
(uintmax_t)ip->i_number, ip->i_fs->fs_fsmnt);
|
||||
(uintmax_t)ip->i_number, ITOFS(ip)->fs_fsmnt);
|
||||
|
||||
return (EPERM);
|
||||
}
|
||||
@ -193,7 +193,7 @@ ufs_getacl_nfs4_internal(struct vnode *vp, struct acl *aclp, struct thread *td)
|
||||
if (error) {
|
||||
printf("ufs_getacl_nfs4(): Loaded invalid ACL "
|
||||
"(failed acl_nfs4_check), inumber %ju on %s\n",
|
||||
(uintmax_t)ip->i_number, ip->i_fs->fs_fsmnt);
|
||||
(uintmax_t)ip->i_number, ITOFS(ip)->fs_fsmnt);
|
||||
|
||||
return (EPERM);
|
||||
}
|
||||
@ -261,7 +261,7 @@ ufs_get_oldacl(acl_type_t type, struct oldacl *old, struct vnode *vp,
|
||||
*/
|
||||
printf("ufs_get_oldacl(): Loaded invalid ACL "
|
||||
"(len = %d), inumber %ju on %s\n", len,
|
||||
(uintmax_t)ip->i_number, ip->i_fs->fs_fsmnt);
|
||||
(uintmax_t)ip->i_number, ITOFS(ip)->fs_fsmnt);
|
||||
return (EPERM);
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ ufs_bmap(ap)
|
||||
* to physical mapping is requested.
|
||||
*/
|
||||
if (ap->a_bop != NULL)
|
||||
*ap->a_bop = &VTOI(ap->a_vp)->i_devvp->v_bufobj;
|
||||
*ap->a_bop = &VFSTOUFS(ap->a_vp->v_mount)->um_devvp->v_bufobj;
|
||||
if (ap->a_bnp == NULL)
|
||||
return (0);
|
||||
|
||||
@ -239,7 +239,7 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb)
|
||||
}
|
||||
}
|
||||
|
||||
if (ip->i_ump->um_fstype == UFS1) {
|
||||
if (I_IS_UFS1(ip)) {
|
||||
daddr = ((ufs1_daddr_t *)bp->b_data)[ap->in_off];
|
||||
if (num == 1 && daddr && runp) {
|
||||
for (bn = ap->in_off + 1;
|
||||
|
@ -65,15 +65,15 @@ ufs_gjournal_modref(struct vnode *vp, int count)
|
||||
ino_t ino;
|
||||
|
||||
ip = VTOI(vp);
|
||||
ump = ip->i_ump;
|
||||
fs = ip->i_fs;
|
||||
devvp = ip->i_devvp;
|
||||
ump = VFSTOUFS(vp->v_mount);
|
||||
fs = ump->um_fs;
|
||||
devvp = ump->um_devvp;
|
||||
ino = ip->i_number;
|
||||
|
||||
cg = ino_to_cg(fs, ino);
|
||||
if (devvp->v_type != VCHR) {
|
||||
/* devvp is a snapshot */
|
||||
dev = VTOI(devvp)->i_devvp->v_rdev;
|
||||
dev = VFSTOUFS(devvp->v_mount)->um_devvp->v_rdev;
|
||||
cgbno = fragstoblks(fs, cgtod(fs, cg));
|
||||
} else {
|
||||
/* devvp is a normal disk device */
|
||||
|
@ -125,7 +125,7 @@ ufs_inactive(ap)
|
||||
}
|
||||
}
|
||||
isize = ip->i_size;
|
||||
if (ip->i_ump->um_fstype == UFS2)
|
||||
if (I_IS_UFS2(ip))
|
||||
isize += ip->i_din2->di_extsize;
|
||||
if (ip->i_effnlink <= 0 && isize && !UFS_RDONLY(ip))
|
||||
error = UFS_TRUNCATE(vp, (off_t)0, IO_EXT | IO_NORMAL, NOCRED);
|
||||
@ -214,7 +214,6 @@ ufs_reclaim(ap)
|
||||
{
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct inode *ip = VTOI(vp);
|
||||
struct ufsmount *ump = ip->i_ump;
|
||||
|
||||
ufs_prepare_reclaim(vp);
|
||||
|
||||
@ -233,6 +232,6 @@ ufs_reclaim(ap)
|
||||
VI_LOCK(vp);
|
||||
vp->v_data = 0;
|
||||
VI_UNLOCK(vp);
|
||||
UFS_IFREE(ump, ip);
|
||||
UFS_IFREE(ITOUMP(ip), ip);
|
||||
return (0);
|
||||
}
|
||||
|
@ -232,13 +232,13 @@ chkdq(struct inode *ip, ufs2_daddr_t change, struct ucred *cred, int flags)
|
||||
/* Reset timer when crossing soft limit */
|
||||
if (dq->dq_curblocks + change >= dq->dq_bsoftlimit &&
|
||||
dq->dq_curblocks < dq->dq_bsoftlimit)
|
||||
dq->dq_btime = time_second + ip->i_ump->um_btime[i];
|
||||
dq->dq_btime = time_second + ITOUMP(ip)->um_btime[i];
|
||||
dq->dq_curblocks += change;
|
||||
dq->dq_flags |= DQ_MOD;
|
||||
DQI_UNLOCK(dq);
|
||||
if (warn)
|
||||
uprintf("\n%s: warning, %s disk quota exceeded\n",
|
||||
ITOV(ip)->v_mount->mnt_stat.f_mntonname,
|
||||
ITOVFS(ip)->mnt_stat.f_mntonname,
|
||||
quotatypes[i]);
|
||||
}
|
||||
return (0);
|
||||
@ -264,7 +264,7 @@ chkdqchg(struct inode *ip, ufs2_daddr_t change, struct ucred *cred,
|
||||
dq->dq_flags |= DQ_BLKS;
|
||||
DQI_UNLOCK(dq);
|
||||
uprintf("\n%s: write failed, %s disk limit reached\n",
|
||||
ITOV(ip)->v_mount->mnt_stat.f_mntonname,
|
||||
ITOVFS(ip)->mnt_stat.f_mntonname,
|
||||
quotatypes[type]);
|
||||
return (EDQUOT);
|
||||
}
|
||||
@ -277,7 +277,7 @@ chkdqchg(struct inode *ip, ufs2_daddr_t change, struct ucred *cred,
|
||||
*/
|
||||
if (ncurblocks >= dq->dq_bsoftlimit && dq->dq_bsoftlimit) {
|
||||
if (dq->dq_curblocks < dq->dq_bsoftlimit) {
|
||||
dq->dq_btime = time_second + ip->i_ump->um_btime[type];
|
||||
dq->dq_btime = time_second + ITOUMP(ip)->um_btime[type];
|
||||
if (ip->i_uid == cred->cr_uid)
|
||||
*warn = 1;
|
||||
return (0);
|
||||
@ -289,7 +289,7 @@ chkdqchg(struct inode *ip, ufs2_daddr_t change, struct ucred *cred,
|
||||
DQI_UNLOCK(dq);
|
||||
uprintf("\n%s: write failed, %s "
|
||||
"disk quota exceeded for too long\n",
|
||||
ITOV(ip)->v_mount->mnt_stat.f_mntonname,
|
||||
ITOVFS(ip)->mnt_stat.f_mntonname,
|
||||
quotatypes[type]);
|
||||
return (EDQUOT);
|
||||
}
|
||||
@ -370,13 +370,13 @@ chkiq(struct inode *ip, int change, struct ucred *cred, int flags)
|
||||
/* Reset timer when crossing soft limit */
|
||||
if (dq->dq_curinodes + change >= dq->dq_isoftlimit &&
|
||||
dq->dq_curinodes < dq->dq_isoftlimit)
|
||||
dq->dq_itime = time_second + ip->i_ump->um_itime[i];
|
||||
dq->dq_itime = time_second + ITOUMP(ip)->um_itime[i];
|
||||
dq->dq_curinodes += change;
|
||||
dq->dq_flags |= DQ_MOD;
|
||||
DQI_UNLOCK(dq);
|
||||
if (warn)
|
||||
uprintf("\n%s: warning, %s inode quota exceeded\n",
|
||||
ITOV(ip)->v_mount->mnt_stat.f_mntonname,
|
||||
ITOVFS(ip)->mnt_stat.f_mntonname,
|
||||
quotatypes[i]);
|
||||
}
|
||||
return (0);
|
||||
@ -401,7 +401,7 @@ chkiqchg(struct inode *ip, int change, struct ucred *cred, int type, int *warn)
|
||||
dq->dq_flags |= DQ_INODS;
|
||||
DQI_UNLOCK(dq);
|
||||
uprintf("\n%s: write failed, %s inode limit reached\n",
|
||||
ITOV(ip)->v_mount->mnt_stat.f_mntonname,
|
||||
ITOVFS(ip)->mnt_stat.f_mntonname,
|
||||
quotatypes[type]);
|
||||
return (EDQUOT);
|
||||
}
|
||||
@ -414,7 +414,7 @@ chkiqchg(struct inode *ip, int change, struct ucred *cred, int type, int *warn)
|
||||
*/
|
||||
if (ncurinodes >= dq->dq_isoftlimit && dq->dq_isoftlimit) {
|
||||
if (dq->dq_curinodes < dq->dq_isoftlimit) {
|
||||
dq->dq_itime = time_second + ip->i_ump->um_itime[type];
|
||||
dq->dq_itime = time_second + ITOUMP(ip)->um_itime[type];
|
||||
if (ip->i_uid == cred->cr_uid)
|
||||
*warn = 1;
|
||||
return (0);
|
||||
@ -426,7 +426,7 @@ chkiqchg(struct inode *ip, int change, struct ucred *cred, int type, int *warn)
|
||||
DQI_UNLOCK(dq);
|
||||
uprintf("\n%s: write failed, %s "
|
||||
"inode quota exceeded for too long\n",
|
||||
ITOV(ip)->v_mount->mnt_stat.f_mntonname,
|
||||
ITOVFS(ip)->mnt_stat.f_mntonname,
|
||||
quotatypes[type]);
|
||||
return (EDQUOT);
|
||||
}
|
||||
@ -445,10 +445,13 @@ chkiqchg(struct inode *ip, int change, struct ucred *cred, int type, int *warn)
|
||||
static void
|
||||
chkdquot(struct inode *ip)
|
||||
{
|
||||
struct ufsmount *ump = ip->i_ump;
|
||||
struct vnode *vp = ITOV(ip);
|
||||
struct ufsmount *ump;
|
||||
struct vnode *vp;
|
||||
int i;
|
||||
|
||||
ump = ITOUMP(ip);
|
||||
vp = ITOV(ip);
|
||||
|
||||
/*
|
||||
* Disk quotas must be turned off for system files. Currently
|
||||
* these are snapshots and quota files.
|
||||
|
@ -456,7 +456,7 @@ ufs_getattr(ap)
|
||||
|
||||
VI_LOCK(vp);
|
||||
ufs_itimes_locked(vp);
|
||||
if (ip->i_ump->um_fstype == UFS1) {
|
||||
if (I_IS_UFS1(ip)) {
|
||||
vap->va_atime.tv_sec = ip->i_din1->di_atime;
|
||||
vap->va_atime.tv_nsec = ip->i_din1->di_atimensec;
|
||||
} else {
|
||||
@ -467,13 +467,13 @@ ufs_getattr(ap)
|
||||
/*
|
||||
* Copy from inode table
|
||||
*/
|
||||
vap->va_fsid = dev2udev(ip->i_dev);
|
||||
vap->va_fsid = dev2udev(ITOUMP(ip)->um_dev);
|
||||
vap->va_fileid = ip->i_number;
|
||||
vap->va_mode = ip->i_mode & ~IFMT;
|
||||
vap->va_nlink = ip->i_effnlink;
|
||||
vap->va_uid = ip->i_uid;
|
||||
vap->va_gid = ip->i_gid;
|
||||
if (ip->i_ump->um_fstype == UFS1) {
|
||||
if (I_IS_UFS1(ip)) {
|
||||
vap->va_rdev = ip->i_din1->di_rdev;
|
||||
vap->va_size = ip->i_din1->di_size;
|
||||
vap->va_mtime.tv_sec = ip->i_din1->di_mtime;
|
||||
@ -651,8 +651,7 @@ ufs_setattr(ap)
|
||||
DIP_SET(ip, i_mtime, vap->va_mtime.tv_sec);
|
||||
DIP_SET(ip, i_mtimensec, vap->va_mtime.tv_nsec);
|
||||
}
|
||||
if (vap->va_birthtime.tv_sec != VNOVAL &&
|
||||
ip->i_ump->um_fstype == UFS2) {
|
||||
if (vap->va_birthtime.tv_sec != VNOVAL && I_IS_UFS2(ip)) {
|
||||
ip->i_din2->di_birthtime = vap->va_birthtime.tv_sec;
|
||||
ip->i_din2->di_birthnsec = vap->va_birthtime.tv_nsec;
|
||||
}
|
||||
@ -1347,7 +1346,7 @@ relock:
|
||||
* expunge the original entry's existence.
|
||||
*/
|
||||
if (tip == NULL) {
|
||||
if (tdp->i_dev != fip->i_dev)
|
||||
if (ITODEV(tdp) != ITODEV(fip))
|
||||
panic("ufs_rename: EXDEV");
|
||||
if (doingdirectory && newparent) {
|
||||
/*
|
||||
@ -1371,7 +1370,7 @@ relock:
|
||||
tdp->i_endoff < tdp->i_size)
|
||||
endoff = tdp->i_endoff;
|
||||
} else {
|
||||
if (tip->i_dev != tdp->i_dev || tip->i_dev != fip->i_dev)
|
||||
if (ITODEV(tip) != ITODEV(tdp) || ITODEV(tip) != ITODEV(fip))
|
||||
panic("ufs_rename: EXDEV");
|
||||
/*
|
||||
* Short circuit rename(foo, foo).
|
||||
@ -2301,12 +2300,9 @@ ufs_strategy(ap)
|
||||
{
|
||||
struct buf *bp = ap->a_bp;
|
||||
struct vnode *vp = ap->a_vp;
|
||||
struct bufobj *bo;
|
||||
struct inode *ip;
|
||||
ufs2_daddr_t blkno;
|
||||
int error;
|
||||
|
||||
ip = VTOI(vp);
|
||||
if (bp->b_blkno == bp->b_lblkno) {
|
||||
error = ufs_bmaparray(vp, bp->b_lblkno, &blkno, bp, NULL, NULL);
|
||||
bp->b_blkno = blkno;
|
||||
@ -2324,8 +2320,7 @@ ufs_strategy(ap)
|
||||
return (0);
|
||||
}
|
||||
bp->b_iooffset = dbtob(bp->b_blkno);
|
||||
bo = ip->i_umbufobj;
|
||||
BO_STRATEGY(bo, bp);
|
||||
BO_STRATEGY(VFSTOUFS(vp->v_mount)->um_bo, bp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -2342,7 +2337,7 @@ ufs_print(ap)
|
||||
struct inode *ip = VTOI(vp);
|
||||
|
||||
printf("\tino %lu, on dev %s", (u_long)ip->i_number,
|
||||
devtoname(ip->i_dev));
|
||||
devtoname(ITODEV(ip)));
|
||||
if (vp->v_type == VFIFO)
|
||||
fifo_printinfo(vp);
|
||||
printf("\n");
|
||||
|
@ -108,8 +108,8 @@ struct ufsmount {
|
||||
#define UFS_VALLOC(aa, bb, cc, dd) VFSTOUFS((aa)->v_mount)->um_valloc(aa, bb, cc, dd)
|
||||
#define UFS_VFREE(aa, bb, cc) VFSTOUFS((aa)->v_mount)->um_vfree(aa, bb, cc)
|
||||
#define UFS_IFREE(aa, bb) ((aa)->um_ifree(aa, bb))
|
||||
#define UFS_RDONLY(aa) ((aa)->i_ump->um_rdonly(aa))
|
||||
#define UFS_SNAPGONE(aa) ((aa)->i_ump->um_snapgone(aa))
|
||||
#define UFS_RDONLY(aa) (ITOUMP(aa)->um_rdonly(aa))
|
||||
#define UFS_SNAPGONE(aa) (ITOUMP(aa)->um_snapgone(aa))
|
||||
|
||||
#define UFS_LOCK(aa) mtx_lock(&(aa)->um_lock)
|
||||
#define UFS_UNLOCK(aa) mtx_unlock(&(aa)->um_lock)
|
||||
|
Loading…
x
Reference in New Issue
Block a user