http://jfs.bkbits.net/linux-2.5 jfs.adm@bkbits.net|ChangeSet|20050203182154|51095 jfs.adm # This is a BitKeeper generated diff -Nru style patch. # # 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 # Signed-off-by: Dave Kleikamp # # 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 # # 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 # # 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 # # 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/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c --- a/fs/jfs/jfs_logmgr.c 2005-02-03 18:54:28 -08:00 +++ b/fs/jfs/jfs_logmgr.c 2005-02-03 18:54:28 -08:00 @@ -67,6 +67,7 @@ #include /* for sync_blockdev() */ #include #include +#include #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-02-03 18:54:28 -08:00 +++ b/fs/jfs/jfs_metapage.c 2005-02-03 18:54:28 -08:00 @@ -21,6 +21,7 @@ #include #include #include +#include #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-02-03 18:54:28 -08:00 +++ b/fs/jfs/jfs_txnmgr.c 2005-02-03 18:54:28 -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 */ @@ -249,6 +249,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 +278,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 +288,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);