diff options
| author | Theodore Ts'o <tytso@mit.edu> | 2012-06-30 19:14:57 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-08-09 11:27:51 -0400 |
| commit | 6ff2c41b81bd0778aa44ffcfce0ea623fa660887 (patch) | |
| tree | d1ce1e944f62b249f2e673a79c8b704fc7ac5cc5 /fs | |
| parent | eb65b85e1bce06b665b3568c19a249cd886fa6ff (diff) | |
ext4: pass a char * to ext4_count_free() instead of a buffer_head ptr
commit f6fb99cadcd44660c68e13f6eab28333653621e6 upstream.
Make it possible for ext4_count_free to operate on buffers and not
just data in buffer_heads.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/ext4/balloc.c | 3 | ||||
| -rw-r--r-- | fs/ext4/bitmap.c | 8 | ||||
| -rw-r--r-- | fs/ext4/ext4.h | 2 | ||||
| -rw-r--r-- | fs/ext4/ialloc.c | 3 |
4 files changed, 8 insertions, 8 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 264f6949511..ebe95f56514 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
| @@ -514,7 +514,8 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb) | |||
| 514 | if (bitmap_bh == NULL) | 514 | if (bitmap_bh == NULL) |
| 515 | continue; | 515 | continue; |
| 516 | 516 | ||
| 517 | x = ext4_count_free(bitmap_bh, sb->s_blocksize); | 517 | x = ext4_count_free(bitmap_bh->b_data, |
| 518 | EXT4_BLOCKS_PER_GROUP(sb) / 8); | ||
| 518 | printk(KERN_DEBUG "group %u: stored = %d, counted = %u\n", | 519 | printk(KERN_DEBUG "group %u: stored = %d, counted = %u\n", |
| 519 | i, ext4_free_blks_count(sb, gdp), x); | 520 | i, ext4_free_blks_count(sb, gdp), x); |
| 520 | bitmap_count += x; | 521 | bitmap_count += x; |
diff --git a/fs/ext4/bitmap.c b/fs/ext4/bitmap.c index fa3af81ac56..012faaaec4a 100644 --- a/fs/ext4/bitmap.c +++ b/fs/ext4/bitmap.c | |||
| @@ -15,15 +15,13 @@ | |||
| 15 | 15 | ||
| 16 | static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; | 16 | static const int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; |
| 17 | 17 | ||
| 18 | unsigned int ext4_count_free(struct buffer_head *map, unsigned int numchars) | 18 | unsigned int ext4_count_free(char *bitmap, unsigned int numchars) |
| 19 | { | 19 | { |
| 20 | unsigned int i, sum = 0; | 20 | unsigned int i, sum = 0; |
| 21 | 21 | ||
| 22 | if (!map) | ||
| 23 | return 0; | ||
| 24 | for (i = 0; i < numchars; i++) | 22 | for (i = 0; i < numchars; i++) |
| 25 | sum += nibblemap[map->b_data[i] & 0xf] + | 23 | sum += nibblemap[bitmap[i] & 0xf] + |
| 26 | nibblemap[(map->b_data[i] >> 4) & 0xf]; | 24 | nibblemap[(bitmap[i] >> 4) & 0xf]; |
| 27 | return sum; | 25 | return sum; |
| 28 | } | 26 | } |
| 29 | 27 | ||
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 1a34c1c8460..e0113aa0d3a 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
| @@ -1713,7 +1713,7 @@ struct mmpd_data { | |||
| 1713 | # define NORET_AND noreturn, | 1713 | # define NORET_AND noreturn, |
| 1714 | 1714 | ||
| 1715 | /* bitmap.c */ | 1715 | /* bitmap.c */ |
| 1716 | extern unsigned int ext4_count_free(struct buffer_head *, unsigned); | 1716 | extern unsigned int ext4_count_free(char *bitmap, unsigned numchars); |
| 1717 | 1717 | ||
| 1718 | /* balloc.c */ | 1718 | /* balloc.c */ |
| 1719 | extern unsigned int ext4_block_group(struct super_block *sb, | 1719 | extern unsigned int ext4_block_group(struct super_block *sb, |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 412469b241a..29272de3023 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
| @@ -1193,7 +1193,8 @@ unsigned long ext4_count_free_inodes(struct super_block *sb) | |||
| 1193 | if (!bitmap_bh) | 1193 | if (!bitmap_bh) |
| 1194 | continue; | 1194 | continue; |
| 1195 | 1195 | ||
| 1196 | x = ext4_count_free(bitmap_bh, EXT4_INODES_PER_GROUP(sb) / 8); | 1196 | x = ext4_count_free(bitmap_bh->b_data, |
| 1197 | EXT4_INODES_PER_GROUP(sb) / 8); | ||
| 1197 | printk(KERN_DEBUG "group %lu: stored = %d, counted = %lu\n", | 1198 | printk(KERN_DEBUG "group %lu: stored = %d, counted = %lu\n", |
| 1198 | (unsigned long) i, ext4_free_inodes_count(sb, gdp), x); | 1199 | (unsigned long) i, ext4_free_inodes_count(sb, gdp), x); |
| 1199 | bitmap_count += x; | 1200 | bitmap_count += x; |
