aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/balloc.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2009-01-05 22:20:24 -0500
committerTheodore Ts'o <tytso@mit.edu>2009-01-05 22:20:24 -0500
commit560671a0d3c9ad2d647fa6d09375a262e1f19c4f (patch)
treea52673326726062d53b35643d51a16739cd804fc /fs/ext4/balloc.c
parente8134b27e351e813414da3b95aa8eac6d3908088 (diff)
ext4: Use high 16 bits of the block group descriptor's free counts fields
Rename the lower bits with suffix _lo and add helper to access the values. Also rename bg_itable_unused_hi to bg_pad as in e2fsprogs. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/balloc.c')
-rw-r--r--fs/ext4/balloc.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 404d81cc9157..902bf66c8dfb 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -102,9 +102,9 @@ unsigned ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh,
102 if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) { 102 if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) {
103 ext4_error(sb, __func__, 103 ext4_error(sb, __func__,
104 "Checksum bad for group %u", block_group); 104 "Checksum bad for group %u", block_group);
105 gdp->bg_free_blocks_count = 0; 105 ext4_free_blks_set(sb, gdp, 0);
106 gdp->bg_free_inodes_count = 0; 106 ext4_free_inodes_set(sb, gdp, 0);
107 gdp->bg_itable_unused = 0; 107 ext4_itable_unused_set(sb, gdp, 0);
108 memset(bh->b_data, 0xff, sb->s_blocksize); 108 memset(bh->b_data, 0xff, sb->s_blocksize);
109 return 0; 109 return 0;
110 } 110 }
@@ -372,7 +372,7 @@ void ext4_add_groupblocks(handle_t *handle, struct super_block *sb,
372 struct ext4_group_desc *desc; 372 struct ext4_group_desc *desc;
373 struct ext4_super_block *es; 373 struct ext4_super_block *es;
374 struct ext4_sb_info *sbi; 374 struct ext4_sb_info *sbi;
375 int err = 0, ret; 375 int err = 0, ret, blk_free_count;
376 ext4_grpblk_t blocks_freed; 376 ext4_grpblk_t blocks_freed;
377 struct ext4_group_info *grp; 377 struct ext4_group_info *grp;
378 378
@@ -444,7 +444,8 @@ void ext4_add_groupblocks(handle_t *handle, struct super_block *sb,
444 } 444 }
445 } 445 }
446 spin_lock(sb_bgl_lock(sbi, block_group)); 446 spin_lock(sb_bgl_lock(sbi, block_group));
447 le16_add_cpu(&desc->bg_free_blocks_count, blocks_freed); 447 blk_free_count = blocks_freed + ext4_free_blks_count(sb, desc);
448 ext4_free_blks_set(sb, desc, blk_free_count);
448 desc->bg_checksum = ext4_group_desc_csum(sbi, block_group, desc); 449 desc->bg_checksum = ext4_group_desc_csum(sbi, block_group, desc);
449 spin_unlock(sb_bgl_lock(sbi, block_group)); 450 spin_unlock(sb_bgl_lock(sbi, block_group));
450 percpu_counter_add(&sbi->s_freeblocks_counter, blocks_freed); 451 percpu_counter_add(&sbi->s_freeblocks_counter, blocks_freed);
@@ -685,7 +686,7 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb)
685 gdp = ext4_get_group_desc(sb, i, NULL); 686 gdp = ext4_get_group_desc(sb, i, NULL);
686 if (!gdp) 687 if (!gdp)
687 continue; 688 continue;
688 desc_count += le16_to_cpu(gdp->bg_free_blocks_count); 689 desc_count += ext4_free_blks_count(sb, gdp);
689 } 690 }
690 691
691 return desc_count; 692 return desc_count;