From: Eric Van Hensbergen This part of the patch contains the VFS inode interfaces changes related to hch's comments. Signed-off-by: Eric Van Hensbergen Signed-off-by: Andrew Morton --- fs/9p/vfs_inode.c | 63 ++++++------------------------------------------------ 1 files changed, 7 insertions(+), 56 deletions(-) diff -puN fs/9p/vfs_inode.c~v9fs-vfs-inode-operations-resend-take-2 fs/9p/vfs_inode.c --- devel/fs/9p/vfs_inode.c~v9fs-vfs-inode-operations-resend-take-2 2005-07-14 16:23:29.000000000 -0700 +++ devel-akpm/fs/9p/vfs_inode.c 2005-07-14 16:23:29.000000000 -0700 @@ -34,9 +34,9 @@ #include #include #include +#include #include "debug.h" -#include "idpool.h" #include "v9fs.h" #include "9p.h" #include "v9fs_vfs.h" @@ -276,7 +276,6 @@ struct inode *v9fs_get_inode(struct supe default: dprintk(DEBUG_ERROR, "BAD mode 0x%x S_IFMT 0x%x\n", mode, mode & S_IFMT); - sb->s_op->put_inode(inode); return ERR_PTR(-EINVAL); } } else { @@ -454,30 +453,14 @@ static int v9fs_remove(struct inode *dir dprintk(DEBUG_VFS, "inode: %p dentry: %p rmdir: %d\n", dir, file, rmdir); - if (!dir || !S_ISDIR(dir->i_mode)) { - dprintk(DEBUG_ERROR, "dir inode is NULL or not a directory\n"); - return -ENOENT; - } - - if (!file) { - dprintk(DEBUG_ERROR, "NO dentry for file to remove\n"); - return -EBADF; - } - - if (!file->d_inode) { - dprintk(DEBUG_ERROR, - "dentry %p NO INODE for file to remove!\n", file); - return -EBADF; - } - file_inode = file->d_inode; sb = file_inode->i_sb; v9ses = v9fs_inode2v9ses(file_inode); v9fid = v9fs_fid_lookup(file, FID_OP); - if (!sb || !v9ses || !v9fid) { + if (!v9fid) { dprintk(DEBUG_ERROR, - "no superblock or v9session or v9fs_fid\n"); + "no v9fs_fid\n"); return -EBADF; } @@ -488,14 +471,6 @@ static int v9fs_remove(struct inode *dir return -EBADF; } - if (rmdir && (!S_ISDIR(file_inode->i_mode))) { - dprintk(DEBUG_ERROR, "trying to remove non-directory\n"); - return -ENOTDIR; - } else if ((!rmdir) && S_ISDIR(file_inode->i_mode)) { - dprintk(DEBUG_ERROR, "trying to remove directory\n"); - return -EISDIR; - } - result = v9fs_t_remove(v9ses, fid, &fcall); if (result < 0) dprintk(DEBUG_ERROR, "remove of file fails: %s(%d)\n", @@ -506,7 +481,6 @@ static int v9fs_remove(struct inode *dir } kfree(fcall); - return result; } @@ -564,17 +538,12 @@ static struct dentry *v9fs_vfs_lookup(st dprintk(DEBUG_VFS, "dir: %p dentry: (%s) %p nameidata: %p\n", dir, dentry->d_iname, dentry, nameidata); - if (!dir) { - dprintk(DEBUG_ERROR, "no dir inode\n"); - return ERR_PTR(-EINVAL); - } - sb = dir->i_sb; v9ses = v9fs_inode2v9ses(dir); dirfid = v9fs_fid_lookup(dentry->d_parent, FID_WALK); - if (!sb || !v9ses || !dirfid) { - dprintk(DEBUG_ERROR, "no superblock, v9ses, or dirfid\n"); + if (!dirfid) { + dprintk(DEBUG_ERROR, "no dirfid\n"); return ERR_PTR(-EINVAL); } @@ -924,7 +893,7 @@ void v9fs_mistat2inode(struct v9fs_stat *mistat, struct inode *inode, struct super_block *sb) { - struct v9fs_session_info *v9ses = sb ? sb->s_fs_info : NULL; + struct v9fs_session_info *v9ses = sb->s_fs_info; inode->i_nlink = 1; @@ -935,7 +904,7 @@ v9fs_mistat2inode(struct v9fs_stat *mist inode->i_uid = -1; inode->i_gid = -1; - if (v9ses && v9ses->extended) { + if (v9ses->extended) { /* TODO: string to uid mapping via user-space daemon */ inode->i_uid = mistat->n_uid; inode->i_gid = mistat->n_gid; @@ -1051,9 +1020,7 @@ v9fs_vfs_symlink(struct inode *dir, stru goto FreeFcall; } - /* need to update dcache so we show up */ kfree(fcall); - fcall = NULL; if (v9fs_t_clunk(v9ses, newfid->fid, &fcall)) { dprintk(DEBUG_ERROR, "clunk for symlink failed: %s\n", @@ -1226,7 +1193,6 @@ v9fs_vfs_link(struct dentry *old_dentry, { int retval = -EPERM; struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir); - struct super_block *sb = dir ? dir->i_sb : NULL; struct v9fs_fcall *fcall = NULL; struct v9fs_stat *mistat = kmalloc(v9ses->maxdata, GFP_KERNEL); struct v9fs_fid *oldfid = v9fs_fid_lookup(old_dentry, FID_OP); @@ -1236,12 +1202,6 @@ v9fs_vfs_link(struct dentry *old_dentry, dprintk(DEBUG_VFS, " %lu,%s,%s\n", dir->i_ino, dentry->d_name.name, old_dentry->d_name.name); - if ((!dentry) || (!sb) || (!v9ses) || (!oldfid)) { - dprintk(DEBUG_ERROR, "problem with arguments\n"); - retval = -EBADF; - goto FreeMem; - } - if (!v9ses->extended) { dprintk(DEBUG_ERROR, "not extended\n"); goto FreeMem; @@ -1272,9 +1232,7 @@ v9fs_vfs_link(struct dentry *old_dentry, goto FreeMem; } - /* need to update dcache so we show up */ kfree(fcall); - fcall = NULL; if (v9fs_t_clunk(v9ses, newfid->fid, &fcall)) { dprintk(DEBUG_ERROR, "clunk for symlink failed: %s\n", @@ -1309,7 +1267,6 @@ v9fs_vfs_mknod(struct inode *dir, struct int retval = -EPERM; struct v9fs_fid *newfid; struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir); - struct super_block *sb = dir ? dir->i_sb : NULL; struct v9fs_fcall *fcall = NULL; struct v9fs_stat *mistat = kmalloc(v9ses->maxdata, GFP_KERNEL); char *symname = __getname(); @@ -1322,12 +1279,6 @@ v9fs_vfs_mknod(struct inode *dir, struct goto FreeMem; } - if ((!dentry) || (!sb) || (!v9ses)) { - dprintk(DEBUG_ERROR, "problem with arguments\n"); - retval = -EBADF; - goto FreeMem; - } - if (!v9ses->extended) { dprintk(DEBUG_ERROR, "not extended\n"); goto FreeMem; _