Ditch vfs_object_create() and make the callers call VOP_CREATEVOBJECT()
directly.
This commit is contained in:
parent
1d0efb6bd2
commit
3760addae2
@ -140,9 +140,9 @@ printf("coda_getp: Internally Opening %p\n", vp);
|
||||
return (error);
|
||||
}
|
||||
if (vp->v_type == VREG) {
|
||||
error = vfs_object_create(vp, p, cred);
|
||||
error = VOP_CREATEVOBJECT(vp, cred, p);
|
||||
if (error != 0) {
|
||||
printf("coda_getpage: vfs_object_create() returns %d\n", error);
|
||||
printf("coda_getpage: VOP_CREATEVOBJECT() returns %d\n", error);
|
||||
vput(vp);
|
||||
return(error);
|
||||
}
|
||||
|
@ -267,9 +267,9 @@ coda_open(struct vop_open_args *ap)
|
||||
}
|
||||
/* grab (above) does this when it calls newvnode unless it's in the cache*/
|
||||
if (vp->v_type == VREG) {
|
||||
error = vfs_object_create(vp, td, cred);
|
||||
error = VOP_CREATEVOBJECT(vp, cred, td);
|
||||
if (error != 0) {
|
||||
printf("coda_open: vfs_object_create() returns %d\n", error);
|
||||
printf("coda_open: VOP_CREATEVOBJECT() returns %d\n", error);
|
||||
vput(vp);
|
||||
}
|
||||
}
|
||||
@ -432,9 +432,9 @@ printf("coda_rdwr: Internally Opening %p\n", vp);
|
||||
return (error);
|
||||
}
|
||||
if (vp->v_type == VREG) {
|
||||
error = vfs_object_create(vp, td, cred);
|
||||
error = VOP_CREATEVOBJECT(vp, cred, td);
|
||||
if (error != 0) {
|
||||
printf("coda_rdwr: vfs_object_create() returns %d\n", error);
|
||||
printf("coda_rdwr: VOP_CREATEVOBJECT() returns %d\n", error);
|
||||
vput(vp);
|
||||
}
|
||||
}
|
||||
@ -1563,9 +1563,9 @@ printf("coda_readdir: Internally Opening %p\n", vp);
|
||||
return (error);
|
||||
}
|
||||
if (vp->v_type == VREG) {
|
||||
error = vfs_object_create(vp, td, cred);
|
||||
error = VOP_CREATEVOBJECT(vp, cred, td);
|
||||
if (error != 0) {
|
||||
printf("coda_readdir: vfs_object_create() returns %d\n", error);
|
||||
printf("coda_readdir: VOP_CREATEVOBJECT() returns %d\n", error);
|
||||
vput(vp);
|
||||
}
|
||||
}
|
||||
|
@ -140,9 +140,9 @@ printf("coda_getp: Internally Opening %p\n", vp);
|
||||
return (error);
|
||||
}
|
||||
if (vp->v_type == VREG) {
|
||||
error = vfs_object_create(vp, p, cred);
|
||||
error = VOP_CREATEVOBJECT(vp, cred, p);
|
||||
if (error != 0) {
|
||||
printf("coda_getpage: vfs_object_create() returns %d\n", error);
|
||||
printf("coda_getpage: VOP_CREATEVOBJECT() returns %d\n", error);
|
||||
vput(vp);
|
||||
return(error);
|
||||
}
|
||||
|
@ -267,9 +267,9 @@ coda_open(struct vop_open_args *ap)
|
||||
}
|
||||
/* grab (above) does this when it calls newvnode unless it's in the cache*/
|
||||
if (vp->v_type == VREG) {
|
||||
error = vfs_object_create(vp, td, cred);
|
||||
error = VOP_CREATEVOBJECT(vp, cred, td);
|
||||
if (error != 0) {
|
||||
printf("coda_open: vfs_object_create() returns %d\n", error);
|
||||
printf("coda_open: VOP_CREATEVOBJECT() returns %d\n", error);
|
||||
vput(vp);
|
||||
}
|
||||
}
|
||||
@ -432,9 +432,9 @@ printf("coda_rdwr: Internally Opening %p\n", vp);
|
||||
return (error);
|
||||
}
|
||||
if (vp->v_type == VREG) {
|
||||
error = vfs_object_create(vp, td, cred);
|
||||
error = VOP_CREATEVOBJECT(vp, cred, td);
|
||||
if (error != 0) {
|
||||
printf("coda_rdwr: vfs_object_create() returns %d\n", error);
|
||||
printf("coda_rdwr: VOP_CREATEVOBJECT() returns %d\n", error);
|
||||
vput(vp);
|
||||
}
|
||||
}
|
||||
@ -1563,9 +1563,9 @@ printf("coda_readdir: Internally Opening %p\n", vp);
|
||||
return (error);
|
||||
}
|
||||
if (vp->v_type == VREG) {
|
||||
error = vfs_object_create(vp, td, cred);
|
||||
error = VOP_CREATEVOBJECT(vp, cred, td);
|
||||
if (error != 0) {
|
||||
printf("coda_readdir: vfs_object_create() returns %d\n", error);
|
||||
printf("coda_readdir: VOP_CREATEVOBJECT() returns %d\n", error);
|
||||
vput(vp);
|
||||
}
|
||||
}
|
||||
|
@ -782,7 +782,7 @@ union_copyup(un, docopy, cred, td)
|
||||
vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
error = VOP_OPEN(lvp, FREAD, cred, td, -1);
|
||||
if (error == 0 && vn_canvmio(lvp) == TRUE)
|
||||
error = vfs_object_create(lvp, td, cred);
|
||||
error = VOP_CREATEVOBJECT(lvp, cred, td);
|
||||
if (error == 0) {
|
||||
error = union_copyfile(lvp, uvp, cred, td);
|
||||
VOP_UNLOCK(lvp, 0, td);
|
||||
@ -815,7 +815,7 @@ union_copyup(un, docopy, cred, td)
|
||||
}
|
||||
if (un->un_openl) {
|
||||
if (vn_canvmio(uvp) == TRUE)
|
||||
error = vfs_object_create(uvp, td, cred);
|
||||
error = VOP_CREATEVOBJECT(uvp, cred, td);
|
||||
}
|
||||
un->un_openl = 0;
|
||||
}
|
||||
@ -1128,7 +1128,7 @@ union_vn_create(vpp, un, td)
|
||||
|
||||
error = VOP_OPEN(vp, fmode, cred, td, -1);
|
||||
if (error == 0 && vn_canvmio(vp) == TRUE)
|
||||
error = vfs_object_create(vp, td, cred);
|
||||
error = VOP_CREATEVOBJECT(vp, cred, td);
|
||||
if (error) {
|
||||
vput(vp);
|
||||
return (error);
|
||||
@ -1331,7 +1331,7 @@ union_dircheck(struct thread *td, struct vnode **vp, struct file *fp)
|
||||
if (lvp != NULLVP) {
|
||||
error = VOP_OPEN(lvp, FREAD, fp->f_cred, td, -1);
|
||||
if (error == 0 && vn_canvmio(lvp) == TRUE)
|
||||
error = vfs_object_create(lvp, td, fp->f_cred);
|
||||
error = VOP_CREATEVOBJECT(lvp, fp->f_cred, td);
|
||||
if (error) {
|
||||
vput(lvp);
|
||||
return (error);
|
||||
|
@ -785,9 +785,8 @@ union_open(ap)
|
||||
/*
|
||||
* This is absolutely necessary or UFS will blow up.
|
||||
*/
|
||||
if (error == 0 && vn_canvmio(tvp) == TRUE) {
|
||||
error = vfs_object_create(tvp, td, cred);
|
||||
}
|
||||
if (error == 0 && vn_canvmio(tvp) == TRUE)
|
||||
error = VOP_CREATEVOBJECT(tvp, cred, td);
|
||||
|
||||
/*
|
||||
* Release any locks held.
|
||||
|
@ -420,7 +420,7 @@ vop_stdcreatevobject(ap)
|
||||
vrele(vp);
|
||||
}
|
||||
|
||||
KASSERT(vp->v_object != NULL, ("vfs_object_create: NULL object"));
|
||||
KASSERT(vp->v_object != NULL, ("vop_stdcreatevobject: NULL object"));
|
||||
vp->v_vflag |= VV_OBJBUF;
|
||||
|
||||
return (error);
|
||||
|
@ -3957,7 +3957,7 @@ fhopen(td, uap)
|
||||
* Make sure that a VM object is created for VMIO support.
|
||||
*/
|
||||
if (vn_canvmio(vp) == TRUE) {
|
||||
if ((error = vfs_object_create(vp, td, td->td_ucred)) != 0)
|
||||
if ((error = VOP_CREATEVOBJECT(vp, td->td_ucred, td)) != 0)
|
||||
goto bad;
|
||||
}
|
||||
if (fmode & FWRITE)
|
||||
@ -4011,7 +4011,7 @@ fhopen(td, uap)
|
||||
fp->f_flag |= FHASLOCK;
|
||||
}
|
||||
if ((vp->v_type == VREG) && (VOP_GETVOBJECT(vp, NULL) != 0))
|
||||
vfs_object_create(vp, td, td->td_ucred);
|
||||
VOP_CREATEVOBJECT(vp, td->td_ucred, td);
|
||||
|
||||
VOP_UNLOCK(vp, 0, td);
|
||||
fdrop(fp, td);
|
||||
|
@ -207,8 +207,8 @@ namei(ndp)
|
||||
(cnp->cn_nameiop != DELETE) &&
|
||||
((cnp->cn_flags & (NOOBJ|LOCKLEAF)) ==
|
||||
LOCKLEAF))
|
||||
vfs_object_create(ndp->ni_vp, td,
|
||||
ndp->ni_cnd.cn_cred);
|
||||
VOP_CREATEVOBJECT(ndp->ni_vp,
|
||||
ndp->ni_cnd.cn_cred, td);
|
||||
|
||||
return (0);
|
||||
}
|
||||
@ -771,7 +771,7 @@ relookup(dvp, vpp, cnp)
|
||||
|
||||
if (vn_canvmio(dp) == TRUE &&
|
||||
((cnp->cn_flags & (NOOBJ|LOCKLEAF)) == LOCKLEAF))
|
||||
vfs_object_create(dp, td, cnp->cn_cred);
|
||||
VOP_CREATEVOBJECT(dp, cnp->cn_cred, td);
|
||||
|
||||
if ((cnp->cn_flags & LOCKLEAF) == 0)
|
||||
VOP_UNLOCK(dp, 0, td);
|
||||
|
@ -2842,22 +2842,6 @@ loop:
|
||||
MNT_IUNLOCK(mp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create the VM object needed for VMIO and mmap support. This
|
||||
* is done for all VREG files in the system. Some filesystems might
|
||||
* afford the additional metadata buffering capability of the
|
||||
* VMIO code by making the device node be VMIO mode also.
|
||||
*
|
||||
* vp must be locked when vfs_object_create is called.
|
||||
*/
|
||||
int
|
||||
vfs_object_create(struct vnode *vp, struct thread *td, struct ucred *cred)
|
||||
{
|
||||
|
||||
GIANT_REQUIRED;
|
||||
return (VOP_CREATEVOBJECT(vp, cred, td));
|
||||
}
|
||||
|
||||
/*
|
||||
* Mark a vnode as free, putting it up for recycling.
|
||||
*/
|
||||
|
@ -3957,7 +3957,7 @@ fhopen(td, uap)
|
||||
* Make sure that a VM object is created for VMIO support.
|
||||
*/
|
||||
if (vn_canvmio(vp) == TRUE) {
|
||||
if ((error = vfs_object_create(vp, td, td->td_ucred)) != 0)
|
||||
if ((error = VOP_CREATEVOBJECT(vp, td->td_ucred, td)) != 0)
|
||||
goto bad;
|
||||
}
|
||||
if (fmode & FWRITE)
|
||||
@ -4011,7 +4011,7 @@ fhopen(td, uap)
|
||||
fp->f_flag |= FHASLOCK;
|
||||
}
|
||||
if ((vp->v_type == VREG) && (VOP_GETVOBJECT(vp, NULL) != 0))
|
||||
vfs_object_create(vp, td, td->td_ucred);
|
||||
VOP_CREATEVOBJECT(vp, td->td_ucred, td);
|
||||
|
||||
VOP_UNLOCK(vp, 0, td);
|
||||
fdrop(fp, td);
|
||||
|
@ -252,7 +252,7 @@ restart:
|
||||
* restores the requested locking state.
|
||||
*/
|
||||
#endif
|
||||
if ((error = vfs_object_create(vp, td, cred)) != 0) {
|
||||
if ((error = VOP_CREATEVOBJECT(vp, cred, td)) != 0) {
|
||||
VOP_UNLOCK(vp, 0, td);
|
||||
VOP_CLOSE(vp, fmode, cred, td);
|
||||
NDFREE(ndp, NDF_ONLY_PNBUF);
|
||||
|
@ -1233,7 +1233,7 @@ nfsrv_object_create(struct vnode *vp)
|
||||
|
||||
if (vp == NULL || vp->v_type != VREG)
|
||||
return (1);
|
||||
return (vfs_object_create(vp, curthread, curthread->td_ucred));
|
||||
return (VOP_CREATEVOBJECT(vp, curthread->td_ucred, curthread));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -649,8 +649,6 @@ int vn_extattr_set(struct vnode *vp, int ioflg, int attrnamespace,
|
||||
int vn_extattr_rm(struct vnode *vp, int ioflg, int attrnamespace,
|
||||
const char *attrname, struct thread *td);
|
||||
int vfs_cache_lookup(struct vop_lookup_args *ap);
|
||||
int vfs_object_create(struct vnode *vp, struct thread *td,
|
||||
struct ucred *cred);
|
||||
void vfs_timestamp(struct timespec *);
|
||||
void vfs_write_resume(struct mount *mp);
|
||||
int vfs_write_suspend(struct mount *mp);
|
||||
|
@ -410,7 +410,7 @@ ffs_reload(struct mount *mp, struct thread *td)
|
||||
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
if (vinvalbuf(devvp, 0, td->td_ucred, td, 0, 0) != 0)
|
||||
panic("ffs_reload: dirty1");
|
||||
vfs_object_create(devvp, td, td->td_ucred);
|
||||
VOP_CREATEVOBJECT(devvp, td->td_ucred, td);
|
||||
VOP_UNLOCK(devvp, 0, td);
|
||||
|
||||
/*
|
||||
@ -553,7 +553,7 @@ ffs_mountfs(devvp, mp, td)
|
||||
dev = devvp->v_rdev;
|
||||
cred = td ? td->td_ucred : NOCRED;
|
||||
|
||||
vfs_object_create(devvp, td, td->td_ucred);
|
||||
VOP_CREATEVOBJECT(devvp, td->td_ucred, td);
|
||||
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
|
||||
DROP_GIANT();
|
||||
g_topology_lock();
|
||||
|
@ -333,12 +333,11 @@ ufs_extattr_enable_with_open(struct ufsmount *ump, struct vnode *vp,
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX: Note, should VOP_CLOSE() if vfs_object_create() fails, but due
|
||||
* XXX: Note, should VOP_CLOSE() if VOP_CREATEVOBJECT() fails, but due
|
||||
* to a similar piece of code in vn_open(), we don't.
|
||||
*/
|
||||
if (vn_canvmio(vp) == TRUE)
|
||||
if ((error = vfs_object_create(vp, td,
|
||||
td->td_ucred)) != 0) {
|
||||
if ((error = VOP_CREATEVOBJECT(vp, td->td_ucred, td)) != 0) {
|
||||
/*
|
||||
* XXX: bug replicated from vn_open(): should
|
||||
* VOP_CLOSE() here.
|
||||
|
Loading…
x
Reference in New Issue
Block a user