public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Coywolf Qi Hunt" <coywolf@sosdg.org>
To: coywolf@sosdg.org
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: [patch] alloc_buffer_head() and free_buffer_head() cleanup
Date: Thu, 25 Aug 2005 23:35:46 +0800	[thread overview]
Message-ID: <20050825153546.GA10202@gmail.com> (raw)
In-Reply-To: <20050825083751.GA4076@localhost.localdomain>

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@fc-cn.com>
---

 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);
 

      reply	other threads:[~2005-08-25 15:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-25  8:37 [patch] alloc_buffer_head() cleanup Coywolf Qi Hunt
2005-08-25 15:35 ` Coywolf Qi Hunt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050825153546.GA10202@gmail.com \
    --to=coywolf@sosdg.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox