[Ocfs2-commits] rev 16 - in trunk: . src src/inc

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Jan 27 18:24:22 CST 2004


Author: manish
Date: 2004-01-27 12:24:19 -0600 (Tue, 27 Jan 2004)
New Revision: 16

Added:
   trunk/src/inc/io.h
Removed:
   trunk/src/inc/ocfsio.h
Modified:
   trunk/TODO
   trunk/configure.in
   trunk/src/Makefile
   trunk/src/alloc.c
   trunk/src/bitmap.c
   trunk/src/dcache.c
   trunk/src/dir.c
   trunk/src/dlm.c
   trunk/src/file.c
   trunk/src/hash.c
   trunk/src/heartbeat.c
   trunk/src/inc/ocfs.h
   trunk/src/inc/proto.h
   trunk/src/inode.c
   trunk/src/journal.c
   trunk/src/namei.c
   trunk/src/nm.c
   trunk/src/oin.c
   trunk/src/osb.c
   trunk/src/proc.c
   trunk/src/sem.c
   trunk/src/super.c
   trunk/src/util.c
   trunk/src/vote.c
Log:
Sync


Modified: trunk/TODO
===================================================================
--- trunk/TODO	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/TODO	2004-01-27 18:24:19 UTC (rev 16)
@@ -1,5 +1,19 @@
+* figure out what to do about old style cdsl. Either we error when we see it
+  (in the module), or we provide an fsck to find and fix them.
+
+* Move the journal file entry over to the next system slot which is unused.
+  This should make downgrading back to ocfs version 1 easier.
+
+* Provide a solution for the potential problem with journal_access buffers
+  who haven't been journal_dirtied in abort_trans. Check out the comment in
+  abort_trans for more info on this.
+
 * fsck must be able to replay the journal
 
+* provide an ocfsmigrate utility to migrate v1 -> v2 and back.
+
+* finish mkfs to really create a filesystem.
+
 * System files should be locked with cache lock, and we need inodes
   for them so that we can cache our reads to them. This can also count
   for the main bitmap. Data writes to the bitmap files can be

Modified: trunk/configure.in
===================================================================
--- trunk/configure.in	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/configure.in	2004-01-27 18:24:19 UTC (rev 16)
@@ -105,10 +105,14 @@
 fi
 AC_SUBST(OCFS_TRACE)
 
-AC_ARG_ENABLE(largeio, [  --enable-largeio=[yes/no]         Turn on largeio [default=yes]],,enable_largeio=yes) 
+AC_ARG_ENABLE(largeio, [  --enable-largeio=[yes/no/auto]    Turn on largeio [default=auto]],,enable_largeio=auto) 
 OCFS_LARGEIO=yes
 if test "x$enable_largeio" = "xno"; then
   OCFS_LARGEIO=
+elif test "x$enable_largeio" = "xauto"; then
+  if test "$OCFS_PROCESSOR" = "ia64"; then
+    OCFS_LARGEIO=
+  fi
 fi
 AC_SUBST(OCFS_LARGEIO)
 
@@ -199,7 +203,11 @@
 
 KVER=
 if test "x$rhkernel" = "xyes"; then
-  KVER=up
+  if test "$OCFS_PROCESSOR" = "i686"; then
+    KVER=up
+  else
+    KVER=smp
+  fi
 elif test "x$ulkernel" = "xyes"; then
   KVER=suse
 fi

Modified: trunk/src/Makefile
===================================================================
--- trunk/src/Makefile	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/Makefile	2004-01-27 18:24:19 UTC (rev 16)
@@ -110,7 +110,7 @@
 
 CFLAGS += $(OPTIMIZE)
 
-MODULES = ocfs.o
+MODULES = ocfs2.o
 
 
 OSOURCES = \
@@ -171,14 +171,14 @@
 
 OBJS = $(subst .c,.o,$(CFILES))
 
-ocfs.o: $(OBJS)
+ocfs2.o: $(OBJS)
 	$(CC) $(OPTS) -Wl,-r -o $@ $^ $(LDADD)
 
 INSTALL_RULES = install-ocfs
 
-install-ocfs: ocfs.o
+install-ocfs: ocfs2.o
 	$(TOPDIR)/mkinstalldirs $(DESTDIR)$(MODULEDIR)
-	$(INSTALL_DATA) ocfs.o $(DESTDIR)$(MODULEDIR)/ocfs.o
+	$(INSTALL_DATA) ocfs2.o $(DESTDIR)$(MODULEDIR)/ocfs2.o
 
 
 CLEAN_RULES = clean-ocfs

