vfs_subr.c (7ae8ce5df187c5b4dd138db3c705622f253f8285) | vfs_subr.c (f257b7a54b4fe77840cf694314bdc401e00c31a1) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 2244 unchanged lines hidden (view full) --- 2253 * 2254 * If WRITECLOSE is set, only flush out regular file vnodes open for 2255 * writing. 2256 * 2257 * SKIPSYSTEM causes any vnodes marked VV_SYSTEM to be skipped. 2258 * 2259 * `rootrefs' specifies the base reference count for the root vnode 2260 * of this filesystem. The root vnode is considered busy if its | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * (c) UNIX System Laboratories, Inc. 5 * All or some portions of this file are derived from material licensed 6 * to the University of California by American Telephone and Telegraph 7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 8 * the permission of UNIX System Laboratories, Inc. --- 2244 unchanged lines hidden (view full) --- 2253 * 2254 * If WRITECLOSE is set, only flush out regular file vnodes open for 2255 * writing. 2256 * 2257 * SKIPSYSTEM causes any vnodes marked VV_SYSTEM to be skipped. 2258 * 2259 * `rootrefs' specifies the base reference count for the root vnode 2260 * of this filesystem. The root vnode is considered busy if its |
2261 * v_usecount exceeds this value. On a successful return, vflush() | 2261 * v_usecount exceeds this value. On a successful return, vflush(, td) |
2262 * will call vrele() on the root vnode exactly rootrefs times. 2263 * If the SKIPSYSTEM or WRITECLOSE flags are specified, rootrefs must 2264 * be zero. 2265 */ 2266#ifdef DIAGNOSTIC 2267static int busyprt = 0; /* print out busy vnodes */ 2268SYSCTL_INT(_debug, OID_AUTO, busyprt, CTLFLAG_RW, &busyprt, 0, ""); 2269#endif 2270 2271int | 2262 * will call vrele() on the root vnode exactly rootrefs times. 2263 * If the SKIPSYSTEM or WRITECLOSE flags are specified, rootrefs must 2264 * be zero. 2265 */ 2266#ifdef DIAGNOSTIC 2267static int busyprt = 0; /* print out busy vnodes */ 2268SYSCTL_INT(_debug, OID_AUTO, busyprt, CTLFLAG_RW, &busyprt, 0, ""); 2269#endif 2270 2271int |
2272vflush(mp, rootrefs, flags) | 2272vflush(mp, rootrefs, flags, td) |
2273 struct mount *mp; 2274 int rootrefs; 2275 int flags; | 2273 struct mount *mp; 2274 int rootrefs; 2275 int flags; |
2276 struct thread *td; |
|
2276{ | 2277{ |
2277 struct thread *td = curthread; /* XXX */ | |
2278 struct vnode *vp, *nvp, *rootvp = NULL; 2279 struct vattr vattr; 2280 int busy = 0, error; 2281 2282 if (rootrefs > 0) { 2283 KASSERT((flags & (SKIPSYSTEM | WRITECLOSE)) == 0, 2284 ("vflush: bad args")); 2285 /* 2286 * Get the filesystem root vnode. We can vput() it 2287 * immediately, since with rootrefs > 0, it won't go away. 2288 */ | 2278 struct vnode *vp, *nvp, *rootvp = NULL; 2279 struct vattr vattr; 2280 int busy = 0, error; 2281 2282 if (rootrefs > 0) { 2283 KASSERT((flags & (SKIPSYSTEM | WRITECLOSE)) == 0, 2284 ("vflush: bad args")); 2285 /* 2286 * Get the filesystem root vnode. We can vput() it 2287 * immediately, since with rootrefs > 0, it won't go away. 2288 */ |
2289 if ((error = VFS_ROOT(mp, &rootvp)) != 0) | 2289 if ((error = VFS_ROOT(mp, &rootvp, td)) != 0) |
2290 return (error); 2291 vput(rootvp); 2292 2293 } 2294 MNT_ILOCK(mp); 2295loop: 2296 MNT_VNODE_FOREACH(vp, mp, nvp) { 2297 --- 1746 unchanged lines hidden --- | 2290 return (error); 2291 vput(rootvp); 2292 2293 } 2294 MNT_ILOCK(mp); 2295loop: 2296 MNT_VNODE_FOREACH(vp, mp, nvp) { 2297 --- 1746 unchanged lines hidden --- |