[pnfs] [PATCH 01/10] pnfs: free nfs page request data

andros at umich.edu andros at umich.edu
Wed Jan 16 17:52:52 EST 2008


From: Andy Adamson <andros at umich.edu>

The filelayout module stores data server information in the wb_private
pointer in a request (struct nfs_page). The kalloc'ed data server information
(struct nfs4_pnfs_dserver) is pointed to by each page in a coalesce group
and refcounted in the file layout modules flush_on layoutdriver I/O operation.

The wb_pointer is referenced by the filelayout module COMMIT function to
gather per-DS pages for COMMIT.

Add a new layoutdriver io operation to any free wb_private data in
nfs_free_requst().

The per-layout private data portion of struct nfs_page (wb_private) will need
the per-layout layoutdriver_io_operations pointer to operate on the data.
Sometimes, as in nfs_free_request(), the inode is not available.

Pass the pnfs layoutdriver_io_operations pointer in the page.

Signed-off-by: Andy Adamson<andros at umich.edu>
Signed-off-by: Fred Isaman<iisaman at umich.edu>
---
 fs/nfs/pagelist.c         |    6 ++++++
 fs/nfs/pnfs.c             |   11 +++++++++++
 fs/nfs/pnfs.h             |    1 +
 include/linux/nfs4_pnfs.h |    1 +
 include/linux/nfs_page.h  |    1 +
 5 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index b49ace5..15a66ab 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -20,6 +20,9 @@
 #include <linux/nfs_mount.h>
 
 #include "internal.h"
+#ifdef CONFIG_PNFS
+#include "pnfs.h"
+#endif /* CONFIG_PNFS */
 
 static struct kmem_cache *nfs_page_cachep;
 
@@ -167,6 +170,9 @@ static void nfs_free_request(struct kref *kref)
 	/* Release struct file or cached credential */
 	nfs_clear_request(req);
 	put_nfs_open_context(req->wb_context);
+#ifdef CONFIG_PNFS
+	pnfs_free_request_data(req);
+#endif /* CONFIG_PNFS */
 	nfs_page_free(req);
 }
 
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 3091ef4..b00779b 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -1730,6 +1730,17 @@ out_unlock:
 	goto out;
 }
 
+void pnfs_free_request_data(struct nfs_page *req)
+{
+	struct layoutdriver_io_operations *lo;
+
+	if (!req->wb_ops || !req->wb_private)
+		return;
+	lo = (struct layoutdriver_io_operations *)req->wb_ops;
+	if (lo->free_request_data)
+		lo->free_request_data(req);
+}
+
 /* Callback operations for layout drivers.
  */
 struct pnfs_client_operations pnfs_ops = {
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 48cfb49..d450e24 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -46,6 +46,7 @@ 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_free_request_data(struct nfs_page *req);
 
 #endif /* CONFIG_PNFS */
 
diff --git a/include/linux/nfs4_pnfs.h b/include/linux/nfs4_pnfs.h
index 31dedb7..94e0227 100644
--- a/include/linux/nfs4_pnfs.h
+++ b/include/linux/nfs4_pnfs.h
@@ -118,6 +118,7 @@ struct layoutdriver_io_operations {
 	ssize_t (*read_pagelist) (struct pnfs_layout_type *layoutid, struct page **pages, unsigned int pgbase, unsigned nr_pages, loff_t offset, size_t count, struct nfs_read_data *nfs_data);
 	ssize_t (*write_pagelist) (struct pnfs_layout_type *layoutid, struct page **pages, unsigned int pgbase, unsigned nr_pages, loff_t offset, size_t count, int sync, struct nfs_write_data *nfs_data);
 	int (*flush_one) (struct inode *inode, struct list_head *head, unsigned int npages, size_t count, int how);
+	void (*free_request_data) (struct nfs_page *);
 
 
 	/* Consistency ops */
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index cc5f1d0..098b788 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -47,6 +47,7 @@ struct nfs_page {
 #ifdef CONFIG_PNFS
 	unsigned int		wb_devip;	/* pNFS data server IP addr */
 	unsigned int		wb_devport;	/* pNFS data server port */
+	void			*wb_ops;	/* pNFS io operations */
 	void			*wb_private;
 #endif
 };
-- 
1.5.0.2



More information about the pNFS mailing list