Commit 1b3f48da authored by Trond Myklebust's avatar Trond Myklebust

Clean up the nfs_fhget() function. Have the called pass the

superblock as a parameter instead of passing it in the form
of a dentry.
parent 2cb6e314
...@@ -688,7 +688,7 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru ...@@ -688,7 +688,7 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru
goto out_unlock; goto out_unlock;
} }
error = -EACCES; error = -EACCES;
inode = nfs_fhget(dentry, &fhandle, &fattr); inode = nfs_fhget(dentry->d_sb, &fhandle, &fattr);
if (!inode) if (!inode)
goto out_unlock; goto out_unlock;
no_entry: no_entry:
...@@ -791,7 +791,7 @@ static int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle, ...@@ -791,7 +791,7 @@ static int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle,
if (error) if (error)
goto out_err; goto out_err;
} }
inode = nfs_fhget(dentry, fhandle, fattr); inode = nfs_fhget(dentry->d_sb, fhandle, fattr);
if (inode) { if (inode) {
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
nfs_renew_times(dentry); nfs_renew_times(dentry);
......
...@@ -53,7 +53,6 @@ ...@@ -53,7 +53,6 @@
*/ */
#define NFS_MAX_READAHEAD RPC_MAXREQS #define NFS_MAX_READAHEAD RPC_MAXREQS
static struct inode * __nfs_fhget(struct super_block *, struct nfs_fh *, struct nfs_fattr *);
void nfs_zap_caches(struct inode *); void nfs_zap_caches(struct inode *);
static void nfs_invalidate_inode(struct inode *); static void nfs_invalidate_inode(struct inode *);
...@@ -273,7 +272,7 @@ nfs_get_root(struct inode **rooti, rpc_authflavor_t authflavor, struct super_blo ...@@ -273,7 +272,7 @@ nfs_get_root(struct inode **rooti, rpc_authflavor_t authflavor, struct super_blo
return error; return error;
} }
*rooti = __nfs_fhget(sb, rootfh, &fattr); *rooti = nfs_fhget(sb, rootfh, &fattr);
if (error == -EACCES && authflavor > RPC_AUTH_MAXFLAVOR) { if (error == -EACCES && authflavor > RPC_AUTH_MAXFLAVOR) {
if (*rooti) { if (*rooti) {
NFS_FLAGS(*rooti) |= NFS_INO_FAKE_ROOT; NFS_FLAGS(*rooti) |= NFS_INO_FAKE_ROOT;
...@@ -692,33 +691,15 @@ nfs_init_locked(struct inode *inode, void *opaque) ...@@ -692,33 +691,15 @@ nfs_init_locked(struct inode *inode, void *opaque)
return 0; return 0;
} }
/*
* This is our own version of iget that looks up inodes by file handle
* instead of inode number. We use this technique instead of using
* the vfs read_inode function because there is no way to pass the
* file handle or current attributes into the read_inode function.
*
*/
struct inode *
nfs_fhget(struct dentry *dentry, struct nfs_fh *fhandle,
struct nfs_fattr *fattr)
{
struct super_block *sb = dentry->d_sb;
dprintk("NFS: nfs_fhget(%s/%s fileid=%Ld)\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
(long long)fattr->fileid);
return __nfs_fhget(sb, fhandle, fattr);
}
/* Don't use READDIRPLUS on directories that we believe are too large */ /* Don't use READDIRPLUS on directories that we believe are too large */
#define NFS_LIMIT_READDIRPLUS (8*PAGE_SIZE) #define NFS_LIMIT_READDIRPLUS (8*PAGE_SIZE)
/* /*
* Look up the inode by super block and fattr->fileid. * This is our front-end to iget that looks up inodes by file handle
* instead of inode number.
*/ */
static struct inode * struct inode *
__nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
{ {
struct nfs_find_desc desc = { struct nfs_find_desc desc = {
.fh = fh, .fh = fh,
...@@ -801,7 +782,7 @@ __nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) ...@@ -801,7 +782,7 @@ __nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
unlock_new_inode(inode); unlock_new_inode(inode);
} else } else
nfs_refresh_inode(inode, fattr); nfs_refresh_inode(inode, fattr);
dprintk("NFS: __nfs_fhget(%s/%Ld ct=%d)\n", dprintk("NFS: nfs_fhget(%s/%Ld ct=%d)\n",
inode->i_sb->s_id, inode->i_sb->s_id,
(long long)NFS_FILEID(inode), (long long)NFS_FILEID(inode),
atomic_read(&inode->i_count)); atomic_read(&inode->i_count));
...@@ -810,7 +791,7 @@ __nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) ...@@ -810,7 +791,7 @@ __nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
return inode; return inode;
out_no_inode: out_no_inode:
printk("__nfs_fhget: iget failed\n"); printk("nfs_fhget: iget failed\n");
goto out; goto out;
} }
......
...@@ -238,7 +238,7 @@ loff_t req_offset(struct nfs_page *req) ...@@ -238,7 +238,7 @@ loff_t req_offset(struct nfs_page *req)
* linux/fs/nfs/inode.c * linux/fs/nfs/inode.c
*/ */
extern void nfs_zap_caches(struct inode *); extern void nfs_zap_caches(struct inode *);
extern struct inode *nfs_fhget(struct dentry *, struct nfs_fh *, extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,
struct nfs_fattr *); struct nfs_fattr *);
extern int __nfs_refresh_inode(struct inode *, struct nfs_fattr *); extern int __nfs_refresh_inode(struct inode *, struct nfs_fattr *);
extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment