Make v_addpollinfo() visible and non-inline.

Have callers only call it as needed.
Add necessary call in ufs_kqfilter().

Test-case found by:	Andrew Gallatin <gallatin@cs.duke.edu>
This commit is contained in:
Poul-Henning Kamp 2002-02-18 16:18:02 +00:00
parent b541b65d91
commit 68edc1b939
3 changed files with 8 additions and 10 deletions

View File

@ -254,11 +254,9 @@ static int vnlru_nowhere;
SYSCTL_INT(_debug, OID_AUTO, vnlru_nowhere, CTLFLAG_RW, &vnlru_nowhere, 0,
"Number of times the vnlru process ran without success");
static __inline void
void
v_addpollinfo(struct vnode *vp)
{
if (vp->v_pollinfo != NULL)
return;
vp->v_pollinfo = zalloc(vnodepoll_zone);
mtx_init(&vp->v_pollinfo->vpi_lock, "vnode pollinfo", MTX_DEF);
}
@ -2725,7 +2723,8 @@ vn_pollrecord(vp, td, events)
short events;
{
v_addpollinfo(vp);
if (vp->v_pollinfo == NULL)
v_addpollinfo(vp);
mtx_lock(&vp->v_pollinfo->vpi_lock);
if (vp->v_pollinfo->vpi_revents & events) {
/*
@ -2759,7 +2758,8 @@ vn_pollevent(vp, events)
short events;
{
v_addpollinfo(vp);
if (vp->v_pollinfo == NULL)
v_addpollinfo(vp);
mtx_lock(&vp->v_pollinfo->vpi_lock);
if (vp->v_pollinfo->vpi_events & events) {
/*

View File

@ -682,6 +682,7 @@ void vput __P((struct vnode *vp));
void vrele __P((struct vnode *vp));
void vref __P((struct vnode *vp));
void vbusy __P((struct vnode *vp));
void v_addpollinfo(struct vnode *vp);
extern vop_t **default_vnodeop_p;
extern vop_t **spec_vnodeop_p;

View File

@ -2473,11 +2473,8 @@ ufs_kqfilter(ap)
kn->kn_hook = (caddr_t)vp;
if (vp->v_pollinfo == NULL) {
/* XXX: call v_addpollinfo(vp) ? */
printf("ufs_kqfilter: vnode with no v_pollinfo\n");
return (1);
}
if (vp->v_pollinfo == NULL)
v_addpollinfo(vp);
mtx_lock(&vp->v_pollinfo->vpi_lock);
SLIST_INSERT_HEAD(&vp->v_pollinfo->vpi_selinfo.si_note, kn, kn_selnext);
mtx_unlock(&vp->v_pollinfo->vpi_lock);