From 1b3f48da0349fded9fd64fe394d53368bad1f8b4 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Tue, 7 Oct 2003 07:43:43 -0400 Subject: [PATCH] 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. --- fs/nfs/dir.c | 4 ++-- fs/nfs/inode.c | 33 +++++++-------------------------- include/linux/nfs_fs.h | 2 +- 3 files changed, 10 insertions(+), 29 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 57acac9718904..6587f4ede169d 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -688,7 +688,7 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru goto out_unlock; } error = -EACCES; - inode = nfs_fhget(dentry, &fhandle, &fattr); + inode = nfs_fhget(dentry->d_sb, &fhandle, &fattr); if (!inode) goto out_unlock; no_entry: @@ -791,7 +791,7 @@ static int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fhandle, if (error) goto out_err; } - inode = nfs_fhget(dentry, fhandle, fattr); + inode = nfs_fhget(dentry->d_sb, fhandle, fattr); if (inode) { d_instantiate(dentry, inode); nfs_renew_times(dentry); diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 4ed5e21d1f7d2..2607af8c6f1eb 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -53,7 +53,6 @@ */ #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 *); static void nfs_invalidate_inode(struct inode *); @@ -273,7 +272,7 @@ nfs_get_root(struct inode **rooti, rpc_authflavor_t authflavor, struct super_blo return error; } - *rooti = __nfs_fhget(sb, rootfh, &fattr); + *rooti = nfs_fhget(sb, rootfh, &fattr); if (error == -EACCES && authflavor > RPC_AUTH_MAXFLAVOR) { if (*rooti) { NFS_FLAGS(*rooti) |= NFS_INO_FAKE_ROOT; @@ -692,33 +691,15 @@ nfs_init_locked(struct inode *inode, void *opaque) 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 */ #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 * -__nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) +struct inode * +nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) { struct nfs_find_desc desc = { .fh = fh, @@ -801,7 +782,7 @@ __nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr) unlock_new_inode(inode); } else 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, (long long)NFS_FILEID(inode), atomic_read(&inode->i_count)); @@ -810,7 +791,7 @@ out: return inode; out_no_inode: - printk("__nfs_fhget: iget failed\n"); + printk("nfs_fhget: iget failed\n"); goto out; } diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index be2bfde990445..7a87a46878a3d 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -238,7 +238,7 @@ loff_t req_offset(struct nfs_page *req) * linux/fs/nfs/inode.c */ 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 *); extern int __nfs_refresh_inode(struct inode *, struct nfs_fattr *); extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); -- 2.53.0