Commit 584aa810 authored by Fred Isaman's avatar Fred Isaman Committed by Trond Myklebust

NFS: rewrite directio read to use async coalesce code

This also has the advantage that it allows directio to use pnfs.
Signed-off-by: default avatarFred Isaman <iisaman@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 1825a0d0
This diff is collapsed.
...@@ -304,8 +304,9 @@ struct nfs_pgio_completion_ops; ...@@ -304,8 +304,9 @@ struct nfs_pgio_completion_ops;
/* read.c */ /* read.c */
extern struct nfs_read_header *nfs_readhdr_alloc(void); extern struct nfs_read_header *nfs_readhdr_alloc(void);
extern void nfs_readhdr_free(struct nfs_pgio_header *hdr); extern void nfs_readhdr_free(struct nfs_pgio_header *hdr);
extern struct nfs_read_data *nfs_readdata_alloc(struct nfs_pgio_header *hdr, extern void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio,
unsigned int pagecount); struct inode *inode,
const struct nfs_pgio_completion_ops *compl_ops);
extern int nfs_initiate_read(struct rpc_clnt *clnt, extern int nfs_initiate_read(struct rpc_clnt *clnt,
struct nfs_read_data *data, struct nfs_read_data *data,
const struct rpc_call_ops *call_ops); const struct rpc_call_ops *call_ops);
......
...@@ -48,8 +48,11 @@ void nfs_pgheader_init(struct nfs_pageio_descriptor *desc, ...@@ -48,8 +48,11 @@ void nfs_pgheader_init(struct nfs_pageio_descriptor *desc,
hdr->cred = hdr->req->wb_context->cred; hdr->cred = hdr->req->wb_context->cred;
hdr->io_start = req_offset(hdr->req); hdr->io_start = req_offset(hdr->req);
hdr->good_bytes = desc->pg_count; hdr->good_bytes = desc->pg_count;
hdr->dreq = desc->pg_dreq;
hdr->release = release; hdr->release = release;
hdr->completion_ops = desc->pg_completion_ops; hdr->completion_ops = desc->pg_completion_ops;
if (hdr->completion_ops->init_hdr)
hdr->completion_ops->init_hdr(hdr);
} }
void nfs_set_pgio_error(struct nfs_pgio_header *hdr, int error, loff_t pos) void nfs_set_pgio_error(struct nfs_pgio_header *hdr, int error, loff_t pos)
...@@ -116,9 +119,6 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode, ...@@ -116,9 +119,6 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode,
req->wb_page = page; req->wb_page = page;
req->wb_index = page->index; req->wb_index = page->index;
page_cache_get(page); page_cache_get(page);
BUG_ON(PagePrivate(page));
BUG_ON(!PageLocked(page));
BUG_ON(page->mapping->host != inode);
req->wb_offset = offset; req->wb_offset = offset;
req->wb_pgbase = offset; req->wb_pgbase = offset;
req->wb_bytes = count; req->wb_bytes = count;
...@@ -257,6 +257,7 @@ void nfs_pageio_init(struct nfs_pageio_descriptor *desc, ...@@ -257,6 +257,7 @@ void nfs_pageio_init(struct nfs_pageio_descriptor *desc,
desc->pg_ioflags = io_flags; desc->pg_ioflags = io_flags;
desc->pg_error = 0; desc->pg_error = 0;
desc->pg_lseg = NULL; desc->pg_lseg = NULL;
desc->pg_dreq = NULL;
} }
/** /**
......
...@@ -51,8 +51,8 @@ struct nfs_read_header *nfs_readhdr_alloc() ...@@ -51,8 +51,8 @@ struct nfs_read_header *nfs_readhdr_alloc()
return rhdr; return rhdr;
} }
struct nfs_read_data *nfs_readdata_alloc(struct nfs_pgio_header *hdr, static struct nfs_read_data *nfs_readdata_alloc(struct nfs_pgio_header *hdr,
unsigned int pagecount) unsigned int pagecount)
{ {
struct nfs_read_data *data, *prealloc; struct nfs_read_data *data, *prealloc;
...@@ -123,9 +123,9 @@ void nfs_pageio_reset_read_mds(struct nfs_pageio_descriptor *pgio) ...@@ -123,9 +123,9 @@ void nfs_pageio_reset_read_mds(struct nfs_pageio_descriptor *pgio)
} }
EXPORT_SYMBOL_GPL(nfs_pageio_reset_read_mds); EXPORT_SYMBOL_GPL(nfs_pageio_reset_read_mds);
static void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, void nfs_pageio_init_read(struct nfs_pageio_descriptor *pgio,
struct inode *inode, struct inode *inode,
const struct nfs_pgio_completion_ops *compl_ops) const struct nfs_pgio_completion_ops *compl_ops)
{ {
if (!pnfs_pageio_init_read(pgio, inode, compl_ops)) if (!pnfs_pageio_init_read(pgio, inode, compl_ops))
nfs_pageio_init_read_mds(pgio, inode, compl_ops); nfs_pageio_init_read_mds(pgio, inode, compl_ops);
......
...@@ -68,6 +68,7 @@ struct nfs_pageio_descriptor { ...@@ -68,6 +68,7 @@ struct nfs_pageio_descriptor {
const struct rpc_call_ops *pg_rpc_callops; const struct rpc_call_ops *pg_rpc_callops;
const struct nfs_pgio_completion_ops *pg_completion_ops; const struct nfs_pgio_completion_ops *pg_completion_ops;
struct pnfs_layout_segment *pg_lseg; struct pnfs_layout_segment *pg_lseg;
struct nfs_direct_req *pg_dreq;
}; };
#define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags)) #define NFS_WBACK_BUSY(req) (test_bit(PG_BUSY,&(req)->wb_flags))
......
...@@ -1208,6 +1208,7 @@ struct nfs_pgio_header { ...@@ -1208,6 +1208,7 @@ struct nfs_pgio_header {
const struct rpc_call_ops *mds_ops; const struct rpc_call_ops *mds_ops;
void (*release) (struct nfs_pgio_header *hdr); void (*release) (struct nfs_pgio_header *hdr);
const struct nfs_pgio_completion_ops *completion_ops; const struct nfs_pgio_completion_ops *completion_ops;
struct nfs_direct_req *dreq;
spinlock_t lock; spinlock_t lock;
/* fields protected by lock */ /* fields protected by lock */
int pnfs_error; int pnfs_error;
...@@ -1221,8 +1222,6 @@ struct nfs_read_header { ...@@ -1221,8 +1222,6 @@ struct nfs_read_header {
struct nfs_read_data rpc_data; struct nfs_read_data rpc_data;
}; };
struct nfs_direct_req;
struct nfs_write_data { struct nfs_write_data {
struct nfs_pgio_header *header; struct nfs_pgio_header *header;
struct list_head list; struct list_head list;
...@@ -1264,6 +1263,7 @@ struct nfs_commit_data { ...@@ -1264,6 +1263,7 @@ struct nfs_commit_data {
struct nfs_pgio_completion_ops { struct nfs_pgio_completion_ops {
void (*error_cleanup)(struct list_head *head); void (*error_cleanup)(struct list_head *head);
void (*init_hdr)(struct nfs_pgio_header *hdr);
void (*completion)(struct nfs_pgio_header *hdr); void (*completion)(struct nfs_pgio_header *hdr);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment