BUG_ON() Conversion in fs/dquot.c
[safe/jmp/linux-2.6] / fs / ext3 / super.c
index 7c45acf..f8a5266 100644 (file)
@@ -472,7 +472,7 @@ static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
 #ifdef CONFIG_EXT3_FS_XATTR
                init_rwsem(&ei->xattr_sem);
 #endif
-               init_MUTEX(&ei->truncate_sem);
+               mutex_init(&ei->truncate_mutex);
                inode_init_once(&ei->vfs_inode);
        }
 }
@@ -481,7 +481,8 @@ static int init_inodecache(void)
 {
        ext3_inode_cachep = kmem_cache_create("ext3_inode_cache",
                                             sizeof(struct ext3_inode_info),
-                                            0, SLAB_RECLAIM_ACCOUNT,
+                                            0, (SLAB_RECLAIM_ACCOUNT|
+                                               SLAB_MEM_SPREAD),
                                             init_once, NULL);
        if (ext3_inode_cachep == NULL)
                return -ENOMEM;
@@ -1677,12 +1678,6 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent)
        }
 
        if (test_opt(sb, NOBH)) {
-               if (sb->s_blocksize_bits != PAGE_CACHE_SHIFT) {
-                       printk(KERN_WARNING "EXT3-fs: Ignoring nobh option "
-                               "since filesystem blocksize doesn't match "
-                               "pagesize\n");
-                       clear_opt(sbi->s_mount_opt, NOBH);
-               }
                if (!(test_opt(sb, DATA_FLAGS) == EXT3_MOUNT_WRITEBACK_DATA)) {
                        printk(KERN_WARNING "EXT3-fs: Ignoring nobh option - "
                                "its supported only with writeback mode\n");
@@ -2150,7 +2145,7 @@ int ext3_force_commit(struct super_block *sb)
 
 static void ext3_write_super (struct super_block * sb)
 {
-       if (down_trylock(&sb->s_lock) == 0)
+       if (mutex_trylock(&sb->s_lock) != 0)
                BUG();
        sb->s_dirt = 0;
 }
@@ -2325,7 +2320,8 @@ restore_opts:
 
 static int ext3_statfs (struct super_block * sb, struct kstatfs * buf)
 {
-       struct ext3_super_block *es = EXT3_SB(sb)->s_es;
+       struct ext3_sb_info *sbi = EXT3_SB(sb);
+       struct ext3_super_block *es = sbi->s_es;
        unsigned long overhead;
        int i;
 
@@ -2367,12 +2363,12 @@ static int ext3_statfs (struct super_block * sb, struct kstatfs * buf)
        buf->f_type = EXT3_SUPER_MAGIC;
        buf->f_bsize = sb->s_blocksize;
        buf->f_blocks = le32_to_cpu(es->s_blocks_count) - overhead;
-       buf->f_bfree = ext3_count_free_blocks (sb);
+       buf->f_bfree = percpu_counter_sum(&sbi->s_freeblocks_counter);
        buf->f_bavail = buf->f_bfree - le32_to_cpu(es->s_r_blocks_count);
        if (buf->f_bfree < le32_to_cpu(es->s_r_blocks_count))
                buf->f_bavail = 0;
        buf->f_files = le32_to_cpu(es->s_inodes_count);
-       buf->f_ffree = ext3_count_free_inodes (sb);
+       buf->f_ffree = percpu_counter_sum(&sbi->s_freeinodes_counter);
        buf->f_namelen = EXT3_NAME_LEN;
        return 0;
 }
@@ -2382,8 +2378,8 @@ static int ext3_statfs (struct super_block * sb, struct kstatfs * buf)
  * Process 1                         Process 2
  * ext3_create()                     quota_sync()
  *   journal_start()                   write_dquot()
- *   DQUOT_INIT()                        down(dqio_sem)
- *     down(dqio_sem)                    journal_start()
+ *   DQUOT_INIT()                        down(dqio_mutex)
+ *     down(dqio_mutex)                    journal_start()
  *
  */
 
@@ -2601,7 +2597,7 @@ static ssize_t ext3_quota_write(struct super_block *sb, int type,
        struct buffer_head *bh;
        handle_t *handle = journal_current_handle();
 
-       down(&inode->i_sem);
+       mutex_lock(&inode->i_mutex);
        while (towrite > 0) {
                tocopy = sb->s_blocksize - offset < towrite ?
                                sb->s_blocksize - offset : towrite;
@@ -2644,7 +2640,7 @@ out:
        inode->i_version++;
        inode->i_mtime = inode->i_ctime = CURRENT_TIME;
        ext3_mark_inode_dirty(handle, inode);
-       up(&inode->i_sem);
+       mutex_unlock(&inode->i_mutex);
        return len - towrite;
 }