]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/gfs2/ops_export.c
Pull vector-domain into release branch
[linux-2.6-omap-h63xx.git] / fs / gfs2 / ops_export.c
index 51a8a14deb29df71c605f64b78f02c05d9fe89c7..b8312edee0e45dc89787f042b350c679e85a6ac6 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/spinlock.h>
 #include <linux/completion.h>
 #include <linux/buffer_head.h>
+#include <linux/exportfs.h>
 #include <linux/gfs2_ondisk.h>
 #include <linux/crc32.h>
 #include <linux/lm_interface.h>
 #include "glops.h"
 #include "inode.h"
 #include "ops_dentry.h"
-#include "ops_export.h"
+#include "ops_fstype.h"
 #include "rgrp.h"
 #include "util.h"
 
+#define GFS2_SMALL_FH_SIZE 4
+#define GFS2_LARGE_FH_SIZE 8
+#define GFS2_OLD_FH_SIZE 10
+
 static struct dentry *gfs2_decode_fh(struct super_block *sb,
                                     __u32 *p,
                                     int fh_len,
@@ -35,31 +40,28 @@ static struct dentry *gfs2_decode_fh(struct super_block *sb,
                                     void *context)
 {
        __be32 *fh = (__force __be32 *)p;
-       struct gfs2_fh_obj fh_obj;
-       struct gfs2_inum_host *this, parent;
+       struct gfs2_inum_host inum, parent;
 
-       this            = &fh_obj.this;
-       fh_obj.imode    = DT_UNKNOWN;
        memset(&parent, 0, sizeof(struct gfs2_inum));
 
        switch (fh_len) {
        case GFS2_LARGE_FH_SIZE:
+       case GFS2_OLD_FH_SIZE:
                parent.no_formal_ino = ((u64)be32_to_cpu(fh[4])) << 32;
                parent.no_formal_ino |= be32_to_cpu(fh[5]);
                parent.no_addr = ((u64)be32_to_cpu(fh[6])) << 32;
                parent.no_addr |= be32_to_cpu(fh[7]);
-               fh_obj.imode = be32_to_cpu(fh[8]);
        case GFS2_SMALL_FH_SIZE:
-               this->no_formal_ino = ((u64)be32_to_cpu(fh[0])) << 32;
-               this->no_formal_ino |= be32_to_cpu(fh[1]);
-               this->no_addr = ((u64)be32_to_cpu(fh[2])) << 32;
-               this->no_addr |= be32_to_cpu(fh[3]);
+               inum.no_formal_ino = ((u64)be32_to_cpu(fh[0])) << 32;
+               inum.no_formal_ino |= be32_to_cpu(fh[1]);
+               inum.no_addr = ((u64)be32_to_cpu(fh[2])) << 32;
+               inum.no_addr |= be32_to_cpu(fh[3]);
                break;
        default:
                return NULL;
        }
 
-       return gfs2_export_ops.find_exported_dentry(sb, &fh_obj, &parent,
+       return gfs2_export_ops.find_exported_dentry(sb, &inum, &parent,
                                                    acceptable, context);
 }
 
@@ -94,9 +96,6 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *p, int *len,
        fh[5] = cpu_to_be32(ip->i_no_formal_ino & 0xFFFFFFFF);
        fh[6] = cpu_to_be32(ip->i_no_addr >> 32);
        fh[7] = cpu_to_be32(ip->i_no_addr & 0xFFFFFFFF);
-
-       fh[8]  = cpu_to_be32(inode->i_mode);
-       fh[9]  = 0;     /* pad to double word */
        *len = GFS2_LARGE_FH_SIZE;
 
        iput(inode);
@@ -193,8 +192,7 @@ static struct dentry *gfs2_get_parent(struct dentry *child)
 static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj)
 {
        struct gfs2_sbd *sdp = sb->s_fs_info;
-       struct gfs2_fh_obj *fh_obj = (struct gfs2_fh_obj *)inum_obj;
-       struct gfs2_inum_host *inum = &fh_obj->this;
+       struct gfs2_inum_host *inum = inum_obj;
        struct gfs2_holder i_gh, ri_gh, rgd_gh;
        struct gfs2_rgrpd *rgd;
        struct inode *inode;
@@ -237,7 +235,9 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj)
        gfs2_glock_dq_uninit(&rgd_gh);
        gfs2_glock_dq_uninit(&ri_gh);
 
-       inode = gfs2_inode_lookup(sb, inum->no_addr, fh_obj->imode);
+       inode = gfs2_inode_lookup(sb, DT_UNKNOWN,
+                                       inum->no_addr,
+                                       0);
        if (!inode)
                goto fail;
        if (IS_ERR(inode)) {
@@ -250,6 +250,11 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb, void *inum_obj)
                iput(inode);
                goto fail;
        }
+
+       /* Pick up the works we bypass in gfs2_inode_lookup */
+       if (inode->i_state & I_NEW) 
+               gfs2_set_iop(inode);
+
        if (GFS2_I(inode)->i_no_formal_ino != inum->no_formal_ino) {
                iput(inode);
                goto fail;