diff options
author | Pekka Enberg <penberg@cs.helsinki.fi> | 2006-02-01 06:06:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-01 11:53:25 -0500 |
commit | d739b42b82773206297db1fc0d96ef895a5d9688 (patch) | |
tree | b23e68bf685ca8a383e10b8673e5d1c547988b74 /fs/reiserfs/journal.c | |
parent | d19720a909b4443f78cbb03f4f090180e143ad9d (diff) |
[PATCH] reiserfs: remove kmalloc wrapper
Remove kmalloc() wrapper from fs/reiserfs/. Please note that a reiserfs
/proc entry format is changed because kmalloc statistics is removed.
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/reiserfs/journal.c')
-rw-r--r-- | fs/reiserfs/journal.c | 84 |
1 files changed, 27 insertions, 57 deletions
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 4491fcf2a0e6..16b526fd20b9 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -152,18 +152,16 @@ static struct reiserfs_bitmap_node *allocate_bitmap_node(struct super_block | |||
152 | struct reiserfs_bitmap_node *bn; | 152 | struct reiserfs_bitmap_node *bn; |
153 | static int id; | 153 | static int id; |
154 | 154 | ||
155 | bn = reiserfs_kmalloc(sizeof(struct reiserfs_bitmap_node), GFP_NOFS, | 155 | bn = kmalloc(sizeof(struct reiserfs_bitmap_node), GFP_NOFS); |
156 | p_s_sb); | ||
157 | if (!bn) { | 156 | if (!bn) { |
158 | return NULL; | 157 | return NULL; |
159 | } | 158 | } |
160 | bn->data = reiserfs_kmalloc(p_s_sb->s_blocksize, GFP_NOFS, p_s_sb); | 159 | bn->data = kzalloc(p_s_sb->s_blocksize, GFP_NOFS); |
161 | if (!bn->data) { | 160 | if (!bn->data) { |
162 | reiserfs_kfree(bn, sizeof(struct reiserfs_bitmap_node), p_s_sb); | 161 | kfree(bn); |
163 | return NULL; | 162 | return NULL; |
164 | } | 163 | } |
165 | bn->id = id++; | 164 | bn->id = id++; |
166 | memset(bn->data, 0, p_s_sb->s_blocksize); | ||
167 | INIT_LIST_HEAD(&bn->list); | 165 | INIT_LIST_HEAD(&bn->list); |
168 | return bn; | 166 | return bn; |
169 | } | 167 | } |
@@ -197,8 +195,8 @@ static inline void free_bitmap_node(struct super_block *p_s_sb, | |||
197 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); | 195 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); |
198 | journal->j_used_bitmap_nodes--; | 196 | journal->j_used_bitmap_nodes--; |
199 | if (journal->j_free_bitmap_nodes > REISERFS_MAX_BITMAP_NODES) { | 197 | if (journal->j_free_bitmap_nodes > REISERFS_MAX_BITMAP_NODES) { |
200 | reiserfs_kfree(bn->data, p_s_sb->s_blocksize, p_s_sb); | 198 | kfree(bn->data); |
201 | reiserfs_kfree(bn, sizeof(struct reiserfs_bitmap_node), p_s_sb); | 199 | kfree(bn); |
202 | } else { | 200 | } else { |
203 | list_add(&bn->list, &journal->j_bitmap_nodes); | 201 | list_add(&bn->list, &journal->j_bitmap_nodes); |
204 | journal->j_free_bitmap_nodes++; | 202 | journal->j_free_bitmap_nodes++; |
@@ -276,8 +274,8 @@ static int free_bitmap_nodes(struct super_block *p_s_sb) | |||
276 | while (next != &journal->j_bitmap_nodes) { | 274 | while (next != &journal->j_bitmap_nodes) { |
277 | bn = list_entry(next, struct reiserfs_bitmap_node, list); | 275 | bn = list_entry(next, struct reiserfs_bitmap_node, list); |
278 | list_del(next); | 276 | list_del(next); |
279 | reiserfs_kfree(bn->data, p_s_sb->s_blocksize, p_s_sb); | 277 | kfree(bn->data); |
280 | reiserfs_kfree(bn, sizeof(struct reiserfs_bitmap_node), p_s_sb); | 278 | kfree(bn); |
281 | next = journal->j_bitmap_nodes.next; | 279 | next = journal->j_bitmap_nodes.next; |
282 | journal->j_free_bitmap_nodes--; | 280 | journal->j_free_bitmap_nodes--; |
283 | } | 281 | } |
@@ -581,7 +579,7 @@ static inline void put_journal_list(struct super_block *s, | |||
581 | jl->j_trans_id, jl->j_refcount); | 579 | jl->j_trans_id, jl->j_refcount); |
582 | } | 580 | } |
583 | if (--jl->j_refcount == 0) | 581 | if (--jl->j_refcount == 0) |
584 | reiserfs_kfree(jl, sizeof(struct reiserfs_journal_list), s); | 582 | kfree(jl); |
585 | } | 583 | } |
586 | 584 | ||
587 | /* | 585 | /* |
@@ -1818,8 +1816,7 @@ void remove_journal_hash(struct super_block *sb, | |||
1818 | static void free_journal_ram(struct super_block *p_s_sb) | 1816 | static void free_journal_ram(struct super_block *p_s_sb) |
1819 | { | 1817 | { |
1820 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); | 1818 | struct reiserfs_journal *journal = SB_JOURNAL(p_s_sb); |
1821 | reiserfs_kfree(journal->j_current_jl, | 1819 | kfree(journal->j_current_jl); |
1822 | sizeof(struct reiserfs_journal_list), p_s_sb); | ||
1823 | journal->j_num_lists--; | 1820 | journal->j_num_lists--; |
1824 | 1821 | ||
1825 | vfree(journal->j_cnode_free_orig); | 1822 | vfree(journal->j_cnode_free_orig); |
@@ -2093,21 +2090,15 @@ static int journal_read_transaction(struct super_block *p_s_sb, | |||
2093 | } | 2090 | } |
2094 | trans_id = get_desc_trans_id(desc); | 2091 | trans_id = get_desc_trans_id(desc); |
2095 | /* now we know we've got a good transaction, and it was inside the valid time ranges */ | 2092 | /* now we know we've got a good transaction, and it was inside the valid time ranges */ |
2096 | log_blocks = | 2093 | log_blocks = kmalloc(get_desc_trans_len(desc) * |
2097 | reiserfs_kmalloc(get_desc_trans_len(desc) * | 2094 | sizeof(struct buffer_head *), GFP_NOFS); |
2098 | sizeof(struct buffer_head *), GFP_NOFS, p_s_sb); | 2095 | real_blocks = kmalloc(get_desc_trans_len(desc) * |
2099 | real_blocks = | 2096 | sizeof(struct buffer_head *), GFP_NOFS); |
2100 | reiserfs_kmalloc(get_desc_trans_len(desc) * | ||
2101 | sizeof(struct buffer_head *), GFP_NOFS, p_s_sb); | ||
2102 | if (!log_blocks || !real_blocks) { | 2097 | if (!log_blocks || !real_blocks) { |
2103 | brelse(c_bh); | 2098 | brelse(c_bh); |
2104 | brelse(d_bh); | 2099 | brelse(d_bh); |
2105 | reiserfs_kfree(log_blocks, | 2100 | kfree(log_blocks); |
2106 | get_desc_trans_len(desc) * | 2101 | kfree(real_blocks); |
2107 | sizeof(struct buffer_head *), p_s_sb); | ||
2108 | reiserfs_kfree(real_blocks, | ||
2109 | get_desc_trans_len(desc) * | ||
2110 | sizeof(struct buffer_head *), p_s_sb); | ||
2111 | reiserfs_warning(p_s_sb, | 2102 | reiserfs_warning(p_s_sb, |
2112 | "journal-1169: kmalloc failed, unable to mount FS"); | 2103 | "journal-1169: kmalloc failed, unable to mount FS"); |
2113 | return -1; | 2104 | return -1; |
@@ -2145,12 +2136,8 @@ static int journal_read_transaction(struct super_block *p_s_sb, | |||
2145 | brelse_array(real_blocks, i); | 2136 | brelse_array(real_blocks, i); |
2146 | brelse(c_bh); | 2137 | brelse(c_bh); |
2147 | brelse(d_bh); | 2138 | brelse(d_bh); |
2148 | reiserfs_kfree(log_blocks, | 2139 | kfree(log_blocks); |
2149 | get_desc_trans_len(desc) * | 2140 | kfree(real_blocks); |
2150 | sizeof(struct buffer_head *), p_s_sb); | ||
2151 | reiserfs_kfree(real_blocks, | ||
2152 | get_desc_trans_len(desc) * | ||
2153 | sizeof(struct buffer_head *), p_s_sb); | ||
2154 | return -1; | 2141 | return -1; |
2155 | } | 2142 | } |
2156 | } | 2143 | } |
@@ -2166,12 +2153,8 @@ static int journal_read_transaction(struct super_block *p_s_sb, | |||
2166 | brelse_array(real_blocks, get_desc_trans_len(desc)); | 2153 | brelse_array(real_blocks, get_desc_trans_len(desc)); |
2167 | brelse(c_bh); | 2154 | brelse(c_bh); |
2168 | brelse(d_bh); | 2155 | brelse(d_bh); |
2169 | reiserfs_kfree(log_blocks, | 2156 | kfree(log_blocks); |
2170 | get_desc_trans_len(desc) * | 2157 | kfree(real_blocks); |
2171 | sizeof(struct buffer_head *), p_s_sb); | ||
2172 | reiserfs_kfree(real_blocks, | ||
2173 | get_desc_trans_len(desc) * | ||
2174 | sizeof(struct buffer_head *), p_s_sb); | ||
2175 | return -1; | 2158 | return -1; |
2176 | } | 2159 | } |
2177 | memcpy(real_blocks[i]->b_data, log_blocks[i]->b_data, | 2160 | memcpy(real_blocks[i]->b_data, log_blocks[i]->b_data, |
@@ -2193,12 +2176,8 @@ static int journal_read_transaction(struct super_block *p_s_sb, | |||
2193 | get_desc_trans_len(desc) - i); | 2176 | get_desc_trans_len(desc) - i); |
2194 | brelse(c_bh); | 2177 | brelse(c_bh); |
2195 | brelse(d_bh); | 2178 | brelse(d_bh); |
2196 | reiserfs_kfree(log_blocks, | 2179 | kfree(log_blocks); |
2197 | get_desc_trans_len(desc) * | 2180 | kfree(real_blocks); |
2198 | sizeof(struct buffer_head *), p_s_sb); | ||
2199 | reiserfs_kfree(real_blocks, | ||
2200 | get_desc_trans_len(desc) * | ||
2201 | sizeof(struct buffer_head *), p_s_sb); | ||
2202 | return -1; | 2181 | return -1; |
2203 | } | 2182 | } |
2204 | brelse(real_blocks[i]); | 2183 | brelse(real_blocks[i]); |
@@ -2217,12 +2196,8 @@ static int journal_read_transaction(struct super_block *p_s_sb, | |||
2217 | journal->j_trans_id = trans_id + 1; | 2196 | journal->j_trans_id = trans_id + 1; |
2218 | brelse(c_bh); | 2197 | brelse(c_bh); |
2219 | brelse(d_bh); | 2198 | brelse(d_bh); |
2220 | reiserfs_kfree(log_blocks, | 2199 | kfree(log_blocks); |
2221 | le32_to_cpu(desc->j_len) * sizeof(struct buffer_head *), | 2200 | kfree(real_blocks); |
2222 | p_s_sb); | ||
2223 | reiserfs_kfree(real_blocks, | ||
2224 | le32_to_cpu(desc->j_len) * sizeof(struct buffer_head *), | ||
2225 | p_s_sb); | ||
2226 | return 0; | 2201 | return 0; |
2227 | } | 2202 | } |
2228 | 2203 | ||
@@ -2472,13 +2447,11 @@ static struct reiserfs_journal_list *alloc_journal_list(struct super_block *s) | |||
2472 | { | 2447 | { |
2473 | struct reiserfs_journal_list *jl; | 2448 | struct reiserfs_journal_list *jl; |
2474 | retry: | 2449 | retry: |
2475 | jl = reiserfs_kmalloc(sizeof(struct reiserfs_journal_list), GFP_NOFS, | 2450 | jl = kzalloc(sizeof(struct reiserfs_journal_list), GFP_NOFS); |
2476 | s); | ||
2477 | if (!jl) { | 2451 | if (!jl) { |
2478 | yield(); | 2452 | yield(); |
2479 | goto retry; | 2453 | goto retry; |
2480 | } | 2454 | } |
2481 | memset(jl, 0, sizeof(*jl)); | ||
2482 | INIT_LIST_HEAD(&jl->j_list); | 2455 | INIT_LIST_HEAD(&jl->j_list); |
2483 | INIT_LIST_HEAD(&jl->j_working_list); | 2456 | INIT_LIST_HEAD(&jl->j_working_list); |
2484 | INIT_LIST_HEAD(&jl->j_tail_bh_list); | 2457 | INIT_LIST_HEAD(&jl->j_tail_bh_list); |
@@ -3042,14 +3015,12 @@ struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct | |||
3042 | } | 3015 | } |
3043 | return th; | 3016 | return th; |
3044 | } | 3017 | } |
3045 | th = reiserfs_kmalloc(sizeof(struct reiserfs_transaction_handle), | 3018 | th = kmalloc(sizeof(struct reiserfs_transaction_handle), GFP_NOFS); |
3046 | GFP_NOFS, s); | ||
3047 | if (!th) | 3019 | if (!th) |
3048 | return NULL; | 3020 | return NULL; |
3049 | ret = journal_begin(th, s, nblocks); | 3021 | ret = journal_begin(th, s, nblocks); |
3050 | if (ret) { | 3022 | if (ret) { |
3051 | reiserfs_kfree(th, sizeof(struct reiserfs_transaction_handle), | 3023 | kfree(th); |
3052 | s); | ||
3053 | return NULL; | 3024 | return NULL; |
3054 | } | 3025 | } |
3055 | 3026 | ||
@@ -3067,8 +3038,7 @@ int reiserfs_end_persistent_transaction(struct reiserfs_transaction_handle *th) | |||
3067 | ret = -EIO; | 3038 | ret = -EIO; |
3068 | if (th->t_refcount == 0) { | 3039 | if (th->t_refcount == 0) { |
3069 | SB_JOURNAL(s)->j_persistent_trans--; | 3040 | SB_JOURNAL(s)->j_persistent_trans--; |
3070 | reiserfs_kfree(th, sizeof(struct reiserfs_transaction_handle), | 3041 | kfree(th); |
3071 | s); | ||
3072 | } | 3042 | } |
3073 | return ret; | 3043 | return ret; |
3074 | } | 3044 | } |