proc: partially revert "procfs: provide stack information for threads"
[safe/jmp/linux-2.6] / fs / gfs2 / dir.c
index d8d8232..25fddc1 100644 (file)
@@ -36,7 +36,7 @@
  * the block.  In leaves, they begin at offset sizeof(struct gfs2_leaf) from the
  * beginning of the leaf block. The dirents reside in leaves when
  *
- * dip->i_di.di_flags & GFS2_DIF_EXHASH is true
+ * dip->i_diskflags & GFS2_DIF_EXHASH is true
  *
  * Otherwise, the dirents are "linear", within a single stuffed dinode block.
  *
@@ -60,7 +60,6 @@
 #include <linux/gfs2_ondisk.h>
 #include <linux/crc32.h>
 #include <linux/vmalloc.h>
-#include <linux/lm_interface.h>
 
 #include "gfs2.h"
 #include "incore.h"
@@ -526,38 +525,6 @@ consist_inode:
        return ERR_PTR(-EIO);
 }
 
-
-/**
- * dirent_first - Return the first dirent
- * @dip: the directory
- * @bh: The buffer
- * @dent: Pointer to list of dirents
- *
- * return first dirent whether bh points to leaf or stuffed dinode
- *
- * Returns: IS_LEAF, IS_DINODE, or -errno
- */
-
-static int dirent_first(struct gfs2_inode *dip, struct buffer_head *bh,
-                       struct gfs2_dirent **dent)
-{
-       struct gfs2_meta_header *h = (struct gfs2_meta_header *)bh->b_data;
-
-       if (be32_to_cpu(h->mh_type) == GFS2_METATYPE_LF) {
-               if (gfs2_meta_check(GFS2_SB(&dip->i_inode), bh))
-                       return -EIO;
-               *dent = (struct gfs2_dirent *)(bh->b_data +
-                                              sizeof(struct gfs2_leaf));
-               return IS_LEAF;
-       } else {
-               if (gfs2_metatype_check(GFS2_SB(&dip->i_inode), bh, GFS2_METATYPE_DI))
-                       return -EIO;
-               *dent = (struct gfs2_dirent *)(bh->b_data +
-                                              sizeof(struct gfs2_dinode));
-               return IS_DINODE;
-       }
-}
-
 static int dirent_check_reclen(struct gfs2_inode *dip,
                               const struct gfs2_dirent *d, const void *end_p)
 {
@@ -755,7 +722,7 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
        struct gfs2_inode *ip = GFS2_I(inode);
        int error;
 
-       if (ip->i_di.di_flags & GFS2_DIF_EXHASH) {
+       if (ip->i_diskflags & GFS2_DIF_EXHASH) {
                struct gfs2_leaf *leaf;
                unsigned hsize = 1 << ip->i_depth;
                unsigned index;
@@ -804,13 +771,20 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh,
 {
        struct gfs2_inode *ip = GFS2_I(inode);
        unsigned int n = 1;
-       u64 bn = gfs2_alloc_block(ip, &n);
-       struct buffer_head *bh = gfs2_meta_new(ip->i_gl, bn);
+       u64 bn;
+       int error;
+       struct buffer_head *bh;
        struct gfs2_leaf *leaf;
        struct gfs2_dirent *dent;
        struct qstr name = { .name = "", .len = 0, .hash = 0 };
+
+       error = gfs2_alloc_block(ip, &bn, &n);
+       if (error)
+               return NULL;
+       bh = gfs2_meta_new(ip->i_gl, bn);
        if (!bh)
                return NULL;
+
        gfs2_trans_add_unrevoke(GFS2_SB(inode), bn, 1);
        gfs2_trans_add_bh(ip->i_gl, bh, 1);
        gfs2_metatype_set(bh, GFS2_METATYPE_LF, GFS2_FORMAT_LF);
@@ -907,7 +881,7 @@ static int dir_make_exhash(struct inode *inode)
 
        dip->i_disksize = sdp->sd_sb.sb_bsize / 2;
        gfs2_add_inode_blocks(&dip->i_inode, 1);
-       dip->i_di.di_flags |= GFS2_DIF_EXHASH;
+       dip->i_diskflags |= GFS2_DIF_EXHASH;
 
        for (x = sdp->sd_hash_ptrs, y = -1; x; x >>= 1, y++) ;
        dip->i_depth = y;
@@ -1000,7 +974,7 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
        divider = (start + half_len) << (32 - dip->i_depth);
 
        /*  Copy the entries  */
-       dirent_first(dip, obh, &dent);
+       dent = (struct gfs2_dirent *)(obh->b_data + sizeof(struct gfs2_leaf));
 
        do {
                next = dent;
@@ -1429,7 +1403,7 @@ int gfs2_dir_read(struct inode *inode, u64 *offset, void *opaque,
        if (!dip->i_entries)
                return 0;
 
-       if (dip->i_di.di_flags & GFS2_DIF_EXHASH)
+       if (dip->i_diskflags & GFS2_DIF_EXHASH)
                return dir_e_read(inode, offset, opaque, filldir);
 
        if (!gfs2_is_stuffed(dip)) {
@@ -1612,7 +1586,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
                        dent = gfs2_init_dirent(inode, dent, name, bh);
                        gfs2_inum_out(nip, dent);
                        dent->de_type = cpu_to_be16(type);
-                       if (ip->i_di.di_flags & GFS2_DIF_EXHASH) {
+                       if (ip->i_diskflags & GFS2_DIF_EXHASH) {
                                leaf = (struct gfs2_leaf *)bh->b_data;
                                be16_add_cpu(&leaf->lf_entries, 1);
                        }
@@ -1628,7 +1602,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
                        error = 0;
                        break;
                }
-               if (!(ip->i_di.di_flags & GFS2_DIF_EXHASH)) {
+               if (!(ip->i_diskflags & GFS2_DIF_EXHASH)) {
                        error = dir_make_exhash(inode);
                        if (error)
                                break;
@@ -1691,7 +1665,7 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name)
        }
 
        dirent_del(dip, bh, prev, dent);
-       if (dip->i_di.di_flags & GFS2_DIF_EXHASH) {
+       if (dip->i_diskflags & GFS2_DIF_EXHASH) {
                struct gfs2_leaf *leaf = (struct gfs2_leaf *)bh->b_data;
                u16 entries = be16_to_cpu(leaf->lf_entries);
                if (!entries)
@@ -1748,7 +1722,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
        gfs2_inum_out(nip, dent);
        dent->de_type = cpu_to_be16(new_type);
 
-       if (dip->i_di.di_flags & GFS2_DIF_EXHASH) {
+       if (dip->i_diskflags & GFS2_DIF_EXHASH) {
                brelse(bh);
                error = gfs2_meta_inode_buffer(dip, &bh);
                if (error)