aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/Kconfig24
-rw-r--r--fs/nfs/Makefile3
-rw-r--r--fs/nfs/file.c6
-rw-r--r--fs/nfs/internal.h5
4 files changed, 1 insertions, 37 deletions
diff --git a/fs/Kconfig b/fs/Kconfig
index d7312825592b..55c1a0374e13 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -1637,30 +1637,6 @@ config NFS_V4
1637 1637
1638 If unsure, say N. 1638 If unsure, say N.
1639 1639
1640config NFS_DIRECTIO
1641 bool "Allow direct I/O on NFS files"
1642 depends on NFS_FS
1643 help
1644 This option enables applications to perform uncached I/O on files
1645 in NFS file systems using the O_DIRECT open() flag. When O_DIRECT
1646 is set for a file, its data is not cached in the system's page
1647 cache. Data is moved to and from user-level application buffers
1648 directly. Unlike local disk-based file systems, NFS O_DIRECT has
1649 no alignment restrictions.
1650
1651 Unless your program is designed to use O_DIRECT properly, you are
1652 much better off allowing the NFS client to manage data caching for
1653 you. Misusing O_DIRECT can cause poor server performance or network
1654 storms. This kernel build option defaults OFF to avoid exposing
1655 system administrators unwittingly to a potentially hazardous
1656 feature.
1657
1658 For more details on NFS O_DIRECT, see fs/nfs/direct.c.
1659
1660 If unsure, say N. This reduces the size of the NFS client, and
1661 causes open() to return EINVAL if a file residing in NFS is
1662 opened with the O_DIRECT flag.
1663
1664config NFSD 1640config NFSD
1665 tristate "NFS server support" 1641 tristate "NFS server support"
1666 depends on INET 1642 depends on INET
diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile
index df0f41e09885..ac6170c594a3 100644
--- a/fs/nfs/Makefile
+++ b/fs/nfs/Makefile
@@ -5,7 +5,7 @@
5obj-$(CONFIG_NFS_FS) += nfs.o 5obj-$(CONFIG_NFS_FS) += nfs.o
6 6
7nfs-y := client.o dir.o file.o getroot.o inode.o super.o nfs2xdr.o \ 7nfs-y := client.o dir.o file.o getroot.o inode.o super.o nfs2xdr.o \
8 pagelist.o proc.o read.o symlink.o unlink.o \ 8 direct.o pagelist.o proc.o read.o symlink.o unlink.o \
9 write.o namespace.o mount_clnt.o 9 write.o namespace.o mount_clnt.o
10nfs-$(CONFIG_ROOT_NFS) += nfsroot.o 10nfs-$(CONFIG_ROOT_NFS) += nfsroot.o
11nfs-$(CONFIG_NFS_V3) += nfs3proc.o nfs3xdr.o 11nfs-$(CONFIG_NFS_V3) += nfs3proc.o nfs3xdr.o
@@ -14,5 +14,4 @@ nfs-$(CONFIG_NFS_V4) += nfs4proc.o nfs4xdr.o nfs4state.o nfs4renewd.o \
14 delegation.o idmap.o \ 14 delegation.o idmap.o \
15 callback.o callback_xdr.o callback_proc.o \ 15 callback.o callback_xdr.o callback_proc.o \
16 nfs4namespace.o 16 nfs4namespace.o
17nfs-$(CONFIG_NFS_DIRECTIO) += direct.o
18nfs-$(CONFIG_SYSCTL) += sysctl.o 17nfs-$(CONFIG_SYSCTL) += sysctl.o
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index ef57a5ae5904..10e8b807e7ff 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -234,10 +234,8 @@ nfs_file_read(struct kiocb *iocb, const struct iovec *iov,
234 ssize_t result; 234 ssize_t result;
235 size_t count = iov_length(iov, nr_segs); 235 size_t count = iov_length(iov, nr_segs);
236 236
237#ifdef CONFIG_NFS_DIRECTIO
238 if (iocb->ki_filp->f_flags & O_DIRECT) 237 if (iocb->ki_filp->f_flags & O_DIRECT)
239 return nfs_file_direct_read(iocb, iov, nr_segs, pos); 238 return nfs_file_direct_read(iocb, iov, nr_segs, pos);
240#endif
241 239
242 dfprintk(VFS, "nfs: read(%s/%s, %lu@%lu)\n", 240 dfprintk(VFS, "nfs: read(%s/%s, %lu@%lu)\n",
243 dentry->d_parent->d_name.name, dentry->d_name.name, 241 dentry->d_parent->d_name.name, dentry->d_name.name,
@@ -383,9 +381,7 @@ const struct address_space_operations nfs_file_aops = {
383 .write_end = nfs_write_end, 381 .write_end = nfs_write_end,
384 .invalidatepage = nfs_invalidate_page, 382 .invalidatepage = nfs_invalidate_page,
385 .releasepage = nfs_release_page, 383 .releasepage = nfs_release_page,
386#ifdef CONFIG_NFS_DIRECTIO
387 .direct_IO = nfs_direct_IO, 384 .direct_IO = nfs_direct_IO,
388#endif
389 .launder_page = nfs_launder_page, 385 .launder_page = nfs_launder_page,
390}; 386};
391 387
@@ -443,10 +439,8 @@ static ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,
443 ssize_t result; 439 ssize_t result;
444 size_t count = iov_length(iov, nr_segs); 440 size_t count = iov_length(iov, nr_segs);
445 441
446#ifdef CONFIG_NFS_DIRECTIO
447 if (iocb->ki_filp->f_flags & O_DIRECT) 442 if (iocb->ki_filp->f_flags & O_DIRECT)
448 return nfs_file_direct_write(iocb, iov, nr_segs, pos); 443 return nfs_file_direct_write(iocb, iov, nr_segs, pos);
449#endif
450 444
451 dfprintk(VFS, "nfs: write(%s/%s(%ld), %lu@%Ld)\n", 445 dfprintk(VFS, "nfs: write(%s/%s(%ld), %lu@%Ld)\n",
452 dentry->d_parent->d_name.name, dentry->d_name.name, 446 dentry->d_parent->d_name.name, dentry->d_name.name,
diff --git a/fs/nfs/internal.h b/fs/nfs/internal.h
index 999ad8ee0645..04ae867dddba 100644
--- a/fs/nfs/internal.h
+++ b/fs/nfs/internal.h
@@ -116,13 +116,8 @@ extern void nfs_destroy_readpagecache(void);
116extern int __init nfs_init_writepagecache(void); 116extern int __init nfs_init_writepagecache(void);
117extern void nfs_destroy_writepagecache(void); 117extern void nfs_destroy_writepagecache(void);
118 118
119#ifdef CONFIG_NFS_DIRECTIO
120extern int __init nfs_init_directcache(void); 119extern int __init nfs_init_directcache(void);
121extern void nfs_destroy_directcache(void); 120extern void nfs_destroy_directcache(void);
122#else
123#define nfs_init_directcache() (0)
124#define nfs_destroy_directcache() do {} while(0)
125#endif
126 121
127/* nfs2xdr.c */ 122/* nfs2xdr.c */
128extern int nfs_stat_to_errno(int); 123extern int nfs_stat_to_errno(int);