4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved.
26 /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
27 /* All Rights Reserved */
30 * University Copyright- Copyright (c) 1982, 1986, 1988
31 * The Regents of the University of California
34 * University Acknowledgment- Portions of this document are derived from
35 * software developed by the University of California, Berkeley, and its
39 #include <sys/types.h>
40 #include <sys/param.h>
42 #include <sys/taskq.h>
43 #include <sys/vnode.h>
45 /* Extensible attribute (xva) routines. */
48 * Zero out the structure, set the size of the requested/returned bitmaps,
49 * set AT_XVATTR in the embedded vattr_t's va_mask, and set up the pointer
50 * to the returned attributes array.
53 xva_init(xvattr_t *xvap)
55 bzero(xvap, sizeof (xvattr_t));
56 xvap->xva_mapsize = XVA_MAPSIZE;
57 xvap->xva_magic = XVA_MAGIC;
58 xvap->xva_vattr.va_mask = AT_XVATTR;
59 xvap->xva_rtnattrmapp = &(xvap->xva_rtnattrmap)[0];
63 * If AT_XVATTR is set, returns a pointer to the embedded xoptattr_t
64 * structure. Otherwise, returns NULL.
67 xva_getxoptattr(xvattr_t *xvap)
69 xoptattr_t *xoap = NULL;
70 if (xvap->xva_vattr.va_mask & AT_XVATTR)
71 xoap = &xvap->xva_xoptattrs;
76 vn_rele_inactive(vnode_t *vp)
82 * Like vn_rele() except if we are going to call VOP_INACTIVE() then do it
83 * asynchronously using a taskq. This can avoid deadlocks caused by re-entering
84 * the file system as a result of releasing the vnode. Note, file systems
85 * already have to handle the race where the vnode is incremented before the
86 * inactive routine is called and does its locking.
88 * Warning: Excessive use of this routine can lead to performance problems.
89 * This is because taskqs throttle back allocation if too many are created.
92 vn_rele_async(vnode_t *vp, taskq_t *taskq)
94 VERIFY(vp->v_count > 0);
96 if (vp->v_count == 1 && !(vp->v_iflag & VI_DOINGINACT)) {
98 VERIFY(taskq_dispatch((taskq_t *)taskq,
99 (task_func_t *)vn_rele_inactive, vp, TQ_SLEEP) != 0);