Commit 2a271d6a authored by Theodore Ts'o's avatar Theodore Ts'o Committed by Greg Kroah-Hartman

ext4: pass a char * to ext4_count_free() instead of a buffer_head ptr

commit f6fb99ca upstream.

Make it possible for ext4_count_free to operate on buffers and not
just data in buffer_heads.
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 66b68d23
...@@ -584,7 +584,8 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb) ...@@ -584,7 +584,8 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb)
if (bitmap_bh == NULL) if (bitmap_bh == NULL)
continue; continue;
x = ext4_count_free(bitmap_bh, sb->s_blocksize); x = ext4_count_free(bitmap_bh->b_data,
EXT4_BLOCKS_PER_GROUP(sb) / 8);
printk(KERN_DEBUG "group %u: stored = %d, counted = %u\n", printk(KERN_DEBUG "group %u: stored = %d, counted = %u\n",
i, ext4_free_group_clusters(sb, gdp), x); i, ext4_free_group_clusters(sb, gdp), x);
bitmap_count += x; bitmap_count += x;
......
...@@ -15,15 +15,13 @@ ...@@ -15,15 +15,13 @@
static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0};
unsigned int ext4_count_free(struct buffer_head *map, unsigned int numchars) unsigned int ext4_count_free(char *bitmap, unsigned int numchars)
{ {
unsigned int i, sum = 0; unsigned int i, sum = 0;
if (!map)
return 0;
for (i = 0; i < numchars; i++) for (i = 0; i < numchars; i++)
sum += nibblemap[map->b_data[i] & 0xf] + sum += nibblemap[bitmap[i] & 0xf] +
nibblemap[(map->b_data[i] >> 4) & 0xf]; nibblemap[(bitmap[i] >> 4) & 0xf];
return sum; return sum;
} }
......
...@@ -1783,7 +1783,7 @@ struct mmpd_data { ...@@ -1783,7 +1783,7 @@ struct mmpd_data {
# define NORET_AND noreturn, # define NORET_AND noreturn,
/* bitmap.c */ /* bitmap.c */
extern unsigned int ext4_count_free(struct buffer_head *, unsigned); extern unsigned int ext4_count_free(char *bitmap, unsigned numchars);
/* balloc.c */ /* balloc.c */
extern unsigned int ext4_block_group(struct super_block *sb, extern unsigned int ext4_block_group(struct super_block *sb,
......
...@@ -1013,7 +1013,8 @@ unsigned long ext4_count_free_inodes(struct super_block *sb) ...@@ -1013,7 +1013,8 @@ unsigned long ext4_count_free_inodes(struct super_block *sb)
if (!bitmap_bh) if (!bitmap_bh)
continue; continue;
x = ext4_count_free(bitmap_bh, EXT4_INODES_PER_GROUP(sb) / 8); x = ext4_count_free(bitmap_bh->b_data,
EXT4_INODES_PER_GROUP(sb) / 8);
printk(KERN_DEBUG "group %lu: stored = %d, counted = %lu\n", printk(KERN_DEBUG "group %lu: stored = %d, counted = %lu\n",
(unsigned long) i, ext4_free_inodes_count(sb, gdp), x); (unsigned long) i, ext4_free_inodes_count(sb, gdp), x);
bitmap_count += x; bitmap_count += x;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment