[Ocfs2-commits] mfasheh commits r1115 - in trunk: . src src/inc

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed Jun 16 17:29:54 CDT 2004


Author: mfasheh
Date: 2004-06-16 16:29:52 -0500 (Wed, 16 Jun 2004)
New Revision: 1115

Removed:
   trunk/src/hash.c
Modified:
   trunk/TODO
   trunk/src/Makefile
   trunk/src/alloc.c
   trunk/src/dlm.c
   trunk/src/file.c
   trunk/src/inc/io.h
   trunk/src/inc/ocfs.h
   trunk/src/inc/proto.h
   trunk/src/io.c
   trunk/src/journal.c
   trunk/src/namei.c
   trunk/src/nm.c
   trunk/src/super.c
Log:
* Dump the bh sem hash. FINALLY! Yay!



Modified: trunk/TODO
===================================================================
--- trunk/TODO	2004-06-16 21:29:29 UTC (rev 1114)
+++ trunk/TODO	2004-06-16 21:29:52 UTC (rev 1115)
@@ -37,9 +37,6 @@
   find_space_from_local where we take the main bitmap lock a bit early... We
   can probably eliminate that and just let it get taken later...
 
-* Remove ocfs_ugly_hack. This can be totally removed after we've gotten rid
-  of the bh_sem_hash.
-
 * Local alloc code can be slightly revamped to not use the commit_bits on
   the journal handle any more. Also, investigate whether we can use the
   "undo" access flag on that bitmap.
@@ -60,6 +57,4 @@
 
 * change the dirent->inode to block number... it's in bytes currently
 
-* finish the work of removing the bh sem hash
-
 * turn priv_sem into a spinlock

Modified: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile	2004-06-16 21:29:29 UTC (rev 1114)
+++ trunk/src/Makefile	2004-06-16 21:29:52 UTC (rev 1115)
@@ -60,13 +60,6 @@
 GLOBAL_DEFINES += -DVERBOSE_BH_SEQNUM_TRACE
 GLOBAL_DEFINES += -DVERBOSE_PROCESS_VOTE
 
-#off by default -- these generate ALOT of output
-#GLOBAL_DEFINES += -DVERBOSE_BH_SEM
-#GLOBAL_DEFINES += -DBH_SEM_DEBUG
-
-#off by default as it's expensive
-#GLOBAL_DEFINES += -DBH_SEM_LEAK_CHECKING
-
 ifneq ($(OCFS_PROCESSOR),ia64)
 #GLOBAL_DEFINES += -DOCFS_DBG_TIMING
 endif
@@ -132,7 +125,6 @@
 	dlm.c		\
 	extmap.c	\
 	file.c		\
-	hash.c		\
 	heartbeat.c	\
 	inode.c		\
 	io.c		\

Modified: trunk/src/alloc.c
===================================================================
--- trunk/src/alloc.c	2004-06-16 21:29:29 UTC (rev 1114)
+++ trunk/src/alloc.c	2004-06-16 21:29:52 UTC (rev 1115)
@@ -40,27 +40,6 @@
 /* Tracing */
 #define OCFS_DEBUG_CONTEXT    OCFS_DEBUG_CONTEXT_ALLOC
 
-/* Remove this after the bh_sem hash is removed. */
-static inline int ocfs_ugly_hack(ocfs_journal_handle *handle,
-				 struct buffer_head *bh)
-{
-	int status = 0;
-	status = ocfs_journal_access(handle, bh, OCFS_JOURNAL_ACCESS_WRITE);
-	if (status < 0) {
-		LOG_ERROR_STATUS (status);
-		return(status);
-	}
-	OCFS_BH_GET_DATA_WRITE(bh);
-	OCFS_BH_PUT_DATA(bh);
-	status = ocfs_journal_dirty(handle, bh);
-	if (status < 0) {
-		LOG_ERROR_STATUS (status);	
-		return(status);
-	}
-
-	return(status);
-}
-
 static int ocfs_kill_this_tree(ocfs_super *osb, struct buffer_head *extent_grp_bh, 
 			       ocfs_journal_handle *handle, struct inode *inode);
 static int ocfs_allocate_new_data_node (ocfs_super * osb, 
@@ -218,7 +197,6 @@
 	int credits = 33; /* one for each potential sysfile fe. This
 			   * goes away when ocfs_ugly_hack goes
 			   * away. */
-	struct buffer_head *ugly_hack_bh = NULL;
 
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p)\n", osb, free_log);
 
@@ -326,7 +304,7 @@
 			status = ocfs_acquire_lock (osb, 
 						    OCFS_DLM_EXCLUSIVE_LOCK,
 						    FLAG_FILE_CREATE,
-						    &ugly_hack_bh, 
+						    NULL,
 						    extnode_inode[i]);
 			if (status < 0) {
 				up_write(&OCFS_I(extnode_inode[i])->ip_io_sem);
@@ -336,10 +314,6 @@
 					LOG_ERROR_STATUS (status);
 				goto abort;
 			}
-
-			ocfs_ugly_hack(handle, ugly_hack_bh);
-			brelse(ugly_hack_bh);
-			ugly_hack_bh = NULL;
 		}
 	}
 
@@ -364,7 +338,6 @@
 				LOG_ERROR_STATUS (status);
 			goto abort;
 		}
-		ocfs_ugly_hack(handle, globalbh);
 	}
 
 
@@ -2998,12 +2971,6 @@
 			      FLAG_FILE_CREATE, 
 			      bh, inode, 1);
 
-	status = ocfs_ugly_hack(handle, bh);
-	if (status < 0) {
-		LOG_ERROR_STATUS (status);
-		goto leave;
-	}
-
 	numBits = ((FileSize + (blockSize-1)) >> blockSizeBits);
 	numBytes = numBits << blockSizeBits;
 

Modified: trunk/src/dlm.c
===================================================================
--- trunk/src/dlm.c	2004-06-16 21:29:29 UTC (rev 1114)
+++ trunk/src/dlm.c	2004-06-16 21:29:52 UTC (rev 1115)
@@ -1105,11 +1105,9 @@
 	}
 
 finito:
-	if (tmpbh) {
-		if (clear_tmp)
-			ocfs_clear_buffer_modified(tmpbh);
+	if (tmpbh)
 		brelse(tmpbh);
-	}
+
 	LOG_EXIT_STATUS (status);
 	return status;
 }				/* ocfs_disk_release_lock */
@@ -1121,7 +1119,6 @@
 int ocfs_release_lock (ocfs_super * osb, __u32 lock_type, __u32 flags, struct buffer_head *bh, struct inode *inode)
 {
 	int status = 0;
-	int tries = 0;
 	ocfs_lock_res *lockres = GET_INODE_LOCKRES(inode);
 	__u64 lock_id;
 
@@ -1135,24 +1132,8 @@
 
 	flags |= FLAG_RELEASE_LOCK;
 
-again:
 	ocfs_acquire_lockres (lockres, 0); // ocfs_release_lock
 
-	if (bh) {
-		/* always get the write lock on the bh */
-		/* make sure to do this AFTER the lockres acquire */
-		if (OCFS_BH_GET_DATA_WRITE_TRYLOCK(bh) == NULL) {
-			tries++;
-			ocfs_release_lockres(lockres); // ocfs_release_lock
-			LOG_ERROR_ARGS("failed to get bh sem (%llu), attempt %d, trying again\n",
-				       (unsigned long long)bh->b_blocknr, tries);
-			ocfs_sleep(100);
-			goto again;
-		}
-		OCFS_BH_PUT_DATA(bh);
-	}
-
-
 	if ((lockres->lock_type == OCFS_DLM_ENABLE_CACHE_LOCK) &&
 	    (lockres->master_node_num == osb->node_num) &&
 	    !(flags & FLAG_FILE_DELETE) && !(flags & FLAG_FILE_EXTEND) 
@@ -1182,8 +1163,6 @@
 	}
 
 finally:
-	if (bh)
-		ocfs_clear_buffer_modified(bh);
 	lockres->lock_holders--;
 	LOG_TRACE_ARGS("lockres->lock_holders = %u\n", lockres->lock_holders);
 	ocfs_release_lockres (lockres); // ocfs_release_lock

Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c	2004-06-16 21:29:29 UTC (rev 1114)
+++ trunk/src/file.c	2004-06-16 21:29:52 UTC (rev 1115)
@@ -303,9 +303,6 @@
 		ret = 0;
 	}
 
-	if (ret < 0)
-		ocfs_bh_sem_hash_cleanup_pid(ocfs_getpid());
-
 	LOG_TRACE_ARGS
 	    ("exiting file_open: file=%p dentry=%p inode=%p kiovec=%d\n",
 	     file, file->f_dentry, file->f_dentry->d_inode, err);
@@ -386,7 +383,6 @@
 	}
 
 bail:
-//	ocfs_bh_sem_hash_cleanup_pid(ocfs_getpid());
 
 	if (dec)
 		iput(inode);
@@ -840,12 +836,6 @@
 		OCFS_CLEAR_FLAG(OCFS_I(inode)->oin_flags, OCFS_OIN_OPEN_FOR_WRITE);
 	}
 
-
-#ifndef BH_SEM_LEAK_CHECKING	
-	if (ret < 0)
-#endif
-		ocfs_bh_sem_hash_cleanup_pid(ocfs_getpid());
-
 	LOG_EXIT_INT (ret);
 	return ret;
 }				/* ocfs_file_write */
@@ -1433,11 +1423,6 @@
 bail:
 	up_write(&OCFS_I(inode)->ip_io_sem);
 
-#ifndef BH_SEM_LEAK_CHECKING
-	if (error < 0)
-#endif
-		ocfs_bh_sem_hash_cleanup_pid(ocfs_getpid());
-
 	LOG_EXIT_INT (error);
 	return error;
 }				/* ocfs_setattr */

Deleted: trunk/src/hash.c
===================================================================
--- trunk/src/hash.c	2004-06-16 21:29:29 UTC (rev 1114)
+++ trunk/src/hash.c	2004-06-16 21:29:52 UTC (rev 1115)
@@ -1,591 +0,0 @@
-/*
- * hash.c
- *
- * lockid hash, bh sem hash, inode hash
- *
- * Copyright (C) 2002, 2004 Oracle.  All rights reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- * 
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 021110-1307, USA.
- *
- * Authors: Kurt Hackel, Mark Fasheh, Sunil Mushran, Wim Coekaerts,
- *	    Manish Singh, Neeraj Goyal, Suchit Kaura
- */
-
-#include <linux/types.h>
-
-#include "inc/ocfs_log.h"
-#include "inc/ocfs.h"
-
-
-/* Tracing */
-#define OCFS_DEBUG_CONTEXT      OCFS_DEBUG_CONTEXT_HASH
-
-
-#ifndef ATOMIC_DEC_AND_LOCK
-extern int atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock);
-#endif
-
-
-/*
- *
- * BH SEM HASH
- *
- */ 
-
-
-static ocfs_bh_sem *ocfs_bh_sem_alloc(void)
-{
-	return kmem_cache_alloc(OcfsGlobalCtxt.bh_sem_cache, GFP_NOFS);
-}
-
-static void ocfs_bh_sem_free(ocfs_bh_sem *sem)
-{
-	kmem_cache_free(OcfsGlobalCtxt.bh_sem_cache, sem);
-}
-
-static void ocfs_bh_sem_get(ocfs_bh_sem *sem)
-{
-	atomic_inc(&sem->s_refcnt);
-}
-
-static void ocfs_bh_sem_put(ocfs_bh_sem *sem)
-{
-	if (atomic_dec_and_lock(&sem->s_refcnt, &OcfsGlobalCtxt.bh_sem_hash_lock)) {
-		if (buffer_modified(sem->s_bh)) {
-			LOG_ERROR_ARGS("putting last refcount of a modified buffer!  block %llu\n",
-				       (unsigned long long)sem->s_bh->b_blocknr);
-		}
-		put_bh(sem->s_bh);
-		sem->s_bh = NULL;
-		spin_unlock(&OcfsGlobalCtxt.bh_sem_hash_lock);
-	}
-}
-
-static void ocfs_bh_sem_down(ocfs_bh_sem *sem)
-{
-	down(&sem->s_sem);
-}
-
-static void ocfs_bh_sem_up(ocfs_bh_sem *sem)
-{
-	up(&sem->s_sem);
-}
-
-/* ripped right out of inode.c */
-#define ocfs_bh_hash_shift  (OcfsGlobalCtxt.bh_sem_hash_sz-1)
-#define _hashfn(dev,block)      \
-		((((dev)<<(ocfs_bh_hash_shift - 6)) ^ ((dev)<<(ocfs_bh_hash_shift - 9))) ^ \
-		(((block)<<(ocfs_bh_hash_shift - 6)) ^ ((block) >> 13) ^ \
-		((block) << (ocfs_bh_hash_shift - 12))))
-#define ocfs_bh_sem_hash_fn(_b)   \
-	(_hashfn((unsigned int)BH_GET_DEVICE((_b)), (_b)->b_blocknr) & ocfs_bh_hash_shift)
-
-int ocfs_bh_sem_hash_init()
-{
-	int i, ret;
-
-	spin_lock_init (&OcfsGlobalCtxt.bh_sem_hash_lock);
-	OcfsGlobalCtxt.bh_sem_hash = (struct list_head *)__get_free_pages(GFP_KERNEL, 2);
-	if (!OcfsGlobalCtxt.bh_sem_hash) {
-		LOG_ERROR_STR("ENOMEM allocating ocfs_bh_sem_hash");
-		ret = -ENOMEM;
-		goto bail;
-	}
-	OcfsGlobalCtxt.bh_sem_hash_sz = (PAGE_SIZE * 4) / sizeof(struct list_head);
-
-	for (i=OcfsGlobalCtxt.bh_sem_hash_sz-1; i>=0; i--)
-		INIT_LIST_HEAD(&OcfsGlobalCtxt.bh_sem_hash[i]);
-
-	atomic_set(&OcfsGlobalCtxt.bh_sem_hash_target_bucket, -1);
-	atomic_set(&OcfsGlobalCtxt.bh_sem_hash_num_iters, 0);
-	ret = 0;
-bail:
-	return ret;
-}
-
-int ocfs_bh_sem_hash_destroy()
-{
-	int missed;
-
-	while (1) {
-		missed = ocfs_bh_sem_hash_prune_all();
-		if (missed == 0)
-			break;
-		LOG_TRACE_ARGS("still have %d entries in use in hashtable\n", missed);
-	}
-
-	spin_lock (&OcfsGlobalCtxt.bh_sem_hash_lock);
-	free_pages((unsigned long)OcfsGlobalCtxt.bh_sem_hash, 2);
-	OcfsGlobalCtxt.bh_sem_hash = NULL;
-	
-	return 0;
-}
-
-
-static ocfs_bh_sem * ocfs_bh_sem_lookup(struct buffer_head *bh)
-{
-	int depth, bucket;
-	struct list_head *head, *iter = NULL;
-	ocfs_bh_sem *sem = NULL, *newsem = NULL;
-
-	bucket = ocfs_bh_sem_hash_fn(bh);
-	head = &OcfsGlobalCtxt.bh_sem_hash[bucket];
-again:
-	depth = 0;
-	spin_lock (&OcfsGlobalCtxt.bh_sem_hash_lock);
-
-	list_for_each(iter, head) {
-		if (++depth > OCFS_BH_SEM_HASH_PRUNE_TRIGGER) {
-			/* Grandma, what a long list you have? */
-			atomic_set(&OcfsGlobalCtxt.bh_sem_hash_target_bucket, bucket);
-		}
-		sem = list_entry (iter, ocfs_bh_sem, s_list);
-		if (sem->s_blocknr == bh->b_blocknr &&
-		    sem->s_dev == BH_GET_DEVICE(bh)) {
-			if (atomic_read(&sem->s_refcnt)==0) {
-				if (sem->s_bh) {
-					LOG_ERROR_STR("refcount was zero but s_bh not NULL!");
-					BUG();
-				}
-				get_bh(bh);
-				sem->s_bh = bh;
-			}
-			if (sem->s_bh != bh) {
-				LOG_ERROR_ARGS("bad bh_sem->bh: sem(%p,%llu,%lu), new(%p,%llu)\n",
-					       sem->s_bh, sem->s_bh ?
-					       (unsigned long long)sem->s_bh->b_blocknr : 0ULL, 
-					       sem->s_blocknr, bh,
-					       (unsigned long long)bh->b_blocknr);
-				BUG();
-			}
-			break;
-		}
-		sem = NULL;
-	}
-
-	if (newsem && !sem) {
-		/* second pass, we are first to insert */
-		sem = newsem;
-		list_add(&sem->s_list, head);
-		get_bh(bh);
-		sem->s_bh = bh;
-	}
-
-	if (sem) {
-		/* found something on first or second pass */
-		ocfs_bh_sem_get(sem);
-		if (newsem != sem) {
-			/* if not just added, mru to front */
-			list_del(&sem->s_list);
-			list_add(&sem->s_list, head);
-		}
-		//LOG_TRACE_ARGS("found bh_sem for %d, modified=%s, pid=%d\n",
-		//	      sem->s_bh->b_blocknr,
-		//	      buffer_modified(sem->s_bh) ? "true" : "false",
-		//	      sem->s_pid);
-			      
-		if (buffer_modified(sem->s_bh) && sem->s_pid == 0) {
-			LOG_ERROR_ARGS("found a%s sem with a modified bh but no pid!!! (block=%llu)\n", 
-				       newsem != sem ? "n old" : " new",
-				       (unsigned long long)sem->s_bh->b_blocknr);
-		}
-	} else {
-		/* first pass. not found. do alloc */
-		spin_unlock (&OcfsGlobalCtxt.bh_sem_hash_lock);
-		newsem = ocfs_bh_sem_alloc();
-		if (newsem) {
-			newsem->s_bh = NULL;
-			atomic_set(&newsem->s_refcnt, 0);
-			newsem->s_blocknr = bh->b_blocknr;
-			newsem->s_dev = BH_GET_DEVICE(bh);
-			init_MUTEX (&newsem->s_sem);
-			init_waitqueue_head(&newsem->s_wait);
-			newsem->s_pid = 0;
-#ifdef BH_SEM_DEBUG
-			memset(&newsem->s_modifier[0], 0, 40);
-#endif
-			goto again;
-		}
-		sem = NULL;
-		goto bail;
-	}
-
-	spin_unlock (&OcfsGlobalCtxt.bh_sem_hash_lock);
-
-	if (newsem && newsem != sem) {
-		/* another thread inserted while we were sleeping */
-		ocfs_bh_sem_free(newsem);
-	}
-
-bail:	
-	return sem;
-}
-
-
-/* look up the semaphore for this blocknum, and lock it too    */
-/* this can obviously block if someone else already has the bh */
-int ocfs_bh_sem_lock(struct buffer_head *bh)
-{
-	ocfs_bh_sem *sem;
-	int ret;
-
-	sem = ocfs_bh_sem_lookup(bh);
-	if (!sem)
-		BUG();
-
-	ocfs_bh_sem_down(sem);
-	if (buffer_modified(bh) && sem->s_pid != current->pid) {
-#ifdef VERBOSE_BH_SEM
-		LOG_TRACE_ARGS("need to wait... modified and pid is %d\n", sem->s_pid);
-#endif
-		LOG_ERROR_ARGS("Uhoh, read lock wanted on modified buffer! (pid=%d, block=%llu)\n", sem->s_pid, (unsigned long long)bh->b_blocknr);
-		ret = OCFS_BH_SEM_WAIT_ON_MODIFY;
-	} else {
-#ifdef VERBOSE_BH_SEM
-		LOG_TRACE_ARGS("got the lock\n");
-#endif
-		ret = OCFS_BH_SEM_GOT_LOCK;
-	}
-
-	return ret;
-}
-
-#ifndef BH_SEM_DEBUG
-int ocfs_bh_sem_lock_modify(struct buffer_head *bh)
-{
-	ocfs_bh_sem *sem;
-	int ret;
-
-	sem = ocfs_bh_sem_lookup(bh);
-	if (!sem)
-		BUG();
-
-	ocfs_bh_sem_down(sem);
-	ret = OCFS_BH_SEM_GOT_LOCK;
-	if (buffer_modified(bh)) {
-		//LOG_TRACE_ARGS("buffer modified\n");
-		if (sem->s_pid == 0) {
-			LOG_ERROR_ARGS("modified, but pid is 0!\n");
-			// BUG();
-			sem->s_pid = current->pid;
-
-			/* this should really be a bug, but for now, up the */
-			/* refcount as if it weren't modified */
-			ocfs_bh_sem_get(sem);
-		} else if (sem->s_pid != current->pid) {
-//			LOG_TRACE_ARGS("need to wait... modified and pid is %d\n", sem->s_pid);
-			ret = OCFS_BH_SEM_WAIT_ON_MODIFY;
-			LOG_ERROR_ARGS("Uhoh, write lock wanted on modified buffer! (pid=%d, block=%llu)\n", sem->s_pid, (unsigned long long)bh->b_blocknr);
-		}
-	} else {
-		//LOG_TRACE_ARGS("buffer NOT modified\n");
-		/* this is the first call to modify it */
-		if (sem->s_pid != 0)
-			LOG_ERROR_ARGS("first to modify, but pid is NOT 0!\n");
-		sem->s_pid = current->pid;
-		
-		/* extra refcount for the modified bh */
-		ocfs_bh_sem_get(sem);
-		
-		set_buffer_modified(bh);
-	}
-
-	return ret;
-}
-#endif
-
-
-
-int ocfs_bh_sem_unlock(struct buffer_head *bh)
-{
-	ocfs_bh_sem *sem;
-
-	sem = ocfs_bh_sem_lookup(bh);
-	if (!sem)
-		BUG();
-
-	/* take away one ref from this lookup */
-	ocfs_bh_sem_put(sem);
-	
-	ocfs_bh_sem_up(sem);
-
-	/* take away another ref from the lock lookup */
-	ocfs_bh_sem_put(sem);
-
-	return 0;
-}
-
-
-/* returns number of pruned entries */
-int ocfs_bh_sem_hash_prune()
-{
-	unsigned int bucket;
-	int pruned = 0, mandatory=0;
-	struct list_head *head, *iter = NULL, *tmpiter = NULL;
-	ocfs_bh_sem *sem = NULL;
-	LIST_HEAD(tmp);
-
-	atomic_inc(&OcfsGlobalCtxt.bh_sem_hash_num_iters);
-       	if (atomic_read(&OcfsGlobalCtxt.bh_sem_hash_num_iters) > 10) {
-		mandatory = 1;
-		atomic_sub(10, &OcfsGlobalCtxt.bh_sem_hash_num_iters);
-	}
-
-	/* The better to prune you with, my dear! */
-	bucket = atomic_read(&OcfsGlobalCtxt.bh_sem_hash_target_bucket);
-	if (bucket == -1) {
-		if (mandatory) {
-			get_random_bytes(&bucket, sizeof(bucket));
-			bucket %= OcfsGlobalCtxt.bh_sem_hash_sz;
-		} else {
-			pruned = 0;
-			goto bail;
-		}
-	}
-
-	spin_lock(&OcfsGlobalCtxt.bh_sem_hash_lock);
-
-	bucket = atomic_read(&OcfsGlobalCtxt.bh_sem_hash_target_bucket);
-	if (bucket == -1) {
-		spin_unlock (&OcfsGlobalCtxt.bh_sem_hash_lock);
-		pruned = 0;
-		goto bail;
-	}
-
-	head = &OcfsGlobalCtxt.bh_sem_hash[bucket];
-	pruned = 0;
-
-	/* run in lru order */
-	list_for_each_prev_safe(iter, tmpiter, head) {
-		sem = list_entry (iter, ocfs_bh_sem, s_list);
-		if (atomic_read(&sem->s_refcnt) < 1) {
-			list_del(&sem->s_list);
-			list_add(&sem->s_list, &tmp);
-			pruned++;
-		}
-		if (pruned >= OCFS_BH_SEM_HASH_PRUNE_MAX)
-			break;
-	}
-	atomic_set(&OcfsGlobalCtxt.bh_sem_hash_target_bucket, -1);
-
-	spin_unlock (&OcfsGlobalCtxt.bh_sem_hash_lock);
-
-	list_for_each_safe(iter, tmpiter, &tmp) {
-		sem = list_entry (iter, ocfs_bh_sem, s_list);
-		if (sem->s_bh) {
-			LOG_ERROR_STR("s_bh is NOT NULL");
-			BUG();
-		}
-		list_del(&sem->s_list);
-		ocfs_bh_sem_free(sem);
-	}
-bail:
-	return pruned;
-}
-
-/*
- * ocfs_bh_sem_hash_cleanup_pid()
- *
- * Yes, this function is evil.
- */
-int ocfs_bh_sem_hash_cleanup_pid(pid_t pid)
-{
-	int bucket, found = 0;
-	struct list_head *head, *iter = NULL;
-	ocfs_bh_sem *sem = NULL;
-
-	bucket = 0;
-again:
-	spin_lock(&OcfsGlobalCtxt.bh_sem_hash_lock);
-
-	head = &OcfsGlobalCtxt.bh_sem_hash[bucket];
-
-	list_for_each(iter, head) {
-		sem = list_entry (iter, ocfs_bh_sem, s_list);
-
-		if (sem->s_bh && 
-		    buffer_modified(sem->s_bh) && 
-		    sem->s_pid == pid) {
-			found++;
-			ocfs_bh_sem_get(sem);
-
-			/* only do one buffer at a time. */
-			spin_unlock(&OcfsGlobalCtxt.bh_sem_hash_lock);
-
-			LOG_ERROR_ARGS("blocknr = %llu, pid = %d\n", 
-				       (unsigned long long)sem->s_bh->b_blocknr,
-				       pid);
-			ocfs_clear_buffer_modified(sem->s_bh);
-			ocfs_bh_sem_put(sem);
-			goto again;
-		}
-	}
-
-	spin_unlock (&OcfsGlobalCtxt.bh_sem_hash_lock);
-
-	if (++bucket < OcfsGlobalCtxt.bh_sem_hash_sz)
-		goto again;
-
-	if (found) {
-		LOG_ERROR_ARGS("Found %d modified buffers!\n", found);
-#ifdef BH_SEM_LEAK_CHECKING
-		BUG();
-#endif
-	}
-	return found;
-} /* ocfs_bh_sem_hash_cleanup_pid() */
-
-/* returns number of missed entries */
-int ocfs_bh_sem_hash_prune_all()
-{
-	int bucket, missed;
-	struct list_head *head, *iter = NULL, *tmpiter = NULL;
-	ocfs_bh_sem *sem = NULL;
-	LIST_HEAD(tmp);
-
-	missed = 0;
-	bucket = 0;
-	spin_lock(&OcfsGlobalCtxt.bh_sem_hash_lock);
-	atomic_set(&OcfsGlobalCtxt.bh_sem_hash_target_bucket, -1);
-again:
-	head = &OcfsGlobalCtxt.bh_sem_hash[bucket];
-
-	/* run in lru order */
-	list_for_each_prev_safe(iter, tmpiter, head) {
-		sem = list_entry (iter, ocfs_bh_sem, s_list);
-		if (atomic_read(&sem->s_refcnt) < 1) {
-			if (sem->s_bh) {
-				LOG_ERROR_ARGS("killing off bh_sem with bh still attached! block=%llu, count=%d\n",
-					       (unsigned long long)sem->s_bh->b_blocknr,
-					       atomic_read(&sem->s_bh->b_count));
-			}
-			list_del(&sem->s_list);
-			list_add(&sem->s_list, &tmp);
-		} else {
-			missed++;
-			LOG_TRACE_ARGS("missed block %lu, refcount %u, "
-				       "pid = %u\n",
-				       sem->s_blocknr, 
-				       atomic_read(&sem->s_refcnt),
-				       sem->s_pid);
-		}
-	}
-
-	if (++bucket < OcfsGlobalCtxt.bh_sem_hash_sz)
-		goto again;
-
-	LOG_TRACE_ARGS("finished pruning, missed %d entries\n", missed);
-
-	spin_unlock (&OcfsGlobalCtxt.bh_sem_hash_lock);
-
-	list_for_each_safe(iter, tmpiter, &tmp) {
-		sem = list_entry (iter, ocfs_bh_sem, s_list);
-		if (sem->s_bh) {
-			LOG_ERROR_STR("s_bh is NOT NULL");
-			BUG();
-		}
-		list_del(&sem->s_list);
-		ocfs_bh_sem_free(sem);
-	}
-
-	return missed;
-}
-
-#define BUFFER_MODIFIED_TIMEOUT   (10*HZ)
-
-void wait_on_buffer_modified(struct buffer_head * bh)
-{
-	int do_timeout = 1;
-	ocfs_bh_sem *sem = ocfs_bh_sem_lookup(bh);
-	struct task_struct *tsk = current;
-	DECLARE_WAITQUEUE(wait, tsk);
-
-	LOG_ENTRY_ARGS("(block=%llu, sem->s_pid=%d)\n",
-		       (unsigned long long)bh->b_blocknr, sem->s_pid);
-
-	add_wait_queue(&sem->s_wait, &wait);
-	do {
-		if (!buffer_modified(bh) ||
-		    sem->s_pid == current->pid)
-			break;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-		{
-			struct block_device *bd;
-			smp_mb();
-			bd = bh->b_bdev;
-			if (bd)
-				blk_run_address_space(bd->bd_inode->i_mapping);
-		}
-#else
-		run_task_queue(&tq_disk);
-#endif
-		if (!do_timeout) {
-			set_task_state(tsk, TASK_UNINTERRUPTIBLE);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-			io_schedule();
-#else
-			schedule();
-#endif
-		} else {
-			do_timeout = 0;
-			set_task_state(tsk, TASK_INTERRUPTIBLE);
-			schedule_timeout(BUFFER_MODIFIED_TIMEOUT);
-			if (buffer_modified(bh) && 
-			    sem->s_pid != current->pid && sem->s_pid != 0) {
-#ifdef BH_SEM_DEBUG
-				LOG_ERROR_ARGS("possible deadlock: block=%lu, owner=%d, this=%d, modifier='%s'\n",
-				       bh->b_blocknr, sem->s_pid, current->pid, sem->s_modifier);
-#else
-				LOG_ERROR_ARGS("possible deadlock: block=%llu, owner=%d, this=%d\n",
-				       (unsigned long long)bh->b_blocknr, sem->s_pid, current->pid);
-#endif
-			}
-		}
-	} while (buffer_modified(bh) && sem->s_pid != current->pid);
-	set_task_state(tsk, TASK_RUNNING);
-	remove_wait_queue(&sem->s_wait, &wait);
-	ocfs_bh_sem_put(sem);
-
-	LOG_EXIT();
-}
-
-void ocfs_clear_buffer_modified(struct buffer_head *bh)
-{
-	ocfs_bh_sem *sem = NULL;
-	
-	LOG_ENTRY();
-	if (buffer_modified(bh)) {
-		sem = ocfs_bh_sem_lookup(bh);
-		if (ocfs_bh_sem_lock_modify(bh) != OCFS_BH_SEM_GOT_LOCK) {
-			printk("ocfs2: sem->s_pid=%d, my pid=%d\n", sem->s_pid, current->pid);
-			BUG();
-		}
-		clear_buffer_modified(bh);
-		sem->s_pid = 0;
-#ifdef BH_SEM_DEBUG
-		memset(&sem->s_modifier[0], 0, 40);
-#endif
-		ocfs_bh_sem_unlock(bh);
-		if (waitqueue_active(&sem->s_wait))
-			wake_up(&sem->s_wait);
-		/* remove ref from lookup above */
-		ocfs_bh_sem_put(sem);
-
-		/* remove additional ref from ocfs_bh_sem_lock_modify */
-		ocfs_bh_sem_put(sem);
-	}
-	LOG_EXIT();
-}

