[patch] alloc_buffer_head() and free_buffer_head() cleanup

From: Coywolf Qi Hunt
Date: Thu Aug 25 2005 - 10:34:28 EST


On Thu, Aug 25, 2005 at 04:37:51PM +0800, Coywolf Qi Hunt wrote:
> Hello,
>
> This cleanups up alloc_buffer_head(), by using a single get_cpu_var().
> Boot tested.

Also cleanup free_buffer_head().

Coywolf


Signed-off-by: Coywolf Qi Hunt <qiyong@xxxxxxxxx>
---

buffer.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)

--- 2.6.13-rc6-mm2/fs/buffer.c~orig 2005-08-25 22:50:29.000000000 +0800
+++ 2.6.13-rc6-mm2/fs/buffer.c 2005-08-25 23:03:32.000000000 +0800
@@ -3049,10 +3049,9 @@ struct buffer_head *alloc_buffer_head(un
{
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;
}
@@ -3062,10 +3061,9 @@ void free_buffer_head(struct buffer_head
{
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);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/