[SCSI] qla4xxx: Fix srb lookup in qla4xxx_eh_device_reset
[safe/jmp/linux-2.6] / fs / gfs2 / ops_fstype.c
index 2cd1164..7bc3c45 100644 (file)
@@ -33,6 +33,7 @@
 #include "log.h"
 #include "quota.h"
 #include "dir.h"
+#include "trace_gfs2.h"
 
 #define DO 0
 #define UNDO 1
@@ -525,11 +526,11 @@ static int init_sb(struct gfs2_sbd *sdp, int silent)
        }
 
        /* Set up the buffer cache and SB for real */
-       if (sdp->sd_sb.sb_bsize < bdev_hardsect_size(sb->s_bdev)) {
+       if (sdp->sd_sb.sb_bsize < bdev_logical_block_size(sb->s_bdev)) {
                ret = -EINVAL;
                fs_err(sdp, "FS block size (%u) is too small for device "
                       "block size (%u)\n",
-                      sdp->sd_sb.sb_bsize, bdev_hardsect_size(sb->s_bdev));
+                      sdp->sd_sb.sb_bsize, bdev_logical_block_size(sb->s_bdev));
                goto out;
        }
        if (sdp->sd_sb.sb_bsize > PAGE_SIZE) {
@@ -775,6 +776,7 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
                /* Map the extents for this journal's blocks */
                map_journal_extents(sdp);
        }
+       trace_gfs2_log_blocks(sdp, atomic_read(&sdp->sd_log_blks_free));
 
        if (sdp->sd_lockstruct.ls_first) {
                unsigned int x;
@@ -1273,9 +1275,22 @@ static int gfs2_get_sb(struct file_system_type *fs_type, int flags,
        return get_sb_bdev(fs_type, flags, dev_name, data, fill_super, mnt);
 }
 
-static struct super_block *get_gfs2_sb(const char *dev_name)
+static int test_meta_super(struct super_block *s, void *ptr)
 {
-       struct super_block *sb;
+       struct block_device *bdev = ptr;
+       return (bdev == s->s_bdev);
+}
+
+static int set_meta_super(struct super_block *s, void *ptr)
+{
+       return -EINVAL;
+}
+
+static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags,
+                           const char *dev_name, void *data, struct vfsmount *mnt)
+{
+       struct super_block *s;
+       struct gfs2_sbd *sdp;
        struct path path;
        int error;
 
@@ -1283,30 +1298,17 @@ static struct super_block *get_gfs2_sb(const char *dev_name)
        if (error) {
                printk(KERN_WARNING "GFS2: path_lookup on %s returned error %d\n",
                       dev_name, error);
-               return NULL;
+               return error;
        }
-       sb = path.dentry->d_inode->i_sb;
-       if (sb && (sb->s_type == &gfs2_fs_type))
-               atomic_inc(&sb->s_active);
-       else
-               sb = NULL;
+       s = sget(&gfs2_fs_type, test_meta_super, set_meta_super,
+                path.dentry->d_inode->i_sb->s_bdev);
        path_put(&path);
-       return sb;
-}
-
-static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags,
-                           const char *dev_name, void *data, struct vfsmount *mnt)
-{
-       struct super_block *sb = NULL;
-       struct gfs2_sbd *sdp;
-
-       sb = get_gfs2_sb(dev_name);
-       if (!sb) {
+       if (IS_ERR(s)) {
                printk(KERN_WARNING "GFS2: gfs2 mount does not exist\n");
-               return -ENOENT;
+               return PTR_ERR(s);
        }
-       sdp = sb->s_fs_info;
-       mnt->mnt_sb = sb;
+       sdp = s->s_fs_info;
+       mnt->mnt_sb = s;
        mnt->mnt_root = dget(sdp->sd_master_dir);
        return 0;
 }