diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/balloc.c | 8 | ||||
-rw-r--r-- | fs/ext4/ext4.h | 9 | ||||
-rw-r--r-- | fs/ext4/ialloc.c | 14 | ||||
-rw-r--r-- | fs/ext4/mballoc.c | 22 | ||||
-rw-r--r-- | fs/ext4/resize.c | 2 | ||||
-rw-r--r-- | fs/ext4/super.c | 10 |
6 files changed, 33 insertions, 32 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index bf42b3219e3c..84dc3d62b40c 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -168,7 +168,7 @@ void ext4_init_block_bitmap(struct super_block *sb, struct buffer_head *bh, | |||
168 | * essentially implementing a per-group read-only flag. */ | 168 | * essentially implementing a per-group read-only flag. */ |
169 | if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) { | 169 | if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) { |
170 | ext4_error(sb, "Checksum bad for group %u", block_group); | 170 | ext4_error(sb, "Checksum bad for group %u", block_group); |
171 | ext4_free_blks_set(sb, gdp, 0); | 171 | ext4_free_group_clusters_set(sb, gdp, 0); |
172 | ext4_free_inodes_set(sb, gdp, 0); | 172 | ext4_free_inodes_set(sb, gdp, 0); |
173 | ext4_itable_unused_set(sb, gdp, 0); | 173 | ext4_itable_unused_set(sb, gdp, 0); |
174 | memset(bh->b_data, 0xff, sb->s_blocksize); | 174 | memset(bh->b_data, 0xff, sb->s_blocksize); |
@@ -550,7 +550,7 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb) | |||
550 | gdp = ext4_get_group_desc(sb, i, NULL); | 550 | gdp = ext4_get_group_desc(sb, i, NULL); |
551 | if (!gdp) | 551 | if (!gdp) |
552 | continue; | 552 | continue; |
553 | desc_count += ext4_free_blks_count(sb, gdp); | 553 | desc_count += ext4_free_group_clusters(sb, gdp); |
554 | brelse(bitmap_bh); | 554 | brelse(bitmap_bh); |
555 | bitmap_bh = ext4_read_block_bitmap(sb, i); | 555 | bitmap_bh = ext4_read_block_bitmap(sb, i); |
556 | if (bitmap_bh == NULL) | 556 | if (bitmap_bh == NULL) |
@@ -558,7 +558,7 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb) | |||
558 | 558 | ||
559 | x = ext4_count_free(bitmap_bh, sb->s_blocksize); | 559 | x = ext4_count_free(bitmap_bh, sb->s_blocksize); |
560 | printk(KERN_DEBUG "group %u: stored = %d, counted = %u\n", | 560 | printk(KERN_DEBUG "group %u: stored = %d, counted = %u\n", |
561 | i, ext4_free_blks_count(sb, gdp), x); | 561 | i, ext4_free_group_clusters(sb, gdp), x); |
562 | bitmap_count += x; | 562 | bitmap_count += x; |
563 | } | 563 | } |
564 | brelse(bitmap_bh); | 564 | brelse(bitmap_bh); |
@@ -572,7 +572,7 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb) | |||
572 | gdp = ext4_get_group_desc(sb, i, NULL); | 572 | gdp = ext4_get_group_desc(sb, i, NULL); |
573 | if (!gdp) | 573 | if (!gdp) |
574 | continue; | 574 | continue; |
575 | desc_count += ext4_free_blks_count(sb, gdp); | 575 | desc_count += ext4_free_group_clusters(sb, gdp); |
576 | } | 576 | } |
577 | 577 | ||
578 | return desc_count; | 578 | return desc_count; |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index a5a7e369f719..db279c362017 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -1978,8 +1978,8 @@ extern ext4_fsblk_t ext4_inode_bitmap(struct super_block *sb, | |||
1978 | struct ext4_group_desc *bg); | 1978 | struct ext4_group_desc *bg); |
1979 | extern ext4_fsblk_t ext4_inode_table(struct super_block *sb, | 1979 | extern ext4_fsblk_t ext4_inode_table(struct super_block *sb, |
1980 | struct ext4_group_desc *bg); | 1980 | struct ext4_group_desc *bg); |
1981 | extern __u32 ext4_free_blks_count(struct super_block *sb, | 1981 | extern __u32 ext4_free_group_clusters(struct super_block *sb, |
1982 | struct ext4_group_desc *bg); | 1982 | struct ext4_group_desc *bg); |
1983 | extern __u32 ext4_free_inodes_count(struct super_block *sb, | 1983 | extern __u32 ext4_free_inodes_count(struct super_block *sb, |
1984 | struct ext4_group_desc *bg); | 1984 | struct ext4_group_desc *bg); |
1985 | extern __u32 ext4_used_dirs_count(struct super_block *sb, | 1985 | extern __u32 ext4_used_dirs_count(struct super_block *sb, |
@@ -1992,8 +1992,9 @@ extern void ext4_inode_bitmap_set(struct super_block *sb, | |||
1992 | struct ext4_group_desc *bg, ext4_fsblk_t blk); | 1992 | struct ext4_group_desc *bg, ext4_fsblk_t blk); |
1993 | extern void ext4_inode_table_set(struct super_block *sb, | 1993 | extern void ext4_inode_table_set(struct super_block *sb, |
1994 | struct ext4_group_desc *bg, ext4_fsblk_t blk); | 1994 | struct ext4_group_desc *bg, ext4_fsblk_t blk); |
1995 | extern void ext4_free_blks_set(struct super_block *sb, | 1995 | extern void ext4_free_group_clusters_set(struct super_block *sb, |
1996 | struct ext4_group_desc *bg, __u32 count); | 1996 | struct ext4_group_desc *bg, |
1997 | __u32 count); | ||
1997 | extern void ext4_free_inodes_set(struct super_block *sb, | 1998 | extern void ext4_free_inodes_set(struct super_block *sb, |
1998 | struct ext4_group_desc *bg, __u32 count); | 1999 | struct ext4_group_desc *bg, __u32 count); |
1999 | extern void ext4_used_dirs_set(struct super_block *sb, | 2000 | extern void ext4_used_dirs_set(struct super_block *sb, |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 0be5862313f0..71a9c8f3dece 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -78,7 +78,7 @@ static unsigned ext4_init_inode_bitmap(struct super_block *sb, | |||
78 | * allocation, essentially implementing a per-group read-only flag. */ | 78 | * allocation, essentially implementing a per-group read-only flag. */ |
79 | if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) { | 79 | if (!ext4_group_desc_csum_verify(sbi, block_group, gdp)) { |
80 | ext4_error(sb, "Checksum bad for group %u", block_group); | 80 | ext4_error(sb, "Checksum bad for group %u", block_group); |
81 | ext4_free_blks_set(sb, gdp, 0); | 81 | ext4_free_group_clusters_set(sb, gdp, 0); |
82 | ext4_free_inodes_set(sb, gdp, 0); | 82 | ext4_free_inodes_set(sb, gdp, 0); |
83 | ext4_itable_unused_set(sb, gdp, 0); | 83 | ext4_itable_unused_set(sb, gdp, 0); |
84 | memset(bh->b_data, 0xff, sb->s_blocksize); | 84 | memset(bh->b_data, 0xff, sb->s_blocksize); |
@@ -322,8 +322,8 @@ static int find_group_dir(struct super_block *sb, struct inode *parent, | |||
322 | if (ext4_free_inodes_count(sb, desc) < avefreei) | 322 | if (ext4_free_inodes_count(sb, desc) < avefreei) |
323 | continue; | 323 | continue; |
324 | if (!best_desc || | 324 | if (!best_desc || |
325 | (ext4_free_blks_count(sb, desc) > | 325 | (ext4_free_group_clusters(sb, desc) > |
326 | ext4_free_blks_count(sb, best_desc))) { | 326 | ext4_free_group_clusters(sb, best_desc))) { |
327 | *best_group = group; | 327 | *best_group = group; |
328 | best_desc = desc; | 328 | best_desc = desc; |
329 | ret = 0; | 329 | ret = 0; |
@@ -434,7 +434,7 @@ static void get_orlov_stats(struct super_block *sb, ext4_group_t g, | |||
434 | desc = ext4_get_group_desc(sb, g, NULL); | 434 | desc = ext4_get_group_desc(sb, g, NULL); |
435 | if (desc) { | 435 | if (desc) { |
436 | stats->free_inodes = ext4_free_inodes_count(sb, desc); | 436 | stats->free_inodes = ext4_free_inodes_count(sb, desc); |
437 | stats->free_clusters = ext4_free_blks_count(sb, desc); | 437 | stats->free_clusters = ext4_free_group_clusters(sb, desc); |
438 | stats->used_dirs = ext4_used_dirs_count(sb, desc); | 438 | stats->used_dirs = ext4_used_dirs_count(sb, desc); |
439 | } else { | 439 | } else { |
440 | stats->free_inodes = 0; | 440 | stats->free_inodes = 0; |
@@ -662,7 +662,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent, | |||
662 | *group = parent_group; | 662 | *group = parent_group; |
663 | desc = ext4_get_group_desc(sb, *group, NULL); | 663 | desc = ext4_get_group_desc(sb, *group, NULL); |
664 | if (desc && ext4_free_inodes_count(sb, desc) && | 664 | if (desc && ext4_free_inodes_count(sb, desc) && |
665 | ext4_free_blks_count(sb, desc)) | 665 | ext4_free_group_clusters(sb, desc)) |
666 | return 0; | 666 | return 0; |
667 | 667 | ||
668 | /* | 668 | /* |
@@ -686,7 +686,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent, | |||
686 | *group -= ngroups; | 686 | *group -= ngroups; |
687 | desc = ext4_get_group_desc(sb, *group, NULL); | 687 | desc = ext4_get_group_desc(sb, *group, NULL); |
688 | if (desc && ext4_free_inodes_count(sb, desc) && | 688 | if (desc && ext4_free_inodes_count(sb, desc) && |
689 | ext4_free_blks_count(sb, desc)) | 689 | ext4_free_group_clusters(sb, desc)) |
690 | return 0; | 690 | return 0; |
691 | } | 691 | } |
692 | 692 | ||
@@ -960,7 +960,7 @@ got: | |||
960 | ext4_lock_group(sb, group); | 960 | ext4_lock_group(sb, group); |
961 | if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { | 961 | if (gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { |
962 | gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT); | 962 | gdp->bg_flags &= cpu_to_le16(~EXT4_BG_BLOCK_UNINIT); |
963 | ext4_free_blks_set(sb, gdp, | 963 | ext4_free_group_clusters_set(sb, gdp, |
964 | ext4_free_blocks_after_init(sb, group, gdp)); | 964 | ext4_free_blocks_after_init(sb, group, gdp)); |
965 | gdp->bg_checksum = ext4_group_desc_csum(sbi, group, | 965 | gdp->bg_checksum = ext4_group_desc_csum(sbi, group, |
966 | gdp); | 966 | gdp); |
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, |
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 95a09ddca3b9..996780ab4f4e 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c | |||
@@ -875,7 +875,7 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input) | |||
875 | ext4_block_bitmap_set(sb, gdp, input->block_bitmap); /* LV FIXME */ | 875 | ext4_block_bitmap_set(sb, gdp, input->block_bitmap); /* LV FIXME */ |
876 | ext4_inode_bitmap_set(sb, gdp, input->inode_bitmap); /* LV FIXME */ | 876 | ext4_inode_bitmap_set(sb, gdp, input->inode_bitmap); /* LV FIXME */ |
877 | ext4_inode_table_set(sb, gdp, input->inode_table); /* LV FIXME */ | 877 | ext4_inode_table_set(sb, gdp, input->inode_table); /* LV FIXME */ |
878 | ext4_free_blks_set(sb, gdp, input->free_blocks_count); | 878 | ext4_free_group_clusters_set(sb, gdp, input->free_blocks_count); |
879 | ext4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb)); | 879 | ext4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb)); |
880 | gdp->bg_flags = cpu_to_le16(EXT4_BG_INODE_ZEROED); | 880 | gdp->bg_flags = cpu_to_le16(EXT4_BG_INODE_ZEROED); |
881 | gdp->bg_checksum = ext4_group_desc_csum(sbi, input->group, gdp); | 881 | gdp->bg_checksum = ext4_group_desc_csum(sbi, input->group, gdp); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 66b8cfa15636..30cf0e1bd89c 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -163,8 +163,8 @@ ext4_fsblk_t ext4_inode_table(struct super_block *sb, | |||
163 | (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_table_hi) << 32 : 0); | 163 | (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_table_hi) << 32 : 0); |
164 | } | 164 | } |
165 | 165 | ||
166 | __u32 ext4_free_blks_count(struct super_block *sb, | 166 | __u32 ext4_free_group_clusters(struct super_block *sb, |
167 | struct ext4_group_desc *bg) | 167 | struct ext4_group_desc *bg) |
168 | { | 168 | { |
169 | return le16_to_cpu(bg->bg_free_blocks_count_lo) | | 169 | return le16_to_cpu(bg->bg_free_blocks_count_lo) | |
170 | (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? | 170 | (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? |
@@ -219,8 +219,8 @@ void ext4_inode_table_set(struct super_block *sb, | |||
219 | bg->bg_inode_table_hi = cpu_to_le32(blk >> 32); | 219 | bg->bg_inode_table_hi = cpu_to_le32(blk >> 32); |
220 | } | 220 | } |
221 | 221 | ||
222 | void ext4_free_blks_set(struct super_block *sb, | 222 | void ext4_free_group_clusters_set(struct super_block *sb, |
223 | struct ext4_group_desc *bg, __u32 count) | 223 | struct ext4_group_desc *bg, __u32 count) |
224 | { | 224 | { |
225 | bg->bg_free_blocks_count_lo = cpu_to_le16((__u16)count); | 225 | bg->bg_free_blocks_count_lo = cpu_to_le16((__u16)count); |
226 | if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) | 226 | if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) |
@@ -2034,7 +2034,7 @@ static int ext4_fill_flex_info(struct super_block *sb) | |||
2034 | flex_group = ext4_flex_group(sbi, i); | 2034 | flex_group = ext4_flex_group(sbi, i); |
2035 | atomic_add(ext4_free_inodes_count(sb, gdp), | 2035 | atomic_add(ext4_free_inodes_count(sb, gdp), |
2036 | &sbi->s_flex_groups[flex_group].free_inodes); | 2036 | &sbi->s_flex_groups[flex_group].free_inodes); |
2037 | atomic_add(ext4_free_blks_count(sb, gdp), | 2037 | atomic_add(ext4_free_group_clusters(sb, gdp), |
2038 | &sbi->s_flex_groups[flex_group].free_clusters); | 2038 | &sbi->s_flex_groups[flex_group].free_clusters); |
2039 | atomic_add(ext4_used_dirs_count(sb, gdp), | 2039 | atomic_add(ext4_used_dirs_count(sb, gdp), |
2040 | &sbi->s_flex_groups[flex_group].used_dirs); | 2040 | &sbi->s_flex_groups[flex_group].used_dirs); |