Modified: trunk/src/inc/io.h
===================================================================
--- trunk/src/inc/io.h	2004-06-16 21:29:29 UTC (rev 1114)
+++ trunk/src/inc/io.h	2004-06-16 21:29:52 UTC (rev 1115)
@@ -66,15 +66,7 @@
 
 #define BH_Modified 18
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-/* 
- * BUFFER_FNS is the new marcro magic intruduced in 2.5.x kernel for defining
- * set_buffer_XXX, clear_buffer_XXX, and buffer_XXX functions
- */
-BUFFER_FNS(Modified, modified)
-
-#else /* 2.4.x kernel */
-
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
 /*
  * Copied right out of the 2.6.2 kernel's buffer_head.h:
  * macro tricks to expand the set_buffer_foo(), clear_buffer_foo()
@@ -97,147 +89,16 @@
 #undef buffer_uptodate
 #undef buffer_dirty
 BUFFER_FNS(Uptodate, uptodate)
-BUFFER_FNS(Modified, modified)
 BUFFER_FNS(Dirty, dirty)
 
 #endif /* 2.4.x kernel */
 
-static inline void * OCFS_BH_GET_DATA_READ(struct buffer_head *bh)
-{
-	unsigned char *kaddr;
-	
-	OCFS_ASSERT(bh);
+#define OCFS_BH_GET_DATA(bh)  ((void *) ((bh)->b_data))
+#define OCFS_BH_GET_DATA_READ(bh) OCFS_BH_GET_DATA(bh)
+#define OCFS_BH_GET_DATA_WRITE(bh) OCFS_BH_GET_DATA(bh)
+#define OCFS_BH_GET_DATA_WRITE_TRYLOCK(bh) OCFS_BH_GET_DATA(bh)
+#define OCFS_BH_PUT_DATA(bh) do { } while(0)
 
-	if (!bh->b_blocknr) {
-		printk("%d: warning trying to OCFS_BH_GET_DATA_READ block zero!\n", current->pid);
-		ocfs_show_stack(NULL);
-	}		
-
-	while (1) {
-		if (ocfs_bh_sem_lock(bh) == OCFS_BH_SEM_WAIT_ON_MODIFY) {
-			BUG();
-
-			ocfs_bh_sem_unlock(bh);
-			wait_on_buffer_modified(bh);
-		} else {
-			break;
-		}
-	}
-
-	kaddr = kmap(bh->b_page);
-	kaddr += ((unsigned long)bh->b_data & ~PAGE_MASK);
-
-	return kaddr;
-}
-
-
-/* BH_SEM_DEBUG needs these to be macros to get at __LINE__ and such */
-
-#ifdef BH_SEM_DEBUG
-#define OCFS_BH_GET_DATA_WRITE(bh) ({ \
-	unsigned char *kaddr; \
-	while (1) { \
-		if (ocfs_bh_sem_lock_modify(bh) == OCFS_BH_SEM_WAIT_ON_MODIFY) { \
-			ocfs_bh_sem_unlock(bh); \
-			wait_on_buffer_modified(bh); \
-		} else \
-			break; \
-	} \
-	kaddr = (kmap((bh)->b_page)) + ((unsigned long)(bh)->b_data & ~PAGE_MASK); \
-	kaddr; \
-})
-
-#define OCFS_BH_GET_DATA_WRITE_TRYLOCK(bh)  \
-({  \
-	unsigned char *kaddr;  \
-	if (ocfs_bh_sem_lock_modify(bh) == OCFS_BH_SEM_WAIT_ON_MODIFY) {  \
-		ocfs_bh_sem_unlock(bh);  \
-		return NULL;  \
-	}  \
-	kaddr = kmap((bh)->b_page);  \
-	kaddr += ((unsigned long)(bh)->b_data & ~PAGE_MASK);  \
-	kaddr;  \
-})
-#else
-static inline void * OCFS_BH_GET_DATA_WRITE(struct buffer_head *bh)
-{
-	unsigned char *kaddr;
-
-	OCFS_ASSERT(bh);
-
-	if (!bh->b_blocknr) {
-		printk("%d: trying to OCFS_BH_GET_DATA_WRITE block zero!\n", current->pid);
-		BUG();
-	}		
-
-	while (1) {
-		if (ocfs_bh_sem_lock_modify(bh) == OCFS_BH_SEM_WAIT_ON_MODIFY) {
-#ifdef VERBOSE_BH_SEM
-			printk("ocfs2: called getdata for write but "
-			       "this process is not the lock "
-			       "holder!\n");
-#endif
-			BUG();
-			ocfs_bh_sem_unlock(bh);
-			wait_on_buffer_modified(bh);
-		} else {
-			break;
-		}
-	}
-
-	kaddr = kmap(bh->b_page);
-	kaddr += ((unsigned long)bh->b_data & ~PAGE_MASK);
-
-	return kaddr;
-}
-
-static inline void * OCFS_BH_GET_DATA_WRITE_TRYLOCK(struct buffer_head *bh)
-{
-	unsigned char *kaddr;
-
-	OCFS_ASSERT(bh);
-
-	if (!bh->b_blocknr) {
-		printk("%d: trying to OCFS_BH_GET_DATA_WRITE_TRYLOCK block zero!\n", current->pid);
-		BUG();
-	}		
-
-	if (ocfs_bh_sem_lock_modify(bh) == OCFS_BH_SEM_WAIT_ON_MODIFY) {
-#ifdef VERBOSE_BH_SEM
-		printk("ocfs2: called getdata for write but "
-		       "this process is not the lock "
-		       "holder!\n");
-#endif
-		LOG_ERROR_STR("Trylock about to BUG()");
-		BUG();
-		ocfs_bh_sem_unlock(bh);
-		return NULL;
-	}
-
-	kaddr = kmap(bh->b_page);
-	kaddr += ((unsigned long)bh->b_data & ~PAGE_MASK);
-
-	return kaddr;
-}
-
-#endif
-
-
-
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-#define BH_GET_DEVICE(bh) ((bh->b_bdev)->bd_dev)
-#else
-#define BH_GET_DEVICE(bh) (bh->b_dev)
-#endif
-
-static inline void OCFS_BH_PUT_DATA(struct buffer_head *bh)
-{
-	OCFS_ASSERT(bh);
-
-	kunmap(bh->b_page);
-	ocfs_bh_sem_unlock(bh);
-}
-
 #define STATE_BH_BITS	8
 #define USED_BH_BITS	23 /* Number of BH bits used up through JBD */
 

