nfs_clbio.c (222586) | nfs_clbio.c (223280) |
---|---|
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 --- 19 unchanged lines hidden (view full) --- 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * @(#)nfs_bio.c 8.9 (Berkeley) 3/30/95 33 */ 34 35#include <sys/cdefs.h> | 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 --- 19 unchanged lines hidden (view full) --- 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 * 32 * @(#)nfs_bio.c 8.9 (Berkeley) 3/30/95 33 */ 34 35#include <sys/cdefs.h> |
36__FBSDID("$FreeBSD: head/sys/fs/nfsclient/nfs_clbio.c 222586 2011-06-01 21:00:28Z kib $"); | 36__FBSDID("$FreeBSD: head/sys/fs/nfsclient/nfs_clbio.c 223280 2011-06-18 23:02:53Z rmacklem $"); |
37 | 37 |
38#include "opt_kdtrace.h" 39 |
|
38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/bio.h> 41#include <sys/buf.h> 42#include <sys/kernel.h> 43#include <sys/mount.h> 44#include <sys/vmmeter.h> 45#include <sys/vnode.h> --- 4 unchanged lines hidden (view full) --- 50#include <vm/vm_object.h> 51#include <vm/vm_pager.h> 52#include <vm/vnode_pager.h> 53 54#include <fs/nfs/nfsport.h> 55#include <fs/nfsclient/nfsmount.h> 56#include <fs/nfsclient/nfs.h> 57#include <fs/nfsclient/nfsnode.h> | 40#include <sys/param.h> 41#include <sys/systm.h> 42#include <sys/bio.h> 43#include <sys/buf.h> 44#include <sys/kernel.h> 45#include <sys/mount.h> 46#include <sys/vmmeter.h> 47#include <sys/vnode.h> --- 4 unchanged lines hidden (view full) --- 52#include <vm/vm_object.h> 53#include <vm/vm_pager.h> 54#include <vm/vnode_pager.h> 55 56#include <fs/nfs/nfsport.h> 57#include <fs/nfsclient/nfsmount.h> 58#include <fs/nfsclient/nfs.h> 59#include <fs/nfsclient/nfsnode.h> |
60#include <fs/nfsclient/nfs_kdtrace.h> |
|
58 59extern int newnfs_directio_allow_mmap; 60extern struct nfsstats newnfsstats; 61extern struct mtx ncl_iod_mutex; 62extern int ncl_numasync; 63extern enum nfsiod_state ncl_iodwant[NFS_MAXASYNCDAEMON]; 64extern struct nfsmount *ncl_iodmount[NFS_MAXASYNCDAEMON]; 65extern int newnfs_directio_enable; --- 328 unchanged lines hidden (view full) --- 394 if (vp->v_type != VDIR) 395 panic("nfs: bioread, not dir"); 396 ncl_invaldir(vp); 397 error = ncl_vinvalbuf(vp, V_SAVE, td, 1); 398 if (error) 399 goto out; 400 } 401 np->n_attrstamp = 0; | 61 62extern int newnfs_directio_allow_mmap; 63extern struct nfsstats newnfsstats; 64extern struct mtx ncl_iod_mutex; 65extern int ncl_numasync; 66extern enum nfsiod_state ncl_iodwant[NFS_MAXASYNCDAEMON]; 67extern struct nfsmount *ncl_iodmount[NFS_MAXASYNCDAEMON]; 68extern int newnfs_directio_enable; --- 328 unchanged lines hidden (view full) --- 397 if (vp->v_type != VDIR) 398 panic("nfs: bioread, not dir"); 399 ncl_invaldir(vp); 400 error = ncl_vinvalbuf(vp, V_SAVE, td, 1); 401 if (error) 402 goto out; 403 } 404 np->n_attrstamp = 0; |
405 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); |
|
402 error = VOP_GETATTR(vp, &vattr, cred); 403 if (error) 404 goto out; 405 mtx_lock(&np->n_mtx); 406 np->n_mtime = vattr.va_mtime; 407 mtx_unlock(&np->n_mtx); 408 } else { 409 mtx_unlock(&np->n_mtx); --- 500 unchanged lines hidden (view full) --- 910 * dirty files to inform the program it needs 911 * to fsync(2) explicitly. 912 */ 913 if (ioflag & IO_NDELAY) 914 return (EAGAIN); 915#endif 916flush_and_restart: 917 np->n_attrstamp = 0; | 406 error = VOP_GETATTR(vp, &vattr, cred); 407 if (error) 408 goto out; 409 mtx_lock(&np->n_mtx); 410 np->n_mtime = vattr.va_mtime; 411 mtx_unlock(&np->n_mtx); 412 } else { 413 mtx_unlock(&np->n_mtx); --- 500 unchanged lines hidden (view full) --- 914 * dirty files to inform the program it needs 915 * to fsync(2) explicitly. 916 */ 917 if (ioflag & IO_NDELAY) 918 return (EAGAIN); 919#endif 920flush_and_restart: 921 np->n_attrstamp = 0; |
922 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); |
|
918 error = ncl_vinvalbuf(vp, V_SAVE, td, 1); 919 if (error) 920 return (error); 921 } else 922 mtx_unlock(&np->n_mtx); 923 } 924 925 /* 926 * If IO_APPEND then load uio_offset. We restart here if we cannot 927 * get the append lock. 928 */ 929 if (ioflag & IO_APPEND) { 930 np->n_attrstamp = 0; | 923 error = ncl_vinvalbuf(vp, V_SAVE, td, 1); 924 if (error) 925 return (error); 926 } else 927 mtx_unlock(&np->n_mtx); 928 } 929 930 /* 931 * If IO_APPEND then load uio_offset. We restart here if we cannot 932 * get the append lock. 933 */ 934 if (ioflag & IO_APPEND) { 935 np->n_attrstamp = 0; |
936 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); |
|
931 error = VOP_GETATTR(vp, &vattr, cred); 932 if (error) 933 return (error); 934 mtx_lock(&np->n_mtx); 935 uio->uio_offset = np->n_size; 936 mtx_unlock(&np->n_mtx); 937 } 938 --- 804 unchanged lines hidden (view full) --- 1743 } else { 1744 if (error) { 1745 bp->b_ioflags |= BIO_ERROR; 1746 bp->b_flags |= B_INVAL; 1747 bp->b_error = np->n_error = error; 1748 mtx_lock(&np->n_mtx); 1749 np->n_flag |= NWRITEERR; 1750 np->n_attrstamp = 0; | 937 error = VOP_GETATTR(vp, &vattr, cred); 938 if (error) 939 return (error); 940 mtx_lock(&np->n_mtx); 941 uio->uio_offset = np->n_size; 942 mtx_unlock(&np->n_mtx); 943 } 944 --- 804 unchanged lines hidden (view full) --- 1749 } else { 1750 if (error) { 1751 bp->b_ioflags |= BIO_ERROR; 1752 bp->b_flags |= B_INVAL; 1753 bp->b_error = np->n_error = error; 1754 mtx_lock(&np->n_mtx); 1755 np->n_flag |= NWRITEERR; 1756 np->n_attrstamp = 0; |
1757 KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); |
|
1751 mtx_unlock(&np->n_mtx); 1752 } 1753 bp->b_dirtyoff = bp->b_dirtyend = 0; 1754 } 1755 } else { 1756 bp->b_resid = 0; 1757 bufdone(bp); 1758 return (0); --- 58 unchanged lines hidden --- | 1758 mtx_unlock(&np->n_mtx); 1759 } 1760 bp->b_dirtyoff = bp->b_dirtyend = 0; 1761 } 1762 } else { 1763 bp->b_resid = 0; 1764 bufdone(bp); 1765 return (0); --- 58 unchanged lines hidden --- |