http://jfs.bkbits.net/linux-2.5
jfs.adm@bkbits.net|ChangeSet|20050302151549|04798 jfs.adm

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2005/02/18 16:45:25-06:00 shaggy@austin.ibm.com 
#   JFS: change project url to http://jfs.sourceforge.net/
#   
#   Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
# 
# MAINTAINERS
#   2005/02/18 16:45:14-06:00 shaggy@austin.ibm.com +2 -2
#   move to sourceforge.net
# 
# Documentation/Changes
#   2005/02/18 16:45:14-06:00 shaggy@austin.ibm.com +1 -1
#   move to sourceforge.net
# 
# ChangeSet
#   2005/02/18 16:41:17-06:00 shaggy@austin.ibm.com 
#   JFS: allow iocharset=none mount option
#   
#   iocharset=none is an explicit option to specify the default
#   character translation be used (no translation).  This allows
#   remounting a partition which was mounted with a different setting,
#   and allows the same mount options to be used between 2.6 and 2.4
#   kernels, where there is a different default.
#   
#   Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
# 
# fs/jfs/super.c
#   2005/02/18 16:41:05-06:00 shaggy@austin.ibm.com +13 -8
#   Allow iocharset=none mount option
# 
# Documentation/filesystems/jfs.txt
#   2005/02/18 16:41:05-06:00 shaggy@austin.ibm.com +3 -9
#   Allow iocharset=none mount option
# 
# ChangeSet
#   2005/02/15 15:47:08-06:00 shaggy@austin.ibm.com 
#   JFS: Fix array overflow
#   
#   On a system with more than 64 processors, commit_threads was too
#   big and caused an array overflow.  Always limit it to MAX_COMMIT_THREADS.
#   
#   Also, avoid waking up more than one commit thread at a time.
#   
#   Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
# 
# fs/jfs/super.c
#   2005/02/15 15:46:55-06:00 shaggy@austin.ibm.com +1 -1
#   Prevent array overflow by limiting commit_threads to MAX_COMMIT_THREADS
# 
# fs/jfs/jfs_txnmgr.c
#   2005/02/15 15:46:55-06:00 shaggy@austin.ibm.com +7 -2
#   Only wake up one commit thread at a time
# 
# ChangeSet
#   2005/01/24 09:09:37-06:00 shaggy@austin.ibm.com 
#   Merge jfs@jfs.bkbits.net:linux-2.5
#   into austin.ibm.com:/home/shaggy/bk/jfs-2.5
# 
# fs/jfs/jfs_txnmgr.c
#   2005/01/24 09:09:26-06:00 shaggy@austin.ibm.com +0 -0
#   Auto merged
# 
# fs/jfs/jfs_metapage.c
#   2005/01/24 09:09:26-06:00 shaggy@austin.ibm.com +0 -0
#   Auto merged
# 
# fs/jfs/jfs_logmgr.c
#   2005/01/24 09:09:26-06:00 shaggy@austin.ibm.com +0 -0
#   Auto merged
# 
# ChangeSet
#   2005/01/20 14:46:30-06:00 shaggy@austin.ibm.com 
#   JFS: replace schedule_timeout() with msleep()
#   
#   Use msleep() instead of schedule_timeout() to guarantee the task
#   delays as expected. The current code uses TASK_INTERRUPTIBLE;
#   however, it does not check for signals, so I do not think the
#   change to msleep() is necessarily bad.
#   
#   Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
#   Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
# 
# fs/jfs/jfs_logmgr.c
#   2005/01/20 14:46:19-06:00 shaggy@austin.ibm.com +2 -2
#   replace schedule_timeout() with msleep()
# 
# ChangeSet
#   2005/01/20 14:22:50-06:00 shaggy@austin.ibm.com 
#   JFS: add missing include
#   
#   This is why it's a good idea to compile & test before checking in
#   the code.
#   
#   Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
# 
# fs/jfs/jfs_metapage.c
#   2005/01/20 14:22:33-06:00 shaggy@austin.ibm.com +1 -0
#   add missing include
# 
# ChangeSet
#   2005/01/20 14:14:19-06:00 shaggy@austin.ibm.com 
#   JFS: fix livelock waiting for stale metapage
#   
#   Several waitors were keeping mp->count from going to zero, so we
#   would never release the page.  Simplify the logic by doing a busy
#   wait without locking the metapage.
#   
#   Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
# 
# fs/jfs/jfs_metapage.c
#   2005/01/20 14:13:55-06:00 shaggy@austin.ibm.com +6 -17
#   many waitors for stale metapage resulted in livelock
# 
# ChangeSet
#   2005/01/14 13:10:38-06:00 shaggy@austin.ibm.com 
#   JFS: base static allocations on physical memory size
#   
#   On larger systems, performance is improved with a larger
#   allocation of tlocks & tblocks.  Base the default size of these
#   allocations on the physical memory size.
#   
#   Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
# 
# fs/jfs/jfs_txnmgr.c
#   2005/01/14 13:10:22-06:00 shaggy@austin.ibm.com +28 -6
#   base default number of tlocks & tblocks on size of phyiscal memory
# 
diff -Nru a/Documentation/Changes b/Documentation/Changes
--- a/Documentation/Changes	2005-03-03 22:01:45 -08:00
+++ b/Documentation/Changes	2005-03-03 22:01:45 -08:00
@@ -339,7 +339,7 @@
 
 JFSutils
 --------
-o  <http://oss.software.ibm.com/jfs>
+o  <http://jfs.sourceforge.net/>
 
 Reiserfsprogs
 -------------
diff -Nru a/Documentation/filesystems/jfs.txt b/Documentation/filesystems/jfs.txt
--- a/Documentation/filesystems/jfs.txt	2005-03-03 22:01:45 -08:00
+++ b/Documentation/filesystems/jfs.txt	2005-03-03 22:01:45 -08:00
@@ -1,13 +1,6 @@
 IBM's Journaled File System (JFS) for Linux
 
-JFS Homepage:  http://oss.software.ibm.com/jfs/
-
-Team members
-------------
-Dave Kleikamp      shaggy@austin.ibm.com  
-Dave Blaschke      blaschke@us.ibm.com
-Steve Best         sbest@us.ibm.com
-Barry Arndt        barndt@us.ibm.com
+JFS Homepage:  http://jfs.sourceforge.net/
 
 The following mount options are supported:
 
@@ -15,6 +8,7 @@
 		ASCII.  The default is to do no conversion.  Use
 		iocharset=utf8 for UTF8 translations.  This requires
 		CONFIG_NLS_UTF8 to be set in the kernel .config file.
+		iocharset=none specifies the default behavior explicitly.
 
 resize=value	Resize the volume to <value> blocks.  JFS only supports
 		growing a volume, not shrinking it.  This option is only
@@ -38,4 +32,4 @@
 Please send bugs, comments, cards and letters to shaggy@austin.ibm.com.
 
 The JFS mailing list can be subscribed to by using the link labeled
-"Mail list Subscribe" at our web page http://oss.software.ibm.com/jfs/.
+"Mail list Subscribe" at our web page http://jfs.sourceforge.net/
diff -Nru a/MAINTAINERS b/MAINTAINERS
--- a/MAINTAINERS	2005-03-03 22:01:45 -08:00
+++ b/MAINTAINERS	2005-03-03 22:01:45 -08:00
@@ -1247,8 +1247,8 @@
 JFS FILESYSTEM
 P:	Dave Kleikamp
 M:	shaggy@austin.ibm.com
-L:	jfs-discussion@oss.software.ibm.com
-W:	http://oss.software.ibm.com/jfs/
+L:	jfs-discussion@lists.sourceforge.net
+W:	http://jfs.sourceforge.net/
 S:	Supported
 
 KCONFIG
diff -Nru a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c
--- a/fs/jfs/jfs_logmgr.c	2005-03-03 22:01:45 -08:00
+++ b/fs/jfs/jfs_logmgr.c	2005-03-03 22:01:45 -08:00
@@ -67,6 +67,7 @@
 #include <linux/buffer_head.h>		/* for sync_blockdev() */
 #include <linux/bio.h>
 #include <linux/suspend.h>
+#include <linux/delay.h>
 #include "jfs_incore.h"
 #include "jfs_filsys.h"
 #include "jfs_metapage.h"