Modified: trunk/src/inc/ocfs.h
===================================================================
--- trunk/src/inc/ocfs.h	2004-06-16 21:29:29 UTC (rev 1114)
+++ trunk/src/inc/ocfs.h	2004-06-16 21:29:52 UTC (rev 1115)
@@ -487,11 +487,6 @@
 
 #define OCFS_NM_HEARTBEAT_TIME		500	/* in ms */
 #define OCFS_HEARTBEAT_INIT             10      /* number of NM iterations to stabilize the publish map */
-
-
-#define OCFS_BH_SEM_HASH_PRUNE_TRIGGER  50      /* trigger nm to prune the hash when list size is > this */
-#define OCFS_BH_SEM_HASH_PRUNE_MAX      100     /* nm will prune at most this many in one cycle */
-
 	
 #ifndef O_DIRECT
 #warning this depends on the architecture!
@@ -865,31 +860,6 @@
 
 /* =========================================================== */
 
-enum {
-	OCFS_BH_SEM_GOT_LOCK,
-	OCFS_BH_SEM_WAIT_ON_MODIFY,
-};
-
-typedef struct _ocfs_bh_sem
-{
-	struct semaphore s_sem;
-	struct list_head s_list;
-	unsigned long s_blocknr;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
-	dev_t s_dev;
-#else
-	kdev_t s_dev;
-#endif
-	atomic_t s_refcnt;
-	struct buffer_head *s_bh;
-	wait_queue_head_t s_wait;
-	pid_t s_pid;
-#ifdef BH_SEM_DEBUG
-	char s_modifier[40];
-#endif
-} ocfs_bh_sem;
-
-
 typedef struct _ocfs_vol_disk_hdr		   // CLASS
 {
 	__u32 minor_version;                       // NUMBER RANGE(0,UINT_MAX)
@@ -1428,7 +1398,6 @@
 	kmem_cache_t *inode_cache;
 	kmem_cache_t *fe_cache;
 	kmem_cache_t *extent_cache;
-	kmem_cache_t *bh_sem_cache;
 	__u32 flags;
 	__u32 pref_node_num;		/* preferred... osb has the real one */
 	ocfs_guid guid;			/* uniquely identifies a node */
@@ -1442,11 +1411,6 @@
 #ifdef OCFS_LINUX_MEM_DEBUG
 	struct list_head item_list;
 #endif
-	struct list_head *bh_sem_hash;
-	spinlock_t bh_sem_hash_lock;
-	int bh_sem_hash_sz;
-	atomic_t bh_sem_hash_target_bucket;
-	atomic_t bh_sem_hash_num_iters;
 	ocfs_dlm_stats net_reqst_stats;	/* stats of netdlm vote requests */
 	ocfs_dlm_stats net_reply_stats;	/* stats of netdlm vote reponses */
 	ocfs_dlm_stats dsk_reqst_stats;	/* stats of diskdlm vote requests */

Modified: trunk/src/inc/proto.h
===================================================================
--- trunk/src/inc/proto.h	2004-06-16 21:29:29 UTC (rev 1114)
+++ trunk/src/inc/proto.h	2004-06-16 21:29:52 UTC (rev 1115)
@@ -173,48 +173,6 @@
 int ocfs_setattr(struct dentry *dentry, struct iattr *attr);
 int ocfs_sync_file(struct file *file, struct dentry *dentry, int datasync);
 
-/* hash.c */
-int ocfs_bh_sem_hash_cleanup_pid(pid_t pid);
-int ocfs_bh_sem_hash_destroy(void);
-int ocfs_bh_sem_hash_init(void);
-int ocfs_bh_sem_hash_prune(void);
-int ocfs_bh_sem_hash_prune_all(void);
-int ocfs_bh_sem_lock(struct buffer_head *bh);
-int ocfs_bh_sem_unlock(struct buffer_head *bh);
-void ocfs_clear_buffer_modified(struct buffer_head *bh);
-void wait_on_buffer_modified(struct buffer_head *bh);
-#ifdef BH_SEM_DEBUG
-#define ocfs_bh_sem_lock_modify(bh) ({ \
-	ocfs_bh_sem *sem; \
-	int ret; \
-	sem = ocfs_bh_sem_lookup(bh); \
-	if (!sem) \
-		BUG(); \
-	ocfs_bh_sem_down(sem); \
-	ret = OCFS_BH_SEM_GOT_LOCK; \
-	if (buffer_modified(bh)) { \
-		if (sem->s_pid == 0) { \
-			sem->s_pid = current->pid; \
-			snprintf(sem->s_modifier, 40, "%s:%s:%d",  __FUNCTION__, __FILE__, __LINE__); \
-			ocfs_bh_sem_get(sem); \
-		} else if (sem->s_pid != current->pid) { \
-			ret = OCFS_BH_SEM_WAIT_ON_MODIFY; \
-		} \
-	} else { \
-		if (sem->s_pid != 0) \
-			printk("first to modify, but pid is NOT 0!\n"); \
-		sem->s_pid = current->pid; \
-		snprintf(sem->s_modifier, 40, "%s:%s:%d",  __FUNCTION__, __FILE__, __LINE__); \
-		ocfs_bh_sem_get(sem); \
-		set_buffer_modified(bh); \
-	} \
-	ret; \
-})
-#else
-int ocfs_bh_sem_lock_modify(struct buffer_head *bh);
-#endif
-
-
 /* heartbeat.c */
 int ocfs_nm_heart_beat(ocfs_super *osb, __u32 flag, int read_publish);
 void ocfs_update_publish_map(ocfs_super *osb, struct buffer_head *bhs[],

Modified: trunk/src/io.c
===================================================================
--- trunk/src/io.c	2004-06-16 21:29:29 UTC (rev 1114)
+++ trunk/src/io.c	2004-06-16 21:29:52 UTC (rev 1115)
@@ -114,23 +114,6 @@
 		if (flags & OCFS_BH_CONCURRENT_WRITE)
 			goto skip_modified_check;
 
-		/* Make sure the buffer is locked for modify, and
-		 * we're the ones with the write lock on this
-		 * buffer. */
-		if (!buffer_modified(bh)) {
-			printk("ocfs2: modified bit is NOT set on buffer "
-			       "(bh->b_blocknr = %llu)!\n",
-			       (unsigned long long)bh->b_blocknr);
-			BUG();
-		}
-		if (ocfs_bh_sem_lock_modify(bh) == OCFS_BH_SEM_WAIT_ON_MODIFY){
-			printk("ocfs2: someone else owns this buffer"
-			       "(bh->b_blocknr = %llu)!\n",
-			       (unsigned long long)bh->b_blocknr);
-			BUG();
-		}
-		ocfs_bh_sem_unlock(bh);
-
 skip_modified_check:
 		if (!(flags & OCFS_BH_IGNORE_JBD) && buffer_jbd(bh)) {
 #ifdef VERBOSE_BH_JBD_TRACE
@@ -170,10 +153,6 @@
 			SET_BH_SEQNUM(inode, bh);
 		else
 			CLEAR_BH_SEQNUM(bh);
-
-		if (!(flags & OCFS_BH_CONCURRENT_WRITE) 
-		    && (!buffer_jbd(bh) || (flags & OCFS_BH_IGNORE_JBD)))
-			ocfs_clear_buffer_modified(bh);
 	}
 	
 bail:

Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c	2004-06-16 21:29:29 UTC (rev 1114)
+++ trunk/src/journal.c	2004-06-16 21:29:52 UTC (rev 1115)
@@ -389,10 +389,6 @@
 	else
 		kern_handle->h_sync = 0;
 
-	/* Ok, we're done changing these buffers now... */
-	for(i = 0; i < handle->num_buffs; i++)
-		ocfs_clear_buffer_modified(handle->buffs[i]);
-
 	/* release inode semaphores we took during this transaction */
 	ocfs_handle_unlock_inodes(handle);
 	if (handle->flags & OCFS_HANDLE_LOCAL_ALLOC)
@@ -560,15 +556,10 @@
 		OCFS_BH_PUT_DATA(bh);
 
 		/* we no longer need the buffer in this case. */
-		if (!dirtied) {
-			ocfs_clear_buffer_modified(bh);
+		if (!dirtied)
 			brelse(bh);
-		}
 	}
 
