linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: andros@netapp.com
To: bhalevy@panasas.com
Cc: linux-nfs@vger.kernel.org, Andy Adamson <andros@netapp.com>
Subject: [PATCH 03/10] SQUASHME pnfs-submit: clear page lseg on partial i/o
Date: Wed, 23 Jun 2010 15:21:11 -0400	[thread overview]
Message-ID: <1277320878-3726-4-git-send-email-andros@netapp.com> (raw)
In-Reply-To: <1277320878-3726-3-git-send-email-andros@netapp.com>

From: Andy Adamson <andros@netapp.com>

partial reads or writes use a single page not the page list.

Signed-off-by: Andy Adamson <andros@netapp.com>
---
 fs/nfs/pnfs.h |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index c60eff6..70f1d97 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -91,10 +91,18 @@ static inline int pnfs_enabled_sb(struct nfs_server *nfss)
 	return nfss->pnfs_curr_ld != NULL;
 }
 
-static inline void _pnfs_clear_lseg_from_pages(struct list_head *head)
+static inline void _pnfs_clear_lseg_from_pages(struct nfs_page *partial,
+					       struct list_head *head)
 {
 	struct nfs_page *req;
 
+	/* partial_read or partial_write */
+	if (list_empty(head)) {
+		put_lseg(partial->wb_lseg);
+		partial->wb_lseg = NULL;
+		return;
+	}
+	/* full_read or full_write */
 	list_for_each_entry(req, head, wb_list) {
 		put_lseg(req->wb_lseg);
 		req->wb_lseg = NULL;
@@ -114,7 +122,7 @@ pnfs_try_to_read_data(struct nfs_read_data *data,
 	if (ret == PNFS_ATTEMPTED)
 		nfs_inc_stats(inode, NFSIOS_PNFS_READ);
 	else
-		_pnfs_clear_lseg_from_pages(&data->pages);
+		_pnfs_clear_lseg_from_pages(data->req, &data->pages);
 	return ret;
 }
 
@@ -132,7 +140,7 @@ pnfs_try_to_write_data(struct nfs_write_data *data,
 	if (ret == PNFS_ATTEMPTED)
 		nfs_inc_stats(inode, NFSIOS_PNFS_WRITE);
 	else
-		_pnfs_clear_lseg_from_pages(&data->pages);
+		_pnfs_clear_lseg_from_pages(data->req, &data->pages);
 	return ret;
 }
 
@@ -153,7 +161,7 @@ pnfs_try_to_commit(struct nfs_write_data *data,
 	if (ret == PNFS_ATTEMPTED)
 		nfs_inc_stats(inode, NFSIOS_PNFS_COMMIT);
 	else
-		_pnfs_clear_lseg_from_pages(&data->pages);
+		_pnfs_clear_lseg_from_pages(data->req, &data->pages);
 	return ret;
 }
 
-- 
1.6.6


  reply	other threads:[~2010-06-23 19:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-23 19:21 [PATCH 0/10] pnfs-submit add layoutget,layoutreturn error handling version 2 andros
2010-06-23 19:21 ` [PATCH 01/10] SQUASHME: pnfs-submit remove unused filelayout_mount_type andros
2010-06-23 19:21   ` [PATCH 02/10] SQUASHME pnfs-submit: pnfs_try_to_read, write, commit using freed memory andros
2010-06-23 19:21     ` andros [this message]
2010-06-23 19:21       ` [PATCH 04/10] SQUASHME pnfs-submit: remove encode_layoutreturn andros
2010-06-23 19:21         ` [PATCH 05/10] SQUASHME pnfs-submit: add error handling to layout return andros
2010-06-23 19:21           ` [PATCH 06/10] SQUASHME pnfs-submit: handle assassinated layoutcommit andros
2010-06-23 19:21             ` [PATCH 07/10] SQUASHME pnfs-submit: add error handlers to layout get andros
2010-06-23 19:21               ` [PATCH 08/10] pnfs-post-submit: restore encode_layoutreturn andros
2010-06-23 19:21                 ` [PATCH 09/10] SQUASHME: pnfs-submit: don't re-initialize i_lock andros
2010-06-23 19:21                   ` [PATCH 10/10] SQUASHME pnfs-submit: remove struct nfs_server from stack andros
2010-06-30 15:19               ` [PATCH 07/10] SQUASHME pnfs-submit: add error handlers to layout get Boaz Harrosh
2010-06-30 19:23                 ` William A. (Andy) Adamson
2010-06-24 13:14 ` [PATCH 0/10] pnfs-submit add layoutget,layoutreturn error handling version 2 Benny Halevy
2010-06-24 17:02   ` William A. (Andy) Adamson
     [not found]     ` <AANLkTikJWftkWhU8TIOGxvGxo8s2_sXyMn8VIsk9caTv-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-28 16:44       ` Andy Adamson
2010-06-28 18:53         ` Benny Halevy
2010-06-28 19:22           ` William A. (Andy) Adamson
     [not found]             ` <AANLkTilDLWK8rfwzlI8xJJUckxljCqgmblAYj9ANOMnb-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-28 20:02               ` William A. (Andy) Adamson
2010-07-01 18:27 ` 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=1277320878-3726-4-git-send-email-andros@netapp.com \
    --to=andros@netapp.com \
    --cc=bhalevy@panasas.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).