summaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs3xdr.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2010-12-14 14:58:11 +0000
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-12-16 12:37:24 -0500
commit573c4e1ef53a6b891b73cc2257e1604da754a2e4 (patch)
treeb1e01ca46472ac6c936c4a144c3a160d8e1595bb /fs/nfs/nfs3xdr.c
parent8111f373600cd43b3198b48b9238e3ad2fd9908d (diff)
downloadblackbird-obmc-linux-573c4e1ef53a6b891b73cc2257e1604da754a2e4.tar.gz
blackbird-obmc-linux-573c4e1ef53a6b891b73cc2257e1604da754a2e4.zip
NFS: Simplify ->decode_dirent() calling sequence
Clean up. The pointer returned by ->decode_dirent() is no longer used as a pointer. The only call site (xdr_decode() in fs/nfs/dir.c) simply extracts the errno value encoded in the pointer. Replace the returned pointer with a standard integer errno return value. Also, pass the "server" argument as part of the nfs_entry instead of as a separate parameter. It's faster to derive "server" in nfs_readdir_xdr_to_array() since we already have the directory's inode handy. "server" ought to be invariant for a set of entries in the same directory, right? The legacy versions of decode_dirent() don't use "server" anyway, so it's wasted work for them to derive and pass "server" for each entry. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Tested-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs3xdr.c')
-rw-r--r--fs/nfs/nfs3xdr.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index c97d00fe849a..15c93ccd90c5 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -1970,10 +1970,10 @@ out_status:
* the local page cache
* @xdr: XDR stream where entry resides
* @entry: buffer to fill in with entry data
- * @server: nfs_server data for this directory
* @plus: boolean indicating whether this should be a readdirplus entry
*
- * Returns the position of the next item in the buffer, or an ERR_PTR.
+ * Returns zero if successful, otherwise a negative errno value is
+ * returned.
*
* This function is not invoked during READDIR reply decoding, but
* rather whenever an application invokes the getdents(2) system call
@@ -2000,8 +2000,8 @@ out_status:
* entryplus3 *nextentry;
* };
*/
-__be32 *nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
- struct nfs_server *server, int plus)
+int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
+ int plus)
{
struct nfs_entry old = *entry;
__be32 *p;
@@ -2015,23 +2015,23 @@ __be32 *nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
if (unlikely(p == NULL))
goto out_overflow;
if (*p == xdr_zero)
- return ERR_PTR(-EAGAIN);
+ return -EAGAIN;
entry->eof = 1;
- return ERR_PTR(-EBADCOOKIE);
+ return -EBADCOOKIE;
}
error = decode_fileid3(xdr, &entry->ino);
if (unlikely(error))
- return ERR_PTR(error);
+ return error;
error = decode_inline_filename3(xdr, &entry->name, &entry->len);
if (unlikely(error))
- return ERR_PTR(error);
+ return error;
entry->prev_cookie = entry->cookie;
error = decode_cookie3(xdr, &entry->cookie);
if (unlikely(error))
- return ERR_PTR(error);
+ return error;
entry->d_type = DT_UNKNOWN;
@@ -2039,7 +2039,7 @@ __be32 *nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
entry->fattr->valid = 0;
error = decode_post_op_attr(xdr, entry->fattr);
if (unlikely(error))
- return ERR_PTR(error);
+ return error;
if (entry->fattr->valid & NFS_ATTR_FATTR_V3)
entry->d_type = nfs_umode_to_dtype(entry->fattr->mode);
@@ -2052,7 +2052,7 @@ __be32 *nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
if (unlikely(error)) {
if (error == -E2BIG)
goto out_truncated;
- return ERR_PTR(error);
+ return error;
}
} else
zero_nfs_fh3(entry->fh);
@@ -2063,15 +2063,15 @@ __be32 *nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
entry->eof = 0;
if (p != NULL)
entry->eof = (p[0] == xdr_zero) && (p[1] != xdr_zero);
- return p;
+ return 0;
out_overflow:
print_overflow_msg(__func__, xdr);
- return ERR_PTR(-EAGAIN);
+ return -EAGAIN;
out_truncated:
dprintk("NFS: directory entry contains invalid file handle\n");
*entry = old;
- return ERR_PTR(-EAGAIN);
+ return -EAGAIN;
}
/*
OpenPOWER on IntegriCloud