]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ext4: pass a char * to ext4_count_free() instead of a buffer_head ptr
authorTheodore Ts'o <tytso@mit.edu>
Sat, 30 Jun 2012 23:14:57 +0000 (19:14 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Aug 2012 15:23:12 +0000 (08:23 -0700)
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>
fs/ext4/balloc.c
fs/ext4/bitmap.c
fs/ext4/ext4.h
fs/ext4/ialloc.c

index cee7812cc3cf9a17f8dc967eb7af480c079c5f44..d23b31ca9d7a713cfff0899889dd6eeb46f1b2c6 100644 (file)
@@ -609,7 +609,8 @@ ext4_fsblk_t ext4_count_free_clusters(struct super_block *sb)
                if (bitmap_bh == NULL)
                        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",
                        i, ext4_free_group_clusters(sb, gdp), x);
                bitmap_count += x;
index b319721da26ae32010adcd46db7e2d98ec50887a..7e86a6d28c64806796fea2892ffa54e5b167121e 100644 (file)
 
 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;
 
-       if (!map)
-               return 0;
        for (i = 0; i < numchars; i++)
-               sum += nibblemap[map->b_data[i] & 0xf] +
-                       nibblemap[(map->b_data[i] >> 4) & 0xf];
+               sum += nibblemap[bitmap[i] & 0xf] +
+                       nibblemap[(bitmap[i] >> 4) & 0xf];
        return sum;
 }
 
index cfc4e01b3c8370c642681824ef55b13a66683c0d..293fa1ced21b674e6b5831cc19f3db059ce472ae 100644 (file)
@@ -1852,7 +1852,7 @@ struct mmpd_data {
 # define NORET_AND     noreturn,
 
 /* bitmap.c */
-extern unsigned int ext4_count_free(struct buffer_head *, unsigned);
+extern unsigned int ext4_count_free(char *bitmap, unsigned numchars);
 void ext4_inode_bitmap_csum_set(struct super_block *sb, ext4_group_t group,
                                struct ext4_group_desc *gdp,
                                struct buffer_head *bh, int sz);
index d48e8b14928cf993c50c33fe9b18a90203c2c492..6866bc233e949bbfc66239e6275bd1bbd8ad8744 100644 (file)
@@ -1054,7 +1054,8 @@ unsigned long ext4_count_free_inodes(struct super_block *sb)
                if (!bitmap_bh)
                        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",
                        (unsigned long) i, ext4_free_inodes_count(sb, gdp), x);
                bitmap_count += x;