[pnfs] [PATCH 6/8] pnfs: propagate fsdata into nfs_create_request

Fred Isaman iisaman at citi.umich.edu
Thu May 1 09:02:15 EDT 2008


Now that layout drivers can pass information into nfs_write_end via
fsdata, the natural place to use that data is in nfs_create_request.
So propagate fsdata into nfs_create_request.

Signed-off-by: Fred Isaman <iisaman at citi.umich.edu>
Signed-off-by: Benny Halevy <bhalevy at panasas.com>

Pass NULL fsdata to nfs_updatepage from nfs_vm_page_mkwrite
as this path does not go through write_{begin,end}

Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfs/file.c            |    4 ++--
 fs/nfs/pagelist.c        |    2 +-
 fs/nfs/read.c            |    4 ++--
 fs/nfs/write.c           |   17 ++++++++++-------
 include/linux/nfs_fs.h   |    3 ++-
 include/linux/nfs_page.h |    3 ++-
 6 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 805443b..98e9d8f 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -376,7 +376,7 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,
 	int status;
 
 	lock_kernel();
-	status = nfs_updatepage(file, page, offset, copied);
+	status = nfs_updatepage(file, page, offset, copied, fsdata);
 	unlock_kernel();
 
 	unlock_page(page);
@@ -444,7 +444,7 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
 	if (ret != 0)
 		goto out_unlock;
 
-	ret = nfs_updatepage(filp, page, 0, pagelen);
+	ret = nfs_updatepage(filp, page, 0, pagelen, NULL);
 	if (ret == 0)
 		ret = pagelen;
 out_unlock:
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index ba6cde2..43634d3 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -57,7 +57,7 @@ nfs_page_free(struct nfs_page *p)
 struct nfs_page *
 nfs_create_request(struct nfs_open_context *ctx, struct inode *inode,
 		   struct page *page,
-		   unsigned int offset, unsigned int count)
+		   unsigned int offset, unsigned int count, void *fsdata)
 {
 	struct nfs_page		*req;
 
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 409c9d2..4055126 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -130,7 +130,7 @@ static int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode,
 	len = nfs_page_length(page);
 	if (len == 0)
 		return nfs_return_empty_page(page);
-	new = nfs_create_request(ctx, inode, page, 0, len);
+	new = nfs_create_request(ctx, inode, page, 0, len, NULL);
 	if (IS_ERR(new)) {
 		unlock_page(page);
 		return PTR_ERR(new);
@@ -585,7 +585,7 @@ readpage_async_filler(void *data, struct page *page)
 	if (len == 0)
 		return nfs_return_empty_page(page);
 
-	new = nfs_create_request(desc->ctx, inode, page, 0, len);
+	new = nfs_create_request(desc->ctx, inode, page, 0, len, NULL);
 	if (IS_ERR(new))
 		goto out_error;
 
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index adb21c0..736bde7 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -39,7 +39,8 @@
  */
 static struct nfs_page * nfs_update_request(struct nfs_open_context*,
 					    struct page *,
-					    unsigned int, unsigned int);
+					    unsigned int, unsigned int,
+					    void *);
 static void nfs_pageio_init_write(struct nfs_pageio_descriptor *desc,
 				  struct inode *inode, int ioflags);
 static void nfs_redirty_request(struct nfs_page *req);
@@ -185,13 +186,13 @@ static void nfs_mark_uptodate(struct page *page, unsigned int base, unsigned int
 }
 
 static int nfs_writepage_setup(struct nfs_open_context *ctx, struct page *page,
-		unsigned int offset, unsigned int count)
+			unsigned int offset, unsigned int count, void *fsdata)
 {
 	struct nfs_page	*req;
 	int ret;
 
 	for (;;) {
-		req = nfs_update_request(ctx, page, offset, count);
+		req = nfs_update_request(ctx, page, offset, count, fsdata);
 		if (!IS_ERR(req))
 			break;
 		ret = PTR_ERR(req);
@@ -590,7 +591,8 @@ static inline int nfs_scan_commit(struct inode *inode, struct list_head *dst, pg
  * Note: Should always be called with the Page Lock held!
  */
 static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx,
-		struct page *page, unsigned int offset, unsigned int bytes)
+				struct page *page, unsigned int offset,
+				unsigned int bytes, void *fsdata)
 {
 	struct address_space *mapping = page->mapping;
 	struct inode *inode = mapping->host;
@@ -640,7 +642,8 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx,
 		}
 		spin_unlock(&inode->i_lock);
 
-		new = nfs_create_request(ctx, inode, page, offset, bytes);
+		new = nfs_create_request(ctx, inode, page,
+					 offset, bytes, fsdata);
 		if (IS_ERR(new))
 			return new;
 	}
@@ -726,7 +729,7 @@ static int nfs_write_pageuptodate(struct page *page, struct inode *inode)
  * things with a page scheduled for an RPC call (e.g. invalidate it).
  */
 int nfs_updatepage(struct file *file, struct page *page,
-		unsigned int offset, unsigned int count)
+		   unsigned int offset, unsigned int count, void *fsdata)
 {
 	struct nfs_open_context *ctx = nfs_file_open_context(file);
 	struct inode	*inode = page->mapping->host;
@@ -751,7 +754,7 @@ int nfs_updatepage(struct file *file, struct page *page,
 		offset = 0;
 	}
 
-	status = nfs_writepage_setup(ctx, page, offset, count);
+	status = nfs_writepage_setup(ctx, page, offset, count, fsdata);
 	__set_page_dirty_nobuffers(page);
 
         dprintk("NFS:      nfs_updatepage returns %d (isize %Ld)\n",
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 8cbe977..6ee2d80 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -475,7 +475,8 @@ extern int  nfs_congestion_kb;
 extern int  nfs_writepage(struct page *page, struct writeback_control *wbc);
 extern int  nfs_writepages(struct address_space *, struct writeback_control *);
 extern int  nfs_flush_incompatible(struct file *file, struct page *page);
-extern int  nfs_updatepage(struct file *, struct page *, unsigned int, unsigned int);
+extern int  nfs_updatepage(struct file *, struct page *, unsigned int,
+			   unsigned int, void *);
 extern int nfs_writeback_done(struct rpc_task *, struct nfs_write_data *);
 extern void nfs_writedata_release(void *);
 
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index 0e36e68..10329fb 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -76,7 +76,8 @@ extern	struct nfs_page *nfs_create_request(struct nfs_open_context *ctx,
 					    struct inode *inode,
 					    struct page *page,
 					    unsigned int offset,
-					    unsigned int count);
+					    unsigned int count,
+					    void *fsdata);
 extern	void nfs_clear_request(struct nfs_page *req);
 extern	void nfs_release_request(struct nfs_page *req);
 
-- 
1.5.3.3



More information about the pNFS mailing list