aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs2xdr.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2010-12-14 09:58:11 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2010-12-16 12:37:24 -0500
commit573c4e1ef53a6b891b73cc2257e1604da754a2e4 (patch)
treeb1e01ca46472ac6c936c4a144c3a160d8e1595bb /fs/nfs/nfs2xdr.c
parent8111f373600cd43b3198b48b9238e3ad2fd9908d (diff)
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/nfs2xdr.c')
-rw-r--r--fs/nfs/nfs2xdr.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c
index 0343175fe6c0..a9b848edbd2e 100644
--- a/fs/nfs/nfs2xdr.c
+++ b/fs/nfs/nfs2xdr.c
@@ -936,10 +936,10 @@ static int nfs2_xdr_dec_writeres(struct rpc_rqst *req, __be32 *p,
936 * the local page cache. 936 * the local page cache.
937 * @xdr: XDR stream where entry resides 937 * @xdr: XDR stream where entry resides
938 * @entry: buffer to fill in with entry data 938 * @entry: buffer to fill in with entry data
939 * @server: nfs_server data for this directory
940 * @plus: boolean indicating whether this should be a readdirplus entry 939 * @plus: boolean indicating whether this should be a readdirplus entry
941 * 940 *
942 * Returns the position of the next item in the buffer, or an ERR_PTR. 941 * Returns zero if successful, otherwise a negative errno value is
942 * returned.
943 * 943 *
944 * This function is not invoked during READDIR reply decoding, but 944 * This function is not invoked during READDIR reply decoding, but
945 * rather whenever an application invokes the getdents(2) system call 945 * rather whenever an application invokes the getdents(2) system call
@@ -954,8 +954,8 @@ static int nfs2_xdr_dec_writeres(struct rpc_rqst *req, __be32 *p,
954 * entry *nextentry; 954 * entry *nextentry;
955 * }; 955 * };
956 */ 956 */
957__be32 *nfs2_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, 957int nfs2_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
958 struct nfs_server *server, int plus) 958 int plus)
959{ 959{
960 __be32 *p; 960 __be32 *p;
961 int error; 961 int error;
@@ -968,9 +968,9 @@ __be32 *nfs2_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
968 if (unlikely(p == NULL)) 968 if (unlikely(p == NULL))
969 goto out_overflow; 969 goto out_overflow;
970 if (*p++ == xdr_zero) 970 if (*p++ == xdr_zero)
971 return ERR_PTR(-EAGAIN); 971 return -EAGAIN;
972 entry->eof = 1; 972 entry->eof = 1;
973 return ERR_PTR(-EBADCOOKIE); 973 return -EBADCOOKIE;
974 } 974 }
975 975
976 p = xdr_inline_decode(xdr, 4); 976 p = xdr_inline_decode(xdr, 4);
@@ -980,7 +980,7 @@ __be32 *nfs2_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
980 980
981 error = decode_filename_inline(xdr, &entry->name, &entry->len); 981 error = decode_filename_inline(xdr, &entry->name, &entry->len);
982 if (unlikely(error)) 982 if (unlikely(error))
983 return ERR_PTR(error); 983 return error;
984 984
985 /* 985 /*
986 * The type (size and byte order) of nfscookie isn't defined in 986 * The type (size and byte order) of nfscookie isn't defined in
@@ -999,11 +999,11 @@ __be32 *nfs2_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
999 entry->eof = 0; 999 entry->eof = 0;
1000 if (p != NULL) 1000 if (p != NULL)
1001 entry->eof = (p[0] == xdr_zero) && (p[1] != xdr_zero); 1001 entry->eof = (p[0] == xdr_zero) && (p[1] != xdr_zero);
1002 return p; 1002 return 0;
1003 1003
1004out_overflow: 1004out_overflow:
1005 print_overflow_msg(__func__, xdr); 1005 print_overflow_msg(__func__, xdr);
1006 return ERR_PTR(-EAGAIN); 1006 return -EAGAIN;
1007} 1007}
1008 1008
1009/* 1009/*