GFS2: Banish struct gfs2_dinode_host
[safe/jmp/linux-2.6] / fs / gfs2 / ops_export.c
index 990d9f4..7fdeb14 100644 (file)
@@ -22,8 +22,7 @@
 #include "glock.h"
 #include "glops.h"
 #include "inode.h"
-#include "ops_dentry.h"
-#include "ops_fstype.h"
+#include "super.h"
 #include "rgrp.h"
 #include "util.h"
 
@@ -130,28 +129,17 @@ static int gfs2_get_name(struct dentry *parent, char *name,
 static struct dentry *gfs2_get_parent(struct dentry *child)
 {
        struct qstr dotdot;
-       struct inode *inode;
        struct dentry *dentry;
 
-       gfs2_str2qstr(&dotdot, "..");
-       inode = gfs2_lookupi(child->d_inode, &dotdot, 1, NULL);
-
-       if (!inode)
-               return ERR_PTR(-ENOENT);
        /*
-        * In case of an error, @inode carries the error value, and we
-        * have to return that as a(n invalid) pointer to dentry.
+        * XXX(hch): it would be a good idea to keep this around as a
+        *           static variable.
         */
-       if (IS_ERR(inode))
-               return ERR_CAST(inode);
-
-       dentry = d_alloc_anon(inode);
-       if (!dentry) {
-               iput(inode);
-               return ERR_PTR(-ENOMEM);
-       }
+       gfs2_str2qstr(&dotdot, "..");
 
-       dentry->d_op = &gfs2_dops;
+       dentry = d_obtain_alias(gfs2_lookupi(child->d_inode, &dotdot, 1));
+       if (!IS_ERR(dentry))
+               dentry->d_op = &gfs2_dops;
        return dentry;
 }
 
@@ -225,7 +213,7 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb,
        }
 
        error = -EIO;
-       if (GFS2_I(inode)->i_di.di_flags & GFS2_DIF_SYSTEM) {
+       if (GFS2_I(inode)->i_diskflags & GFS2_DIF_SYSTEM) {
                iput(inode);
                goto fail;
        }
@@ -233,13 +221,9 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb,
        gfs2_glock_dq_uninit(&i_gh);
 
 out_inode:
-       dentry = d_alloc_anon(inode);
-       if (!dentry) {
-               iput(inode);
-               return ERR_PTR(-ENOMEM);
-       }
-
-       dentry->d_op = &gfs2_dops;
+       dentry = d_obtain_alias(inode);
+       if (!IS_ERR(dentry))
+               dentry->d_op = &gfs2_dops;
        return dentry;
 
 fail_rgd: