nfs_vnops.c (46568) | nfs_vnops.c (46580) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 20 unchanged lines hidden (view full) --- 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 |
37 * $Id: nfs_vnops.c,v 1.126 1999/05/03 20:59:14 alc Exp $ | 37 * $Id: nfs_vnops.c,v 1.127 1999/05/06 18:13:05 peter Exp $ |
38 */ 39 40 41/* 42 * vnode op calls for Sun NFS version 2 and 3 43 */ 44 45#include "opt_inet.h" --- 2617 unchanged lines hidden (view full) --- 2663 cr = bp->b_wcred; 2664 2665 /* 2666 * If the op is asynchronous and an i/o daemon is waiting 2667 * queue the request, wake it up and wait for completion 2668 * otherwise just do it ourselves. 2669 */ 2670 if ((bp->b_flags & B_ASYNC) == 0 || | 38 */ 39 40 41/* 42 * vnode op calls for Sun NFS version 2 and 3 43 */ 44 45#include "opt_inet.h" --- 2617 unchanged lines hidden (view full) --- 2663 cr = bp->b_wcred; 2664 2665 /* 2666 * If the op is asynchronous and an i/o daemon is waiting 2667 * queue the request, wake it up and wait for completion 2668 * otherwise just do it ourselves. 2669 */ 2670 if ((bp->b_flags & B_ASYNC) == 0 || |
2671 nfs_asyncio(bp, NOCRED)) | 2671 nfs_asyncio(bp, NOCRED, p)) |
2672 error = nfs_doio(bp, cr, p); 2673 return (error); 2674} 2675 2676/* 2677 * Mmap a file 2678 * 2679 * NB Currently unsupported. --- 341 unchanged lines hidden (view full) --- 3021 * NOTE: B_DONE may or may not be set in a_bp on call. 3022 */ 3023static int 3024nfs_bwrite(ap) 3025 struct vop_bwrite_args /* { 3026 struct vnode *a_bp; 3027 } */ *ap; 3028{ | 2672 error = nfs_doio(bp, cr, p); 2673 return (error); 2674} 2675 2676/* 2677 * Mmap a file 2678 * 2679 * NB Currently unsupported. --- 341 unchanged lines hidden (view full) --- 3021 * NOTE: B_DONE may or may not be set in a_bp on call. 3022 */ 3023static int 3024nfs_bwrite(ap) 3025 struct vop_bwrite_args /* { 3026 struct vnode *a_bp; 3027 } */ *ap; 3028{ |
3029 return (nfs_writebp(ap->a_bp, 1)); | 3029 return (nfs_writebp(ap->a_bp, 1, curproc)); |
3030} 3031 3032/* 3033 * This is a clone of vn_bwrite(), except that B_WRITEINPROG isn't set unless 3034 * the force flag is one and it also handles the B_NEEDCOMMIT flag. We set 3035 * B_CACHE if this is a VMIO buffer. 3036 */ 3037int | 3030} 3031 3032/* 3033 * This is a clone of vn_bwrite(), except that B_WRITEINPROG isn't set unless 3034 * the force flag is one and it also handles the B_NEEDCOMMIT flag. We set 3035 * B_CACHE if this is a VMIO buffer. 3036 */ 3037int |
3038nfs_writebp(bp, force) | 3038nfs_writebp(bp, force, procp) |
3039 register struct buf *bp; 3040 int force; | 3039 register struct buf *bp; 3040 int force; |
3041 struct proc *procp; |
|
3041{ 3042 int s; 3043 int oldflags = bp->b_flags; 3044 int retv = 1; 3045 off_t off; 3046 3047 if(!(bp->b_flags & B_BUSY)) 3048 panic("bwrite: buffer is not busy???"); --- 22 unchanged lines hidden (view full) --- 3071 * an actual write will have to be scheduled via. VOP_STRATEGY(). 3072 * If B_WRITEINPROG is already set, then push it with a write anyhow. 3073 */ 3074 vfs_busy_pages(bp, 1); 3075 if ((oldflags & (B_NEEDCOMMIT | B_WRITEINPROG)) == B_NEEDCOMMIT) { 3076 off = ((u_quad_t)bp->b_blkno) * DEV_BSIZE + bp->b_dirtyoff; 3077 bp->b_flags |= B_WRITEINPROG; 3078 retv = nfs_commit(bp->b_vp, off, bp->b_dirtyend-bp->b_dirtyoff, | 3042{ 3043 int s; 3044 int oldflags = bp->b_flags; 3045 int retv = 1; 3046 off_t off; 3047 3048 if(!(bp->b_flags & B_BUSY)) 3049 panic("bwrite: buffer is not busy???"); --- 22 unchanged lines hidden (view full) --- 3072 * an actual write will have to be scheduled via. VOP_STRATEGY(). 3073 * If B_WRITEINPROG is already set, then push it with a write anyhow. 3074 */ 3075 vfs_busy_pages(bp, 1); 3076 if ((oldflags & (B_NEEDCOMMIT | B_WRITEINPROG)) == B_NEEDCOMMIT) { 3077 off = ((u_quad_t)bp->b_blkno) * DEV_BSIZE + bp->b_dirtyoff; 3078 bp->b_flags |= B_WRITEINPROG; 3079 retv = nfs_commit(bp->b_vp, off, bp->b_dirtyend-bp->b_dirtyoff, |
3079 bp->b_wcred, bp->b_proc); | 3080 bp->b_wcred, procp); |
3080 bp->b_flags &= ~B_WRITEINPROG; 3081 if (!retv) { 3082 bp->b_dirtyoff = bp->b_dirtyend = 0; 3083 bp->b_flags &= ~B_NEEDCOMMIT; 3084 biodone(bp); 3085 } else if (retv == NFSERR_STALEWRITEVERF) { 3086 nfs_clearcommit(bp->b_vp->v_mount); 3087 } --- 249 unchanged lines hidden --- | 3081 bp->b_flags &= ~B_WRITEINPROG; 3082 if (!retv) { 3083 bp->b_dirtyoff = bp->b_dirtyend = 0; 3084 bp->b_flags &= ~B_NEEDCOMMIT; 3085 biodone(bp); 3086 } else if (retv == NFSERR_STALEWRITEVERF) { 3087 nfs_clearcommit(bp->b_vp->v_mount); 3088 } --- 249 unchanged lines hidden --- |