diff options
author | Chuck Lever <cel@netapp.com> | 2006-03-20 13:44:30 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-20 13:44:30 -0500 |
commit | 99514f8fdda2beef1ca922b7f9d89c1a2c57fec0 (patch) | |
tree | 74a96ad19ed705775d9cd87b79c28aafe0286dee /fs/nfs | |
parent | 0cdd80d07fb0f558dfdb30f6e0b9905f5e5475f1 (diff) | |
download | op-kernel-dev-99514f8fdda2beef1ca922b7f9d89c1a2c57fec0.zip op-kernel-dev-99514f8fdda2beef1ca922b7f9d89c1a2c57fec0.tar.gz |
NFS: make iocb available everywhere in direct read path
Pass the iocb argument all the way down to the direct read request
scheduler, and make it available in nfs_direct_read_result.
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')
-rw-r--r-- | fs/nfs/direct.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 6ecde96..6cbddc5 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c @@ -68,6 +68,8 @@ static kmem_cache_t *nfs_direct_cachep; struct nfs_direct_req { struct kref kref; /* release manager */ struct list_head list; /* nfs_read_data structs */ + struct file * filp; /* file descriptor */ + struct kiocb * iocb; /* controlling i/o request */ wait_queue_head_t wait; /* wait for i/o completion */ struct inode * inode; /* target file of I/O */ struct page ** pages; /* pages in our buffer */ @@ -240,8 +242,12 @@ static const struct rpc_call_ops nfs_read_direct_ops = { * For each nfs_read_data struct that was allocated on the list, dispatch * an NFS READ operation */ -static void nfs_direct_read_schedule(struct nfs_direct_req *dreq, struct inode *inode, struct nfs_open_context *ctx, unsigned long user_addr, size_t count, loff_t file_offset) +static void nfs_direct_read_schedule(struct nfs_direct_req *dreq, unsigned long user_addr, size_t count, loff_t file_offset) { + struct file *file = dreq->filp; + struct inode *inode = file->f_mapping->host; + struct nfs_open_context *ctx = (struct nfs_open_context *) + file->private_data; struct list_head *list = &dreq->list; struct page **pages = dreq->pages; size_t rsize = NFS_SERVER(inode)->rsize; @@ -321,10 +327,11 @@ static ssize_t nfs_direct_read_wait(struct nfs_direct_req *dreq, int intr) return (ssize_t) result; } -static ssize_t nfs_direct_read(struct inode *inode, struct nfs_open_context *ctx, unsigned long user_addr, size_t count, loff_t file_offset, struct page **pages, unsigned int nr_pages) +static ssize_t nfs_direct_read(struct kiocb *iocb, unsigned long user_addr, size_t count, loff_t file_offset, struct page **pages, unsigned int nr_pages) { ssize_t result; sigset_t oldset; + struct inode *inode = iocb->ki_filp->f_mapping->host; struct rpc_clnt *clnt = NFS_CLIENT(inode); struct nfs_direct_req *dreq; @@ -335,11 +342,11 @@ static ssize_t nfs_direct_read(struct inode *inode, struct nfs_open_context *ctx dreq->pages = pages; dreq->npages = nr_pages; dreq->inode = inode; + dreq->filp = iocb->ki_filp; nfs_add_stats(inode, NFSIOS_DIRECTREADBYTES, count); rpc_clnt_sigmask(clnt, &oldset); - nfs_direct_read_schedule(dreq, inode, ctx, user_addr, count, - file_offset); + nfs_direct_read_schedule(dreq, user_addr, count, file_offset); result = nfs_direct_read_wait(dreq, clnt->cl_intr); rpc_clnt_sigunmask(clnt, &oldset); @@ -520,10 +527,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, char __user *buf, size_t count, int page_count; struct page **pages; struct file *file = iocb->ki_filp; - struct nfs_open_context *ctx = - (struct nfs_open_context *) file->private_data; struct address_space *mapping = file->f_mapping; - struct inode *inode = mapping->host; dprintk("nfs: direct read(%s/%s, %lu@%Ld)\n", file->f_dentry->d_parent->d_name.name, @@ -553,7 +557,7 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, char __user *buf, size_t count, goto out; } - retval = nfs_direct_read(inode, ctx, (unsigned long) buf, count, pos, + retval = nfs_direct_read(iocb, (unsigned long) buf, count, pos, pages, page_count); if (retval > 0) iocb->ki_pos = pos + retval; |