-	for(i = 0; i < handle->num_buffs; i++)
-		ocfs_clear_buffer_modified(handle->buffs[i]);
-
 	/* release inode semaphores we took during this transaction */
 	ocfs_handle_unlock_inodes(handle);
 	if (handle->flags & OCFS_HANDLE_LOCAL_ALLOC)

Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c	2004-06-16 21:29:29 UTC (rev 1114)
+++ trunk/src/namei.c	2004-06-16 21:29:52 UTC (rev 1115)
@@ -304,11 +304,6 @@
 	if ((status < 0) && inode)
 		iput(inode);
 
-#ifndef BH_SEM_LEAK_CHECKING
-	if (status < 0)
-#endif
-		ocfs_bh_sem_hash_cleanup_pid(ocfs_getpid());
-
 	LOG_EXIT_STATUS(status);
 	return(status);
 }		/* ocfs_mknod */
@@ -729,13 +724,6 @@
 	if (parent_node_bh)
 		brelse(parent_node_bh);
 
-
-#ifndef BH_SEM_LEAK_CHECKING
-	if (retval < 0)
-#endif
-		ocfs_bh_sem_hash_cleanup_pid(ocfs_getpid());
-
-
 	LOG_EXIT_INT (retval);
 	return retval;
 }				/* ocfs_unlink */
