Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mfashe...
[powerpc.git] / fs / ocfs2 / super.c
index cdf7339..4c29cd7 100644 (file)
 
 #include "buffer_head_io.h"
 
-/*
- * Globals
- */
-static spinlock_t ocfs2_globals_lock = SPIN_LOCK_UNLOCKED;
-
-static u32 osb_id;             /* Keeps track of next available OSB Id */
-
 static kmem_cache_t *ocfs2_inode_cachep = NULL;
 
 kmem_cache_t *ocfs2_lock_cache = NULL;
@@ -209,7 +202,7 @@ static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb)
 
        mlog_entry_void();
 
-       new = ocfs2_iget(osb, osb->root_blkno);
+       new = ocfs2_iget(osb, osb->root_blkno, OCFS2_FI_FLAG_SYSFILE);
        if (IS_ERR(new)) {
                status = PTR_ERR(new);
                mlog_errno(status);
@@ -217,7 +210,7 @@ static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb)
        }
        osb->root_inode = new;
 
-       new = ocfs2_iget(osb, osb->system_dir_blkno);
+       new = ocfs2_iget(osb, osb->system_dir_blkno, OCFS2_FI_FLAG_SYSFILE);
        if (IS_ERR(new)) {
                status = PTR_ERR(new);
                mlog_errno(status);
@@ -642,10 +635,9 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
 
        ocfs2_complete_mount_recovery(osb);
 
-       printk("ocfs2: Mounting device (%u,%u) on (node %d, slot %d) with %s "
-              "data mode.\n",
-              MAJOR(sb->s_dev), MINOR(sb->s_dev), osb->node_num,
-              osb->slot_num,
+       printk(KERN_INFO "ocfs2: Mounting device (%s) on (node %d, slot %d) "
+              "with %s data mode.\n",
+              osb->dev_str, osb->node_num, osb->slot_num,
               osb->s_mount_opt & OCFS2_MOUNT_DATA_WRITEBACK ? "writeback" :
               "ordered");
 
@@ -690,7 +682,7 @@ static struct file_system_type ocfs2_fs_type = {
        .kill_sb        = kill_block_super, /* set to the generic one
                                             * right now, but do we
                                             * need to change that? */
-       .fs_flags       = FS_REQUIRES_DEV,
+       .fs_flags       = FS_REQUIRES_DEV|FS_RENAME_DOES_D_MOVE,
        .next           = NULL
 };
 
@@ -800,10 +792,6 @@ static int __init ocfs2_init(void)
                goto leave;
        }
 
-       spin_lock(&ocfs2_globals_lock);
-       osb_id = 0;
-       spin_unlock(&ocfs2_globals_lock);
-
        ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL);
        if (!ocfs2_debugfs_root) {
                status = -EFAULT;
@@ -1020,7 +1008,7 @@ static int ocfs2_fill_local_node_info(struct ocfs2_super *osb)
                goto bail;
        }
 
-       mlog(ML_NOTICE, "I am node %d\n", osb->node_num);
+       mlog(0, "I am node %d\n", osb->node_num);
 
        status = 0;
 bail:
@@ -1191,8 +1179,8 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err)
 
        atomic_set(&osb->vol_state, VOLUME_DISMOUNTED);
 
-       printk("ocfs2: Unmounting device (%u,%u) on (node %d)\n",
-              MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev), osb->node_num);
+       printk(KERN_INFO "ocfs2: Unmounting device (%s) on (node %d)\n",
+              osb->dev_str, osb->node_num);
 
        ocfs2_delete_osb(osb);
        kfree(osb);
@@ -1212,8 +1200,6 @@ static int ocfs2_setup_osb_uuid(struct ocfs2_super *osb, const unsigned char *uu
        if (osb->uuid_str == NULL)
                return -ENOMEM;
 
-       memcpy(osb->uuid, uuid, OCFS2_VOL_UUID_LEN);
-
        for (i = 0, ptr = osb->uuid_str; i < OCFS2_VOL_UUID_LEN; i++) {
                /* print with null */
                ret = snprintf(ptr, 3, "%02X", uuid[i]);
@@ -1311,13 +1297,6 @@ static int ocfs2_initialize_super(struct super_block *sb,
                goto bail;
        }
 
-       osb->uuid = kmalloc(OCFS2_VOL_UUID_LEN, GFP_KERNEL);
-       if (!osb->uuid) {
-               mlog(ML_ERROR, "unable to alloc uuid\n");
-               status = -ENOMEM;
-               goto bail;
-       }
-
        di = (struct ocfs2_dinode *)bh->b_data;
 
        osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots);
@@ -1327,7 +1306,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
                status = -EINVAL;
                goto bail;
        }
-       mlog(ML_NOTICE, "max_slots for this device: %u\n", osb->max_slots);
+       mlog(0, "max_slots for this device: %u\n", osb->max_slots);
 
        init_waitqueue_head(&osb->osb_wipe_event);
        osb->osb_orphan_wipes = kcalloc(osb->max_slots,
@@ -1418,7 +1397,7 @@ static int ocfs2_initialize_super(struct super_block *sb,
                goto bail;
        }
 
-       memcpy(&uuid_net_key, &osb->uuid[i], sizeof(osb->net_key));
+       memcpy(&uuid_net_key, di->id2.i_super.s_uuid, sizeof(uuid_net_key));
        osb->net_key = le32_to_cpu(uuid_net_key);
 
        strncpy(osb->vol_label, di->id2.i_super.s_label, 63);
@@ -1463,8 +1442,13 @@ static int ocfs2_initialize_super(struct super_block *sb,
 
        osb->bitmap_blkno = OCFS2_I(inode)->ip_blkno;
 
+       /* We don't have a cluster lock on the bitmap here because
+        * we're only interested in static information and the extra
+        * complexity at mount time isn't worht it. Don't pass the
+        * inode in to the read function though as we don't want it to
+        * be put in the cache. */
        status = ocfs2_read_block(osb, osb->bitmap_blkno, &bitmap_bh, 0,
-                                 inode);
+                                 NULL);
        iput(inode);
        if (status < 0) {
                mlog_errno(status);
@@ -1473,7 +1457,6 @@ static int ocfs2_initialize_super(struct super_block *sb,
 
        di = (struct ocfs2_dinode *) bitmap_bh->b_data;
        osb->bitmap_cpg = le16_to_cpu(di->id2.i_chain.cl_cpg);
-       osb->num_clusters = le32_to_cpu(di->id1.bitmap1.i_total);
        brelse(bitmap_bh);
        mlog(0, "cluster bitmap inode: %llu, clusters per group: %u\n",
             (unsigned long long)osb->bitmap_blkno, osb->bitmap_cpg);
@@ -1484,18 +1467,6 @@ static int ocfs2_initialize_super(struct super_block *sb,
                goto bail;
        }
 
-       /*  Link this osb onto the global linked list of all osb structures. */
-       /*  The Global Link List is mainted for the whole driver . */
-       spin_lock(&ocfs2_globals_lock);
-       osb->osb_id = osb_id;
-       if (osb_id < OCFS2_MAX_OSB_ID)
-               osb_id++;
-       else {
-               mlog(ML_ERROR, "Too many volumes mounted\n");
-               status = -ENOMEM;
-       }
-       spin_unlock(&ocfs2_globals_lock);
-
 bail:
        mlog_exit(status);
        return status;