Skip to content

Commit

Permalink
[PATCH] alloc_buffer_head() and free_buffer_head() cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Coywolf Qi Hunt <qiyong@fc-cn.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Coywolf Qi Hunt authored and Linus Torvalds committed Sep 7, 2005
1 parent 3f4bb1f commit 736c7b8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions fs/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
if (ret) {
preempt_disable();
__get_cpu_var(bh_accounting).nr++;
get_cpu_var(bh_accounting).nr++;
recalc_bh_state();
preempt_enable();
put_cpu_var(bh_accounting);
}
return ret;
}
Expand All @@ -3059,10 +3058,9 @@ void free_buffer_head(struct buffer_head *bh)
{
BUG_ON(!list_empty(&bh->b_assoc_buffers));
kmem_cache_free(bh_cachep, bh);
preempt_disable();
__get_cpu_var(bh_accounting).nr--;
get_cpu_var(bh_accounting).nr--;
recalc_bh_state();
preempt_enable();
put_cpu_var(bh_accounting);
}
EXPORT_SYMBOL(free_buffer_head);

Expand Down

0 comments on commit 736c7b8

Please sign in to comment.