]> git.kernelconcepts.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)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 2 Aug 2012 13:37:43 +0000 (14:37 +0100)
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>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/ext4/balloc.c
fs/ext4/bitmap.c
fs/ext4/ext4.h
fs/ext4/ialloc.c

index 914bf9e7dcbc7caa08cc9da875f34f179b39b18e..d6970f76d585f22bac7f0beabefe57615a87831f 100644 (file)
@@ -557,7 +557,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 fa3af81ac565c16dba6237edc89c3c7d70c5fc61..012faaaec4adac780ec32eebd30987bca924a73f 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 7b1cd5c65d695c9329c3d0b064358f45f7216242..873897ccb0578a5d583b511bb17b9ef164281c05 100644 (file)
@@ -1757,7 +1757,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);
 
 /* balloc.c */
 extern unsigned int ext4_block_group(struct super_block *sb,
index 8fb6844f9734755b23a653ef4e1f05fea148bc36..626679935b8084e4683e739d583d9e08017f64cf 100644 (file)
@@ -1057,7 +1057,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;