public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: cl@linux-foundation.org
To: linux-kernel@vger.kernel.org
Cc: Tejun Heo <tj@kernel.org>, Christoph Hellwig <hch@lst.de>,
	Olaf Weber <olaf@sgi.com>
Cc: mingo@elte.hu
Cc: rusty@rustcorp.com.au
Cc: davem@davemloft.net
Subject: [my_cpu_ptr 4/5] sda_icsb_modify_counters() does not need a "cpu" variable
Date: Wed, 27 May 2009 13:47:02 -0400	[thread overview]
Message-ID: <20090527180716.456986138@gentwo.org> (raw)
In-Reply-To: 20090527180635.008102701@gentwo.org

[-- Attachment #1: my_cpu_ptr_xfs --]
[-- Type: text/plain, Size: 1439 bytes --]

The xfs_icsb_modify_counters() function no longer needs the cpu variable
if we use my_cpu_ptr() and we can get rid of get/put_cpu().

Cc: Christoph Hellwig <hch@lst.de>
Cc: Olaf Weber <olaf@sgi.com>
Signed-off-by: Christoph Lameter <cl@linux-foundation.org>

---
 fs/xfs/xfs_mount.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Index: linux-2.6/fs/xfs/xfs_mount.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_mount.c	2009-05-27 11:54:37.000000000 -0500
+++ linux-2.6/fs/xfs/xfs_mount.c	2009-05-27 11:55:10.000000000 -0500
@@ -2320,12 +2320,12 @@ xfs_icsb_modify_counters(
 {
 	xfs_icsb_cnts_t	*icsbp;
 	long long	lcounter;	/* long counter for 64 bit fields */
-	int		cpu, ret = 0;
+	int		ret = 0;
 
 	might_sleep();
 again:
-	cpu = get_cpu();
-	icsbp = (xfs_icsb_cnts_t *)per_cpu_ptr(mp->m_sb_cnts, cpu);
+	preempt_disable();
+	icsbp = (xfs_icsb_cnts_t *)my_cpu_ptr(mp->m_sb_cnts);
 
 	/*
 	 * if the counter is disabled, go to slow path
@@ -2369,11 +2369,11 @@ again:
 		break;
 	}
 	xfs_icsb_unlock_cntr(icsbp);
-	put_cpu();
+	preempt_enable();
 	return 0;
 
 slow_path:
-	put_cpu();
+	preempt_enable();
 
 	/*
 	 * serialise with a mutex so we don't burn lots of cpu on
@@ -2421,7 +2421,7 @@ slow_path:
 
 balance_counter:
 	xfs_icsb_unlock_cntr(icsbp);
-	put_cpu();
+	preempt_enable();
 
 	/*
 	 * We may have multiple threads here if multiple per-cpu

-- 

  parent reply	other threads:[~2009-05-27 18:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-27 17:46 [my_cpu_ptr 0/5] Introduce my_cpu_ptr/__my_cpu_ptr cl
2009-05-27 17:46 ` [my_cpu_ptr 1/5] Introduce my_cpu_ptr() cl
2009-05-28  3:46   ` Rusty Russell
2009-05-28 15:59     ` Christoph Lameter
2009-05-29  1:27       ` Rusty Russell
2009-05-29 15:37         ` Christoph Lameter
2009-05-31  3:19           ` Rusty Russell
2009-06-03 14:08             ` Christoph Lameter
2009-05-28 16:10     ` Christoph Hellwig
2009-05-28 16:37       ` Christoph Lameter
2009-05-29  9:46         ` Tejun Heo
2009-05-27 17:47 ` [my_cpu_ptr 2/5] Straight transformations cl
2009-05-27 17:47 ` [my_cpu_ptr 3/5] Elimninate get/put_cpu cl
2009-05-27 19:33   ` Christoph Lameter
2009-05-27 17:47 ` cl [this message]
2009-05-28 13:45   ` [my_cpu_ptr 4/5] sda_icsb_modify_counters() does not need a "cpu" variable Olaf Weber
2009-05-27 17:47 ` [my_cpu_ptr 5/5] Use my_cpu_ptr in crypto subsystem cl

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=20090527180716.456986138@gentwo.org \
    --to=cl@linux-foundation.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olaf@sgi.com \
    --cc=tj@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