Ejemplo n.º 1
0
int
sysvbfs_reclaim(void *v)
{
	extern struct pool sysvbfs_node_pool;
	struct vop_reclaim_args /* {
		struct vnode *a_vp;
	} */ *ap = v;
	struct vnode *vp = ap->a_vp;
	struct sysvbfs_node *bnode = vp->v_data;
	struct bfs *bfs = bnode->bmp->bfs;

	DPRINTF("%s:\n", __func__);

	vcache_remove(vp->v_mount,
	    &bnode->inode->number, sizeof(bnode->inode->number));
	if (bnode->removed) {
		if (bfs_inode_delete(bfs, bnode->inode->number) != 0)
			DPRINTF("%s: delete inode failed\n", __func__);
	}
	genfs_node_destroy(vp);
	pool_put(&sysvbfs_node_pool, bnode);
	vp->v_data = NULL;

	return 0;
}
Ejemplo n.º 2
0
/*
 * Reclaim an inode so that it can be used for other purposes.
 */
int
ulfs_reclaim(struct vnode *vp)
{
	struct inode *ip = VTOI(vp);

	if (prtactive && vp->v_usecount > 1)
		vprint("ulfs_reclaim: pushing active", vp);

	/* XXX: do we really need two of these? */
	/* note: originally the first was inside a wapbl txn */
	lfs_update(vp, NULL, NULL, UPDATE_CLOSE);
	lfs_update(vp, NULL, NULL, UPDATE_CLOSE);

	/*
	 * Remove the inode from the vnode cache.
	 */
	vcache_remove(vp->v_mount, &ip->i_number, sizeof(ip->i_number));

	if (ip->i_devvp) {
		vrele(ip->i_devvp);
		ip->i_devvp = 0;
	}
#if defined(LFS_QUOTA) || defined(LFS_QUOTA2)
	ulfsquota_free(ip);
#endif
#ifdef LFS_DIRHASH
	if (ip->i_dirhash != NULL)
		ulfsdirhash_free(ip);
#endif
	return (0);
}
Ejemplo n.º 3
0
/*
 * Reclaim an nfsnode so that it can be used for other purposes.
 */
int
nfs_reclaim(void *v)
{
	struct vop_reclaim_args /* {
		struct vnode *a_vp;
	} */ *ap = v;
	struct vnode *vp = ap->a_vp;
	struct nfsnode *np = VTONFS(vp);

	if (prtactive && vp->v_usecount > 1)
		vprint("nfs_reclaim: pushing active", vp);

	vcache_remove(vp->v_mount, np->n_fhp, np->n_fhsize);

	/*
	 * Free up any directory cookie structures and
	 * large file handle structures that might be associated with
	 * this nfs node.
	 */
	if (vp->v_type == VDIR && np->n_dircache != NULL) {
		nfs_invaldircache(vp, NFS_INVALDIRCACHE_FORCE);
		hashdone(np->n_dircache, HASH_LIST, nfsdirhashmask);
	}
	KASSERT(np->n_dirgens == NULL);

	if (np->n_fhsize > NFS_SMALLFH)
		kmem_free(np->n_fhp, np->n_fhsize);

	pool_put(&nfs_vattr_pool, np->n_vattr);
	if (np->n_rcred)
		kauth_cred_free(np->n_rcred);

	if (np->n_wcred)
		kauth_cred_free(np->n_wcred);

	if (vp->v_type == VREG) {
		mutex_destroy(&np->n_commitlock);
	}
	genfs_node_destroy(vp);
	pool_put(&nfs_node_pool, np);
	vp->v_data = NULL;
	return (0);
}
Ejemplo n.º 4
0
/*
 * Reclaim an fnode/ntnode so that it can be used for other purposes.
 */
int
ntfs_reclaim(void *v)
{
	struct vop_reclaim_args /* {
		struct vnode *a_vp;
	} */ *ap = v;
	struct vnode *vp = ap->a_vp;
	struct fnode *fp = VTOF(vp);
	struct ntnode *ip = FTONT(fp);
	const int attrlen = strlen(fp->f_attrname);
	int error;

	dprintf(("ntfs_reclaim: vnode: %p, ntnode: %llu\n", vp,
	    (unsigned long long)ip->i_number));

	if (prtactive && vp->v_usecount > 1)
		vprint("ntfs_reclaim: pushing active", vp);

	if ((error = ntfs_ntget(ip)) != 0)
		return (error);

	vcache_remove(vp->v_mount, fp->f_key, NTKEY_SIZE(attrlen));

	if (ip->i_devvp) {
		vrele(ip->i_devvp);
		ip->i_devvp = NULL;
	}
	genfs_node_destroy(vp);
	vp->v_data = NULL;

	/* Destroy fnode. */
	if (fp->f_key != &fp->f_smallkey)
		kmem_free(fp->f_key, NTKEY_SIZE(attrlen));
	if (fp->f_dirblbuf)
		free(fp->f_dirblbuf, M_NTFSDIR);
	kmem_free(fp, sizeof(*fp));
	ntfs_ntrele(ip);

	ntfs_ntput(ip);

	return (0);
}
Ejemplo n.º 5
0
/*
 * the kernel wants its vnode back.
 * no lock needed we are being called from vclean()
 */
int
adosfs_reclaim(void *v)
{
	struct vop_reclaim_args /* {
		struct vnode *a_vp;
	} */ *sp = v;
	struct vnode *vp;
	struct anode *ap;

#ifdef ADOSFS_DIAGNOSTIC
	printf("(reclaim 0)");
#endif
	vp = sp->a_vp;
	ap = VTOA(vp);
	vcache_remove(vp->v_mount, &ap->block, sizeof(ap->block));
	if (vp->v_type == VDIR && ap->tab)
		free(ap->tab, M_ANODE);
	else if (vp->v_type == VLNK && ap->slinkto)
		free(ap->slinkto, M_ANODE);
	genfs_node_destroy(vp);
	pool_put(&adosfs_node_pool, ap);
	vp->v_data = NULL;
	return(0);
}