Don't use the UFS_* and VFS_* functions where a direct call is possble.

The UFS_ functions are for UFS to call back into VFS.  The VFS functions
are external entry points into the filesystem.
This commit is contained in:
phk 2005-02-08 17:40:01 +00:00
parent 76391460ae
commit c1f0056196
6 changed files with 39 additions and 39 deletions

View File

@ -606,7 +606,7 @@ ffs_reallocblks_ufs1(ap)
} else {
ip->i_flag |= IN_CHANGE | IN_UPDATE;
if (!doasyncfree)
UFS_UPDATE(vp, 1);
ffs_update(vp, 1);
}
if (ssize < len) {
if (doasyncfree)
@ -813,7 +813,7 @@ ffs_reallocblks_ufs2(ap)
} else {
ip->i_flag |= IN_CHANGE | IN_UPDATE;
if (!doasyncfree)
UFS_UPDATE(vp, 1);
ffs_update(vp, 1);
}
if (ssize < len) {
if (doasyncfree)
@ -921,9 +921,9 @@ ffs_valloc(pvp, mode, cred, vpp)
(allocfcn_t *)ffs_nodealloccg);
if (ino == 0)
goto noinodes;
error = VFS_VGET(pvp->v_mount, ino, LK_EXCLUSIVE, vpp);
error = ffs_vget(pvp->v_mount, ino, LK_EXCLUSIVE, vpp);
if (error) {
UFS_VFREE(pvp, ino, mode);
ffs_vfree(pvp, ino, mode);
return (error);
}
ip = VTOI(*vpp);
@ -2368,7 +2368,7 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS)
(intmax_t)cmd.size);
}
#endif /* DEBUG */
if ((error = VFS_VGET(mp, (ino_t)cmd.value, LK_EXCLUSIVE, &vp)))
if ((error = ffs_vget(mp, (ino_t)cmd.value, LK_EXCLUSIVE, &vp)))
break;
ip = VTOI(vp);
ip->i_nlink += cmd.size;
@ -2388,7 +2388,7 @@ sysctl_ffs_fsck(SYSCTL_HANDLER_ARGS)
(intmax_t)cmd.size);
}
#endif /* DEBUG */
if ((error = VFS_VGET(mp, (ino_t)cmd.value, LK_EXCLUSIVE, &vp)))
if ((error = ffs_vget(mp, (ino_t)cmd.value, LK_EXCLUSIVE, &vp)))
break;
ip = VTOI(vp);
DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + cmd.size);

View File

@ -236,13 +236,13 @@ ffs_truncate(vp, length, flags, cred, td)
oip->i_flag |= IN_CHANGE | IN_UPDATE;
if (needextclean)
softdep_setup_freeblocks(oip, length, IO_EXT);
return (UFS_UPDATE(ovp, 1));
return (ffs_update(ovp, 1));
}
if (oip->i_size == length) {
oip->i_flag |= IN_CHANGE | IN_UPDATE;
if (needextclean)
softdep_setup_freeblocks(oip, length, IO_EXT);
return (UFS_UPDATE(ovp, 0));
return (ffs_update(ovp, 0));
}
if (fs->fs_ronly)
panic("ffs_truncate: read-only filesystem");
@ -303,7 +303,7 @@ ffs_truncate(vp, length, flags, cred, td)
else
bawrite(bp);
oip->i_flag |= IN_CHANGE | IN_UPDATE;
return (UFS_UPDATE(ovp, 1));
return (ffs_update(ovp, 1));
}
/*
* Shorten the size of the file. If the file is not being
@ -381,7 +381,7 @@ ffs_truncate(vp, length, flags, cred, td)
DIP_SET(oip, i_db[i], 0);
}
oip->i_flag |= IN_CHANGE | IN_UPDATE;
allerror = UFS_UPDATE(ovp, 1);
allerror = ffs_update(ovp, 1);
/*
* Having written the new inode to disk, save its new configuration

View File

@ -699,7 +699,7 @@ ffs_snapshot(mp, snapfile)
UFS_UNLOCK(ump);
mp->mnt_flag = flag;
if (error)
(void) UFS_TRUNCATE(vp, (off_t)0, 0, NOCRED, td);
(void) ffs_truncate(vp, (off_t)0, 0, NOCRED, td);
(void) ffs_syncvnode(vp, MNT_WAIT);
if (error)
vput(vp);
@ -852,7 +852,7 @@ expunge_ufs1(snapvp, cancelip, fs, acctfunc, expungetype)
blkno = VTOI(snapvp)->i_din1->di_db[lbn];
} else {
td->td_pflags |= TDP_COWINPROGRESS;
error = UFS_BALLOC(snapvp, lblktosize(fs, (off_t)lbn),
error = ffs_balloc_ufs1(snapvp, lblktosize(fs, (off_t)lbn),
fs->fs_bsize, KERNCRED, BA_METAONLY, &bp);
td->td_pflags &= ~TDP_COWINPROGRESS;
if (error)
@ -865,7 +865,7 @@ expunge_ufs1(snapvp, cancelip, fs, acctfunc, expungetype)
if ((error = bread(snapvp, lbn, fs->fs_bsize, KERNCRED, &bp)))
return (error);
} else {
error = UFS_BALLOC(snapvp, lblktosize(fs, (off_t)lbn),
error = ffs_balloc_ufs1(snapvp, lblktosize(fs, (off_t)lbn),
fs->fs_bsize, KERNCRED, 0, &bp);
if (error)
return (error);
@ -1036,7 +1036,7 @@ snapacct_ufs1(vp, oldblkp, lastblkp, fs, lblkno, expungetype)
blkp = &ip->i_din1->di_db[lbn];
ip->i_flag |= IN_CHANGE | IN_UPDATE;
} else {
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn),
error = ffs_balloc_ufs1(vp, lblktosize(fs, (off_t)lbn),
fs->fs_bsize, KERNCRED, BA_METAONLY, &ibp);
if (error)
return (error);
@ -1132,7 +1132,7 @@ expunge_ufs2(snapvp, cancelip, fs, acctfunc, expungetype)
blkno = VTOI(snapvp)->i_din2->di_db[lbn];
} else {
td->td_pflags |= TDP_COWINPROGRESS;
error = UFS_BALLOC(snapvp, lblktosize(fs, (off_t)lbn),
error = ffs_balloc_ufs2(snapvp, lblktosize(fs, (off_t)lbn),
fs->fs_bsize, KERNCRED, BA_METAONLY, &bp);
td->td_pflags &= ~TDP_COWINPROGRESS;
if (error)
@ -1145,7 +1145,7 @@ expunge_ufs2(snapvp, cancelip, fs, acctfunc, expungetype)
if ((error = bread(snapvp, lbn, fs->fs_bsize, KERNCRED, &bp)))
return (error);
} else {
error = UFS_BALLOC(snapvp, lblktosize(fs, (off_t)lbn),
error = ffs_balloc_ufs2(snapvp, lblktosize(fs, (off_t)lbn),
fs->fs_bsize, KERNCRED, 0, &bp);
if (error)
return (error);
@ -1316,7 +1316,7 @@ snapacct_ufs2(vp, oldblkp, lastblkp, fs, lblkno, expungetype)
blkp = &ip->i_din2->di_db[lbn];
ip->i_flag |= IN_CHANGE | IN_UPDATE;
} else {
error = UFS_BALLOC(vp, lblktosize(fs, (off_t)lbn),
error = ffs_balloc_ufs2(vp, lblktosize(fs, (off_t)lbn),
fs->fs_bsize, KERNCRED, BA_METAONLY, &ibp);
if (error)
return (error);
@ -1788,7 +1788,7 @@ ffs_snapshot_mount(mp)
int error, snaploc, loc;
/*
* XXX The following needs to be set before UFS_TRUNCATE or
* XXX The following needs to be set before ffs_truncate or
* VOP_READ can be called.
*/
mp->mnt_stat.f_iosize = fs->fs_bsize;
@ -1800,7 +1800,7 @@ ffs_snapshot_mount(mp)
for (snaploc = 0; snaploc < FSMAXSNAP; snaploc++) {
if (fs->fs_snapinum[snaploc] == 0)
break;
if ((error = VFS_VGET(mp, fs->fs_snapinum[snaploc],
if ((error = ffs_vget(mp, fs->fs_snapinum[snaploc],
LK_EXCLUSIVE, &vp)) != 0){
printf("ffs_snapshot_mount: vget failed %d\n", error);
continue;
@ -1812,7 +1812,7 @@ ffs_snapshot_mount(mp)
reason = "non-snapshot";
} else {
reason = "old format snapshot";
(void)UFS_TRUNCATE(vp, (off_t)0, 0, NOCRED, td);
(void)ffs_truncate(vp, (off_t)0, 0, NOCRED, td);
(void)ffs_syncvnode(vp, MNT_WAIT);
}
printf("ffs_snapshot_mount: %s inode %d\n",

View File

@ -514,7 +514,7 @@ process_worklist_item(matchmnt, flags)
break;
wk->wk_state |= INPROGRESS;
FREE_LOCK(&lk);
VFS_VGET(WK_DIRREM(wk)->dm_mnt, WK_DIRREM(wk)->dm_oldinum,
ffs_vget(WK_DIRREM(wk)->dm_mnt, WK_DIRREM(wk)->dm_oldinum,
LK_NOWAIT | LK_EXCLUSIVE, &vp);
ACQUIRE_LOCK(&lk);
wk->wk_state &= ~INPROGRESS;
@ -2322,7 +2322,7 @@ handle_workitem_freeblocks(freeblks, flags)
*/
if (freeblks->fb_chkcnt != blocksreleased &&
(fs->fs_flags & FS_UNCLEAN) != 0 &&
VFS_VGET(freeblks->fb_mnt, freeblks->fb_previousinum,
ffs_vget(freeblks->fb_mnt, freeblks->fb_previousinum,
(flags & LK_NOWAIT) | LK_EXCLUSIVE, &vp) == 0) {
ip = VTOI(vp);
DIP_SET(ip, i_blocks, DIP(ip, i_blocks) + \
@ -3106,7 +3106,7 @@ handle_workitem_remove(dirrem, xp)
int error;
if ((vp = xp) == NULL &&
(error = VFS_VGET(dirrem->dm_mnt, dirrem->dm_oldinum, LK_EXCLUSIVE,
(error = ffs_vget(dirrem->dm_mnt, dirrem->dm_oldinum, LK_EXCLUSIVE,
&vp)) != 0) {
softdep_error("handle_workitem_remove: vget", error);
return;
@ -4602,9 +4602,9 @@ softdep_fsync(vp)
* for details on possible races.
*/
FREE_LOCK(&lk);
if (VFS_VGET(mnt, parentino, LK_NOWAIT | LK_EXCLUSIVE, &pvp)) {
if (ffs_vget(mnt, parentino, LK_NOWAIT | LK_EXCLUSIVE, &pvp)) {
VOP_UNLOCK(vp, 0, td);
error = VFS_VGET(mnt, parentino, LK_EXCLUSIVE, &pvp);
error = ffs_vget(mnt, parentino, LK_EXCLUSIVE, &pvp);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
if (error != 0)
return (error);
@ -4612,13 +4612,13 @@ softdep_fsync(vp)
/*
* All MKDIR_PARENT dependencies and all the NEWBLOCK pagedeps
* that are contained in direct blocks will be resolved by
* doing a UFS_UPDATE. Pagedeps contained in indirect blocks
* doing a ffs_update. Pagedeps contained in indirect blocks
* may require a complete sync'ing of the directory. So, we
* try the cheap and fast UFS_UPDATE first, and if that fails,
* try the cheap and fast ffs_update first, and if that fails,
* then we do the slower ffs_syncvnode of the directory.
*/
if (flushparent) {
if ((error = UFS_UPDATE(pvp, 1)) != 0) {
if ((error = ffs_update(pvp, 1)) != 0) {
vput(pvp);
return (error);
}
@ -5060,7 +5060,7 @@ flush_pagedep_deps(pvp, mp, diraddhdp)
*/
if (dap->da_state & MKDIR_PARENT) {
FREE_LOCK(&lk);
if ((error = UFS_UPDATE(pvp, 1)) != 0)
if ((error = ffs_update(pvp, 1)) != 0)
break;
ACQUIRE_LOCK(&lk);
/*
@ -5086,7 +5086,7 @@ flush_pagedep_deps(pvp, mp, diraddhdp)
inum = dap->da_newinum;
if (dap->da_state & MKDIR_BODY) {
FREE_LOCK(&lk);
if ((error = VFS_VGET(mp, inum, LK_EXCLUSIVE, &vp)))
if ((error = ffs_vget(mp, inum, LK_EXCLUSIVE, &vp)))
break;
if ((error=ffs_syncvnode(vp, MNT_NOWAIT)) ||
(error=ffs_syncvnode(vp, MNT_NOWAIT))) {
@ -5217,7 +5217,7 @@ softdep_request_cleanup(fs, vp)
*/
if (!(curthread->td_pflags & TDP_COWINPROGRESS)) {
UFS_UNLOCK(ump);
error = UFS_UPDATE(vp, 1);
error = ffs_update(vp, 1);
UFS_LOCK(ump);
if (error != 0)
return (0);
@ -5365,7 +5365,7 @@ clear_remove(td)
if (vn_start_write(NULL, &mp, V_NOWAIT) != 0)
continue;
FREE_LOCK(&lk);
if ((error = VFS_VGET(mp, ino, LK_EXCLUSIVE, &vp))) {
if ((error = ffs_vget(mp, ino, LK_EXCLUSIVE, &vp))) {
softdep_error("clear_remove: vget", error);
vn_finished_write(mp);
ACQUIRE_LOCK(&lk);
@ -5441,7 +5441,7 @@ clear_inodedeps(td)
if (vn_start_write(NULL, &mp, V_NOWAIT) != 0)
continue;
FREE_LOCK(&lk);
if ((error = VFS_VGET(mp, ino, LK_EXCLUSIVE, &vp)) != 0) {
if ((error = ffs_vget(mp, ino, LK_EXCLUSIVE, &vp)) != 0) {
softdep_error("clear_inodedeps: vget", error);
vn_finished_write(mp);
ACQUIRE_LOCK(&lk);

View File

@ -157,7 +157,7 @@ ffs_mount(struct mount *mp, struct thread *td)
/*
* Flush any dirty data.
*/
if ((error = VFS_SYNC(mp, MNT_WAIT, td)) != 0) {
if ((error = ffs_sync(mp, MNT_WAIT, td)) != 0) {
vn_finished_write(mp);
return (error);
}

View File

@ -305,7 +305,7 @@ ffs_syncvnode(struct vnode *vp, int waitfor)
}
VI_UNLOCK(vp);
splx(s);
return (UFS_UPDATE(vp, wait));
return (ffs_update(vp, wait));
}
/*
@ -729,14 +729,14 @@ ffs_write(ap)
VN_KNOTE_UNLOCKED(vp, NOTE_WRITE | (extended ? NOTE_EXTEND : 0));
if (error) {
if (ioflag & IO_UNIT) {
(void)UFS_TRUNCATE(vp, osize,
(void)ffs_truncate(vp, osize,
IO_NORMAL | (ioflag & IO_SYNC),
ap->a_cred, uio->uio_td);
uio->uio_offset -= resid - uio->uio_resid;
uio->uio_resid = resid;
}
} else if (resid > uio->uio_resid && (ioflag & IO_SYNC))
error = UFS_UPDATE(vp, 1);
error = ffs_update(vp, 1);
return (error);
}
@ -1052,13 +1052,13 @@ ffs_extwrite(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *ucred)
}
if (error) {
if (ioflag & IO_UNIT) {
(void)UFS_TRUNCATE(vp, osize,
(void)ffs_truncate(vp, osize,
IO_EXT | (ioflag&IO_SYNC), ucred, uio->uio_td);
uio->uio_offset -= resid - uio->uio_resid;
uio->uio_resid = resid;
}
} else if (resid > uio->uio_resid && (ioflag & IO_SYNC))
error = UFS_UPDATE(vp, 1);
error = ffs_update(vp, 1);
return (error);
}