diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2010-12-14 09:58:11 -0500 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-12-16 12:37:24 -0500 |
commit | 573c4e1ef53a6b891b73cc2257e1604da754a2e4 (patch) | |
tree | b1e01ca46472ac6c936c4a144c3a160d8e1595bb /fs/nfs/dir.c | |
parent | 8111f373600cd43b3198b48b9238e3ad2fd9908d (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/dir.c')
-rw-r--r-- | fs/nfs/dir.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 996dd8989a91..3e2123fe79f5 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -172,7 +172,7 @@ struct nfs_cache_array { | |||
172 | struct nfs_cache_array_entry array[0]; | 172 | struct nfs_cache_array_entry array[0]; |
173 | }; | 173 | }; |
174 | 174 | ||
175 | typedef __be32 * (*decode_dirent_t)(struct xdr_stream *, struct nfs_entry *, struct nfs_server *, int); | 175 | typedef int (*decode_dirent_t)(struct xdr_stream *, struct nfs_entry *, int); |
176 | typedef struct { | 176 | typedef struct { |
177 | struct file *file; | 177 | struct file *file; |
178 | struct page *page; | 178 | struct page *page; |
@@ -378,14 +378,14 @@ error: | |||
378 | return error; | 378 | return error; |
379 | } | 379 | } |
380 | 380 | ||
381 | /* Fill in an entry based on the xdr code stored in desc->page */ | 381 | static int xdr_decode(nfs_readdir_descriptor_t *desc, |
382 | static | 382 | struct nfs_entry *entry, struct xdr_stream *xdr) |
383 | int xdr_decode(nfs_readdir_descriptor_t *desc, struct nfs_entry *entry, struct xdr_stream *stream) | ||
384 | { | 383 | { |
385 | __be32 *p = desc->decode(stream, entry, NFS_SERVER(desc->file->f_path.dentry->d_inode), desc->plus); | 384 | int error; |
386 | if (IS_ERR(p)) | ||
387 | return PTR_ERR(p); | ||
388 | 385 | ||
386 | error = desc->decode(xdr, entry, desc->plus); | ||
387 | if (error) | ||
388 | return error; | ||
389 | entry->fattr->time_start = desc->timestamp; | 389 | entry->fattr->time_start = desc->timestamp; |
390 | entry->fattr->gencount = desc->gencount; | 390 | entry->fattr->gencount = desc->gencount; |
391 | return 0; | 391 | return 0; |
@@ -566,6 +566,7 @@ int nfs_readdir_xdr_to_array(nfs_readdir_descriptor_t *desc, struct page *page, | |||
566 | entry.eof = 0; | 566 | entry.eof = 0; |
567 | entry.fh = nfs_alloc_fhandle(); | 567 | entry.fh = nfs_alloc_fhandle(); |
568 | entry.fattr = nfs_alloc_fattr(); | 568 | entry.fattr = nfs_alloc_fattr(); |
569 | entry.server = NFS_SERVER(inode); | ||
569 | if (entry.fh == NULL || entry.fattr == NULL) | 570 | if (entry.fh == NULL || entry.fattr == NULL) |
570 | goto out; | 571 | goto out; |
571 | 572 | ||