linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mingming Cao <cmm@us.ibm.com>
To: akpm@osdl.org
Cc: kiran@scalex86.org, LaurentVivier@wanadoo.fr, sct@redhat.com,
	linux-kernel@vger.kernel.org,
	ext2-devel <ext2-devel@lists.sourceforge.net>,
	linux-fsdevel@vger.kernel.org
Subject: [PATCH 2/2] Set initial value when calling percpu counter initialization routine
Date: Mon, 24 Apr 2006 15:51:46 -0700	[thread overview]
Message-ID: <1145919106.4820.45.camel@dyn9047017069.beaverton.ibm.com> (raw)
In-Reply-To: <1145631550.4478.11.camel@localhost.localdomain>


[PATCH 2] - Updates in the users of the percpu counters, to 
make use of the new percpu_counter_init() routine now take additional
parameter to allow user to pass the initial value of the global counter.

Signed-Off-By: Mingming Cao <cmm@us.ibm.com>---

 linux-2.6.16-cmm/fs/ext2/super.c        |    9 +++------
 linux-2.6.16-cmm/fs/ext3/super.c        |    9 +++------
 linux-2.6.16-cmm/fs/file_table.c        |    2 +-
 linux-2.6.16-cmm/net/core/sock.c        |    2 +-
 linux-2.6.16-cmm/net/decnet/af_decnet.c |    2 +-
 linux-2.6.16-cmm/net/ipv4/proc.c        |    2 +-
 linux-2.6.16-cmm/net/ipv4/tcp.c         |    2 +-
 7 files changed, 11 insertions(+), 17 deletions(-)

diff -puN fs/ext3/super.c~ext3_64bit_percpu_counter_fix fs/ext3/super.c
--- linux-2.6.16/fs/ext3/super.c~ext3_64bit_percpu_counter_fix	2006-04-24 14:19:18.000000000 -0700
+++ linux-2.6.16-cmm/fs/ext3/super.c	2006-04-24 14:19:18.000000000 -0700
@@ -1583,9 +1583,6 @@ static int ext3_fill_super (struct super
 		goto failed_mount;
 	}
 
