public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Fred Isaman <iisaman@netapp.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 10/10] pnfs-submit: filelayout: adjust to new alloc_layout API
Date: Mon, 14 Jun 2010 21:46:15 -0400	[thread overview]
Message-ID: <1276566375-24566-11-git-send-email-iisaman@netapp.com> (raw)
In-Reply-To: <1276566375-24566-10-git-send-email-iisaman@netapp.com>

From: Andy Adamson <andros@netapp.com>

Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Fred Isaman <iisaman@netapp.com>
---
 fs/nfs/nfs4filelayout.c |   11 +++++++----
 fs/nfs/nfs4filelayout.h |    7 +++++++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 8a83c0d..f863549 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -308,11 +308,14 @@ filelayout_write_pagelist(struct pnfs_layout_type *layoutid,
  * will use the pnfs_layout_type type to refer to the layout for this
  * inode from now on.
  */
-static void *
+static struct pnfs_layout_type *
 filelayout_alloc_layout(struct inode *inode)
 {
+	struct nfs4_filelayout *flp;
+
 	dprintk("NFS_FILELAYOUT: allocating layout\n");
-	return kzalloc(sizeof(struct nfs4_filelayout), GFP_KERNEL);
+	flp =  kzalloc(sizeof(struct nfs4_filelayout), GFP_KERNEL);
+	return flp ? &flp->fl_cache : NULL;
 }
 
 /* Free a filelayout layout structure
@@ -478,7 +481,7 @@ static struct pnfs_layout_segment *
 filelayout_alloc_lseg(struct pnfs_layout_type *layoutid,
 		      struct nfs4_pnfs_layoutget_res *lgr)
 {
-	struct nfs4_filelayout *flo = PNFS_LD_DATA(layoutid);
+	struct nfs4_filelayout *flo = FILE_LO_CACHE(layoutid);
 	struct pnfs_layout_segment *lseg;
 	int rc;
 
@@ -697,7 +700,7 @@ filelayout_commit(struct pnfs_layout_type *layoutid, int sync,
 ssize_t
 filelayout_get_stripesize(struct pnfs_layout_type *layoutid)
 {
-	struct nfs4_filelayout *flo = PNFS_LD_DATA(layoutid);
+	struct nfs4_filelayout *flo = FILE_LO_CACHE(layoutid);
 
 	return flo->stripe_unit;
 }
diff --git a/fs/nfs/nfs4filelayout.h b/fs/nfs/nfs4filelayout.h
index 3697926..060bf9a 100644
--- a/fs/nfs/nfs4filelayout.h
+++ b/fs/nfs/nfs4filelayout.h
@@ -70,6 +70,7 @@ struct nfs4_filelayout_segment {
 };
 
 struct nfs4_filelayout {
+	struct pnfs_layout_type fl_cache;
 	int uncommitted_write;
 	loff_t last_commit_size;
 	u64 layout_id;
@@ -90,6 +91,12 @@ nfs4_fl_select_ds_fh(struct nfs4_filelayout_segment *flseg, u32 idx)
 		return &flseg->fh_array[idx];
 }
 
+static inline struct nfs4_filelayout *
+FILE_LO_CACHE(struct pnfs_layout_type *lo_cache)
+{
+	return container_of(lo_cache, struct nfs4_filelayout, fl_cache);
+}
+
 extern struct pnfs_client_operations *pnfs_callback_ops;
 
 extern void nfs4_fl_free_deviceid_callback(struct kref *);
-- 
1.6.6.1


  reply	other threads:[~2010-06-15 14:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15  1:46 [PATCH 00/10] layout refcounting changes Fred Isaman
2010-06-15  1:46 ` [PATCH 01/10] pnfs-submit: separate locking from get and put of layout Fred Isaman
2010-06-15  1:46   ` [PATCH 02/10] pnfs-submit: split get_layout and grab_current_layout Fred Isaman
2010-06-15  1:46     ` [PATCH 03/10] pnfs-submit: remove list_empty check from put_layout Fred Isaman
2010-06-15  1:46       ` [PATCH 04/10] pnfs-submit: add backpointer to pnfs_layout_type Fred Isaman
2010-06-15  1:46         ` [PATCH 05/10] pnfs-submit: Move pnfs_layout_state and pnfs_layout_suspend back to nfs_inode Fred Isaman
2010-06-15  1:46           ` [PATCH 06/10] pnfs-submit: Add state flag for layoutcommit_needed Fred Isaman
2010-06-15  1:46             ` [PATCH 07/10] pnfs-submit: avoid race handling return on close Fred Isaman
2010-06-15  1:46               ` [PATCH 08/10] pnfs-submit: change nfsi->layout to a pointer Fred Isaman
2010-06-15  1:46                 ` [PATCH 09/10] pnfs-submit: API change: alloc_layout returns layout cache head Fred Isaman
2010-06-15  1:46                   ` Fred Isaman [this message]
2010-06-15 17:06               ` [PATCH 07/10] pnfs-submit: avoid race handling return on close Benny Halevy
2010-06-15 17:32                 ` Fred Isaman
     [not found]                   ` <AANLkTilDj2Ua_t77kk5Gj_t0vqEcOJFKlqODAj18KQnm-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-15 17:33                     ` Trond Myklebust
     [not found]                       ` <1276623230.8767.48.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2010-06-15 17:52                         ` Fred Isaman
     [not found]                           ` <AANLkTimScICltrCrtEIz7qw1GzuaTGNwCVTk-ZTsZO4_-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-06-15 18:19                             ` Trond Myklebust
     [not found]                               ` <1276625991.2988.1.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2010-06-15 18:47                                 ` Benny Halevy
2010-06-15 17:00         ` [PATCH 04/10] pnfs-submit: add backpointer to pnfs_layout_type Benny Halevy
2010-06-15 16:56       ` [PATCH 03/10] pnfs-submit: remove list_empty check from put_layout 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=1276566375-24566-11-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