All of lore.kernel.org
 help / color / mirror / Atom feed
From: andros@netapp.com
To: bhalevy@panasas.com
Cc: linux-nfs@vger.kernel.org, Andy Adamson <andros@netapp.com>,
	Andy Adamson <andros@citi.umich.edu>,
	Boaz Harrosh <bharrosh@panasas.com>,
	Dean Hildebrand <dhildeb@us.ibm.com>,
	Fred Isaman <iisaman@netapp.com>
Subject: [PATCH 06/40] pnfs_submit: wave3 associate layout segment with nfs_page
Date: Fri,  4 Feb 2011 16:33:28 -0500	[thread overview]
Message-ID: <1296855242-2592-7-git-send-email-andros@netapp.com> (raw)
In-Reply-To: <1296855242-2592-6-git-send-email-andros@netapp.com>

From: Andy Adamson <andros@netapp.com>

Signed-off-by: Andy Adamson <andros@citi.umich.edu>
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Dean Hildebrand <dhildeb@us.ibm.com>
Signed-off-by: Fred Isaman <iisaman@netapp.com>
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: Fred Isaman <iisaman@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---
 fs/nfs/file.c            |    4 ----
 fs/nfs/pagelist.c        |   12 ++++++++++--
 fs/nfs/pnfs.c            |   14 ++++++++++++--
 fs/nfs/pnfs.h            |    5 +++++
 fs/nfs/read.c            |    9 ++++++---
 fs/nfs/write.c           |    2 +-
 include/linux/nfs_page.h |    3 ++-
 7 files changed, 36 insertions(+), 13 deletions(-)

diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 7bf029e..d85a534 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -387,10 +387,6 @@ static int nfs_write_begin(struct file *file, struct address_space *mapping,
 		file->f_path.dentry->d_name.name,
 		mapping->host->i_ino, len, (long long) pos);
 
-	pnfs_update_layout(mapping->host,
-			   nfs_file_open_context(file),
-			   IOMODE_RW);
-
 start:
 	/*
 	 * Prevent starvation issues if someone is doing a consistency
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index 0e8dece..9a27592 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;
 
@@ -53,7 +54,8 @@ 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,
+		   struct pnfs_layout_segment *lseg)
 {
 	struct nfs_page		*req;
 
@@ -84,6 +86,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);
+	req->wb_lseg    = lseg;
+	if (lseg)
+		get_lseg(lseg);
 	return req;
 }
 
@@ -159,9 +164,12 @@ void nfs_clear_request(struct nfs_page *req)
 		put_nfs_open_context(ctx);
 		req->wb_context = NULL;
 	}
+	if (req->wb_lseg != NULL) {
+		put_lseg(req->wb_lseg);
+		req->wb_lseg = NULL;
+	}
 }
 
-
 /**
  * nfs_release_request - Release the count on an NFS read/write request
  * @req: request to release
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index c7199db..1811204 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -264,7 +264,7 @@ put_lseg_locked(struct pnfs_layout_segment *lseg,
 	return 0;
 }
 
-static void
+void
 put_lseg(struct pnfs_layout_segment *lseg)
 {
 	struct inode *ino;
@@ -282,6 +282,7 @@ put_lseg(struct pnfs_layout_segment *lseg)
 		free_lseg(lseg);
 	}
 }
+EXPORT_SYMBOL_GPL(put_lseg);
 
 static bool
 should_free_lseg(u32 lseg_iomode, u32 recall_iomode)
@@ -795,7 +796,6 @@ pnfs_update_layout(struct inode *ino,
 out:
 	dprintk("%s end, state 0x%lx lseg %p\n", __func__,
 		nfsi->layout->plh_flags, lseg);
-	put_lseg(lseg); /* STUB - callers currently ignore return value */
 	return lseg;
 out_unlock:
 	spin_unlock(&ino->i_lock);
@@ -910,6 +910,16 @@ pnfs_pageio_init_read(struct nfs_pageio_descriptor *pgio,
 	pnfs_set_pg_test(inode, pgio);
 }
 
+static void _pnfs_clear_lseg_from_pages(struct list_head *head)
+{
+	struct nfs_page *req;
+
+	list_for_each_entry(req, head, wb_list) {
+		put_lseg(req->wb_lseg);
+		req->wb_lseg = NULL;
+	}
+}
+
 /*
  * Device ID cache. Currently supports one layout type per struct nfs_client.
  * Add layout type to the lookup key to expand to support multiple types.
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 7a75a0c..7614c3b 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -151,6 +151,7 @@ extern int nfs4_proc_layoutget(struct nfs4_layoutget *lgp);
 
 /* pnfs.c */
 void get_layout_hdr(struct pnfs_layout_hdr *lo);
+void put_lseg(struct pnfs_layout_segment *lseg);
 struct pnfs_layout_segment *
 pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx,
 		   enum pnfs_iomode access_type);
@@ -210,6 +211,10 @@ static inline void get_lseg(struct pnfs_layout_segment *lseg)
 {
 }
 
+static inline void put_lseg(struct pnfs_layout_segment *lseg)
+{
+}
+
 static inline struct pnfs_layout_segment *
 pnfs_update_layout(struct inode *ino, struct nfs_open_context *ctx,
 		   enum pnfs_iomode access_type)
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 11e7d6e..2eac0f1 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -117,12 +117,14 @@ int nfs_readpage_async(struct nfs_open_context *ctx, struct inode *inode,
 	LIST_HEAD(one_request);
 	struct nfs_page	*new;
 	unsigned int len;
+	struct pnfs_layout_segment *lseg;
 
 	len = nfs_page_length(page);
 	if (len == 0)
 		return nfs_return_empty_page(page);
-	pnfs_update_layout(inode, ctx, IOMODE_READ);
-	new = nfs_create_request(ctx, inode, page, 0, len);
+	lseg = pnfs_update_layout(inode, ctx, IOMODE_READ);
+	new = nfs_create_request(ctx, inode, page, 0, len, lseg);
+	put_lseg(lseg);
 	if (IS_ERR(new)) {
 		unlock_page(page);
 		return PTR_ERR(new);
@@ -569,7 +571,8 @@ 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,
+				 desc->pgio->pg_lseg);
 	if (IS_ERR(new))
 		goto out_error;
 
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 7a2905d..7f3c10a 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -651,7 +651,7 @@ static struct nfs_page * nfs_setup_write_request(struct nfs_open_context* ctx,
 	req = nfs_try_to_update_request(inode, page, offset, bytes);
 	if (req != NULL)
 		goto out;
-	req = nfs_create_request(ctx, inode, page, offset, bytes);
+	req = nfs_create_request(ctx, inode, page, offset, bytes, NULL);
 	if (IS_ERR(req))
 		goto out;
 	error = nfs_inode_add_request(inode, req);
diff --git a/include/linux/nfs_page.h b/include/linux/nfs_page.h
index ec9fd30..484c5b9 100644
--- a/include/linux/nfs_page.h
+++ b/include/linux/nfs_page.h
@@ -75,7 +75,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,
+					    struct pnfs_layout_segment *lseg);
 extern	void nfs_clear_request(struct nfs_page *req);
 extern	void nfs_release_request(struct nfs_page *req);
 
-- 
1.6.6


  reply	other threads:[~2011-02-04 21:34 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-04 21:33 [PATCH 0/40] Wave3: For pNFS team review, not for kernel submission andros
2011-02-04 21:33 ` [PATCH 01/40] pnfs-submit: wave3: lseg refcounting andros
2011-02-04 21:33   ` [PATCH 02/40] pnfs_submit: add data server session to nfs4_setup_sequence andros
2011-02-04 21:33     ` [PATCH 03/40] pnfs_submit: update nfs4_async_handle_error for data server andros
2011-02-04 21:33       ` [PATCH 04/40] pnfs_submit: update state renewal for data servers andros
2011-02-04 21:33         ` [PATCH 05/40] pnfs_submit: wave3 pageio-helpers andros
2011-02-04 21:33           ` andros [this message]
2011-02-04 21:33             ` [PATCH 07/40] pnfs_submit: filelayout policy operations andros
2011-02-04 21:33               ` [PATCH 08/40] pnfs_submit: filelayout i/o helpers andros
2011-02-04 21:33                 ` [PATCH 09/40] pnfs_submit: wave3 generic read andros
2011-02-04 21:33                   ` [PATCH 10/40] pnfs_submit: filelayout read andros
2011-02-04 21:33                     ` [PATCH 11/40] pnfs_submit: increase NFS_MAX_FILE_IO_SIZE andros
2011-02-04 21:33                       ` [PATCH 12/40] pnfs_submit: enforce requested DS only pNFS role andros
2011-02-04 21:33                         ` [PATCH 13/40] REVERT pnfs_submit-add-data-server-session-to-nfs4_setup_s.patch andros
2011-02-04 21:33                           ` [PATCH 14/40] REVERT: pnfs_submit: update nfs4_async_handle_error for data server andros
2011-02-04 21:33                             ` [PATCH 15/40] REVERT pnfs_submit: increase NFS_MAX_FILE_IO_SIZE andros
2011-02-04 21:33                               ` [PATCH 16/40] REVERT pnfs_submit: enforce requested DS only pNFS role andros
2011-02-04 21:33                                 ` [PATCH 17/40] SQUASHME pnfs-submit wave3 remove is_ds_only_session andros
2011-02-04 21:33                                   ` [PATCH 18/40] SQUASHME pnfs-submit: wave3 make pnfs_initiate_read static andros
2011-02-04 21:33                                     ` [PATCH 19/40] SQUASHME pnfs-submit wave3 filelayout read pagelist cleanup andros
2011-02-04 21:33                                       ` [PATCH 20/40] SQUASHME pnfs-submit wave3 remove nr_pages from read_pagelist andros
2011-02-04 21:33                                         ` [PATCH 21/40] SQUASHME pnfs-submit wave3 add comment to nfs4_fl_prepare_ds_fh andros
2011-02-04 21:33                                           ` [PATCH 22/40] SQUASHME pnfs-submit wave3 move BUG outside of switch andros
2011-02-04 21:33                                             ` [PATCH 23/40] SQUASHME pnfs-submit wave3 new function for ds expired lease andros
2011-02-04 21:33                                               ` [PATCH 24/40] NFS move nfs_client initialization into nfs_get_client andros
2011-02-04 21:33                                                 ` [PATCH 25/40] pnfs-submit: wave3 refactor dataserver client setup andros
2011-02-04 21:33                                                   ` [PATCH 26/40] pnfs-submit: wave3 refactor data server session initialization andros
2011-02-04 21:33                                                     ` [PATCH 27/40] pnfs_submit: wave3 rename nfs4_pnfs_ds_create andros
2011-02-04 21:33                                                       ` [PATCH 28/40] pnfs-submit: wave3 turn off pNFS on ds connection failure andros
2011-02-04 21:33                                                         ` [PATCH 29/40] pnfs-submit: wave3 rewrite read lseg refcounting andros
2011-02-04 21:33                                                           ` [PATCH 30/40] pnfs-submit: wave3 let LAYOUTGET distinguish between read and write calls andros
2011-02-04 21:33                                                             ` [PATCH 31/40] pnfs_submit wave3 remove struct pnfs_fl_call_data andros
2011-02-04 21:33                                                               ` [PATCH 32/40] pnfs_submit: wave3 get rid of pnfs_call_data andros
2011-02-04 21:33                                                                 ` [PATCH 33/40] pnfs-submit wave3 remove CONFIG_NFS_V4 and V4_1 from nfs_read_data andros
2011-02-04 21:33                                                                   ` [PATCH 34/40] pnfs-submit wave3 don't use nfs_read_prepare for DS andros
2011-02-04 21:33                                                                     ` [PATCH 35/40] pnfs_submit wave3 filelayout_read_prepare andros
2011-02-04 21:33                                                                       ` [PATCH 36/40] pnfs-submit wave3 filelayout read done andros
2011-02-04 21:33                                                                         ` [PATCH 37/40] pnfs-submit wave3 send zero stateid seqid on v4.1 i/o andros
2011-02-04 21:34                                                                           ` [PATCH 38/40] pnfs-submit wave3 new flag for state renewal check andros
2011-02-04 21:34                                                                             ` [PATCH 39/40] pnfs-submit wave3 new flag for lease time check andros
2011-02-04 21:34                                                                               ` [PATCH 40/40] pnfs-submit wave3 add MDS mount DS only check andros
2011-02-07 17:42                                                                           ` [PATCH 37/40] pnfs-submit wave3 send zero stateid seqid on v4.1 i/o Benny Halevy
2011-02-09 17:11                                                                             ` William A. (Andy) Adamson
2011-02-08 23:06                                                                         ` [PATCH 36/40] pnfs-submit wave3 filelayout read done Fred Isaman
2011-02-09 16:10                                                                           ` William A. (Andy) Adamson
2011-02-08 22:09                                                                   ` [PATCH 33/40] pnfs-submit wave3 remove CONFIG_NFS_V4 and V4_1 from nfs_read_data Fred Isaman
     [not found]                                                                     ` <AANLkTin_N0rFNr2KzxZ32bpWWUzwJQ4skLnZNVA=W6FQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-09 16:11                                                                       ` William A. (Andy) Adamson
2011-02-04 21:59                                                             ` [PATCH 30/40] pnfs-submit: wave3 let LAYOUTGET distinguish between read and write calls Fred Isaman
2011-02-05 16:47                                                               ` William A. (Andy) Adamson
2011-02-04 21:51                                               ` [PATCH 23/40] SQUASHME pnfs-submit wave3 new function for ds expired lease Fred Isaman
2011-02-05 16:46                                                 ` William A. (Andy) Adamson
2011-02-06 19:41                                                   ` Fred Isaman
2011-02-07 15:05                                                     ` William A. (Andy) Adamson
2011-02-07 15:29                                                       ` Fred Isaman
2011-02-04 21:44                                       ` [PATCH 19/40] SQUASHME pnfs-submit wave3 filelayout read pagelist cleanup Fred Isaman
2011-02-05 16:47                                         ` William A. (Andy) Adamson
2011-02-10  5:59 ` [PATCH 0/40] Wave3: For pNFS team review, not for kernel submission Benny Halevy
2011-02-10 14:17   ` William A. (Andy) Adamson

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=1296855242-2592-7-git-send-email-andros@netapp.com \
    --to=andros@netapp.com \
    --cc=andros@citi.umich.edu \
    --cc=bhalevy@panasas.com \
    --cc=bharrosh@panasas.com \
    --cc=dhildeb@us.ibm.com \
    --cc=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.