aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/direct.c
diff options
context:
space:
mode:
authorChuck Lever <cel@netapp.com>2006-03-20 13:44:28 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2006-03-20 13:44:28 -0500
commitb8a32e2b8b7fefff994c89d398b6ac920a195b43 (patch)
tree20f0c2610eddb104a8cbf1d7981b34fc962a92ea /fs/nfs/direct.c
parentec06c096edec0755534c7126f4caded69de131c2 (diff)
NFS: clean up NFS client's a_ops->direct_IO method
The NFS client's a_ops->direct_IO method, nfs_direct_IO, is required to be present to allow NFS files to be opened with O_DIRECT, but is never called because the NFS client shunts reads and writes to files opened with O_DIRECT directly to its own routines. Gut the nfs_direct_IO function. This eliminates the only part of the NFS client's direct I/O path that requires support for multi-segment iovs, allowing further simplification in subsequent patches. Test plan: Compile the kernel with CONFIG_NFS and CONFIG_NFS_DIRECTIO enabled. Millions of fsx-odirect ops. OraSim. Signed-off-by: Chuck Lever <cel@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/direct.c')
-rw-r--r--fs/nfs/direct.c70
1 files changed, 23 insertions, 47 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 3f87a72bd137..8096d326bd79 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -79,6 +79,29 @@ struct nfs_direct_req {
79 79
80 80
81/** 81/**
82 * nfs_direct_IO - NFS address space operation for direct I/O
83 * @rw: direction (read or write)
84 * @iocb: target I/O control block
85 * @iov: array of vectors that define I/O buffer
86 * @pos: offset in file to begin the operation
87 * @nr_segs: size of iovec array
88 *
89 * The presence of this routine in the address space ops vector means
90 * the NFS client supports direct I/O. However, we shunt off direct
91 * read and write requests before the VFS gets them, so this method
92 * should never be called.
93 */
94ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_t pos, unsigned long nr_segs)
95{
96 struct dentry *dentry = iocb->ki_filp->f_dentry;
97
98 dprintk("NFS: nfs_direct_IO (%s) off/no(%Ld/%lu) EINVAL\n",
99 dentry->d_name.name, (long long) pos, nr_segs);
100
101 return -EINVAL;
102}
103
104/**
82 * nfs_get_user_pages - find and set up pages underlying user's buffer 105 * nfs_get_user_pages - find and set up pages underlying user's buffer
83 * rw: direction (read or write) 106 * rw: direction (read or write)
84 * user_addr: starting address of this segment of user's buffer 107 * user_addr: starting address of this segment of user's buffer
@@ -606,53 +629,6 @@ static ssize_t nfs_direct_write(struct inode *inode,
606} 629}
607 630
608/** 631/**
609 * nfs_direct_IO - NFS address space operation for direct I/O
610 * rw: direction (read or write)
611 * @iocb: target I/O control block
612 * @iov: array of vectors that define I/O buffer
613 * file_offset: offset in file to begin the operation
614 * nr_segs: size of iovec array
615 *
616 */
617ssize_t
618nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
619 loff_t file_offset, unsigned long nr_segs)
620{
621 ssize_t result = -EINVAL;
622 struct file *file = iocb->ki_filp;
623 struct nfs_open_context *ctx;
624 struct dentry *dentry = file->f_dentry;
625 struct inode *inode = dentry->d_inode;
626
627 /*
628 * No support for async yet
629 */
630 if (!is_sync_kiocb(iocb))
631 return result;
632
633 ctx = (struct nfs_open_context *)file->private_data;
634 switch (rw) {
635 case READ:
636 dprintk("NFS: direct_IO(read) (%s) off/no(%Lu/%lu)\n",
637 dentry->d_name.name, file_offset, nr_segs);
638
639 result = nfs_direct_read(inode, ctx, iov,
640 file_offset, nr_segs);
641 break;
642 case WRITE:
643 dprintk("NFS: direct_IO(write) (%s) off/no(%Lu/%lu)\n",
644 dentry->d_name.name, file_offset, nr_segs);
645
646 result = nfs_direct_write(inode, ctx, iov,
647 file_offset, nr_segs);
648 break;
649 default:
650 break;
651 }
652 return result;
653}
654
655/**
656 * nfs_file_direct_read - file direct read operation for NFS files 632 * nfs_file_direct_read - file direct read operation for NFS files
657 * @iocb: target I/O control block 633 * @iocb: target I/O control block
658 * @buf: user's buffer into which to read data 634 * @buf: user's buffer into which to read data