]> Pileus Git - ~andy/linux/blobdiff - fs/ext4/mballoc.c
Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[~andy/linux] / fs / ext4 / mballoc.c
index 1cd6994fc446008b74dc9b77863edf0f24e14c33..08778f6cdfe9d07f07f08e0f69035a56ecd38083 100644 (file)
@@ -969,7 +969,6 @@ static int ext4_mb_get_buddy_page_lock(struct super_block *sb,
 
        block++;
        pnum = block / blocks_per_page;
-       poff = block % blocks_per_page;
        page = find_or_create_page(inode->i_mapping, pnum, GFP_NOFS);
        if (!page)
                return -EIO;
@@ -2077,8 +2076,9 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
        struct super_block *sb = seq->private;
        ext4_group_t group = (ext4_group_t) ((unsigned long) v);
        int i;
-       int err;
+       int err, buddy_loaded = 0;
        struct ext4_buddy e4b;
+       struct ext4_group_info *grinfo;
        struct sg {
                struct ext4_group_info info;
                ext4_grpblk_t counters[16];
@@ -2095,15 +2095,21 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
 
        i = (sb->s_blocksize_bits + 2) * sizeof(sg.info.bb_counters[0]) +
                sizeof(struct ext4_group_info);
-       err = ext4_mb_load_buddy(sb, group, &e4b);
-       if (err) {
-               seq_printf(seq, "#%-5u: I/O error\n", group);
-               return 0;
+       grinfo = ext4_get_group_info(sb, group);
+       /* Load the group info in memory only if not already loaded. */
+       if (unlikely(EXT4_MB_GRP_NEED_INIT(grinfo))) {
+               err = ext4_mb_load_buddy(sb, group, &e4b);
+               if (err) {
+                       seq_printf(seq, "#%-5u: I/O error\n", group);
+                       return 0;
+               }
+               buddy_loaded = 1;
        }
-       ext4_lock_group(sb, group);
+
        memcpy(&sg, ext4_get_group_info(sb, group), i);
-       ext4_unlock_group(sb, group);
-       ext4_mb_unload_buddy(&e4b);
+
+       if (buddy_loaded)
+               ext4_mb_unload_buddy(&e4b);
 
        seq_printf(seq, "#%-5u: %-5u %-5u %-5u [", group, sg.info.bb_free,
                        sg.info.bb_fragments, sg.info.bb_first_free);
@@ -2825,7 +2831,6 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
        err = ext4_handle_dirty_metadata(handle, NULL, gdp_bh);
 
 out_err:
-       ext4_mark_super_dirty(sb);
        brelse(bitmap_bh);
        return err;
 }
@@ -4694,7 +4699,6 @@ do_more:
                put_bh(bitmap_bh);
                goto do_more;
        }
-       ext4_mark_super_dirty(sb);
 error_return:
        brelse(bitmap_bh);
        ext4_std_error(sb, err);
@@ -4705,7 +4709,7 @@ error_return:
  * ext4_group_add_blocks() -- Add given blocks to an existing group
  * @handle:                    handle to this transaction
  * @sb:                                super block
- * @block:                     start physcial block to add to the block group
+ * @block:                     start physical block to add to the block group
  * @count:                     number of blocks to free
  *
  * This marks the blocks as free in the bitmap and buddy.