[pnfs] [PATCH 22/28] pnfs: pnfs_modify_new_request
Fred Isaman
iisaman at citi.umich.edu
Tue Mar 11 15:32:03 EDT 2008
Add hook into nfs_page initialization to allow for setup of wb_private,
and any other nfs_page fields that need twiddling.
Signed-off-by: Fred Isaman <iisaman at citi.umich.edu>
---
fs/nfs/pagelist.c | 3 +++
fs/nfs/pnfs.c | 20 ++++++++++++++++++++
fs/nfs/pnfs.h | 2 ++
include/linux/nfs4_pnfs.h | 4 ++++
4 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index 624083e..c49b59b 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -90,6 +90,9 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode,
req->wb_bytes = count;
req->wb_context = get_nfs_open_context(ctx);
kref_init(&req->wb_kref);
+#ifdef CONFIG_PNFS
+ pnfs_modify_new_request(inode, req, fsdata);
+#endif /* CONFIG_PNFS */
return req;
}
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index a4db86e..4c4927f 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1928,6 +1928,26 @@ out_unlock:
goto out;
}
+void pnfs_modify_new_request(struct inode *inode, struct nfs_page *req,
+ void *fsdata)
+{
+ struct nfs_server *nfss = NFS_SERVER(inode);
+ struct pnfs_layout_segment *lseg = NULL;
+ loff_t pos;
+ unsigned count;
+
+ if (!nfss->pnfs_curr_ld || !nfss->pnfs_curr_ld->ld_io_ops ||
+ !nfss->pnfs_curr_ld->ld_io_ops->new_request)
+ return;
+
+ pos = ((loff_t)req->wb_index << PAGE_CACHE_SHIFT) + req->wb_offset;
+ count = req->wb_bytes;
+ lseg = pnfs_find_get_lseg(inode, pos, count, IOMODE_RW);
+ nfss->pnfs_curr_ld->ld_io_ops->new_request(lseg, req, pos, count,
+ fsdata);
+ put_lseg(lseg);
+}
+
void pnfs_free_request_data(struct nfs_page *req)
{
struct layoutdriver_io_operations *lo;
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 3860e38..9824f78 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -48,6 +48,8 @@ void pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode *, struc
void pnfs_pageio_init_write(struct nfs_pageio_descriptor *, struct inode *);
void pnfs_update_layout_commit(struct inode *, struct list_head *, pgoff_t, unsigned int);
int pnfs_flush_one(struct inode *, struct list_head *, unsigned int, size_t, int);
+void pnfs_modify_new_request(struct inode *inode, struct nfs_page *req,
+ void *fsdata);
void pnfs_free_request_data(struct nfs_page *req);
void pnfs_free_fsdata(void *fsdata);
ssize_t pnfs_file_write(struct file *, const char __user *, size_t, loff_t *);
diff --git a/include/linux/nfs4_pnfs.h b/include/linux/nfs4_pnfs.h
index 308a9fb..000e9eb 100644
--- a/include/linux/nfs4_pnfs.h
+++ b/include/linux/nfs4_pnfs.h
@@ -141,6 +141,10 @@ struct layoutdriver_io_operations {
int (*write_begin) (struct pnfs_layout_segment *lseg, struct page *page,
loff_t pos, unsigned count,
struct pnfs_fsdata **fsdata);
+ /* Hook into nfs_create_request, for setting wb_private */
+ void (*new_request)(struct pnfs_layout_segment *lseg,
+ struct nfs_page *req, loff_t pos, unsigned count,
+ struct pnfs_fsdata *fsdata);
void (*free_request_data) (struct nfs_page *);
void (*free_fsdata) (struct pnfs_fsdata *data);
--
1.5.3.3
More information about the pNFS
mailing list