linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Benny Halevy <bhalevy@panasas.com>,
	open-osd <osd-dev@open-osd.org>,
	NFS list <linux-nfs@vger.kernel.org>
Subject: [PATCH 04/10] SQUASHME: pnfsd-exofs: Change layout encoding to two pass
Date: Tue, 14 Jun 2011 17:36:14 -0400	[thread overview]
Message-ID: <1308087374-13151-1-git-send-email-bharrosh@panasas.com> (raw)
In-Reply-To: <4DF7D36F.9070602@panasas.com>

This way there is No need for dynamic allocation of the creds
array.

TODO: We can now remove the olo_comps pointer from
      struct pnfs_osd_layout neither the server nor client use
      it any more. (rename it to pnfs_osd_layout_hdr)

Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
---
 fs/exportfs/pnfs_osd_xdr_srv.c        |   16 +++++-----------
 include/linux/nfsd/pnfs_osd_xdr_srv.h |    6 +++++-
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/fs/exportfs/pnfs_osd_xdr_srv.c b/fs/exportfs/pnfs_osd_xdr_srv.c
index 67564f6..ec814c1 100644
--- a/fs/exportfs/pnfs_osd_xdr_srv.c
+++ b/fs/exportfs/pnfs_osd_xdr_srv.c
@@ -110,7 +110,7 @@ static inline int pnfs_osd_xdr_encode_objid(
  * 	struct pnfs_osd_opaque_cred	oc_cap;
  * };
  */