@@ -1225,11 +1213,6 @@
 	if (old_inode_de_bh)
 		brelse(old_inode_de_bh);
 
-#ifndef BH_SEM_LEAK_CHECKING
-	if (status < 0)
-#endif
-		ocfs_bh_sem_hash_cleanup_pid(ocfs_getpid());
-
 	LOG_EXIT_STATUS(status);
 	return status;
 }				/* ocfs_rename */
@@ -1365,6 +1348,7 @@
 bail:
 	up_write(&OCFS_I(dir)->ip_io_sem);
 
+	/* can we race with the nm threads iget() here? */
 	if (status >= 0) {
 		insert_inode_hash (inode);
 		d_instantiate (dentry, inode);
@@ -1378,11 +1362,6 @@
 	if (parent_fe_bh)
 		brelse(parent_fe_bh);
 
-#ifndef BH_SEM_LEAK_CHECKING
-	if (status < 0)
-#endif
-		ocfs_bh_sem_hash_cleanup_pid(ocfs_getpid());
-
 	LOG_EXIT_STATUS (status);
 	return status;
 }				/* ocfs_symlink */

Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c	2004-06-16 21:29:29 UTC (rev 1114)
+++ trunk/src/nm.c	2004-06-16 21:29:52 UTC (rev 1115)
@@ -239,8 +239,6 @@
 	return(status);
 }   /* ocfs_schedule_process_vote */
 