@@ -1612,8 +1613,7 @@
 	 */
 	if ((!list_empty(&log->cqueue)) || !list_empty(&log->synclist)) {
 		for (i = 0; i < 800; i++) {	/* Too much? */
-			current->state = TASK_INTERRUPTIBLE;
-			schedule_timeout(HZ / 4);
+			msleep(250);
 			if (list_empty(&log->cqueue) &&
 			    list_empty(&log->synclist))
 				break;
diff -Nru a/fs/jfs/jfs_metapage.c b/fs/jfs/jfs_metapage.c
--- a/fs/jfs/jfs_metapage.c	2005-03-03 22:01:45 -08:00
+++ b/fs/jfs/jfs_metapage.c	2005-03-03 22:01:45 -08:00
@@ -21,6 +21,7 @@
 #include <linux/init.h>
 #include <linux/buffer_head.h>
 #include <linux/mempool.h>
+#include <linux/delay.h>
 #include "jfs_incore.h"
 #include "jfs_superblock.h"
 #include "jfs_filsys.h"
@@ -242,14 +243,14 @@
 	mp = search_hash(hash_ptr, mapping, lblock);
 	if (mp) {
 	      page_found:
-		mp->count++;
-		lock_metapage(mp);
-		spin_unlock(&meta_lock);
 		if (test_bit(META_stale, &mp->flag)) {
-			release_metapage(mp);
-			yield();	/* Let other waiters release it, too */
+			spin_unlock(&meta_lock);
+			msleep(1);
 			goto again;
 		}
+		mp->count++;
+		lock_metapage(mp);
+		spin_unlock(&meta_lock);
 		if (test_bit(META_discard, &mp->flag)) {
 			if (!new) {
 				jfs_error(inode->i_sb,
@@ -461,7 +462,6 @@
 	}
 
 	if (mp->page) {
-		/* Releasing spinlock, we have to check mp->count later */
 		set_bit(META_stale, &mp->flag);
 		spin_unlock(&meta_lock);
 		kunmap(mp->page);
@@ -498,12 +498,6 @@
 		list_del(&mp->synclist);
 		LOGSYNC_UNLOCK(log);
 	}
-	if (mp->count) {
-		/* Someone else is trying to get this metpage */
-		unlock_metapage(mp);
-		spin_unlock(&meta_lock);
-		return;
-	}
 	remove_from_hash(mp, meta_hash(mp->mapping, mp->index));
 	spin_unlock(&meta_lock);
 
@@ -532,12 +526,8 @@
 		mp = search_hash(hash_ptr, mapping, lblock);
 		if (mp) {
 			if (test_bit(META_stale, &mp->flag)) {
-				/* Racing with release_metapage */
-				mp->count++;
-				lock_metapage(mp);
 				spin_unlock(&meta_lock);
-				/* racing release_metapage should be done now */
-				release_metapage(mp);
+				msleep(1);
 				goto again;
 			}
 
diff -Nru a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c
--- a/fs/jfs/jfs_txnmgr.c	2005-03-03 22:01:45 -08:00
+++ b/fs/jfs/jfs_txnmgr.c	2005-03-03 22:01:45 -08:00
@@ -93,15 +93,15 @@
 } TxStat;
 #endif
 
-static int nTxBlock = 512;	/* number of transaction blocks */
+static int nTxBlock = -1;	/* number of transaction blocks */
 module_param(nTxBlock, int, 0);
 MODULE_PARM_DESC(nTxBlock,
-		 "Number of transaction blocks (default:512, max:65536)");
+		 "Number of transaction blocks (max:65536)");
 
-static int nTxLock = 4096;	/* number of transaction locks */
+static int nTxLock = -1;	/* number of transaction locks */
 module_param(nTxLock, int, 0);
 MODULE_PARM_DESC(nTxLock,
-		 "Number of transaction locks (default:4096, max:65536)");
+		 "Number of transaction locks (max:65536)");
 
 struct tblock *TxBlock;	        /* transaction block table */
 static int TxLockLWM;		/* Low water mark for number of txLocks used */
@@ -124,6 +124,7 @@
 
 DECLARE_WAIT_QUEUE_HEAD(jfs_sync_thread_wait);
 DECLARE_WAIT_QUEUE_HEAD(jfs_commit_thread_wait);
+static int jfs_commit_thread_waking;
 
 /*
  * Retry logic exist outside these macros to protect from spurrious wakeups.
@@ -249,6 +250,25 @@
 int txInit(void)
 {
 	int k, size;
+	struct sysinfo si;
+
+	/* Set defaults for nTxLock and nTxBlock if unset */
+
+	if (nTxLock == -1) {
+		if (nTxBlock == -1) {
+			/* Base default on memory size */
+			si_meminfo(&si);
+			if (si.totalram > (256 * 1024)) /* 1 GB */
+				nTxLock = 64 * 1024;
+			else
+				nTxLock = si.totalram >> 2;
+		} else if (nTxBlock > (8 * 1024))
+			nTxLock = 64 * 1024;
+		else
+			nTxLock = nTxBlock << 3;
+	}
+	if (nTxBlock == -1)
+		nTxBlock = nTxLock >> 3;
 
 	/* Verify tunable parameters */
 	if (nTxBlock < 16)
@@ -259,6 +279,9 @@
 		nTxLock = 256;	/* No one should set it this low */
 	if (nTxLock > 65536)
 		nTxLock = 65536;
+
+	printk(KERN_INFO "JFS: nTxBlock = %d, nTxLock = %d\n",
+	       nTxBlock, nTxLock);
 	/*
 	 * initialize transaction block (tblock) table
 	 *
@@ -266,8 +289,8 @@
 	 * tid = 0 is reserved.
 	 */
 	TxLockLWM = (nTxLock * 4) / 10;
-	TxLockHWM = (nTxLock * 8) / 10;
-	TxLockVHWM = (nTxLock * 9) / 10;
+	TxLockHWM = (nTxLock * 7) / 10;
+	TxLockVHWM = (nTxLock * 8) / 10;
 
 	size = sizeof(struct tblock) * nTxBlock;
 	TxBlock = (struct tblock *) vmalloc(size);
@@ -2732,6 +2755,7 @@
 
 	do {
 		LAZY_LOCK(flags);
+		jfs_commit_thread_waking = 0;	/* OK to wake another thread */
 		while (!list_empty(&TxAnchor.unlock_queue)) {
 			WorkDone = 0;
 			list_for_each_entry(tblk, &TxAnchor.unlock_queue,
@@ -2804,10 +2828,13 @@
 	list_add_tail(&tblk->cqueue, &TxAnchor.unlock_queue);
 	/*
 	 * Don't wake up a commit thread if there is already one servicing
-	 * this superblock.
+	 * this superblock, or if the last one we woke up hasn't started yet.
 	 */
-	if (!(JFS_SBI(tblk->sb)->commit_state & IN_LAZYCOMMIT))
+	if (!(JFS_SBI(tblk->sb)->commit_state & IN_LAZYCOMMIT) &&
+	    !jfs_commit_thread_waking) {
+		jfs_commit_thread_waking = 1;
 		wake_up(&jfs_commit_thread_wait);
+	}
 	LAZY_UNLOCK(flags);
 }
 
diff -Nru a/fs/jfs/super.c b/fs/jfs/super.c
--- a/fs/jfs/super.c	2005-03-03 22:01:45 -08:00
+++ b/fs/jfs/super.c	2005-03-03 22:01:45 -08:00
@@ -235,7 +235,7 @@
 static int parse_options(char *options, struct super_block *sb, s64 *newLVSize,
 			 int *flag)
 {
-	void *nls_map = NULL;
+	void *nls_map = (void *)-1;	/* -1: no change;  NULL: none */
 	char *p;
 	struct jfs_sb_info *sbi = JFS_SBI(sb);
 
@@ -263,12 +263,17 @@
 			/* Don't do anything ;-) */
 			break;
 		case Opt_iocharset:
-			if (nls_map)	/* specified iocharset twice! */
+			if (nls_map && nls_map != (void *) -1)
 				unload_nls(nls_map);
-			nls_map = load_nls(args[0].from);
-			if (!nls_map) {
-				printk(KERN_ERR "JFS: charset not found\n");
-				goto cleanup;
+			if (!strcmp(args[0].from, "none"))
+				nls_map = NULL;
+			else {
+				nls_map = load_nls(args[0].from);
+				if (!nls_map) {
+					printk(KERN_ERR
+					       "JFS: charset not found\n");
+					goto cleanup;
+				}
 			}
 			break;
 		case Opt_resize:
@@ -318,7 +323,7 @@
 		}
 	}
 
-	if (nls_map) {
+	if (nls_map != (void *) -1) {
 		/* Discard old (if remount) */
 		if (sbi->nls_tab)
 			unload_nls(sbi->nls_tab);
@@ -327,7 +332,7 @@
 	return 1;
 
 cleanup:
-	if (nls_map)
+	if (nls_map && nls_map != (void *) -1)
 		unload_nls(nls_map);
 	return 0;
 }
@@ -622,7 +627,7 @@
 
 	if (commit_threads < 1)
 		commit_threads = num_online_cpus();
-	else if (commit_threads > MAX_COMMIT_THREADS)
+	if (commit_threads > MAX_COMMIT_THREADS)
 		commit_threads = MAX_COMMIT_THREADS;
 
 	for (i = 0; i < commit_threads; i++) {