aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorNeil Brown <neilb@cse.unsw.edu.au>2005-01-04 05:46:24 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-04 05:46:24 -0800
commitb5d85ce8bf1e63fafe3c5cd252032059d63fbf5c (patch)
treeecc327aefd5db3fa6ed0d276882b103deef42ef8 /fs
parentee7bf1c3b3ce59abf7f3525eb26ad28970f1612f (diff)
downloadhistory-b5d85ce8bf1e63fafe3c5cd252032059d63fbf5c.tar.gz
[PATCH] knfsd: nfsd4: encode_dirent: more readdir attribute encoding to new function
Move readdir attribute encoding to nfsd4_encode_dirent_fattr(), remove the (no-longer used) error label. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4xdr.c73
1 files changed, 41 insertions, 32 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index f06899b61792cb..412cfec2aed811 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1770,6 +1770,46 @@ out_serverfault:
}
static int
+nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd,
+ const char *name, int namlen, u32 *p, int *buflen)
+{
+ struct svc_export *exp = cd->rd_fhp->fh_export;
+ struct dentry *dentry;
+ int nfserr;
+
+ dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen);
+ if (IS_ERR(dentry)) {
+ nfserr = nfserrno(PTR_ERR(dentry));
+ return nfserr;
+ }
+
+ exp_get(exp);
+ if (d_mountpoint(dentry)) {
+ if (nfsd_cross_mnt(cd->rd_rqstp, &dentry, &exp)) {
+ /*
+ * -EAGAIN is the only error returned from
+ * nfsd_cross_mnt() and it indicates that an
+ * up-call has been initiated to fill in the export
+ * options on exp. When the answer comes back,
+ * this call will be retried.
+ */
+ dput(dentry);
+ exp_put(exp);
+ nfserr = nfserr_dropit;
+ return nfserr;
+ }
+
+ }
+
+ nfserr = nfsd4_encode_fattr(NULL, exp,
+ dentry, p, buflen, cd->rd_bmval,
+ cd->rd_rqstp);
+ dput(dentry);
+ exp_put(exp);
+ return nfserr;
+}
+
+static int
nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen,
loff_t offset, ino_t ino, unsigned int d_type)
{
@@ -1777,8 +1817,6 @@ nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen,
int buflen;
u32 *p = cd->buffer;
u32 *attrlenp;
- struct dentry *dentry;
- struct svc_export *exp = cd->rd_fhp->fh_export;
int nfserr = 0;
/* In nfsv4, "." and ".." never make it onto the wire.. */
@@ -1802,35 +1840,7 @@ nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen,
/*
* Now we come to the ugly part: writing the fattr for this entry.
*/
- dentry = lookup_one_len(name, cd->rd_fhp->fh_dentry, namlen);
- if (IS_ERR(dentry)) {
- nfserr = nfserrno(PTR_ERR(dentry));
- goto error;
- }
-
- exp_get(exp);
- if (d_mountpoint(dentry)) {
- if (nfsd_cross_mnt(cd->rd_rqstp, &dentry, &exp)) {
- /*
- * -EAGAIN is the only error returned from
- * nfsd_cross_mnt() and it indicates that an
- * up-call has been initiated to fill in the export
- * options on exp. When the answer comes back,
- * this call will be retried.
- */
- dput(dentry);
- exp_put(exp);
- nfserr = nfserr_dropit;
- goto error;
- }
-
- }
-
- nfserr = nfsd4_encode_fattr(NULL, exp,
- dentry, p, &buflen, cd->rd_bmval,
- cd->rd_rqstp);
- dput(dentry);
- exp_put(exp);
+ nfserr = nfsd4_encode_dirent_fattr(cd, name, namlen, p, &buflen);
if (!nfserr) {
p += buflen;
goto out;
@@ -1838,7 +1848,6 @@ nfsd4_encode_dirent(struct readdir_cd *ccd, const char *name, int namlen,
if (nfserr == nfserr_resource)
goto nospc;
-error:
/*
* If we get here, we experienced a miscellaneous
* failure while writing the attributes. If the