Linux NFS development
 help / color / mirror / Atom feed
From: Anna Schumaker <Anna.Schumaker@netapp.com>
To: <Trond.Myklebust@primarydata.com>, <linux-nfs@vger.kernel.org>
Subject: [PATCH 3/3] NFS: Add support for reading NFS4_CONTENT_HOLE segments
Date: Wed, 17 Dec 2014 17:35:26 -0500	[thread overview]
Message-ID: <1418855726-14262-4-git-send-email-Anna.Schumaker@Netapp.com> (raw)
In-Reply-To: <1418855726-14262-1-git-send-email-Anna.Schumaker@Netapp.com>

This patch adds support for decoding a single hole segment returned by
the server.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---
 fs/nfs/nfs42xdr.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c
index c0d266d..ced0d8c 100644
--- a/fs/nfs/nfs42xdr.c
+++ b/fs/nfs/nfs42xdr.c
@@ -216,6 +216,25 @@ out_overflow:
 	return -EIO;
 }
 
+static int decode_read_plus_hole(struct xdr_stream *xdr, struct nfs_pgio_res *res)
+{
+	__be32 *p;
+	uint64_t offset, length;
+
+	p = xdr_inline_decode(xdr, 8 + 8);
+	if (unlikely(!p))
+		goto out_overflow;
+
+	p = xdr_decode_hyper(p, &offset);
+	p = xdr_decode_hyper(p, &length);
+
+	res->count = xdr_read_hole(xdr, length);
+	return 0;
+out_overflow:
+	print_overflow_msg(__func__, xdr);
+	return -EIO;
+}
+
 static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res)
 {
 	__be32 *p;
@@ -245,7 +264,7 @@ static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res)
 	if (type == NFS4_CONTENT_DATA)
 		status = decode_read_plus_data(xdr, res);
 	else
-		status = -ENOTSUPP;
+		status = decode_read_plus_hole(xdr, res);
 
 	if (segments > 1)
 		res->eof = 0;
-- 
2.1.3


  parent reply	other threads:[~2014-12-17 22:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17 22:35 [PATCH 0/3] NFS: Add READ_PLUS support Anna Schumaker
2014-12-17 22:35 ` [PATCH 1/3] NFS: Add basic support for READ_PLUS Anna Schumaker
2014-12-17 22:35 ` [PATCH 2/3] SUNRPC: Add the ability to zero out data pages Anna Schumaker
2014-12-17 22:35 ` Anna Schumaker [this message]
2015-01-07 15:28 ` [PATCH 0/3] NFS: Add READ_PLUS support Anna Schumaker
2015-01-07 18:24 ` J. Bruce Fields

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=1418855726-14262-4-git-send-email-Anna.Schumaker@Netapp.com \
    --to=anna.schumaker@netapp.com \
    --cc=Trond.Myklebust@primarydata.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