linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Fred Isaman <iisaman@netapp.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 7/8] pnfs_post_submit: Restore "pnfs: pnfs_modify_new_request"
Date: Sun,  2 May 2010 21:00:48 -0400	[thread overview]
Message-ID: <1272848449-19170-8-git-send-email-iisaman@netapp.com> (raw)
In-Reply-To: <1272848449-19170-7-git-send-email-iisaman@netapp.com>

From: Fred Isaman <iisaman@citi.umich.edu>

pnfs: pnfs_modify_new_request

Add hook into nfs_page initialization to allow for setting of
PG_USE_PNFS.

[pnfs: pass lseg from write_begin to write_end]
Signed-off-by: Fred Isaman <iisaman@citi.umich.edu>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>

Signed-off-by: Fred Isaman <iisaman@netapp.com>
---
 fs/nfs/pagelist.c         |    2 ++
 fs/nfs/pnfs.c             |   19 +++++++++++++++++++
 fs/nfs/pnfs.h             |   15 +++++++++++++++
 include/linux/nfs4_pnfs.h |    3 +++
 4 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index 3584b6a..3a1d673 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -20,6 +20,7 @@
 #include <linux/nfs_mount.h>
 
 #include "internal.h"
+#include "pnfs.h"
 
 static struct kmem_cache *nfs_page_cachep;
 
@@ -86,6 +87,7 @@ 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);
+	pnfs_modify_new_request(req, fsdata);
 	return req;
 }
 
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index ce6ca4b..46fe088 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -2245,6 +2245,25 @@ out_unlock:
 	goto out;
 }
 
+/* Note that fsdata != NULL */
+void _pnfs_modify_new_write_request(struct nfs_page *req,
+				    struct pnfs_fsdata *fsdata)
+{
+	struct inode *inode = req->wb_page->mapping->host;
+	struct pnfs_layout_segment *lseg = NULL;
+	loff_t pos;
+	unsigned count;
+
+	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);
+	if (lseg) {
+		if (fsdata->ok_to_use_pnfs)
+			set_bit(PG_USE_PNFS, &req->wb_flags);
+		put_lseg(lseg);
+	}
+}
+
 void pnfs_free_fsdata(struct pnfs_fsdata *fsdata)
 {
 	if (fsdata) {
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 8d37dfb..1c94984 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -78,6 +78,8 @@ int _pnfs_write_begin(struct inode *inode, struct page *page,
 		      struct pnfs_fsdata **fsdata);
 int _pnfs_do_flush(struct inode *inode, struct nfs_page *req,
 		   struct pnfs_fsdata *fsdata);
+void _pnfs_modify_new_write_request(struct nfs_page *req,
+				    struct pnfs_fsdata *fsdata);
 void _pnfs_direct_init_io(struct inode *inode, struct nfs_open_context *ctx,
 			  size_t count, loff_t loff, int iswrite,
 			  size_t *rwsize, size_t *remaining);
@@ -205,6 +207,14 @@ static inline void pnfs_redirty_request(struct nfs_page *req)
 	clear_bit(PG_USE_PNFS, &req->wb_flags);
 }
 
+static inline void pnfs_modify_new_request(struct nfs_page *req,
+					   void *fsdata)
+{
+	if (fsdata)
+		_pnfs_modify_new_write_request(req, fsdata);
+	/* Should we do something (like set PG_USE_PNFS) if !fsdata ? */
+}
+
 static inline int pnfs_return_layout(struct inode *ino,
 				     struct nfs4_pnfs_layout_segment *lseg,
 				     const nfs4_stateid *stateid, /* optional */
@@ -294,6 +304,11 @@ static inline void pnfs_redirty_request(struct nfs_page *req)
 {
 }
 
+static inline void pnfs_modify_new_request(struct nfs_page *req,
+					   void *fsdata)
+{
+}
+
 static inline int pnfs_get_write_status(struct nfs_write_data *data)
 {
 	return 0;
diff --git a/include/linux/nfs4_pnfs.h b/include/linux/nfs4_pnfs.h
index 1ba0590..e01a065 100644
--- a/include/linux/nfs4_pnfs.h
+++ b/include/linux/nfs4_pnfs.h
@@ -142,6 +142,9 @@ struct layoutdriver_io_operations {
 	int (*write_begin) (struct pnfs_layout_segment *lseg, struct page *page,
 			    loff_t pos, unsigned count,
 			    struct pnfs_fsdata *fsdata);
+	void (*new_request)(struct pnfs_layout_segment *lseg,
+			    struct nfs_page *req, loff_t pos, unsigned count,
+			    struct pnfs_fsdata *fsdata);
 
 	/* Consistency ops */
 	/* 2 problems:
-- 
1.6.6.1


  reply	other threads:[~2010-05-05  3:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-03  1:00 [PATCH 0/8]: pnfs_submit: removal of fsdata manipulation Fred Isaman
2010-05-03  1:00 ` [PATCH 1/8] SQUASHME: pnfs_submit: Revert the pnfs_write_end part of "pnfs: commit and pnfs_write_end" Fred Isaman
2010-05-03  1:00   ` [PATCH 2/8] SQUASHME: pnfs_submit: Revert "pnfs: pnfs_modify_new_request" Fred Isaman
2010-05-03  1:00     ` [PATCH 3/8] SQUASHME: pnfs_submit: Revert "pnfs: propagate fsdata into nfs_create_request" Fred Isaman
2010-05-03  1:00       ` [PATCH 4/8] SQUASHME: pnfs_submit: Revert "pnfs: pnfs_do_flush" Fred Isaman
2010-05-03  1:00         ` [PATCH 5/8] pnfs_post_submit: Restore " Fred Isaman
2010-05-03  1:00           ` [PATCH 6/8] pnfs_post_submit: Restore "pnfs: propagate fsdata into nfs_create_request" Fred Isaman
2010-05-03  1:00             ` Fred Isaman [this message]
2010-05-03  1:00               ` [PATCH 8/8] pnfs_post_submit: Revert the pnfs_write_end part of "pnfs: commit and pnfs_write_end" Fred Isaman
2010-05-06 19:45 ` [PATCH 0/8]: pnfs_submit: removal of fsdata manipulation Benny Halevy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1272848449-19170-8-git-send-email-iisaman@netapp.com \
    --to=iisaman@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).