On Mon, 2012-04-09 at 16:52 -0400, Fred Isaman wrote: > This also has the advantage that it allows directio to use pnfs. > > Signed-off-by: Fred Isaman <iisaman@xxxxxxxxxx> > --- > fs/nfs/direct.c | 247 +++++++++++++++++++++------------------------ > fs/nfs/internal.h | 3 + > fs/nfs/pagelist.c | 6 +- > fs/nfs/read.c | 6 +- > include/linux/nfs_page.h | 1 + > include/linux/nfs_xdr.h | 4 +- > 6 files changed, 128 insertions(+), 139 deletions(-) > > diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c > index 22a40c4..409a9a0 100644 > --- a/fs/nfs/direct.c > +++ b/fs/nfs/direct.c > @@ -124,22 +124,6 @@ ssize_t nfs_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, loff_ > return -EINVAL; > } > > -static void nfs_direct_dirty_pages(struct page **pages, unsigned int pgbase, size_t count) > -{ > - unsigned int npages; > - unsigned int i; > - > - if (count == 0) > - return; > - pages += (pgbase >> PAGE_SHIFT); > - npages = (count + (pgbase & ~PAGE_MASK) + PAGE_SIZE - 1) >> PAGE_SHIFT; > - for (i = 0; i < npages; i++) { > - struct page *page = pages[i]; > - if (!PageCompound(page)) > - set_page_dirty(page); > - } > -} > - > static void nfs_direct_release_pages(struct page **pages, unsigned int npages) > { > unsigned int i; > @@ -226,58 +210,85 @@ static void nfs_direct_complete(struct nfs_direct_req *dreq) > nfs_direct_req_release(dreq); > } > > -/* > - * We must hold a reference to all the pages in this direct read request > - * until the RPCs complete. This could be long *after* we are woken up in > - * nfs_direct_wait (for instance, if someone hits ^C on a slow server). > - */ > -static void nfs_direct_read_result(struct rpc_task *task, void *calldata) > +void nfs_direct_readpage_release(struct nfs_page *req) > { > - struct nfs_read_data *data = calldata; > - > - nfs_readpage_result(task, data); > + dprintk("NFS: direct read done (%s/%lld %d@%lld)\n", > + req->wb_context->dentry->d_inode->i_sb->s_id, > + (long long)NFS_FILEID(req->wb_context->dentry->d_inode), > + req->wb_bytes, > + (long long)req_offset(req)); > + nfs_release_request(req); > } > > -static void nfs_direct_read_release(void *calldata) > +static void nfs_direct_read_completion(struct nfs_pgio_header *hdr) > { > + unsigned long pos = req_offset(hdr->req); Umm... req_offset() returns an loff_t. 'unsigned long' is likely to be too small to hold these values on a 32-bit machine. Looking back, it looks as if the same problem exists in the page cache code (e.g. nfs_read_completion) as well as stuff like hdr->eof, and hdr->first_error. -- Trond Myklebust Linux NFS client maintainer NetApp Trond.Myklebust@xxxxxxxxxx www.netapp.com ��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