Deleted Added
full compact
vfs_bio.c (165203) vfs_bio.c (165375)
1/*-
2 * Copyright (c) 2004 Poul-Henning Kamp
3 * Copyright (c) 1994,1997 John S. Dyson
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

34 * Author: John S. Dyson
35 * Significant help during the development and debugging phases
36 * had been provided by David Greenman, also of the FreeBSD core team.
37 *
38 * see man buf(9) for more info.
39 */
40
41#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004 Poul-Henning Kamp
3 * Copyright (c) 1994,1997 John S. Dyson
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

34 * Author: John S. Dyson
35 * Significant help during the development and debugging phases
36 * had been provided by David Greenman, also of the FreeBSD core team.
37 *
38 * see man buf(9) for more info.
39 */
40
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: head/sys/kern/vfs_bio.c 165203 2006-12-14 11:34:07Z kib $");
42__FBSDID("$FreeBSD: head/sys/kern/vfs_bio.c 165375 2006-12-20 09:22:31Z kib $");
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/bio.h>
47#include <sys/conf.h>
48#include <sys/buf.h>
49#include <sys/devicestat.h>
50#include <sys/eventhandler.h>

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

811 * now so we set it generally. This could be set either here
812 * or in biodone() since the I/O is synchronous. We put it
813 * here.
814 */
815int
816bufwrite(struct buf *bp)
817{
818 int oldflags;
43
44#include <sys/param.h>
45#include <sys/systm.h>
46#include <sys/bio.h>
47#include <sys/conf.h>
48#include <sys/buf.h>
49#include <sys/devicestat.h>
50#include <sys/eventhandler.h>

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

811 * now so we set it generally. This could be set either here
812 * or in biodone() since the I/O is synchronous. We put it
813 * here.
814 */
815int
816bufwrite(struct buf *bp)
817{
818 int oldflags;
819 struct vnode *vp;
820 int vp_md;
819
820 CTR3(KTR_BUF, "bufwrite(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags);
821 if (bp->b_flags & B_INVAL) {
822 brelse(bp);
823 return (0);
824 }
825
826 oldflags = bp->b_flags;
827
828 if (BUF_REFCNT(bp) == 0)
829 panic("bufwrite: buffer is not busy???");
830
831 if (bp->b_pin_count > 0)
832 bunpin_wait(bp);
833
834 KASSERT(!(bp->b_vflags & BV_BKGRDINPROG),
835 ("FFS background buffer should not get here %p", bp));
836
821
822 CTR3(KTR_BUF, "bufwrite(%p) vp %p flags %X", bp, bp->b_vp, bp->b_flags);
823 if (bp->b_flags & B_INVAL) {
824 brelse(bp);
825 return (0);
826 }
827
828 oldflags = bp->b_flags;
829
830 if (BUF_REFCNT(bp) == 0)
831 panic("bufwrite: buffer is not busy???");
832
833 if (bp->b_pin_count > 0)
834 bunpin_wait(bp);
835
836 KASSERT(!(bp->b_vflags & BV_BKGRDINPROG),
837 ("FFS background buffer should not get here %p", bp));
838
839 vp = bp->b_vp;
840 if (vp)
841 vp_md = vp->v_vflag & VV_MD;
842 else
843 vp_md = 0;
844
837 /* Mark the buffer clean */
838 bundirty(bp);
839
840 bp->b_flags &= ~B_DONE;
841 bp->b_ioflags &= ~BIO_ERROR;
842 bp->b_flags |= B_CACHE;
843 bp->b_iocmd = BIO_WRITE;
844

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

866 /*
867 * don't allow the async write to saturate the I/O
868 * system. We will not deadlock here because
869 * we are blocking waiting for I/O that is already in-progress
870 * to complete. We do not block here if it is the update
871 * or syncer daemon trying to clean up as that can lead
872 * to deadlock.
873 */
845 /* Mark the buffer clean */
846 bundirty(bp);
847
848 bp->b_flags &= ~B_DONE;
849 bp->b_ioflags &= ~BIO_ERROR;
850 bp->b_flags |= B_CACHE;
851 bp->b_iocmd = BIO_WRITE;
852

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

874 /*
875 * don't allow the async write to saturate the I/O
876 * system. We will not deadlock here because
877 * we are blocking waiting for I/O that is already in-progress
878 * to complete. We do not block here if it is the update
879 * or syncer daemon trying to clean up as that can lead
880 * to deadlock.
881 */
874 if ((curthread->td_pflags & TDP_NORUNNINGBUF) == 0 &&
875 (bp->b_vp->v_vflag & VV_MD) == 0)
882 if ((curthread->td_pflags & TDP_NORUNNINGBUF) == 0 && !vp_md)
876 waitrunningbufspace();
877 }
878
879 return (0);
880}
881
882/*
883 * Delayed write. (Buffer is marked dirty). Do not bother writing

--- 3057 unchanged lines hidden ---
883 waitrunningbufspace();
884 }
885
886 return (0);
887}
888
889/*
890 * Delayed write. (Buffer is marked dirty). Do not bother writing

--- 3057 unchanged lines hidden ---