1 ext4: cleanup mballoc header files
3 From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
5 Move some of the forward declaration of the static functions
6 to mballoc.c where they are used. This enables us to include
7 mballoc.h in other .c files. Also correct the buddy cache
10 Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
11 Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
13 fs/ext4/mballoc.c | 23 +++++++++++++++++++----
14 fs/ext4/mballoc.h | 18 +-----------------
15 2 files changed, 20 insertions(+), 21 deletions(-)
17 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
18 index 11fd4b9..598b418 100644
19 --- a/fs/ext4/mballoc.c
20 +++ b/fs/ext4/mballoc.c
25 - * [ group 0 buddy][ group 0 bitmap] [group 1][ group 1]...
26 + * [ group 0 bitmap][ group 0 buddy] [group 1][ group 1]...
29 * one block each for bitmap and buddy information. So for each group we
34 +static struct kmem_cache *ext4_pspace_cachep;
35 +static struct kmem_cache *ext4_ac_cachep;
36 +static struct kmem_cache *ext4_free_ext_cachep;
37 +static void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
38 + ext4_group_t group);
39 +static int ext4_mb_init_per_dev_proc(struct super_block *sb);
40 +static int ext4_mb_destroy_per_dev_proc(struct super_block *sb);
41 +static void release_blocks_on_commit(journal_t *journal, transaction_t *txn);
45 static inline void *mb_correct_addr_and_bit(int *bit, void *addr)
47 @@ -716,7 +726,7 @@ static void ext4_mb_generate_buddy(struct super_block *sb,
48 * stored in the inode as
51 - * [ group 0 buddy][ group 0 bitmap] [group 1][ group 1]...
52 + * [ group 0 bitmap][ group 0 buddy] [group 1][ group 1]...
55 * one block each for bitmap and buddy information.
56 @@ -1322,8 +1332,13 @@ static void ext4_mb_use_best_found(struct ext4_allocation_context *ac,
57 ac->ac_tail = ret & 0xffff;
58 ac->ac_buddy = ret >> 16;
60 - /* XXXXXXX: SUCH A HORRIBLE **CK */
63 + * take the page reference. We want the page to be pinned
64 + * so that we don't get a ext4_mb_init_cache_call for this
65 + * group until we update the bitmap. That would mean we
66 + * double allocate blocks. The reference is dropped
67 + * in ext4_mb_release_context
69 ac->ac_bitmap_page = e4b->bd_bitmap_page;
70 get_page(ac->ac_bitmap_page);
71 ac->ac_buddy_page = e4b->bd_buddy_page;
72 diff --git a/fs/ext4/mballoc.h b/fs/ext4/mballoc.h
73 index a931b6b..997f78f 100644
74 --- a/fs/ext4/mballoc.h
75 +++ b/fs/ext4/mballoc.h
78 #define MB_DEFAULT_GROUP_PREALLOC 512
80 -static struct kmem_cache *ext4_pspace_cachep;
81 -static struct kmem_cache *ext4_ac_cachep;
82 -static struct kmem_cache *ext4_free_ext_cachep;
84 struct ext4_free_data {
85 /* this links the free block information from group_info */
86 @@ -262,25 +259,12 @@ static inline void ext4_mb_store_history(struct ext4_allocation_context *ac)
91 -static void ext4_mb_store_history(struct ext4_allocation_context *ac);
94 #define in_range(b, first, len) ((b) >= (first) && (b) <= (first) + (len) - 1)
96 struct buffer_head *read_block_bitmap(struct super_block *, ext4_group_t);
98 -static void ext4_mb_generate_from_pa(struct super_block *sb, void *bitmap,
99 - ext4_group_t group);
100 -static void ext4_mb_return_to_preallocation(struct inode *inode,
101 - struct ext4_buddy *e4b, sector_t block,
103 -static void ext4_mb_put_pa(struct ext4_allocation_context *,
104 - struct super_block *, struct ext4_prealloc_space *pa);
105 -static int ext4_mb_init_per_dev_proc(struct super_block *sb);
106 -static int ext4_mb_destroy_per_dev_proc(struct super_block *sb);
107 -static void release_blocks_on_commit(journal_t *journal, transaction_t *txn);
110 static inline void ext4_lock_group(struct super_block *sb, ext4_group_t group)
112 @@ -306,7 +290,7 @@ static inline int ext4_is_group_locked(struct super_block *sb,
113 &(grinfo->bb_state));
116 -static ext4_fsblk_t ext4_grp_offs_to_block(struct super_block *sb,
117 +static inline ext4_fsblk_t ext4_grp_offs_to_block(struct super_block *sb,
118 struct ext4_free_extent *fex)
125 To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
126 the body of a message to majordomo@vger.kernel.org
127 More majordomo info at http://vger.kernel.org/majordomo-info.html