diff options
Diffstat (limited to 'fs/reiserfs/fix_node.c')
| -rw-r--r-- | fs/reiserfs/fix_node.c | 50 |
1 files changed, 4 insertions, 46 deletions
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 | } |
