[GFS2] Fix a ref count bug and other clean ups
[powerpc.git] / fs / gfs2 / super.c
index fff5a96..a4da649 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/spinlock.h>
 #include <linux/completion.h>
 #include <linux/buffer_head.h>
+#include <linux/crc32.h>
 #include <linux/gfs2_ondisk.h>
 #include <asm/semaphore.h>
 
@@ -299,8 +300,9 @@ int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
                        break;
 
                name.len = sprintf(buf, "journal%u", sdp->sd_journals);
+               name.hash = gfs2_disk_hash(name.name, name.len);
 
-               error = gfs2_dir_search(sdp->sd_jindex->u.generic_ip,
+               error = gfs2_dir_search(sdp->sd_jindex,
                                        &name, NULL, NULL);
                if (error == -ENOENT) {
                        error = 0;
@@ -317,8 +319,12 @@ int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
                if (!jd)
                        break;
 
-               error = gfs2_lookupi(sdp->sd_jindex, &name, 1, &jd->jd_inode);
-               if (error) {
+               jd->jd_inode = gfs2_lookupi(sdp->sd_jindex, &name, 1, NULL);
+               if (!jd->jd_inode || IS_ERR(jd->jd_inode)) {
+                       if (!jd->jd_inode)
+                               error = -ENOENT;
+                       else
+                               error = PTR_ERR(jd->jd_inode);
                        kfree(jd);
                        break;
                }