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 | |
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>
-rw-r--r-- | fs/reiserfs/dir.c | 16 | ||||
-rw-r--r-- | fs/reiserfs/fix_node.c | 50 | ||||
-rw-r--r-- | fs/reiserfs/journal.c | 84 | ||||
-rw-r--r-- | fs/reiserfs/namei.c | 16 | ||||
-rw-r--r-- | fs/reiserfs/procfs.c | 3 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 6 | ||||
-rw-r--r-- | fs/reiserfs/xattr.c | 11 | ||||
-rw-r--r-- | include/linux/reiserfs_fs.h | 16 | ||||
-rw-r--r-- | include/linux/reiserfs_fs_sb.h | 1 |
9 files changed, 49 insertions, 154 deletions
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c index 9dd71e807034..d71ac6579289 100644 --- a/fs/reiserfs/dir.c +++ b/fs/reiserfs/dir.c | |||
@@ -150,18 +150,15 @@ static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
150 | if (d_reclen <= 32) { | 150 | if (d_reclen <= 32) { |
151 | local_buf = small_buf; | 151 | local_buf = small_buf; |
152 | } else { | 152 | } else { |
153 | local_buf = | 153 | local_buf = kmalloc(d_reclen, |
154 | reiserfs_kmalloc(d_reclen, GFP_NOFS, | 154 | GFP_NOFS); |
155 | inode->i_sb); | ||
156 | if (!local_buf) { | 155 | if (!local_buf) { |
157 | pathrelse(&path_to_entry); | 156 | pathrelse(&path_to_entry); |
158 | ret = -ENOMEM; | 157 | ret = -ENOMEM; |
159 | goto out; | 158 | goto out; |
160 | } | 159 | } |
161 | if (item_moved(&tmp_ih, &path_to_entry)) { | 160 | if (item_moved(&tmp_ih, &path_to_entry)) { |
162 | reiserfs_kfree(local_buf, | 161 | kfree(local_buf); |
163 | d_reclen, | ||
164 | inode->i_sb); | ||
165 | goto research; | 162 | goto research; |
166 | } | 163 | } |
167 | } | 164 | } |
@@ -174,15 +171,12 @@ static int reiserfs_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
174 | (dirent, local_buf, d_reclen, d_off, d_ino, | 171 | (dirent, local_buf, d_reclen, d_off, d_ino, |
175 | DT_UNKNOWN) < 0) { | 172 | DT_UNKNOWN) < 0) { |
176 | if (local_buf != small_buf) { | 173 | if (local_buf != small_buf) { |
177 | reiserfs_kfree(local_buf, | 174 | kfree(local_buf); |
178 | d_reclen, | ||
179 | inode->i_sb); | ||
180 | } | 175 | } |
181 | goto end; | 176 | goto end; |
182 | } | 177 | } |
183 | if (local_buf != small_buf) { | 178 | if (local_buf != small_buf) { |
184 | reiserfs_kfree(local_buf, d_reclen, | 179 | kfree(local_buf); |
185 | inode->i_sb); | ||
186 | } | 180 | } |
187 | // next entry should be looked for with such offset | 181 | // next entry should be looked for with such offset |
188 | next_pos = deh_offset(deh) + 1; | 182 | next_pos = deh_offset(deh) + 1; |
diff --git a/fs/reiserfs/fix_node.c b/fs/reiserfs/fix_node.c index 45829889dcdc..aa22588019ec 100644 --- a/fs/reiserfs/fix_node.c +++ b/fs/reiserfs/fix_node.c | |||
@@ -2021,38 +2021,6 @@ static int get_neighbors(struct tree_balance *p_s_tb, int n_h) | |||
2021 | return CARRY_ON; | 2021 | return CARRY_ON; |
2022 | } | 2022 | } |
2023 | 2023 | ||
2024 | #ifdef CONFIG_REISERFS_CHECK | ||
2025 | void *reiserfs_kmalloc(size_t size, gfp_t flags, struct super_block *s) | ||
2026 | { | ||
2027 | void *vp; | ||
2028 | static size_t malloced; | ||
2029 | |||
2030 | vp = kmalloc(size, flags); | ||
2031 | if (vp) { | ||
2032 | REISERFS_SB(s)->s_kmallocs += size; | ||
2033 | if (REISERFS_SB(s)->s_kmallocs > malloced + 200000) { | ||
2034 | reiserfs_warning(s, | ||
2035 | "vs-8301: reiserfs_kmalloc: allocated memory %d", | ||
2036 | REISERFS_SB(s)->s_kmallocs); | ||
2037 | malloced = REISERFS_SB(s)->s_kmallocs; | ||
2038 | } | ||
2039 | } | ||
2040 | return vp; | ||
2041 | } | ||
2042 | |||
2043 | void reiserfs_kfree(const void *vp, size_t size, struct super_block *s) | ||
2044 | { | ||
2045 | kfree(vp); | ||
2046 | |||
2047 | REISERFS_SB(s)->s_kmallocs -= size; | ||
2048 | if (REISERFS_SB(s)->s_kmallocs < 0) | ||
2049 | reiserfs_warning(s, | ||
2050 | "vs-8302: reiserfs_kfree: allocated memory %d", | ||
2051 | REISERFS_SB(s)->s_kmallocs); | ||
2052 | |||
2053 | } | ||
2054 | #endif | ||
2055 | |||
2056 | static int get_virtual_node_size(struct super_block *sb, struct buffer_head *bh) | 2024 | static int get_virtual_node_size(struct super_block *sb, struct buffer_head *bh) |
2057 | { | 2025 | { |
2058 | int max_num_of_items; | 2026 | int max_num_of_items; |
@@ -2086,7 +2054,7 @@ static int get_mem_for_virtual_node(struct tree_balance *tb) | |||
2086 | /* we have to allocate more memory for virtual node */ | 2054 | /* we have to allocate more memory for virtual node */ |
2087 | if (tb->vn_buf) { | 2055 | if (tb->vn_buf) { |
2088 | /* free memory allocated before */ | 2056 | /* free memory allocated before */ |
2089 | reiserfs_kfree(tb->vn_buf, tb->vn_buf_size, tb->tb_sb); | 2057 | kfree(tb->vn_buf); |
2090 | /* this is not needed if kfree is atomic */ | 2058 | /* this is not needed if kfree is atomic */ |
2091 | check_fs = 1; | 2059 | check_fs = 1; |
2092 | } | 2060 | } |
@@ -2095,24 +2063,15 @@ static int get_mem_for_virtual_node(struct tree_balance *tb) | |||
2095 | tb->vn_buf_size = size; | 2063 | tb->vn_buf_size = size; |
2096 | 2064 | ||
2097 | /* get memory for virtual item */ | 2065 | /* get memory for virtual item */ |
2098 | buf = | 2066 | buf = kmalloc(size, GFP_ATOMIC | __GFP_NOWARN); |
2099 | reiserfs_kmalloc(size, GFP_ATOMIC | __GFP_NOWARN, | ||
2100 | tb->tb_sb); | ||
2101 | if (!buf) { | 2067 | if (!buf) { |
2102 | /* getting memory with GFP_KERNEL priority may involve | 2068 | /* getting memory with GFP_KERNEL priority may involve |
2103 | balancing now (due to indirect_to_direct conversion on | 2069 | balancing now (due to indirect_to_direct conversion on |
2104 | dcache shrinking). So, release path and collected | 2070 | dcache shrinking). So, release path and collected |
2105 | resources here */ | 2071 | resources here */ |
2106 | free_buffers_in_tb(tb); | 2072 | free_buffers_in_tb(tb); |
2107 | buf = reiserfs_kmalloc(size, GFP_NOFS, tb->tb_sb); | 2073 | buf = kmalloc(size, GFP_NOFS); |
2108 | if (!buf) { | 2074 | if (!buf) { |
2109 | #ifdef CONFIG_REISERFS_CHECK | ||
2110 | reiserfs_warning(tb->tb_sb, | ||
2111 | "vs-8345: get_mem_for_virtual_node: " | ||
2112 | "kmalloc failed. reiserfs kmalloced %d bytes", | ||
2113 | REISERFS_SB(tb->tb_sb)-> | ||
2114 | s_kmallocs); | ||
2115 | #endif | ||
2116 | tb->vn_buf_size = 0; | 2075 | tb->vn_buf_size = 0; |
2117 | } | 2076 | } |
2118 | tb->vn_buf = buf; | 2077 | tb->vn_buf = buf; |
@@ -2619,7 +2578,6 @@ void unfix_nodes(struct tree_balance *tb) | |||
2619 | } | 2578 | } |
2620 | } | 2579 | } |
2621 | 2580 | ||
2622 | if (tb->vn_buf) | 2581 | kfree(tb->vn_buf); |
2623 | reiserfs_kfree(tb->vn_buf, tb->vn_buf_size, tb->tb_sb); | ||
2624 | 2582 | ||
2625 | } | 2583 | } |
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 | } |
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index 8f8d8d01107c..c8123308e060 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
@@ -456,7 +456,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th, | |||
456 | /* get memory for composing the entry */ | 456 | /* get memory for composing the entry */ |
457 | buflen = DEH_SIZE + ROUND_UP(namelen); | 457 | buflen = DEH_SIZE + ROUND_UP(namelen); |
458 | if (buflen > sizeof(small_buf)) { | 458 | if (buflen > sizeof(small_buf)) { |
459 | buffer = reiserfs_kmalloc(buflen, GFP_NOFS, dir->i_sb); | 459 | buffer = kmalloc(buflen, GFP_NOFS); |
460 | if (buffer == 0) | 460 | if (buffer == 0) |
461 | return -ENOMEM; | 461 | return -ENOMEM; |
462 | } else | 462 | } else |
@@ -490,7 +490,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th, | |||
490 | retval = reiserfs_find_entry(dir, name, namelen, &path, &de); | 490 | retval = reiserfs_find_entry(dir, name, namelen, &path, &de); |
491 | if (retval != NAME_NOT_FOUND) { | 491 | if (retval != NAME_NOT_FOUND) { |
492 | if (buffer != small_buf) | 492 | if (buffer != small_buf) |
493 | reiserfs_kfree(buffer, buflen, dir->i_sb); | 493 | kfree(buffer); |
494 | pathrelse(&path); | 494 | pathrelse(&path); |
495 | 495 | ||
496 | if (retval == IO_ERROR) { | 496 | if (retval == IO_ERROR) { |
@@ -515,7 +515,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th, | |||
515 | reiserfs_warning(dir->i_sb, | 515 | reiserfs_warning(dir->i_sb, |
516 | "reiserfs_add_entry: Congratulations! we have got hash function screwed up"); | 516 | "reiserfs_add_entry: Congratulations! we have got hash function screwed up"); |
517 | if (buffer != small_buf) | 517 | if (buffer != small_buf) |
518 | reiserfs_kfree(buffer, buflen, dir->i_sb); | 518 | kfree(buffer); |
519 | pathrelse(&path); | 519 | pathrelse(&path); |
520 | return -EBUSY; | 520 | return -EBUSY; |
521 | } | 521 | } |
@@ -535,7 +535,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th, | |||
535 | &entry_key); | 535 | &entry_key); |
536 | 536 | ||
537 | if (buffer != small_buf) | 537 | if (buffer != small_buf) |
538 | reiserfs_kfree(buffer, buflen, dir->i_sb); | 538 | kfree(buffer); |
539 | pathrelse(&path); | 539 | pathrelse(&path); |
540 | return -EBUSY; | 540 | return -EBUSY; |
541 | } | 541 | } |
@@ -546,7 +546,7 @@ static int reiserfs_add_entry(struct reiserfs_transaction_handle *th, | |||
546 | reiserfs_paste_into_item(th, &path, &entry_key, dir, buffer, | 546 | reiserfs_paste_into_item(th, &path, &entry_key, dir, buffer, |
547 | paste_size); | 547 | paste_size); |
548 | if (buffer != small_buf) | 548 | if (buffer != small_buf) |
549 | reiserfs_kfree(buffer, buflen, dir->i_sb); | 549 | kfree(buffer); |
550 | if (retval) { | 550 | if (retval) { |
551 | reiserfs_check_path(&path); | 551 | reiserfs_check_path(&path); |
552 | return retval; | 552 | return retval; |
@@ -1065,7 +1065,7 @@ static int reiserfs_symlink(struct inode *parent_dir, | |||
1065 | goto out_failed; | 1065 | goto out_failed; |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | name = reiserfs_kmalloc(item_len, GFP_NOFS, parent_dir->i_sb); | 1068 | name = kmalloc(item_len, GFP_NOFS); |
1069 | if (!name) { | 1069 | if (!name) { |
1070 | drop_new_inode(inode); | 1070 | drop_new_inode(inode); |
1071 | retval = -ENOMEM; | 1071 | retval = -ENOMEM; |
@@ -1079,14 +1079,14 @@ static int reiserfs_symlink(struct inode *parent_dir, | |||
1079 | retval = journal_begin(&th, parent_dir->i_sb, jbegin_count); | 1079 | retval = journal_begin(&th, parent_dir->i_sb, jbegin_count); |
1080 | if (retval) { | 1080 | if (retval) { |
1081 | drop_new_inode(inode); | 1081 | drop_new_inode(inode); |
1082 | reiserfs_kfree(name, item_len, parent_dir->i_sb); | 1082 | kfree(name); |
1083 | goto out_failed; | 1083 | goto out_failed; |
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | retval = | 1086 | retval = |
1087 | reiserfs_new_inode(&th, parent_dir, mode, name, strlen(symname), | 1087 | reiserfs_new_inode(&th, parent_dir, mode, name, strlen(symname), |
1088 | dentry, inode); | 1088 | dentry, inode); |
1089 | reiserfs_kfree(name, item_len, parent_dir->i_sb); | 1089 | kfree(name); |
1090 | if (retval) { /* reiserfs_new_inode iputs for us */ | 1090 | if (retval) { /* reiserfs_new_inode iputs for us */ |
1091 | goto out_failed; | 1091 | goto out_failed; |
1092 | } | 1092 | } |
diff --git a/fs/reiserfs/procfs.c b/fs/reiserfs/procfs.c index fc2f43c75df4..ef6caed9336b 100644 --- a/fs/reiserfs/procfs.c +++ b/fs/reiserfs/procfs.c | |||
@@ -88,7 +88,6 @@ static int show_super(struct seq_file *m, struct super_block *sb) | |||
88 | seq_printf(m, "state: \t%s\n" | 88 | seq_printf(m, "state: \t%s\n" |
89 | "mount options: \t%s%s%s%s%s%s%s%s%s%s%s\n" | 89 | "mount options: \t%s%s%s%s%s%s%s%s%s%s%s\n" |
90 | "gen. counter: \t%i\n" | 90 | "gen. counter: \t%i\n" |
91 | "s_kmallocs: \t%i\n" | ||
92 | "s_disk_reads: \t%i\n" | 91 | "s_disk_reads: \t%i\n" |
93 | "s_disk_writes: \t%i\n" | 92 | "s_disk_writes: \t%i\n" |
94 | "s_fix_nodes: \t%i\n" | 93 | "s_fix_nodes: \t%i\n" |
@@ -128,7 +127,7 @@ static int show_super(struct seq_file *m, struct super_block *sb) | |||
128 | "SMALL_TAILS " : "NO_TAILS ", | 127 | "SMALL_TAILS " : "NO_TAILS ", |
129 | replay_only(sb) ? "REPLAY_ONLY " : "", | 128 | replay_only(sb) ? "REPLAY_ONLY " : "", |
130 | convert_reiserfs(sb) ? "CONV " : "", | 129 | convert_reiserfs(sb) ? "CONV " : "", |
131 | atomic_read(&r->s_generation_counter), SF(s_kmallocs), | 130 | atomic_read(&r->s_generation_counter), |
132 | SF(s_disk_reads), SF(s_disk_writes), SF(s_fix_nodes), | 131 | SF(s_disk_reads), SF(s_disk_writes), SF(s_fix_nodes), |
133 | SF(s_do_balance), SF(s_unneeded_left_neighbor), | 132 | SF(s_do_balance), SF(s_unneeded_left_neighbor), |
134 | SF(s_good_search_by_key_reada), SF(s_bmaps), | 133 | SF(s_good_search_by_key_reada), SF(s_bmaps), |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 397d9590c8f2..77891de0e02e 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -472,12 +472,6 @@ static void reiserfs_put_super(struct super_block *s) | |||
472 | 472 | ||
473 | print_statistics(s); | 473 | print_statistics(s); |
474 | 474 | ||
475 | if (REISERFS_SB(s)->s_kmallocs != 0) { | ||
476 | reiserfs_warning(s, | ||
477 | "vs-2004: reiserfs_put_super: allocated memory left %d", | ||
478 | REISERFS_SB(s)->s_kmallocs); | ||
479 | } | ||
480 | |||
481 | if (REISERFS_SB(s)->reserved_blocks != 0) { | 475 | if (REISERFS_SB(s)->reserved_blocks != 0) { |
482 | reiserfs_warning(s, | 476 | reiserfs_warning(s, |
483 | "green-2005: reiserfs_put_super: reserved blocks left %d", | 477 | "green-2005: reiserfs_put_super: reserved blocks left %d", |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index cc061bfd437b..4f0db4e54517 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -368,15 +368,13 @@ static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
368 | if (d_reclen <= 32) { | 368 | if (d_reclen <= 32) { |
369 | local_buf = small_buf; | 369 | local_buf = small_buf; |
370 | } else { | 370 | } else { |
371 | local_buf = | 371 | local_buf = kmalloc(d_reclen, GFP_NOFS); |
372 | reiserfs_kmalloc(d_reclen, GFP_NOFS, inode->i_sb); | ||
373 | if (!local_buf) { | 372 | if (!local_buf) { |
374 | pathrelse(&path_to_entry); | 373 | pathrelse(&path_to_entry); |
375 | return -ENOMEM; | 374 | return -ENOMEM; |
376 | } | 375 | } |
377 | if (item_moved(&tmp_ih, &path_to_entry)) { | 376 | if (item_moved(&tmp_ih, &path_to_entry)) { |
378 | reiserfs_kfree(local_buf, d_reclen, | 377 | kfree(local_buf); |
379 | inode->i_sb); | ||
380 | 378 | ||
381 | /* sigh, must retry. Do this same offset again */ | 379 | /* sigh, must retry. Do this same offset again */ |
382 | next_pos = d_off; | 380 | next_pos = d_off; |
@@ -399,13 +397,12 @@ static int __xattr_readdir(struct file *filp, void *dirent, filldir_t filldir) | |||
399 | if (filldir(dirent, local_buf, d_reclen, d_off, d_ino, | 397 | if (filldir(dirent, local_buf, d_reclen, d_off, d_ino, |
400 | DT_UNKNOWN) < 0) { | 398 | DT_UNKNOWN) < 0) { |
401 | if (local_buf != small_buf) { | 399 | if (local_buf != small_buf) { |
402 | reiserfs_kfree(local_buf, d_reclen, | 400 | kfree(local_buf); |
403 | inode->i_sb); | ||
404 | } | 401 | } |
405 | goto end; | 402 | goto end; |
406 | } | 403 | } |
407 | if (local_buf != small_buf) { | 404 | if (local_buf != small_buf) { |
408 | reiserfs_kfree(local_buf, d_reclen, inode->i_sb); | 405 | kfree(local_buf); |
409 | } | 406 | } |
410 | } /* while */ | 407 | } /* while */ |
411 | 408 | ||
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index e276c5ba2bb7..7d51149bd793 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -1971,22 +1971,6 @@ extern struct file_operations reiserfs_file_operations; | |||
1971 | extern struct address_space_operations reiserfs_address_space_operations; | 1971 | extern struct address_space_operations reiserfs_address_space_operations; |
1972 | 1972 | ||
1973 | /* fix_nodes.c */ | 1973 | /* fix_nodes.c */ |
1974 | #ifdef CONFIG_REISERFS_CHECK | ||
1975 | void *reiserfs_kmalloc(size_t size, gfp_t flags, struct super_block *s); | ||
1976 | void reiserfs_kfree(const void *vp, size_t size, struct super_block *s); | ||
1977 | #else | ||
1978 | static inline void *reiserfs_kmalloc(size_t size, int flags, | ||
1979 | struct super_block *s) | ||
1980 | { | ||
1981 | return kmalloc(size, flags); | ||
1982 | } | ||
1983 | |||
1984 | static inline void reiserfs_kfree(const void *vp, size_t size, | ||
1985 | struct super_block *s) | ||
1986 | { | ||
1987 | kfree(vp); | ||
1988 | } | ||
1989 | #endif | ||
1990 | 1974 | ||
1991 | int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb, | 1975 | int fix_nodes(int n_op_mode, struct tree_balance *p_s_tb, |
1992 | struct item_head *p_s_ins_ih, const void *); | 1976 | struct item_head *p_s_ins_ih, const void *); |
diff --git a/include/linux/reiserfs_fs_sb.h b/include/linux/reiserfs_fs_sb.h index 3e68592e52e9..31b4c0bd4fa0 100644 --- a/include/linux/reiserfs_fs_sb.h +++ b/include/linux/reiserfs_fs_sb.h | |||
@@ -382,7 +382,6 @@ struct reiserfs_sb_info { | |||
382 | on-disk FS format */ | 382 | on-disk FS format */ |
383 | 383 | ||
384 | /* session statistics */ | 384 | /* session statistics */ |
385 | int s_kmallocs; | ||
386 | int s_disk_reads; | 385 | int s_disk_reads; |
387 | int s_disk_writes; | 386 | int s_disk_writes; |
388 | int s_fix_nodes; | 387 | int s_fix_nodes; |