summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient/nfs_nfsiod.c
diff options
context:
space:
mode:
authorps <ps@FreeBSD.org>2004-12-15 22:20:22 +0000
committerps <ps@FreeBSD.org>2004-12-15 22:20:22 +0000
commit7c0944d56c2504d71b846fe79d625028c80cdfd8 (patch)
treec7f222f7a8c32bdc81d83fd0f9f6321889902c8b /sys/nfsclient/nfs_nfsiod.c
parentede2fb9751ccd8ce53c764a80e9c92cf19817e80 (diff)
downloadFreeBSD-src-7c0944d56c2504d71b846fe79d625028c80cdfd8.zip
FreeBSD-src-7c0944d56c2504d71b846fe79d625028c80cdfd8.tar.gz
First cut of NFS direct IO support.
- NFS direct IO completely bypasses the buffer and page caches. If a file is open for direct IO all caching is disabled. - Direct IO for Directories will be addressed later. - 2 new NFS directio related sysctls are added. One is a knob to disable NFS direct IO completely (direct IO is enabled by default). The other is to disallow mmaped IO on a file that has at least one O_DIRECT open (see the comment in nfs_vnops.c for more details). The default is to allow mmaps on a file that has O_DIRECT opens. Submitted by: Mohan Srinivasan mohans at yahoo-inc dot com Obtained from: Yahoo!
Diffstat (limited to 'sys/nfsclient/nfs_nfsiod.c')
-rw-r--r--sys/nfsclient/nfs_nfsiod.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/nfsclient/nfs_nfsiod.c b/sys/nfsclient/nfs_nfsiod.c
index d1ca197..8cbee10 100644
--- a/sys/nfsclient/nfs_nfsiod.c
+++ b/sys/nfsclient/nfs_nfsiod.c
@@ -243,10 +243,16 @@ nfssvc_iod(void *instance)
nmp->nm_bufqwant = 0;
wakeup(&nmp->nm_bufq);
}
- if (bp->b_iocmd == BIO_READ)
- (void) nfs_doio(bp->b_vp, bp, bp->b_rcred, NULL);
- else
- (void) nfs_doio(bp->b_vp, bp, bp->b_wcred, NULL);
+ if (bp->b_flags & B_DIRECT) {
+ KASSERT((bp->b_iocmd == BIO_WRITE), ("nfscvs_iod: BIO_WRITE not set"));
+ (void)nfs_doio_directwrite(bp);
+ } else {
+ if (bp->b_iocmd == BIO_READ)
+ (void) nfs_doio(bp->b_vp, bp, bp->b_rcred, NULL);
+ else
+ (void) nfs_doio(bp->b_vp, bp, bp->b_wcred, NULL);
+ }
+
/*
* If there are more than one iod on this mount, then defect
* so that the iods can be shared out fairly between the mounts
OpenPOWER on IntegriCloud