All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Benny Halevy <bhalevy@panasas.com>,
	Trond Myklebust <Trond.Myklebust@netapp.com>,
	NFS list <linux-nfs@vger.kernel.org>,
	open-osd <osd-dev@open-osd.org>
Cc: Benny Halevy <bhalevy@panasas.com>
Subject: [PATCH 22/23] pnfs: encode_layoutcommit
Date: Sun, 22 May 2011 19:53:48 +0300	[thread overview]
Message-ID: <1306083228-11226-1-git-send-email-bharrosh@panasas.com> (raw)
In-Reply-To: <4DD93D3E.9010909@panasas.com>

From: Benny Halevy <bhalevy@panasas.com>

Add a layout driver method to encode the layout type specific
opaque part of layout commit in-line in the xdr stream.

Currently, the pnfs-objects layout driver uses it to encode metadata hints
to the MDS and the blocks layout driver to commit provisionally allocated
extents to the file.

Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---
 fs/nfs/nfs4xdr.c |   16 +++++++++++++---
 fs/nfs/pnfs.h    |    4 ++++
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 29d33b3..3a530a8 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1875,6 +1875,7 @@ encode_layoutget(struct xdr_stream *xdr,
 
 static int
 encode_layoutcommit(struct xdr_stream *xdr,
+		    struct inode *inode,
 		    const struct nfs4_layoutcommit_args *args,
 		    struct compound_hdr *hdr)
 {
@@ -1883,7 +1884,7 @@ encode_layoutcommit(struct xdr_stream *xdr,
 	dprintk("%s: lbw: %llu type: %d\n", __func__, args->lastbytewritten,
 		NFS_SERVER(args->inode)->pnfs_curr_ld->id);
 
-	p = reserve_space(xdr, 48 + NFS4_STATEID_SIZE);
+	p = reserve_space(xdr, 44 + NFS4_STATEID_SIZE);
 	*p++ = cpu_to_be32(OP_LAYOUTCOMMIT);
 	/* Only whole file layouts */
 	p = xdr_encode_hyper(p, 0); /* offset */
@@ -1894,7 +1895,14 @@ encode_layoutcommit(struct xdr_stream *xdr,
 	p = xdr_encode_hyper(p, args->lastbytewritten);
 	*p++ = cpu_to_be32(0); /* Never send time_modify_changed */
 	*p++ = cpu_to_be32(NFS_SERVER(args->inode)->pnfs_curr_ld->id);/* type */
-	*p++ = cpu_to_be32(0); /* no file layout payload */
+
+	if (NFS_SERVER(inode)->pnfs_curr_ld->encode_layoutcommit)
+		NFS_SERVER(inode)->pnfs_curr_ld->encode_layoutcommit(
+			NFS_I(inode)->layout, xdr, args);
+	else {
+		p = reserve_space(xdr, 4);
+		*p = cpu_to_be32(0); /* no layout-type payload */
+	}
 
 	hdr->nops++;
 	hdr->replen += decode_layoutcommit_maxsz;
@@ -2751,6 +2759,8 @@ static void nfs4_xdr_enc_layoutcommit(struct rpc_rqst *req,
 				      struct xdr_stream *xdr,
 				      struct nfs4_layoutcommit_args *args)
 {
+	struct nfs4_layoutcommit_data *data =
+		container_of(args, struct nfs4_layoutcommit_data, args);
 	struct compound_hdr hdr = {
 		.minorversion = nfs4_xdr_minorversion(&args->seq_args),
 	};
@@ -2758,7 +2768,7 @@ static void nfs4_xdr_enc_layoutcommit(struct rpc_rqst *req,
 	encode_compound_hdr(xdr, req, &hdr);
 	encode_sequence(xdr, &args->seq_args, &hdr);
 	encode_putfh(xdr, NFS_FH(args->inode), &hdr);
-	encode_layoutcommit(xdr, args, &hdr);
+	encode_layoutcommit(xdr, data->args.inode, args, &hdr);
 	encode_getfattr(xdr, args->bitmask, &hdr);
 	encode_nops(&hdr);
 }
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 798861c..0c33d57 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -110,6 +110,10 @@ struct pnfs_layoutdriver_type {
 	void (*encode_layoutreturn) (struct pnfs_layout_hdr *layoutid,
 				     struct xdr_stream *xdr,
 				     const struct nfs4_layoutreturn_args *args);
+
+	void (*encode_layoutcommit) (struct pnfs_layout_hdr *layoutid,
+				     struct xdr_stream *xdr,
+				     const struct nfs4_layoutcommit_args *args);
 };
 
 struct pnfs_layout_hdr {
-- 
1.7.2.3


  parent reply	other threads:[~2011-05-22 16:54 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-22 16:43 [PATCHSET V4 00/23 boaz] pnfs for 2.6.40 Boaz Harrosh
2011-05-22 16:47 ` [PATCH 01/23] pnfs: CB_NOTIFY_DEVICEID Boaz Harrosh
2011-05-22 16:47 ` [PATCH 02/23] pnfs: Use byte-range for layoutget Boaz Harrosh
2011-05-22 16:47 ` [PATCH 03/23] pnfs: align layoutget requests on page boundaries Boaz Harrosh
2011-05-22 16:48 ` [PATCH 04/23] pnfs: Use byte-range for cb_layoutrecall Boaz Harrosh
2011-05-22 16:48 ` [PATCH 05/23] pnfs: client stats Boaz Harrosh
2011-05-22 16:48 ` [PATCH 06/23] pnfs: resolve header dependency in pnfs.h Boaz Harrosh
2011-05-22 16:49 ` [PATCH 07/23] pnfs-obj: objlayoutdriver module skeleton Boaz Harrosh
2011-05-22 16:49 ` [PATCH 08/23] pnfs-obj: pnfs_osd XDR definitions Boaz Harrosh
2011-05-22 16:49 ` [PATCH 09/23] pnfs-obj: pnfs_osd XDR client implementation Boaz Harrosh
2011-05-22 16:50 ` [PATCH 10/23] pnfs-obj: decode layout, alloc/free lseg Boaz Harrosh
2011-05-22 16:50 ` [PATCH 11/23] pnfs: per mount layout driver private data Boaz Harrosh
2011-05-22 16:50 ` [PATCH 12/23] pnfs-obj: objio_osd device information retrieval and caching Boaz Harrosh
2011-05-22 16:51 ` [PATCH 13/23] pnfs: set/unset layoutdriver Boaz Harrosh
2011-05-22 16:51 ` [PATCH 14/23] pnfs: alloc and free layout_hdr layoutdriver methods Boaz Harrosh
2011-05-22 16:51 ` [PATCH 15/23] pnfs-obj: define per-mount and per-inode private structures Boaz Harrosh
2011-05-22 16:52 ` [PATCH 16/23] pnfs: support for non-rpc layout drivers Boaz Harrosh
2011-05-22 19:40   ` Benny Halevy
2011-05-22 23:25     ` Benny Halevy
2011-05-23  4:22     ` Boaz Harrosh
2011-05-23 14:54       ` Fred Isaman
2011-05-23 17:56         ` Boaz Harrosh
2011-05-22 16:52 ` [PATCH 17/23] pnfs-obj: osd raid engine read/write implementation Boaz Harrosh
2011-05-22 16:52 ` [PATCH 18/23] pnfs: layoutreturn Boaz Harrosh
2011-05-22 16:52 ` [PATCH 19/23] pnfs: layoutret_on_setattr Boaz Harrosh
2011-05-22 16:53 ` [PATCH 20/23] pnfs: encode_layoutreturn Boaz Harrosh
2011-05-22 16:53 ` [PATCH 21/23] pnfs-obj: report errors and .encode_layoutreturn Implementation Boaz Harrosh
2011-05-22 16:53 ` Boaz Harrosh [this message]
2011-05-22 16:54 ` [PATCH 23/23] pnfs-obj: objlayout_encode_layoutcommit implementation 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=1306083228-11226-1-git-send-email-bharrosh@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=Trond.Myklebust@netapp.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 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.