All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fred Isaman <iisaman@netapp.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 7/7] wave4: nfs_pageio_do_add_request needs to distinguish between read and write
Date: Fri, 11 Feb 2011 11:54:39 -0500	[thread overview]
Message-ID: <1297443279-19813-8-git-send-email-iisaman@netapp.com> (raw)
In-Reply-To: <1297443279-19813-1-git-send-email-iisaman@netapp.com>

This is so that it can send the appropriate mode in LAYOUTGET.

Signed-off-by: Fred Isaman <iisaman@netapp.com>
---
 fs/nfs/pagelist.c        |    7 +++----
 fs/nfs/pnfs.c            |    8 ++++++++
 fs/nfs/pnfs.h            |    7 +++++++
 fs/nfs/write.c           |    2 +-
 include/linux/nfs_page.h |    1 +
 5 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index f0aa20b..0518d62a 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -299,10 +299,9 @@ static int nfs_pageio_do_add_request(struct nfs_pageio_descriptor *desc,
 	} else {
 		put_lseg(desc->pg_lseg);
 		desc->pg_base = req->wb_pgbase;
-		if (desc->pg_test)
-			desc->pg_lseg = pnfs_update_layout(desc->pg_inode,
-							   req->wb_context,
-							   IOMODE_READ);
+		desc->pg_lseg = pnfs_update_layout(desc->pg_inode,
+						   req->wb_context,
+						   desc->pg_iomode);
 	}
 	nfs_list_remove_request(req);
 	nfs_list_add_request(req, &desc->pg_list);
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index 9d2351a..a2ee472 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -889,6 +889,14 @@ void
 pnfs_pageio_init_read(struct nfs_pageio_descriptor *pgio,
 		  struct inode *inode)
 {
+	pgio->pg_iomode = IOMODE_READ;
+	pnfs_set_pg_test(inode, pgio);
+}
+
+void
+pnfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, struct inode *inode)
+{
+	pgio->pg_iomode = IOMODE_RW;
 	pnfs_set_pg_test(inode, pgio);
 }
 
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 50bcb1f..16f9fa5 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -179,6 +179,7 @@ enum pnfs_try_status pnfs_try_to_write_data(struct nfs_write_data *,
 enum pnfs_try_status pnfs_try_to_read_data(struct nfs_read_data *,
 					    const struct rpc_call_ops *);
 void pnfs_pageio_init_read(struct nfs_pageio_descriptor *, struct inode *);
+void pnfs_pageio_init_write(struct nfs_pageio_descriptor *, struct inode *);
 int pnfs_layout_process(struct nfs4_layoutget *lgp);
 void pnfs_free_lseg_list(struct list_head *tmp_list);
 void pnfs_destroy_layout(struct nfs_inode *);
@@ -297,6 +298,12 @@ pnfs_pageio_init_read(struct nfs_pageio_descriptor *pgio, struct inode *ino)
 	pgio->pg_test = NULL;
 }
 
+static inline void
+pnfs_pageio_init_write(struct nfs_pageio_descriptor *pgio, struct inode *ino)
+{
+	pgio->pg_test = NULL;
+}
+
 #endif /* CONFIG_NFS_V4_1 */
 
 #endif /* FS_NFS_PNFS_H */
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 5757b06..4c21045 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1001,7 +1001,7 @@ static void nfs_pageio_init_write(struct nfs_pageio_descriptor *pgio,
 {
 	size_t wsize = NFS_SERVER(inode)->wsize;
 
-	pgio->pg_test = NULL;
+	pnfs_pageio_init_write(pgio, inode);
 
 	if (wsize < PAGE_CACHE_SIZE)
 		nfs_pageio_init(pgio, inode, nfs_flush_multi, wsize, ioflags);
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index ba88ff4..fd57be2 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -63,6 +63,7 @@ struct nfs_pageio_descriptor {
 	int 			pg_ioflags;
 	int			pg_error;
 	struct pnfs_layout_segment *pg_lseg;
+	int			pg_iomode;
 	int			(*pg_test)(struct nfs_pageio_descriptor *, struct nfs_page *, struct nfs_page *);
 };
 
-- 
1.7.2.1


  parent reply	other threads:[~2011-02-11 16:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-11 16:54 [PATCH 0/7] pnfs wave 4 proposal Fred Isaman
2011-02-11 16:54 ` [PATCH 1/7] wave4: nfs: rearrange nfs_write_rpcsetup Fred Isaman
2011-02-14 17:22   ` Andy Adamson
2011-02-14 17:27     ` Fred Isaman
2011-02-14 18:11       ` William A. (Andy) Adamson
2011-02-11 16:54 ` [PATCH 2/7] wave4: Send lseg down through nfs_write_rpcsetup into nfs_initiate_write Fred Isaman
2011-02-11 16:54 ` [PATCH 3/7] wave4: remove GETATTR from ds write Fred Isaman
2011-02-11 16:54 ` [PATCH 4/7] wave4: nfs: rearrange nfs4_write_done Fred Isaman
2011-02-11 16:54 ` [PATCH 5/7] wave4: implement pnfs_try_to_write_data Fred Isaman
2011-02-11 16:54 ` [PATCH 6/7] wave4: filelayout write Fred Isaman
2011-02-11 16:54 ` Fred Isaman [this message]
2011-02-11 22:15   ` pNFS files server? Daniel.Muntz
2011-02-14 17:20     ` Andy Adamson
2011-02-11 20:19 ` [PATCH 0/7] pnfs wave 4 proposal Andy Adamson
2011-02-11 20:32   ` Fred Isaman

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=1297443279-19813-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.