-static int pnfs_osd_xdr_encode_object_cred(
+int pnfs_osd_xdr_encode_layout_cred(
 	struct exp_xdr_stream *xdr,
 	struct pnfs_osd_object_cred *olo_comp)
 {
@@ -136,6 +136,7 @@ static int pnfs_osd_xdr_encode_object_cred(
 
 	return 0;
 }
+EXPORT_SYMBOL(pnfs_osd_xdr_encode_layout_cred);
 
 /*
  * struct pnfs_osd_layout {
@@ -145,12 +146,11 @@ static int pnfs_osd_xdr_encode_object_cred(
  * 	struct pnfs_osd_object_cred	*olo_comps;
  * };
  */
-int pnfs_osd_xdr_encode_layout(
+int pnfs_osd_xdr_encode_layout_hdr(
 	struct exp_xdr_stream *xdr,
 	struct pnfs_osd_layout *pol)
 {
 	__be32 *p;
-	u32 i;
 	int err;
 
 	err = pnfs_osd_xdr_encode_data_map(xdr, &pol->olo_map);
@@ -164,15 +164,9 @@ int pnfs_osd_xdr_encode_layout(
 	p = exp_xdr_encode_u32(p, pol->olo_comps_index);
 	p = exp_xdr_encode_u32(p, pol->olo_num_comps);
 
-	for (i = 0; i < pol->olo_num_comps; i++) {
-		err = pnfs_osd_xdr_encode_object_cred(xdr, &pol->olo_comps[i]);
-		if (err)
-			return err;
-	}
-
 	return 0;
 }
-EXPORT_SYMBOL(pnfs_osd_xdr_encode_layout);
+EXPORT_SYMBOL(pnfs_osd_xdr_encode_layout_hdr);
 
 static int _encode_string(struct exp_xdr_stream *xdr,
 			  const struct nfs4_string *str)
@@ -217,7 +211,7 @@ int pnfs_osd_xdr_encode_deviceaddr(
 	if (err)
 		return err;
 
-	err = pnfs_osd_xdr_encode_object_cred(xdr,
+	err = pnfs_osd_xdr_encode_layout_cred(xdr,
 					      &devaddr->oda_root_obj_cred);
 	if (err)
 		return err;
diff --git a/include/linux/nfsd/pnfs_osd_xdr_srv.h b/include/linux/nfsd/pnfs_osd_xdr_srv.h
index 256a7e07..e9a2187 100644
--- a/include/linux/nfsd/pnfs_osd_xdr_srv.h
+++ b/include/linux/nfsd/pnfs_osd_xdr_srv.h
@@ -17,10 +17,14 @@
 #include <linux/exp_xdr.h>
 
 /* Layout encoding */
-int pnfs_osd_xdr_encode_layout(
+int pnfs_osd_xdr_encode_layout_hdr(
 	struct exp_xdr_stream *xdr,
 	struct pnfs_osd_layout *layout);
 
+int pnfs_osd_xdr_encode_layout_cred(
+	struct exp_xdr_stream *xdr,
+	struct pnfs_osd_object_cred *cred);
+
 /* deviceaddr encoding */
 int pnfs_osd_xdr_encode_deviceaddr(
 	struct exp_xdr_stream *xdr, struct pnfs_osd_deviceaddr *devaddr);
-- 
1.7.3.4


  parent reply	other threads:[~2011-06-14 21:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-14 20:53 [PATCHSET 0/8] pnfsd-exofs: New set of exofs pnfs export patches Boaz Harrosh
2011-06-14 21:00 ` Benny Halevy
2011-06-14 22:24   ` Benny Halevy
2011-06-14 21:02 ` [PATCH 1/8] nfs_xdr: Move nfs4_string definition out of #ifdef CONFIG_NFS_V4 Boaz Harrosh
2011-06-14 21:02 ` [PATCH 2/8] exofs: pnfs-tree: Remove pnfs-osd private definitions Boaz Harrosh
2011-06-14 21:03 ` [PATCH 4/8] pnfsd-exofs: pnfs objects server XDR functions Boaz Harrosh
2011-06-14 21:03 ` [PATCH 5/8] pnfsd-exofs: Add pNFS export support Boaz Harrosh
2011-06-14 21:03 ` [PATCH 6/8] pnfsd-exofs: get_device_info implementation Boaz Harrosh
2011-06-14 21:03 ` [PATCH 8/8] pnfsd-exofs: layoutreturn pnfs-obj information decoding Boaz Harrosh
2011-06-14 21:20 ` [PATCH 3/8] pnfs-obj: pnfs_osd_xdr: Remove dead code and cleanup Boaz Harrosh
2011-06-14 21:20 ` [PATCH 7/8] pnfsd-exofs: Recall layouts on truncate Boaz Harrosh
2011-06-14 21:32 ` [PATCHSET 0/10] pnfsd-exofs: SQUASHMES that went into last changes Boaz Harrosh
2011-06-14 21:35   ` [PATCH 01/10] SQUASHME: pnfsd-exofs xdr_srv: Wrong type in comments Boaz Harrosh
2011-06-14 21:35   ` [PATCH 02/10] SQUASHME: pnfsd-exofs: Move all Server xdr definisions to separate header Boaz Harrosh
2011-06-14 21:36   ` [PATCH 03/10] SQUASHME: pnfsd-exofs: Prettify pnfs_osd_xdr_srv.h Boaz Harrosh
2011-06-14 21:36   ` Boaz Harrosh [this message]
2011-06-14 21:36   ` [PATCH 05/10] SQUASHME: pnfsd-exofs: osd_xdr_srv: Convert XDR API to return enum nfsstat4 Boaz Harrosh
2011-06-14 21:36   ` [PATCH 06/10] SQUASHME: pnfsd-exofs: Server xdr definisions were moved to a separate header Boaz Harrosh
2011-06-14 21:36   ` [PATCH 07/10] SQUASHME: pnfsd-exofs: osd_xdr_srv header moved Boaz Harrosh
2011-06-14 21:36   ` [PATCH 08/10] SQUASHME: pnfsd-exofs: layout encoding was Changed to two pass Boaz Harrosh
2011-06-14 21:36   ` [PATCH 09/10] SQUASHME: pnfsd-exofs: Convert XDR API to return enum nfsstat4 Boaz Harrosh
2011-06-14 21:38   ` [PATCH 10/10] SQUASHME: pnfsd-exofs: checkpatch love and a dprint 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=1308087374-13151-1-git-send-email-bharrosh@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=bhalevy@panasas.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=osd-dev@open-osd.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).