-	percpu_counter_init(&sbi->s_freeblocks_counter);
-	percpu_counter_init(&sbi->s_freeinodes_counter);
-	percpu_counter_init(&sbi->s_dirs_counter);
 	bgl_lock_init(&sbi->s_blockgroup_lock);
 
 	for (i = 0; i < db_count; i++) {
@@ -1727,11 +1724,11 @@ static int ext3_fill_super (struct super
 		test_opt(sb,DATA_FLAGS) == EXT3_MOUNT_ORDERED_DATA ? "ordered":
 		"writeback");
 
-	percpu_counter_mod(&sbi->s_freeblocks_counter,
+	percpu_counter_init(&sbi->s_freeblocks_counter,
 		ext3_count_free_blocks(sb));
-	percpu_counter_mod(&sbi->s_freeinodes_counter,
+	percpu_counter_init(&sbi->s_freeinodes_counter,
 		ext3_count_free_inodes(sb));
-	percpu_counter_mod(&sbi->s_dirs_counter,
+	percpu_counter_init(&sbi->s_dirs_counter,
 		ext3_count_dirs(sb));
 
 	lock_kernel();
diff -puN fs/file_table.c~ext3_64bit_percpu_counter_fix fs/file_table.c
--- linux-2.6.16/fs/file_table.c~ext3_64bit_percpu_counter_fix	2006-04-24 14:19:18.000000000 -0700
+++ linux-2.6.16-cmm/fs/file_table.c	2006-04-24 14:19:18.000000000 -0700
@@ -300,5 +300,5 @@ void __init files_init(unsigned long mem
 	if (files_stat.max_files < NR_FILE)
 		files_stat.max_files = NR_FILE;
 	files_defer_init();
-	percpu_counter_init(&nr_files);
+	percpu_counter_init(&nr_files, 0);
 } 
diff -puN net/decnet/af_decnet.c~ext3_64bit_percpu_counter_fix net/decnet/af_decnet.c
--- linux-2.6.16/net/decnet/af_decnet.c~ext3_64bit_percpu_counter_fix	2006-04-24 14:19:18.000000000 -0700
+++ linux-2.6.16-cmm/net/decnet/af_decnet.c	2006-04-24 14:19:18.000000000 -0700
@@ -2384,7 +2384,7 @@ static int __init decnet_init(void)
 	if (rc != 0)
 		goto out;
 
-	percpu_counter_init(&decnet_memory_allocated);
+	percpu_counter_init(&decnet_memory_allocated, 0);
 	dn_neigh_init();
 	dn_dev_init();
 	dn_route_init();
diff -puN net/ipv4/tcp.c~ext3_64bit_percpu_counter_fix net/ipv4/tcp.c
--- linux-2.6.16/net/ipv4/tcp.c~ext3_64bit_percpu_counter_fix	2006-04-24 14:19:18.000000000 -0700
+++ linux-2.6.16-cmm/net/ipv4/tcp.c	2006-04-24 14:19:18.000000000 -0700
@@ -2178,7 +2178,7 @@ void __init tcp_init(void)
 	       "(established %d bind %d)\n",
 	       tcp_hashinfo.ehash_size << 1, tcp_hashinfo.bhash_size);
 
-	percpu_counter_init(&tcp_memory_allocated);
+	percpu_counter_init(&tcp_memory_allocated, 0);
 
 	tcp_register_congestion_control(&tcp_reno);
 }
diff -puN fs/ext2/super.c~ext3_64bit_percpu_counter_fix fs/ext2/super.c
--- linux-2.6.16/fs/ext2/super.c~ext3_64bit_percpu_counter_fix	2006-04-24 14:19:18.000000000 -0700
+++ linux-2.6.16-cmm/fs/ext2/super.c	2006-04-24 14:19:18.000000000 -0700
@@ -834,9 +834,6 @@ static int ext2_fill_super(struct super_
 		printk ("EXT2-fs: not enough memory\n");
 		goto failed_mount;
 	}
-	percpu_counter_init(&sbi->s_freeblocks_counter);
-	percpu_counter_init(&sbi->s_freeinodes_counter);
-	percpu_counter_init(&sbi->s_dirs_counter);
 	bgl_lock_init(&sbi->s_blockgroup_lock);
 	sbi->s_debts = kmalloc(sbi->s_groups_count * sizeof(*sbi->s_debts),
 			       GFP_KERNEL);
@@ -886,11 +883,11 @@ static int ext2_fill_super(struct super_
 		ext2_warning(sb, __FUNCTION__,
 			"mounting ext3 filesystem as ext2");
 	ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY);
-	percpu_counter_mod(&sbi->s_freeblocks_counter,
+	percpu_counter_init(&sbi->s_freeblocks_counter,
 				ext2_count_free_blocks(sb));
-	percpu_counter_mod(&sbi->s_freeinodes_counter,
+	percpu_counter_init(&sbi->s_freeinodes_counter,
 				ext2_count_free_inodes(sb));
-	percpu_counter_mod(&sbi->s_dirs_counter,
+	percpu_counter_init(&sbi->s_dirs_counter,
 				ext2_count_dirs(sb));
 	return 0;
 
diff -puN net/ipv4/proc.c~ext3_64bit_percpu_counter_fix net/ipv4/proc.c
--- linux-2.6.16/net/ipv4/proc.c~ext3_64bit_percpu_counter_fix	2006-04-24 14:19:18.000000000 -0700
+++ linux-2.6.16-cmm/net/ipv4/proc.c	2006-04-24 14:19:18.000000000 -0700
@@ -61,7 +61,7 @@ static int fold_prot_inuse(struct proto 
 static int sockstat_seq_show(struct seq_file *seq, void *v)
 {
 	socket_seq_show(seq);
-	seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %lu\n",
+	seq_printf(seq, "TCP: inuse %d orphan %d tw %d alloc %d mem %llu\n",
 		   fold_prot_inuse(&tcp_prot), atomic_read(&tcp_orphan_count),
 		   tcp_death_row.tw_count, read_sockets_allocated(&tcp_prot),
 		   percpu_counter_read_positive(&tcp_memory_allocated));
diff -puN net/core/sock.c~ext3_64bit_percpu_counter_fix net/core/sock.c
--- linux-2.6.16/net/core/sock.c~ext3_64bit_percpu_counter_fix	2006-04-24 14:19:18.000000000 -0700
+++ linux-2.6.16-cmm/net/core/sock.c	2006-04-24 14:19:18.000000000 -0700
@@ -1783,7 +1783,7 @@ static char proto_method_implemented(con
 
 static void proto_seq_printf(struct seq_file *seq, struct proto *proto)
 {
-	seq_printf(seq, "%-9s %4u %6d  %6lu   %-3s %6u   %-3s  %-10s "
+	seq_printf(seq, "%-9s %4u %6d  %6llu   %-3s %6u   %-3s  %-10s "
 			"%2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c %2c\n",
 		   proto->name,
 		   proto->obj_size,

_




-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

      reply	other threads:[~2006-04-24 22:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-10 17:59 [RFC][PATCH 1/3] per cpu counter fixes for unsigned long type counter overflow Mingming Cao
2006-04-10 22:18 ` Andrew Morton
2006-04-11  1:09   ` Mingming Cao
2006-04-11  7:54     ` Andreas Dilger
2006-04-11 17:23       ` Mingming Cao
2006-04-21 14:59 ` [PATCH 2/2] ext3 free blocks counter initialization fix Mingming Cao
2006-04-24 22:51   ` Mingming Cao [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=1145919106.4820.45.camel@dyn9047017069.beaverton.ibm.com \
    --to=cmm@us.ibm.com \
    --cc=LaurentVivier@wanadoo.fr \
    --cc=akpm@osdl.org \
    --cc=ext2-devel@lists.sourceforge.net \
    --cc=kiran@scalex86.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sct@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).