diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2009-01-05 22:20:24 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-01-05 22:20:24 -0500 |
commit | 560671a0d3c9ad2d647fa6d09375a262e1f19c4f (patch) | |
tree | a52673326726062d53b35643d51a16739cd804fc /fs/ext4/super.c | |
parent | e8134b27e351e813414da3b95aa8eac6d3908088 (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/super.c')
-rw-r--r-- | fs/ext4/super.c | 68 |
1 files changed, 66 insertions, 2 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 2415e2b09707..a3321bf22311 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -93,6 +93,38 @@ ext4_fsblk_t ext4_inode_table(struct super_block *sb, | |||
93 | (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_table_hi) << 32 : 0); | 93 | (ext4_fsblk_t)le32_to_cpu(bg->bg_inode_table_hi) << 32 : 0); |
94 | } | 94 | } |
95 | 95 | ||
96 | __u32 ext4_free_blks_count(struct super_block *sb, | ||
97 | struct ext4_group_desc *bg) | ||
98 | { | ||
99 | return le16_to_cpu(bg->bg_free_blocks_count_lo) | | ||
100 | (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? | ||
101 | (__u32)le16_to_cpu(bg->bg_free_blocks_count_hi) << 16 : 0); | ||
102 | } | ||
103 | |||
104 | __u32 ext4_free_inodes_count(struct super_block *sb, | ||
105 | struct ext4_group_desc *bg) | ||
106 | { | ||
107 | return le16_to_cpu(bg->bg_free_inodes_count_lo) | | ||
108 | (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? | ||
109 | (__u32)le16_to_cpu(bg->bg_free_inodes_count_hi) << 16 : 0); | ||
110 | } | ||
111 | |||
112 | __u32 ext4_used_dirs_count(struct super_block *sb, | ||
113 | struct ext4_group_desc *bg) | ||
114 | { | ||
115 | return le16_to_cpu(bg->bg_used_dirs_count_lo) | | ||
116 | (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? | ||
117 | (__u32)le16_to_cpu(bg->bg_used_dirs_count_hi) << 16 : 0); | ||
118 | } | ||
119 | |||
120 | __u32 ext4_itable_unused_count(struct super_block *sb, | ||
121 | struct ext4_group_desc *bg) | ||
122 | { | ||
123 | return le16_to_cpu(bg->bg_itable_unused_lo) | | ||
124 | (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT ? | ||
125 | (__u32)le16_to_cpu(bg->bg_itable_unused_hi) << 16 : 0); | ||
126 | } | ||
127 | |||
96 | void ext4_block_bitmap_set(struct super_block *sb, | 128 | void ext4_block_bitmap_set(struct super_block *sb, |
97 | struct ext4_group_desc *bg, ext4_fsblk_t blk) | 129 | struct ext4_group_desc *bg, ext4_fsblk_t blk) |
98 | { | 130 | { |
@@ -117,6 +149,38 @@ void ext4_inode_table_set(struct super_block *sb, | |||
117 | bg->bg_inode_table_hi = cpu_to_le32(blk >> 32); | 149 | bg->bg_inode_table_hi = cpu_to_le32(blk >> 32); |
118 | } | 150 | } |
119 | 151 | ||
152 | void ext4_free_blks_set(struct super_block *sb, | ||
153 | struct ext4_group_desc *bg, __u32 count) | ||
154 | { | ||
155 | bg->bg_free_blocks_count_lo = cpu_to_le16((__u16)count); | ||
156 | if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) | ||
157 | bg->bg_free_blocks_count_hi = cpu_to_le16(count >> 16); | ||
158 | } | ||
159 | |||
160 | void ext4_free_inodes_set(struct super_block *sb, | ||
161 | struct ext4_group_desc *bg, __u32 count) | ||
162 | { | ||
163 | bg->bg_free_inodes_count_lo = cpu_to_le16((__u16)count); | ||
164 | if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) | ||
165 | bg->bg_free_inodes_count_hi = cpu_to_le16(count >> 16); | ||
166 | } | ||
167 | |||
168 | void ext4_used_dirs_set(struct super_block *sb, | ||
169 | struct ext4_group_desc *bg, __u32 count) | ||
170 | { | ||
171 | bg->bg_used_dirs_count_lo = cpu_to_le16((__u16)count); | ||
172 | if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) | ||
173 | bg->bg_used_dirs_count_hi = cpu_to_le16(count >> 16); | ||
174 | } | ||
175 | |||
176 | void ext4_itable_unused_set(struct super_block *sb, | ||
177 | struct ext4_group_desc *bg, __u32 count) | ||
178 | { | ||
179 | bg->bg_itable_unused_lo = cpu_to_le16((__u16)count); | ||
180 | if (EXT4_DESC_SIZE(sb) >= EXT4_MIN_DESC_SIZE_64BIT) | ||
181 | bg->bg_itable_unused_hi = cpu_to_le16(count >> 16); | ||
182 | } | ||
183 | |||
120 | /* | 184 | /* |
121 | * Wrappers for jbd2_journal_start/end. | 185 | * Wrappers for jbd2_journal_start/end. |
122 | * | 186 | * |
@@ -1561,9 +1625,9 @@ static int ext4_fill_flex_info(struct super_block *sb) | |||
1561 | 1625 | ||
1562 | flex_group = ext4_flex_group(sbi, i); | 1626 | flex_group = ext4_flex_group(sbi, i); |
1563 | sbi->s_flex_groups[flex_group].free_inodes += | 1627 | sbi->s_flex_groups[flex_group].free_inodes += |
1564 | le16_to_cpu(gdp->bg_free_inodes_count); | 1628 | ext4_free_inodes_count(sb, gdp); |
1565 | sbi->s_flex_groups[flex_group].free_blocks += | 1629 | sbi->s_flex_groups[flex_group].free_blocks += |
1566 | le16_to_cpu(gdp->bg_free_blocks_count); | 1630 | ext4_free_blks_count(sb, gdp); |
1567 | } | 1631 | } |
1568 | 1632 | ||
1569 | return 1; | 1633 | return 1; |