]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/jfs/namei.c
[PATCH] switch all filesystems over to d_obtain_alias
[linux-2.6-omap-h63xx.git] / fs / jfs / namei.c
index f8718de3505e9fc56805b5a338fbb244c59e3488..e199dde7b83c6b79db13297c9e27fb0ffd09e28f 100644 (file)
@@ -1455,19 +1455,17 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, struc
                free_UCSname(&key);
                if (rc == -ENOENT) {
                        d_add(dentry, NULL);
-                       return ERR_PTR(0);
+                       return NULL;
                } else if (rc) {
                        jfs_err("jfs_lookup: dtSearch returned %d", rc);
                        return ERR_PTR(rc);
                }
        }
 
-       ip = iget(dip->i_sb, inum);
-       if (ip == NULL || is_bad_inode(ip)) {
+       ip = jfs_iget(dip->i_sb, inum);
+       if (IS_ERR(ip)) {
                jfs_err("jfs_lookup: iget failed on inum %d", (uint) inum);
-               if (ip)
-                       iput(ip);
-               return ERR_PTR(-EACCES);
+               return ERR_CAST(ip);
        }
 
        dentry = d_splice_alias(ip, dentry);
@@ -1485,12 +1483,11 @@ static struct inode *jfs_nfs_get_inode(struct super_block *sb,
 
        if (ino == 0)
                return ERR_PTR(-ESTALE);
-       inode = iget(sb, ino);
-       if (inode == NULL)
-               return ERR_PTR(-ENOMEM);
+       inode = jfs_iget(sb, ino);
+       if (IS_ERR(inode))
+               return ERR_CAST(inode);
 
-       if (is_bad_inode(inode) ||
-           (generation && inode->i_generation != generation)) {
+       if (generation && inode->i_generation != generation) {
                iput(inode);
                return ERR_PTR(-ESTALE);
        }
@@ -1514,28 +1511,12 @@ struct dentry *jfs_fh_to_parent(struct super_block *sb, struct fid *fid,
 
 struct dentry *jfs_get_parent(struct dentry *dentry)
 {
-       struct super_block *sb = dentry->d_inode->i_sb;
-       struct dentry *parent = ERR_PTR(-ENOENT);
-       struct inode *inode;
        unsigned long parent_ino;
 
        parent_ino =
                le32_to_cpu(JFS_IP(dentry->d_inode)->i_dtroot.header.idotdot);
-       inode = iget(sb, parent_ino);
-       if (inode) {
-               if (is_bad_inode(inode)) {
-                       iput(inode);
-                       parent = ERR_PTR(-EACCES);
-               } else {
-                       parent = d_alloc_anon(inode);
-                       if (!parent) {
-                               parent = ERR_PTR(-ENOMEM);
-                               iput(inode);
-                       }
-               }
-       }
 
-       return parent;
+       return d_obtain_alias(jfs_iget(dentry->d_inode->i_sb, parent_ino));
 }
 
 const struct inode_operations jfs_dir_inode_operations = {
@@ -1562,7 +1543,10 @@ const struct file_operations jfs_dir_operations = {
        .read           = generic_read_dir,
        .readdir        = jfs_readdir,
        .fsync          = jfs_fsync,
-       .ioctl          = jfs_ioctl,
+       .unlocked_ioctl = jfs_ioctl,
+#ifdef CONFIG_COMPAT
+       .compat_ioctl   = jfs_compat_ioctl,
+#endif
 };
 
 static int jfs_ci_hash(struct dentry *dir, struct qstr *this)