vfs_subr.c (ee1d0eb330e3d90d30229ccc95891236f57a3f6b) vfs_subr.c (156cb26583261189ef25d1535ec92e4244adb0f8)
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.

--- 938 unchanged lines hidden (view full) ---

947 }
948 }
949 /*
950 * If you alter this loop please notice that interlock is dropped and
951 * reacquired in flushbuflist. Special care is needed to ensure that
952 * no race conditions occur from this.
953 */
954 for (error = 0;;) {
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.

--- 938 unchanged lines hidden (view full) ---

947 }
948 }
949 /*
950 * If you alter this loop please notice that interlock is dropped and
951 * reacquired in flushbuflist. Special care is needed to ensure that
952 * no race conditions occur from this.
953 */
954 for (error = 0;;) {
955 if ((blist = TAILQ_FIRST(&vp->v_cleanblkhd)) != 0 &&
955 blist = TAILQ_FIRST(&vp->v_bufobj.bo_clean.bv_hd);
956 if (blist != NULL &&
956 flushbuflist(blist, flags, vp, slpflag, slptimeo, &error)) {
957 if (error)
958 break;
959 continue;
960 }
957 flushbuflist(blist, flags, vp, slpflag, slptimeo, &error)) {
958 if (error)
959 break;
960 continue;
961 }
961 if ((blist = TAILQ_FIRST(&vp->v_dirtyblkhd)) != 0 &&
962 blist = TAILQ_FIRST(&vp->v_bufobj.bo_dirty.bv_hd);
963 if (blist != NULL &&
962 flushbuflist(blist, flags, vp, slpflag, slptimeo, &error)) {
963 if (error)
964 break;
965 continue;
966 }
967 break;
968 }
969 if (error) {

--- 10 unchanged lines hidden (view full) ---

980 bufobj_wwait(bo, 0, 0);
981 VI_UNLOCK(vp);
982 if (VOP_GETVOBJECT(vp, &object) == 0) {
983 VM_OBJECT_LOCK(object);
984 vm_object_pip_wait(object, "vnvlbx");
985 VM_OBJECT_UNLOCK(object);
986 }
987 VI_LOCK(vp);
964 flushbuflist(blist, flags, vp, slpflag, slptimeo, &error)) {
965 if (error)
966 break;
967 continue;
968 }
969 break;
970 }
971 if (error) {

--- 10 unchanged lines hidden (view full) ---

982 bufobj_wwait(bo, 0, 0);
983 VI_UNLOCK(vp);
984 if (VOP_GETVOBJECT(vp, &object) == 0) {
985 VM_OBJECT_LOCK(object);
986 vm_object_pip_wait(object, "vnvlbx");
987 VM_OBJECT_UNLOCK(object);
988 }
989 VI_LOCK(vp);
988 } while (vp->v_numoutput > 0);
990 } while (bo->bo_numoutput > 0);
989 VI_UNLOCK(vp);
990
991 /*
992 * Destroy the copy in the VM cache, too.
993 */
994 if (VOP_GETVOBJECT(vp, &object) == 0) {
995 VM_OBJECT_LOCK(object);
996 vm_object_page_remove(object, 0, 0,
997 (flags & V_SAVE) ? TRUE : FALSE);
998 VM_OBJECT_UNLOCK(object);
999 }
1000
1001#ifdef INVARIANTS
1002 VI_LOCK(vp);
1003 if ((flags & (V_ALT | V_NORMAL)) == 0 &&
991 VI_UNLOCK(vp);
992
993 /*
994 * Destroy the copy in the VM cache, too.
995 */
996 if (VOP_GETVOBJECT(vp, &object) == 0) {
997 VM_OBJECT_LOCK(object);
998 vm_object_page_remove(object, 0, 0,
999 (flags & V_SAVE) ? TRUE : FALSE);
1000 VM_OBJECT_UNLOCK(object);
1001 }
1002
1003#ifdef INVARIANTS
1004 VI_LOCK(vp);
1005 if ((flags & (V_ALT | V_NORMAL)) == 0 &&
1004 (!TAILQ_EMPTY(&vp->v_dirtyblkhd) ||
1005 !TAILQ_EMPTY(&vp->v_cleanblkhd)))
1006 (vp->v_bufobj.bo_dirty.bv_cnt > 0 ||
1007 vp->v_bufobj.bo_clean.bv_cnt > 0))
1006 panic("vinvalbuf: flush failed");
1007 VI_UNLOCK(vp);
1008#endif
1009 return (0);
1010}
1011
1012/*
1013 * Flush out buffers on the specified list.

--- 379 unchanged lines hidden (view full) ---

1393 /*
1394 * Delete from old vnode list, if on one.
1395 */
1396 vp = bp->b_vp;
1397 VI_LOCK(vp);
1398 bo = bp->b_bufobj;
1399 if (bp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN))
1400 buf_vlist_remove(bp);
1008 panic("vinvalbuf: flush failed");
1009 VI_UNLOCK(vp);
1010#endif
1011 return (0);
1012}
1013
1014/*
1015 * Flush out buffers on the specified list.

--- 379 unchanged lines hidden (view full) ---

1395 /*
1396 * Delete from old vnode list, if on one.
1397 */
1398 vp = bp->b_vp;
1399 VI_LOCK(vp);
1400 bo = bp->b_bufobj;
1401 if (bp->b_xflags & (BX_VNDIRTY | BX_VNCLEAN))
1402 buf_vlist_remove(bp);
1401 if ((vp->v_iflag & VI_ONWORKLST) && TAILQ_EMPTY(&vp->v_dirtyblkhd)) {
1403 if ((vp->v_iflag & VI_ONWORKLST) && bo->bo_dirty.bv_cnt == 0) {
1402 vp->v_iflag &= ~VI_ONWORKLST;
1403 mtx_lock(&sync_mtx);
1404 LIST_REMOVE(vp, v_synclist);
1405 syncer_worklist_len--;
1406 mtx_unlock(&sync_mtx);
1407 }
1408 vdropl(vp);
1409 bp->b_vp = NULL;

--- 2579 unchanged lines hidden ---
1404 vp->v_iflag &= ~VI_ONWORKLST;
1405 mtx_lock(&sync_mtx);
1406 LIST_REMOVE(vp, v_synclist);
1407 syncer_worklist_len--;
1408 mtx_unlock(&sync_mtx);
1409 }
1410 vdropl(vp);
1411 bp->b_vp = NULL;

--- 2579 unchanged lines hidden ---