vfs_export.c (42315) | vfs_export.c (42408) |
---|---|
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. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 | 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. --- 22 unchanged lines hidden (view full) --- 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95 |
39 * $Id: vfs_subr.c,v 1.179 1999/01/05 18:12:29 eivind Exp $ | 39 * $Id: vfs_subr.c,v 1.180 1999/01/05 18:49:53 eivind Exp $ |
40 */ 41 42/* 43 * External virtual filesystem routines 44 */ 45#include "opt_ddb.h" 46 47#include <sys/param.h> --- 413 unchanged lines hidden (view full) --- 461 cache_purge(vp); 462 vp->v_lease = NULL; 463 if (vp->v_type != VBAD) { 464 vgonel(vp, p); 465 } else { 466 simple_unlock(&vp->v_interlock); 467 } 468 | 40 */ 41 42/* 43 * External virtual filesystem routines 44 */ 45#include "opt_ddb.h" 46 47#include <sys/param.h> --- 413 unchanged lines hidden (view full) --- 461 cache_purge(vp); 462 vp->v_lease = NULL; 463 if (vp->v_type != VBAD) { 464 vgonel(vp, p); 465 } else { 466 simple_unlock(&vp->v_interlock); 467 } 468 |
469#ifdef DIAGNOSTIC | 469#ifdef INVARIANTS |
470 { 471 int s; 472 473 if (vp->v_data) 474 panic("cleaned vnode isn't"); 475 s = splbio(); 476 if (vp->v_numoutput) 477 panic("Clean vnode has pending I/O's"); --- 313 unchanged lines hidden (view full) --- 791 */ 792void 793bgetvp(vp, bp) 794 register struct vnode *vp; 795 register struct buf *bp; 796{ 797 int s; 798 | 470 { 471 int s; 472 473 if (vp->v_data) 474 panic("cleaned vnode isn't"); 475 s = splbio(); 476 if (vp->v_numoutput) 477 panic("Clean vnode has pending I/O's"); --- 313 unchanged lines hidden (view full) --- 791 */ 792void 793bgetvp(vp, bp) 794 register struct vnode *vp; 795 register struct buf *bp; 796{ 797 int s; 798 |
799#if defined(DIAGNOSTIC) 800 if (bp->b_vp) 801 panic("bgetvp: not free"); 802#endif | 799 KASSERT(bp->b_vp == NULL, ("bgetvp: not free")); |
803 vhold(vp); 804 bp->b_vp = vp; 805 if (vp->v_type == VBLK || vp->v_type == VCHR) 806 bp->b_dev = vp->v_rdev; 807 else 808 bp->b_dev = NODEV; 809 /* 810 * Insert onto list for new vnode. --- 11 unchanged lines hidden (view full) --- 822void 823brelvp(bp) 824 register struct buf *bp; 825{ 826 struct vnode *vp; 827 struct buflists *listheadp; 828 int s; 829 | 800 vhold(vp); 801 bp->b_vp = vp; 802 if (vp->v_type == VBLK || vp->v_type == VCHR) 803 bp->b_dev = vp->v_rdev; 804 else 805 bp->b_dev = NODEV; 806 /* 807 * Insert onto list for new vnode. --- 11 unchanged lines hidden (view full) --- 819void 820brelvp(bp) 821 register struct buf *bp; 822{ 823 struct vnode *vp; 824 struct buflists *listheadp; 825 int s; 826 |
830#if defined(DIAGNOSTIC) 831 if (bp->b_vp == (struct vnode *) 0) 832 panic("brelvp: NULL"); 833#endif | 827 KASSERT(bp->b_vp != NULL, ("brelvp: NULL")); |
834 835 /* 836 * Delete from old vnode list, if on one. 837 */ 838 vp = bp->b_vp; 839 s = splbio(); 840 if (bp->b_xflags & (B_VNDIRTY|B_VNCLEAN)) { 841 if (bp->b_xflags & B_VNDIRTY) --- 149 unchanged lines hidden (view full) --- 991/* 992 * Associate a p-buffer with a vnode. 993 */ 994void 995pbgetvp(vp, bp) 996 register struct vnode *vp; 997 register struct buf *bp; 998{ | 828 829 /* 830 * Delete from old vnode list, if on one. 831 */ 832 vp = bp->b_vp; 833 s = splbio(); 834 if (bp->b_xflags & (B_VNDIRTY|B_VNCLEAN)) { 835 if (bp->b_xflags & B_VNDIRTY) --- 149 unchanged lines hidden (view full) --- 985/* 986 * Associate a p-buffer with a vnode. 987 */ 988void 989pbgetvp(vp, bp) 990 register struct vnode *vp; 991 register struct buf *bp; 992{ |
999#if defined(DIAGNOSTIC) 1000 if (bp->b_vp) 1001 panic("pbgetvp: not free"); 1002#endif | 993 KASSERT(bp->b_vp == NULL, ("pbgetvp: not free")); 994 |
1003 bp->b_vp = vp; 1004 if (vp->v_type == VBLK || vp->v_type == VCHR) 1005 bp->b_dev = vp->v_rdev; 1006 else 1007 bp->b_dev = NODEV; 1008} 1009 1010/* 1011 * Disassociate a p-buffer from a vnode. 1012 */ 1013void 1014pbrelvp(bp) 1015 register struct buf *bp; 1016{ 1017 | 995 bp->b_vp = vp; 996 if (vp->v_type == VBLK || vp->v_type == VCHR) 997 bp->b_dev = vp->v_rdev; 998 else 999 bp->b_dev = NODEV; 1000} 1001 1002/* 1003 * Disassociate a p-buffer from a vnode. 1004 */ 1005void 1006pbrelvp(bp) 1007 register struct buf *bp; 1008{ 1009 |
1018#if defined(DIAGNOSTIC) 1019 if (bp->b_vp == (struct vnode *) 0) 1020 panic("pbrelvp: NULL"); 1021#endif | 1010 KASSERT(bp->b_vp != NULL, ("pbrelvp: NULL")); |
1022 1023 bp->b_vp = (struct vnode *) 0; 1024} 1025 1026/* 1027 * Reassign a buffer from one vnode to another. 1028 * Used to assign file specific control information 1029 * (indirect blocks) to the vnode to which they belong. --- 278 unchanged lines hidden (view full) --- 1308 * If count drops to zero, call inactive routine and return to freelist. 1309 */ 1310void 1311vrele(vp) 1312 struct vnode *vp; 1313{ 1314 struct proc *p = curproc; /* XXX */ 1315 | 1011 1012 bp->b_vp = (struct vnode *) 0; 1013} 1014 1015/* 1016 * Reassign a buffer from one vnode to another. 1017 * Used to assign file specific control information 1018 * (indirect blocks) to the vnode to which they belong. --- 278 unchanged lines hidden (view full) --- 1297 * If count drops to zero, call inactive routine and return to freelist. 1298 */ 1299void 1300vrele(vp) 1301 struct vnode *vp; 1302{ 1303 struct proc *p = curproc; /* XXX */ 1304 |
1316#ifdef DIAGNOSTIC 1317 if (vp == NULL) 1318 panic("vrele: null vp"); 1319#endif | 1305 KASSERT(vp, ("vrele: null vp")); 1306 |
1320 simple_lock(&vp->v_interlock); 1321 1322 if (vp->v_usecount > 1) { 1323 1324 vp->v_usecount--; 1325 simple_unlock(&vp->v_interlock); 1326 1327 return; --- 23 unchanged lines hidden (view full) --- 1351} 1352 1353void 1354vput(vp) 1355 struct vnode *vp; 1356{ 1357 struct proc *p = curproc; /* XXX */ 1358 | 1307 simple_lock(&vp->v_interlock); 1308 1309 if (vp->v_usecount > 1) { 1310 1311 vp->v_usecount--; 1312 simple_unlock(&vp->v_interlock); 1313 1314 return; --- 23 unchanged lines hidden (view full) --- 1338} 1339 1340void 1341vput(vp) 1342 struct vnode *vp; 1343{ 1344 struct proc *p = curproc; /* XXX */ 1345 |
1359#ifdef DIAGNOSTIC 1360 if (vp == NULL) 1361 panic("vput: null vp"); 1362#endif | 1346 KASSERT(vp != NULL, ("vput: null vp")); |
1363 1364 simple_lock(&vp->v_interlock); 1365 1366 if (vp->v_usecount > 1) { 1367 1368 vp->v_usecount--; 1369 VOP_UNLOCK(vp, LK_INTERLOCK, p); 1370 return; --- 270 unchanged lines hidden (view full) --- 1641 struct vop_revoke_args /* { 1642 struct vnode *a_vp; 1643 int a_flags; 1644 } */ *ap; 1645{ 1646 struct vnode *vp, *vq; 1647 struct proc *p = curproc; /* XXX */ 1648 | 1347 1348 simple_lock(&vp->v_interlock); 1349 1350 if (vp->v_usecount > 1) { 1351 1352 vp->v_usecount--; 1353 VOP_UNLOCK(vp, LK_INTERLOCK, p); 1354 return; --- 270 unchanged lines hidden (view full) --- 1625 struct vop_revoke_args /* { 1626 struct vnode *a_vp; 1627 int a_flags; 1628 } */ *ap; 1629{ 1630 struct vnode *vp, *vq; 1631 struct proc *p = curproc; /* XXX */ 1632 |
1649#ifdef DIAGNOSTIC 1650 if ((ap->a_flags & REVOKEALL) == 0) 1651 panic("vop_revoke"); 1652#endif | 1633 KASSERT((ap->a_flags & REVOKEALL) != 0, ("vop_revoke")); |
1653 1654 vp = ap->a_vp; 1655 simple_lock(&vp->v_interlock); 1656 1657 if (vp->v_flag & VALIASED) { 1658 /* 1659 * If a vgone (or vclean) is already in progress, 1660 * wait until it is done and return. --- 1185 unchanged lines hidden --- | 1634 1635 vp = ap->a_vp; 1636 simple_lock(&vp->v_interlock); 1637 1638 if (vp->v_flag & VALIASED) { 1639 /* 1640 * If a vgone (or vclean) is already in progress, 1641 * wait until it is done and return. --- 1185 unchanged lines hidden --- |