linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / fs / super.c
index d325036..c0993b9 100644 (file)
 #include <linux/writeback.h>           /* for the emergency remount stuff */
 #include <linux/idr.h>
 #include <linux/kobject.h>
-#include <linux/mutex.h>
 #include <linux/devpts_fs.h>
 #include <linux/proc_fs.h>
 #include <asm/uaccess.h>
+#include <linux/vs_base.h>
 
 
 void get_filesystem(struct file_system_type *fs);
@@ -58,10 +58,11 @@ DEFINE_SPINLOCK(sb_lock);
  */
 static struct super_block *alloc_super(void)
 {
-       struct super_block *s = kzalloc(sizeof(struct super_block),  GFP_USER);
+       struct super_block *s = kmalloc(sizeof(struct super_block),  GFP_USER);
        static struct super_operations default_op;
 
        if (s) {
+               memset(s, 0, sizeof(struct super_block));
                if (security_sb_alloc(s)) {
                        kfree(s);
                        s = NULL;
@@ -78,9 +79,9 @@ static struct super_block *alloc_super(void)
                down_write(&s->s_umount);
                s->s_count = S_BIAS;
                atomic_set(&s->s_active, 1);
-               mutex_init(&s->s_vfs_rename_mutex);
-               mutex_init(&s->s_dquot.dqio_mutex);
-               mutex_init(&s->s_dquot.dqonoff_mutex);
+               sema_init(&s->s_vfs_rename_sem,1);
+               sema_init(&s->s_dquot.dqio_sem, 1);
+               sema_init(&s->s_dquot.dqonoff_sem, 1);
                init_rwsem(&s->s_dquot.dqptr_sem);
                init_waitqueue_head(&s->s_wait_unfrozen);
                s->s_maxbytes = MAX_NON_LFS;
@@ -383,9 +384,9 @@ restart:
 void sync_filesystems(int wait)
 {
        struct super_block *sb;
-       static DEFINE_MUTEX(mutex);
+       static DECLARE_MUTEX(mutex);
 
-       mutex_lock(&mutex);             /* Could be down_interruptible */
+       down(&mutex);           /* Could be down_interruptible */
        spin_lock(&sb_lock);
        list_for_each_entry(sb, &super_blocks, s_list) {
                if (!sb->s_op->sync_fs)
@@ -414,7 +415,7 @@ restart:
                        goto restart;
        }
        spin_unlock(&sb_lock);
-       mutex_unlock(&mutex);
+       up(&mutex);
 }
 
 /**
@@ -695,9 +696,9 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type,
         * will protect the lockfs code from trying to start a snapshot
         * while we are mounting
         */
-       mutex_lock(&bdev->bd_mount_mutex);
+       down(&bdev->bd_mount_sem);
        s = sget(fs_type, test_bdev_super, set_bdev_super, bdev);
-       mutex_unlock(&bdev->bd_mount_mutex);
+       up(&bdev->bd_mount_sem);
        if (IS_ERR(s))
                goto out;
 
@@ -714,7 +715,7 @@ struct super_block *get_sb_bdev(struct file_system_type *fs_type,
                s->s_flags = flags;
                strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
                sb_set_blocksize(s, block_size(bdev));
-               error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
+               error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0);
                if (error) {
                        up_write(&s->s_umount);
                        deactivate_super(s);
@@ -758,7 +759,7 @@ struct super_block *get_sb_nodev(struct file_system_type *fs_type,
 
        s->s_flags = flags;
 
-       error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
+       error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0);
        if (error) {
                up_write(&s->s_umount);
                deactivate_super(s);
@@ -787,7 +788,7 @@ struct super_block *get_sb_single(struct file_system_type *fs_type,
                return s;
        if (!s->s_root) {
                s->s_flags = flags;
-               error = fill_super(s, data, flags & MS_SILENT ? 1 : 0);
+               error = fill_super(s, data, flags & MS_VERBOSE ? 1 : 0);
                if (error) {
                        up_write(&s->s_umount);
                        deactivate_super(s);