aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/mballoc.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2011-09-09 19:08:51 -0400
committerTheodore Ts'o <tytso@mit.edu>2011-09-09 19:08:51 -0400
commit021b65bb1e4e4b625c80bbb82651e5e155721ef3 (patch)
treee1826a0ec395ac2acf46c43113f2c6a64a5165d0 /fs/ext4/mballoc.c
parent6f16b60690ba04cf476480a6f19b204e4b95b4a6 (diff)
ext4: Rename ext4_free_blks_{count,set}() to refer to clusters
The field bg_free_blocks_count_{lo,high} in the block group descriptor has been repurposed to hold the number of free clusters for bigalloc functions. So rename the functions so it makes it easier to read and audit the block allocation and block freeing code. Note: at this point in bigalloc development we doesn't support online resize, so this also makes it really obvious all of the places we need to fix up to add support for online resize. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/mballoc.c')
-rw-r--r--fs/ext4/mballoc.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 5e1215d38331..76db2f12107f 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2256,7 +2256,7 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
2256 ext4_free_blocks_after_init(sb, group, desc); 2256 ext4_free_blocks_after_init(sb, group, desc);
2257 } else { 2257 } else {
2258 meta_group_info[i]->bb_free = 2258 meta_group_info[i]->bb_free =
2259 ext4_free_blks_count(sb, desc); 2259 ext4_free_group_clusters(sb, desc);
2260 } 2260 }
2261 2261
2262 INIT_LIST_HEAD(&meta_group_info[i]->bb_prealloc_list); 2262 INIT_LIST_HEAD(&meta_group_info[i]->bb_prealloc_list);
@@ -2799,7 +2799,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
2799 goto out_err; 2799 goto out_err;
2800 2800
2801 ext4_debug("using block group %u(%d)\n", ac->ac_b_ex.fe_group, 2801 ext4_debug("using block group %u(%d)\n", ac->ac_b_ex.fe_group,
2802 ext4_free_blks_count(sb, gdp)); 2802 ext4_free_group_clusters(sb, gdp));
2803 2803
2804 err = ext4_journal_get_write_access(handle, gdp_bh); 2804 err = ext4_journal_get_write_access(handle, gdp_bh);
2805 if (err) 2805 if (err)
@@ -2839,12 +2839,12 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
2839 ac->ac_b_ex.fe_len); 2839 ac->ac_b_ex.fe_len);
2840 if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { 2840 if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
2841 gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT); 2841 gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT);
2842 ext4_free_blks_set(sb, gdp, 2842 ext4_free_group_clusters_set(sb, gdp,
2843 ext4_free_blocks_after_init(sb, 2843 ext4_free_blocks_after_init(sb,
2844 ac->ac_b_ex.fe_group, gdp)); 2844 ac->ac_b_ex.fe_group, gdp));
2845 } 2845 }
2846 len = ext4_free_blks_count(sb, gdp) - ac->ac_b_ex.fe_len; 2846 len = ext4_free_group_clusters(sb, gdp) - ac->ac_b_ex.fe_len;
2847 ext4_free_blks_set(sb, gdp, len); 2847 ext4_free_group_clusters_set(sb, gdp, len);
2848 gdp->bg_checksum = ext4_group_desc_csum(sbi, ac->ac_b_ex.fe_group, gdp); 2848 gdp->bg_checksum = ext4_group_desc_csum(sbi, ac->ac_b_ex.fe_group, gdp);
2849 2849
2850 ext4_unlock_group(sb, ac->ac_b_ex.fe_group); 2850 ext4_unlock_group(sb, ac->ac_b_ex.fe_group);
@@ -4702,8 +4702,8 @@ do_more:
4702 mb_free_blocks(inode, &e4b, bit, count_clusters); 4702 mb_free_blocks(inode, &e4b, bit, count_clusters);
4703 } 4703 }
4704 4704
4705 ret = ext4_free_blks_count(sb, gdp) + count_clusters; 4705 ret = ext4_free_group_clusters(sb, gdp) + count_clusters;
4706 ext4_free_blks_set(sb, gdp, ret); 4706 ext4_free_group_clusters_set(sb, gdp, ret);
4707 gdp->bg_checksum = ext4_group_desc_csum(sbi, block_group, gdp); 4707 gdp->bg_checksum = ext4_group_desc_csum(sbi, block_group, gdp);
4708 ext4_unlock_group(sb, block_group); 4708 ext4_unlock_group(sb, block_group);
4709 percpu_counter_add(&sbi->s_freeclusters_counter, count_clusters); 4709 percpu_counter_add(&sbi->s_freeclusters_counter, count_clusters);
@@ -4846,8 +4846,8 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
4846 ext4_lock_group(sb, block_group); 4846 ext4_lock_group(sb, block_group);
4847 mb_clear_bits(bitmap_bh->b_data, bit, count); 4847 mb_clear_bits(bitmap_bh->b_data, bit, count);
4848 mb_free_blocks(NULL, &e4b, bit, count); 4848 mb_free_blocks(NULL, &e4b, bit, count);
4849 blk_free_count = blocks_freed + ext4_free_blks_count(sb, desc); 4849 blk_free_count = blocks_freed + ext4_free_group_clusters(sb, desc);
4850 ext4_free_blks_set(sb, desc, blk_free_count); 4850 ext4_free_group_clusters_set(sb, desc, blk_free_count);
4851 desc->bg_checksum = ext4_group_desc_csum(sbi, block_group, desc); 4851 desc->bg_checksum = ext4_group_desc_csum(sbi, block_group, desc);
4852 ext4_unlock_group(sb, block_group); 4852 ext4_unlock_group(sb, block_group);
4853 percpu_counter_add(&sbi->s_freeclusters_counter, 4853 percpu_counter_add(&sbi->s_freeclusters_counter,