All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benny Halevy <bhalevy@panasas.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-nfs@vger.kernel.org, bharrosh@panasas.com
Subject: [PATCH v3 26/29] pnfs: encode_layoutcommit
Date: Mon, 16 May 2011 09:24:12 -0700	[thread overview]
Message-ID: <1305563052-8244-1-git-send-email-bhalevy@panasas.com> (raw)
In-Reply-To: <4DD14D8E.1070701@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 515eb38..c821c9c 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1884,6 +1884,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)
 {
@@ -1892,7 +1893,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 */
@@ -1903,7 +1904,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;
@@ -2760,6 +2768,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),
 	};
@@ -2767,7 +2777,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.3.4


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

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-16 16:15 [PATCH v3 0/29] pnfs for 2.6.40 Benny Halevy
2011-05-16 16:20 ` [PATCH v3 01/29] pnfs: CB_NOTIFY_DEVICEID Benny Halevy
2011-05-16 16:20 ` [PATCH v3 02/29] pnfs: Use byte-range for layoutget Benny Halevy
2011-05-16 16:20 ` [PATCH v3 03/29] pnfs: align layoutget requests on page boundaries Benny Halevy
2011-05-16 16:21 ` [PATCH v3 04/29] pnfs: Use byte-range for cb_layoutrecall Benny Halevy
2011-05-16 16:21 ` [PATCH v3 05/29] pnfs: client stats Benny Halevy
2011-05-16 16:21 ` [PATCH v3 06/29] pnfs: resolve header dependency in pnfs.h Benny Halevy
2011-05-16 16:21 ` [PATCH v3 07/29] pnfs-obj: objlayoutdriver module skeleton Benny Halevy
2011-05-16 16:21 ` [PATCH v3 08/29] NFSD: introduce exp_xdr.h Benny Halevy
2011-05-16 16:21 ` [PATCH v3 09/29] pnfs-obj: pnfs_osd XDR definitions Benny Halevy
2011-05-16 16:21 ` [PATCH v3 10/29] exofs: pnfs-tree: Remove pnfs-osd private definitions Benny Halevy
2011-05-16 16:22 ` [PATCH v3 11/29] pnfs-obj: pnfs_osd XDR client implementation Benny Halevy
2011-05-16 16:22 ` [PATCH v3 12/29] pnfs-obj: decode layout, alloc/free lseg Benny Halevy
     [not found]   ` <4DD43666.5040304@panasas.com>
2011-05-19 12:46     ` Boaz Harrosh
2011-05-16 16:22 ` [PATCH v3 13/29] pnfs: per mount layout driver private data Benny Halevy
2011-05-16 16:22 ` [PATCH v3 14/29] pnfs-obj: objio_osd device information retrieval and caching Benny Halevy
2011-05-16 16:22 ` [PATCH v3 15/29] pnfs: set/unset layoutdriver Benny Halevy
2011-05-16 16:22 ` [PATCH v3 16/29] pnfs-obj: objlayout set/unset layout driver methods Benny Halevy
2011-05-16 16:22 ` [PATCH v3 17/29] pnfs: alloc and free layout_hdr layoutdriver methods Benny Halevy
2011-05-16 16:23 ` [PATCH v3 18/29] pnfs: support for non-rpc layout drivers Benny Halevy
2011-05-16 16:23 ` [PATCH v3 19/29] pnfs-obj: read/write implementation Benny Halevy
2011-05-16 16:23 ` [PATCH v3 20/29] pnfs: layoutreturn Benny Halevy
2011-05-16 16:23 ` [PATCH v3 21/29] pnfs: layoutret_on_setattr Benny Halevy
2011-05-16 16:23 ` [PATCH v3 22/29] pnfs: encode_layoutreturn Benny Halevy
2011-05-16 16:23 ` [PATCH v3 23/29] sunrpc: xdr_rewind_stream() Benny Halevy
2011-05-16 16:23 ` [PATCH v3 24/29] pnfs-obj: objlayout_encode_layoutreturn Implementation Benny Halevy
2011-05-16 16:24 ` [PATCH v3 25/29] pnfs-obj: objio_osd report osd_errors for layoutreturn Benny Halevy
2011-05-16 16:24 ` Benny Halevy [this message]
2011-05-16 16:24 ` [PATCH v3 27/29] pnfs-obj: objlayout_encode_layoutcommit implementation Benny Halevy
2011-05-16 16:24 ` [PATCH v3 28/29] pnfs-obj: objio_osd: RAID0 support Benny Halevy
2011-05-16 16:24 ` [PATCH v3 29/29] pnfs-obj: objio_osd: groups support 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=1305563052-8244-1-git-send-email-bhalevy@panasas.com \
    --to=bhalevy@panasas.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=bharrosh@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 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.