Modified: trunk/src/alloc.c
===================================================================
--- trunk/src/alloc.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/alloc.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -49,7 +49,8 @@
 static int ocfs_sync_local_to_main(ocfs_super *osb, 
 				   ocfs_bitmap_free_head **f, 
 				   struct buffer_head *local_alloc_bh, 
-				   struct buffer_head *bm_lock_bh);
+				   struct buffer_head *bm_lock_bh,
+				   bool in_recovery);
 static __u32 ocfs_alloc_count_bits(ocfs_local_alloc *alloc);
 static void ocfs_clear_local_alloc(ocfs_local_alloc *alloc);
 static int ocfs_find_space_from_local(ocfs_super *osb, __u32 bitswanted, 
@@ -3356,7 +3357,8 @@
 static int ocfs_sync_local_to_main(ocfs_super *osb, 
 				   ocfs_bitmap_free_head **f, 
 				   struct buffer_head *local_alloc_bh, 
-				   struct buffer_head *bm_lock_bh)
+				   struct buffer_head *bm_lock_bh,
+				   bool in_recovery)
 {
 	int status = 0, tmpstat;
 	ocfs_lock_res *bm_lock_res = NULL;
@@ -3365,6 +3367,7 @@
 	int bit_off, left;
 	ocfs_local_alloc *alloc = NULL;
 	bool local_lock = true;
+	void *bitmap;
 
 	LOG_ENTRY();
 
@@ -3389,7 +3392,9 @@
 
 		/* Get the allocation lock here */
 		status = ocfs_acquire_lock (osb, OCFS_BITMAP_LOCK_OFFSET,
-					    OCFS_DLM_EXCLUSIVE_LOCK, 0, 
+					    OCFS_DLM_EXCLUSIVE_LOCK, 
+					    (in_recovery) ? FLAG_FILE_RECOVERY 
+					    : 0, 
 					    &bm_lock_res, &bh, NULL);
 		if (status < 0) {
 			if (status != -EINTR)
@@ -3422,10 +3427,13 @@
 	LOG_TRACE_ARGS("alloc->alloc_size = %u, COUNT = %u, num_used = %u\n", 
 		       alloc->alloc_size, ocfs_alloc_count_bits(alloc), 
 		       alloc->num_used);
+
+	bitmap = alloc->bitmap;
+
 	/* any unset bits in local alloc need to be unset in bitmap. */
 	bit_off = 0;
 	left = alloc->alloc_size;
-	while ((bit_off = find_next_zero_bit(alloc->bitmap, left, bit_off)) 
+	while ((bit_off = find_next_zero_bit(bitmap, left, bit_off)) 
 	       != -1) {
 		if (bit_off >= left) {
 			/*LOG_TRACE_ARGS("bit_off (%d) >= left\n", bit_off);*/
@@ -3549,7 +3557,7 @@
 				      __u32 numbits)
 {
 	int numfound, bitoff, left, startoff, lastzero;
-	__u8 *bitmap = NULL;
+	void *bitmap = NULL;
 
 	LOG_ENTRY_ARGS("(numbits wanted = %u)\n", numbits);
 
@@ -3617,6 +3625,7 @@
 	/* main bitmap variables. */
 	struct buffer_head *main_bm_bh = NULL;
 	ocfs_lock_res *bm_lock_res = NULL;
+	void *bitmap;
 
 	LOG_ENTRY_ARGS("(bitswanted = %u)\n", bitswanted);
 	
@@ -3648,10 +3657,11 @@
 		if (status < 0) {
 			if (status == -ENOSPC) {
 				/* TODO: Remove this printk */
-				printk("ocfs: disabling local alloc "
+				printk("ocfs2: disabling local alloc "
 				       "bitmap for this mount.\n");
 
-				ocfs_shutdown_local_alloc(osb, NULL, false);
+				ocfs_shutdown_local_alloc(osb, NULL, false, 
+							  false);
 
 				/* we want to make sure an empty alloc
 				 * hits disk. */
@@ -3697,7 +3707,7 @@
 		}
 
 		status = ocfs_sync_local_to_main(osb, &(handle->commit_bits),
-						 NULL, main_bm_bh);
+						 NULL, main_bm_bh, false);
 		if (status < 0) {
 			LOG_ERROR_STATUS(status);
 			goto bail;
@@ -3726,11 +3736,12 @@
 
 	/* Ok, if we've got this far then the search suceeded and we
 	 * can mark the bitmap. */
+	bitmap = alloc->bitmap;
 	tmpoff = startoff;
 	tmpwanted = bitswanted;
 	while(tmpwanted--) {
 		/* LOG_TRACE_ARGS("setting bit %d\n", tmpoff); */
-		set_bit(tmpoff++, alloc->bitmap);
+		set_bit(tmpoff++, bitmap);
 	}
 	alloc->num_used += bitswanted;
 
@@ -3940,16 +3951,21 @@
  * one off osb. If you do pass it however, be warned that it *will* be
  * returned brelse'd and NULL'd out.*/
 void ocfs_shutdown_local_alloc(ocfs_super *osb, 
-			       struct buffer_head **local_alloc_bh, bool sync)
+			       struct buffer_head **local_alloc_bh, 
+			       bool sync,
+			       bool in_recovery)
 {
 	int status;
 	ocfs_local_alloc *alloc = NULL;
 	ocfs_bitmap_free_head *f = NULL;
 	struct buffer_head *bh = NULL;
 
-	LOG_ENTRY_ARGS("(local_alloc_bh = 0x%x, sync = %s\n)", local_alloc_bh,
-		       sync ? "true" : false);
+	LOG_ENTRY_ARGS("(local_alloc_bh = 0x%x, sync = %s, "
+		       "in_recovery = %s)\n", local_alloc_bh,
+		       sync ? "true" : "false",
+		       in_recovery ? "true" : "false");
 
+
 	if (!osb->have_local_alloc)
 		return;
 
@@ -3958,7 +3974,7 @@
 	else
 		bh = osb->local_alloc_bh;
 
-	status = ocfs_sync_local_to_main(osb, &f, NULL, NULL);
+	status = ocfs_sync_local_to_main(osb, &f, NULL, NULL, in_recovery);
 	if (status < 0)
 		LOG_ERROR_STATUS(status);
 	else if (f)
@@ -4010,7 +4026,7 @@
 		goto bail;
 	}
 
-	ocfs_shutdown_local_alloc(osb, &alloc_bh, true);
+	ocfs_shutdown_local_alloc(osb, &alloc_bh, true, true);
 
 bail:
 	if (alloc_bh)

Modified: trunk/src/bitmap.c
===================================================================
--- trunk/src/bitmap.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/bitmap.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -274,7 +274,7 @@
 void ocfs_set_bits (ocfs_alloc_bm * bitmap, __u32 start, __u32 num)
 {
 	struct buffer_head *currbh = NULL;
-	char *buff;
+	void *buff;
 	int i, local;
 
 	LOG_ENTRY_ARGS ("(0x%08x, %u, %u)\n", bitmap, start, num);
@@ -315,7 +315,7 @@
 void ocfs_clear_bits (ocfs_alloc_bm * bitmap, __u32 start, __u32 num)
 {
 	struct buffer_head *currbh = NULL;
-	char *buff;
+	void *buff;
 	int i, local;
 
 	LOG_ENTRY_ARGS ("(0x%08x, %u, %u)\n", bitmap, start, num);

Modified: trunk/src/dcache.c
===================================================================
--- trunk/src/dcache.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/dcache.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -66,7 +66,8 @@
                 /* shouldn't be revalidating root dir, need offset to parent, and fe for this dir */
 		if (osb->oin_root_dir->inode == inode ||
 		    !ocfs_linux_get_inode_offset (parent, &parentOff, NULL) ||
-		    !ocfs_linux_get_dir_entry_offset (osb, &off, parentOff, &(dentry->d_name), &fe_bh, NULL)) 
+		    !ocfs_linux_get_dir_entry_offset (osb, &off, parentOff, 
+						      &(dentry->d_name), &fe_bh, parent)) 
                         goto bail;
 	} else if (ocfs_linux_get_inode_offset (inode, &off, NULL)) {
 		tmpstat= ocfs_read_bh(osb, off, &fe_bh, 0, inode);
@@ -99,6 +100,7 @@
 #else
 		args.offset = fe->this_sector;
 		args.fe_bh = fe_bh;
+		args.file_lookup_only = false;
 		OCFS_BH_PUT_DATA(fe_bh);
 		fe = NULL;
 		ocfs_read_inode2 (inode, (void *) &args);

Modified: trunk/src/dir.c
===================================================================
--- trunk/src/dir.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/dir.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -98,7 +98,9 @@
                                     if (r < 0)
 					   LOG_ERROR_STR("filldir failed"); 
                             } else {
-                                    if (ocfs_find_files_on_disk (osb, rootOff, NULL, &entry_bh, ofile, inode) < 0)
+				    r = ocfs_find_files_on_disk (osb, rootOff, NULL, &entry_bh, 
+								 ofile, inode, true);
+				    if (r < 0)
 					    break;
 				    entry = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(entry_bh); /* read */
                                     r=filldir (dirent, entry->filename, strlen (entry->filename), filp->f_pos,
@@ -135,7 +137,7 @@
 /* ocfs_find_files_on_disk()
  *
  */
-int ocfs_find_files_on_disk (ocfs_super * osb, __u64 parent_off, struct qstr * file_name, struct buffer_head ** fe_bh, ocfs_file * ofile, struct inode *inode)
+int ocfs_find_files_on_disk (ocfs_super * osb, __u64 parent_off, struct qstr * file_name, struct buffer_head ** fe_bh, ocfs_file * ofile, struct inode *inode, bool take_lock)
 {
 	int status = -ENOENT;
 	__u64 thisDirNode;
@@ -146,11 +148,12 @@
 	struct buffer_head *bh = NULL;
 	struct buffer_head **bhs = NULL;
 	int bufsz, nbhs, i;
+	ocfs_dir_node *dir = NULL;
+	struct inode *tmpinode = NULL;
 
-
 	/* TODO: change this to take a buffer head instead of fe */
 
-	LOG_ENTRY_ARGS ("(osb=%p, parent=%u.%u, fname=%p, fe_bh=%p, ofile=%p)\n", osb, parent_off, file_name, fe_bh, ofile);
+	LOG_ENTRY_ARGS ("(osb=%p, parent=%u.%u, fname=%p, fe_bh=%p, ofile=%p, inode=%p)\n", osb, parent_off, file_name, fe_bh, ofile, inode);
 
 	nbhs = osb->vol_layout.dir_node_size >> 9;
 	bufsz = nbhs * (sizeof(struct buffer_head *));
@@ -172,16 +175,18 @@
 	}
 	OCFS_ASSERT(bhs);
 
-	/* Get a shared lock on the directory... */
-	status = ocfs_acquire_lock (osb, parent_off, OCFS_DLM_SHARED_LOCK, FLAG_DIR,
-				    &lockres, &bh, inode);
-	if (status < 0) {
-		/* Volume should be disabled in this case */
-		if (status != -EINTR)
-			LOG_ERROR_STATUS (status);
-		goto leave;
+	if (take_lock) {
+		/* Get a shared lock on the directory... */
+		status = ocfs_acquire_lock (osb, parent_off, OCFS_DLM_SHARED_LOCK, FLAG_DIR,
+				    	&lockres, &bh, inode);
+		if (status < 0) {
+			/* Volume should be disabled in this case */
+			if (status != -EINTR)
+				LOG_ERROR_STATUS (status);
+			goto leave;
+		}
+		lock_acq = true;
 	}
-	lock_acq = true;
 
 	if (bhs[0]==NULL || bhs[0]->b_blocknr != (thisDirNode >> 9)) {
 		for (i=0; i<nbhs; i++) {
@@ -190,7 +195,7 @@
 				bhs[i]=NULL;
 			}
 		}
-		status = ocfs_read_bhs (osb, thisDirNode, osb->vol_layout.dir_node_size, bhs, OCFS_BH_CACHED, inode);
+		status = ocfs_read_dirnode(osb, thisDirNode, &bhs[0], OCFS_BH_CACHED, inode);
 		if (status < 0) {
 			/* Volume should be disabled in this case */
 			LOG_ERROR_STATUS (status);
@@ -207,7 +212,7 @@
 
 leave:
 
-	if (lock_acq)
+	if (take_lock && lock_acq)
 	{
 		tmpstat = ocfs_release_lock (osb, parent_off, OCFS_DLM_SHARED_LOCK,
 					     FLAG_DIR, lockres, bh, inode);
@@ -433,7 +438,7 @@
 					bhs[i] = NULL;
 				}
 			}
-			status = ocfs_read_bhs (osb, next, osb->vol_layout.dir_node_size, bhs, OCFS_BH_CACHED, dir_inode);
+			status = ocfs_read_dirnode(osb, next, bhs, OCFS_BH_CACHED, dir_inode);
 			if (status < 0) {
 				LOG_ERROR_STR("failed to read directory");
 				bRet = false;
@@ -612,10 +617,7 @@
 			goto leave;
 		}
 		memset(arr, 0, bufsz);
-
-		status = ocfs_read_bhs (osb, DirNodeOffset, 
-					osb->vol_layout.dir_node_size, arr, 
-					OCFS_BH_CACHED, dir_inode);
+		status = ocfs_read_dirnode(osb, DirNodeOffset, arr, OCFS_BH_CACHED, dir_inode);
 		if (status < 0) {
 			LOG_ERROR_STATUS (status);
 			goto leave;
@@ -1074,8 +1076,7 @@
 	LockNode = NULL;
 
 	/* get the bhs for dir_off */
-	status = ocfs_read_bhs (osb, dir_off, osb->vol_layout.dir_node_size, 
-				bhs, OCFS_BH_CACHED, dir_inode);
+	status = ocfs_read_dirnode(osb, dir_off, bhs, OCFS_BH_CACHED, dir_inode);
 	if (status < 0) {
 		LOG_ERROR_STATUS (status);
 		goto leave;
@@ -1110,8 +1111,7 @@
 	dir_off = locknode_off;
 	while (1) {
 		LOG_TRACE_ARGS("ocfs_insert_file: now checking %u.%u\n", dir_off);
-		status = ocfs_read_bhs (osb, dir_off, osb->vol_layout.dir_node_size,
-					bhs, OCFS_BH_CACHED, dir_inode);
+		status = ocfs_read_dirnode(osb, dir_off, bhs, OCFS_BH_CACHED, dir_inode);
 		if (status < 0) {
 			LOG_ERROR_STATUS (status);
 			goto leave;
@@ -1202,10 +1202,8 @@
 		if (dir_next_node != INVALID_NODE_POINTER) {
 			/* already allocated a new block */
 			LOG_TRACE_ARGS("ocfs_insert_file: CASE 2A\n");
-			status = ocfs_read_bhs(osb, dir_next_node, 
-					       osb->vol_layout.dir_node_size, 
-					       newbhs, OCFS_BH_COND_CACHED, 
-					       dir_inode);
+			status = ocfs_read_dirnode(osb, dir_next_node, newbhs, 
+						   OCFS_BH_COND_CACHED, dir_inode);
 			if (status < 0) {
 				ocfs_safefree(newbhs);
 				LOG_ERROR_STATUS (status);
@@ -1236,9 +1234,8 @@
 				goto leave;
 			}
 
-			status = ocfs_read_bhs(osb, bitmapOffset,
-					       osb->vol_layout.dir_node_size,
-					       newbhs, OCFS_BH_COND_CACHED, dir_inode);
+			status = ocfs_read_dirnode(osb, bitmapOffset, newbhs, 
+						   OCFS_BH_COND_CACHED, dir_inode);
 			if (status < 0) {
 				ocfs_safefree(newbhs);
 				LOG_ERROR_STATUS (status);

Modified: trunk/src/dlm.c
===================================================================
--- trunk/src/dlm.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/dlm.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -400,6 +400,7 @@
 				status = tmpstat;
 				goto finally;
 			}
+			LOG_TRACE_ARGS("broke cache lock, setting to NO_LOCK\n");
 			fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(bh); /* write */
 			DISK_LOCK_FILE_LOCK (fe) = OCFS_DLM_NO_LOCK;
 			lock_level = OCFS_DLM_NO_LOCK;
@@ -1278,6 +1279,27 @@
 	return status;
 }				/* ocfs_create_update_lock */
 
+enum {
+	invalid_path = 0,
+	fast_path, 
+	become_master, 
+	get_x, 
+	wait_for_release, 
+	master_request,
+	num_paths
+};
+
+const char *lock_path_strs[] = {"invalid_path", "fast_path", "become_master",
+				"get_x", "wait_for_release", "master_request" };
+
+static inline const char * lock_path_str(int lock_path);
+static inline const char * lock_path_str(int lock_path)
+{
+	if (lock_path >= num_paths || lock_path <= invalid_path)
+		return lock_path_strs[0];
+	return lock_path_strs[lock_path];
+}
+
 /*
  * ocfs_acquire_lock()
  *
@@ -1295,13 +1317,11 @@
 	int lockflags = (lock_id >= osb->vol_layout.bitmap_off ? OCFS_BH_CACHED : 0);
 	/* TODO: 40 bytes of "bool" sitting on the stack for now. move    */
 	/*       mutually exclusive flags into an enum and switch on them */
-	bool disk_vote = false;
-	bool become_master = false, keep_exclusive = false, wait_for_release = false;
-	bool local_lock = false, fast_path = false, wait_on_recovery = false;
-	bool get_x = false, master_request = false, truncate_extend = false;
-	bool have_cache_already = false;
+	bool disk_vote = false, keep_exclusive = false, local_lock = false;
+	bool no_owner = false, owner_dead = false, wait_on_recovery = false;
+	bool truncate_extend = false, have_cache_already = false;
+	int lock_path = invalid_path;
 
-
 	LOG_ENTRY_ARGS ("(0x%08x, %u.%u, %u, %u, 0x%08x, 0x%08x)\n", osb,
 			HI (lock_id), LO (lock_id), lock_type, flags, lr, bh);
 
@@ -1392,169 +1412,163 @@
 		OCFS_BH_PUT_DATA(*b);
 	}
 
+	no_owner = (lockres->master_node_num == OCFS_INVALID_NODE_NUM);
+
 	/* master node is an invalid node */
-	if (unlikely(lockres->master_node_num >= OCFS_MAXIMUM_NODES &&
-	             lockres->master_node_num != OCFS_INVALID_NODE_NUM)) {
+	if (unlikely(lockres->master_node_num >= OCFS_MAXIMUM_NODES && !no_owner)) {
 		LOG_ERROR_STATUS (status = -EINVAL);
 		ocfs_release_lockres (lockres);
 		goto finally;
 	}
 
-	master_request = false;
-	fast_path = false;
 	truncate_extend = (flags & (FLAG_FILE_EXTEND | FLAG_FILE_TRUNCATE));
 	local_lock = (lockres->master_node_num == osb->node_num);
 	wait_on_recovery = TEST_NODE_IN_RECOVERY(osb, lockres->master_node_num);
-	become_master = (osb->node_num != lockres->master_node_num) 
-		&& (wait_on_recovery || 
-		    lockres->master_node_num == OCFS_INVALID_NODE_NUM || 
-		    !IS_NODE_ALIVE(osb->publ_map, lockres->master_node_num, 
-				   OCFS_MAXIMUM_NODES));
+	owner_dead = !(no_owner || IS_NODE_ALIVE(osb->publ_map, 
+			 lockres->master_node_num, OCFS_MAXIMUM_NODES));
 
-	wait_for_release = (lockres->lock_type > OCFS_DLM_SHARED_LOCK);
-	wait_for_release = false;
-	get_x = (flags & (FLAG_FILE_DELETE | FLAG_FILE_RENAME) 
-		 && !become_master && (local_lock || !wait_for_release));
-	if (local_lock && !(get_x || truncate_extend))
-		fast_path = true;
-	if (local_lock && truncate_extend) {
-#ifdef VERBOSE_LOCKING_TRACE
-		LOG_TRACE_ARGS("local_lock but an extend or truncate request!  will do a master_request.\n");
-#endif
-		become_master = true;
+	if (!local_lock && (wait_on_recovery || no_owner || owner_dead)) {
+		lock_path = become_master;
+	} else if (flags & (FLAG_FILE_DELETE | FLAG_FILE_RENAME)) {
+		lock_path = get_x;
+	} else if (local_lock) {
+		if (truncate_extend)
+			lock_path = become_master;
+		else 
+			lock_path = fast_path;
+	} else {
+		lock_path = master_request;
 	}
-	if (!(fast_path || become_master || get_x || wait_for_release))
-		master_request = true;
+			
+	/* hack upon hack... if the cachelock is still sitting around, skip voting */
+	if ((lock_path == become_master || lock_path == get_x) &&
+		ocfs_journal_new_file_search(osb, lock_id)==0)
+			lock_path = fast_path;
 
-	/* hack upon hack... if the cachelock is still sitting around, skip voting */
-	if (!fast_path && (become_master || get_x)) {
-		if (ocfs_journal_new_file_search(osb, lock_id)==0) {
-			fast_path = true;
-		}
+	if (lock_path == fast_path && lockres->lock_type != OCFS_DLM_ENABLE_CACHE_LOCK) {
+		LOG_TRACE_ARGS("testing testing!!! flipping this fast_path to master_request\n");
+		lock_path = master_request;
 	}
+		
 
-	/* possible locking paths:               */
-        /*   fast_path, become_master, get_x,    */
-	/*   wait_for_release, master_request    */
+	LOG_TRACE_ARGS("lockres: master=%d, locktype=%d, flags: %d, lock_path: %s\n",
+		       lockres->master_node_num, lockres->lock_type, flags, 
+		       lock_path_str(lock_path));
 
-#ifdef VERBOSE_LOCKING_TRACE
-	LOG_TRACE_ARGS("acquire_lock: lock path is %s\n", 
-	       fast_path ? "fast_path" : 
-	        (become_master ? "become_master" : 
-		 (get_x ? "get_x" : 
-		  (wait_for_release ? "wait_for_release" : 
-		   (master_request ? "master_request" : "invalid")))));
-#endif
-
-	/* master node is this node */
-	if (fast_path) {
-		/* specifically keep an exclusive if we already have one on */
-		/* this node even if we are asking for a cache lock */
-		disklock = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(*b); /* read */
-		keep_exclusive = (DISK_LOCK_FILE_LOCK (disklock) == OCFS_DLM_EXCLUSIVE_LOCK);
-		OCFS_BH_PUT_DATA(*b);
-		goto got_lock;
-	}
-
-	/* there is no master, or master needs recovery */
-	/* or a delete or rename request */
-	if (become_master || get_x) {
-		if (wait_on_recovery && !(flags & FLAG_FILE_RECOVERY)) {
-			int waitcnt = 0;
-			LOG_TRACE_ARGS("Waiting on node %u to be recovered\n",
-				       lockres->master_node_num);
-			while (1) {
-				LOG_TRACE_ARGS("waitcnt = %d\n", waitcnt);
-				if (!TEST_NODE_IN_RECOVERY(osb, lockres->master_node_num))
-					break;
-				ocfs_sleep(500);
-			}
+	switch (lock_path) {
+		case fast_path: /* master node is this node */
+		{
+			/* specifically keep an exclusive if we already have one on */
+			/* this node even if we are asking for a cache lock */
+			disklock = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(*b); /* read */
+			keep_exclusive = (DISK_LOCK_FILE_LOCK (disklock) == OCFS_DLM_EXCLUSIVE_LOCK);
+			if (keep_exclusive)
+				LOG_ERROR_STR("keep_exclusive set!");
+			OCFS_BH_PUT_DATA(*b);
+			break;
 		}
-
-		status = ocfs_make_lock_master (osb, lock_id, lock_type,
-					   flags, lockres, *b, &disk_vote, inode);
-
-		if (status < 0) {
-			ocfs_release_lockres (lockres);
-			if (status == -EAGAIN) {
-				ocfs_sleep (500);
-				if (ocfs_task_interruptible (osb)) {
-					LOG_TRACE_ARGS("interrupted... lockid=%u.%u\n", HILO(lock_id));
-					status = -EINTR;
-					goto finally;
+		case become_master:  	/* there is no master, or master needs recovery */
+		case get_x:		/* a delete or rename request */
+		{
+			if (wait_on_recovery && !(flags & FLAG_FILE_RECOVERY)) {
+				int waitcnt = 0;
+				LOG_TRACE_ARGS("Waiting on node %u to be recovered\n",
+				       	lockres->master_node_num);
+				while (1) {
+					LOG_TRACE_ARGS("waitcnt = %d\n", waitcnt);
+					if (!TEST_NODE_IN_RECOVERY(osb, lockres->master_node_num))
+						break;
+					ocfs_sleep(500);
 				}
-
-				updated = false;
-				goto again;
 			}
-			goto finally;
-		}
-
-		/* make lock master succeeded */
-		/* so why, if get_x and the make lock master do the same thing,
-		 * does the make lock master path need to rewrite the stuff to disk
-		 * but the get_x path doesn't ???? */
-		if (get_x)
-			goto skip_lock_write;
-		keep_exclusive = false;
-		goto got_lock;
-	}
-
-	/* there is a valid, live master and it's not this node */
-	/* if the lock is acquired already by the master wait */
-	/* for release, else change master */
-	if (wait_for_release) {
-		ocfs_release_lockres(lockres);
-		status = ocfs_wait_for_lock_release (osb, lock_id, 30000, lockres,
-			     ((flags & FLAG_DIR) ?  OCFS_DLM_SHARED_LOCK : OCFS_DLM_NO_LOCK), inode);
-		if (status == 0 || status == -ETIMEDOUT) {
-			/* lock released or waited too long, back to top */
-			if (status == -ETIMEDOUT) {
-				LOG_TRACE_ARGS("lock %u.%u, level %d, not being freed by node %u\n", 
-					       HILO(lock_id), lockres->lock_type, lockres->master_node_num);
+	
+			status = ocfs_make_lock_master (osb, lock_id, lock_type,
+					   	flags, lockres, *b, &disk_vote, inode);
+	
+			if (status < 0) {
+				ocfs_release_lockres (lockres);
+				if (status == -EAGAIN) {
+					ocfs_sleep (500);
+					if (ocfs_task_interruptible (osb)) {
+						LOG_TRACE_ARGS("interrupted... lockid=%u.%u\n", HILO(lock_id));
+						status = -EINTR;
+						goto finally;
+					}
+	
+					updated = false;
+					goto again;
+				}
+				goto finally;
 			}
-			updated = false;
-			goto again;
+	
+			/* make lock master succeeded */
+			/* so why, if get_x and the make lock master do the same thing,
+		 	* does the make lock master path need to rewrite the stuff to disk
+		 	* but the get_x path doesn't ???? */
+			if (get_x)
+				goto skip_lock_write;
+			keep_exclusive = false;
+			break;
 		}
-		if (status != -EINTR) {
-			LOG_ERROR_STR ("Lock owner is alive and taking too much time");
-					LOG_ERROR_STATUS(status);
-		}
-		goto finally;
-	}
-
-	OCFS_ASSERT(master_request);
-
-	if (master_request) {
-		status = ocfs_update_lock_state (osb, lockres, flags | FLAG_CHANGE_MASTER, 
-						 &disk_vote, inode);
-		if (status < 0) {
-			ocfs_release_lockres (lockres);
-			if (status == -EAGAIN) {
-				ocfs_sleep (500);
-				if (ocfs_task_interruptible (osb)) {
-					LOG_TRACE_ARGS("interrupted... lockid=%u.%u\n",
-						HILO(lockres->sector_num));
-					status = -EINTR;
-					goto finally;
+		case wait_for_release: 	/* there is a valid, live master and it's not this node */
+					/* if the lock is acquired already by the master wait */
+					/* for release, else change master */
+		{
+			ocfs_release_lockres(lockres);
+			status = ocfs_wait_for_lock_release (osb, lock_id, 30000, lockres,
+			     	((flags & FLAG_DIR) ?  OCFS_DLM_SHARED_LOCK : OCFS_DLM_NO_LOCK), inode);
+			if (status == 0 || status == -ETIMEDOUT) {
+				/* lock released or waited too long, back to top */
+				if (status == -ETIMEDOUT) {
+					LOG_TRACE_ARGS("lock %u.%u, level %d, not being freed by node %u\n", 
+					       	HILO(lock_id), lockres->lock_type, lockres->master_node_num);
 				}
 				updated = false;
 				goto again;
 			}
+			if (status != -EINTR) {
+				LOG_ERROR_STR ("Lock owner is alive and taking too much time");
+						LOG_ERROR_STATUS(status);
+			}
 			goto finally;
 		}
-		// successfully got vote to change master
-		status = ocfs_read_bh (osb, lock_id, b, lockflags, inode);
-		if (status < 0) {
-			LOG_ERROR_STATUS (status);
+		case master_request:
+		{
+			status = ocfs_update_lock_state (osb, lockres, flags | FLAG_CHANGE_MASTER, 
+							 &disk_vote, inode);
+			if (status < 0) {
+				ocfs_release_lockres (lockres);
+				if (status == -EAGAIN) {
+					ocfs_sleep (500);
+					if (ocfs_task_interruptible (osb)) {
+						LOG_TRACE_ARGS("interrupted... lockid=%u.%u\n",
+							HILO(lockres->sector_num));
+						status = -EINTR;
+						goto finally;
+					}
+					updated = false;
+					goto again;
+				}
+				goto finally;
+			}
+			// successfully got vote to change master
+			status = ocfs_read_bh (osb, lock_id, b, lockflags, inode);
+			if (status < 0) {
+				LOG_ERROR_STATUS (status);
+				goto finally;
+			}
+		
+			keep_exclusive = false;
+			break;
+		}
+		default:
+		{
+			LOG_ERROR_ARGS("unknown lock type\n");
+			status = -EINVAL;
 			goto finally;
 		}
-	
-		keep_exclusive = false;
 	}
 
-got_lock:
-
 	disklock = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(*b); /* read */
 	have_cache_already = (DISK_LOCK_CURRENT_MASTER (disklock) == osb->node_num &&
 			      DISK_LOCK_FILE_LOCK (disklock) == OCFS_DLM_ENABLE_CACHE_LOCK);
@@ -1763,6 +1777,9 @@
 
 	fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(*b); /* write */
 
+	LOG_TRACE_ARGS("writing lock now... releasemaster: %s, level: %d, master: %d\n",
+		       flags & FLAG_FILE_RELEASE_MASTER, DISK_LOCK_FILE_LOCK (fe),
+		       DISK_LOCK_CURRENT_MASTER (fe));
 	if (flags & FLAG_FILE_RELEASE_MASTER)
 		DISK_LOCK_CURRENT_MASTER (fe) = OCFS_INVALID_NODE_NUM;
 
@@ -1770,9 +1787,12 @@
 	    (DISK_LOCK_CURRENT_MASTER (fe) == osb->node_num)) {
 		lockres->lock_state = OCFS_DLM_ENABLE_CACHE_LOCK; 
 		cachelock = true;
+		LOG_TRACE_STR("keeping at CACHE_LOCK");
 	}
-	else
+	else {
+		LOG_TRACE_STR("setting to NO_LOCK");
 		DISK_LOCK_FILE_LOCK (fe) = OCFS_DLM_NO_LOCK;
+	}
 
 	OCFS_BH_PUT_DATA(*b);
 
@@ -2099,7 +2119,12 @@
 
 	lockres->lock_type = (__u8) OCFS_DLM_NO_LOCK;
 
-	LOG_TRACE_STR ("okie dokie... ocfs_break_cache_lock done\n");
+	LOG_TRACE_STR ("okie dokie... ocfs_break_cache_lock voting done\n");
+#if 0
+	status = ocfs_break_cache_lock_drop_buffers(osb, lockres->sector_num, inode);
+	
+	LOG_TRACE_STR ("okie dokie... ocfs_break_cache_lock drop buffers done\n");
+#endif
 
 finally:
 	jif = jiffies - jif;
@@ -2116,3 +2141,37 @@
 	LOG_EXIT_STATUS (status);
 	return (status);
 }				/* ocfs_break_cache_lock */
+
+#if 0
+int ocfs_break_cache_lock_drop_buffers(ocfs_super * osb, __u64 lock_id, struct inode * inode)
+{
+	unsigned long blk, startblk;
+	__u64 next_node_ptr;
+	int i, status;
+	struct buffer_head *bh;
+	ocfs_dir_node *dir;
+	
+	next_node_ptr = lock_id;
+	do {
+		bh = NULL;
+		startblk = next_node_ptr >> 9;
+		status = ocfs_read_bh (osb, next_node_ptr, bh, 0, inode);
+		if (status < 0) {
+			LOG_ERROR_STATUS(status);
+			break;
+		}
+		dir = (ocfs_dir_node *)OCFS_BH_GET_DATA_READ(bh);
+		next_node_ptr = dir->next_node_ptr;
+		OCFS_BH_PUT_DATA(bh);
+		brelse(bh);
+		for (blk = startblk + 1; blk < startblk + 256; blk++) {
+			bh = getblk(OCFS_GET_BLOCKDEV(osb->sb), blk, 512);
+			mark_buffer_uptodate(bh, false);
+			CLEAR_BH_SEQNUM(bh);
+			brelse(bh);
+		}
+	} while ((__s64)next_node_ptr != -1LL);
+
+	return status;
+}
+#endif

Modified: trunk/src/file.c
===================================================================
--- trunk/src/file.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/file.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -93,7 +93,7 @@
 
 		/*  Look on the disk now ... */
 		status = ocfs_find_files_on_disk (osb, parent_off, &(dentry->d_name),
-					  &fe_bh, NULL, parent);
+					  &fe_bh, NULL, parent, true);
 		if (status >= 0) {
 			oin = NULL;
 			ocfs_down_sem (&(osb->osb_res), true);
@@ -441,7 +441,7 @@
 	ocfs_lock_res *pLockResource = NULL;
 	__u64 changeSeqNum = 0;
 	__u64 lockId = 0;
-	__u32 lockFlags = 0;
+	__u32 lockFlags = 0, locktype = 0;
 	bool bCacheLock = false;
 	struct buffer_head *bh = NULL;
 	ocfs_journal_handle *handle = NULL;
@@ -489,9 +489,9 @@
 	ocfs_handle_set_sync(handle, false);
 #endif
 
-	status = ocfs_acquire_lock (osb, lockId, 
-			bCacheLock ? OCFS_DLM_ENABLE_CACHE_LOCK : OCFS_DLM_EXCLUSIVE_LOCK, 
-			lockFlags, &pLockResource, &bh, inode);
+	locktype = bCacheLock ? OCFS_DLM_ENABLE_CACHE_LOCK : OCFS_DLM_EXCLUSIVE_LOCK;
+	status = ocfs_acquire_lock (osb, lockId, locktype, lockFlags, &pLockResource, 
+				    &bh, inode);
 	if (status < 0) {
 		if (status != -EINTR)
 			LOG_ERROR_STATUS (status);
@@ -534,14 +534,14 @@
 
 leave:
 	lockFlags |= FLAG_FILE_UPDATE_OIN;
+	locktype = bCacheLock ? OCFS_DLM_ENABLE_CACHE_LOCK : OCFS_DLM_EXCLUSIVE_LOCK;
 
 	if (handle) {
 		if (status < 0) {
 			ocfs_abort_trans(handle);
 		} else {
-			ocfs_journal_add_lock(handle, lockId, 
-					      OCFS_DLM_EXCLUSIVE_LOCK, 
-					      lockFlags, pLockResource, bh);
+			ocfs_journal_add_lock(handle, lockId, locktype, lockFlags, 
+					      pLockResource, bh);
 			bAcquiredLock = false;
 			status = ocfs_commit_trans(handle);
 			if (status < 0)
@@ -549,7 +549,7 @@
 		}
 	}
 	if (bAcquiredLock) {
-		tmpstat = ocfs_release_lock (osb, lockId, OCFS_DLM_EXCLUSIVE_LOCK,
+		tmpstat = ocfs_release_lock (osb, lockId, locktype,
 					     lockFlags, pLockResource, bh, inode);
 		if (tmpstat < 0)
 			LOG_ERROR_STATUS (tmpstat);
@@ -729,6 +729,10 @@
 #endif
 
 	ocfs_put_lockres (lockres);
+	
+	if (ret < 0)
+		ocfs_bh_sem_hash_cleanup_pid(ocfs_getpid());
+
 	LOG_EXIT_LONG (ret);
 	return ret;
 }				/* ocfs_file_write */
@@ -802,7 +806,7 @@
 	int status = 0, tmpstat;
 	ocfs_file_entry *fe = NULL;
 	__u64 lockId = 0;
-	__u32 lockFlags = 0;
+	__u32 lockFlags = 0, locktype = 0;
 	bool bFileLockAcquired = false;
 	bool bAcquiredLock = false;
 	ocfs_lock_res *pLockResource = NULL;
@@ -861,9 +865,9 @@
 	}
 	OCFS_BH_PUT_DATA(bh);
 
-	status = ocfs_acquire_lock (osb, lockId,
-			bCacheLock ? OCFS_DLM_ENABLE_CACHE_LOCK : OCFS_DLM_EXCLUSIVE_LOCK,
-			lockFlags, &pLockResource, &bh, inode);
+	locktype = bCacheLock ? OCFS_DLM_ENABLE_CACHE_LOCK : OCFS_DLM_EXCLUSIVE_LOCK;
+	status = ocfs_acquire_lock (osb, lockId, locktype, lockFlags, &pLockResource, 
+				    &bh, inode);
 	if (status < 0) {
 		if (status != -EINTR)
 			LOG_ERROR_STATUS (status);
@@ -983,7 +987,8 @@
 		if (bFileLockAcquired)
 			lockFlags |= FLAG_FILE_UPDATE_OIN;
 
-		tmpstat = ocfs_release_lock (osb, lockId, OCFS_DLM_EXCLUSIVE_LOCK,
+		locktype = bCacheLock ? OCFS_DLM_ENABLE_CACHE_LOCK : OCFS_DLM_EXCLUSIVE_LOCK;
+		tmpstat = ocfs_release_lock (osb, lockId, locktype,
 					     lockFlags, pLockResource, bh, inode);
 		if (tmpstat < 0)
 			LOG_ERROR_STATUS (tmpstat);
@@ -1017,7 +1022,7 @@
 	__u64 bitmapOffset = 0;
 	__u64 numClustersAlloc = 0;
 	__u64 lockId = 0;
-	__u32 lockFlags = 0;
+	__u32 lockFlags = 0, locktype = 0;
 	bool bFileLockAcquired = false;
 	bool bAcquiredLock = false;
 	ocfs_lock_res *pLockResource = NULL;
@@ -1085,11 +1090,10 @@
 		OCFS_BH_PUT_DATA(bh);
 		brelse(bh);
 		bh = NULL;
-		
-		status = ocfs_acquire_lock (osb, lockId, bCacheLock ? 
-					    OCFS_DLM_ENABLE_CACHE_LOCK : 
-					    OCFS_DLM_EXCLUSIVE_LOCK, lockFlags,
-					    &pLockResource, &bh, inode);
+	
+		locktype = bCacheLock ? OCFS_DLM_ENABLE_CACHE_LOCK : OCFS_DLM_EXCLUSIVE_LOCK;	
+		status = ocfs_acquire_lock (osb, lockId, locktype, lockFlags, &pLockResource, 
+					    &bh, inode);
 		if (status < 0) {
 			if (status != -EINTR)
 				LOG_ERROR_STATUS (status);
@@ -1228,8 +1232,7 @@
 				if (bFileLockAcquired)
 					lockFlags |= FLAG_FILE_UPDATE_OIN;
 
-				ocfs_journal_add_lock(handle, lockId, 
-						      OCFS_DLM_EXCLUSIVE_LOCK, 
+				ocfs_journal_add_lock(handle, lockId, locktype, 
 						      lockFlags, pLockResource,
 						      bh);
 				bAcquiredLock = false;
@@ -1244,6 +1247,7 @@
 		if (bFileLockAcquired)
 			lockFlags |= FLAG_FILE_UPDATE_OIN;
 
+		locktype = bCacheLock ? OCFS_DLM_ENABLE_CACHE_LOCK : OCFS_DLM_EXCLUSIVE_LOCK;	
 		tmpstat = ocfs_release_lock (osb, lockId, OCFS_DLM_EXCLUSIVE_LOCK,
 					     lockFlags, pLockResource, bh, inode);
 		if (tmpstat < 0)
@@ -1391,6 +1395,9 @@
 bail:
 	atomic_dec (&parentInode->i_count);
 bail2:
+	if (error < 0)
+		ocfs_bh_sem_hash_cleanup_pid(ocfs_getpid());
+
 	LOG_EXIT_LONG (error);
 	return error;
 }				/* ocfs_setattr */

Modified: trunk/src/hash.c
===================================================================
--- trunk/src/hash.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/hash.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -32,7 +32,9 @@
 #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
 
 struct _ocfs_inode_num;
 
@@ -998,13 +1000,18 @@
 	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;
 
-	LOG_ENTRY();
+	LOG_ENTRY_ARGS("(pid = %d)\n", pid);
 
 	bucket = 0;
 again:
@@ -1019,18 +1026,15 @@
 		    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);
 
-			ocfs_bh_sem_down(sem);
-			sem->s_pid = 0;
-			clear_buffer_modified(sem->s_bh);
-			ocfs_bh_sem_up(sem);
-
-			/* remove ref from ocfs_bh_sem_lock_modify */
+			LOG_ERROR_ARGS("blocknr = %lu, pid = %d\n", 
+				       sem->s_bh->b_blocknr, pid);
+			ocfs_clear_buffer_modified(sem->s_bh);
 			ocfs_bh_sem_put(sem);
-
 			goto again;
 		}
 	}
@@ -1045,7 +1049,7 @@
 
 	LOG_EXIT_ULONG(found);
 	return found;
-}
+} /* ocfs_bh_sem_hash_cleanup_pid() */
 
 /* returns number of missed entries */
 int ocfs_bh_sem_hash_prune_all()
@@ -1134,7 +1138,7 @@
 	if (buffer_modified(bh)) {
 		sem = ocfs_bh_sem_lookup(bh);
 		if (ocfs_bh_sem_lock_modify(bh) != OCFS_BH_SEM_GOT_LOCK) {
-			printk("ocfs: sem->s_pid=%d, my pid=%d\n", sem->s_pid, current->pid);
+			printk("ocfs2: sem->s_pid=%d, my pid=%d\n", sem->s_pid, current->pid);
 			BUG();
 		}
 		clear_buffer_modified(bh);
@@ -1384,11 +1388,19 @@
 	inum = __ocfs_inode_hash_lookup(h, offset);
 
 	/* whoa, offset better be the same! */
-	if (inum && (inum->i_off != offset))
+	if (inum && (inum->i_off != offset)) {
+		LOG_ERROR_ARGS("inum=%p, i_off=%u.%u, offset=%u.%u)\n",
+			       inum, inum ? inum->i_off : 0ULL,
+			       offset);
 		BUG();
+	}
 
-	if (inum && (inum->i_fe_off != fe_off))
+	if (inum && (inum->i_fe_off != fe_off)) {
+		LOG_ERROR_ARGS("inum=%p, i_fe_off=%u.%u, fe_off=%u.%u)\n",
+			       inum, inum ? inum->i_fe_off : 0ULL,
+			       fe_off);
 		BUG();
+	}
 
 	/* (second pass) we didn't find anything, insert new one. */
 	if (inum == NULL && new_inum) {
@@ -1447,7 +1459,6 @@
 	if (inum == NULL) {
 		printk("Cannot remove a nonexistent inum from hash! (%u.%u)\n",
 		       HILO(off));
-
 		BUG();
 	}
 
@@ -1664,6 +1675,7 @@
 	/* call iget4, return inode */
 	args.offset = offset;
 	args.fe_bh = fe_bh;
+	args.file_lookup_only = false;
 	inode = iget4(sb, inum->i_ino, (find_inode_t) ocfs_find_inode, &args);
 	if (!inode || is_bad_inode (inode)) {
 		LOG_ERROR_STATUS(-EINVAL);

Modified: trunk/src/heartbeat.c
===================================================================
--- trunk/src/heartbeat.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/heartbeat.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -149,7 +149,7 @@
 			node_map->scan_rate[i] = publish->hbm[i];
 			node_map->scan_time[i] = curr_time;
 			if (publish->mounted && i != osb->node_num) {
-				printk("ocfs: Adding %s (node %d) to "
+				printk("ocfs2: Adding %s (node %d) to "
 				       "clustered device (%u,%u)\n",
 				       osb->node_cfg_info[i]->node_name, i,
 				       MAJOR(osb->sb->s_dev), 
@@ -188,7 +188,7 @@
 					(node_map->miss_cnt[i])++;
 				if (node_map->miss_cnt[i] > MISS_COUNT_VALUE) {
 #if !defined(USERSPACE_TOOL)
-					printk ("ocfs: Removing %s (node %d) "
+					printk ("ocfs2: Removing %s (node %d) "
 						"from clustered device (%u,%u)\n",
 						osb->node_cfg_info[i]->node_name, i,
 						MAJOR(osb->sb->s_dev),
@@ -206,7 +206,7 @@
 		} else {
 #if !defined(USERSPACE_TOOL)
 			if (!IS_NODE_ALIVE(osb->publ_map, i, num_nodes) && osb->node_num != i)
-				printk ("ocfs: Adding %s (node %d) to clustered device (%u,%u)\n",
+				printk ("ocfs2: Adding %s (node %d) to clustered device (%u,%u)\n",
 					osb->node_cfg_info[i]->node_name, i,
 					MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
 #endif

Copied: trunk/src/inc/io.h (from rev 15, trunk/src/inc/ocfsio.h)
===================================================================
--- trunk/src/inc/ocfsio.h	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/inc/io.h	2004-01-27 18:24:19 UTC (rev 16)
@@ -0,0 +1,285 @@
+#ifndef OCFSIO_H
+#define OCFSIO_H
+
+#include <linux/fs.h>
+#include <linux/compiler.h>
+#include <proto.h>
+
+/* Yosh made me do it. */
+static inline int ocfs_write_bh  (ocfs_super          *osb, 
+				  struct buffer_head  *bh, 
+				  int                  flags, 
+				  struct inode        *inode);
+static inline int ocfs_read_bh   (ocfs_super          *osb, 
+				  __u64                off, 
+				  struct buffer_head **bh, 
+				  int                  flags, 
+				  struct inode        *inode);
+
+int ocfs_write_dirnode(ocfs_super * osb, struct buffer_head *bhs[],
+		      int flags, struct inode *hdr_inode);
+int ocfs_read_dirnode(ocfs_super * osb, __u64 off, struct buffer_head *bhs[],
+		      int flags, struct inode *hdr_inode);
+
+int ocfs_write_bhs (ocfs_super          *osb,
+		    struct buffer_head  *bh[], 
+		    int                  nr, 
+		    int                  flags, 
+		    struct inode        *inode);
+int ocfs_read_bhs  (ocfs_super          *osb, 
+		    __u64                off,
+		    __u64                len, 
+		    struct buffer_head  *bhs[], 
+		    int                  flags, 
+		    struct inode         *inode);
+
+void ocfs_end_buffer_io_sync     (struct buffer_head   *bh, 
+				  int                   uptodate);
+
+#define OCFS_BH_CACHED            1
+#define OCFS_BH_COND_CACHED       2
+#define OCFS_BH_CONCURRENT_WRITE  4     /* This should only be used by ocfs_worker */
+#define OCFS_BH_IGNORE_JBD        8     /* This should only be used by ocfs_checkpoint_handle! */
+#define OCFS_BH_CACHE_LOCK        16    /* For read only; better know what you are doing with this one! */
+
+
+#define OCFS_NONCACHED(osb,off)  ((off) < (osb)->vol_layout.data_start_off)
+
+#ifdef DEBUG_LOCK_BUFFER
+#define LOCK_BUFFER_STR(bh)						      \
+	if (buffer_locked(bh) && current->pid!=debug_exclude)		      \
+		printk("ocfs2: (%d) BUFFER LOCKED! blocknr=%u\n",	      \
+			current->pid, (bh)->b_blocknr)
+#else
+#define LOCK_BUFFER_STR(bh)         
+#endif
+
+#ifdef VERBOSE_DEBUG_LOCK_BUFFER
+#define VERBOSE_LOCK_BUFFER_STR(bh)					      \
+	if (current->pid!=debug_exclude)				      \
+		printk("ocfs2: (%d) locking buffer %u\n", current->pid,	      \
+			(bh)->b_blocknr)
+#define VERBOSE_UNLOCK_BUFFER_STR(bh)					      \
+	if (current->pid!=debug_exclude)				      \
+		printk("ocfs2: (%d) unlocking buffer %u\n", current->pid,     \
+		       (bh)->b_blocknr)
+#else 
+#define VERBOSE_LOCK_BUFFER_STR(bh) 
+#define VERBOSE_UNLOCK_BUFFER_STR(bh) 
+#endif
+
+
+#define BH_Modified 18
+#define buffer_modified(bh)		__buffer_state((bh),Modified)
+#define set_buffer_modified(bh)		set_bit(BH_Modified, &(bh)->b_state);
+#define clear_buffer_modified(bh)	clear_bit(BH_Modified, &(bh)->b_state);
+
+
+static inline void * OCFS_BH_GET_DATA_READ(struct buffer_head *bh)
+{
+	unsigned char *kaddr;
+
+	LOCK_BUFFER_STR(bh);
+	VERBOSE_LOCK_BUFFER_STR(bh);
+	while (1) {
+		if (ocfs_bh_sem_lock(bh)==OCFS_BH_SEM_WAIT_ON_MODIFY) {
+			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(struct buffer_head *bh)
+{
+	unsigned char *kaddr;
+
+	LOCK_BUFFER_STR(bh);
+	VERBOSE_LOCK_BUFFER_STR(bh);
+	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
+			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_PUT_DATA(struct buffer_head *bh)
+{
+	kunmap((bh)->b_page);
+	VERBOSE_UNLOCK_BUFFER_STR(bh);
+	ocfs_bh_sem_unlock(bh);
+}
+
+
+#define STATE_BIT_MAX           (1 << 12)
+#define STATE_BIT_MAX_MASK      ((1 << 12)-1)
+#define STATE_BIT_MASK		((~0UL)<<19)
+
+
+static inline void CLEAR_BH_SEQNUM(struct buffer_head *bh)
+{
+	unsigned int prev = bh->b_state & STATE_BIT_MASK;
+	bh->b_state &= ~prev;
+}
+
+static inline void SET_BH_SEQNUM(struct inode *inode, struct buffer_head *bh)
+{
+	unsigned int seq = (atomic_read(GET_INODE_CLEAN_SEQ(inode)) & 
+			    STATE_BIT_MAX_MASK) << 19;
+
+	CLEAR_BH_SEQNUM(bh);
+	bh->b_state |= seq;
+}
+
+static inline int TEST_BH_SEQNUM(struct inode *inode, struct buffer_head *bh)
+{
+	int ret;
+	unsigned int seq = (bh->b_state & STATE_BIT_MASK) >> 19;
+
+	ret = (seq == atomic_read(GET_INODE_CLEAN_SEQ(inode)));
+	return ret;
+}
+
+static inline int check_block_zero_write(struct buffer_head *bh)
+{
+	if (unlikely(bh->b_blocknr == 0)) {
+		ocfs_vol_disk_hdr *hdr = 
+			(ocfs_vol_disk_hdr *) OCFS_BH_GET_DATA_READ(bh);
+		if (hdr == NULL) {
+			printk ("ocfs2: failed to map bh page!!!\n");
+			return -EIO;
+		}
+		printk ("ocfs: Blocknum is zero!!!\n");
+		if (memcmp(hdr->signature, 
+			   OCFS_VOLUME_SIGNATURE, 
+			   strlen(OCFS_VOLUME_SIGNATURE)) != 0) {
+			printk("ocfs2: WARNING! attempting to write non "
+			       "volume header to block 0\n");
+			OCFS_BH_PUT_DATA(bh);
+			return -EIO;
+		}
+		OCFS_BH_PUT_DATA(bh);
+	}
+	return 0;
+}
+
+#define OCFS_PRINT_FE_SIZE(bh)						      \
+do {									      \
+	if (bh) {							      \
+		ocfs_file_entry *__fe = (ocfs_file_entry *) bh->b_data;	      \
+		if (IS_VALID_FILE_ENTRY(__fe)) {			      \
+			printk("ocfs2: %s:%d fe_check: file_size = (%u.%u), " \
+				"this_sector = (%u.%u)\n",		      \
+				__FUNCTION__, __LINE__, 		      \
+				HILO(__fe->file_size),			      \
+				HILO(__fe->this_sector));		      \
+		}							      \
+	}								      \
+} while(0)
+
+#define OCFS_DO_HEX_DUMP(bh)						      \
+do {									      \
+	printk("bh->b_data:\n");					      \
+	for(i = 0; i < 512; i++) {					      \
+		printk("%03x ", bh->b_data[i]);				      \
+		if ( ((i+1) % 16) == 0 )				      \
+		printk("\n");						      \
+	}								      \
+	printk("\n");							      \
+} while (0)
+
+/* we should take this out later */
+static inline int check_rootdir_overwrite(struct buffer_head *bh)
+{
+	int i;
+
+	if (bh->b_blocknr >= 4720 && bh->b_blocknr < (4720+256)) {
+		ocfs_dir_node *dir = (ocfs_dir_node *)bh->b_data;
+		ocfs_file_entry *fe = (ocfs_file_entry *)bh->b_data;
+		
+		if (strncmp("DIRNV20", dir->signature, strlen("DIRNV20"))==0) {
+			if (dir->node_disk_off >> 9 != 4720) {
+				OCFS_DO_HEX_DUMP(bh);
+				printk("uh oh!  dirnode disk off is incorrect!  %u\n",(__u32)(dir->node_disk_off>>9));
+				BUG();
+			} else if (bh->b_blocknr != 4720) {
+				OCFS_DO_HEX_DUMP(bh);
+				printk("uh oh!  dirnode is being written at blocknr=%u!\n", bh->b_blocknr);
+				BUG();
+			}
+		} else if (strncmp("FIL", fe->signature, strlen("FIL"))==0) {
+			if (fe->this_sector >> 9 != bh->b_blocknr) {
+				OCFS_DO_HEX_DUMP(bh);
+				printk("uh oh!  fe->this_sector (%u) != blocknr (%u)\n",
+				       (__u32)(fe->this_sector>>9), bh->b_blocknr);
+				BUG();
+			} else if (fe->extents[0].disk_off >> 9 == 4720) {
+				OCFS_DO_HEX_DUMP(bh);
+				printk("uh oh!  fe->extents[0].disk_off recurses!!!\n");
+				BUG();
+			}
+		} else if (bh->b_blocknr == 4720) {
+			OCFS_DO_HEX_DUMP(bh);
+			printk("uh oh!  invalid type being written to dirnode!\n");
+			printk("signature: '%c%c%c%c%c%c%c'\n", 
+			       dir->signature[0], dir->signature[1], dir->signature[2],
+			       dir->signature[3], dir->signature[4], dir->signature[5], dir->signature[6]);
+			printk("fooblydoo flippity floppety floo. supercalafragilicousexpialdizzle\n");
+			BUG();
+		}
+	}
+	return 0;
+}
+
+static inline int ocfs_write_bh (ocfs_super * osb, struct buffer_head *bh, 
+				 int flags, struct inode *inode)
+{
+	int status;
+	
+	IO_FUNC_TIMING_DECL
+
+	status = ocfs_write_bhs (osb, &bh, 1, flags, inode);
+
+	IO_FUNC_TIMING_PRINT("ocfs_write_bh", status);
+
+	return status;
+}
+
+static inline int ocfs_read_bh (ocfs_super * osb, __u64 off, 
+				struct buffer_head **bh, int flags, 
+				struct inode *inode)
+{
+	int status = 0;
+
+	IO_FUNC_TIMING_DECL
+
+	if (bh == NULL) {
+		printk("ocfs2: bh == NULL\n");
+		status = -EINVAL;
+		goto bail;
+	}
+	
+	status = ocfs_read_bhs(osb, off, 512, bh, flags, inode);
+
+bail:
+	IO_FUNC_TIMING_PRINT("ocfs_read_bh", status);
+
+	return status;
+}
+
+#endif /* OCFSIO_H */

Modified: trunk/src/inc/ocfs.h
===================================================================
--- trunk/src/inc/ocfs.h	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/inc/ocfs.h	2004-01-27 18:24:19 UTC (rev 16)
@@ -213,6 +213,7 @@
 	__u64            offset;
 //	struct list_head i_clean_buffers;
 	atomic_t         i_clean_buffer_seq;
+	__u8             deleted; /* this can be a generic flags field later */
 } ocfs_inode_private;
 
 #define CLEAN_SEQ_OFF    	((unsigned long)(&((ocfs_inode_private *)0)->i_clean_buffer_seq))
@@ -223,6 +224,10 @@
 
 #define inode_data_is_oin(i)      (OCFS_GENERIC_IP(i)->generic_ip != NULL)
 
+#define INODE_DELETED(i) (OCFS_GENERIC_IP(i)->deleted)
+#define SET_INODE_DELETED(i) OCFS_GENERIC_IP(i)->deleted = 1
+#define CLEAR_INODE_DELETED(i) OCFS_GENERIC_IP(i)->deleted = 0
+
 #define SET_INODE_OFFSET(i,o)						      \
 do {									      \
 	OCFS_GENERIC_IP(i)->offset = o;					      \
@@ -1474,7 +1479,7 @@
 #define MAX_CLUSTER_NAME_LEN		64
 
 
-#define OCFS_IPC_DEFAULT_PORT   7000
+#define OCFS_IPC_DEFAULT_PORT   7001
 
 		
 #define OCFS_IPC_DLM_VERSION    0x0201
@@ -2448,8 +2453,8 @@
 typedef struct _ocfs_find_inode_args
 {
 	__u64 offset;
-//	ocfs_file_entry *entry;
 	struct buffer_head *fe_bh;
+	bool file_lookup_only;
 }
 ocfs_find_inode_args;
 /* timeout structure taken from Ben's aio.c */

Deleted: trunk/src/inc/ocfsio.h
===================================================================
--- trunk/src/inc/ocfsio.h	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/inc/ocfsio.h	2004-01-27 18:24:19 UTC (rev 16)
@@ -1,421 +0,0 @@
-#ifndef OCFSIO_H
-#define OCFSIO_H
-
-#include <linux/fs.h>
-#include <linux/compiler.h>
-
-static inline int ocfs_write_bh (ocfs_super * osb, struct buffer_head *bh, int flags, struct inode *inode);
-static inline int ocfs_write_bhs (ocfs_super * osb, struct buffer_head *bh[], int nr, int flags, struct inode *inode);
-static inline int ocfs_read_bh (ocfs_super * osb, __u64 off, struct buffer_head **bh, int flags, struct inode *inode);
-static inline int ocfs_read_bhs (ocfs_super * osb, __u64 off, __u64 len, struct buffer_head *bhs[], int flags, struct inode *inode);
-
-#define OCFS_BH_CACHED        1
-#define OCFS_BH_COND_CACHED   4
-/* This should only be used by ocfs_checkpoint_handle! */
-#define OCFS_BH_IGNORE_JBD    8
-
-#define OCFS_NONCACHED(osb,off)  ((off) < (osb)->vol_layout.data_start_off)
-
-#ifdef DEBUG_LOCK_BUFFER
-#define LOCK_BUFFER_STR(bh)		if (buffer_locked(bh))   \
-						printk("ocfs: (%d) BUFFER LOCKED! blocknr=%u\n", \
-						       current->pid, (bh)->b_blocknr)
-#else
-#define LOCK_BUFFER_STR(bh)         
-#endif
-
-#ifdef VERBOSE_DEBUG_LOCK_BUFFER
-#define VERBOSE_LOCK_BUFFER_STR(bh)	printk("ocfs: (%d) locking buffer %u\n", \
-					       current->pid, (bh)->b_blocknr)
-#define VERBOSE_UNLOCK_BUFFER_STR(bh)	printk("ocfs: (%d) unlocking buffer %u\n", \
-					       current->pid, (bh)->b_blocknr)
-#else 
-#define VERBOSE_LOCK_BUFFER_STR(bh) 
-#define VERBOSE_UNLOCK_BUFFER_STR(bh) 
-#endif
-
-
-#define OCFS_BH_GET_DATA(bh)  	({ \
-				 	char *kaddr; \
-					LOCK_BUFFER_STR(bh); \
-					VERBOSE_LOCK_BUFFER_STR(bh); \
-					lock_buffer(bh); \
-					kaddr = kmap((bh)->b_page); \
-					if (kaddr) \
-						kaddr += ((unsigned long)(bh)->b_data & ~PAGE_MASK); \
-					else \
-						unlock_buffer(bh); \
-					kaddr; \
-				 })
-
-#define OCFS_BH_PUT_DATA(bh)	({ \
-				 	kunmap((bh)->b_page); \
-					VERBOSE_UNLOCK_BUFFER_STR(bh); \
-					unlock_buffer(bh); \
- 				 })
-
-#define STATE_BIT_MAX           (1 << 13)
-#define STATE_BIT_MAX_MASK      ((1 << 13)-1)
-#define STATE_BIT_MASK		((~0UL)<<19)
-
-
-static inline void SET_BH_SEQNUM(struct inode *inode, struct buffer_head *bh)
-{
-	unsigned int prev = bh->b_state & STATE_BIT_MASK;
-	unsigned int seq = (atomic_read(GET_INODE_CLEAN_SEQ(inode)) & STATE_BIT_MAX_MASK) << 19;
-	bh->b_state &= ~prev;
-	bh->b_state |= seq;
-}
-
-static inline int TEST_BH_SEQNUM(struct inode *inode, struct buffer_head *bh)
-{
-	int ret;
-	unsigned int seq = (bh->b_state & STATE_BIT_MASK) >> 19;
-	ret = (seq == atomic_read(GET_INODE_CLEAN_SEQ(inode)));
-	return ret;
-}
-	
-static inline int check_block_zero_write(struct buffer_head *bh)
-{
-	if (unlikely(bh->b_blocknr == 0)) {
-		ocfs_vol_disk_hdr *hdr = (ocfs_vol_disk_hdr *)OCFS_BH_GET_DATA(bh);
-		if (hdr == NULL) {
-			printk ("ocfs: failed to map bh page!!!\n");
-			return -EIO;
-		}	
-		printk ("ocfs: Blocknum is zero!!!\n");
-		if (memcmp(hdr->signature, OCFS_VOLUME_SIGNATURE, strlen(OCFS_VOLUME_SIGNATURE)) != 0) {
-			printk("ocfs: WARNING! attempting to write non volume header to block 0\n");
-			OCFS_BH_PUT_DATA(bh);
-			return -EIO;
-		}
-		OCFS_BH_PUT_DATA(bh);
-	}
-	return 0;
-}
-
-
-static inline int ocfs_write_bh (ocfs_super * osb, struct buffer_head *bh, int flags, struct inode *inode)
-{
-	int ret;
-	
-	IO_FUNC_TIMING_DECL
-
-	ret = ocfs_write_bhs (osb, &bh, 1, flags, inode);
-
-	IO_FUNC_TIMING_PRINT("ocfs_write_bh", ret)
-
-	return ret;
-}
-
-static inline int ocfs_write_bhs (ocfs_super * osb, struct buffer_head *bhs[], int nr, int flags, struct inode *inode)
-{
-	int status = 0;
-	int i;
-	struct super_block *sb;
-	ocfs_blockdev dev;
-	struct buffer_head *bh;
-	int jbd_managed_buffers = 0;
-
-	IO_FUNC_TIMING_DECL
-
-	if (osb == NULL || osb->sb == NULL || bhs == NULL) {
-		printk("ocfs: osb == NULL || osb->sb == NULL || bhs == NULL\n");
-		status = -EINVAL;
-		goto bail;
-	}
-
-	if (nr > 256)
-		printk ("ocfs: Getting write for %d blocks\n", nr);
-
-	sb = osb->sb;
-	dev = OCFS_GET_BLOCKDEV(sb);
-
-	if (OCFS_NONCACHED(osb, bhs[0]->b_blocknr << 9)) {
-		if (flags & OCFS_BH_CACHED)
-			printk("ocfs: hey bozo you are trying to write a system thingy cached!\n");
-		flags &= ~OCFS_BH_CACHED;
-	}
-
-	if (nr > 1 && flags & OCFS_BH_CACHED) {
-		printk("ocfs: hey bozo you are trying to write multiple blocks cached!\n");
-		flags &= ~OCFS_BH_CACHED;
-	}
-
-	for (i = 0 ; i < nr ; i++) {
-		bh = bhs[i];
-		if (bh == NULL) {
-			printk("ocfs: bh == NULL\n");
-			status = -EIO;
-			goto bail;
-		}
-
-		if (check_block_zero_write(bh) < 0)
-			goto bail;
-
-		if (!(flags & OCFS_BH_IGNORE_JBD) && buffer_jbd(bh)) {
-#ifdef VERBOSE_BH_JBD_TRACE
-			printk("ocfs: trying to write a jbd managed bh "
-			       "(blocknr = %u), nr=%d\n", bh->b_blocknr, nr);
-#endif
-			/* they should not have dirty bit set... */
-			jbd_managed_buffers++;
-			continue;
-		}
-
-		LOCK_BUFFER_STR(bh);
-		VERBOSE_LOCK_BUFFER_STR(bh);
-		lock_buffer(bh);
-#ifdef LINUX_2_5
-		set_buffer_uptodate(bh);
-#else
-		mark_buffer_uptodate(bh, true);
-#endif
-		mark_buffer_dirty(bh);
-		if (flags & OCFS_BH_CACHED && inode && !TEST_BH_SEQNUM(inode,bh)) {
-#ifdef VERBOSE_BH_SEQNUM_TRACE
-			printk("(write) bh (%u) seqnum (%u) does not match inode (%u)\n",
-			       bh->b_blocknr, (bh->b_state & STATE_BIT_MASK) >> 19,
-			       atomic_read(GET_INODE_CLEAN_SEQ(inode)));
-#endif
-			flags &= ~OCFS_BH_CACHED;
-		}
-		unlock_buffer(bh);
-		VERBOSE_UNLOCK_BUFFER_STR(bh);
-	}
-
-	/* if *every* buffer submitted is already jbd managed, fully cached */
-	if (jbd_managed_buffers == nr)
-		flags |= OCFS_BH_CACHED;
-
-	if (!(flags & OCFS_BH_CACHED))
-		ll_rw_block (WRITE, nr, bhs);
-
-	for (i = (nr-1) ; i >= 0; i--) {
-		bh = bhs[i];
-		if (!(flags & OCFS_BH_CACHED))
-			wait_on_buffer(bh);
-		if (inode)
-			SET_BH_SEQNUM(inode, bh);
-		//buffer_insert_inode_clean_queue(bh, inode);
-	}
-
-bail:
-
-	IO_FUNC_TIMING_PRINT("ocfs_write_bhs", status)
-
-	return status;
-}
-
-static inline int ocfs_read_bh (ocfs_super * osb, __u64 off, struct buffer_head **bh, int flags, struct inode *inode)
-{
-	int status = 0;
-	struct super_block *sb;
-	int nr;
-	__u64 blocknum;
-	ocfs_blockdev dev;
-
-	IO_FUNC_TIMING_DECL
-	
-	if (osb == NULL || osb->sb == NULL || bh == NULL) {
-		printk("ocfs: osb == NULL || osb->sb == NULL || bh == NULL\n");
-		status = -EINVAL;
-		goto error;
-	}
-
-	if ((flags & OCFS_BH_COND_CACHED) && 
-	    (off >= osb->vol_layout.bitmap_off))
-			flags |= OCFS_BH_CACHED;
-
-	if (OCFS_NONCACHED(osb, off)) {
-		if (flags & OCFS_BH_CACHED)
-			printk("ocfs: hey bozo you are trying to read a system thingy cached!\n");
-		flags &= ~OCFS_BH_CACHED;
-	}
-
-	sb = osb->sb;
-	dev = OCFS_GET_BLOCKDEV(sb);
-	nr = 1;
-	blocknum = off >> sb->s_blocksize_bits;
-
-	if (*bh == NULL) {
-		*bh = getblk (dev, blocknum, sb->s_blocksize);
-		if (*bh == NULL) {
-			printk("ocfs: *bh == NULL\n");
-			status = -EIO;
-			goto error;
-		}
-	}
-	else if ((*bh)->b_blocknr != blocknum)
-		printk("ocfs: Asking me to read blocknum = %u even though "
-		       "bh->blocknr == %u\n", blocknum, (*bh)->b_blocknr);
-
-	if (flags & OCFS_BH_CACHED && inode && !TEST_BH_SEQNUM(inode, *bh)) {
-#ifdef VERBOSE_BH_SEQNUM_TRACE
-		printk("(read) bh (%u) seqnum (%u) does not match inode (%u)\n",
-		       (*bh)->b_blocknr, ((*bh)->b_state & STATE_BIT_MASK) >> 19,
-		       atomic_read(GET_INODE_CLEAN_SEQ(inode)));
-#endif
-		flags &= ~OCFS_BH_CACHED;
-	}
-
-	if (!(flags & OCFS_BH_CACHED) && buffer_jbd(*bh)) {
-#ifdef VERBOSE_BH_JBD_TRACE
-		printk("ocfs: trying to sync read a jbd managed bh "
-		       "(blocknr = %u)\n", (*bh)->b_blocknr);
-#endif
-		goto error;
-	}
-
-	if (!(flags & OCFS_BH_CACHED)) {
-		LOCK_BUFFER_STR(*bh);
-		VERBOSE_LOCK_BUFFER_STR(*bh);
-		lock_buffer(*bh);
-		if (!buffer_dirty(*bh)) 
-#ifdef LINUX_2_5
-			clear_buffer_uptodate(*bh);
-#else
-			mark_buffer_uptodate(*bh, false);
-#endif
-		unlock_buffer(*bh);
-		VERBOSE_UNLOCK_BUFFER_STR(*bh);
-	}
-
-	status = 0;
-	ll_rw_block(READ, nr, bh);
-
-	wait_on_buffer(*bh);
-	if (inode)
-		SET_BH_SEQNUM(inode, *bh);
-	//buffer_insert_inode_clean_queue(*bh, inode);
-
-error:
-
-	IO_FUNC_TIMING_PRINT("ocfs_read_bh", status)
-
-	return status;
-
-}
-
-/*
- * ocfs_read_bhs()
- *
- */
-static inline int ocfs_read_bhs (ocfs_super * osb, __u64 off, __u64 len, struct buffer_head *bhs[], int flags, struct inode *inode)
-{
-	int status = 0;
-	struct super_block *sb;
-	int nr, i, ignore_cache;
-	__u64 blocknum;
-	ocfs_blockdev dev;
-	struct buffer_head *bh;
-
-	IO_FUNC_TIMING_DECL
-
-	if (len % 512) {
-		printk("ocfs: len %% 512 (len=%u)\n", len);
-		status = -EINVAL;
-		goto done;
-	}
-
-	if (osb == NULL || osb->sb == NULL || bhs == NULL) {
-		printk("ocfs: osb == NULL || osb->sb == NULL || bhs == NULL || num == NULL\n");
-		status = -EINVAL;
-		goto done;
-	}
-
-	if ((flags & OCFS_BH_COND_CACHED) && 
-	    (off >= osb->vol_layout.bitmap_off))
-			flags |= OCFS_BH_CACHED;
-
-	if (OCFS_NONCACHED(osb, off)) {
-		if (flags & OCFS_BH_CACHED)
-			printk("ocfs: hey bozo you are trying to write a system thingy cached!\n");
-		flags &= ~OCFS_BH_CACHED;
-	}
-
-	sb = osb->sb;
-	dev = OCFS_GET_BLOCKDEV(sb);
-	blocknum = off >> sb->s_blocksize_bits;
-
-	nr = (len + 511) >> 9;
-	if (nr == 0) {
-		printk("ocfs: No buffers will be read!!!\n");
-		printk("ocfs: Len=%u Off=%u.%u numbuffers=%u blocknum=%u.%u\n", len,
-		     HI (off), LO (off), nr, HI (blocknum), LO (blocknum));
-		status = 0;
-		goto done;
-	}
-
-	for (i = 0 ; i < nr ; i++) {
-		if (bhs[i] == NULL) {
-			bhs[i] = getblk (dev, blocknum++, sb->s_blocksize);
-			if (bhs[i] == NULL) {
-				printk("ocfs: bh == NULL\n");
-				status = -EIO;
-				goto done;
-			}
-		}
-		bh = bhs[i];
-
-		ignore_cache = 0;
-		
-		if (flags & OCFS_BH_CACHED && inode && !TEST_BH_SEQNUM(inode,bh)) {
-#ifdef VERBOSE_BH_SEQNUM_TRACE
-			printk("(read) bh (%u) seqnum (%u) does not match inode (%u)\n",
-			       bh->b_blocknr, (bh->b_state & STATE_BIT_MASK) >> 19,
-			       atomic_read(GET_INODE_CLEAN_SEQ(inode)));
-#endif
-			ignore_cache = 1;
-		}
-
-		if (!(flags & OCFS_BH_CACHED) || ignore_cache) {
-			if (buffer_jbd(bh)) {
-#ifdef VERBOSE_BH_JBD_TRACE
-				printk("ocfs: trying to sync read a jbd "
-				       "managed bh (blocknr = %u)\n", 
-				       bh->b_blocknr);
-#endif
-				if (!buffer_uptodate(bh)) {
-					printk("ocfs: jbd buffer is not "
-					       "uptodate!\n");
-					status = -EINVAL;
-					goto done;
-				}
-				continue;
-			}
-
-			LOCK_BUFFER_STR(bh);
-			VERBOSE_LOCK_BUFFER_STR(bh);
-			lock_buffer(bh);
-			if (!buffer_dirty(bh)) 
-#ifdef LINUX_2_5
-				clear_buffer_uptodate(bh);
-#else
-				mark_buffer_uptodate(bh, false);
-#endif
-			unlock_buffer(bh);
-			VERBOSE_UNLOCK_BUFFER_STR(bh);
-		}
-	}
-
-	status = 0;
-	ll_rw_block(READ, nr, bhs);
-
-	for (i = (nr-1); i >= 0; i--) {
-		bh = bhs[i];
-		wait_on_buffer(bh);
-		if (inode)
-			SET_BH_SEQNUM(inode, bh);
-		//buffer_insert_inode_clean_queue(bh, inode);
-        }
-
-done:
-
-	IO_FUNC_TIMING_PRINT("ocfs_read_bh", status)
-
-	return status;
-}
-
-
-#endif /* OCFSIO_H */

Modified: trunk/src/inc/proto.h
===================================================================
--- trunk/src/inc/proto.h	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/inc/proto.h	2004-01-27 18:24:19 UTC (rev 16)
@@ -195,7 +195,7 @@
 int ocfs_rename (struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry);
 int ocfs_symlink (struct inode *dir, struct dentry *dentry, const char *symname);
 
-int ocfs_find_files_on_disk (ocfs_super * osb, __u64 parent_off, struct qstr * file_name, struct buffer_head ** fe_bh, ocfs_file * ofile, struct inode *inode);
+int ocfs_find_files_on_disk (ocfs_super * osb, __u64 parent_off, struct qstr * file_name, struct buffer_head ** fe_bh, ocfs_file * ofile, struct inode *inode, bool take_lock);
 int ocfs_write_force_dir_node (ocfs_super * osb, struct buffer_head *bhs[], __s32 idx);
 int ocfs_insert_file (ocfs_super * osb, ocfs_file_entry * InsertEntry, struct buffer_head *lock_bh, struct buffer_head **insert_bh, ocfs_journal_handle * handle, struct inode *dir_inode, struct inode *file_inode);
 int ocfs_reindex_dir_node (ocfs_super * osb, __u64 DirNodeOffset, struct buffer_head *bhs[], ocfs_journal_handle *handle, struct inode *dir_inode);
@@ -216,7 +216,9 @@
 int ocfs_create_new_local_alloc(ocfs_super *osb, int node_num);
 int ocfs_load_local_alloc(ocfs_super *osb);
 void ocfs_shutdown_local_alloc(ocfs_super *osb, 
-			       struct buffer_head **local_alloc_bh, bool sync);
+			       struct buffer_head **local_alloc_bh, 
+			       bool sync,
+			       bool in_recovery);
 int ocfs_find_space(ocfs_super * osb, __u64 file_size, __u64 * cluster_off, __u64 * cluster_count, bool sysfile, ocfs_journal_handle *handle);
 int ocfs_recover_local_alloc(ocfs_super *osb, int node_num);
 

Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/inode.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -135,61 +135,66 @@
 		LOG_TRACE_STR ("error getting inode offset");
 		goto bail;
 	}
-	
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(args->fe_bh); /* read */
-	if (S_ISDIR (inode->i_mode)) {
-		LOG_TRACE_STR ("find_inode -> S_ISDIR");
-		if (fe->extents[0].disk_off != fileOff) {
+
+	if (args->file_lookup_only == false) {
+		fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(args->fe_bh); /* read */
+		if (S_ISDIR (inode->i_mode)) {
+			LOG_TRACE_STR ("find_inode -> S_ISDIR");
+			if (fe->extents[0].disk_off != fileOff) {
+				LOG_TRACE_ARGS
+			    	("DIR : inode number same but full offset does not match: %u.%u != %u.%u\n",
+			     	fe->extents[0].disk_off, fileOff);
+				goto bail;
+			}
+		} else if (args->offset != fileOff) {
 			LOG_TRACE_ARGS
-			    ("DIR : inode number same but full offset does not match: %u.%u != %u.%u\n",
-			     fe->extents[0].disk_off, fileOff);
+		    	("FILE : inode number same but full offset does not match: %u.%u != %u.%u\n",
+		     	args->offset, fileOff);
 			goto bail;
 		}
-	} else if (args->offset != fileOff) {
-		LOG_TRACE_ARGS
-		    ("FILE : inode number same but full offset does not match: %u.%u != %u.%u\n",
-		     args->offset, fileOff);
-		goto bail;
-	}
 	
 #ifdef REPOPULATE_INODE
-	/* not sure if this is appropriate, but we have the most 
-	 * current file entry so why not use it? */
-	mode = fe->prot_bits;
-
-	switch (fe->attribs) {
-	    case OCFS_ATTRIB_DIRECTORY:
-		    mode |= S_IFDIR;
-		    break;
-	    case OCFS_ATTRIB_CHAR:
-		    mode |= S_IFCHR;
-		    inode->i_rdev = MKDEV (fe->dev_major, fe->dev_minor);
-		    break;
-	    case OCFS_ATTRIB_BLOCK:
-		    mode |= S_IFBLK;
-		    inode->i_rdev = MKDEV (fe->dev_major, fe->dev_minor);
-		    break;
-	    case OCFS_ATTRIB_FIFO:
-		    mode |= S_IFIFO;
-		    break;
-	    case OCFS_ATTRIB_SYMLINK:
-		    mode |= S_IFLNK;
-		    break;
-	    case OCFS_ATTRIB_SOCKET:
-		    mode |= S_IFSOCK;
-		    break;
-	    case OCFS_ATTRIB_REG:
-	    default:
-		    mode |= S_IFREG;
-		    break;
+		/* not sure if this is appropriate, but we have the most 
+	 	* current file entry so why not use it? */
+		mode = fe->prot_bits;
+	
+		switch (fe->attribs) {
+	    	case OCFS_ATTRIB_DIRECTORY:
+		    	mode |= S_IFDIR;
+		    	break;
+	    	case OCFS_ATTRIB_CHAR:
+		    	mode |= S_IFCHR;
+		    	inode->i_rdev = MKDEV (fe->dev_major, fe->dev_minor);
+		    	break;
+	    	case OCFS_ATTRIB_BLOCK:
+		    	mode |= S_IFBLK;
+		    	inode->i_rdev = MKDEV (fe->dev_major, fe->dev_minor);
+		    	break;
+	    	case OCFS_ATTRIB_FIFO:
+		    	mode |= S_IFIFO;
+		    	break;
+	    	case OCFS_ATTRIB_SYMLINK:
+		    	mode |= S_IFLNK;
+		    	break;
+	    	case OCFS_ATTRIB_SOCKET:
+		    	mode |= S_IFSOCK;
+		    	break;
+	    	case OCFS_ATTRIB_REG:
+	    	default:
+		    	mode |= S_IFREG;
+		    	break;
+		}
+		oin = NULL;		/* set it back to our current OIN if we have one */
+		if (inode_data_is_oin (inode))
+			oin = GET_INODE_OIN(inode);
+	
+		ocfs_populate_inode (inode, fe, mode, oin, false);
+#endif /* REPOPULATE_INODE */
+	} else {
+		if (args->offset != fileOff)
+			goto bail;
 	}
-	oin = NULL;		/* set it back to our current OIN if we have one */
-	if (inode_data_is_oin (inode))
-		oin = GET_INODE_OIN(inode);
 
-	ocfs_populate_inode (inode, fe, mode, oin, false);
-#endif /* REPOPULATE_INODE */
-
 	ret = 1;
 bail:
 	if (fe)
@@ -514,20 +519,25 @@
 		goto bail;
 	}
 
-	if (S_ISDIR (inode->i_mode)) {
-		LOG_TRACE_STR ("find_actor -> S_ISDIR\n");
-		fe = OCFS_BH_GET_DATA_READ(args->fe_bh); /* read */
-		if (fe->extents[0].disk_off != fileOff) {
+	if (args->file_lookup_only == false) {
+		if (S_ISDIR (inode->i_mode)) {
+			LOG_TRACE_STR ("find_actor -> S_ISDIR\n");
+			fe = OCFS_BH_GET_DATA_READ(args->fe_bh); /* read */
+			if (fe->extents[0].disk_off != fileOff) {
+				LOG_TRACE_ARGS
+			    	("DIR : inode number same but full offset does not match: %u.%u != %u.%u\n",
+			     	fe->extents[0].disk_off, fileOff);
+				goto bail;
+			}
+		} else if (args->offset != fileOff) {
 			LOG_TRACE_ARGS
-			    ("DIR : inode number same but full offset does not match: %u.%u != %u.%u\n",
-			     fe->extents[0].disk_off, fileOff);
+		    	("FILE : inode number same but full offset does not match: %u.%u != %u.%u\n",
+		     	args->offset, fileOff);
 			goto bail;
 		}
-	} else if (args->offset != fileOff) {
-		LOG_TRACE_ARGS
-		    ("FILE : inode number same but full offset does not match: %u.%u != %u.%u\n",
-		     args->offset, fileOff);
-		goto bail;
+	} else {
+		if (args->offset != fileOff)
+			goto bail;
 	}
 
 	ret = 1;
@@ -649,69 +659,72 @@
  */
 void ocfs_clear_inode (struct inode *inode)
 {
-	__u64 offset;
+	__u64 offset = 0;
 	ocfs_super *osb;
+	ocfs_lock_res *lockres = NULL;
+	ocfs_inode *oin;
 
 	LOG_ENTRY();
 
-	if (inode) {
-		ocfs_linux_get_inode_offset(inode, &offset, NULL);
+	if (!inode)
+		goto bail;
 
-		if (inode_data_is_oin (inode)) {
-			ocfs_inode *oin;
+	osb = (ocfs_super *) OCFS_GENERIC_SB_P(inode->i_sb);
 
-			LOG_TRACE_STR ("inode with oin : clear inode");
+	if (!ocfs_linux_get_inode_offset(inode, &offset, NULL)) {
+		LOG_ERROR_ARGS("Could not find offset for inode %lu\n", 
+			       inode->i_ino);
+		goto bail;
+	}
 
-			oin = GET_INODE_OIN(inode);
-			osb = (ocfs_super *) oin->osb;
-			if (oin == osb->oin_root_dir) {
-				LOG_TRACE_STR
-				    ("this is the root inode, doing cleanup now!");
-				ocfs_sync_blockdev(inode->i_sb);
-				LOG_TRACE_STR ("syncing past root inode");
-				LOG_TRACE_STR ("calling dismount");
-				ocfs_dismount_volume (inode->i_sb);
-				goto bail;
-			}
+	if (inode_data_is_oin (inode)) {
+		LOG_TRACE_STR ("inode with oin : clear inode");
 
-			ocfs_extent_map_destroy (&oin->map);
-			ocfs_extent_map_init (&oin->map);
+		oin = GET_INODE_OIN(inode);
+		if (oin == osb->oin_root_dir) {
+			LOG_TRACE_STR("this is the root inode, doing "
+				      "cleanup now!");
+			ocfs_sync_blockdev(inode->i_sb);
+			LOG_TRACE_STR ("syncing past root inode");
+			LOG_TRACE_STR ("calling dismount");
+			ocfs_dismount_volume (inode->i_sb);
+			goto bail;
+		}
 
-			ocfs_release_cached_oin (osb, oin);
-			ocfs_release_oin (oin, true);
-			oin = NULL;
-			LOG_TRACE_STR ("yeah! done with deallocs!");
-		} else {
-			__u64 fileOff;
-			ocfs_lock_res *lockres = NULL;
+		ocfs_extent_map_destroy (&oin->map);
+		ocfs_extent_map_init (&oin->map);
 
-			osb = (ocfs_super *) OCFS_GENERIC_SB_P(inode->i_sb);
-
-			if (ocfs_linux_get_inode_offset (inode, &fileOff, NULL)) {
-				if (!ocfs_lookup_sector_node (osb, fileOff, &lockres)) {
-					if (lockres) {
-						if (lockres->oin) {
-							ocfs_put_lockres (lockres->oin->lock_res);
-							lockres->oin->lock_res = NULL;
-							lockres->oin = NULL;
-						}
-						ocfs_remove_sector_node (osb, lockres);
-						ocfs_put_lockres(lockres);
-					} else
-						LOG_TRACE_STR ("lockres in hash is null");
-				} else {
-					LOG_TRACE_STR
-					    ("hashtable has already been destroyed.  skipping.");
+		ocfs_release_cached_oin (osb, oin);
+		ocfs_release_oin (oin, true);
+		oin = NULL;
+		LOG_TRACE_STR ("yeah! done with deallocs!");
+	} else {
+		if (!ocfs_lookup_sector_node (osb, offset, &lockres)) {
+			if (lockres) {
+				if (lockres->oin) {
+					ocfs_put_lockres (lockres->oin->lock_res);
+					lockres->oin->lock_res = NULL;
+					lockres->oin = NULL;
 				}
-			} else {
-				LOG_TRACE_STR ("Could not find offset");
-			}
+				ocfs_remove_sector_node (osb, lockres);
+				ocfs_put_lockres(lockres);
+			} else
+				LOG_TRACE_STR ("lockres in hash is null");
+		} else {
+			LOG_TRACE_STR("hashtable has already been destroyed.");
 		}
-		/* we may be called after unmount, in which case
-		 * don't do this. */
-		if (osb->inode_hash.size)
+	}
+	/* we may be called after unmount, in which case
+	 * don't do this. */
+	if (osb->inode_hash.size) {
+		if (!INODE_DELETED(inode))
 			ocfs_inode_hash_remove(&osb->inode_hash, offset);
+		else
+			LOG_TRACE_ARGS("Inode %lu (%u.%u) already deleted, "
+				       "skipping call to hash_remove\n",
+				       inode->i_ino, HILO(offset));
 	}
+
 bail:
 	LOG_EXIT ();
 	return;
@@ -1454,11 +1467,14 @@
 		}
 				
 #endif
-		inuse = true;
+
 #if LINUX_VERSION_CODE <= LinuxVersionCode(2,4,10)
 		if (err)
 			goto out;
 #endif
+
+		inuse = true;
+
                 totalioblocks = 0;
                 while (size > 0) {
                         if (large_io) {

Modified: trunk/src/journal.c
===================================================================
--- trunk/src/journal.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/journal.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -890,6 +890,7 @@
 	/* Ok, look up the inode for our journal */
 	args.offset = fe->this_sector;
 	args.fe_bh = bh;
+	args.file_lookup_only = false;
 	LOG_TRACE_ARGS("fe->this_sector = %u.%u\n", HI(fe->this_sector), 
 		       LO(fe->this_sector));
 	OCFS_BH_PUT_DATA(bh);
@@ -1109,7 +1110,7 @@
 
 	olderr = journal_errno(journal->k_journal);
 	if (olderr) {
-		printk("ocfs: last journal left error code %d\n", olderr);
+		printk("ocfs2: last journal left error code %d\n", olderr);
 		journal_ack_err(journal->k_journal);
 		journal_clear_err(journal->k_journal);
 	}
@@ -1369,7 +1370,7 @@
 	recalc_sigpending(current);
 	spin_unlock_irq(&current->sigmask_lock);
 #endif	
-	sprintf(current->comm, "ocfs_recover");
+	sprintf(current->comm, "ocfs2_recover");
 
 	status = ocfs_recover_vol(osb, node_num);
 	if (status < 0)
@@ -1472,7 +1473,7 @@
 		status = 0;
 		goto clear_node;
 	}
-	printk("ocfs: Recovering node %d from device (%u,%u)\n", node_num, 
+	printk("ocfs2: Recovering node %d from device (%u,%u)\n", node_num, 
 	       MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
 
 	/* Absolutely need to make sure that the node is using the
@@ -1503,6 +1504,7 @@
 	/* Ok, look up the inode for our journal */
 	args.offset = fe->this_sector;
 	args.fe_bh = bh;
+	args.file_lookup_only = false;
 	OCFS_BH_PUT_DATA(bh);
 	fe = NULL;
 #ifdef LINUX_2_5

Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/namei.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -2,7 +2,7 @@
 
 #define OCFS_DEBUG_CONTEXT    OCFS_DEBUG_CONTEXT_EXTENT
 
-static int ocfs_fe_smash (ocfs_super * osb, __u64 lock_node_off, __u32 flags, __u64 file_off, ocfs_journal_handle *passed_handle, ocfs_bitmap_free_head **ret_head, struct inode *inode, struct inode *parent_inode);
+static int ocfs_fe_smash (ocfs_super * osb, __u64 lock_node_off, __u32 flags, __u64 file_off, ocfs_journal_handle *passed_handle, ocfs_bitmap_free_head **ret_head, struct dentry *dentry, struct inode *parent_inode);
 static int ocfs_rename_file (ocfs_super * osb, ocfs_journal_handle *handle, __u64 parent_off, struct dentry *dentry, __u64 file_off, struct inode *dir_inode);
 static int ocfs_mknod_locked(ocfs_super *osb, struct inode *dir, 
 			     struct dentry *dentry, int mode, 
@@ -66,8 +66,11 @@
 //		ret = ERR_PTR (-ENOMEM);
 //		goto bail;
 //	}
-
-	status = ocfs_find_files_on_disk (osb, parentOffset, &(dentry->d_name), &fe_bh, NULL, dir);
+	
+	LOG_TRACE_ARGS("about to call find_files_on_disk with inode=%08x\n", dir);
+		
+	status = ocfs_find_files_on_disk (osb, parentOffset, &(dentry->d_name), 
+					  &fe_bh, NULL, dir, true);
 	if (status >= 0) {
 		unsigned long ino;
 		__u64 inode_off;
@@ -76,6 +79,7 @@
 		args.offset = fe->this_sector;
 //		args.entry = fe;
 		args.fe_bh = fe_bh;
+		args.file_lookup_only = false;
 		if (fe->attribs & OCFS_ATTRIB_DIRECTORY)
 			inode_off = fe->extents[0].disk_off;
 		else
@@ -185,7 +189,8 @@
 #endif
 
 	/* lock the parent directory */
-	status = ocfs_acquire_lock (osb, parent_off, OCFS_DLM_EXCLUSIVE_LOCK,
+	status = ocfs_acquire_lock (osb, parent_off, 
+				    OCFS_DLM_ENABLE_CACHE_LOCK,
 				    FLAG_FILE_CREATE | FLAG_DIR, 
 				    &lock_res, &lock_bh, dir);
 	if (status < 0) {
@@ -196,7 +201,8 @@
 	}
 
 	/* Ok, we got the lock -- we'd better add it to our transaction */
-	ocfs_journal_add_lock(handle, parent_off, OCFS_DLM_EXCLUSIVE_LOCK, 
+	ocfs_journal_add_lock(handle, parent_off, 
+			      OCFS_DLM_ENABLE_CACHE_LOCK, 
 			      FLAG_FILE_CREATE | FLAG_DIR, lock_res, lock_bh);
 
 	/* do the real work now. */
@@ -256,6 +262,10 @@
 
 	if (S_ISDIR (mode)) 
 		oin->dir_disk_off = fe->extents[0].disk_off;
+
+	LOG_TRACE_ARGS("new_fe_bh: this_sector = %u.%u, "
+		       "extents[0].disk_off = %u.%u\n",
+		       HILO(fe->this_sector), HILO(fe->extents[0].disk_off));
 	
 	status = 0;
 
@@ -281,6 +291,9 @@
 
 	atomic_dec (&dir->i_count);
 
+	if (status < 0)
+		ocfs_bh_sem_hash_cleanup_pid(ocfs_getpid());
+
 	LOG_EXIT_STATUS(status);
 	return(status);
 }		/* ocfs_mknod */
@@ -409,10 +422,10 @@
 		fe->file_size = osb->vol_layout.dir_node_size;
 		fe->next_del = INVALID_DIR_NODE_INDEX;
 
-		if (!cache_lock)
-			DISK_LOCK_FILE_LOCK (fe) = OCFS_DLM_NO_LOCK;
+//		if (!cache_lock)
+//			DISK_LOCK_FILE_LOCK (fe) = OCFS_DLM_NO_LOCK;
 		
-		status = ocfs_read_bhs(osb, bitmapOffset, osb->vol_layout.dir_node_size, dirbhs, OCFS_BH_CACHED, NULL);
+		status = ocfs_read_dirnode(osb, bitmapOffset, dirbhs, OCFS_BH_CACHED, inode);
 		if (status < 0) {
 			ocfs_safefree (dirbhs);
 			OCFS_BH_PUT_DATA(lock_bh);
@@ -441,7 +454,7 @@
 		 * header have to hit disk, but the rest of it has to
 		 * be zeroed out too. At least this will populate the
 		 * cache now... */
-		status = ocfs_write_bhs(osb, dirbhs, numblks, 0, NULL);
+		status = ocfs_write_dirnode(osb, dirbhs, 0, inode);
 		if (status < 0) {
 			for(i=0; i < numblks; i++)
 				brelse(dirbhs[i]);
@@ -458,8 +471,8 @@
 		ocfs_safefree (dirbhs);
 	}
 
-	if (S_ISDIR (mode) && !cache_lock)
-		DISK_LOCK_FILE_LOCK (fe) = OCFS_DLM_NO_LOCK;
+//	if (S_ISDIR (mode) && !cache_lock)
+//		DISK_LOCK_FILE_LOCK (fe) = OCFS_DLM_NO_LOCK;
 
 	status = ocfs_insert_file (osb, fe, lock_bh, &fe_bh, handle, dir, inode);
 	if (status < 0) {
@@ -583,7 +596,7 @@
 
 		if (fileOff != -1)
 			status = ocfs_fe_smash (osb, parentOff, 0, fileOff, 
-						NULL, NULL, inode, parentInode);
+						NULL, NULL, dentry, parentInode);
 
 		if (status < 0) {
 			if (status != -ENOTEMPTY && status != -EPERM &&
@@ -626,6 +639,10 @@
 		retval = -EBUSY;
 	else
 		retval = status;
+
+	if (retval < 0)
+		ocfs_bh_sem_hash_cleanup_pid(ocfs_getpid());
+
 	LOG_EXIT_LONG (retval);
 	return retval;
 }				/* ocfs_unlink */
@@ -983,7 +1000,7 @@
 	/* check if the target already exists (in which case we need
 	 * to delete it */
 	status = ocfs_find_files_on_disk(osb, newDirOff, &(new_dentry->d_name),
-					 &newfe_bh, NULL, new_dir);
+					 &newfe_bh, NULL, new_dir, false);
 
 	/* The only error we allow here is -ENOENT because the new
 	 * file not existing is perfectly valid. */
@@ -1024,7 +1041,7 @@
 		}
 
 		status = ocfs_fe_smash (osb, newDirOff, 0, 
-					tmpoff, handle, &free_head, new_inode, new_dir);
+					tmpoff, handle, &free_head, new_dentry, new_dir);
 		if (status < 0) {
 			/* TODO: we should make this transactional such that */
 			/* either we get the new file or the old file stays. */
@@ -1042,7 +1059,7 @@
 		LOG_TRACE_STR ("Source & Target Directories are different");
 
 		status = ocfs_fe_smash (osb, oldDirOff, FLAG_DEL_NAME, 
-					oldOffset, handle, NULL, old_inode, old_dir);
+					oldOffset, handle, NULL, old_dentry, old_dir);
 		if (status < 0) {
 			if (status != -ENOTEMPTY && status != -EINTR && 
 			    status != -EBUSY)
@@ -1191,16 +1208,16 @@
 
 bail:
 	if (oldfe_lock) {
-		status = ocfs_release_lock(osb, oldfe_lockid, 
-					   OCFS_DLM_EXCLUSIVE_LOCK, 
-					   oldfe_flags, oldfe_lock, NULL, old_dir);
+		ocfs_release_lock(osb, oldfe_lockid, 
+				  OCFS_DLM_EXCLUSIVE_LOCK, 
+				  oldfe_flags, oldfe_lock, NULL, old_dir);
 		ocfs_put_lockres(oldfe_lock);
 	}
 
 	if (newfe_lock) {
-		status = ocfs_release_lock(osb, newfe_lockid, 
-					   OCFS_DLM_EXCLUSIVE_LOCK, 
-					   newfe_flags, newfe_lock, NULL, new_dir);
+		ocfs_release_lock(osb, newfe_lockid, 
+				  OCFS_DLM_EXCLUSIVE_LOCK, 
+				  newfe_flags, newfe_lock, NULL, new_dir);
 		ocfs_put_lockres(newfe_lock);
 	}
 
@@ -1225,6 +1242,9 @@
 	if (free_head)
 		free_bitmap_free_head(free_head);
 
+	if (status < 0)
+		ocfs_bh_sem_hash_cleanup_pid(ocfs_getpid());
+
 	LOG_EXIT_STATUS(status);
 	return status;
 }				/* ocfs_rename */
@@ -1288,7 +1308,8 @@
 	}
 
 	/* lock the parent directory */
-	status = ocfs_acquire_lock (osb, parent_off, OCFS_DLM_EXCLUSIVE_LOCK,
+	status = ocfs_acquire_lock (osb, parent_off, 
+				    OCFS_DLM_ENABLE_CACHE_LOCK,
 				    FLAG_FILE_CREATE | FLAG_DIR, 
 				    &lock_res, &lock_bh, dir);
 	if (status < 0) {
@@ -1333,7 +1354,7 @@
 
 	if (lock_res != NULL) {
 		int tmpstat;
-		tmpstat = ocfs_release_lock (osb, parent_off, OCFS_DLM_EXCLUSIVE_LOCK,
+		tmpstat = ocfs_release_lock (osb, parent_off, OCFS_DLM_ENABLE_CACHE_LOCK,
 		     FLAG_FILE_CREATE | FLAG_DIR, lock_res, lock_bh, dir);
 		if (tmpstat < 0)
 			LOG_ERROR_STATUS (tmpstat);
@@ -1379,6 +1400,9 @@
 	}
 	atomic_dec (&dir->i_count);
 
+	if (status < 0)
+		ocfs_bh_sem_hash_cleanup_pid(ocfs_getpid());
+
 	LOG_EXIT_STATUS (status);
 	return status;
 }				/* ocfs_symlink */
@@ -1550,7 +1574,7 @@
  * to pass back a bitmap_free_head (if it's not passed as NULL)
  *
  */
-static int ocfs_fe_smash (ocfs_super * osb, __u64 lock_node_off, __u32 flags, __u64 file_off, ocfs_journal_handle *passed_handle, ocfs_bitmap_free_head **ret_head, struct inode *inode, struct inode *parent_inode)
+static int ocfs_fe_smash (ocfs_super * osb, __u64 lock_node_off, __u32 flags, __u64 file_off, ocfs_journal_handle *passed_handle, ocfs_bitmap_free_head **ret_head, struct dentry *dentry, struct inode *parent_inode)
 {
 	int status = 0;
 	int tmpstat;
@@ -1564,6 +1588,7 @@
 	ocfs_lock_res *file_lock = NULL;
 	ocfs_bitmap_free_head *free_head = NULL;
 	ocfs_journal_handle *handle = NULL;
+	struct inode *inode = dentry->d_inode;
 
 	LOG_ENTRY ();
 
@@ -1583,13 +1608,13 @@
 		goto leave;
 	}
 
-	status = ocfs_read_bh (osb, file_off, &fe_bh, OCFS_BH_CACHED, inode);
-	if (status < 0) {
-		LOG_ERROR_STATUS (status);
-		goto leave;
-	}
 
 	if (passed_handle) {
+		status = ocfs_read_bh (osb, file_off, &fe_bh, OCFS_BH_CACHED, inode);
+		if (status < 0) {
+			LOG_ERROR_STATUS (status);
+			goto leave;
+		}
 		handle = passed_handle;
 		/* ok, we're going to skip the locking, but there's
 		 * one problem: what if this is a directory that we're
@@ -1630,6 +1655,15 @@
 		goto leave;
 	}
 
+	/* this will re-read the directory now with the EXCLUSIVE */
+	/* lock already held; it will also return the fe_bh to us */
+	status = ocfs_find_files_on_disk (osb, lock_node_off, &(dentry->d_name), 
+					  &fe_bh, NULL, parent_inode, false);
+	if (status < 0) {
+		LOG_ERROR_STATUS(status);
+		goto leave;
+	}
+
 	/* lock the file entry */
 	fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(fe_bh); /* read */
 
@@ -1763,6 +1797,9 @@
 	if (local_handle && handle && (status < 0))
 		ocfs_abort_trans(handle);
 	else if (local_handle && handle) {
+		SET_INODE_DELETED(inode);
+		ocfs_inode_hash_remove(&osb->inode_hash, lock_id);
+
 		status = ocfs_commit_trans(handle);
 		if (status < 0)
 			LOG_ERROR_STATUS(status);

Modified: trunk/src/nm.c
===================================================================
--- trunk/src/nm.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/nm.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -63,7 +63,7 @@
 
 	LOG_ENTRY ();
 
-#define LISTENER_PROCESS_NAME	"ocfslsnr"
+#define LISTENER_PROCESS_NAME	"ocfs2lsnr"
 	ocfs_daemonize (LISTENER_PROCESS_NAME, strlen(LISTENER_PROCESS_NAME));
 
 	OcfsIpcCtxt.task = current;
@@ -247,7 +247,7 @@
 	if (osb->obj_id.type != OCFS_TYPE_OSB)
 		goto eek;
 
-	sprintf (proc, "ocfsnm-%d", osb->osb_id);
+	sprintf (proc, "ocfs2nm-%d", osb->osb_id);
 	ocfs_daemonize (proc, strlen(proc));
 
 	osb->dlm_task = current;
@@ -294,7 +294,7 @@
 			} else if (osb->needs_flush) {
 				flush_misses++;
 				if (flush_misses > OCFS_NM_MAX_FLUSH_MISSES) {
-					printk("ocfs: nm thread has not been "
+					printk("ocfs2: nm thread has not been "
 					       "able to commit cache in %d "
 					       "iterations!\n", flush_misses);
 				}
@@ -1128,7 +1128,7 @@
 			}
 			OCFS_BH_PUT_DATA(fe_bh);
 
-			if (is_dir) {
+			if (is_dir && vote_type == RELEASE_CACHE) {
 				struct buffer_head **dir_bhs = NULL;
 				int dirblks = osb->vol_layout.dir_node_size / osb->sect_size;
 
@@ -1140,10 +1140,7 @@
 				}
 				memset(dir_bhs, 0, dirblks * sizeof(*dir_bhs));
 
-				status = ocfs_read_bhs(osb, lock_id, 
-						      dirblks * osb->sect_size,
-						      dir_bhs, OCFS_BH_CACHED, 
-						      inode);
+				status = ocfs_read_dirnode(osb, lock_id, dir_bhs, OCFS_BH_CACHED, inode);
 				if (status >= 0)
 					ocfs_release_dir_cache_lock(osb, dir_bhs, inode);
 			
@@ -1164,6 +1161,7 @@
 			/* need to do the write only if fe lock values need to change */
 			if (is_locked || vote_type == CHANGE_MASTER) {
 				if (vote_type == RELEASE_CACHE) {
+					LOG_TRACE_STR("release cache vote, setting to NO_LOCK");
 					fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
 					DISK_LOCK_FILE_LOCK (fe) = OCFS_DLM_NO_LOCK;
 					OCFS_BH_PUT_DATA(fe_bh);
@@ -1175,8 +1173,8 @@
 					}
 					lockres->lock_type = lockres->lock_state = OCFS_DLM_NO_LOCK;
 				} else {
-					if (!is_dir) {
-						/* fe_bh was written in ocfs_release_dir_cache_lock */
+					//if (!is_dir) /* fe_bh was written in ocfs_release_dir_cache_lock */
+					{
 						status = ocfs_write_bh(osb, fe_bh, 0, inode);
 						if (status < 0) {
 							LOG_ERROR_STATUS (status);
@@ -1426,8 +1424,10 @@
 	for(i = 0; i < dirnode->num_ent_used; i++) {
 		fe = (ocfs_file_entry *) FILEENT_GETBH_WRITE(dirnode, dir_bhs, i); /* write */
 
-		if (DISK_LOCK_FILE_LOCK(fe) == OCFS_DLM_ENABLE_CACHE_LOCK)
+		if (DISK_LOCK_FILE_LOCK(fe) == OCFS_DLM_ENABLE_CACHE_LOCK) {
+			LOG_TRACE_STR("setting lock to NO_LOCK");
 			DISK_LOCK_FILE_LOCK(fe) = OCFS_DLM_NO_LOCK;
+		}
 
 		FILEENT_PUTBH(dirnode, dir_bhs, i);
 	}
@@ -1436,7 +1436,7 @@
 	OCFS_BH_PUT_DATA(dir_bhs[0]);
 	dirnode = NULL;
 
-	status = ocfs_write_bhs(osb, dir_bhs, dirblks, 0, inode);
+	status = ocfs_write_dirnode(osb, dir_bhs, 0, inode);
 	if (status < 0) {
 		LOG_ERROR_STATUS (status);
 		goto bail;
@@ -1449,9 +1449,8 @@
 				brelse(dir_bhs[i]);
 		memset(dir_bhs, 0, dirblks * sizeof(*dir_bhs));
 
-		status = ocfs_read_bhs(osb, next_node_ptr, 
-				       osb->vol_layout.dir_node_size, 
-				       dir_bhs, OCFS_BH_CACHED, inode);
+		status = ocfs_read_dirnode(osb, next_node_ptr, dir_bhs, 
+					   OCFS_BH_CACHED, inode);
 		if (status < 0) {
 			LOG_ERROR_STATUS (status);
 			goto bail;
@@ -1466,12 +1465,15 @@
 		if(!IS_VALID_DIR_NODE(dirnode))
 			break;
 
+		LOG_TRACE_STR("setting another dirnode header to NO_LOCK");
 		DISK_LOCK_FILE_LOCK(dirnode) = OCFS_DLM_NO_LOCK;
 
 		for(i = 0; i < dirnode->num_ent_used; i++) {
 			fe = FILEENT_GETBH_WRITE(dirnode, dir_bhs, i); /* write */
-			if (DISK_LOCK_FILE_LOCK(fe) == OCFS_DLM_ENABLE_CACHE_LOCK)
+			if (DISK_LOCK_FILE_LOCK(fe) == OCFS_DLM_ENABLE_CACHE_LOCK) {
+				LOG_TRACE_STR("setting fileentry to NO_LOCK");
 				DISK_LOCK_FILE_LOCK(fe) = OCFS_DLM_NO_LOCK;
+			}
 			FILEENT_PUTBH(dirnode, dir_bhs, i);
 		}
 
@@ -1481,7 +1483,7 @@
 		OCFS_BH_PUT_DATA(dir_bhs[0]);
 		dirnode = NULL;
 
-		status = ocfs_write_bhs(osb, dir_bhs, dirblks, 0, inode);
+		status = ocfs_write_dirnode(osb, dir_bhs, 0, inode);
 		if (status < 0) {
 			LOG_ERROR_STATUS (status);
 			goto bail;

Modified: trunk/src/oin.c
===================================================================
--- trunk/src/oin.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/oin.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -620,7 +620,6 @@
 		__u64 savedOffset = oin->file_disk_off;
 
 		CLEAR_INODE_OIN(inode);
-		SET_INODE_OFFSET (inode, savedOffset);
 		LOG_TRACE_ARGS ("inode oin cleared / flags: %d / offset: %u.%u\n",
 			inode->i_flags, savedOffset);
 	}

Modified: trunk/src/osb.c
===================================================================
--- trunk/src/osb.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/osb.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -350,14 +350,14 @@
 	if (config->journal_version < OCFS_JOURNAL_CURRENT_VERSION) {
 		if (dirty) {
 			LOG_ERROR_STR("Volume is dirty, please remount with " \
-				      "old version of ocfs before upgrading.");
+				      "ocfs version 1 before upgrading.");
 			status = -1;
 			goto finally;
 		}
 
-		printk("ocfs: Old journal type found, converting to new"    \
-			      "style. You will no longer be able to mount " \
-			      "with old versions of ocfs.\n");
+		printk("ocfs2: Old journal type found, converting to new " \
+		       "style. You will no longer be able to mount with " \
+		       "ocfs version 1.\n");
 
 		/* do our "journal_create" */
 		status = ocfs_journal_create(&osb->journal);
@@ -392,7 +392,7 @@
 	if (!mounted)
 		ocfs_journal_wipe(&osb->journal, 0);
 	else
-		printk(KERN_NOTICE "ocfs: File system was not unmounted "
+		printk(KERN_NOTICE "ocfs2: File system was not unmounted "
 		       "cleanly, recovering volume.\n");
 
 	/* will play back anything left in the journal. */
@@ -555,8 +555,7 @@
 		goto bail;
 	}
 
-	status = ocfs_read_bhs(osb, bitmapOffset, OCFS_DEFAULT_DIR_NODE_SIZE, 
-			       dirnode_bhs, 0, NULL);
+	status = ocfs_read_dirnode(osb, bitmapOffset, dirnode_bhs, 0, NULL);
 	if (status < 0) {
 		LOG_ERROR_STATUS (status = -EFAIL);
 		goto bail;

Modified: trunk/src/proc.c
===================================================================
--- trunk/src/proc.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/proc.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -56,18 +56,18 @@
 	}
 	*p, ProcList[] =
 	{
-		{ "ocfs/version", NULL, ocfs_proc_version },
-		{ "ocfs/nodename", NULL, ocfs_proc_nodename },
-		{ "ocfs/globalctxt", NULL, ocfs_proc_globalctxt },
+		{ "ocfs2/version", NULL, ocfs_proc_version },
+		{ "ocfs2/nodename", NULL, ocfs_proc_nodename },
+		{ "ocfs2/globalctxt", NULL, ocfs_proc_globalctxt },
 #ifdef OCFS_LINUX_MEM_DEBUG
-		{ "ocfs/memallocs", NULL, ocfs_proc_memallocs },
+		{ "ocfs2/memallocs", NULL, ocfs_proc_memallocs },
 #endif
 		{ NULL, }
 	};
 
 	LOG_ENTRY ();
 
-	proc_mkdir ("ocfs", 0);
+	proc_mkdir ("ocfs2", 0);
 
 	for (p = ProcList; p->name; p++)
 		create_proc_read_entry (p->name, 0, NULL, p->read_proc,
@@ -85,10 +85,10 @@
 {
 	LOG_ENTRY ();
 
-	remove_proc_entry ("ocfs/version", NULL);
-	remove_proc_entry ("ocfs/nodename", NULL);
-	remove_proc_entry ("ocfs/memallocs", NULL);
-	remove_proc_entry ("ocfs", NULL);
+	remove_proc_entry ("ocfs2/version", NULL);
+	remove_proc_entry ("ocfs2/nodename", NULL);
+	remove_proc_entry ("ocfs2/memallocs", NULL);
+	remove_proc_entry ("ocfs2", NULL);
 
 	LOG_EXIT ();
 	return;
@@ -344,7 +344,7 @@
 	ProcList[2].data = (char *) osb;
 	ProcList[3].data = (char *) osb;
 
-	sprintf (newdir, "ocfs/%-d", osb->osb_id);
+	sprintf (newdir, "ocfs2/%-d", osb->osb_id);
 	proc_mkdir (newdir, 0);
 
 	for (p = ProcList; p->name; p++) {
@@ -369,16 +369,16 @@
 
 	LOG_ENTRY ();
 
-	sprintf (tmp, "ocfs/%-d/nodenum", osb->osb_id);
+	sprintf (tmp, "ocfs2/%-d/nodenum", osb->osb_id);
 	remove_proc_entry (tmp, NULL);
 
-	sprintf (tmp, "ocfs/%-d/mountpoint", osb->osb_id);
+	sprintf (tmp, "ocfs2/%-d/mountpoint", osb->osb_id);
 	remove_proc_entry (tmp, NULL);
 
-	sprintf (tmp, "ocfs/%-d/statistics", osb->osb_id);
+	sprintf (tmp, "ocfs2/%-d/statistics", osb->osb_id);
 	remove_proc_entry (tmp, NULL);
 
-	sprintf (tmp, "ocfs/%-d", osb->osb_id);
+	sprintf (tmp, "ocfs2/%-d", osb->osb_id);
 	remove_proc_entry (tmp, NULL);
 
 	LOG_EXIT ();

Modified: trunk/src/sem.c
===================================================================
--- trunk/src/sem.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/sem.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -8,7 +8,7 @@
  */
 void ocfs_init_sem (ocfs_sem * res)
 {
-	LOG_ENTRY_ARGS ("(0x%08x)\n", res);
+	LOG_ENTRY ();
 
 	memset (res, 0, sizeof (ocfs_sem));
 	init_MUTEX (&(res->sem));
@@ -32,9 +32,7 @@
 {
 	bool ret = true;
 
-	LOG_ENTRY_ARGS ("(0x%08x, %s, pid=%d, count=%d, semcount=%d, semsleepers=%d)\n", 
-			res, wait ? "wait" : "nowait", 
-			res->pid, res->count, res->sem.count, res->sem.sleepers);
+	LOG_ENTRY ();
 
 	if (res->magic != OCFS_SEM_MAGIC) {
 		LOG_ERROR_ARGS("semaphore magic value is bad!\n");
@@ -82,7 +80,7 @@
  */
 void ocfs_up_sem (ocfs_sem * res)
 {
-	LOG_ENTRY_ARGS ("(0x%08x)\n", res);
+	LOG_ENTRY ();
 
 	if (res->magic != OCFS_SEM_MAGIC) {
 		LOG_ERROR_ARGS("semaphore magic value is bad!\n");
@@ -108,7 +106,7 @@
  */
 int ocfs_del_sem (ocfs_sem * res)
 {
-	LOG_ENTRY_ARGS ("(0x%08x)\n", res);
+	LOG_ENTRY ();
 
 	res->magic = OCFS_SEM_DELETED;
 

Modified: trunk/src/super.c
===================================================================
--- trunk/src/super.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/super.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -20,7 +20,7 @@
 __u32 debug_level = 0;
 __u32 debug_exclude = 0;
 char *ip_address = NULL;
-__u32 ip_port = 0;
+__u32 ip_port_v2 = 0;
 char *guid = NULL;
 __u32 cs = 0;
 __u32 comm_voting = 0;
@@ -33,7 +33,7 @@
 extern struct ctl_table_header *ocfs_table_header;
 #endif
 
-#define KERN_OCFS 989 
+#define KERN_OCFS 988 
 static ctl_table ocfs_dbg_table[] = {
 	{1, "debug_level", &debug_level, sizeof (__u32), 0644, NULL, &proc_dointvec, 
 	&sysctl_intvec, NULL, NULL, NULL},
@@ -47,7 +47,7 @@
 };
 
 static ctl_table ocfs_kern_table[] = {
-       	{KERN_OCFS, "ocfs", NULL, 0, 0555, ocfs_dbg_table}, 
+       	{KERN_OCFS, "ocfs2", NULL, 0, 0555, ocfs_dbg_table}, 
 	{0} 
 };
 static ctl_table ocfs_root_table[] = {
@@ -56,41 +56,43 @@
 };
 static struct ctl_table_header *ocfs_table_header = NULL;
 
+EXPORT_NO_SYMBOLS;
+
 MODULE_LICENSE ("GPL");
 MODULE_AUTHOR("Oracle Corporation");
 //MODULE_DESCRIPTION("Oracle Clustered FileSystem");
 
 #ifdef LINUX_2_5
 module_param (node_name, charp, 0);
-module_param (node_number, ulong, 0);
-module_param (debug_context, ulong, 0);
-module_param (debug_level, ulong, 0);
-module_param (debug_exclude, ulong, 0);
+module_param (node_number, uint, 0);
+module_param (debug_context, uint, 0);
+module_param (debug_level, uint, 0);
+module_param (debug_exclude, uint, 0);
 module_param (ip_address, charp, 0);
-module_param (ip_port, ulong, 0);
+module_param (ip_port_v2, uint, 0);
 module_param (guid, charp, 0);
-module_param (cs, int, 0);
-module_param (comm_voting, ulong, 0);
+module_param (cs, uint, 0);
+module_param (comm_voting, uint, 0);
 #else /* LINUX_2_5 */
 MODULE_PARM (node_name, "s");
 MODULE_PARM_DESC(node_name, "Name of this machine in the cluster");
-MODULE_PARM (node_number, "l");
+MODULE_PARM (node_number, "i");
 MODULE_PARM_DESC(node_number, "Slot number for this machine within volume");
-MODULE_PARM (debug_context, "l");
+MODULE_PARM (debug_context, "i");
 MODULE_PARM_DESC(debug_context, "Debug context");
-MODULE_PARM (debug_level, "l");
+MODULE_PARM (debug_level, "i");
 MODULE_PARM_DESC(debug_level, "Debug level");
-MODULE_PARM (debug_exclude, "l");
+MODULE_PARM (debug_exclude, "i");
 MODULE_PARM_DESC(debug_exclude, "Process ID to exclude from tracing");
 MODULE_PARM (ip_address, "s");
 MODULE_PARM_DESC(ip_address, "IP address for the network dlm on this node");
-MODULE_PARM (ip_port, "l");
-MODULE_PARM_DESC(ip_port, "Port number for the network dlm on this node");
+MODULE_PARM (ip_port_v2, "i");
+MODULE_PARM_DESC(ip_port_v2, "Port number for the network dlm on this node");
 MODULE_PARM (guid, "s");
 MODULE_PARM_DESC(guid, "GUID for this machine");
 MODULE_PARM (cs, "i");
 MODULE_PARM_DESC(cs, "Checksum");
-MODULE_PARM (comm_voting, "l");
+MODULE_PARM (comm_voting, "i");
 MODULE_PARM_DESC(comm_voting, "Enable/Disable network dlm");
 #endif /* Linux 2.4 stuff */
 
@@ -125,7 +127,7 @@
 
 static struct file_system_type ocfs_fs_type = {
         .owner          = THIS_MODULE,
-        .name           = "ocfs",
+        .name           = "ocfs2",
         .get_sb         = ocfs_get_sb, /* is this called when we mount
 					* the fs? */
         .kill_sb        = kill_block_super, /* set to the generic one
@@ -192,7 +194,7 @@
 	}
 
 	sb->s_root = root_dentry;
-	printk ("ocfs: Mounting device (%u,%u) on %s (node %d)\n",
+	printk ("ocfs2: Mounting device (%u,%u) on %s (node %d)\n",
 		MAJOR(sb->s_dev), MINOR(sb->s_dev),
 		osb->node_cfg_info[osb->node_num]->node_name, osb->node_num);
 
@@ -281,7 +283,7 @@
 
 	sb->s_root = root;
 
-	printk ("ocfs: Mounting device (%u,%u) on %s (node %d)\n",
+	printk ("ocfs2: Mounting device (%u,%u) on %s (node %d)\n",
 		MAJOR(sb->s_dev), MINOR(sb->s_dev),
 		osb->node_cfg_info[osb->node_num]->node_name, osb->node_num);
 
@@ -303,7 +305,7 @@
 }				/* ocfs_read_super */
 
 
-static DECLARE_FSTYPE (ocfs_fs_type, "ocfs", ocfs_read_super, FS_REQUIRES_DEV);
+static DECLARE_FSTYPE (ocfs_fs_type, "ocfs2", ocfs_read_super, FS_REQUIRES_DEV);
 #endif /* #if LINUX_2_5 ... #else */
 
 
@@ -391,7 +393,7 @@
 	if (ocfs_hostname==NULL)
 		return -EINVAL;
 	strcpy(ocfs_hostname, system_utsname.nodename);
-	printk("ocfs: hostname is %s\n", ocfs_hostname);
+	printk("ocfs2: hostname is %s\n", ocfs_hostname);
 	
 	ocfs_table_header = register_sysctl_table(ocfs_root_table, 0);
 	if (!ocfs_table_header) {
@@ -511,10 +513,10 @@
 		}
 	}
 
-	if (ip_port == 0)
+	if (ip_port_v2 == 0)
 		OcfsGlobalCtxt.comm_info.ip_port = OCFS_IPC_DEFAULT_PORT;
 	else
-		OcfsGlobalCtxt.comm_info.ip_port = ip_port;
+		OcfsGlobalCtxt.comm_info.ip_port = ip_port_v2;
 	LOG_TRACE_ARGS("IP port: %d\n", OcfsGlobalCtxt.comm_info.ip_port);
 
 	if (node_name && strlen (node_name) < MAX_NODE_NAME_LENGTH) {
@@ -546,7 +548,7 @@
 			check_sum += (__u32) guid[i];
 		if (cs != check_sum) {
 			status = -EINVAL;
-			LOG_ERROR_STR ("load module using load_ocfs");
+			LOG_ERROR_STR ("load module using load_ocfs2");
 		}
 	}
 
@@ -736,26 +738,26 @@
  */
 static int ocfs_initialize_mem_lists (void)
 {
-	OcfsGlobalCtxt.oin_cache = kmem_cache_create ("oin_cache",
+	OcfsGlobalCtxt.oin_cache = kmem_cache_create ("ocfs2_oin",
 		sizeof (ocfs_inode) + OCFS_POINTER_SIZE, 0, SLAB_NO_REAP | SLAB_HWCACHE_ALIGN,
 		NULL, NULL);
 
-	OcfsGlobalCtxt.ofile_cache = kmem_cache_create ("ofile_cache",
+	OcfsGlobalCtxt.ofile_cache = kmem_cache_create ("ocfs2_ofile",
 		sizeof (ocfs_file) + OCFS_POINTER_SIZE, 0, SLAB_NO_REAP | SLAB_HWCACHE_ALIGN,
 		NULL, NULL);
 
-	OcfsGlobalCtxt.lockres_cache = kmem_cache_create ("lockres_cache",
+	OcfsGlobalCtxt.lockres_cache = kmem_cache_create ("ocfs2_lockres",
 		sizeof (ocfs_lock_res) + OCFS_POINTER_SIZE, 0, SLAB_NO_REAP | SLAB_HWCACHE_ALIGN,
 		NULL, NULL);
 
-	OcfsGlobalCtxt.fe_cache = kmem_cache_create ("fileentry_cache",
+	OcfsGlobalCtxt.fe_cache = kmem_cache_create ("ocfs2_fileentry",
 		OCFS_SECTOR_SIZE, 0, SLAB_NO_REAP | SLAB_HWCACHE_ALIGN, NULL, NULL);
 
-	OcfsGlobalCtxt.extent_cache = kmem_cache_create ("extent_cache",
+	OcfsGlobalCtxt.extent_cache = kmem_cache_create ("ocfs2_extent",
 		sizeof(ocfs_extent) + OCFS_POINTER_SIZE, 0, SLAB_NO_REAP | SLAB_HWCACHE_ALIGN,
 		NULL, NULL);
 	
-	OcfsGlobalCtxt.bh_sem_cache = kmem_cache_create ("bh_sem_cache",
+	OcfsGlobalCtxt.bh_sem_cache = kmem_cache_create ("ocfs2_bh_sem",
 		sizeof(ocfs_bh_sem), 0, SLAB_NO_REAP | SLAB_HWCACHE_ALIGN,
 		NULL, NULL);
 
@@ -892,7 +894,7 @@
 	child_pid = kernel_thread (ocfs_volume_thread, osb,
 				   CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
 	if (child_pid < 0) {
-		LOG_ERROR_ARGS ("unable to launch ocfsnm thread, error=%d",
+		LOG_ERROR_ARGS ("unable to launch ocfs2nm thread, error=%d",
 				child_pid);
 		ocfs_up_sem (&(osb->osb_res));
 		status = -EFAIL;
@@ -924,7 +926,7 @@
 			init_completion (&(OcfsIpcCtxt.complete));
 		} else {
 			status = -EFAIL;
-			LOG_ERROR_ARGS ("unable to launch ocfslsnr thread, error=%d", child_pid);
+			LOG_ERROR_ARGS ("unable to launch ocfs2lsnr thread, error=%d", child_pid);
 			goto leave;
 		}
 
@@ -1044,7 +1046,7 @@
 
 	/* Shutdown the journal and sync up and clear the local alloc. */
 	ocfs_journal_shutdown(osb);
-	ocfs_shutdown_local_alloc(osb, NULL, true);
+	ocfs_shutdown_local_alloc(osb, NULL, true, false);
 
 	/* unset the mounted flag -- we're done with the journal and
 	 * the local alloc bitmap */
@@ -1067,7 +1069,7 @@
 
 	/* Wait for this volume's NM thread to exit */
 	if (osb->dlm_task) {
-		LOG_TRACE_STR ("Waiting for ocfsnm to exit....");
+		LOG_TRACE_STR ("Waiting for ocfs2nm to exit....");
 		send_sig (SIGINT, osb->dlm_task, 0);
 		wait_for_completion (&(osb->complete));
 		osb->dlm_task = NULL;
@@ -1089,7 +1091,7 @@
 	if (mount_cnt == 0) {
 		/* Shutdown ocfslsnr */
 		if (OcfsIpcCtxt.task) {
-			LOG_TRACE_STR ("Waiting for ocfslsnr to exit....");
+			LOG_TRACE_STR ("Waiting for ocfs2lsnr to exit....");
 			send_sig (SIGINT, OcfsIpcCtxt.task, 0);
 			wait_for_completion (&(OcfsIpcCtxt.complete));
 			OcfsIpcCtxt.task = NULL;
@@ -1111,7 +1113,7 @@
 		AcquiredOSB = false;
 	}
 
-	printk ("ocfs: Unmounting device (%u,%u) on %s (node %d)\n",
+	printk ("ocfs2: Unmounting device (%u,%u) on %s (node %d)\n",
 		MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev),
 		osb->node_cfg_info[osb->node_num]->node_name, osb->node_num);
 

Modified: trunk/src/util.c
===================================================================
--- trunk/src/util.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/util.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -259,7 +259,7 @@
 bool ocfs_linux_get_inode_offset (struct inode * inode, __u64 * off, ocfs_inode ** oin)
 {
 	if (off == NULL)
-		return false;
+		BUG();
 
 	if (oin != NULL)
 		*oin = NULL;
@@ -269,7 +269,11 @@
 	*off = GET_INODE_OFFSET (inode);
 
 	LOG_TRACE_ARGS("offset=%u.%u, i_ino=%u\n", HILO((*off)), inode->i_ino);
-	return (*off != -1);
+
+	if (*off == -1)
+		BUG();
+
+	return(true);
 }				/* ocfs_linux_get_inode_offset */
 
 
@@ -288,7 +292,8 @@
 
 	*off = -1;
 
-	status = ocfs_find_files_on_disk (osb, parentOff, fileName, &ent_bh, NULL, parent_inode);
+	status = ocfs_find_files_on_disk (osb, parentOff, fileName, &ent_bh, 
+					  NULL, parent_inode, true);
 	if (status >= 0) {
 		ent = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(ent_bh); /* read */
 		*off = ent->this_sector;

Modified: trunk/src/vote.c
===================================================================
--- trunk/src/vote.c	2004-01-24 01:22:15 UTC (rev 15)
+++ trunk/src/vote.c	2004-01-27 18:24:19 UTC (rev 16)
@@ -79,7 +79,7 @@
 	if (error < 0) {
 		if (error == -ERESTARTSYS) {
 			status = -EBADF;
-			LOG_TRACE_STR ("Shutting down ocfslsnr");
+			LOG_TRACE_STR ("Shutting down ocfs2lsnr");
 		} else {
 			status = -EFAIL;
 			LOG_ERROR_ARGS ("unable to recvmsg, error=%d", error);
@@ -484,7 +484,7 @@
 	case OCFS_INFO_DISMOUNT:
 		src_node = dlm_msg->src_node;
 		req_master = (ocfs_dlm_req_master *) dlm_msg->msg_buf;
-		printk ("ocfs: Received dismount message for device (%u,%u) "
+		printk ("ocfs2: Received dismount message for device (%u,%u) "
 			"from %s (node %d)\n", MAJOR(osb->sb->s_dev),
 			MINOR(osb->sb->s_dev), osb->node_cfg_info[src_node]->node_name,
 			src_node);



More information about the Ocfs2-commits mailing list