-//#define OCFS_BH_SEM_PRUNE_LIMIT   60   // prune everything each 30 seconds
-#define OCFS_BH_SEM_PRUNE_LIMIT   60000  // 8 hours :)
 /* half a second timeout */
 #define OCFS_HEARTBEAT_JIFFIES  (HZ >> 1)
 
@@ -265,7 +263,7 @@
 	ocfs_node_config_hdr *node_cfg_hdr = NULL;
 	__u64 curr_node_map;
 	__u64 cfg_seq_num;
-	int which, pruned, prune_iters = 0;
+	int which;
 	struct buffer_head *bh = NULL;
 	siginfo_t info;
 
@@ -294,18 +292,6 @@
 		if (!time_after (jiffies, (unsigned long) (osb->hbt)))
 			goto finally;
 
-		/* try to prune some bh_sem hash entries if list is too long */
-		if (prune_iters++ == OCFS_BH_SEM_PRUNE_LIMIT) {
-			int missed;
-			prune_iters = 0;
-			missed = ocfs_bh_sem_hash_prune_all(); 
-			//LOG_TRACE_ARGS("missed %d entries pruning everything from nm thread\n", missed);
-			printk("missed %d entries pruning everything from nm thread\n", missed);
-		} else {
-			pruned = ocfs_bh_sem_hash_prune();
-			LOG_TRACE_ARGS("pruned %d entries from nm thread\n", pruned);
-		}
-
 		/* lock publish to prevent overwrites from vote_req and vote_reset */
 		down (&(osb->publish_lock));
 
@@ -1132,10 +1118,7 @@
 				}
 				else // CHANGE_MASTER
 					lockres->master_node_num = node_num;
-			} else {
-				/* we didn't actually modify it. */
-				ocfs_clear_buffer_modified(fe_bh);
-			}
+			} 
 			brelse(fe_bh);
 			vote_response = FLAG_VOTE_NODE;
 			inc_inode_seq = 1;

Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c	2004-06-16 21:29:29 UTC (rev 1114)
+++ trunk/src/super.c	2004-06-16 21:29:52 UTC (rev 1115)
@@ -515,12 +515,6 @@
 		goto leave;
 	}
 	
-	status = ocfs_bh_sem_hash_init();
-	if (status < 0) {
-		LOG_ERROR_STATUS (status);
-		goto leave;
-	}
-
 	OcfsGlobalCtxt.hbm = DISK_HBEAT_COMM_ON;
 
 	spin_lock_init (&osb_id_lock);
@@ -547,9 +541,6 @@
 
 leave:
 	if (status < 0) {
-		if (OcfsGlobalCtxt.bh_sem_hash && ocfs_bh_sem_hash_destroy() < 0) 
-			LOG_ERROR_STR("failed to destroy bh_sem hashtable");
-
 		/* Free up lookaside lists */
 		if (OcfsGlobalCtxt.flags & OCFS_FLAG_MEM_LISTS_INITIALIZED)
 			ocfs_free_mem_lists ();
@@ -701,9 +692,6 @@
 	down (&(OcfsGlobalCtxt.global_res));
 	OCFS_SET_FLAG (OcfsGlobalCtxt.flags, OCFS_FLAG_SHUTDOWN_VOL_THREAD);
 
-	if (ocfs_bh_sem_hash_destroy() < 0) 
-		LOG_ERROR_STR("failed to destroy bh_sem hashtable");
-
 	if (OcfsGlobalCtxt.flags & OCFS_FLAG_MEM_LISTS_INITIALIZED)
 		ocfs_free_mem_lists ();
 
@@ -829,10 +817,6 @@
 		sizeof(ocfs_extent) + OCFS_POINTER_SIZE, 0, SLAB_NO_REAP | SLAB_HWCACHE_ALIGN,
 		NULL, NULL);
 	
-	OcfsGlobalCtxt.bh_sem_cache = kmem_cache_create ("ocfs2_bh_sem",
-		sizeof(ocfs_bh_sem), 0, SLAB_NO_REAP | SLAB_HWCACHE_ALIGN,
-		NULL, NULL);
-
 	OCFS_SET_FLAG (OcfsGlobalCtxt.flags, OCFS_FLAG_MEM_LISTS_INITIALIZED);
 
 	return 0;
@@ -847,7 +831,6 @@
 	kmem_cache_destroy (OcfsGlobalCtxt.inode_cache);
 	kmem_cache_destroy (OcfsGlobalCtxt.fe_cache);
 	kmem_cache_destroy (OcfsGlobalCtxt.extent_cache);
-	kmem_cache_destroy (OcfsGlobalCtxt.bh_sem_cache);
 	OCFS_CLEAR_FLAG (OcfsGlobalCtxt.flags, OCFS_FLAG_MEM_LISTS_INITIALIZED);
 }				/* ocfs_free_mem_lists */
 



More information about the Ocfs2-commits mailing list