Commit 736c7b80 authored by Coywolf Qi Hunt's avatar Coywolf Qi Hunt Committed by Linus Torvalds

[PATCH] alloc_buffer_head() and free_buffer_head() cleanup

Signed-off-by: default avatarCoywolf Qi Hunt <qiyong@fc-cn.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3f4bb1f4
...@@ -3046,10 +3046,9 @@ struct buffer_head *alloc_buffer_head(unsigned int __nocast gfp_flags) ...@@ -3046,10 +3046,9 @@ struct buffer_head *alloc_buffer_head(unsigned int __nocast gfp_flags)
{ {
struct buffer_head *ret = kmem_cache_alloc(bh_cachep, gfp_flags); struct buffer_head *ret = kmem_cache_alloc(bh_cachep, gfp_flags);
if (ret) { if (ret) {
preempt_disable(); get_cpu_var(bh_accounting).nr++;
__get_cpu_var(bh_accounting).nr++;
recalc_bh_state(); recalc_bh_state();
preempt_enable(); put_cpu_var(bh_accounting);
} }
return ret; return ret;
} }
...@@ -3059,10 +3058,9 @@ void free_buffer_head(struct buffer_head *bh) ...@@ -3059,10 +3058,9 @@ void free_buffer_head(struct buffer_head *bh)
{ {
BUG_ON(!list_empty(&bh->b_assoc_buffers)); BUG_ON(!list_empty(&bh->b_assoc_buffers));
kmem_cache_free(bh_cachep, bh); kmem_cache_free(bh_cachep, bh);
preempt_disable(); get_cpu_var(bh_accounting).nr--;
__get_cpu_var(bh_accounting).nr--;
recalc_bh_state(); recalc_bh_state();
preempt_enable(); put_cpu_var(bh_accounting);
} }
EXPORT_SYMBOL(free_buffer_head); EXPORT_SYMBOL(free_buffer_head);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment