linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>,
	Brent Welch <welch@panasas.com>,
	NFS list <linux-nfs@vger.kernel.org>,
	open-osd <osd-dev@open-osd.org>
Subject: [PATCH 8/8] pnfs-obj: Support for RAID5 read-4-write interface.
Date: Mon, 31 Oct 2011 15:16:54 -0700	[thread overview]
Message-ID: <1320099414-1211-1-git-send-email-bharrosh@panasas.com> (raw)
In-Reply-To: <4EAF146D.5060507@panasas.com>

The ore need suplied a r4w_get_page/r4w_put_page API
from Filesystem so it can get cache pages to read-into when
writing parial stripes.

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 fs/nfs/objlayout/objio_osd.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/fs/nfs/objlayout/objio_osd.c b/fs/nfs/objlayout/objio_osd.c
index 3161da6..c807ab9 100644
--- a/fs/nfs/objlayout/objio_osd.c
+++ b/fs/nfs/objlayout/objio_osd.c
@@ -459,6 +459,43 @@ static void _write_done(struct ore_io_state *ios, void *private)
 	objlayout_write_done(&objios->oir, status, objios->sync);
 }
 
+static struct page *__r4w_get_page(void *priv, u64 offset, bool *uptodate)
+{
+	struct objio_state *objios = priv;
+	struct nfs_write_data *wdata = objios->oir.rpcdata;
+	pgoff_t index = offset / PAGE_SIZE;
+	struct page *page = find_get_page(wdata->inode->i_mapping, index);
+
+	if (!page) {
+		page = find_or_create_page(wdata->inode->i_mapping,
+						index, GFP_NOFS);
+		if (unlikely(!page)) {
+			dprintk("%s: grab_cache_page Failed index=0x%lx\n",
+				__func__, index);
+			return NULL;
+		}
+		unlock_page(page);
+	}
+	if (PageDirty(page) || PageWriteback(page))
+		*uptodate = true;
+	else
+		*uptodate = PageUptodate(page);
+	dprintk("%s: index=0x%lx uptodate=%d\n", __func__, index, *uptodate);
+	return page;
+}
+
+static void __r4w_put_page(void *priv, struct page *page)
+{
+	dprintk("%s: index=0x%lx\n", __func__, page->index);
+	page_cache_release(page);
+	return;
+}
+
+static const struct _ore_r4w_op _r4w_op = {
+	.get_page = &__r4w_get_page,
+	.put_page = &__r4w_put_page,
+};
+
 int objio_write_pagelist(struct nfs_write_data *wdata, int how)
 {
 	struct objio_state *objios;
@@ -472,6 +509,7 @@ int objio_write_pagelist(struct nfs_write_data *wdata, int how)
 		return ret;
 
 	objios->sync = 0 != (how & FLUSH_SYNC);
+	objios->ios->r4w = &_r4w_op;
 
 	if (!objios->sync)
 		objios->ios->done = _write_done;
-- 
1.7.6.4


  parent reply	other threads:[~2011-10-31 22:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-28 19:13 [patchset 0/8] pnfs-obj: Move to ORE for v3.2 merge window Boaz Harrosh
2011-10-29 17:24 ` Trond Myklebust
2011-10-31 17:49   ` Boaz Harrosh
2011-10-31 21:34     ` Boaz Harrosh
2011-10-31 21:45       ` [PATCH 1/8] pnfs-obj: Remove redundant EOF from objlayout_io_state Boaz Harrosh
2011-10-31 22:24         ` Trond Myklebust
2011-10-31 22:45           ` Boaz Harrosh
2011-10-31 23:23             ` Boaz Harrosh
2011-10-31 23:29             ` Trond Myklebust
2011-10-31 23:59               ` Boaz Harrosh
2011-11-01  2:25                 ` Trond Myklebust
2011-10-31 21:45       ` [PATCH 2/8] pnfs-obj: Return PNFS_NOT_ATTEMPTED in case of read/write_pagelist Boaz Harrosh
2011-10-31 21:47       ` [PATCH 3/8] pnfs-obj: Get rid of objlayout_{alloc,free}_io_state Boaz Harrosh
2011-10-31 22:03       ` [PATCH 4/8] pnfs-obj: Rename objlayout_io_state => objlayout_io_res Boaz Harrosh
2011-10-31 22:04       ` [PATCH 5/8] pnfs-obj: move to ore 01: ore_layout & ore_components Boaz Harrosh
2011-10-31 22:15       ` [PATCH 6/8] pnfs-obj: move to ore 02: move to ORE Boaz Harrosh
2011-10-31 22:16       ` [PATCH 7/8] pnfs-obj: move to ore 03: Remove old raid engine Boaz Harrosh
2011-10-31 22:16       ` Boaz Harrosh [this message]
2011-11-01 17:42       ` [patchset 0/8] pnfs-obj: Move to ORE for v3.2 merge window Boaz Harrosh
2011-11-02 19:01         ` [osd-dev] " Boaz Harrosh

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=1320099414-1211-1-git-send-email-bharrosh@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=osd-dev@open-osd.org \
    --cc=welch@panasas.com \
    /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).