[Ocfs2-tools-commits] jlbec commits r1072 - in branches/global-heartbeat: . debian debugfs.ocfs2 debugfs.ocfs2/include documentation extras fsck.ocfs2 libo2cb libo2cb/include libocfs2 libocfs2/include mkfs.ocfs2 mounted.ocfs2 o2cb_ctl ocfs2_hb_ctl ocfs2cdsl ocfs2console ocfs2console/ocfs2interface tunefs.ocfs2 vendor/common

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Mon Sep 5 21:01:32 CDT 2005


Author: jlbec
Date: 2005-09-05 21:01:13 -0500 (Mon, 05 Sep 2005)
New Revision: 1072

Added:
   branches/global-heartbeat/documentation/migrate_from_ocfs.sxw
   branches/global-heartbeat/libo2cb/include/sparse_endian_types.h
   branches/global-heartbeat/libocfs2/include/jbd.h
   branches/global-heartbeat/libocfs2/slot_map.c
   branches/global-heartbeat/vendor/common/ocfs2fs
Removed:
   branches/global-heartbeat/debugfs.ocfs2/include/jbd.h
   branches/global-heartbeat/libocfs2/include/jfs_compat.h
   branches/global-heartbeat/libocfs2/include/jfs_user.h
   branches/global-heartbeat/libocfs2/include/kernel-jbd.h
Modified:
   branches/global-heartbeat/Config.make.in
   branches/global-heartbeat/configure.in
   branches/global-heartbeat/debian/changelog
   branches/global-heartbeat/debugfs.ocfs2/Makefile
   branches/global-heartbeat/debugfs.ocfs2/commands.c
   branches/global-heartbeat/debugfs.ocfs2/debugfs.ocfs2.8.in
   branches/global-heartbeat/debugfs.ocfs2/dump.c
   branches/global-heartbeat/debugfs.ocfs2/include/dump.h
   branches/global-heartbeat/documentation/ocfs2_faq.txt
   branches/global-heartbeat/documentation/users_guide.sxw
   branches/global-heartbeat/extras/find_dup_extents.c
   branches/global-heartbeat/fsck.ocfs2/fsck.ocfs2.8.in
   branches/global-heartbeat/fsck.ocfs2/fsck.ocfs2.checks.8.in
   branches/global-heartbeat/fsck.ocfs2/journal.c
   branches/global-heartbeat/fsck.ocfs2/pass0.c
   branches/global-heartbeat/fsck.ocfs2/pass1.c
   branches/global-heartbeat/fsck.ocfs2/pass4.c
   branches/global-heartbeat/libo2cb/Makefile
   branches/global-heartbeat/libo2cb/include/o2cb.h
   branches/global-heartbeat/libo2cb/include/ocfs2_heartbeat.h
   branches/global-heartbeat/libo2cb/include/ocfs2_nodemanager.h
   branches/global-heartbeat/libo2cb/o2cb_abi.c
   branches/global-heartbeat/libocfs2/Makefile
   branches/global-heartbeat/libocfs2/alloc.c
   branches/global-heartbeat/libocfs2/bitops.c
   branches/global-heartbeat/libocfs2/chain.c
   branches/global-heartbeat/libocfs2/chainalloc.c
   branches/global-heartbeat/libocfs2/checkhb.c
   branches/global-heartbeat/libocfs2/dirblock.c
   branches/global-heartbeat/libocfs2/extents.c
   branches/global-heartbeat/libocfs2/getsectsize.c
   branches/global-heartbeat/libocfs2/getsize.c
   branches/global-heartbeat/libocfs2/heartbeat.c
   branches/global-heartbeat/libocfs2/include/bitops.h
   branches/global-heartbeat/libocfs2/include/byteorder.h
   branches/global-heartbeat/libocfs2/include/ocfs2.h
   branches/global-heartbeat/libocfs2/include/ocfs2_fs.h
   branches/global-heartbeat/libocfs2/inode.c
   branches/global-heartbeat/libocfs2/inode_scan.c
   branches/global-heartbeat/libocfs2/mkjournal.c
   branches/global-heartbeat/libocfs2/openfs.c
   branches/global-heartbeat/mkfs.ocfs2/Makefile
   branches/global-heartbeat/mkfs.ocfs2/mkfs.c
   branches/global-heartbeat/mkfs.ocfs2/mkfs.h
   branches/global-heartbeat/mkfs.ocfs2/mkfs.ocfs2.8.in
   branches/global-heartbeat/mounted.ocfs2/mounted.ocfs2.8.in
   branches/global-heartbeat/o2cb_ctl/o2cb_config.c
   branches/global-heartbeat/o2cb_ctl/o2cb_ctl.8.in
   branches/global-heartbeat/o2cb_ctl/o2cb_ctl.c
   branches/global-heartbeat/ocfs2_hb_ctl/ocfs2_hb_ctl.8.in
   branches/global-heartbeat/ocfs2cdsl/ocfs2cdsl.8.in
   branches/global-heartbeat/ocfs2console/ocfs2console.8.in
   branches/global-heartbeat/ocfs2console/ocfs2interface/about.py
   branches/global-heartbeat/tunefs.ocfs2/tunefs.c
   branches/global-heartbeat/tunefs.ocfs2/tunefs.ocfs2.8.in
   branches/global-heartbeat/vendor/common/o2cb.init
Log:

o Merged [1005:1071] from trunk:
	- [1008] Trunk is now 1.1
	- [1009] Some sundry version updates
	- [1013] Resync with kernel
	- [1015] Remove endian special handling
	- [1025] migrate doc added
	- [1026] migrate doc updated
	- [1029] manpages updated
	- [1030] tunefs manpage updated
	- [1031] faq updated
	- [1032] added ocfs2cdsl and mounted.ocfs2 to users guide
	- [1034] Check i_size in fsck, ensure i_size & i_cluster updates
	- [1043] Merged endian-safe branch to trunk, r1017:1042
	- [1045] Provide endian types in userspace
	- [1046] ocfs2fs service added for sles9
	- [1048] get rid of an unused static function
	- [1049] fsck recognizes an inode with i_count and no directory
	         references or vice versa
	- [1050] Don't rewrite the O2CB config if not needed.
	- [1051] Write cluster.conf to a temporary and rename(2).
	- [1055] Set heartbeat deadline from o2cb.init
	- [1061] Bump version
	- [1062] faq updated
	- [1063] faq update
	- [1064] Actually check the right variable for the presence of
	         libuuid
	- [1067] Bumped version to 1.1.2
	- [1069] fix some 32->64bit wrapping problems
	- [1070] Resync with e2fsprogs
	- [1071] Resync with e2fsprogs



Modified: branches/global-heartbeat/Config.make.in
===================================================================
--- branches/global-heartbeat/Config.make.in	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/Config.make.in	2005-09-06 02:01:13 UTC (rev 1072)
@@ -69,5 +69,3 @@
 
 OCFS2_DYNAMIC_FSCK = @OCFS2_DYNAMIC_FSCK@
 OCFS2_DYNAMIC_CTL = @OCFS2_DYNAMIC_CTL@
-
-B0RKEN_ENDIAN = @B0RKEN_ENDIAN@

Modified: branches/global-heartbeat/configure.in
===================================================================
--- branches/global-heartbeat/configure.in	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/configure.in	2005-09-06 02:01:13 UTC (rev 1072)
@@ -7,10 +7,10 @@
 AC_SUBST(PACKAGE)
 
 # Adjust these for the software version.
-MAJOR_VERSION=0
-MINOR_VERSION=99
-MICRO_VERSION=16
-EXTRA_VERSION=BETA17
+MAJOR_VERSION=1
+MINOR_VERSION=1
+MICRO_VERSION=2
+EXTRA_VERSION=ALPHA
 
 # Adjust this only to bump the RPM packaging version
 RPM_VERSION=1
@@ -84,23 +84,13 @@
 
 UUID_LIBS=
 AC_CHECK_LIB(uuid, uuid_unparse, UUID_LIBS=-luuid)
-if test "x$COM_ERR_LIBS" = "x"; then
+if test "x$UUID_LIBS" = "x"; then
   AC_MSG_ERROR([Unable to find uuid library])
 fi
 AC_CHECK_HEADER(uuid/uuid.h, :,
   AC_MSG_ERROR([Unable to find uuid headers]))
 AC_SUBST(UUID_LIBS)
 
-AC_C_BIGENDIAN()
-
-B0RKEN_ENDIAN=
-case "$host_cpu" in
-  s390x)
-    B0RKEN_ENDIAN=-DCONFIG_ARCH_S390=1
-    ;;
-esac
-AC_SUBST(B0RKEN_ENDIAN)
-
 AC_MSG_CHECKING(for debug executables)
 AC_ARG_ENABLE(debugexe, [  --enable-debugexe=[yes/no]     Enable debug executables for library source files [default=no]],,enable_debugexe=no)
 OCFS2_DEBUG_EXE=

Modified: branches/global-heartbeat/debian/changelog
===================================================================
--- branches/global-heartbeat/debian/changelog	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/debian/changelog	2005-09-06 02:01:13 UTC (rev 1072)
@@ -1,3 +1,9 @@
+ocfs2-tools (1.0.0-1) unstable; urgency=low
+
+  * New release.
+
+ -- Joel Becker <joel.becker at oracle.com>  Tue,  2 Aug 2006 14:40:25 -0700
+
 ocfs2-tools (0.99.17-1) unstable; urgency=low
 
   * New release.

Modified: branches/global-heartbeat/debugfs.ocfs2/Makefile
===================================================================
--- branches/global-heartbeat/debugfs.ocfs2/Makefile	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/debugfs.ocfs2/Makefile	2005-09-06 02:01:13 UTC (rev 1072)
@@ -24,12 +24,12 @@
 	include/commands.h	\
 	include/dump.h		\
 	include/utils.h		\
-	include/jbd.h		\
 	include/journal.h
 
 OBJS = $(subst .c,.o,$(CFILES))
 
 LIBOCFS2_LIBS = -L$(TOPDIR)/libocfs2 -locfs2
+LIBO2CB_LIBS = -L$(TOPDIR)/libo2cb -lo2cb
 
 MANS = debugfs.ocfs2.8
 
@@ -41,6 +41,6 @@
 	$(TOPDIR)/mkinstalldirs $(DIST_DIR)/include
 
 debugfs.ocfs2: $(OBJS)
-	$(LINK) $(GLIB_LIBS) $(LIBOCFS2_LIBS) $(COM_ERR_LIBS) -lreadline -lncurses
+	$(LINK) $(GLIB_LIBS) $(LIBOCFS2_LIBS) $(LIBO2CB_LIBS) $(COM_ERR_LIBS) -lreadline -lncurses
 
 include $(TOPDIR)/Postamble.make

Modified: branches/global-heartbeat/debugfs.ocfs2/commands.c
===================================================================
--- branches/global-heartbeat/debugfs.ocfs2/commands.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/debugfs.ocfs2/commands.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -47,6 +47,7 @@
 static void do_ls (char **args);
 static void do_quit (char **args);
 static void do_help (char **args);
+static void do_hb (char **args);
 static void do_dump (char **args);
 static void do_rdump (char **args);
 static void do_cat (char **args);
@@ -72,6 +73,7 @@
 	{ "extent",	do_extent },
 	{ "group",	do_group },
 	{ "help",	do_help },
+	{ "hb",		do_hb },
 	{ "?",		do_help },
 	{ "lcd",	do_lcd },
 	{ "logdump",	do_logdump },
@@ -714,7 +716,6 @@
 
 	return ;
 }
-#if 0
 /*
  * do_hb()
  *
@@ -725,21 +726,18 @@
 	FILE *out;
 	int len;
 	errcode_t ret;
-	void (*dump_func) (FILE *out, char *buf);
 
 	if (check_device_open())
 		return ;
 
-	DBGFS_FATAL("internal");
-
 	ret = ocfs2_read_whole_file(gbls.fs, gbls.hb_blkno, &hbbuf, &len);
 	if (ret) {
 		com_err(args[0], ret, " ");
 		goto bail;
 	}
 
-	out = open_pager();
-	dump_func(out, hbbuf);
+	out = open_pager(gbls.interactive);
+	dump_hb(out, hbbuf, len);
 	close_pager(out);
 
 bail:
@@ -748,7 +746,6 @@
 
 	return ;
 }
-#endif
 
 /*
  * do_dump()

Modified: branches/global-heartbeat/debugfs.ocfs2/debugfs.ocfs2.8.in
===================================================================
--- branches/global-heartbeat/debugfs.ocfs2/debugfs.ocfs2.8.in	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/debugfs.ocfs2/debugfs.ocfs2.8.in	2005-09-06 02:01:13 UTC (rev 1072)
@@ -5,15 +5,20 @@
 \fBdebugfs.ocfs2\fR [\fB\-f\fR \fIcmdfile\fR] [\fB\-V\fR] [\fB\-w\fR] [\fB\-?\fR] [\fIdevice\fR]
 .SH "DESCRIPTION"
 .PP 
-The \fBdebugfs.ocfs2\fR is an interactive file system debugger. It can be used to examine the state of an OCFS2 filesystem. \fIdevice\fR is the special file corresponding the device containing the OCFS2 filesystem (e.g \fI/dev/hdxx\fR).
+The \fBdebugfs.ocfs2\fR is an interactive file system debugger. It can be
+used to examine the state of an OCFS2 filesystem. \fIdevice\fR is the
+special file corresponding the device containing the OCFS2 filesystem
+(e.g \fI/dev/hdxx\fR).
 .SH "OPTIONS"
 .TP
 \fB\-f, --file\fR \fIcmdfile\fR 
-Causes \fBdebugfs.ocfs2\fR to read in commands from \fIcmdfile\fR and execute them. It exits after all the commands are executed.
+Causes \fBdebugfs.ocfs2\fR to read in commands from \fIcmdfile\fR and
+execute them. It exits after all the commands are executed.
 
 .TP
 \fB\-w, --write\fR 
-Specifies that the filesystem should be opened in \fIread-write\fR mode. Without this option, the filesystem is opened in the \fIread-only\fR mode.
+Specifies that the filesystem should be opened in \fIread-write\fR mode.
+Without this option, the filesystem is opened in the \fIread-only\fR mode.
 
 .TP
 \fB\-V, --version\fR 
@@ -24,7 +29,19 @@
 Displays help and exit.
 
 .SH "SPECIFYING FILES"
-Many \fBdebugfs.ocfs2\fR commands take a \fIfilespec\fR as an argument to specify an inode (as opposed to a pathname) in the filesystem which is currently opened by \fBdebugfs.ocfs2\fR. The \fIfilespec\fR argument may be specified in two forms. The first form is an inode number surrounded by angle brackets, e.g., <32>. The second form is a pathname; if the pathname is prefixed by a forward slash ('/'), then it is interpreted relative to the root of the filesystem which is currently opened by \fBdebugfs.ocfs2\fR. If not, the path is interpreted relative to the current working directory as maintained by \fBdebugfs.ocfs2\fR, which can be modified using the command \fIcd\fR. If the pathname is prefixed by a double forward slash ('//'), then it is interpreted relative to the root of the system directory of the filesystem opened by \fBdebugfs.ocfs2\fR.
+Many \fBdebugfs.ocfs2\fR commands take a \fIfilespec\fR as an argument
+to specify an inode (as opposed to a pathname) in the filesystem which
+is currently opened by \fBdebugfs.ocfs2\fR. The \fIfilespec\fR argument
+may be specified in two forms. The first form is an inode number
+surrounded by angle brackets, e.g., <32>. The second form is a pathname;
+if the pathname is prefixed by a forward slash ('/'), then it is
+interpreted relative to the root of the filesystem which is currently
+opened by \fBdebugfs.ocfs2\fR. If not, the path is interpreted relative
+to the current working directory as maintained by \fBdebugfs.ocfs2\fR,
+which can be modified using the command \fIcd\fR. If the pathname is
+prefixed by a double forward slash ('//'), then it is interpreted relative
+to the root of the system directory of the filesystem opened by
+\fBdebugfs.ocfs2\fR.
 
 .SH "COMMANDS"
 This is a list of the commands which debugfs.ocfs2 supports.
@@ -51,7 +68,10 @@
 
 .TP
 \fIdump [-p] filespec outfile\fR
-Dump the contents of the inode \fIfilespec\fR to the output file \fIoutfile\fR. If the \fI-p\fR is given, set the owner, group, timestamps and permissions information on \fIoutfile\fR to match those of \fIfilespec\fR.
+Dump the contents of the inode \fIfilespec\fR to the output file
+\fIoutfile\fR. If the \fI-p\fR is given, set the owner, group,
+timestamps and permissions information on \fIoutfile\fR to match
+those of \fIfilespec\fR.
 
 .TP
 \fIextent block#\fR
@@ -67,7 +87,8 @@
 
 .TP
 \fIlcd directory\fR
-Change the current working directory of the \fBdebugfs.ocfs2\fR process to the \fIdirectory\fR on the native filesystem.
+Change the current working directory of the \fBdebugfs.ocfs2\fR process
+to the \fIdirectory\fR on the native filesystem.
 
 .TP
 \fIlogdump node#\fR
@@ -75,7 +96,8 @@
 
 .TP
 \fIls [-l] \fIfilespec\fR
-Print the listing  of the files in the directory \fIfilespec\fR. The \fI-l\fR flag will list files in the long format.
+Print the listing  of the files in the directory \fIfilespec\fR. The
+\fI-l\fR flag will list files in the long format.
 
 .TP
 \fIopen device\fR
@@ -87,7 +109,10 @@
 
 .TP
 \fIrdump [-v] filespec outdir\fR
-Recursively dump directory \fIfilespec\fR and all its contents (including regular files, symbolic links and other directories) into the \fIoutdir\fR which should be an existing directory on the native filesystem.
+Recursively dump directory \fIfilespec\fR and all its contents
+(including regular files, symbolic links and other directories) into
+the \fIoutdir\fR which should be an existing directory on the native
+filesystem.
 
 .TP
 \fIslotmap\fR
@@ -105,10 +130,15 @@
 This tool has been modelled after \fBdebugfs\fR, a debugging tool for ext2.
 
 .SH "SEE ALSO"
-.BR ocfs2(8)
+.BR mkfs.ocfs2(8)
+.BR fsck.ocfs2(8)
+.BR tunefs.ocfs2(8)
+.BR mounted.ocfs2(8)
+.BR ocfs2console(8)
+.BR ocfs2cdsl(8)
 
 .SH "AUTHOR"
 Oracle Corporation
 
 .SH "COPYRIGHT"
-Copyright \(co 2004 Oracle
+Copyright \(co 2004, 2005 Oracle. All rights reserved.

Modified: branches/global-heartbeat/debugfs.ocfs2/dump.c
===================================================================
--- branches/global-heartbeat/debugfs.ocfs2/dump.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/debugfs.ocfs2/dump.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -24,6 +24,7 @@
  */
 
 #include <main.h>
+#include <stdint.h>
 
 extern dbgfs_gbls gbls;
 
@@ -92,15 +93,15 @@
 	int i;
 
 	fprintf(out, "\tTotal Records: %u   Used: %u\n",
-		le16_to_cpu(tl->tl_count), le16_to_cpu(tl->tl_used));
+		tl->tl_count, tl->tl_used);
 
 	fprintf(out, "\t##   %-10s   %-10s\n", "Start Cluster",
 		"Num Clusters");
 
-	for(i = 0; i < le16_to_cpu(tl->tl_used); i++)
+	for(i = 0; i < tl->tl_used; i++)
 		fprintf(out, "\t%-2d   %-10u   %-10u\n",
-			i, le32_to_cpu(tl->tl_recs[i].t_start),
-			le32_to_cpu(tl->tl_recs[i].t_clusters));
+			i, tl->tl_recs[i].t_start,
+			tl->tl_recs[i].t_clusters);
 
 	return ;
 }
@@ -199,12 +200,12 @@
 	str = ctime((time_t*)&in->i_dtime);
 	fprintf(out, "\tdtime: 0x%"PRIx64" -- %s", in->i_dtime, str);
 
-	fprintf(out, "\tctime_nsec: 0x%x -- %u\n",
-		le32_to_cpu(in->i_ctime_nsec), le32_to_cpu(in->i_ctime));
-	fprintf(out, "\tatime_nsec: 0x%x -- %u\n",
-		le32_to_cpu(in->i_atime_nsec), le32_to_cpu(in->i_atime_nsec));
-	fprintf(out, "\tmtime_nsec: 0x%x -- %u\n",
-		le32_to_cpu(in->i_mtime_nsec), le32_to_cpu(in->i_mtime_nsec));
+	fprintf(out, "\tctime_nsec: 0x%08"PRIx32" -- %u\n",
+		in->i_ctime_nsec, in->i_ctime_nsec);
+	fprintf(out, "\tatime_nsec: 0x%08"PRIx32" -- %u\n",
+		in->i_atime_nsec, in->i_atime_nsec);
+	fprintf(out, "\tmtime_nsec: 0x%08"PRIx32" -- %u\n",
+		in->i_mtime_nsec, in->i_mtime_nsec);
 
 	fprintf(out, "\tLast Extblk: %"PRIu64"\n", in->i_last_eb_blk);
 	if (in->i_suballoc_slot == OCFS2_INVALID_SLOT)
@@ -400,10 +401,11 @@
 
 	fprintf (out, "\tError: %d\n", ntohl(jsb->s_errno));
 
-	/* XXX not sure what to do about swabbing these */
-	fprintf (out, "\tFeatures Compat: %u   Incompat: %u   RO Compat: %u\n",
-		 jsb->s_feature_compat, jsb->s_feature_incompat,
-		 jsb->s_feature_ro_compat);
+	fprintf (out, "\tFeatures Compat: 0x%"PRIx32"   "
+		 "Incompat: 0x%"PRIx32"   RO Compat: 0x%"PRIx32"\n",
+		 ntohl(jsb->s_feature_compat),
+		 ntohl(jsb->s_feature_incompat),
+		 ntohl(jsb->s_feature_ro_compat));
 
 	fprintf (out, "\tJournal UUID: ");
 	for(i = 0; i < 16; i++)
@@ -560,10 +562,32 @@
 	fprintf (out, "\t%5s   %5s\n", "Slot#", "Node#");
 	
 	for (i = 0; i < num_slots; ++i) {
-		if (slots[i] != -1)
-			fprintf (out, "\t%5d   %5d\n",
-				 i, slots[i]);
+		uint16_t slot = le16_to_cpu(slots[i]);
+		if (slot == (uint16_t)OCFS2_INVALID_SLOT)
+			continue;
+
+		fprintf (out, "\t%5d   %5u\n", i, slot);
 	}
 
 	return ;
 }
+
+void dump_hb (FILE *out, char *buf, uint32_t len)
+{
+	uint32_t i;
+	struct o2hb_disk_heartbeat_block *hb;
+
+	fprintf (out, "\t%4s: %4s %16s %16s %8s\n",
+		 "node", "node", "seq", "generation", "checksum");
+	
+	for (i = 0; i < 255 && ((i + 1) * 512 < len); ++i) {
+		hb = (struct o2hb_disk_heartbeat_block *)(buf + (i * 512));
+		ocfs2_swap_disk_heartbeat_block(hb);
+		fprintf (out, "\t%4u: %4u %016"PRIx64" %016"PRIx64" "
+			 "%08"PRIx32"\n", i,
+			 hb->hb_node, hb->hb_seq, hb->hb_generation,
+			 hb->hb_cksum);
+	}
+
+	return ;
+}

Modified: branches/global-heartbeat/debugfs.ocfs2/include/dump.h
===================================================================
--- branches/global-heartbeat/debugfs.ocfs2/include/dump.h	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/debugfs.ocfs2/include/dump.h	2005-09-06 02:01:13 UTC (rev 1072)
@@ -50,5 +50,6 @@
 void dump_jbd_unknown (FILE *out, uint64_t start, uint64_t end);
 void dump_slots (FILE *out, char *buf, uint32_t len);
 void dump_fast_symlink (FILE *out, char *link);
+void dump_hb (FILE *out, char *buf, uint32_t len);
 
 #endif		/* __DUMP_H__ */

Deleted: branches/global-heartbeat/debugfs.ocfs2/include/jbd.h
===================================================================
--- branches/global-heartbeat/debugfs.ocfs2/include/jbd.h	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/debugfs.ocfs2/include/jbd.h	2005-09-06 02:01:13 UTC (rev 1072)
@@ -1,124 +0,0 @@
-/*
- * jbd.h
- *
- * header file extracted from linux/include/linux/jbd.h
- *
- * Originally written by Stephen C. Tweedie <sct at redhat.com>
- *
- * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved
- *
- * This file is part of the Linux kernel and is made available under
- * the terms of the GNU General Public License, version 2, or at your
- * option, any later version, incorporated herein by reference.
- *
- * Definitions for transaction data structures for the buffer cache
- * filesystem journaling support.
- */
-
-#ifndef _JBD_H_
-#define _JBD_H_
-
-/*
- * Internal structures used by the logging mechanism:
- */
-
-#define JFS_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */
-
-/*
- * On-disk structures
- */
-
-/* 
- * Descriptor block types:
- */
-
-#define JFS_DESCRIPTOR_BLOCK	1
-#define JFS_COMMIT_BLOCK	2
-#define JFS_SUPERBLOCK_V1	3
-#define JFS_SUPERBLOCK_V2	4
-#define JFS_REVOKE_BLOCK	5
-
-/*
- * Standard header for all descriptor blocks:
- */
-typedef struct journal_header_s
-{
-	__u32		h_magic;
-	__u32		h_blocktype;
-	__u32		h_sequence;
-} journal_header_t;
-
-/* 
- * The block tag: used to describe a single buffer in the journal 
- */
-typedef struct journal_block_tag_s
-{
-	__u32		t_blocknr;	/* The on-disk block number */
-	__u32		t_flags;	/* See below */
-} journal_block_tag_t;
-
-/* 
- * The revoke descriptor: used on disk to describe a series of blocks to
- * be revoked from the log 
- */
-typedef struct journal_revoke_header_s
-{
-	journal_header_t r_header;
-	int		 r_count;	/* Count of bytes used in the block */
-} journal_revoke_header_t;
-
-/* Definitions for the journal tag flags word: */
-#define JFS_FLAG_ESCAPE		1	/* on-disk block is escaped */
-#define JFS_FLAG_SAME_UUID	2	/* block has same uuid as previous */
-#define JFS_FLAG_DELETED	4	/* block deleted by this transaction */
-#define JFS_FLAG_LAST_TAG	8	/* last tag in this descriptor block */
-
-/*
- * The journal superblock.  All fields are in big-endian byte order.
- */
-typedef struct journal_superblock_s
-{
-/* 0x0000 */
-	journal_header_t s_header;
-
-/* 0x000C */
-	/* Static information describing the journal */
-	__u32	s_blocksize;		/* journal device blocksize */
-	__u32	s_maxlen;		/* total blocks in journal file */
-	__u32	s_first;		/* first block of log information */
-	
-/* 0x0018 */
-	/* Dynamic information describing the current state of the log */
-	__u32	s_sequence;		/* first commit ID expected in log */
-	__u32	s_start;		/* blocknr of start of log */
-
-/* 0x0020 */
-	/* Error value, as set by journal_abort(). */
-	__s32	s_errno;
-
-/* 0x0024 */
-	/* Remaining fields are only valid in a version-2 superblock */
-	__u32	s_feature_compat; 	/* compatible feature set */
-	__u32	s_feature_incompat; 	/* incompatible feature set */
-	__u32	s_feature_ro_compat; 	/* readonly-compatible feature set */
-/* 0x0030 */
-	__u8	s_uuid[16];		/* 128-bit uuid for journal */
-
-/* 0x0040 */
-	__u32	s_nr_users;		/* Nr of filesystems sharing log */
-	
-	__u32	s_dynsuper;		/* Blocknr of dynamic superblock copy*/
-	
-/* 0x0048 */
-	__u32	s_max_transaction;	/* Limit of journal blocks per trans.*/
-	__u32	s_max_trans_data;	/* Limit of data blocks per trans. */
-
-/* 0x0050 */
-	__u32	s_padding[44];
-
-/* 0x0100 */
-	__u8	s_users[16*48];		/* ids of all fs'es sharing the log */
-/* 0x0400 */
-} journal_superblock_t;
-
-#endif		/* _JBD_H_ */

Copied: branches/global-heartbeat/documentation/migrate_from_ocfs.sxw (from rev 1071, trunk/documentation/migrate_from_ocfs.sxw)

Modified: branches/global-heartbeat/documentation/ocfs2_faq.txt
===================================================================
--- branches/global-heartbeat/documentation/ocfs2_faq.txt	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/documentation/ocfs2_faq.txt	2005-09-06 02:01:13 UTC (rev 1072)
@@ -1,23 +1,27 @@
-/* -*- mode: txt; c-basic-offset: 4; -*-
- * vim: noexpandtab sw=4 ts=4 sts=0:
- */
 
+		OCFS2 - Frequently Asked Questions
+		==================================
+
 General
 -------
 
-Q01 How do I get started?
-A01 a) Download and install the module and tools rpms.
+Q01	How do I get started?
+A01	a) Download and install the module and tools rpms.
 	b) Create cluster.conf and propagate to all nodes.
 	c) Configure and start the O2CB cluster service.
 	d) Format the volume.
 	e) Mount the volume.
+
+Q02	How do I know the version number running?
+A02	# cat /proc/fs/ocfs2/version
+	OCFS2 1.0.0 Tue Aug  2 17:38:59 PDT 2005 (build e7bd36709a2c1cb875cf2d533a018f20)
 ==============================================================================
 
 Download and Install
 --------------------
 
-Q01 How do I download the rpms?
-A01 If you are on Novell's SLES9, upgrade to SP2 and you will have the
+Q01	How do I download the rpms?
+A01	If you are on Novell's SLES9, upgrade to SP2 and you will have the
 	required module installed. However, you will be required to install
 	ocfs2-tools and ocfs2console rpms from the distribution.
 	If you are on Red Hat's EL4, download and install the appropriate module
@@ -25,26 +29,46 @@
 	module refers to one matching the kernel flavor, uniprocessor, smp or
 	hugemem.
 
-Q02 How do I install the rpms?
-A02 You can install all three rpms in one go using:
-	rpm -ivh ocfs2-tools-X.i386.rpm ocfs2console-X.i386.rpm ocfs2-2.6.9-11.ELsmp-X.i686.rpm
+Q02	How do I install the rpms?
+A02	You can install all three rpms in one go using:
+	rpm -ivh ocfs2-tools-X.i386.rpm ocfs2console-X.i386.rpm
+		ocfs2-2.6.9-11.ELsmp-X.i686.rpm
 	If you need to upgrade, do:
 	rpm -Uvh ocfs2-2.6.9-11.ELsmp-Y.i686.rpm
 
-Q03 Do I need to install the console?
-A03 No, the console is recommended but not required.
+Q03	Do I need to install the console?
+A03	No, the console is recommended but not required.
 
 Q04	What are the dependencies for installing ocfs2console?
-A04	ocfs2console requires e2fsprogs, glib2 2.2.3 or later, vte 0.11.10 or later,
-	pygtk2 (EL4) or python-gtk (SLES9) 1.99.16 or later, python 1.99.16 or later
-	and ocfs2-tools.
+A04	ocfs2console requires e2fsprogs, glib2 2.2.3 or later, vte 0.11.10 or
+	later, pygtk2 (EL4) or python-gtk (SLES9) 1.99.16 or later,
+	python 2.3 or later and ocfs2-tools.
+
+Q05	What modules are installed with the OCFS2 package?
+A05	a) configfs.ko
+	b) ocfs2.ko
+	c) ocfs2_dlm.ko
+	d) ocfs2_dlmfs.ko
+	e) ocfs2_nodemanager.ko
+
+Q06	What tools are installed with the tools package?
+A06	a) mkfs.ocfs2
+	b) fsck.ocfs2
+	c) tunefs.ocfs2
+	d) debugfs.ocfs2
+	e) mount.ocfs2
+	f) mounted.ocfs2
+	g) ocfs2cdsl
+	h) ocfs2_hb_ctl
+	i) o2cb_ctl
+	j) ocfs2console - installed with the console package
 ==============================================================================
 
 Configure
 ---------
 
-Q01 How do I populate /etc/ocfs2/cluster.conf?
-A01 If you have installed the console, use it to create this
+Q01	How do I populate /etc/ocfs2/cluster.conf?
+A01	If you have installed the console, use it to create this
 	configuration file. For details, refer to the user's guide.
 	If you do not have the console installed, check the Appendix in the
 	User's guide for a sample cluster.conf and the details of all the
@@ -52,20 +76,28 @@
 	Do not forget to copy this file to all the nodes in the cluster.
 	If you ever edit this file on any node, ensure the other nodes are
 	updated as well.
+
+Q02	Should the IP interconnect be public or private?
+A02	Using a private interconnect is recommended. While OCFS2 does not
+	take much bandwidth, it does require the nodes to be alive on the
+	network and sends regular keepalive packets to ensure that they are.
+	To avoid a network delay being interpreted as a node disappearing on
+	the net leading to a STONITH, a private interconnect is recommended.
+	One could use the same interconnect for Oracle RAC and OCFS2.
 ==============================================================================
 
 O2CB Cluster Service
 --------------------
 
-Q01 How do I configure the cluster service?
-A01 # /etc/init.d/o2cb configure
+Q01	How do I configure the cluster service?
+A01	# /etc/init.d/o2cb configure
 	Enter 'y' if you want the service to load on boot and the name of
 	the cluster (as listed in /etc/ocfs2/cluster.conf).
 
 Q02	How do I start the cluster service?
-A02	a) Load the modules as:
+A02	a) To load the modules, do:
 		# /etc/init.d/o2cb load
-	b) Online it as:
+	b) To Online it, do:
 		# /etc/init.d/o2cb online [cluster_name]
 	If you have configured the cluster to load on boot, you could
 	combine the two as follows:
@@ -73,10 +105,10 @@
 	The cluster name is not required if you have specified the name
 	during configuration.
 
-Q03 How do I stop the cluster service?
-A03	a) Offline it as:
+Q03	How do I stop the cluster service?
+A03	a) To offline it, do:
 		# /etc/init.d/o2cb offline [cluster_name]
-	b) Unload the modules as:
+	b) To unload the modules, do:
 		# /etc/init.d/o2cb unload
 	If you have configured the cluster to load on boot, you could
 	combine the two as follows:
@@ -85,7 +117,7 @@
 	during configuration.
 
 Q04	How can I learn the status of the cluster?
-A04	Use the status command as follows:
+A04	To learn the status of the cluster, do:
 		# /etc/init.d/o2cb status
 
 Q05	I am unable to get the cluster online. What could be wrong?
@@ -97,9 +129,9 @@
 Format
 ------
 
-Q01 How do I format a volume?
-A01	You could either use the console or use mkfs.ocfs2 directly to format the
-	volume.  For console, refer to the user's guide.
+Q01	How do I format a volume?
+A01	You could either use the console or use mkfs.ocfs2 directly to format
+	the volume.  For console, refer to the user's guide.
 		# mkfs.ocfs2 -L "oracle_home" /dev/sdX
 	The above formats the volume with default block and cluster sizes,
 	which are computed based upon the size of the volume.
@@ -107,7 +139,7 @@
 	The above formats the volume for 4 nodes with a 4K block size and a
 	32K cluster size.
 
-Q02	What does the number of node slots during format mean?
+Q02	What does the number of node slots during format refer to?
 A02	The number of node slots specifies the number of nodes that can
 	concurrently mount the volume. This number is specified during
 	format and can be increased using tunefs.ocfs2. This number cannot
@@ -120,8 +152,8 @@
 	increased, there is no need to specify a much larger number than one
 	plans for mounting the volume.
 
-Q04 Does the number of node slots have to be the same for all volumes?
-A04 No. This number can be different for each volume.
+Q04	Does the number of node slots have to be the same for all volumes?
+A04	No. This number can be different for each volume.
 
 Q05	What block size should I use?
 A05	A block size is the smallest unit of space addressable by the file
@@ -131,16 +163,18 @@
 	block is never recommended.
 
 Q06	What cluster size should I use?
-A06 A cluster size is the smallest unit of space allocated to a file to
+A06	A cluster size is the smallest unit of space allocated to a file to
 	hold the data. OCFS2 supports cluster sizes of 4K, 8K, 16K, 32K,
 	64K, 128K, 256K, 512K and 1M. For database volumes, a cluster size
 	of 128K or larger is recommended. For Oracle home, 32K to 64K.
 
-Q07	Any advantage of labeling the volumes?
-A07	As in a shared disk environment, the disk names (/dev/sdX) could
-	change from boot to boot, labeling becomes a must for easy identification.
-	You could also mount volumes by label using the (mount -L "label"
-	command). The label is changeable using the tunefs.ocfs2 utility.
+Q07	Any advantage of labelling the volumes?
+A07	As in a shared disk environment, the disk name (/dev/sdX) for a
+	particular device be different on different nodes, labelling becomes
+	a must for easy identification.
+	You could also use labels to identify volumes during mount.
+		# mount -L "label" /dir
+	The volume label is changeable using the tunefs.ocfs2 utility.
 ==============================================================================
 
 Mount
@@ -159,8 +193,8 @@
 Q03	What entry to I add to /etc/fstab to mount an ocfs2 volume?
 A03	Add the following:
 		/dev/sdX	/dir	ocfs2	noauto,_netdev	0	0
-	The _netdev option indicates that the devices needs to be mounted after the
-	network is up.
+	The _netdev option indicates that the devices needs to be mounted after
+	the network is up.
 
 Q04	What all do I need to do to automount OCFS2 volumes on boot?
 A04	a) Enable o2cb service using:
@@ -180,12 +214,18 @@
 	mount command reads the /etc/mtab to show the information.
 
 Q06	What are the /config and /dlm mountpoints for?
-A06	OCFS2 comes bundled with two in-memory filesystems configfs and ocfs2_dlmfs.
-	configfs is used by the ocfs2 tools to communicate to the in-kernel
-	node manager the list of nodes in the cluster and to the in-kernel
-	heartbeat thread the resource to heartbeat on.
+A06	OCFS2 comes bundled with two in-memory filesystems configfs and
+	ocfs2_dlmfs. configfs is used by the ocfs2 tools to communicate to the
+	in-kernel node manager the list of nodes in the cluster and to the
+	in-kernel heartbeat thread the resource to heartbeat on.
 	ocfs2_dlmfs is used by ocfs2 tools to communicate with the in-kernel
 	dlm to take and release clusterwide locks on resources.
+
+Q07	Why does it take so much time to mount the volume?
+A07	It takes around 5 secs for a volume to mount. It does so so as
+	to let the heartbeat thread stabilize. In a later release, we
+	plan to add support for a global heartbeat, which will make most
+	mounts instant.
 ==============================================================================
 
 Oracle RAC
@@ -193,7 +233,7 @@
 
 Q01	Any special flags to run Oracle RAC?
 A01	OCFS2 volumes containing the Voting diskfile (CRS), Cluster registry
-	(OCR), Data files, Redo logs, Archive logs and control files should
+	(OCR), Data files, Redo logs, Archive logs and control files must 
 	be mounted with the "datavolume" mount option. This is to ensure
 	that the Oracle processes open these files with the o_direct flag.
 
@@ -208,3 +248,84 @@
 	should never be on the same volume as the distribution (including the
 	trace logs like, alert.log).
 ==============================================================================
+
+Moving data from OCFS (Release 1) and OCFS2
+-------------------------------------------
+
+Q01	Can I mount OCFS volumes as OCFS2?
+A01	No. OCFS and OCFS2 are not on-disk compatible. We had to break the
+	compatibility in order to add many of the new features. At the same
+	time, we have added enough flexibility in the new disk layout so as to
+	maintain backward compatibility in the future.
+
+Q02	Can OCFS volumes and OCFS2 volumes be mounted on the same machine
+	simultaneously?
+A02	No. OCFS only works on 2.4 linux kernels (Red Hat's AS2.1/EL3 and SuSE's
+	SLES8).  OCFS2, on the other hand, only works on the 2.6 kernels
+	(Red Hat's EL4 and SuSE's SLES9).
+
+Q03	Can I access my OCFS volume on 2.6 kernels (SLES9/RHEL4)?
+A03	Yes, you can access the OCFS volume on 2.6 kernels using FSCat
+	tools, fsls and fscp. These tools can access the OCFS volumes at the
+	device layer, to list and copy the files to another filesystem.
+	FSCat tools are available on oss.oracle.com.
+
+Q04	Can I in-place convert my OCFS volume to OCFS2?
+A04	No. The on-disk layout of OCFS and OCFS2 are sufficiently different
+	that it would require a third disk (as a temporary buffer) inorder to
+	in-place upgrade the volume. With that in mind, it was decided not to
+	develop such a tool but instead provide tools to copy data from OCFS
+	without one having to mount it.
+
+Q05	What is the quickest way to move data from OCFS to OCFS2?
+A05	Quickest would mean having to perform the minimal number of copies.
+	If you have the current backup on a non-OCFS volume accessible from
+	the 2.6 kernel install, then all you would need to do is to retore
+	the backup on the OCFS2 volume(s). If you do not have a backup but
+	have a setup in which the system containing the OCFS2 volumes can
+	access the disks containing the OCFS volume, you can use the FSCat
+	tools to extract data from the OCFS volume and copy onto OCFS2.
+==============================================================================
+
+Coreutils
+---------
+
+Q01	Like with OCFS (Release 1), do I need to use o_direct enabled tools
+	to perform cp, mv, tar, etc.?
+A01	No. OCFS2 does not need the o_direct enabled tools. The file system
+	allows processes to open files in both o_direct and bufferred mode
+	concurrently.
+==============================================================================
+
+Troubleshooting
+---------------
+
+Q01	How do I enable and disable tracing?
+A01	To list all the debug bits along with their statuses, do:
+		# cat /proc/fs/ocfs2_nodemanager/log_mask
+	To enable tracing the bit SUPER, do:
+		# echo "SUPER allow" > /proc/fs/ocfs2_nodemanager/log_mask
+	To disable tracing the bit SUPER, do:
+		# echo "SUPER off" > /proc/fs/ocfs2_nodemanager/log_mask
+	To totally turn off tracing the SUPER bit, as in, turn off
+	tracing even if some other bit is enabled for the same, do:
+		# echo "SUPER deny" > /proc/fs/ocfs2_nodemanager/log_mask
+
+Q02	Is there a more convenient way to enable and disable tracing?
+A02	Yes, using debugfs.ocfs2.
+	To list all the debug bits along with their statuses, do:
+		# debugfs.ocfs2 -l
+	To enable heartbeat tracing, do:
+		# debugfs.ocfs2 -l HEARTBEAT ENTRY EXIT allow 
+	To disable heartbeat tracing, do:
+		# debugfs.ocfs2 -l HEARTBEAT off ENTRY EXIT deny
+==============================================================================
+
+Directories
+-----------
+
+Q01	Any limits to the number of sub-directories?
+A01	Yes. OCFS2 currently allows upto 32000 sub-directories. While this
+	limit could be increased, we will not be doing it till we
+	implement some kind of efficient name lookup (htree, etc.).
+==============================================================================

Modified: branches/global-heartbeat/documentation/users_guide.sxw
===================================================================
(Binary files differ)

Modified: branches/global-heartbeat/extras/find_dup_extents.c
===================================================================
--- branches/global-heartbeat/extras/find_dup_extents.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/extras/find_dup_extents.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -184,6 +184,8 @@
 				   strlen(OCFS2_INODE_SIGNATURE)))
 				continue;
 
+			ocfs2_swap_inode_to_cpu(di);
+
 			if (!(di->i_flags & OCFS2_VALID_FL))
 				continue;
 

Modified: branches/global-heartbeat/fsck.ocfs2/fsck.ocfs2.8.in
===================================================================
--- branches/global-heartbeat/fsck.ocfs2/fsck.ocfs2.8.in	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/fsck.ocfs2/fsck.ocfs2.8.in	2005-09-06 02:01:13 UTC (rev 1072)
@@ -1,6 +1,6 @@
 .TH "fsck.ocfs2" "8" "March 2005" "Version @VERSION@" "OCFS2 Manual Pages"
 .SH "NAME"
-fsck.ocfs2 \- Check an OCFS2 file system.
+fsck.ocfs2 \- Check an \fIOCFS2\fR file system.
 .SH "SYNOPSIS"
 \fBfsck.ocfs2\fR [ \fB\-fFGnuvVy\fR ] [ \fB\-b\fR \fIsuperblock block\fR ] [ \fB\-B\fR \fIblock size\fR ] \fIdevice\fR
 .SH "DESCRIPTION"
@@ -82,12 +82,18 @@
 .br
 
 .SH "SEE ALSO"
-.BR ocfs2(8)
+.BR mkfs.ocfs2(8)
+.BR debugfs.ocfs2(8)
+.BR tunefs.ocfs2(8)
+.BR mounted.ocfs2(8)
+.BR ocfs2console(8)
+.BR ocfs2cdsl(8)
 
+
 .SH "AUTHORS"
 Oracle Corporation.  This man page entry derives some text, especially the exit code summary, from
 .BR e2fsck(8)
 by Theodore Ts’o <tytso at mit.edu>. 
 
 .SH "COPYRIGHT"
-Copyright \(co 2004 Oracle Corporation
+Copyright \(co 2004, 2005 Oracle. All rights reserved.

Modified: branches/global-heartbeat/fsck.ocfs2/fsck.ocfs2.checks.8.in
===================================================================
--- branches/global-heartbeat/fsck.ocfs2/fsck.ocfs2.checks.8.in	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/fsck.ocfs2/fsck.ocfs2.checks.8.in	2005-09-06 02:01:13 UTC (rev 1072)
@@ -6,11 +6,15 @@
 .SH "DESCRIPTION"
 .PP 
 .BR fsck.ocfs2(8)
-is used to check an OCFS2 file system.  It performs many consistenty checks and will offer to fix faults that it finds.  This man page lists the problems it may find and describes their fixes.  The problems are indexed by the error number that 
+is used to check an OCFS2 file system.  It performs many consistenty checks
+and will offer to fix faults that it finds.  This man page lists the problems
+it may find and describes their fixes.  The problems are indexed by the error
+number that 
 .BR fsck.ocfs2(8)
 emits when it describes the problem and asks if it should be fixed.
 
-The prompts are constructed such that answering 'no' results in no changes to the file system.  This may result in errors later on that stop 
+The prompts are constructed such that answering 'no' results in no changes
+to the file system.  This may result in errors later on that stop 
 .BR fsck.ocfs2(8)
 from proceeding.
 
@@ -31,8 +35,8 @@
 contains a generation number that doesn't match.
 
 Answering yes implies that the generation number is correct and that the
-extent block is from a previous file system.  The extent block will be ignored 
-and the file that contains it will lose the data it referenced.
+extent block is from a previous file system.  The extent block will be
+ignored and the file that contains it will lose the data it referenced.
 
 .SS "EB_GEN_FIX"
 Extent blocks are created with a generation number to match the generation
@@ -44,28 +48,33 @@
 block is updated to match the generation number in the volume.
 
 .SS "EXTENT_BLKNO_UNALIGNED"
-The block that marks the start of an extent should always fall on the start of a cluster.  An extent was found that starts part-way into a cluster.
+The block that marks the start of an extent should always fall on the start
+of a cluster.  An extent was found that starts part-way into a cluster.
 
 Answering yes moves the start of the extent back to the start of the addressed
-cluster.  This may add data to the middle of the file that contains this extent.
+cluster.  This may add data to the middle of the file that contains this
+extent.
 
 .SS "EXTENT_CLUSTERS_OVERRUN"
-An extent was found which claims to contain clusters which are beyond the end of the volume.
+An extent was found which claims to contain clusters which are beyond the
+end of the volume.
 
-Answering yes clamps the extent to the end of the volume.  This may result in a
-reduced file size for the file that contains the extent, but it couldn't have
-addressed those final clusters anyway.  One can imagine this problem arising if
-there are problems shrinking a volume.
+Answering yes clamps the extent to the end of the volume.  This may result
+in a reduced file size for the file that contains the extent, but it
+couldn't have addressed those final clusters anyway.  One can imagine this
+problem arising if there are problems shrinking a volume.
 
 .SS "EXTENT_EB_INVALID"
-Deep extent trees are built by forming a tree out of extent blocks.  An extent tree references an invalid extent block.
+Deep extent trees are built by forming a tree out of extent blocks.  An
+extent tree references an invalid extent block.
 
 Answering yes stops the tree from referencing the invalid extent block.  This
 may truncate data from the file which contains the tree.
 
 .SS "EXTENT_LIST_DEPTH"
 Extent lists contain a record of their depth in the tree.  An extent list
-was found whose recorded depth doesn't match the position they have in the tree.
+was found whose recorded depth doesn't match the position they have in the
+tree.
 
 Answering yes updates the depth field in the list to match the tree on disk.
 
@@ -74,21 +83,22 @@
 inode or the size of the block which contains it.  An extent list was found
 which claims to have more entries than would fit in its container.
 
-Answering yes updates the count field in the exent list to match the container.
-Answering no to this question may stop further fixes from being done because
-the count value can not be trusted.
+Answering yes updates the count field in the exent list to match the
+container. Answering no to this question may stop further fixes from being
+done because the count value can not be trusted.
 
 .SS "EXTENT_LIST_FREE"
 The number of free entries in an extent list must be less than the total
-number of entries in the list.   A list was found which claims to have more free entries than possible entries.
+number of entries in the list.   A list was found which claims to have more
+free entries than possible entries.
 
 Answering yes sets the number of free entries in the list equal to the total
 possible entries.
 
 .SS "EXTENT_BLKNO_RANGE"
-An extent record was found which references a block which can not be referenced
-by an extent.  The referenced block is either very early in the volume, and
-thus reserved, or beyond the end of the volume.
+An extent record was found which references a block which can not be
+referenced by an extent.  The referenced block is either very early in the
+volume, and thus reserved, or beyond the end of the volume.
 
 Answering yes removes this extent record from the tree.  This may remove data
 from the file which owns the tree but any such data was inaccesible.
@@ -105,8 +115,8 @@
 
 .SS "GROUP_EXPECTED_DESC"
 The group descriptors that make up the global bitmap chain allocator reside
-at predictable locations on disk.  A group descriptor at one of these locations
-was not linked into the global bitmap allocator.
+at predictable locations on disk.  A group descriptor at one of these
+locations was not linked into the global bitmap allocator.
 
 Answering yes will relink this group into the allocator.
 
@@ -127,15 +137,17 @@
 
 .SS "GROUP_BLKNO"
 Group descriptors have a field which records their block location on disk.  A
-group descriptor was found at a given location but is recorded as being located
-somewhere else.
+group descriptor was found at a given location but is recorded as being
+located somewhere else.
 
 Answering yes updates the group descriptor's recorded location to match where
 it actually is found on disk.
 
 .SS "GROUP_CHAIN"
 Group descriptors are found in a number of different singly-linked chains
-in an allocator inode.  A group descriptor records the chain number that it is linked in.  A group descriptor was found whose chain field doesn't match the chain it was found in.
+in an allocator inode.  A group descriptor records the chain number that it
+is linked in.  A group descriptor was found whose chain field doesn't match
+the chain it was found in.
 
 Answering yes sets the group descriptor's chain field to match the chain
 it is found in.
@@ -171,6 +183,23 @@
 Answering yes will remove the unused chain and shift the remaining chains
 forward in the list.
 
+.SS "CHAIN_I_CLUSTERS"
+Chain allocator inodes have an i_clusters value that represents the number
+of clusters used by the allocator.  An inode was found whose i_clusters
+value doesn't match the number of clusters its chains cover.
+
+Answering yes updates i_clusters in the inode to reflect what was actually
+found by walking the chain.
+
+.SS "CHAIN_I_SIZE"
+Chain allocator inodes multiply the number of bytes per cluster
+by the their i_clusters value and store it in i_size.  An inode was found
+which didn't have the correct value in its i_size.
+
+Answering yes updates i_size to be the product of i_clusters and the cluster
+size.  Nothing else uses this value, and previous versions of tools didn't
+calculate it properly, so don't be too worried if this error appears.
+
 .SS "CHAIN_GROUP_BITS"
 The inode that contains an embedded chain list has fields which record the
 total number of bits covered by the chain as well as the amount free.  These 
@@ -183,7 +212,8 @@
 The header that starts a chain tried to reference a group descriptor at
 a block number that couldn't be valid.
 
-Answering yes will clear the reference to this invalid block and truncate the chain that it started.
+Answering yes will clear the reference to this invalid block and truncate
+the chain that it started.
 
 .SS "CHAIN_LINK_GEN"
 A reference was made to a group descriptor whose generation number doesn't
@@ -191,8 +221,8 @@
 
 Answering yes to this question implies that the group descriptor is invalid
 and the chain is truncated at the point that it referred to this invalid
-group descriptor.  Answering no to this question considers the group descriptor
-as valid and its generation may be fixed.
+group descriptor.  Answering no to this question considers the group
+descriptor as valid and its generation may be fixed.
 
 .SS "CHAIN_LINK_MAGIC"
 Chains are built by chain headers and group descriptors which are linked
@@ -229,7 +259,8 @@
 The inode allocator did not accurately reflect the set of inodes that are
 free and in use in the volume.
 
-Answering yes will update the inode allocator bitmaps.  Each bit that doesn't match the state of its inode will be inverted.
+Answering yes will update the inode allocator bitmaps.  Each bit that
+doesn't match the state of its inode will be inverted.
 
 .SS "INODE_SUBALLOC"
 Each inode records the node whose allocator is responsible for the inode.  An
@@ -244,8 +275,8 @@
 clusters in batches.  A node's local allocator claims to reflect more bytes
 than are possible for the volume's block size.
 
-Answering yes decreses the local allocator's size to reflect the volume's block
-size.
+Answering yes decreses the local allocator's size to reflect the volume's
+block size.
 
 .SS "LALLOC_NZ_USED"
 A given node's local allocator isn't in use but it claims to have bits
@@ -293,8 +324,9 @@
 A local allocator inode was found to have problems.  This gives the operator
 a chance to just reset the local allocator inode. 
 
-Answering yes clears the local allocator.  No information is lost but the global
-bitmap allocator may need to be updated to reflect clusters that were reserved for the local allocator but were free.
+Answering yes clears the local allocator.  No information is lost but the
+global bitmap allocator may need to be updated to reflect clusters that were
+reserved for the local allocator but were free.
 
 .SS "DEALLOC_COUNT"
 The given truncate log inode contains a count that is greater than the 
@@ -318,17 +350,17 @@
 allocator is updated to match what is used by the file system.
 
 .SS "TRUNCATE_REC_WRAP"
-Clusters are recorded as 32bit values.  A truncate record was found which claims
-to have enough clusters to cause this value to wrap.  This could never be the case and
-is a sure sign of corruption.
+Clusters are recorded as 32bit values.  A truncate record was found which
+claims to have enough clusters to cause this value to wrap.  This could
+never be the case and is a sure sign of corruption.
 
 Answering yes will clear the truncate record.  This may result in previously
 freed space being marked as allocated.  This will be fixed up later as the
 allocator is updated to match what is used by the file system.
 
 .SS "TRUNCATE_REC_RANGE"
-A truncate record was found which claims to reference a region of clusters which
-partially extends beyond the number of clusters in the volume.
+A truncate record was found which claims to reference a region of clusters
+which partially extends beyond the number of clusters in the volume.
 
 Answering yes will clear the truncate record.  This may result in previously
 freed space being marked as allocated.  This will be fixed up later as the
@@ -352,7 +384,8 @@
 inode is updated to match the generation number in the volume.
 
 .SS "INODE_BLKNO"
-Inodes contain a field that must match the block that they reside in.  An inode was found at a block that doesn't match the field in the inode.
+Inodes contain a field that must match the block that they reside in. 
+An inode was found at a block that doesn't match the field in the inode.
 
 Answering yes updates the field to match the inode's position on disk.
 
@@ -387,13 +420,16 @@
 Answering yes clears the inode and so deletes the link.
 
 .SS "LINK_SIZE"
-The size of a link on disk must match the length of its target string.  A link was found whose size does not.
+The size of a link on disk must match the length of its target string.
+A link was found whose size does not.
 
 Answering yes updates the link's size to reflect the length of its target
 string.
 
 .SS "LINK_BLOCKS"
-Links can not be sparse.  There must be exactly as many blocks allocated as are needed to cover its size.  A link was found which doesn't have enough blocks allocated to cover its size.
+Links can not be sparse.  There must be exactly as many blocks allocated
+as are needed to cover its size.  A link was found which doesn't have enough
+blocks allocated to cover its size.
 
 Answering yes clears the link's inode and so deletes the link.
 
@@ -404,6 +440,17 @@
 Answering yes to this question clears the directorie's inode and so
 deletes the directory.
 
+.SS "INODE_SIZE"
+Certain inodes record the size of the data they reference in an i_size field.
+This can be the number of bytes in a file, directory, or symlink target
+which are stored in data mapped by extents of clusters.  This error occurs
+when the extent lists are walked and the amount of data found does not match
+what is stored in i_size.
+
+Answering yes to this question updates the inode's i_size to match the amount
+of data referenced by the extent lists.  It is vitally important that i_size
+matches the extent lists and so answering yes is strongly encouraged.
+
 .SS "INODE_CLUSTERS"
 Inodes contain a record of how many clusters are allocated to them.  An inode
 was found whose recorded number of clusters doesn't match the number of blocks
@@ -431,13 +478,14 @@
 A specific cluster's use didn't match the setting of its bit in the cluster
 allocator.
 
-Answering yes will invert the bit in the allocator to match the use of the cluster -- either allocated and in use or free.
+Answering yes will invert the bit in the allocator to match the use of the
+cluster -- either allocated and in use or free.
 
 \" pass2.c
 
 .SS "DIRENT_DOTTY_DUP"
-There can be only one instance of both the "." and ".." entries in a directory.
-A directory entry was found which duplicated one of these entries.
+There can be only one instance of both the "." and ".." entries in a
+directory. A directory entry was found which duplicated one of these entries.
 
 Answering yes will remove the duplicate directory entry.
 
@@ -501,10 +549,13 @@
 Answering yes resets the entry's type to match the target inode.
 
 .SS "DIR_PARENT_DUP"
-Each directory can only be pointed to by one directory entry in a parent directory.  A directory entry was found which was the second entry to point to a given
-directory inode.
+Each directory can only be pointed to by one directory entry in a parent
+directory.  A directory entry was found which was the second entry to point
+to a given directory inode.
 
-Answering yes clears this entry which was the second to refer to a given directory.  This reflects the policy that hard links to directories are not allowed.
+Answering yes clears this entry which was the second to refer to a given
+directory.  This reflects the policy that hard links to directories are not
+allowed.
 
 .SS "DIRENT_DUPLICATE"
 File names within a directory must be unique.  A file name occurred in more
@@ -515,25 +566,28 @@
 the directory.
 
 .SS "DIRENT_LENGTH"
-There are very few directory entry lengths that are valid.  The lengths must be
-greater than the minimum required to record a single character directory, be
-rounded to 12 bytes, be within the amount of space remaining in a directory
-block, and be properly rounded for the size of the name of the directory entry.
-An entry was found which didn't meet these criteria.
+There are very few directory entry lengths that are valid.  The lengths must
+be greater than the minimum required to record a single character directory,
+be rounded to 12 bytes, be within the amount of space remaining in a directory
+block, and be properly rounded for the size of the name of the directory
+entry. An entry was found which didn't meet these criteria.
 
 Answering yes will try to repair the directory entry.  This runs a very good
-chance of invalidating all the entries in the directory block.  Orphaned inodes
-may appear in lost+found.
+chance of invalidating all the entries in the directory block.  Orphaned
+inodes may appear in lost+found.
 
 \" pass3.c
 
 .SS "ROOT_DIR_MISSING"
-The super block contains a reference to the inode that serves as the root directory.  This reference points to an inode that isn't in use.
+The super block contains a reference to the inode that serves as the root
+directory.  This reference points to an inode that isn't in use.
 
-Answering yes will create a new inode and update the super block to refer to this inode as the root directory.
+Answering yes will create a new inode and update the super block to refer
+to this inode as the root directory.
 
 .SS "LOSTFOUND_MISSING"
-The super block contains a reference to the inode that serves as the lost+found directory.  This reference points to an inode that isn't in use.
+The super block contains a reference to the inode that serves as the
+lost+found directory.  This reference points to an inode that isn't in use.
 
 Answering yes will create a new lost+found directory in the root directory.
 
@@ -556,7 +610,8 @@
 \" pass4.c
 
 .SS "INODE_NOT_CONNECTED"
-Most all inodes in the system should be referenced by a directory entry. An inode was found which isn't referred to by any directory entry.
+Most all inodes in the system should be referenced by a directory entry. An
+inode was found which isn't referred to by any directory entry.
 
 Answering yes moves this inode into the lost+found directory and 
 gives it a name based on its inode number.
@@ -566,7 +621,8 @@
 was found whose recorded count doesn't match the number of entries that
 refer to it.
 
-Answering yes sets the inode's count to match the number of referring directory entries.
+Answering yes sets the inode's count to match the number of referring
+directory entries.
 
 .SS "INODE_ORPHANED"
 While files are being deleted they are placed in an internal directory.  If
@@ -578,10 +634,10 @@
 the inode.
 
 .SH "SEE ALSO"
-.BR ocfs2(8)
+.BR fsck.ocfs2(8)
 
 .SH "AUTHORS"
 Oracle Corporation.
 
 .SH "COPYRIGHT"
-Copyright \(co 2004 Oracle Corporation
+Copyright \(co 2004, 2005 Oracle. All rights reserved.

Modified: branches/global-heartbeat/fsck.ocfs2/journal.c
===================================================================
--- branches/global-heartbeat/fsck.ocfs2/journal.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/fsck.ocfs2/journal.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -41,12 +41,10 @@
 #include <string.h>
 #include <inttypes.h>
 
+#include "byteorder.h"
 #include "fsck.h"
 #include "journal.h"
-/* jfs_compat.h defines these */
-#undef cpu_to_be32
-#undef be32_to_cpu
-#include "jfs_user.h"
+#include "jbd.h"
 #include "ocfs2.h"
 #include "pass1.h"
 #include "problem.h"

Modified: branches/global-heartbeat/fsck.ocfs2/pass0.c
===================================================================
--- branches/global-heartbeat/fsck.ocfs2/pass0.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/fsck.ocfs2/pass0.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -245,6 +245,8 @@
 	cr->c_total -= bg->bg_bits;
 	di->id1.bitmap1.i_used -= bg->bg_bits - bg->bg_free_bits_count;
 	di->id1.bitmap1.i_total -= bg->bg_bits;
+	di->i_clusters -= (bg->bg_bits / cl->cl_bpc);
+	di->i_size = (uint64_t)di->i_clusters * ost->ost_fs->fs_clustersize;
 
 	ret = ocfs2_write_inode(ost->ost_fs, di->i_blkno, (char *)di);
 	if (ret) {
@@ -451,6 +453,7 @@
 	uint32_t free = 0, total = 0;
 	int changed = 0, trust_next_free = 1;
 	errcode_t ret = 0;
+	uint64_t chain_bytes;
 
 	if (memcmp(di->i_signature, OCFS2_INODE_SIGNATURE,
 		   strlen(OCFS2_INODE_SIGNATURE))) {
@@ -543,6 +546,7 @@
 		};
 		ret = check_chain(ost, di, &cs, cr, buf1, buf2, &changed,
 				  allowed, forbidden);
+		/* XXX what?  not checking ret? */
 
 		if (cr->c_blkno != 0) {
 			free += cs.cs_free_bits;
@@ -597,6 +601,30 @@
 		}
 	}
 
+	total /= cl->cl_bpc;
+
+	if (di->i_clusters != total &&
+	    prompt(ost, PY, PR_CHAIN_I_CLUSTERS,
+		   "Allocator inode %"PRIu64" has %"PRIu32" clusters "
+		   "represtented in its allocator chains but has an "
+		   "i_clusters value of %"PRIu32". Fix this by updating "
+		   "i_clusters?", di->i_blkno, total, di->i_clusters)) {
+		di->i_clusters = total;
+		changed = 1;
+	}
+
+	chain_bytes = (uint64_t)total * ost->ost_fs->fs_clustersize;
+	if (di->i_size != chain_bytes &&
+	    prompt(ost, PY, PR_CHAIN_I_SIZE,
+		   "Allocator inode %"PRIu64" has %"PRIu32" clusters "
+		   "represtented in its allocator chain which accounts for "
+		   "%"PRIu64" total bytes, but its i_size is %"PRIu64". "
+		   "Fix this by updating i_size?", di->i_blkno,
+		   di->id1.bitmap1.i_total, chain_bytes, di->i_size)) {
+		di->i_size = chain_bytes;
+		changed = 1;
+	}
+
 	if (changed) {
 		ret = ocfs2_write_inode(ost->ost_fs, di->i_blkno, (char *)di);
 		if (ret) {
@@ -781,6 +809,9 @@
 
 		di->id1.bitmap1.i_used += bg->bg_bits - bg->bg_free_bits_count;
 		di->id1.bitmap1.i_total += bg->bg_bits;
+		di->i_clusters += (bg->bg_bits / di->id2.i_chain.cl_bpc);
+		di->i_size = (uint64_t)di->i_clusters *
+			     ost->ost_fs->fs_clustersize;
 
 		ret = ocfs2_write_inode(ost->ost_fs, di->i_blkno, (char *)di);
 		if (ret) {

Modified: branches/global-heartbeat/fsck.ocfs2/pass1.c
===================================================================
--- branches/global-heartbeat/fsck.ocfs2/pass1.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/fsck.ocfs2/pass1.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -129,10 +129,13 @@
 		 * write back the new map */
 		if (oldval != val && !ost->ost_write_inode_alloc_asked) {
 			yn = prompt(ost, PY, PR_INODE_ALLOC_REPAIR,
-				    "fsck found an inode whose "
-				    "allocation does not match the chain "
-				    "allocators.  Fix the allocation of this "
-				    "and all future inodes?");
+				    "Inode %"PRIu64" is marked as %s but its "
+				    "position in the inode allocator is "
+				    "marked as %s.  Fix the allocation of this "
+				    "and all future inodes?", blkno,
+				    val ? "valid" : "invalid",
+				    oldval ? "in use" : "free");
+
 			ost->ost_write_inode_alloc_asked = 1;
 			ost->ost_write_inode_alloc = !!yn;
 			if (!ost->ost_write_inode_alloc)
@@ -149,8 +152,8 @@
 		goto out;
 	}
 
-	verbosef("updated inode %"PRIu64" alloc to %d in slot %"PRId16"\n",
-		 blkno, val, slot);
+	verbosef("updated inode %"PRIu64" alloc to %d from %d in slot "
+		  "%"PRId16"\n", blkno, val, oldval, slot);
 
 	/* make sure the inode's fields are consistent if it's allocated */
 	if (val == 1 && slot != di->i_suballoc_slot &&
@@ -530,6 +533,12 @@
 	if (clear) {
 		di->i_flags &= ~OCFS2_VALID_FL;
 		o2fsck_write_inode(ost, blkno, di);
+		/* if we cleared the inode then we're going to be 
+		 * forbidding directory entries from referencing it.. we
+		 * should back-out the inode count we found in the inode
+		 * so that we're not surprised when there aren't any
+		 * references to it in pass 4 */
+		o2fsck_icount_set(ost->ost_icount_in_inodes, di->i_blkno, 0);
 	}
 }
 
@@ -698,22 +707,10 @@
 	return 0;
 }
 
-/* XXX this is only really building up the vb data so that the caller can
- * verify the chain allocator inode's fields.  I wonder if we shouldn't have
- * already done that in pass 0. */
-static int check_gd_block(ocfs2_filesys *fs, uint64_t gd_blkno, int chain_num,
-			   void *priv_data)
-{
-	struct verifying_blocks *vb = priv_data;
-	verbosef("found gd block %"PRIu64"\n", gd_blkno);
-	/* XXX should arguably be verifying that pass 0 marked the group desc
-	 * blocks found */
-	/* don't have bcount */
-	vb_saw_block(vb, vb->vb_num_blocks);
-	return 0;
-}
-
-
+/*
+ * this verifies i_size and i_clusters for inodes that use i_list to
+ * reference extents of data.
+ */
 static errcode_t o2fsck_check_blocks(ocfs2_filesys *fs, o2fsck_state *ost,
 				     uint64_t blkno, ocfs2_dinode *di)
 {
@@ -724,28 +721,21 @@
 		.vb_di = di,
 	};
 
-	/*
-	 * ISLNK && clusters == 0 is the only sign of an inode that doesn't
-	 * have an extent list when i_flags would have us believe it did.  
-	 * We might be able to be very clever about discovering the 
-	 * difference between i_symlink and i_list, but we don't try yet.
-	 */
-	if (di->i_flags & OCFS2_LOCAL_ALLOC_FL ||
-	    di->i_flags & OCFS2_DEALLOC_FL)
-		ret = 0;
-	else if (di->i_flags & OCFS2_CHAIN_FL)
-		ret = ocfs2_chain_iterate(fs, blkno, check_gd_block, &vb);
-	else if (S_ISLNK(di->i_mode) && di->i_clusters == 0) 
-		ret = 0;
-	else {
-		ret = o2fsck_check_extents(ost, di);
-		if (ret == 0)
-			ret = ocfs2_block_iterate_inode(fs, di, 0,
-							verify_block, &vb);
-		if (vb.vb_ret)
-			ret = vb.vb_ret;
-	}
+	/* don't bother to verify for inodes that don't have i_list,
+	 * we have to trust i_mode/i_clusters to tell us that a symlink
+	 * has put target data in the union instead of i_list */
+	if ((di->i_flags & (OCFS2_SUPER_BLOCK_FL | OCFS2_LOCAL_ALLOC_FL |
+			    OCFS2_BITMAP_FL | OCFS2_CHAIN_FL |
+			    OCFS2_DEALLOC_FL)) ||
+	    (S_ISLNK(di->i_mode) && di->i_clusters == 0))
+		return 0;
 
+	ret = o2fsck_check_extents(ost, di);
+	if (ret == 0)
+		ret = ocfs2_block_iterate_inode(fs, di, 0, verify_block, &vb);
+	if (vb.vb_ret)
+		ret = vb.vb_ret;
+
 	if (ret) {
 		com_err(whoami, ret, "while iterating over the blocks for "
 			"inode %"PRIu64, di->i_blkno);	
@@ -778,19 +768,18 @@
 		/* XXX clear valid flag and stuff? */
 	}
 
-#if 0 /* boy, this is just broken */
 	if (vb.vb_num_blocks > 0)
 		expected = (vb.vb_last_block + 1) * fs->fs_blocksize;
 
 	/* i_size is checked for symlinks elsewhere */
 	if (!S_ISLNK(di->i_mode) && di->i_size > expected &&
-	    prompt(ost, PY, 0, "Inode %"PRIu64" has a size of %"PRIu64" but has "
-		    "%"PRIu64" bytes of actual data. Correct the file size?",
+	    prompt(ost, PY, PR_INODE_SIZE, "Inode %"PRIu64" has a size of "
+		   "%"PRIu64" but has %"PRIu64" bytes of actual data. "
+		   "Correct the file size?",
 		    di->i_blkno, di->i_size, expected)) {
 		di->i_size = expected;
 		o2fsck_write_inode(ost, blkno, di);
 	}
-#endif
 
 	if (vb.vb_num_blocks > 0)
 		expected = ocfs2_clusters_in_blocks(fs, vb.vb_last_block + 1);
@@ -1168,24 +1157,29 @@
 
 		valid = 0;
 
-		/* we never consider inodes who don't have a signature.
-		 * We only consider inodes whose generations don't match
-		 * if the user has asked us to */
+		/* we never consider inodes who don't have a signature */
 		if (!memcmp(di->i_signature, OCFS2_INODE_SIGNATURE,
-			    strlen(OCFS2_INODE_SIGNATURE)) &&
-		    (ost->ost_fix_fs_gen ||
-		    (di->i_fs_generation == ost->ost_fs_generation))) {
+			    strlen(OCFS2_INODE_SIGNATURE))) {
 
-			if (di->i_flags & OCFS2_VALID_FL)
-				o2fsck_verify_inode_fields(fs, ost, blkno, di);
+			ocfs2_swap_inode_to_cpu(di);
 
-			if (di->i_flags & OCFS2_VALID_FL) {
-				ret = o2fsck_check_blocks(fs, ost, blkno, di);
-				if (ret)
-					goto out;
-			}
+			 /* We only consider inodes whose generations don't
+			  * match if the user has asked us to */
+			if ((ost->ost_fix_fs_gen ||
+			    (di->i_fs_generation == ost->ost_fs_generation))) {
 
-			valid = di->i_flags & OCFS2_VALID_FL;
+				if (di->i_flags & OCFS2_VALID_FL)
+					o2fsck_verify_inode_fields(fs, ost,
+								   blkno, di);
+				if (di->i_flags & OCFS2_VALID_FL) {
+					ret = o2fsck_check_blocks(fs, ost,
+								  blkno, di);
+					if (ret)
+						goto out;
+				}
+
+				valid = di->i_flags & OCFS2_VALID_FL;
+			}
 		}
 
 		update_inode_alloc(ost, di, blkno, valid);

Modified: branches/global-heartbeat/fsck.ocfs2/pass4.c
===================================================================
--- branches/global-heartbeat/fsck.ocfs2/pass4.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/fsck.ocfs2/pass4.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -40,8 +40,8 @@
 
 static const char *whoami = "pass4";
 
-static errcode_t check_link_counts(o2fsck_state *ost, ocfs2_dinode *di,
-				   uint64_t blkno)
+static void check_link_counts(o2fsck_state *ost, ocfs2_dinode *di,
+			      uint64_t blkno)
 {
 	uint16_t refs, in_inode;
 	errcode_t ret;
@@ -67,7 +67,9 @@
 	ret = ocfs2_read_inode(ost->ost_fs, blkno, (char *)di);
 	if (ret) {
 		com_err(whoami, ret, "reading inode %"PRIu64" to update its "
-			"i_links_count", blkno);
+			"i_links_count.  Could this be because a directory "
+			"entry referenced an invalid inode but wasn't fixed?",
+			blkno);
 		goto out;
 	}
 
@@ -89,7 +91,7 @@
 	}
 
 out:
-	return 0;
+	return;
 }
 
 static int replay_orphan_iterate(struct ocfs2_dir_entry *dirent,
@@ -180,12 +182,43 @@
 	return ret;
 }
 
+/* return the next inode that has either directory entries pointing to it or
+ * that was valid and had a non-zero i_links_count.  OCFS2_ET_BIT_NOT_FOUND
+ * will be bubbled up from the next_blkno() calls when there is no such next
+ * inode.  It is expected that sometimes these won't match.  If a directory
+ * has been lost there can be inodes with i_links_count and no directory
+ * entries at all.  If an inode was lost but the user chose not to erase
+ * the directory entries then there may be references to inodes that
+ * we never saw the i_links_count for */
+static errcode_t next_inode_any_ref(o2fsck_state *ost, uint64_t start,
+				    uint64_t *blkno_ret)
+{
+	errcode_t tmp, ret = OCFS2_ET_BIT_NOT_FOUND;
+	uint64_t blkno;
+
+	tmp = o2fsck_icount_next_blkno(ost->ost_icount_refs, start, &blkno);
+	if (tmp == 0) {
+		*blkno_ret = blkno;
+		ret = 0;
+	}
+
+	tmp = o2fsck_icount_next_blkno(ost->ost_icount_in_inodes, start,
+				       &blkno);
+	/* use this if we didn't have one yet or this one's lesser */
+	if (tmp == 0 && (ret != 0 || (blkno < *blkno_ret))) {
+		ret = 0;
+		*blkno_ret = blkno;
+	}
+
+	return ret;
+}
+
 errcode_t o2fsck_pass4(o2fsck_state *ost)
 {
 	ocfs2_dinode *di;
 	char *buf = NULL;
-	errcode_t ret, ref_ret, inode_ret;
-	uint64_t blkno, ref_blkno, inode_blkno;
+	errcode_t ret;
+	uint64_t blkno, start;
 
 	printf("Pass 4a: checking for orphaned inodes\n");
 
@@ -205,31 +238,11 @@
 	}
 
 	di = (ocfs2_dinode *)buf;
+	start = 0;
 
-	for(blkno = 0, ref_ret = 0; ref_ret != OCFS2_ET_BIT_NOT_FOUND ;
-	    blkno = ref_blkno + 1) {
-		ref_blkno = 0;
-		ref_ret = o2fsck_icount_next_blkno(ost->ost_icount_refs, blkno,
-						   &ref_blkno);
-		inode_blkno = 0;
-		inode_ret = o2fsck_icount_next_blkno(ost->ost_icount_in_inodes,
-						     blkno, &inode_blkno);
-
-		verbosef("ref %"PRIu64" ino %"PRIu64"\n", ref_blkno,
-			 inode_blkno);
-
-		if (ref_ret != inode_ret || ref_blkno != inode_blkno) {
-			printf("fsck's internal inode link count tracking "
-			       "isn't consistent. (ref_ret = %d ref_blkno = "
-			       "%"PRIu64" inode_ret = %d inode_blkno = "
-			       "%"PRIu64")\n", (int)ref_ret, ref_blkno,
-			       (int)inode_ret, inode_blkno);
-			ret = OCFS2_ET_INTERNAL_FAILURE;
-			break;
-		}
-
-		if (ref_ret == 0)
-			check_link_counts(ost, di, ref_blkno);
+	while (next_inode_any_ref(ost, start, &blkno) == 0) {
+		check_link_counts(ost, di, blkno);
+		start = blkno + 1;
 	}
 
 out:

Modified: branches/global-heartbeat/libo2cb/Makefile
===================================================================
--- branches/global-heartbeat/libo2cb/Makefile	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libo2cb/Makefile	2005-09-06 02:01:13 UTC (rev 1072)
@@ -45,7 +45,8 @@
 	include/ocfs2_heartbeat.h	\
 	include/o2cb_abi.h		\
 	include/o2cb_crc32.h		\
-	include/o2cb.h
+	include/o2cb.h			\
+	include/sparse_endian_types.h
 
 HFILES_GEN =		\
 	include/o2cb_err.h

Modified: branches/global-heartbeat/libo2cb/include/o2cb.h
===================================================================
--- branches/global-heartbeat/libo2cb/include/o2cb.h	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libo2cb/include/o2cb.h	2005-09-06 02:01:13 UTC (rev 1072)
@@ -42,13 +42,23 @@
 #include <et/com_err.h>
 
 #if O2CB_FLAT_INCLUDES
+
+#include "sparse_endian_types.h"
+
 #include "o2cb_err.h"
+
 #include "ocfs2_nodemanager.h"
 #include "ocfs2_heartbeat.h"
+
 #else
+
+#include <o2cb/sparse_endian_types.h>
+
 #include <o2cb/o2cb_err.h>
+
 #include <o2cb/ocfs2_nodemanager.h>
 #include <o2cb/ocfs2_heartbeat.h>
+
 #endif
 
 errcode_t o2cb_init(void);

Modified: branches/global-heartbeat/libo2cb/include/ocfs2_heartbeat.h
===================================================================
--- branches/global-heartbeat/libo2cb/include/ocfs2_heartbeat.h	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libo2cb/include/ocfs2_heartbeat.h	2005-09-06 02:01:13 UTC (rev 1072)
@@ -11,12 +11,12 @@
  * modify it under the terms of the GNU General Public
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public
  * License along with this program; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
@@ -27,10 +27,11 @@
 #define _OCFS2_HEARTBEAT_H
 
 struct o2hb_disk_heartbeat_block {
-	__u64 hb_seq;
+	__le64 hb_seq;
 	__u8  hb_node;
 	__u8  hb_pad1[3];
-	__u32 hb_cksum;
+	__le32 hb_cksum;
+	__le64 hb_generation;
 };
 
 #endif /* _OCFS2_HEARTBEAT_H */

Modified: branches/global-heartbeat/libo2cb/include/ocfs2_nodemanager.h
===================================================================
--- branches/global-heartbeat/libo2cb/include/ocfs2_nodemanager.h	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libo2cb/include/ocfs2_nodemanager.h	2005-09-06 02:01:13 UTC (rev 1072)
@@ -12,12 +12,12 @@
  * modify it under the terms of the GNU General Public
  * License as published by the Free Software Foundation; either
  * version 2 of the License, or (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public
  * License along with this program; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,

Copied: branches/global-heartbeat/libo2cb/include/sparse_endian_types.h (from rev 1071, trunk/libo2cb/include/sparse_endian_types.h)

Modified: branches/global-heartbeat/libo2cb/o2cb_abi.c
===================================================================
--- branches/global-heartbeat/libo2cb/o2cb_abi.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libo2cb/o2cb_abi.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -461,6 +461,7 @@
 	return 0;
 }
 
+/* o2cb_get_region_attribute() would just be s/set/get/ of this function */
 static errcode_t o2cb_set_region_attribute(const char *cluster_name,
 					   const char *region_name,
 					   const char *attr_name,
@@ -478,24 +479,6 @@
 	return o2cb_set_attribute(attr_path, attr_value);
 }
 
-static errcode_t o2cb_get_region_attribute(const char *cluster_name,
-					   const char *region_name,
-					   const char *attr_name,
-					   char *attr_value,
-					   size_t count)
-{
-	int ret;
-	char attr_path[PATH_MAX];
-
-	ret = snprintf(attr_path, PATH_MAX - 1,
-		       O2CB_FORMAT_HEARTBEAT_REGION_ATTR,
-		       cluster_name, region_name, attr_name);
-	if ((ret <= 0) || (ret == (PATH_MAX - 1)))
-		return O2CB_ET_INTERNAL_FAILURE;
-
-	return o2cb_get_attribute(attr_path, attr_value, count);
-}
-
 static errcode_t _fake_default_cluster(char *cluster)
 {
 	errcode_t ret;

Modified: branches/global-heartbeat/libocfs2/Makefile
===================================================================
--- branches/global-heartbeat/libocfs2/Makefile	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/Makefile	2005-09-06 02:01:13 UTC (rev 1072)
@@ -23,7 +23,6 @@
 
 CFLAGS = $(OPTS) $(WARNINGS) -fPIC
 CPPFLAGS += -DOCFS2_FLAT_INCLUDES -DO2DLM_FLAT_INCLUDES -DO2CB_FLAT_INCLUDES
-CPPFLAGS += $(B0RKEN_ENDIAN)
 
 ifneq ($(OCFS2_DEBUG_EXE),)
 DEBUG_EXE_FILES = $(shell awk '/DEBUG_EXE/{if (k[FILENAME] == 0) {print FILENAME; k[FILENAME] = 1;}}' $(CFILES))
@@ -76,6 +75,7 @@
 	namei.c		\
 	newdir.c	\
 	openfs.c	\
+	slot_map.c	\
 	sysfile.c	\
 	truncate.c	\
 	unix_io.c	\
@@ -88,9 +88,7 @@
 	include/dir_iterate.h		\
 	include/dir_util.h		\
 	include/extent_map.h		\
-	include/jfs_compat.h		\
-	include/jfs_user.h		\
-	include/kernel-jbd.h		\
+	include/jbd.h			\
 	include/kernel-list.h		\
 	include/kernel-rbtree.h		\
 	include/ocfs1_fs_compat.h	\

Modified: branches/global-heartbeat/libocfs2/alloc.c
===================================================================
--- branches/global-heartbeat/libocfs2/alloc.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/alloc.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -163,7 +163,7 @@
 
 	if (flags & OCFS2_DEALLOC_FL) {
 		tl_recs = ocfs2_truncate_recs_per_inode(fs->fs_blocksize);
-		di->id2.i_dealloc.tl_count = cpu_to_le16(tl_recs);
+		di->id2.i_dealloc.tl_count = tl_recs;
 		return ;
 	}
 

Modified: branches/global-heartbeat/libocfs2/bitops.c
===================================================================
--- branches/global-heartbeat/libocfs2/bitops.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/bitops.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -27,19 +27,12 @@
  */
 
 #include <stdio.h>
+#include <strings.h>
 #include <sys/types.h>
 
 #include "bitops.h"
 
 /*
- * XXX: We're not endian safe at all, and have just hacked in big endian
- * bitops for the arches we want to test on (ppc32 and s390x userland).
- * Post-1.0, we have to revisit this.
- */
-
-#ifndef _OCFS2_HAVE_ASM_BITOPS_
-
-/*
  * For the benefit of those who are trying to port Linux to another
  * architecture, here are some C-language equivalents.  You should
  * recode these in the native assmebly language, if at all possible.
@@ -49,29 +42,8 @@
  * systems, as well as non-32 bit systems.
  */
 
-#if defined(__powerpc__)
 int ocfs2_set_bit(int nr,void * addr)
 {
-	unsigned long mask = 1 << (nr & 0x1f);
-	unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
-	unsigned long old = *p;
-
-	*p = old | mask;
-	return (old & mask) != 0;
-}
-#elif defined(__s390x__)
-int ocfs2_set_bit(int nr,void * addr)
-{
-	unsigned long mask = 1UL << (nr & 0x3f);
-	unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-	unsigned long old = *p;
-
-	*p = old | mask;
-	return (old & mask) != 0;
-}
-#else
-int ocfs2_set_bit(int nr,void * addr)
-{
 	int		mask, retval;
 	unsigned char	*ADDR = (unsigned char *) addr;
 
@@ -81,31 +53,9 @@
 	*ADDR |= mask;
 	return retval;
 }
-#endif
 
-#if defined(__powerpc__)
 int ocfs2_clear_bit(int nr, void * addr)
 {
-	unsigned long mask = 1 << (nr & 0x1f);
-	unsigned long *p = ((unsigned long *)addr) + (nr >> 5);
-	unsigned long old = *p;
-
-	*p = old & ~mask;
-	return (old & mask) != 0;
-}
-#elif defined(__s390x__)
-int ocfs2_clear_bit(int nr, void * addr)
-{
-	unsigned long mask = 1UL << (nr & 0x3f);
-	unsigned long *p = ((unsigned long *)addr) + (nr >> 6);
-	unsigned long old = *p;
-
-	*p = old & ~mask;
-	return (old & mask) != 0;
-}
-#else
-int ocfs2_clear_bit(int nr, void * addr)
-{
 	int		mask, retval;
 	unsigned char	*ADDR = (unsigned char *) addr;
 
@@ -115,25 +65,9 @@
 	*ADDR &= ~mask;
 	return retval;
 }
-#endif
 
-#if defined(__powerpc__)
 int ocfs2_test_bit(int nr, const void * addr)
 {
-	const unsigned int *p = (const unsigned int *) addr;
-
-	return ((p[nr >> 5] >> (nr & 0x1f)) & 1) != 0;
-}
-#elif defined(__s390x__)
-int ocfs2_test_bit(int nr, const void * addr)
-{
-	const unsigned long *p = (const unsigned long *) addr;
-
-	return ((p[nr >> 6] >> (nr & 0x3f)) & 1UL) != 0;
-}
-#else
-int ocfs2_test_bit(int nr, const void * addr)
-{
 	int			mask;
 	const unsigned char	*ADDR = (const unsigned char *) addr;
 
@@ -141,112 +75,7 @@
 	mask = 1 << (nr & 0x07);
 	return ((mask & *ADDR) != 0);
 }
-#endif
 
-#endif	/* !_OCFS2_HAVE_ASM_BITOPS_ */
-
-#if !defined(_OCFS2_HAVE_ASM_FINDBIT_)
-#include <strings.h>
-
-#if defined(__powerpc__)
-static inline int __ilog2(unsigned long x)
-{
-        int lz;
-                                                                                                                                                         
-        asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
-        return 31 - lz;
-}
-
-static inline int ffz(unsigned int x)
-{
-        if ((x = ~x) == 0)
-                return 32;
-        return __ilog2(x & -x);
-}
-
-static inline int __ffs(unsigned long x)
-{
-	return __ilog2(x & -x);
-}
-#elif defined(__s390x__)
-
-static const char _zb_findmap[] = {
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,
-	0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,8
-};
-
-static const char _sb_findmap[] = {
-	8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-	4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-	5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-	4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-	6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-	4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-	5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-	4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-	7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-	4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-	5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-	4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-	6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-	4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-	5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,
-	4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0
-};
-
-static inline int ffz(unsigned long word)
-{
-	int bit = 0;
-
-	if ((word & 0xffffffff) == 0xffffffff) {
-		word >>= 32;
-		bit += 32;
-	}
-	if ((word & 0xffff) == 0xffff) {
-		word >>= 16;
-		bit += 16;
-	}
-	if ((word & 0xff) == 0xff) {
-		word >>= 8;
-		bit += 8;
-	}
-	return bit + _zb_findmap[word & 0xff];
-}
-
-static inline int __ffs(unsigned long word)
-{
-	int bit = 0;
-
-	if ((word & 0xffffffff) == 0) {
-		word >>= 32;
-		bit += 32;
-	}
-	if ((word & 0xffff) == 0) {
-		word >>= 16;
-		bit += 16;
-	}
-	if ((word & 0xff) == 0) {
-		word >>= 8;
-		bit += 8;
-	}
-	return bit + _sb_findmap[word & 0xff];
-}
-#endif
-
 int ocfs2_find_first_bit_set(void *addr, int size)
 {
 	return ocfs2_find_next_bit_set(addr, size, 0);
@@ -257,85 +86,8 @@
 	return ocfs2_find_next_bit_clear(addr, size, 0);
 }
 
-#if defined(__powerpc__)
 int ocfs2_find_next_bit_set(void *addr, int size, int offset)
 {
-	unsigned int *p = ((unsigned int *) addr) + (offset >> 5);
-	unsigned int result = offset & ~31UL;
-	unsigned int tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= 31UL;
-	if (offset) {
-		tmp = *p++;
-		tmp &= ~0UL << offset;
-		if (size < 32)
-			goto found_first;
-		if (tmp)
-			goto found_middle;
-		size -= 32;
-		result += 32;
-	}
-	while (size >= 32) {
-		if ((tmp = *p++) != 0)
-			goto found_middle;
-		result += 32;
-		size -= 32;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
-
-found_first:
-	tmp &= ~0UL >> (32 - size);
-	if (tmp == 0UL)        /* Are any bits set? */
-		return result + size; /* Nope. */
-found_middle:
-	return result + __ffs(tmp);
-}
-#elif defined(__s390x__)
-int ocfs2_find_next_bit_set(void *addr, int size, int offset)
-{
-	unsigned long *p = ((unsigned long *) addr) + (offset >> 6);
-	unsigned long result = offset & ~63UL;
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= 63UL;
-	if (offset) {
-		tmp = *p++;
-		tmp &= ~0UL << offset;
-		if (size < 64)
-			goto found_first;
-		if (tmp)
-			goto found_middle;
-		size -= 64;
-		result += 64;
-	}
-	while (size & ~63UL) {
-		if ((tmp = *p++) != 0)
-			goto found_middle;
-		result += 64;
-		size -= 64;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
-
-found_first:
-	tmp &= ~0UL >> (64 - size);
-	if (tmp == 0UL)        /* Are any bits set? */
-		return result + size; /* Nope. */
-found_middle:
-	return result + __ffs(tmp);
-}
-#else
-int ocfs2_find_next_bit_set(void *addr, int size, int offset)
-{
 	unsigned char * p;
 	int set = 0, d0;
 	unsigned int	bit = offset & 7, res = 0;
@@ -371,85 +123,9 @@
 
 	return (res + d0 - 1);
 }
-#endif
 
-#if defined(__powerpc__)
 int ocfs2_find_next_bit_clear(void *addr, int size, int offset)
 {
-	unsigned int * p = ((unsigned int *) addr) + (offset >> 5);
-	unsigned int result = offset & ~31UL;
-	unsigned int tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= 31UL;
-	if (offset) {
-		tmp = *p++;
-		tmp |= ~0UL >> (32-offset);
-		if (size < 32)
-			goto found_first;
-		if (tmp != ~0U)
-			goto found_middle;
-		size -= 32;
-		result += 32;
-	}
-	while (size >= 32) {
-		if ((tmp = *p++) != ~0U)
-			goto found_middle;
-		result += 32;
-		size -= 32;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
-found_first:
-	tmp |= ~0UL << size;
-	if (tmp == ~0UL)        /* Are any bits zero? */
-		return result + size; /* Nope. */
-found_middle:
-	return result + ffz(tmp);
-}
-#elif defined(__s390x__)
-int ocfs2_find_next_bit_clear(void *addr, int size, int offset)
-{
-	unsigned long * p = ((unsigned long *) addr) + (offset >> 6);
-	unsigned long result = offset & ~63UL;
-	unsigned long tmp;
-
-	if (offset >= size)
-		return size;
-	size -= result;
-	offset &= 63UL;
-	if (offset) {
-		tmp = *p++;
-		tmp |= ~0UL >> (64-offset);
-		if (size < 64)
-			goto found_first;
-		if (~tmp)
-			goto found_middle;
-		size -= 64;
-		result += 64;
-	}
-	while (size & ~63UL) {
-		if (~(tmp = *p++))
-			goto found_middle;
-		result += 64;
-		size -= 64;
-	}
-	if (!size)
-		return result;
-	tmp = *p;
-found_first:
-	tmp |= ~0UL << size;
-	if (tmp == ~0UL)        /* Are any bits zero? */
-		return result + size; /* Nope. */
-found_middle:
-	return result + ffz(tmp);
-}
-#else
-int ocfs2_find_next_bit_clear(void *addr, int size, int offset)
-{
 	unsigned char * p;
 	int set = 0, d0;
 	unsigned int	bit = offset & 7, res = 0;
@@ -484,11 +160,7 @@
 
 	return (res + d0 - 1);
 }
-#endif
 
-#endif	
-
-
 #ifdef DEBUG_EXE
 #include <stdio.h>
 #include <stdlib.h>

Modified: branches/global-heartbeat/libocfs2/chain.c
===================================================================
--- branches/global-heartbeat/libocfs2/chain.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/chain.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -29,14 +29,19 @@
 
 #include "ocfs2.h"
 
-static void ocfs2_group_desc_to_cpu(ocfs2_group_desc *gd)
+void ocfs2_swap_group_desc(ocfs2_group_desc *gd)
 {
-	gd->bg_generation = le32_to_cpu(gd->bg_generation);
-}
+	if (cpu_is_little_endian)
+		return;
 
-static void ocfs2_group_desc_to_le(ocfs2_group_desc *gd)
-{
-	gd->bg_generation = cpu_to_le32(gd->bg_generation);
+	gd->bg_size = bswap_16(gd->bg_size);
+	gd->bg_bits = bswap_16(gd->bg_bits);
+	gd->bg_free_bits_count = bswap_16(gd->bg_free_bits_count);
+	gd->bg_chain = bswap_16(gd->bg_chain);
+	gd->bg_generation = bswap_32(gd->bg_generation);
+	gd->bg_next_group = bswap_64(gd->bg_next_group);
+	gd->bg_parent_dinode = bswap_64(gd->bg_parent_dinode);
+	gd->bg_blkno = bswap_64(gd->bg_blkno);
 }
 
 errcode_t ocfs2_read_group_desc(ocfs2_filesys *fs, uint64_t blkno,
@@ -68,7 +73,7 @@
 	memcpy(gd_buf, blk, fs->fs_blocksize);
 
 	gd = (ocfs2_group_desc *)gd_buf;
-	ocfs2_group_desc_to_cpu(gd);
+	ocfs2_swap_group_desc(gd);
 
 	ret = 0;
 out:
@@ -98,7 +103,7 @@
 	memcpy(blk, gd_buf, fs->fs_blocksize);
 
 	gd = (ocfs2_group_desc *)blk;
-	ocfs2_group_desc_to_le(gd);
+	ocfs2_swap_group_desc(gd);
 
 	ret = io_write_block(fs->fs_io, blkno, 1, blk);
 	if (ret)

Modified: branches/global-heartbeat/libocfs2/chainalloc.c
===================================================================
--- branches/global-heartbeat/libocfs2/chainalloc.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/chainalloc.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -307,7 +307,7 @@
 	if (cinode->ci_chains)
 		ocfs2_bitmap_free(cinode->ci_chains);
 
-	total_bits = fs->fs_clusters *
+	total_bits = (uint64_t)fs->fs_clusters *
 		cinode->ci_inode->id2.i_chain.cl_bpc;
 
 	snprintf(name, sizeof(name),
@@ -534,6 +534,8 @@
 	rec->c_blkno = blkno;
 
 	cinode->ci_inode->i_clusters += cinode->ci_inode->id2.i_chain.cl_cpg;
+	cinode->ci_inode->i_size = (uint64_t)cinode->ci_inode->i_clusters *
+				   fs->fs_clustersize;
 	cinode->ci_inode->id1.bitmap1.i_total += gd->bg_bits;
 	cinode->ci_inode->id1.bitmap1.i_used += gd->bg_bits -
 						gd->bg_free_bits_count;
@@ -564,6 +566,8 @@
 
 		cinode->ci_inode->i_clusters -= 
 			cinode->ci_inode->id2.i_chain.cl_cpg;
+		cinode->ci_inode->i_size = (uint64_t)cinode->ci_inode->i_clusters *
+					   fs->fs_clustersize;
 		cinode->ci_inode->id1.bitmap1.i_total -= gd->bg_bits;
 		cinode->ci_inode->id1.bitmap1.i_used -= gd->bg_bits -
 							gd->bg_free_bits_count;

Modified: branches/global-heartbeat/libocfs2/checkhb.c
===================================================================
--- branches/global-heartbeat/libocfs2/checkhb.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/checkhb.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -63,8 +63,8 @@
 	if (!ret) {
 		slots = (int16_t *)slotbuf;
 		for (i = 0, j = 0; i < num_nodes; ++i)
-			if (slots[i] != -1)
-				node_nums[j++] = (uint8_t)slots[i];
+			if (le16_to_cpu(slots[i]) != (uint16_t)OCFS2_INVALID_SLOT)
+				node_nums[j++] = le16_to_cpu(slots[i]);
 	}
 
 	if (slotbuf)

Modified: branches/global-heartbeat/libocfs2/dirblock.c
===================================================================
--- branches/global-heartbeat/libocfs2/dirblock.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/dirblock.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -32,35 +32,41 @@
 
 #include "ocfs2.h"
 
+static void ocfs2_swap_dir_entry(struct ocfs2_dir_entry *dirent)
+{
+	if (cpu_is_little_endian)
+		return;
 
-errcode_t ocfs2_read_dir_block(ocfs2_filesys *fs, uint64_t block,
-                               void *buf)
+	dirent->inode = bswap_64(dirent->inode);
+	dirent->rec_len = bswap_16(dirent->rec_len);
+}
+
+static errcode_t ocfs2_swap_dir_entries_direction(void *buf, uint64_t bytes,
+						  int to_cpu)
 {
-	errcode_t	retval;
 	char		*p, *end;
 	struct ocfs2_dir_entry *dirent;
 	unsigned int	name_len, rec_len;
+	errcode_t retval = 0;
 
- 	retval = io_read_block(fs->fs_io, block, 1, buf);
-	if (retval)
-		return retval;
-
 	p = (char *) buf;
-	end = (char *) buf + fs->fs_blocksize;
+	end = (char *) buf + bytes;
 	while (p < end-12) {
 		dirent = (struct ocfs2_dir_entry *) p;
 
-		dirent->inode = le64_to_cpu(dirent->inode);
-		dirent->rec_len = le16_to_cpu(dirent->rec_len);
+		if (to_cpu)
+			ocfs2_swap_dir_entry(dirent);
 		name_len = dirent->name_len;
 		rec_len = dirent->rec_len;
+		if (!to_cpu)
+			ocfs2_swap_dir_entry(dirent);
 
 		if ((rec_len < 12) || (rec_len % 4)) {
 			rec_len = 12;
 			retval = OCFS2_ET_DIR_CORRUPTED;
 		}
 
-		if (((name_len & 0xFF) + 12) > dirent->rec_len)
+		if (((name_len & 0xFF) + 12) > rec_len)
 			retval = OCFS2_ET_DIR_CORRUPTED;
 
 		p += rec_len;
@@ -68,13 +74,32 @@
 	return retval;
 }
 
+errcode_t ocfs2_swap_dir_entries_from_cpu(void *buf, uint64_t bytes)
+{
+	return ocfs2_swap_dir_entries_direction(buf, bytes, 0);
+}
+errcode_t ocfs2_swap_dir_entries_to_cpu(void *buf, uint64_t bytes)
+{
+	return ocfs2_swap_dir_entries_direction(buf, bytes, 1);
+}
+
+errcode_t ocfs2_read_dir_block(ocfs2_filesys *fs, uint64_t block,
+                               void *buf)
+{
+	errcode_t	retval;
+
+ 	retval = io_read_block(fs->fs_io, block, 1, buf);
+	if (retval)
+		return retval;
+
+	return ocfs2_swap_dir_entries_to_cpu(buf, fs->fs_blocksize);
+}
+
 errcode_t ocfs2_write_dir_block(ocfs2_filesys *fs, uint64_t block,
                                 void *inbuf)
 {
 	errcode_t	retval;
-	char		*p, *end;
 	char		*buf = NULL;
-	struct ocfs2_dir_entry *dirent;
 
 	retval = ocfs2_malloc_block(fs->fs_io, &buf);
 	if (retval)
@@ -82,24 +107,12 @@
 
 	memcpy(buf, inbuf, fs->fs_blocksize);
 
-	p = buf;
-	end = buf + fs->fs_blocksize;
-	while (p < end-12) {
-		dirent = (struct ocfs2_dir_entry *) p;
-
-		if ((dirent->rec_len < 12) ||
-		    (dirent->rec_len % 4)) {
-			ocfs2_free(&buf);
-			return OCFS2_ET_DIR_CORRUPTED;
-		}
-
-		p += dirent->rec_len;
-
-		dirent->inode = cpu_to_le64(dirent->inode);
-		dirent->rec_len = cpu_to_le16(dirent->rec_len);
-	}
-
+	retval = ocfs2_swap_dir_entries_from_cpu(buf, fs->fs_blocksize);
+	if (retval)
+		goto out;
+	
  	retval = io_write_block(fs->fs_io, block, 1, buf);
+out:
 	ocfs2_free(&buf);
 	return retval;
 }

Modified: branches/global-heartbeat/libocfs2/extents.c
===================================================================
--- branches/global-heartbeat/libocfs2/extents.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/extents.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -34,20 +34,70 @@
 
 #include "ocfs2.h"
 
-static void ocfs2_swap_extent_block_to_cpu(ocfs2_extent_block *eb)
+static void ocfs2_swap_extent_list_primary(ocfs2_extent_list *el)
 {
-	eb->h_blkno         = le64_to_cpu(eb->h_blkno);
-	eb->h_suballoc_slot = le16_to_cpu(eb->h_suballoc_slot);
-	eb->h_suballoc_bit  = le16_to_cpu(eb->h_suballoc_bit);
+	el->l_tree_depth = bswap_16(el->l_tree_depth);
+	el->l_count = bswap_16(el->l_count);
+	el->l_next_free_rec = bswap_16(el->l_next_free_rec);
 }
 
-static void ocfs2_swap_extent_block_to_le(ocfs2_extent_block *eb)
+static void ocfs2_swap_extent_list_secondary(ocfs2_extent_list *el)
 {
-	eb->h_blkno         = cpu_to_le64(eb->h_blkno);
-	eb->h_suballoc_slot = cpu_to_le16(eb->h_suballoc_slot);
-	eb->h_suballoc_bit  = cpu_to_le16(eb->h_suballoc_bit);
+	uint16_t i;
+
+	for(i = 0; i < el->l_next_free_rec; i++) {
+		ocfs2_extent_rec *rec = &el->l_recs[i];
+
+		rec->e_cpos = bswap_32(rec->e_cpos);
+		rec->e_clusters = bswap_32(rec->e_clusters);
+		rec->e_blkno = bswap_64(rec->e_blkno);
+	}
 }
 
+void ocfs2_swap_extent_list_from_cpu(ocfs2_extent_list *el)
+{
+	if (cpu_is_little_endian)
+		return;
+
+	ocfs2_swap_extent_list_secondary(el);
+	ocfs2_swap_extent_list_primary(el);
+}
+void ocfs2_swap_extent_list_to_cpu(ocfs2_extent_list *el)
+{
+	if (cpu_is_little_endian)
+		return;
+
+	ocfs2_swap_extent_list_primary(el);
+	ocfs2_swap_extent_list_secondary(el);
+}
+
+static void ocfs2_swap_extent_block_header(ocfs2_extent_block *eb)
+{
+
+	eb->h_suballoc_slot = bswap_16(eb->h_suballoc_slot);
+	eb->h_suballoc_bit  = bswap_16(eb->h_suballoc_bit);
+	eb->h_fs_generation = bswap_32(eb->h_fs_generation);
+	eb->h_blkno         = bswap_64(eb->h_blkno);
+	eb->h_next_leaf_blk = bswap_64(eb->h_next_leaf_blk);
+}
+
+static void ocfs2_swap_extent_block_from_cpu(ocfs2_extent_block *eb)
+{
+	if (cpu_is_little_endian)
+		return;
+
+	ocfs2_swap_extent_block_header(eb);
+	ocfs2_swap_extent_list_from_cpu(&eb->h_list);
+}
+static void ocfs2_swap_extent_block_to_cpu(ocfs2_extent_block *eb)
+{
+	if (cpu_is_little_endian)
+		return;
+
+	ocfs2_swap_extent_block_header(eb);
+	ocfs2_swap_extent_list_to_cpu(&eb->h_list);
+}
+
 errcode_t ocfs2_read_extent_block_nocheck(ocfs2_filesys *fs, uint64_t blkno,
 					  char *eb_buf)
 {
@@ -121,7 +171,7 @@
 	memcpy(blk, eb_buf, fs->fs_blocksize);
 
 	eb = (ocfs2_extent_block *) blk;
-	ocfs2_swap_extent_block_to_le(eb);
+	ocfs2_swap_extent_block_from_cpu(eb);
 
 	ret = io_write_block(fs->fs_io, blkno, 1, blk);
 	if (ret)

Modified: branches/global-heartbeat/libocfs2/getsectsize.c
===================================================================
--- branches/global-heartbeat/libocfs2/getsectsize.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/getsectsize.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -33,7 +33,7 @@
 #include <linux/fd.h>
 #endif
 
-#if defined(__linux__) && defined(_IO) && !defined(BLKGETSIZE)
+#if defined(__linux__) && defined(_IO) && !defined(BLKSSZGET)
 #define BLKSSZGET  _IO(0x12,104)/* get block device sector size */
 #endif
 

Modified: branches/global-heartbeat/libocfs2/getsize.c
===================================================================
--- branches/global-heartbeat/libocfs2/getsize.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/getsize.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -18,6 +18,9 @@
 #define HAVE_ERRNO_H 1
 #define HAVE_LINUX_FD_H 1
 #define HAVE_OPEN64 1
+#define HAVE_SYS_IOCTL_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_FSTAT64 1
 
 #define _LARGEFILE_SOURCE
 #define _LARGEFILE64_SOURCE
@@ -30,21 +33,27 @@
 #include <errno.h>
 #endif
 #include <fcntl.h>
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
 #ifdef HAVE_LINUX_FD_H
-#include <sys/ioctl.h>
 #include <linux/fd.h>
 #endif
 #ifdef HAVE_SYS_DISKLABEL_H
-#include <sys/ioctl.h>
 #include <sys/disklabel.h>
-#endif /* HAVE_SYS_DISKLABEL_H */
+#endif
 #ifdef HAVE_SYS_DISK_H
+#ifdef HAVE_SYS_QUEUE_H
 #include <sys/queue.h> /* for LIST_HEAD */
+#endif
 #include <sys/disk.h>
-#endif /* HAVE_SYS_DISK_H */
+#endif
 #ifdef __linux__
 #include <sys/utsname.h>
 #endif
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
 
 #if defined(__linux__) && defined(_IO) && !defined(BLKGETSIZE)
 #define BLKGETSIZE _IO(0x12,96)	/* return device size */
@@ -55,9 +64,6 @@
 #endif
 
 #ifdef APPLE_DARWIN
-#include <sys/ioctl.h>
-#include <sys/disk.h>
-
 #define BLKGETSIZE DKIOCGETBLOCKCOUNT32
 #endif /* APPLE_DARWIN */
 
@@ -67,14 +73,22 @@
 #include "windows.h"
 #include "winioctl.h"
 
+#if (_WIN32_WINNT >= 0x0500)
+#define HAVE_GET_FILE_SIZE_EX 1
+#endif
+
 errcode_t ocfs2_get_device_size(const char *file, int blocksize,
-				uint32_t *retblocks)
+				uint64_t *retblocks)
 {
 	HANDLE dev;
 	PARTITION_INFORMATION pi;
 	DISK_GEOMETRY gi;
 	DWORD retbytes;
+#ifdef HAVE_GET_FILE_SIZE_EX
 	LARGE_INTEGER filesize;
+#else
+	DWORD filesize;
+#endif /* HAVE_GET_FILE_SIZE_EX */
 
 	dev = CreateFile(file, GENERIC_READ, 
 			 FILE_SHARE_READ | FILE_SHARE_WRITE ,
@@ -99,9 +113,18 @@
 			     gi.TracksPerCylinder *
 			     gi.Cylinders.QuadPart / blocksize;
 
+#ifdef HAVE_GET_FILE_SIZE_EX
 	} else if (GetFileSizeEx(dev, &filesize)) {
 		*retblocks = filesize.QuadPart / blocksize;
 	}
+#else
+	} else {
+		filesize = GetFileSize(dev, NULL);
+		if (INVALID_FILE_SIZE != filesize) {
+			*retblocks = filesize / blocksize;
+		}
+	}
+#endif /* HAVE_GET_FILE_SIZE_EX */
 
 	CloseHandle(dev);
 	return 0;
@@ -124,9 +147,9 @@
  * Returns the number of blocks in a partition
  */
 errcode_t ocfs2_get_device_size(const char *file, int blocksize,
-				 uint32_t *retblocks)
+				uint64_t *retblocks)
 {
-	int	fd;
+	int	fd, rc = 0;
 	int valid_blkgetsize64 = 1;
 #ifdef __linux__
 	struct 		utsname ut;
@@ -157,9 +180,8 @@
 		if ((sizeof(*retblocks) < sizeof(unsigned long long))
 		    && ((size64 / (blocksize / 512)) > 0xFFFFFFFF))
 			return EFBIG;
-		close(fd);
 		*retblocks = size64 / (blocksize / 512);
-		return 0;
+		goto out;
 	}
 #endif
 
@@ -172,28 +194,27 @@
 #endif
 	if (valid_blkgetsize64 &&
 	    ioctl(fd, BLKGETSIZE64, &size64) >= 0) {
-		if ((sizeof(*retblocks) < sizeof(unsigned long long))
-		    && ((size64 / blocksize) > 0xFFFFFFFF))
-			return EFBIG;
-		close(fd);
+		if ((sizeof(*retblocks) < sizeof(unsigned long long)) &&
+		    ((size64 / blocksize) > 0xFFFFFFFF)) {
+			rc = EFBIG;
+			goto out;
+		}
 		*retblocks = size64 / blocksize;
-		return 0;
+		goto out;
 	}
 #endif
 
 #ifdef BLKGETSIZE
 	if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
-		close(fd);
 		*retblocks = size / (blocksize / 512);
-		return 0;
+		goto out;
 	}
 #endif
 
 #ifdef FDGETPRM
 	if (ioctl(fd, FDGETPRM, &this_floppy) >= 0) {
-		close(fd);
 		*retblocks = this_floppy.size / (blocksize / 512);
-		return 0;
+		goto out;
 	}
 #endif
 
@@ -204,7 +225,7 @@
 	    u_int bs;
 	    if (ioctl(fd, DIOCGMEDIASIZE, &ms) >= 0) {
 		*retblocks = ms / blocksize;
-		return 0;
+		goto out;
 	    }
 	}
 #elif defined(DIOCGDINFO)
@@ -222,14 +243,27 @@
 	if (part >= 0 && (ioctl(fd, DIOCGDINFO, (char *)&lab) >= 0)) {
 		pp = &lab.d_partitions[part];
 		if (pp->p_size) {
-			close(fd);
 			*retblocks = pp->p_size / (blocksize / 512);
-			return 0;
+			goto out;
 		}
 	}
 #endif /* defined(DIOCG*) */
 #endif /* HAVE_SYS_DISKLABEL_H */
 
+	{
+#ifdef HAVE_FSTAT64
+		struct stat64   st;
+		if (fstat64(fd, &st) == 0)
+#else
+		struct stat	st;
+		if (fstat(fd, &st) == 0)
+#endif
+			if (S_ISREG(st.st_mode)) {
+				*retblocks = st.st_size / blocksize;
+				goto out;
+			}
+	}
+
 	/*
 	 * OK, we couldn't figure it out by using a specialized ioctl,
 	 * which is generally the best way.  So do binary search to
@@ -248,9 +282,14 @@
 			high = mid;
 	}
 	valid_offset (fd, 0);
+	size64 = low + 1;
+	if ((sizeof(*retblocks) < sizeof(unsigned long long))
+	    && ((size64 / blocksize) > 0xFFFFFFFF))
+		return EFBIG;
+	*retblocks = size64 / blocksize;
+out:
 	close(fd);
-	*retblocks = (low + 1) / blocksize;
-	return 0;
+	return rc;
 }
 
 #endif /* WIN32 */
@@ -258,7 +297,7 @@
 #ifdef DEBUG_EXE
 int main(int argc, char **argv)
 {
-	uint32_t blocks;
+	uint64_t blocks;
 	int	 retval;
 	
 	if (argc < 2) {
@@ -272,7 +311,7 @@
 			"while calling ocfs2_get_device_size");
 		exit(1);
 	}
-	printf("Device %s has %d 1k blocks.\n", argv[1], blocks);
+	printf("Device %s has %"PRIu64" 1k blocks.\n", argv[1], blocks);
 	exit(0);
 }
 #endif

Modified: branches/global-heartbeat/libocfs2/heartbeat.c
===================================================================
--- branches/global-heartbeat/libocfs2/heartbeat.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/heartbeat.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -30,6 +30,16 @@
 
 #include "ocfs2.h"
 
+void ocfs2_swap_disk_heartbeat_block(struct o2hb_disk_heartbeat_block *hb)
+{
+	if (cpu_is_little_endian)
+		return;
+
+	hb->hb_seq        = bswap_64(hb->hb_seq);
+	hb->hb_cksum      = bswap_32(hb->hb_cksum);
+	hb->hb_generation = bswap_64(hb->hb_generation);
+}
+
 errcode_t ocfs2_fill_heartbeat_desc(ocfs2_filesys *fs,
 				    struct o2cb_region_desc *desc)
 {

Modified: branches/global-heartbeat/libocfs2/include/bitops.h
===================================================================
--- branches/global-heartbeat/libocfs2/include/bitops.h	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/include/bitops.h	2005-09-06 02:01:13 UTC (rev 1072)
@@ -3,8 +3,7 @@
  *
  * bitops.h
  *
- * Bitmap frobbing routines for the OCFS2 userspace library.  These
- * are the inlined versions.
+ * Bitmap frobbing routines for the OCFS2 userspace library.
  *
  * Copyright (C) 2004 Oracle.  All rights reserved.
  *
@@ -26,251 +25,18 @@
  *
  *  This code is a port of e2fsprogs/lib/ext2fs/bitops.h
  *  Copyright (C) 1993, 1994, 1995, 1996 Theodore Ts'o.
- *
- *  i386 bitops operations taken from <asm/bitops.h>, Copyright 1992,
- *  Linus Torvalds.
  */
 
+#ifndef _BITOPS_H
+#define _BITOPS_H
 
-
-/*
- * OCFS2 bitmap manipulation routines.
- */
-
-#if ((defined __GNUC__) && \
-     (defined(__i386__) || defined(__i486__) || defined(__i586__)))
-
-#define _OCFS2_HAVE_ASM_BITOPS_
-
-/*
- * These are done by inline assembly for speed reasons.....
- *
- * All bitoperations return 0 if the bit was cleared before the
- * operation and != 0 if it was not.  Bit 0 is the LSB of addr; bit 32
- * is the LSB of (addr+1).
- */
-
-/*
- * Some hacks to defeat gcc over-optimizations..
- */
-struct __dummy_h { unsigned long a[100]; };
-#define OCFS2_ADDR (*(struct __dummy_h *) addr)
-#define OCFS2_CONST_ADDR (*(const struct __dummy_h *) addr)	
-
-static inline int ocfs2_set_bit(int nr, void * addr)
-{
-	int oldbit;
-
-	__asm__ __volatile__("btsl %2,%1\n\tsbbl %0,%0"
-		:"=r" (oldbit),"=m" (OCFS2_ADDR)
-		:"r" (nr));
-	return oldbit;
-}
-
-static inline int ocfs2_clear_bit(int nr, void * addr)
-{
-	int oldbit;
-
-	__asm__ __volatile__("btrl %2,%1\n\tsbbl %0,%0"
-		:"=r" (oldbit),"=m" (OCFS2_ADDR)
-		:"r" (nr));
-	return oldbit;
-}
-
-static inline int ocfs2_test_bit(int nr, const void * addr)
-{
-	int oldbit;
-
-	__asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
-		:"=r" (oldbit)
-		:"m" (OCFS2_CONST_ADDR),"r" (nr));
-	return oldbit;
-}
-
-#if 0
-#define _OCFS2_HAVE_ASM_FINDBIT_
-
-_INLINE_ int ext2fs_find_first_bit_set(void * addr, unsigned size)
-{
-	int d0, d1, d2;
-	int res;
-
-	if (!size)
-		return 0;
-	/* This looks at memory. Mark it volatile to tell gcc not to move it around */
-	__asm__ __volatile__(
-		"cld\n\t"			     
-		"xorl %%eax,%%eax\n\t"
-		"xorl %%edx,%%edx\n\t"
-		"repe; scasl\n\t"
-		"je 1f\n\t"
-		"movl -4(%%edi),%%eax\n\t"
-		"subl $4,%%edi\n\t"
-		"bsfl %%eax,%%edx\n"
-		"1:\tsubl %%esi,%%edi\n\t"
-		"shll $3,%%edi\n\t"
-		"addl %%edi,%%edx"
-		:"=d" (res), "=&c" (d0), "=&D" (d1), "=&a" (d2)
-		:"1" ((size + 31) >> 5), "2" (addr), "S" (addr));
-	return res;
-}
-
-_INLINE_ int ext2fs_find_next_bit_set (void * addr, int size, int offset)
-{
-	unsigned long * p = ((unsigned long *) addr) + (offset >> 5);
-	int set = 0, bit = offset & 31, res;
-	
-	if (bit) {
-		/*
-		 * Look for zero in first byte
-		 */
-		__asm__("bsfl %1,%0\n\t"
-			"jne 1f\n\t"
-			"movl $32, %0\n"
-			"1:"
-			: "=r" (set)
-			: "r" (*p >> bit));
-		if (set < (32 - bit))
-			return set + offset;
-		set = 32 - bit;
-		p++;
-	}
-	/*
-	 * No bit found yet, search remaining full bytes for a bit
-	 */
-	res = ext2fs_find_first_bit_set(p, size - 32 * (p - (unsigned long *) addr));
-	return (offset + set + res);
-}
-#endif
-
-#undef OCFS2_ADDR
-
-#endif	/* i386 */
-
-#ifdef __mc68000__
-
-#define _OCFS2_HAVE_ASM_BITOPS_
-
-static inline int ocfs2_set_bit(int nr,void * addr)
-{
-	char retval;
-
-	__asm__ __volatile__ ("bfset %2@{%1:#1}; sne %0"
-	     : "=d" (retval) : "d" (nr^7), "a" (addr));
-
-	return retval;
-}
-
-static inline int ocfs2_clear_bit(int nr, void * addr)
-{
-	char retval;
-
-	__asm__ __volatile__ ("bfclr %2@{%1:#1}; sne %0"
-	     : "=d" (retval) : "d" (nr^7), "a" (addr));
-
-	return retval;
-}
-
-static inline int ocfs2_test_bit(int nr, const void * addr)
-{
-	char retval;
-
-	__asm__ __volatile__ ("bftst %2@{%1:#1}; sne %0"
-	     : "=d" (retval) : "d" (nr^7), "a" (addr));
-
-	return retval;
-}
-
-#endif /* __mc68000__ */
-
-#ifdef __sparc__
-
-#define _OCFS2_HAVE_ASM_BITOPS_
-
-/*
- * Do the bitops so that we are compatible with the standard i386
- * convention.
- */
-
-static inline int ocfs2_set_bit(int nr,void * addr)
-{
-#if 1
-	int		mask;
-	unsigned char	*ADDR = (unsigned char *) addr;
-
-	ADDR += nr >> 3;
-	mask = 1 << (nr & 0x07);
-	__asm__ __volatile__("ldub	[%0], %%g6\n\t"
-			     "or	%%g6, %2, %%g5\n\t"
-			     "stb	%%g5, [%0]\n\t"
-			     "and	%%g6, %2, %0\n"
-	: "=&r" (ADDR)
-	: "0" (ADDR), "r" (mask)
-	: "g5", "g6");
-	return (int) ADDR;
-#else
-	int		mask, retval;
-	unsigned char	*ADDR = (unsigned char *) addr;
-
-	ADDR += nr >> 3;
-	mask = 1 << (nr & 0x07);
-	retval = (mask & *ADDR) != 0;
-	*ADDR |= mask;
-	return retval;
-#endif
-}
-
-static inline int ocfs2_clear_bit(int nr, void * addr)
-{
-#if 1
-	int		mask;
-	unsigned char	*ADDR = (unsigned char *) addr;
-
-	ADDR += nr >> 3;
-	mask = 1 << (nr & 0x07);
-	__asm__ __volatile__("ldub	[%0], %%g6\n\t"
-			     "andn	%%g6, %2, %%g5\n\t"
-			     "stb	%%g5, [%0]\n\t"
-			     "and	%%g6, %2, %0\n"
-	: "=&r" (ADDR)
-	: "0" (ADDR), "r" (mask)
-	: "g5", "g6");
-	return (int) ADDR;
-	
-#else
-	int		mask, retval;
-	unsigned char	*ADDR = (unsigned char *) addr;
-
-	ADDR += nr >> 3;
-	mask = 1 << (nr & 0x07);
-	retval = (mask & *ADDR) != 0;
-	*ADDR &= ~mask;
-	return retval;
-#endif
-}
-
-static inline int ocfs2_test_bit(int nr, const void * addr)
-{
-	int			mask;
-	const unsigned char	*ADDR = (const unsigned char *) addr;
-
-	ADDR += nr >> 3;
-	mask = 1 << (nr & 0x07);
-	return ((mask & *ADDR) != 0);
-}
-
-#endif /* __sparc__ */
-
-#ifndef _OCFS2_HAVE_ASM_BITOPS_
 extern int ocfs2_set_bit(int nr,void * addr);
 extern int ocfs2_clear_bit(int nr, void * addr);
 extern int ocfs2_test_bit(int nr, const void * addr);
-#endif
 
-#if !defined(_OCFS2_HAVE_ASM_FINDBIT_)
 extern int ocfs2_find_first_bit_set(void *addr, int size);
 extern int ocfs2_find_first_bit_clear(void *addr, int size);
 extern int ocfs2_find_next_bit_set(void *addr, int size, int offset);
 extern int ocfs2_find_next_bit_clear(void *addr, int size, int offset);
-#endif	
 
+#endif

Modified: branches/global-heartbeat/libocfs2/include/byteorder.h
===================================================================
--- branches/global-heartbeat/libocfs2/include/byteorder.h	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/include/byteorder.h	2005-09-06 02:01:13 UTC (rev 1072)
@@ -33,13 +33,12 @@
 #include <stdint.h>
 
 /*
- * All OCFS2 on-disk values are in little endian, except for the
- * autoconfig areas and the journal areas.  The journal code has the
- * right bits for itself, and the autoconfig areas use htonl(), so
- * they are OK.
+ * All OCFS2 on-disk values are in little endian, except for jbd's journal
+ * fields which it takes care of itself.
  */
 
 #if __BYTE_ORDER == __LITTLE_ENDIAN
+#define cpu_is_little_endian	1
 # ifndef cpu_to_le16
 #  define cpu_to_le16(x) ((uint16_t)(x))
 # endif
@@ -77,6 +76,7 @@
 #  define be64_to_cpu(x) ((uint64_t)bswap_64(x))
 # endif
 #elif __BYTE_ORDER == __BIG_ENDIAN
+#define cpu_is_little_endian	0
 # ifndef cpu_to_le16
 #  define cpu_to_le16(x) ((uint16_t)bswap_16(x))
 # endif
@@ -117,4 +117,6 @@
 # error Invalid byte order __BYTE_ORDER
 #endif  /* __BYTE_ORDER */
 
+#define cpu_is_big_endian	(!cpu_is_little_endian)
+
 #endif  /* _BYTEORDER_H */

Copied: branches/global-heartbeat/libocfs2/include/jbd.h (from rev 1071, trunk/libocfs2/include/jbd.h)

Deleted: branches/global-heartbeat/libocfs2/include/jfs_compat.h
===================================================================
--- branches/global-heartbeat/libocfs2/include/jfs_compat.h	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/include/jfs_compat.h	2005-09-06 02:01:13 UTC (rev 1072)
@@ -1,67 +0,0 @@
-
-#ifndef _JFS_COMPAT_H
-#define _JFS_COMPAT_H
-
-#include "kernel-list.h"
-#include <errno.h>
-#include <netinet/in.h>
-
-// libocfs.h has these
-//#define printk printf
-//#define KERN_ERR ""
-#define KERN_DEBUG ""
-#define KERN_EMERG ""
-
-#define READ 0
-#define WRITE 1
-
-#define cpu_to_be32(n) htonl(n)
-#define be32_to_cpu(n) ntohl(n)
-
-typedef unsigned int tid_t;
-typedef struct journal_s journal_t;
-
-struct buffer_head;
-struct inode;
-
-struct journal_s
-{
-	unsigned long		j_flags;
-	int			j_errno;
-	struct buffer_head *	j_sb_buffer;
-	struct journal_superblock_s *j_superblock;
-	int			j_format_version;
-	unsigned long		j_head;
-	unsigned long		j_tail;
-	unsigned long		j_free;
-	unsigned long		j_first, j_last;
-	kdev_t			j_dev;
-	kdev_t			j_fs_dev;
-	int			j_blocksize;
-	unsigned int		j_blk_offset;
-	unsigned int		j_maxlen;
-	struct inode *		j_inode;
-	tid_t			j_tail_sequence;
-	tid_t			j_transaction_sequence;
-	__u8			j_uuid[16];
-	struct jbd_revoke_table_s *j_revoke;
-};
-
-#define J_ASSERT(assert)						\
-	do { if (!(assert)) {						\
-		printf ("Assertion failure in %s() at %s line %d: "	\
-			"\"%s\"\n",					\
-			__FUNCTION__, __FILE__, __LINE__, # assert);	\
-		fatal_error(e2fsck_global_ctx, 0);			\
-	} } while (0)
-
-#define is_journal_abort(x) 0
-
-#define BUFFER_TRACE(bh, info)	do {} while (0)
-
-/* Need this so we can compile with configure --enable-gcc-wall */
-#ifdef NO_INLINE_FUNCS
-#define inline
-#endif
-
-#endif /* _JFS_COMPAT_H */

Deleted: branches/global-heartbeat/libocfs2/include/jfs_user.h
===================================================================
--- branches/global-heartbeat/libocfs2/include/jfs_user.h	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/include/jfs_user.h	2005-09-06 02:01:13 UTC (rev 1072)
@@ -1,8 +0,0 @@
-#ifndef _JFS_USER_H
-#define _JFS_USER_H
-
-typedef unsigned short kdev_t;
-
-#include "kernel-jbd.h"
-
-#endif /* _JFS_USER_H */

Deleted: branches/global-heartbeat/libocfs2/include/kernel-jbd.h
===================================================================
--- branches/global-heartbeat/libocfs2/include/kernel-jbd.h	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/include/kernel-jbd.h	2005-09-06 02:01:13 UTC (rev 1072)
@@ -1,910 +0,0 @@
-/*
- * linux/include/linux/jbd.h
- * 
- * Written by Stephen C. Tweedie <sct at redhat.com>
- *
- * Copyright 1998-2000 Red Hat, Inc --- All Rights Reserved
- *
- * This file is part of the Linux kernel and is made available under
- * the terms of the GNU General Public License, version 2, or at your
- * option, any later version, incorporated herein by reference.
- *
- * Definitions for transaction data structures for the buffer cache
- * filesystem journaling support.
- */
-
-#ifndef _LINUX_JBD_H
-#define _LINUX_JBD_H
-
-#if defined(CONFIG_JBD) || defined(CONFIG_JBD_MODULE) || !defined(__KERNEL__)
-
-/* Allow this file to be included directly into e2fsprogs */
-#ifndef __KERNEL__
-#include "jfs_compat.h"
-#define JFS_DEBUG
-#define jfs_debug jbd_debug
-#else
-
-#include <linux/journal-head.h>
-#include <linux/stddef.h>
-#include <asm/semaphore.h>
-#endif
-
-#ifndef __GNUC__
-#define __FUNCTION__ ""
-#endif
-
-#define journal_oom_retry 1
-
-#ifdef __STDC__
-#ifdef CONFIG_JBD_DEBUG
-/*
- * Define JBD_EXPENSIVE_CHECKING to enable more expensive internal
- * consistency checks.  By default we don't do this unless
- * CONFIG_JBD_DEBUG is on.
- */
-#define JBD_EXPENSIVE_CHECKING
-extern int journal_enable_debug;
-
-#define jbd_debug(n, f, a...)						\
-	do {								\
-		if ((n) <= journal_enable_debug) {			\
-			printk (KERN_DEBUG "(%s, %d): %s: ",		\
-				__FILE__, __LINE__, __FUNCTION__);	\
-		  	printk (f, ## a);				\
-		}							\
-	} while (0)
-#else
-#ifdef __GNUC__
-#define jbd_debug(f, a...)	/**/
-#else
-#define jbd_debug(f, ...)	/**/
-#endif	
-#endif
-#else
-#define jbd_debug(x)		/* AIX doesn't do STDC */
-#endif
-
-extern void * __jbd_kmalloc (char *where, size_t size, int flags, int retry);
-#define jbd_kmalloc(size, flags) \
-	__jbd_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry)
-#define jbd_rep_kmalloc(size, flags) \
-	__jbd_kmalloc(__FUNCTION__, (size), (flags), 1)
-
-#define JFS_MIN_JOURNAL_BLOCKS 1024
-
-#ifdef __KERNEL__
-typedef struct handle_s		handle_t;	/* Atomic operation type */
-typedef struct journal_s	journal_t;	/* Journal control structure */
-#endif
-
-/*
- * Internal structures used by the logging mechanism:
- */
-
-#define JFS_MAGIC_NUMBER 0xc03b3998U /* The first 4 bytes of /dev/random! */
-
-/*
- * On-disk structures
- */
-
-/* 
- * Descriptor block types:
- */
-
-#define JFS_DESCRIPTOR_BLOCK	1
-#define JFS_COMMIT_BLOCK	2
-#define JFS_SUPERBLOCK_V1	3
-#define JFS_SUPERBLOCK_V2	4
-#define JFS_REVOKE_BLOCK	5
-
-/*
- * Standard header for all descriptor blocks:
- */
-typedef struct journal_header_s
-{
-	__u32		h_magic;
-	__u32		h_blocktype;
-	__u32		h_sequence;
-} journal_header_t;
-
-
-/* 
- * The block tag: used to describe a single buffer in the journal 
- */
-typedef struct journal_block_tag_s
-{
-	__u32		t_blocknr;	/* The on-disk block number */
-	__u32		t_flags;	/* See below */
-} journal_block_tag_t;
-
-/* 
- * The revoke descriptor: used on disk to describe a series of blocks to
- * be revoked from the log 
- */
-typedef struct journal_revoke_header_s
-{
-	journal_header_t r_header;
-	int		 r_count;	/* Count of bytes used in the block */
-} journal_revoke_header_t;
-
-
-/* Definitions for the journal tag flags word: */
-#define JFS_FLAG_ESCAPE		1	/* on-disk block is escaped */
-#define JFS_FLAG_SAME_UUID	2	/* block has same uuid as previous */
-#define JFS_FLAG_DELETED	4	/* block deleted by this transaction */
-#define JFS_FLAG_LAST_TAG	8	/* last tag in this descriptor block */
-
-
-/*
- * The journal superblock.  All fields are in big-endian byte order.
- */
-typedef struct journal_superblock_s
-{
-/* 0x0000 */
-	journal_header_t s_header;
-
-/* 0x000C */
-	/* Static information describing the journal */
-	__u32	s_blocksize;		/* journal device blocksize */
-	__u32	s_maxlen;		/* total blocks in journal file */
-	__u32	s_first;		/* first block of log information */
-	
-/* 0x0018 */
-	/* Dynamic information describing the current state of the log */
-	__u32	s_sequence;		/* first commit ID expected in log */
-	__u32	s_start;		/* blocknr of start of log */
-
-/* 0x0020 */
-	/* Error value, as set by journal_abort(). */
-	__s32	s_errno;
-
-/* 0x0024 */
-	/* Remaining fields are only valid in a version-2 superblock */
-	__u32	s_feature_compat; 	/* compatible feature set */
-	__u32	s_feature_incompat; 	/* incompatible feature set */
-	__u32	s_feature_ro_compat; 	/* readonly-compatible feature set */
-/* 0x0030 */
-	__u8	s_uuid[16];		/* 128-bit uuid for journal */
-
-/* 0x0040 */
-	__u32	s_nr_users;		/* Nr of filesystems sharing log */
-	
-	__u32	s_dynsuper;		/* Blocknr of dynamic superblock copy*/
-	
-/* 0x0048 */
-	__u32	s_max_transaction;	/* Limit of journal blocks per trans.*/
-	__u32	s_max_trans_data;	/* Limit of data blocks per trans. */
-
-/* 0x0050 */
-	__u32	s_padding[44];
-
-/* 0x0100 */
-	__u8	s_users[16*48];		/* ids of all fs'es sharing the log */
-/* 0x0400 */
-} journal_superblock_t;
-
-#define JFS_HAS_COMPAT_FEATURE(j,mask)					\
-	((j)->j_format_version >= 2 &&					\
-	 ((j)->j_superblock->s_feature_compat & cpu_to_be32((mask))))
-#define JFS_HAS_RO_COMPAT_FEATURE(j,mask)				\
-	((j)->j_format_version >= 2 &&					\
-	 ((j)->j_superblock->s_feature_ro_compat & cpu_to_be32((mask))))
-#define JFS_HAS_INCOMPAT_FEATURE(j,mask)				\
-	((j)->j_format_version >= 2 &&					\
-	 ((j)->j_superblock->s_feature_incompat & cpu_to_be32((mask))))
-
-#define JFS_FEATURE_INCOMPAT_REVOKE	0x00000001
-
-/* Features known to this kernel version: */
-#define JFS_KNOWN_COMPAT_FEATURES	0
-#define JFS_KNOWN_ROCOMPAT_FEATURES	0
-#define JFS_KNOWN_INCOMPAT_FEATURES	JFS_FEATURE_INCOMPAT_REVOKE
-
-#ifdef __KERNEL__
-
-#include <linux/fs.h>
-#include <linux/sched.h>
-
-#define JBD_ASSERTIONS
-#ifdef JBD_ASSERTIONS
-#define J_ASSERT(assert)						\
-do {									\
-	if (!(assert)) {						\
-		printk (KERN_EMERG					\
-			"Assertion failure in %s() at %s:%d: \"%s\"\n",	\
-			__FUNCTION__, __FILE__, __LINE__, # assert);	\
-		BUG();							\
-	}								\
-} while (0)
-
-#if defined(CONFIG_BUFFER_DEBUG)
-void buffer_assertion_failure(struct buffer_head *bh);
-#define J_ASSERT_BH(bh, expr)						\
-	do {								\
-		if (!(expr))						\
-			buffer_assertion_failure(bh);			\
-		J_ASSERT(expr);						\
-	} while (0)
-#define J_ASSERT_JH(jh, expr)	J_ASSERT_BH(jh2bh(jh), expr)
-#else
-#define J_ASSERT_BH(bh, expr)	J_ASSERT(expr)
-#define J_ASSERT_JH(jh, expr)	J_ASSERT(expr)
-#endif
-
-#else
-#define J_ASSERT(assert)
-#endif		/* JBD_ASSERTIONS */
-
-enum jbd_state_bits {
-	BH_JWrite
-	  = BH_PrivateStart,	/* 1 if being written to log (@@@ DEBUGGING) */
-	BH_Freed,		/* 1 if buffer has been freed (truncated) */
-	BH_Revoked,		/* 1 if buffer has been revoked from the log */
-	BH_RevokeValid,		/* 1 if buffer revoked flag is valid */
-	BH_JBDDirty,		/* 1 if buffer is dirty but journaled */
-};
-
-/* Return true if the buffer is one which JBD is managing */
-static inline int buffer_jbd(struct buffer_head *bh)
-{
-	return __buffer_state(bh, JBD);
-}
-
-static inline struct buffer_head *jh2bh(struct journal_head *jh)
-{
-	return jh->b_bh;
-}
-
-static inline struct journal_head *bh2jh(struct buffer_head *bh)
-{
-	return bh->b_private;
-}
-
-struct jbd_revoke_table_s;
-
-/* The handle_t type represents a single atomic update being performed
- * by some process.  All filesystem modifications made by the process go
- * through this handle.  Recursive operations (such as quota operations)
- * are gathered into a single update.
- *
- * The buffer credits field is used to account for journaled buffers
- * being modified by the running process.  To ensure that there is
- * enough log space for all outstanding operations, we need to limit the
- * number of outstanding buffers possible at any time.  When the
- * operation completes, any buffer credits not used are credited back to
- * the transaction, so that at all times we know how many buffers the
- * outstanding updates on a transaction might possibly touch. */
-
-struct handle_s 
-{
-	/* Which compound transaction is this update a part of? */
-	transaction_t	      * h_transaction;
-
-	/* Number of remaining buffers we are allowed to dirty: */
-	int			h_buffer_credits;
-
-	/* Reference count on this handle */
-	int			h_ref;
-
-	/* Field for caller's use to track errors through large fs
-	   operations */
-	int			h_err;
-
-	/* Flags */
-	unsigned int	h_sync:		1;	/* sync-on-close */
-	unsigned int	h_jdata:	1;	/* force data journaling */
-	unsigned int	h_aborted:	1;	/* fatal error on handle */
-};
-
-
-/* The transaction_t type is the guts of the journaling mechanism.  It
- * tracks a compound transaction through its various states:
- *
- * RUNNING:	accepting new updates
- * LOCKED:	Updates still running but we don't accept new ones
- * RUNDOWN:	Updates are tidying up but have finished requesting
- *		new buffers to modify (state not used for now)
- * FLUSH:       All updates complete, but we are still writing to disk
- * COMMIT:      All data on disk, writing commit record
- * FINISHED:	We still have to keep the transaction for checkpointing.
- *
- * The transaction keeps track of all of the buffers modified by a
- * running transaction, and all of the buffers committed but not yet
- * flushed to home for finished transactions.
- */
-
-struct transaction_s 
-{
-	/* Pointer to the journal for this transaction. */
-	journal_t *		t_journal;
-	
-	/* Sequence number for this transaction */
-	tid_t			t_tid;
-	
-	/* Transaction's current state */
-	enum {
-		T_RUNNING,
-		T_LOCKED,
-		T_RUNDOWN,
-		T_FLUSH,
-		T_COMMIT,
-		T_FINISHED 
-	}			t_state;
-
-	/* Where in the log does this transaction's commit start? */
-	unsigned long		t_log_start;
-	
-	/* Doubly-linked circular list of all inodes owned by this
-           transaction */	/* AKPM: unused */
-	struct inode *		t_ilist;
-	
-	/* Number of buffers on the t_buffers list */
-	int			t_nr_buffers;
-	
-	/* Doubly-linked circular list of all buffers reserved but not
-           yet modified by this transaction */
-	struct journal_head *	t_reserved_list;
-	
-	/* Doubly-linked circular list of all metadata buffers owned by this
-           transaction */
-	struct journal_head *	t_buffers;
-	
-	/*
-	 * Doubly-linked circular list of all data buffers still to be
-	 * flushed before this transaction can be committed.
-	 * Protected by journal_datalist_lock.
-	 */
-	struct journal_head *	t_sync_datalist;
-	
-	/*
-	 * Doubly-linked circular list of all writepage data buffers
-	 * still to be written before this transaction can be committed.
-	 * Protected by journal_datalist_lock.
-	 */
-	struct journal_head *	t_async_datalist;
-	
-	/* Doubly-linked circular list of all forget buffers (superceded
-           buffers which we can un-checkpoint once this transaction
-           commits) */
-	struct journal_head *	t_forget;
-	
-	/*
-	 * Doubly-linked circular list of all buffers still to be
-	 * flushed before this transaction can be checkpointed.
-	 */
-	/* Protected by journal_datalist_lock */
-	struct journal_head *	t_checkpoint_list;
-	
-	/* Doubly-linked circular list of temporary buffers currently
-           undergoing IO in the log */
-	struct journal_head *	t_iobuf_list;
-	
-	/* Doubly-linked circular list of metadata buffers being
-           shadowed by log IO.  The IO buffers on the iobuf list and the
-           shadow buffers on this list match each other one for one at
-           all times. */
-	struct journal_head *	t_shadow_list;
-	
-	/* Doubly-linked circular list of control buffers being written
-           to the log. */
-	struct journal_head *	t_log_list;
-	
-	/* Number of outstanding updates running on this transaction */
-	int			t_updates;
-
-	/* Number of buffers reserved for use by all handles in this
-	 * transaction handle but not yet modified. */
-	int			t_outstanding_credits;
-	
-	/*
-	 * Forward and backward links for the circular list of all
-	 * transactions awaiting checkpoint.
-	 */
-	/* Protected by journal_datalist_lock */
-	transaction_t		*t_cpnext, *t_cpprev;
-
-	/* When will the transaction expire (become due for commit), in
-	 * jiffies ? */
-	unsigned long		t_expires;
-
-	/* How many handles used this transaction? */
-	int t_handle_count;
-};
-
-
-/* The journal_t maintains all of the journaling state information for a
- * single filesystem.  It is linked to from the fs superblock structure.
- * 
- * We use the journal_t to keep track of all outstanding transaction
- * activity on the filesystem, and to manage the state of the log
- * writing process. */
-
-struct journal_s
-{
-	/* General journaling state flags */
-	unsigned long		j_flags;
-
-	/* Is there an outstanding uncleared error on the journal (from
-	 * a prior abort)? */
-	int			j_errno;
-	
-	/* The superblock buffer */
-	struct buffer_head *	j_sb_buffer;
-	journal_superblock_t *	j_superblock;
-
-	/* Version of the superblock format */
-	int			j_format_version;
-
-	/* Number of processes waiting to create a barrier lock */
-	int			j_barrier_count;
-	
-	/* The barrier lock itself */
-	struct semaphore	j_barrier;
-	
-	/* Transactions: The current running transaction... */
-	transaction_t *		j_running_transaction;
-	
-	/* ... the transaction we are pushing to disk ... */
-	transaction_t *		j_committing_transaction;
-	
-	/* ... and a linked circular list of all transactions waiting
-	 * for checkpointing. */
-	/* Protected by journal_datalist_lock */
-	transaction_t *		j_checkpoint_transactions;
-
-	/* Wait queue for waiting for a locked transaction to start
-           committing, or for a barrier lock to be released */
-	wait_queue_head_t	j_wait_transaction_locked;
-	
-	/* Wait queue for waiting for checkpointing to complete */
-	wait_queue_head_t	j_wait_logspace;
-	
-	/* Wait queue for waiting for commit to complete */
-	wait_queue_head_t	j_wait_done_commit;
-	
-	/* Wait queue to trigger checkpointing */
-	wait_queue_head_t	j_wait_checkpoint;
-	
-	/* Wait queue to trigger commit */
-	wait_queue_head_t	j_wait_commit;
-	
-	/* Wait queue to wait for updates to complete */
-	wait_queue_head_t	j_wait_updates;
-
-	/* Semaphore for locking against concurrent checkpoints */
-	struct semaphore 	j_checkpoint_sem;
-
-	/* The main journal lock, used by lock_journal() */
-	struct semaphore	j_sem;
-		
-	/* Journal head: identifies the first unused block in the journal. */
-	unsigned long		j_head;
-	
-	/* Journal tail: identifies the oldest still-used block in the
-	 * journal. */
-	unsigned long		j_tail;
-
-	/* Journal free: how many free blocks are there in the journal? */
-	unsigned long		j_free;
-
-	/* Journal start and end: the block numbers of the first usable
-	 * block and one beyond the last usable block in the journal. */
-	unsigned long		j_first, j_last;
-
-	/* Device, blocksize and starting block offset for the location
-	 * where we store the journal. */
-	kdev_t			j_dev;
-	int			j_blocksize;
-	unsigned int		j_blk_offset;
-
-	/* Device which holds the client fs.  For internal journal this
-	 * will be equal to j_dev. */
-	kdev_t			j_fs_dev;
-
-	/* Total maximum capacity of the journal region on disk. */
-	unsigned int		j_maxlen;
-
-	/* Optional inode where we store the journal.  If present, all
-	 * journal block numbers are mapped into this inode via
-	 * bmap(). */
-	struct inode *		j_inode;
-
-	/* Sequence number of the oldest transaction in the log */
-	tid_t			j_tail_sequence;
-	/* Sequence number of the next transaction to grant */
-	tid_t			j_transaction_sequence;
-	/* Sequence number of the most recently committed transaction */
-	tid_t			j_commit_sequence;
-	/* Sequence number of the most recent transaction wanting commit */
-	tid_t			j_commit_request;
-
-	/* Journal uuid: identifies the object (filesystem, LVM volume
-	 * etc) backed by this journal.  This will eventually be
-	 * replaced by an array of uuids, allowing us to index multiple
-	 * devices within a single journal and to perform atomic updates
-	 * across them.  */
-
-	__u8			j_uuid[16];
-
-	/* Pointer to the current commit thread for this journal */
-	struct task_struct *	j_task;
-
-	/* Maximum number of metadata buffers to allow in a single
-	 * compound commit transaction */
-	int			j_max_transaction_buffers;
-
-	/* What is the maximum transaction lifetime before we begin a
-	 * commit? */
-	unsigned long		j_commit_interval;
-
-	/* The timer used to wakeup the commit thread: */
-	struct timer_list *	j_commit_timer;
-	int			j_commit_timer_active;
-
-	/* Link all journals together - system-wide */
-	struct list_head	j_all_journals;
-
-	/* The revoke table: maintains the list of revoked blocks in the
-           current transaction. */
-	struct jbd_revoke_table_s *j_revoke;
-};
-
-/* 
- * Journal flag definitions 
- */
-#define JFS_UNMOUNT	0x001	/* Journal thread is being destroyed */
-#define JFS_ABORT	0x002	/* Journaling has been aborted for errors. */
-#define JFS_ACK_ERR	0x004	/* The errno in the sb has been acked */
-#define JFS_FLUSHED	0x008	/* The journal superblock has been flushed */
-#define JFS_LOADED	0x010	/* The journal superblock has been loaded */
-
-/* 
- * Function declarations for the journaling transaction and buffer
- * management
- */
-
-/* Filing buffers */
-extern void __journal_unfile_buffer(struct journal_head *);
-extern void journal_unfile_buffer(struct journal_head *);
-extern void __journal_refile_buffer(struct journal_head *);
-extern void journal_refile_buffer(struct journal_head *);
-extern void __journal_file_buffer(struct journal_head *, transaction_t *, int);
-extern void __journal_free_buffer(struct journal_head *bh);
-extern void journal_file_buffer(struct journal_head *, transaction_t *, int);
-extern void __journal_clean_data_list(transaction_t *transaction);
-
-/* Log buffer allocation */
-extern struct journal_head * journal_get_descriptor_buffer(journal_t *);
-extern unsigned long journal_next_log_block(journal_t *);
-
-/* Commit management */
-extern void journal_commit_transaction(journal_t *);
-
-/* Checkpoint list management */
-int __journal_clean_checkpoint_list(journal_t *journal);
-extern void journal_remove_checkpoint(struct journal_head *);
-extern void __journal_remove_checkpoint(struct journal_head *);
-extern void journal_insert_checkpoint(struct journal_head *, transaction_t *);
-extern void __journal_insert_checkpoint(struct journal_head *,transaction_t *);
-
-/* Buffer IO */
-extern int 
-journal_write_metadata_buffer(transaction_t	  *transaction,
-			      struct journal_head  *jh_in,
-			      struct journal_head **jh_out,
-			      int		   blocknr);
-
-/* Transaction locking */
-extern void		__wait_on_journal (journal_t *);
-
-/*
- * Journal locking.
- *
- * We need to lock the journal during transaction state changes so that
- * nobody ever tries to take a handle on the running transaction while
- * we are in the middle of moving it to the commit phase.  
- *
- * Note that the locking is completely interrupt unsafe.  We never touch
- * journal structures from interrupts.
- *
- * In 2.2, the BKL was required for lock_journal.  This is no longer
- * the case.
- */
-
-static inline void lock_journal(journal_t *journal)
-{
-	down(&journal->j_sem);
-}
-
-/* This returns zero if we acquired the semaphore */
-static inline int try_lock_journal(journal_t * journal)
-{
-	return down_trylock(&journal->j_sem);
-}
-
-static inline void unlock_journal(journal_t * journal)
-{
-	up(&journal->j_sem);
-}
-
-
-static inline handle_t *journal_current_handle(void)
-{
-	return current->journal_info;
-}
-
-/* The journaling code user interface:
- *
- * Create and destroy handles
- * Register buffer modifications against the current transaction. 
- */
-
-extern handle_t *journal_start(journal_t *, int nblocks);
-extern handle_t *journal_try_start(journal_t *, int nblocks);
-extern int	 journal_restart (handle_t *, int nblocks);
-extern int	 journal_extend (handle_t *, int nblocks);
-extern int	 journal_get_write_access (handle_t *, struct buffer_head *);
-extern int	 journal_get_create_access (handle_t *, struct buffer_head *);
-extern int	 journal_get_undo_access (handle_t *, struct buffer_head *);
-extern int	 journal_dirty_data (handle_t *,
-				struct buffer_head *, int async);
-extern int	 journal_dirty_metadata (handle_t *, struct buffer_head *);
-extern void	 journal_release_buffer (handle_t *, struct buffer_head *);
-extern void	 journal_forget (handle_t *, struct buffer_head *);
-extern void	 journal_sync_buffer (struct buffer_head *);
-extern int	 journal_flushpage(journal_t *, struct page *, unsigned long);
-extern int	 journal_try_to_free_buffers(journal_t *, struct page *, int);
-extern int	 journal_stop(handle_t *);
-extern int	 journal_flush (journal_t *);
-
-extern void	 journal_lock_updates (journal_t *);
-extern void	 journal_unlock_updates (journal_t *);
-
-extern journal_t * journal_init_dev(kdev_t dev, kdev_t fs_dev,
-				int start, int len, int bsize);
-extern journal_t * journal_init_inode (struct inode *);
-extern int	   journal_update_format (journal_t *);
-extern int	   journal_check_used_features 
-		   (journal_t *, unsigned long, unsigned long, unsigned long);
-extern int	   journal_check_available_features 
-		   (journal_t *, unsigned long, unsigned long, unsigned long);
-extern int	   journal_set_features 
-		   (journal_t *, unsigned long, unsigned long, unsigned long);
-extern int	   journal_create     (journal_t *);
-extern int	   journal_load       (journal_t *journal);
-extern void	   journal_destroy    (journal_t *);
-extern int	   journal_recover    (journal_t *journal);
-extern int	   journal_wipe       (journal_t *, int);
-extern int	   journal_skip_recovery (journal_t *);
-extern void	   journal_update_superblock (journal_t *, int);
-extern void	   __journal_abort      (journal_t *);
-extern void	   journal_abort      (journal_t *, int);
-extern int	   journal_errno      (journal_t *);
-extern void	   journal_ack_err    (journal_t *);
-extern int	   journal_clear_err  (journal_t *);
-extern unsigned long journal_bmap(journal_t *journal, unsigned long blocknr);
-extern int	    journal_force_commit(journal_t *journal);
-
-/*
- * journal_head management
- */
-extern struct journal_head
-		*journal_add_journal_head(struct buffer_head *bh);
-extern void	journal_remove_journal_head(struct buffer_head *bh);
-extern void	__journal_remove_journal_head(struct buffer_head *bh);
-extern void	journal_unlock_journal_head(struct journal_head *jh);
-
-/* Primary revoke support */
-#define JOURNAL_REVOKE_DEFAULT_HASH 256
-extern int	   journal_init_revoke(journal_t *, int);
-extern void	   journal_destroy_revoke_caches(void);
-extern int	   journal_init_revoke_caches(void);
-
-extern void	   journal_destroy_revoke(journal_t *);
-extern int	   journal_revoke (handle_t *,
-				unsigned long, struct buffer_head *);
-extern int	   journal_cancel_revoke(handle_t *, struct journal_head *);
-extern void	   journal_write_revoke_records(journal_t *, transaction_t *);
-
-/* Recovery revoke support */
-extern int	   journal_set_revoke(journal_t *, unsigned long, tid_t);
-extern int	   journal_test_revoke(journal_t *, unsigned long, tid_t);
-extern void	   journal_clear_revoke(journal_t *);
-extern void	   journal_brelse_array(struct buffer_head *b[], int n);
-
-/* The log thread user interface:
- *
- * Request space in the current transaction, and force transaction commit
- * transitions on demand.
- */
-
-extern int	log_space_left (journal_t *); /* Called with journal locked */
-extern tid_t	log_start_commit (journal_t *, transaction_t *);
-extern void	log_wait_commit (journal_t *, tid_t);
-extern int	log_do_checkpoint (journal_t *, int);
-
-extern void	log_wait_for_space(journal_t *, int nblocks);
-extern void	__journal_drop_transaction(journal_t *, transaction_t *);
-extern int	cleanup_journal_tail(journal_t *);
-
-/* Reduce journal memory usage by flushing */
-extern void shrink_journal_memory(void);
-
-/* Debugging code only: */
-
-#define jbd_ENOSYS() \
-do {								      \
-	printk (KERN_ERR "JBD unimplemented function " __FUNCTION__); \
-	current->state = TASK_UNINTERRUPTIBLE;			      \
-	schedule();						      \
-} while (1)
-
-/*
- * is_journal_abort
- *
- * Simple test wrapper function to test the JFS_ABORT state flag.  This
- * bit, when set, indicates that we have had a fatal error somewhere,
- * either inside the journaling layer or indicated to us by the client
- * (eg. ext3), and that we and should not commit any further
- * transactions.  
- */
-
-static inline int is_journal_aborted(journal_t *journal)
-{
-	return journal->j_flags & JFS_ABORT;
-}
-
-static inline int is_handle_aborted(handle_t *handle)
-{
-	if (handle->h_aborted)
-		return 1;
-	return is_journal_aborted(handle->h_transaction->t_journal);
-}
-
-static inline void journal_abort_handle(handle_t *handle)
-{
-	handle->h_aborted = 1;
-}
-
-/* Not all architectures define BUG() */
-#ifndef BUG
-#define BUG() do { \
-        printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
-	* ((char *) 0) = 0; \
- } while (0)
-#endif /* BUG */
-
-#else
-
-extern int	   journal_recover    (journal_t *journal);
-extern int	   journal_skip_recovery (journal_t *);
-
-/* Primary revoke support */
-extern int	   journal_init_revoke(journal_t *, int);
-extern void	   journal_destroy_revoke_caches(void);
-extern int	   journal_init_revoke_caches(void);
-
-/* Recovery revoke support */
-extern int	   journal_set_revoke(journal_t *, unsigned long, tid_t);
-extern int	   journal_test_revoke(journal_t *, unsigned long, tid_t);
-extern void	   journal_clear_revoke(journal_t *);
-extern void	   journal_brelse_array(struct buffer_head *b[], int n);
-
-extern void	   journal_destroy_revoke(journal_t *);
-#endif /* __KERNEL__   */
-
-/* Comparison functions for transaction IDs: perform comparisons using
- * modulo arithmetic so that they work over sequence number wraps. */
-
-static inline int tid_gt(tid_t x, tid_t y)
-{
-	int difference = (x - y);
-	return (difference > 0);
-}
-
-static inline int tid_geq(tid_t x, tid_t y)
-{
-	int difference = (x - y);
-	return (difference >= 0);
-}
-
-extern int journal_blocks_per_page(struct inode *inode);
-
-/*
- * Definitions which augment the buffer_head layer
- */
-
-/* journaling buffer types */
-#define BJ_None		0	/* Not journaled */
-#define BJ_SyncData	1	/* Normal data: flush before commit */
-#define BJ_AsyncData	2	/* writepage data: wait on it before commit */
-#define BJ_Metadata	3	/* Normal journaled metadata */
-#define BJ_Forget	4	/* Buffer superceded by this transaction */
-#define BJ_IO		5	/* Buffer is for temporary IO use */
-#define BJ_Shadow	6	/* Buffer contents being shadowed to the log */
-#define BJ_LogCtl	7	/* Buffer contains log descriptors */
-#define BJ_Reserved	8	/* Buffer is reserved for access by journal */
-#define BJ_Types	9
- 
-extern int jbd_blocks_per_page(struct inode *inode);
-
-#ifdef __KERNEL__
-
-extern spinlock_t jh_splice_lock;
-/*
- * Once `expr1' has been found true, take jh_splice_lock
- * and then reevaluate everything.
- */
-#define SPLICE_LOCK(expr1, expr2)				\
-	({							\
-		int ret = (expr1);				\
-		if (ret) {					\
-			spin_lock(&jh_splice_lock);		\
-			ret = (expr1) && (expr2);		\
-			spin_unlock(&jh_splice_lock);		\
-		}						\
-		ret;						\
-	})
-
-/*
- * A number of buffer state predicates.  They test for
- * buffer_jbd() because they are used in core kernel code.
- *
- * These will be racy on SMP unless we're *sure* that the
- * buffer won't be detached from the journalling system
- * in parallel.
- */
-
-/* Return true if the buffer is on journal list `list' */
-static inline int buffer_jlist_eq(struct buffer_head *bh, int list)
-{
-	return SPLICE_LOCK(buffer_jbd(bh), bh2jh(bh)->b_jlist == list);
-}
-
-/* Return true if this bufer is dirty wrt the journal */
-static inline int buffer_jdirty(struct buffer_head *bh)
-{
-	return buffer_jbd(bh) && __buffer_state(bh, JBDDirty);
-}
-
-/* Return true if it's a data buffer which journalling is managing */
-static inline int buffer_jbd_data(struct buffer_head *bh)
-{
-	return SPLICE_LOCK(buffer_jbd(bh),
-			bh2jh(bh)->b_jlist == BJ_SyncData ||
-			bh2jh(bh)->b_jlist == BJ_AsyncData);
-}
-
-#ifdef CONFIG_SMP
-#define assert_spin_locked(lock)	J_ASSERT(spin_is_locked(lock))
-#else
-#define assert_spin_locked(lock)	do {} while(0)
-#endif
-
-#define buffer_trace_init(bh)	do {} while (0)
-#define print_buffer_fields(bh)	do {} while (0)
-#define print_buffer_trace(bh)	do {} while (0)
-#define BUFFER_TRACE(bh, info)	do {} while (0)
-#define BUFFER_TRACE2(bh, bh2, info)	do {} while (0)
-#define JBUFFER_TRACE(jh, info)	do {} while (0)
-
-#endif	/* __KERNEL__ */
-
-#endif	/* CONFIG_JBD || CONFIG_JBD_MODULE || !__KERNEL__ */
-
-/*
- * Compatibility no-ops which allow the kernel to compile without CONFIG_JBD
- * go here.
- */
-
-#if defined(__KERNEL__) && !(defined(CONFIG_JBD) || defined(CONFIG_JBD_MODULE))
-
-#define J_ASSERT(expr)			do {} while (0)
-#define J_ASSERT_BH(bh, expr)		do {} while (0)
-#define buffer_jbd(bh)			0
-#define buffer_jlist_eq(bh, val)	0
-#define journal_buffer_journal_lru(bh)	0
-
-#endif	/* defined(__KERNEL__) && !defined(CONFIG_JBD) */
-#endif	/* _LINUX_JBD_H */

Modified: branches/global-heartbeat/libocfs2/include/ocfs2.h
===================================================================
--- branches/global-heartbeat/libocfs2/include/ocfs2.h	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/include/ocfs2.h	2005-09-06 02:01:13 UTC (rev 1072)
@@ -50,19 +50,19 @@
 #include <kernel-list.h>
 #include <kernel-rbtree.h>
 
+#include <o2dlm.h>
+#include <o2cb.h>
+
 #if OCFS2_FLAT_INCLUDES
 #include "ocfs2_err.h"
-
 #include "ocfs2_fs.h"
+#include "jbd.h"
 #else
 #include <ocfs2/ocfs2_err.h>
-
 #include <ocfs2/ocfs2_fs.h>
+#include <ocfs2/jbd.h>
 #endif
 
-#include <o2dlm.h>
-#include <o2cb.h>
-
 #define OCFS2_LIB_FEATURE_INCOMPAT_SUPP		(OCFS2_FEATURE_INCOMPAT_SUPP | OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV)
 #define OCFS2_LIB_FEATURE_RO_COMPAT_SUPP	OCFS2_FEATURE_RO_COMPAT_SUPP
 
@@ -253,8 +253,8 @@
 errcode_t ocfs2_close(ocfs2_filesys *fs);
 void ocfs2_freefs(ocfs2_filesys *fs);
 
+void ocfs2_swap_inode_from_cpu(ocfs2_dinode *di);
 void ocfs2_swap_inode_to_cpu(ocfs2_dinode *di);
-void ocfs2_swap_inode_to_le(ocfs2_dinode *di);
 errcode_t ocfs2_read_inode(ocfs2_filesys *fs, uint64_t blkno,
 			   char *inode_buf);
 errcode_t ocfs2_write_inode(ocfs2_filesys *fs, uint64_t blkno,
@@ -268,6 +268,8 @@
 errcode_t ocfs2_free_cached_inode(ocfs2_filesys *fs,
 				  ocfs2_cached_inode *cinode);
 
+void ocfs2_swap_extent_list_from_cpu(ocfs2_extent_list *el);
+void ocfs2_swap_extent_list_to_cpu(ocfs2_extent_list *el);
 errcode_t ocfs2_extent_map_init(ocfs2_filesys *fs,
 				ocfs2_cached_inode *cinode);
 void ocfs2_extent_map_free(ocfs2_cached_inode *cinode);
@@ -292,9 +294,9 @@
 errcode_t ocfs2_load_extent_map(ocfs2_filesys *fs,
 				ocfs2_cached_inode *cinode);
 
+void ocfs2_swap_journal_superblock(journal_superblock_t *jsb);
 errcode_t ocfs2_init_journal_superblock(ocfs2_filesys *fs, char *buf,
 					int buflen, uint32_t jrnl_size);
-
 errcode_t ocfs2_create_journal_superblock(ocfs2_filesys *fs,
 					  uint32_t size, int flags,
 					  char **ret_jsb);
@@ -350,6 +352,8 @@
 						void *priv_data),
 				    void *priv_data);
 
+errcode_t ocfs2_swap_dir_entries_from_cpu(void *buf, uint64_t bytes);
+errcode_t ocfs2_swap_dir_entries_to_cpu(void *buf, uint64_t bytes);
 errcode_t ocfs2_read_dir_block(ocfs2_filesys *fs, uint64_t block,
 			       void *buf);
 errcode_t ocfs2_write_dir_block(ocfs2_filesys *fs, uint64_t block,
@@ -429,7 +433,7 @@
 				   uint64_t first_bit);
 
 errcode_t ocfs2_get_device_size(const char *file, int blocksize,
-				uint32_t *retblocks);
+				uint64_t *retblocks);
 
 errcode_t ocfs2_get_device_sectsize(const char *file, int *sectsize);
 
@@ -440,6 +444,7 @@
 errcode_t ocfs2_read_whole_file(ocfs2_filesys *fs, uint64_t blkno,
 				char **buf, int *len);
 
+void ocfs2_swap_disk_heartbeat_block(struct o2hb_disk_heartbeat_block *hb);
 errcode_t ocfs2_check_heartbeat(char *device, int *mount_flags,
 				struct list_head *nodes_list);
 
@@ -448,6 +453,7 @@
 errcode_t ocfs2_get_ocfs1_label(char *device, uint8_t *label, uint16_t label_len,
 				uint8_t *uuid, uint16_t uuid_len);
 
+void ocfs2_swap_group_desc(ocfs2_group_desc *gd);
 errcode_t ocfs2_read_group_desc(ocfs2_filesys *fs, uint64_t blkno,
 				char *gd_buf);
 
@@ -569,6 +575,8 @@
 
 errcode_t ocfs2_meta_unlock(ocfs2_filesys *fs, ocfs2_cached_inode *ci);
 
+void ocfs2_swap_slot_map(int16_t *map, loff_t num_slots);
+
 /* 
  * ${foo}_to_${bar} is a floor function.  blocks_to_clusters will
  * returns the cluster that contains a block, not the number of clusters

Modified: branches/global-heartbeat/libocfs2/include/ocfs2_fs.h
===================================================================
--- branches/global-heartbeat/libocfs2/include/ocfs2_fs.h	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/include/ocfs2_fs.h	2005-09-06 02:01:13 UTC (rev 1072)
@@ -10,12 +10,12 @@
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public
  * License, version 2,  as published by the Free Software Foundation.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public
  * License along with this program; if not, write to the
  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
@@ -86,20 +86,9 @@
 	OCFS2_SB(sb)->s_feature_incompat &= ~(mask)
 
 #define OCFS2_FEATURE_COMPAT_SUPP	0
+#define OCFS2_FEATURE_INCOMPAT_SUPP	0
 #define OCFS2_FEATURE_RO_COMPAT_SUPP	0
 
-/* We're not big endian safe yet. But it has been decreed that the
- * unwashed zLinux masses must be appeased, lest they storm the castle
- * with rakes and pitchforks. Thus...
- */
-#ifdef CONFIG_ARCH_S390
-#define OCFS2_FEATURE_INCOMPAT_B0RKEN_ENDIAN	0x0001
-
-#define OCFS2_FEATURE_INCOMPAT_SUPP	OCFS2_FEATURE_INCOMPAT_B0RKEN_ENDIAN
-#else
-#define OCFS2_FEATURE_INCOMPAT_SUPP	0
-#endif
-
 /*
  * Heartbeat-only devices are missing journals and other files.  The
  * filesystem driver can't load them, but the library can.  Never put
@@ -243,29 +232,27 @@
  * Convenience casts
  */
 #define OCFS2_RAW_SB(dinode)		(&((dinode)->id2.i_super))
-#define OCFS2_LOCAL_ALLOC(dinode)	(&((dinode)->id2.i_lab))
 
-
 /*
  * On disk extent record for OCFS2
  * It describes a range of clusters on disk.
  */
 typedef struct _ocfs2_extent_rec {
-/*00*/	__u32 e_cpos;		/* Offset into the file, in clusters */
-	__u32 e_clusters;	/* Clusters covered by this extent */
-	__u64 e_blkno;		/* Physical disk offset, in blocks */
+/*00*/	__le32 e_cpos;		/* Offset into the file, in clusters */
+	__le32 e_clusters;	/* Clusters covered by this extent */
+	__le64 e_blkno;		/* Physical disk offset, in blocks */
 /*10*/
-} ocfs2_extent_rec;	
+} ocfs2_extent_rec;
 
 typedef struct _ocfs2_chain_rec {
-	__u32 c_free;	/* Number of free bits in this chain. */
-	__u32 c_total;	/* Number of total bits in this chain */
-	__u64 c_blkno;	/* Physical disk offset (blocks) of 1st group */
+	__le32 c_free;	/* Number of free bits in this chain. */
+	__le32 c_total;	/* Number of total bits in this chain */
+	__le64 c_blkno;	/* Physical disk offset (blocks) of 1st group */
 } ocfs2_chain_rec;
 
 typedef struct _ocfs2_truncate_rec {
-	__u32 t_start;		/* 1st cluster in this log */
-	__u32 t_clusters;	/* Number of total clusters covered */
+	__le32 t_start;		/* 1st cluster in this log */
+	__le32 t_clusters;	/* Number of total clusters covered */
 } ocfs2_truncate_rec;
 
 /*
@@ -275,14 +262,14 @@
  * ocfs2_extent_block.h_list, respectively.
  */
 typedef struct _ocfs2_extent_list {
-/*00*/	__u16 l_tree_depth;		/* Extent tree depth from this
+/*00*/	__le16 l_tree_depth;		/* Extent tree depth from this
 					   point.  0 means data extents
 					   hang directly off this
 					   header (a leaf) */
-	__u16 l_count;			/* Number of extent records */
-	__u16 l_next_free_rec;		/* Next unused extent slot */
-	__u16 l_reserved1;
-	__u64 l_reserved2;		/* Pad to
+	__le16 l_count;			/* Number of extent records */
+	__le16 l_next_free_rec;		/* Next unused extent slot */
+	__le16 l_reserved1;
+	__le64 l_reserved2;		/* Pad to
 					   sizeof(ocfs2_extent_rec) */
 /*10*/	ocfs2_extent_rec l_recs[0];	/* Extent records */
 } ocfs2_extent_list;
@@ -293,11 +280,11 @@
  * ocfs2_dinode.id2.i_chain.
  */
 typedef struct _ocfs2_chain_list {
-/*00*/	__u16 cl_cpg;			/* Clusters per Block Group */
-	__u16 cl_bpc;			/* Bits per cluster */
-	__u16 cl_count;			/* Total chains in this list */
-	__u16 cl_next_free_rec;		/* Next unused chain slot */
-	__u64 cl_reserved1;
+/*00*/	__le16 cl_cpg;			/* Clusters per Block Group */
+	__le16 cl_bpc;			/* Bits per cluster */
+	__le16 cl_count;			/* Total chains in this list */
+	__le16 cl_next_free_rec;		/* Next unused chain slot */
+	__le64 cl_reserved1;
 /*10*/	ocfs2_chain_rec cl_recs[0];	/* Chain records */
 } ocfs2_chain_list;
 
@@ -307,9 +294,9 @@
  * ocfs2_dinode.id2.i_dealloc.
  */
 typedef struct _ocfs2_truncate_log {
-/*00*/	__u16 tl_count;			/* Total records in this log */
-	__u16 tl_used;			/* Number of records in use */
-	__u32 tl_reserved1;
+/*00*/	__le16 tl_count;			/* Total records in this log */
+	__le16 tl_used;			/* Number of records in use */
+	__le32 tl_reserved1;
 /*08*/	ocfs2_truncate_rec tl_recs[0];	/* Truncate records */
 } ocfs2_truncate_log;
 
@@ -319,15 +306,15 @@
 typedef struct _ocfs2_extent_block
 {
 /*00*/	__u8 h_signature[8];		/* Signature for verification */
-	__u64 h_reserved1;
-/*10*/	__s16 h_suballoc_slot;		/* Slot suballocator this
+	__le64 h_reserved1;
+/*10*/	__le16 h_suballoc_slot;		/* Slot suballocator this
 					   extent_header belongs to */
-	__u16 h_suballoc_bit;		/* Bit offset in suballocator
+	__le16 h_suballoc_bit;		/* Bit offset in suballocator
 					   block group */
-	__u32 h_fs_generation;		/* Must match super block */
-	__u64 h_blkno;			/* Offset on disk, in blocks */
-/*20*/	__u64 h_reserved3;
-	__u64 h_next_leaf_blk;		/* Offset on disk, in blocks,
+	__le32 h_fs_generation;		/* Must match super block */
+	__le64 h_blkno;			/* Offset on disk, in blocks */
+/*20*/	__le64 h_reserved3;
+	__le64 h_next_leaf_blk;		/* Offset on disk, in blocks,
 					   of next leaf header pointing
 					   to data */
 /*30*/	ocfs2_extent_list h_list;	/* Extent record list */
@@ -340,29 +327,29 @@
  * are relative to the start of ocfs2_dinode.id2.
  */
 typedef struct _ocfs2_super_block {
-/*00*/	__u16 s_major_rev_level;
-	__u16 s_minor_rev_level;
-	__u16 s_mnt_count;
-	__s16 s_max_mnt_count;
-	__u16 s_state;			/* File system state */
-	__u16 s_errors;			/* Behaviour when detecting errors */
-	__u32 s_checkinterval;		/* Max time between checks */
-/*10*/	__u64 s_lastcheck;		/* Time of last check */
-	__u32 s_creator_os;		/* OS */
-	__u32 s_feature_compat;		/* Compatible feature set */
-/*20*/	__u32 s_feature_incompat;	/* Incompatible feature set */
-	__u32 s_feature_ro_compat;	/* Readonly-compatible feature set */
-	__u64 s_root_blkno;		/* Offset, in blocks, of root directory
+/*00*/	__le16 s_major_rev_level;
+	__le16 s_minor_rev_level;
+	__le16 s_mnt_count;
+	__le16 s_max_mnt_count;
+	__le16 s_state;			/* File system state */
+	__le16 s_errors;			/* Behaviour when detecting errors */
+	__le32 s_checkinterval;		/* Max time between checks */
+/*10*/	__le64 s_lastcheck;		/* Time of last check */
+	__le32 s_creator_os;		/* OS */
+	__le32 s_feature_compat;		/* Compatible feature set */
+/*20*/	__le32 s_feature_incompat;	/* Incompatible feature set */
+	__le32 s_feature_ro_compat;	/* Readonly-compatible feature set */
+	__le64 s_root_blkno;		/* Offset, in blocks, of root directory
 					   dinode */
-/*30*/	__u64 s_system_dir_blkno;	/* Offset, in blocks, of system
+/*30*/	__le64 s_system_dir_blkno;	/* Offset, in blocks, of system
 					   directory dinode */
-	__u32 s_blocksize_bits;		/* Blocksize for this fs */
-	__u32 s_clustersize_bits;	/* Clustersize for this fs */
-/*40*/	__u16 s_max_slots;		/* Max number of simultaneous mounts
+	__le32 s_blocksize_bits;		/* Blocksize for this fs */
+	__le32 s_clustersize_bits;	/* Clustersize for this fs */
+/*40*/	__le16 s_max_slots;		/* Max number of simultaneous mounts
 					   before tunefs required */
-	__u16 s_reserved1;
-	__u32 s_reserved2;
-	__u64 s_first_cluster_group;	/* Block offset of 1st cluster
+	__le16 s_reserved1;
+	__le32 s_reserved2;
+	__le64 s_first_cluster_group;	/* Block offset of 1st cluster
 					 * group header */
 /*50*/	__u8  s_label[OCFS2_MAX_VOL_LABEL_LEN];	/* Label for mounting, etc. */
 /*90*/	__u8  s_uuid[OCFS2_VOL_UUID_LEN];	/* 128-bit uuid */
@@ -376,11 +363,11 @@
  */
 typedef struct _ocfs2_local_alloc
 {
-/*00*/	__u32 la_bm_off;	/* Starting bit offset in main bitmap */
-	__u16 la_size;		/* Size of included bitmap, in bytes */
-	__u16 la_reserved1;
-	__u64 la_reserved2;
-/*10*/	__u8 la_bitmap[0];
+/*00*/	__le32 la_bm_off;	/* Starting bit offset in main bitmap */
+	__le16 la_size;		/* Size of included bitmap, in bytes */
+	__le16 la_reserved1;
+	__le64 la_reserved2;
+/*10*/	__u8   la_bitmap[0];
 } ocfs2_local_alloc;
 
 /*
@@ -388,47 +375,47 @@
  */
 typedef struct _ocfs2_dinode {
 /*00*/	__u8 i_signature[8];		/* Signature for validation */
-	__u32 i_generation;		/* Generation number */
-	__s16 i_suballoc_slot;		/* Slot suballocator this inode
+	__le32 i_generation;		/* Generation number */
+	__le16 i_suballoc_slot;		/* Slot suballocator this inode
 					   belongs to */
-	__u16 i_suballoc_bit;		/* Bit offset in suballocator
+	__le16 i_suballoc_bit;		/* Bit offset in suballocator
 					   block group */
-/*10*/	__u32 i_reserved0;
-	__u32 i_clusters;		/* Cluster count */
-	__u32 i_uid;			/* Owner UID */
-	__u32 i_gid;			/* Owning GID */
-/*20*/	__u64 i_size;			/* Size in bytes */
-	__u16 i_mode;			/* File mode */
-	__u16 i_links_count;		/* Links count */
-	__u32 i_flags;			/* File flags */
-/*30*/	__u64 i_atime;			/* Access time */
-	__u64 i_ctime;			/* Creation time */
-/*40*/	__u64 i_mtime;			/* Modification time */
-	__u64 i_dtime;			/* Deletion time */
-/*50*/	__u64 i_blkno;			/* Offset on disk, in blocks */
-	__u64 i_last_eb_blk;		/* Pointer to last extent
+/*10*/	__le32 i_reserved0;
+	__le32 i_clusters;		/* Cluster count */
+	__le32 i_uid;			/* Owner UID */
+	__le32 i_gid;			/* Owning GID */
+/*20*/	__le64 i_size;			/* Size in bytes */
+	__le16 i_mode;			/* File mode */
+	__le16 i_links_count;		/* Links count */
+	__le32 i_flags;			/* File flags */
+/*30*/	__le64 i_atime;			/* Access time */
+	__le64 i_ctime;			/* Creation time */
+/*40*/	__le64 i_mtime;			/* Modification time */
+	__le64 i_dtime;			/* Deletion time */
+/*50*/	__le64 i_blkno;			/* Offset on disk, in blocks */
+	__le64 i_last_eb_blk;		/* Pointer to last extent
 					   block */
-/*60*/	__u32 i_fs_generation;		/* Generation per fs-instance */
-	__u32 i_atime_nsec;
-	__u32 i_ctime_nsec;
-	__u32 i_mtime_nsec;
-/*70*/	__u64 i_reserved1[9];
+/*60*/	__le32 i_fs_generation;		/* Generation per fs-instance */
+	__le32 i_atime_nsec;
+	__le32 i_ctime_nsec;
+	__le32 i_mtime_nsec;
+/*70*/	__le64 i_reserved1[9];
 /*B8*/	union {
-		__u64 i_pad1;		/* Generic way to refer to this
+		__le64 i_pad1;		/* Generic way to refer to this
 					   64bit union */
 		struct {
-			__u64 i_rdev;	/* Device number */
+			__le64 i_rdev;	/* Device number */
 		} dev1;
 		struct {		/* Info for bitmap system
 					   inodes */
-			__u32 i_used;	/* Bits (ie, clusters) used  */
-			__u32 i_total;	/* Total bits (clusters)
+			__le32 i_used;	/* Bits (ie, clusters) used  */
+			__le32 i_total;	/* Total bits (clusters)
 					   available */
 		} bitmap1;
 		struct {		/* Info for journal system
 					   inodes */
-			__u32 ij_flags;	/* Mounted, version, etc. */
-			__u32 ij_pad;
+			__le32 ij_flags;	/* Mounted, version, etc. */
+			__le32 ij_pad;
 		} journal1;
 	} id1;				/* Inode type dependant 1 */
 /*C0*/	union {
@@ -448,8 +435,8 @@
  * Packed as this structure could be accessed unaligned on 64-bit platforms
  */
 struct ocfs2_dir_entry {
-/*00*/	__u64   inode;                  /* Inode number */
-	__u16   rec_len;                /* Directory entry length */
+/*00*/	__le64   inode;                  /* Inode number */
+	__le16   rec_len;                /* Directory entry length */
 	__u8    name_len;               /* Name length */
 	__u8    file_type;
 /*0C*/	char    name[OCFS2_MAX_FILENAME_LEN];   /* File name */
@@ -462,20 +449,20 @@
 typedef struct _ocfs2_group_desc
 {
 /*00*/	__u8    bg_signature[8];        /* Signature for validation */
-	__u16   bg_size;                /* Size of included bitmap in
+	__le16   bg_size;                /* Size of included bitmap in
 					   bytes. */
-	__u16   bg_bits;                /* Bits represented by this
+	__le16   bg_bits;                /* Bits represented by this
 					   group. */
-	__u16	bg_free_bits_count;     /* Free bits count */
-	__u16   bg_chain;               /* What chain I am in. */
-/*10*/	__u32   bg_generation;
-	__u32	bg_reserved1;
-	__u64   bg_next_group;          /* Next group in my list, in
+	__le16	bg_free_bits_count;     /* Free bits count */
+	__le16   bg_chain;               /* What chain I am in. */
+/*10*/	__le32   bg_generation;
+	__le32	bg_reserved1;
+	__le64   bg_next_group;          /* Next group in my list, in
 					   blocks */
-/*20*/	__u64   bg_parent_dinode;       /* dinode which owns me, in
+/*20*/	__le64   bg_parent_dinode;       /* dinode which owns me, in
 					   blocks */
-	__u64   bg_blkno;               /* Offset on disk, in blocks */
-/*30*/	__u64   bg_reserved2[2];
+	__le64   bg_blkno;               /* Offset on disk, in blocks */
+/*30*/	__le64   bg_reserved2[2];
 /*40*/	__u8    bg_bitmap[0];
 } ocfs2_group_desc;
 
@@ -506,7 +493,7 @@
 	return size / sizeof(struct _ocfs2_chain_rec);
 }
 
-static inline int ocfs2_extent_recs_per_eb(struct super_block *sb)
+static inline u16 ocfs2_extent_recs_per_eb(struct super_block *sb)
 {
 	int size;
 
@@ -516,9 +503,9 @@
 	return size / sizeof(struct _ocfs2_extent_rec);
 }
 
-static inline int ocfs2_local_alloc_size(struct super_block *sb)
+static inline u16 ocfs2_local_alloc_size(struct super_block *sb)
 {
-	int size;
+	u16 size;
 
 	size = sb->s_blocksize -
 		offsetof(struct _ocfs2_dinode, id2.i_lab.la_bitmap);

Modified: branches/global-heartbeat/libocfs2/inode.c
===================================================================
--- branches/global-heartbeat/libocfs2/inode.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/inode.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -62,48 +62,151 @@
 	return ret;
 }
 
-
-/* FIXME swap rest of inode as kernel is updated */
-void ocfs2_swap_inode_to_cpu(ocfs2_dinode *di)
+static void ocfs2_swap_inode_third(ocfs2_dinode *di)
 {
-	di->i_generation    = le32_to_cpu(di->i_generation);
-	di->i_suballoc_slot = le16_to_cpu(di->i_suballoc_slot);
-	di->i_suballoc_bit  = le16_to_cpu(di->i_suballoc_bit);
-	di->i_fs_generation = le32_to_cpu(di->i_fs_generation);
 
-	if (S_ISCHR(di->i_mode) || S_ISBLK(di->i_mode))
-		di->id1.dev1.i_rdev = le64_to_cpu(di->id1.dev1.i_rdev);
-	else if (di->i_flags & OCFS2_JOURNAL_FL)
-		di->id1.journal1.ij_flags =
-			le32_to_cpu(di->id1.journal1.ij_flags);
-	else if (di->i_flags & OCFS2_BITMAP_FL) {
-		di->id1.bitmap1.i_total = 
-			le32_to_cpu(di->id1.bitmap1.i_total);
-		di->id1.bitmap1.i_used = 
-			le32_to_cpu(di->id1.bitmap1.i_used);
-	} 
+	if (di->i_flags & OCFS2_CHAIN_FL) {
+		ocfs2_chain_list *cl = &di->id2.i_chain;
+		uint16_t i;
+
+		for (i = 0; i < cl->cl_next_free_rec; i++) {
+			ocfs2_chain_rec *rec = &cl->cl_recs[i];
+
+			rec->c_free  = bswap_32(rec->c_free);
+			rec->c_total = bswap_32(rec->c_total);
+			rec->c_blkno = bswap_64(rec->c_blkno);
+		}
+
+	} else if (di->i_flags & OCFS2_DEALLOC_FL) {
+		ocfs2_truncate_log *tl = &di->id2.i_dealloc;
+		uint16_t i;
+
+		for(i = 0; i < tl->tl_count; i++) {
+			ocfs2_truncate_rec *rec = &tl->tl_recs[i];
+
+			rec->t_start    = bswap_32(rec->t_start);
+			rec->t_clusters = bswap_32(rec->t_clusters);
+		}
+	}
 }
 
-void ocfs2_swap_inode_to_le(ocfs2_dinode *di)
+static void ocfs2_swap_inode_second(ocfs2_dinode *di)
 {
-	di->i_generation    = cpu_to_le32(di->i_generation);
-	di->i_suballoc_slot = cpu_to_le16(di->i_suballoc_slot);
-	di->i_suballoc_bit  = cpu_to_le16(di->i_suballoc_bit);
-	di->i_fs_generation = cpu_to_le32(di->i_fs_generation);
-
 	if (S_ISCHR(di->i_mode) || S_ISBLK(di->i_mode))
-		di->id1.dev1.i_rdev = cpu_to_le64(di->id1.dev1.i_rdev);
-	else if (di->i_flags & OCFS2_JOURNAL_FL)
-		di->id1.journal1.ij_flags =
-			cpu_to_le32(di->id1.journal1.ij_flags);
+		di->id1.dev1.i_rdev = bswap_64(di->id1.dev1.i_rdev);
 	else if (di->i_flags & OCFS2_BITMAP_FL) {
-		di->id1.bitmap1.i_total = 
-			cpu_to_le32(di->id1.bitmap1.i_total);
-		di->id1.bitmap1.i_used = 
-			cpu_to_le32(di->id1.bitmap1.i_used);
+		di->id1.bitmap1.i_used = bswap_32(di->id1.bitmap1.i_used);
+		di->id1.bitmap1.i_total = bswap_32(di->id1.bitmap1.i_total);
+	} else if (di->i_flags & OCFS2_JOURNAL_FL)
+		di->id1.journal1.ij_flags = bswap_32(di->id1.journal1.ij_flags);
+
+	/* we need to be careful to swap the union member that is in use.
+	 * first the ones that are explicitly marked with flags.. */ 
+	if (di->i_flags & OCFS2_SUPER_BLOCK_FL) {
+		ocfs2_super_block *sb = &di->id2.i_super;
+
+		sb->s_major_rev_level     = bswap_16(sb->s_major_rev_level);
+		sb->s_minor_rev_level     = bswap_16(sb->s_minor_rev_level);
+		sb->s_mnt_count           = bswap_16(sb->s_mnt_count);
+		sb->s_max_mnt_count       = bswap_16(sb->s_max_mnt_count);
+		sb->s_state               = bswap_16(sb->s_state);
+		sb->s_errors              = bswap_16(sb->s_errors);
+		sb->s_checkinterval       = bswap_32(sb->s_checkinterval);
+		sb->s_lastcheck           = bswap_64(sb->s_lastcheck);
+		sb->s_creator_os          = bswap_32(sb->s_creator_os);
+		sb->s_feature_compat      = bswap_32(sb->s_feature_compat);
+		sb->s_feature_ro_compat   = bswap_32(sb->s_feature_ro_compat);
+		sb->s_feature_incompat    = bswap_32(sb->s_feature_incompat);
+		sb->s_root_blkno          = bswap_64(sb->s_root_blkno);
+		sb->s_system_dir_blkno    = bswap_64(sb->s_system_dir_blkno);
+		sb->s_blocksize_bits      = bswap_32(sb->s_blocksize_bits);
+		sb->s_clustersize_bits    = bswap_32(sb->s_clustersize_bits);
+		sb->s_max_slots           = bswap_16(sb->s_max_slots);
+		sb->s_first_cluster_group = bswap_64(sb->s_first_cluster_group);
+
+	} else if (di->i_flags & OCFS2_LOCAL_ALLOC_FL) {
+		ocfs2_local_alloc *la = &di->id2.i_lab;
+
+		la->la_bm_off = bswap_32(la->la_bm_off);
+		la->la_size   = bswap_16(la->la_size);
+
+	} else if (di->i_flags & OCFS2_CHAIN_FL) {
+		ocfs2_chain_list *cl = &di->id2.i_chain;
+
+		cl->cl_cpg           = bswap_16(cl->cl_cpg);
+		cl->cl_bpc           = bswap_16(cl->cl_bpc);
+		cl->cl_count         = bswap_16(cl->cl_count);
+		cl->cl_next_free_rec = bswap_16(cl->cl_next_free_rec);
+
+	} else if (di->i_flags & OCFS2_DEALLOC_FL) {
+		ocfs2_truncate_log *tl = &di->id2.i_dealloc;
+
+		tl->tl_count = bswap_16(tl->tl_count);
+		tl->tl_used  = bswap_16(tl->tl_used);
 	}
 }
 
+static void ocfs2_swap_inode_first(ocfs2_dinode *di)
+{
+	di->i_generation    = bswap_32(di->i_generation);
+	di->i_suballoc_slot = bswap_16(di->i_suballoc_slot);
+	di->i_suballoc_bit  = bswap_16(di->i_suballoc_bit);
+	di->i_clusters      = bswap_32(di->i_clusters);
+	di->i_uid           = bswap_32(di->i_uid);
+	di->i_gid           = bswap_32(di->i_gid);
+	di->i_size          = bswap_64(di->i_size);
+	di->i_mode          = bswap_16(di->i_mode);
+	di->i_links_count   = bswap_16(di->i_links_count);
+	di->i_flags         = bswap_32(di->i_flags);
+	di->i_atime         = bswap_64(di->i_atime);
+	di->i_ctime         = bswap_64(di->i_ctime);
+	di->i_mtime         = bswap_64(di->i_mtime);
+	di->i_dtime         = bswap_64(di->i_dtime);
+	di->i_blkno         = bswap_64(di->i_blkno);
+	di->i_last_eb_blk   = bswap_64(di->i_last_eb_blk);
+	di->i_fs_generation = bswap_32(di->i_fs_generation);
+	di->i_atime_nsec    = bswap_32(di->i_atime_nsec);
+	di->i_ctime_nsec    = bswap_32(di->i_ctime_nsec);
+	di->i_mtime_nsec    = bswap_32(di->i_mtime_nsec);
+}
+
+static int has_extents(ocfs2_dinode *di)
+{
+	/* inodes flagged with other stuff in id2 */
+	if (di->i_flags & (OCFS2_SUPER_BLOCK_FL | OCFS2_LOCAL_ALLOC_FL |
+			   OCFS2_CHAIN_FL | OCFS2_DEALLOC_FL))
+		return 0;
+	/* i_flags doesn't indicate when id2 is a fast symlink */
+	if (S_ISLNK(di->i_mode) && di->i_size && di->i_clusters == 0)
+		return 0;
+
+	return 1;
+}
+
+void ocfs2_swap_inode_from_cpu(ocfs2_dinode *di)
+{
+	if (cpu_is_little_endian)
+		return;
+
+	if (has_extents(di))
+		ocfs2_swap_extent_list_from_cpu(&di->id2.i_list);
+	ocfs2_swap_inode_third(di);
+	ocfs2_swap_inode_second(di);
+	ocfs2_swap_inode_first(di);
+}
+
+void ocfs2_swap_inode_to_cpu(ocfs2_dinode *di)
+{
+	if (cpu_is_little_endian)
+		return;
+
+	ocfs2_swap_inode_first(di);
+	ocfs2_swap_inode_second(di);
+	ocfs2_swap_inode_third(di);
+	if (has_extents(di))
+		ocfs2_swap_extent_list_to_cpu(&di->id2.i_list);
+}
+
 errcode_t ocfs2_read_inode(ocfs2_filesys *fs, uint64_t blkno,
 			   char *inode_buf)
 {
@@ -163,7 +266,7 @@
 	memcpy(blk, inode_buf, fs->fs_blocksize);
 
 	di = (ocfs2_dinode *)blk;
-	ocfs2_swap_inode_to_le(di);
+	ocfs2_swap_inode_from_cpu(di);
 
 	ret = io_write_block(fs->fs_io, blkno, 1, blk);
 	if (ret)

Modified: branches/global-heartbeat/libocfs2/inode_scan.c
===================================================================
--- branches/global-heartbeat/libocfs2/inode_scan.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/inode_scan.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -86,8 +86,8 @@
 	if (!scan->cur_blkno)
 		abort();
 
-	ret = io_read_block(scan->fs->fs_io, scan->cur_blkno, 1,
-			    (char *)scan->cur_desc);
+	ret = ocfs2_read_group_desc(scan->fs, scan->cur_blkno,
+				    (char *)scan->cur_desc);
 	if (ret)
 		return (ret);
 
@@ -175,10 +175,10 @@
 	if (num_blocks > scan->buffer_blocks)
 		num_blocks = scan->buffer_blocks;
 
-	ret = io_read_block(scan->fs->fs_io,
-			    scan->cur_blkno,
-			    num_blocks,
-			    scan->group_buffer);
+       ret = io_read_block(scan->fs->fs_io,
+			   scan->cur_blkno,
+			   num_blocks,
+			   scan->group_buffer);
 	if (ret)
 		return ret;
 
@@ -239,7 +239,7 @@
 			return ret;
 	}
 	
-	/* FIXME: Should swap the inode */
+	/* the caller swap after verifying the inode's signature */
 	memcpy(inode, scan->cur_block, scan->fs->fs_blocksize);
 
 	scan->cur_block += scan->fs->fs_blocksize;

Modified: branches/global-heartbeat/libocfs2/mkjournal.c
===================================================================
--- branches/global-heartbeat/libocfs2/mkjournal.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/mkjournal.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -32,13 +32,32 @@
 #include <netinet/in.h>
 
 #include "ocfs2.h"
+#include "jbd.h"
 
-/* jfs_compat.h defines these */
-#undef cpu_to_be32
-#undef be32_to_cpu
-#include "jfs_user.h"
+void ocfs2_swap_journal_superblock(journal_superblock_t *jsb)
+{
+	if (cpu_is_big_endian)
+		return;
 
+	jsb->s_header.h_magic     = bswap_32(jsb->s_header.h_magic);
+	jsb->s_header.h_blocktype = bswap_32(jsb->s_header.h_blocktype);
+	jsb->s_header.h_sequence  = bswap_32(jsb->s_header.h_sequence);
 
+	jsb->s_blocksize         = bswap_32(jsb->s_blocksize);
+	jsb->s_maxlen            = bswap_32(jsb->s_maxlen);
+	jsb->s_first             = bswap_32(jsb->s_first);
+	jsb->s_sequence          = bswap_32(jsb->s_sequence);
+	jsb->s_start             = bswap_32(jsb->s_start);
+	jsb->s_errno             = bswap_32(jsb->s_errno);
+	jsb->s_feature_compat    = bswap_32(jsb->s_feature_compat);
+	jsb->s_feature_incompat  = bswap_32(jsb->s_feature_incompat);
+	jsb->s_feature_ro_compat = bswap_32(jsb->s_feature_ro_compat);
+	jsb->s_nr_users          = bswap_32(jsb->s_nr_users);
+	jsb->s_dynsuper          = bswap_32(jsb->s_dynsuper);
+	jsb->s_max_transaction   = bswap_32(jsb->s_max_transaction);
+	jsb->s_max_trans_data    = bswap_32(jsb->s_max_trans_data);
+}
+
 /*
  * The code to init a journal superblock is also in
  * mkfs.ocfs2/mkfs.c:replacement_journal_create().
@@ -56,21 +75,21 @@
 		return OCFS2_ET_JOURNAL_TOO_SMALL;
 
 	memset(buf, 0, buflen);
-	jsb->s_header.h_magic     = htonl(JFS_MAGIC_NUMBER);
-	jsb->s_header.h_blocktype = htonl(JFS_SUPERBLOCK_V2);
+	jsb->s_header.h_magic     = JFS_MAGIC_NUMBER;
+	jsb->s_header.h_blocktype = JFS_SUPERBLOCK_V2;
 
-	jsb->s_blocksize = cpu_to_be32(fs->fs_blocksize);
-	jsb->s_maxlen    = cpu_to_be32(jrnl_size_in_blks);
+	jsb->s_blocksize = fs->fs_blocksize;
+	jsb->s_maxlen    = jrnl_size_in_blks;
 
 	if (fs->fs_blocksize == 512)
-		jsb->s_first = htonl(2);
+		jsb->s_first = 2;
 	else
-		jsb->s_first = htonl(1);
+		jsb->s_first = 1;
 
-	jsb->s_start    = htonl(1);
-	jsb->s_sequence = htonl(1);
-	jsb->s_errno    = htonl(0);
-	jsb->s_nr_users = htonl(1);
+	jsb->s_start    = 1;
+	jsb->s_sequence = 1;
+	jsb->s_errno    = 0;
+	jsb->s_nr_users = 1;
 
 	memcpy(jsb->s_uuid, OCFS2_RAW_SB(fs->fs_super)->s_uuid,
 	       sizeof(jsb->s_uuid));
@@ -107,9 +126,9 @@
 	    EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) {
 		jsb->s_nr_users = 0;
 		if (fs->blocksize == 1024)
-			jsb->s_first = htonl(3);
+			jsb->s_first = 3;
 		else
-			jsb->s_first = htonl(2);
+			jsb->s_first = 2;
 	}
 #endif
 
@@ -149,18 +168,8 @@
 	}
 
 	memcpy(jsb_buf, blk, fs->fs_blocksize);
+	ocfs2_swap_journal_superblock(jsb);
 
-	/* XXX incomplete */
-	jsb->s_header.h_magic = be32_to_cpu(disk->s_header.h_magic);
-	jsb->s_header.h_blocktype = be32_to_cpu(disk->s_header.h_blocktype);
-
-	jsb->s_blocksize = be32_to_cpu(disk->s_blocksize);
-	jsb->s_maxlen = be32_to_cpu(disk->s_maxlen);
-	jsb->s_first = be32_to_cpu(disk->s_first);
-	jsb->s_start = be32_to_cpu(disk->s_start);
-	jsb->s_sequence = be32_to_cpu(disk->s_sequence);
-	jsb->s_errno = be32_to_cpu(disk->s_errno);
-
 	ret = 0;
 out:
 	ocfs2_free(&blk);
@@ -190,18 +199,8 @@
 	jsb = (journal_superblock_t *)jsb_buf;
 
 	memcpy(blk, jsb_buf, fs->fs_blocksize);
+	ocfs2_swap_journal_superblock(disk);
 
-	/* XXX incomplete */
-	disk->s_header.h_magic = cpu_to_be32(jsb->s_header.h_magic);
-	disk->s_header.h_blocktype = cpu_to_be32(jsb->s_header.h_blocktype);
-
-	disk->s_blocksize = cpu_to_be32(jsb->s_blocksize);
-	disk->s_maxlen = cpu_to_be32(jsb->s_maxlen);
-	disk->s_first = cpu_to_be32(jsb->s_first);
-	disk->s_start = cpu_to_be32(jsb->s_start);
-	disk->s_sequence = cpu_to_be32(jsb->s_sequence);
-	disk->s_errno = cpu_to_be32(jsb->s_errno);
-
 	ret = io_write_block(fs->fs_io, blkno, 1, blk);
 	if (ret)
 		goto out;

Modified: branches/global-heartbeat/libocfs2/openfs.c
===================================================================
--- branches/global-heartbeat/libocfs2/openfs.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/libocfs2/openfs.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -71,58 +71,6 @@
 	return ret;
 }
 
-static void ocfs2_swap_super_to_cpu(ocfs2_dinode *di)
-{
-	ocfs2_super_block *sb;
-
-	ocfs2_swap_inode_to_cpu(di);
-
-	sb = &di->id2.i_super;
-	sb->s_major_rev_level     = le16_to_cpu(sb->s_major_rev_level);
-	sb->s_minor_rev_level     = le16_to_cpu(sb->s_minor_rev_level);
-	sb->s_mnt_count           = le16_to_cpu(sb->s_mnt_count);
-	sb->s_max_mnt_count       = le16_to_cpu(sb->s_max_mnt_count);
-	sb->s_state               = le16_to_cpu(sb->s_state);
-	sb->s_checkinterval       = le32_to_cpu(sb->s_checkinterval);
-	sb->s_lastcheck           = le64_to_cpu(sb->s_lastcheck);
-	sb->s_creator_os          = le32_to_cpu(sb->s_creator_os);
-	sb->s_feature_compat      = le32_to_cpu(sb->s_feature_compat);
-	sb->s_feature_ro_compat   = le32_to_cpu(sb->s_feature_ro_compat);
-	sb->s_feature_incompat    = le32_to_cpu(sb->s_feature_incompat);
-	sb->s_root_blkno          = le64_to_cpu(sb->s_root_blkno);
-	sb->s_system_dir_blkno    = le64_to_cpu(sb->s_system_dir_blkno);
-	sb->s_blocksize_bits      = le32_to_cpu(sb->s_blocksize_bits);
-	sb->s_clustersize_bits    = le32_to_cpu(sb->s_clustersize_bits);
-	sb->s_max_slots           = le16_to_cpu(sb->s_max_slots);
-	sb->s_first_cluster_group = le64_to_cpu(sb->s_first_cluster_group);
-}
-
-static void ocfs2_swap_super_to_le(ocfs2_dinode *di)
-{
-	ocfs2_super_block *sb;
-
-	ocfs2_swap_inode_to_le(di);
-
-	sb = &di->id2.i_super;
-	sb->s_major_rev_level     = cpu_to_le16(sb->s_major_rev_level);
-	sb->s_minor_rev_level     = cpu_to_le16(sb->s_minor_rev_level);
-	sb->s_mnt_count           = cpu_to_le16(sb->s_mnt_count);
-	sb->s_max_mnt_count       = cpu_to_le16(sb->s_max_mnt_count);
-	sb->s_state               = cpu_to_le16(sb->s_state);
-	sb->s_checkinterval       = cpu_to_le32(sb->s_checkinterval);
-	sb->s_lastcheck           = cpu_to_le64(sb->s_lastcheck);
-	sb->s_creator_os          = cpu_to_le32(sb->s_creator_os);
-	sb->s_feature_compat      = cpu_to_le32(sb->s_feature_compat);
-	sb->s_feature_ro_compat   = cpu_to_le32(sb->s_feature_ro_compat);
-	sb->s_feature_incompat    = cpu_to_le32(sb->s_feature_incompat);
-	sb->s_root_blkno          = cpu_to_le64(sb->s_root_blkno);
-	sb->s_system_dir_blkno    = cpu_to_le64(sb->s_system_dir_blkno);
-	sb->s_blocksize_bits      = cpu_to_le32(sb->s_blocksize_bits);
-	sb->s_clustersize_bits    = cpu_to_le32(sb->s_clustersize_bits);
-	sb->s_max_slots           = cpu_to_le16(sb->s_max_slots);
-	sb->s_first_cluster_group = cpu_to_le64(sb->s_first_cluster_group);
-}
-
 static errcode_t ocfs2_read_super(ocfs2_filesys *fs, int superblock)
 {
 	errcode_t ret;
@@ -143,8 +91,7 @@
 		   strlen(OCFS2_SUPER_BLOCK_SIGNATURE)))
 		goto out_blk;
 
-	ocfs2_swap_super_to_cpu(di);
-
+	ocfs2_swap_inode_to_cpu(di);
 	fs->fs_super = di;
 
 	return 0;
@@ -172,9 +119,7 @@
 		   strlen(OCFS2_SUPER_BLOCK_SIGNATURE)))
 		goto out_blk;
 
-	ocfs2_swap_super_to_le(di);
-	ret = io_write_block(fs->fs_io, OCFS2_SUPER_BLOCK_BLKNO, 1, blk);
-	ocfs2_swap_super_to_cpu(di);
+	ret = ocfs2_write_inode(fs, OCFS2_SUPER_BLOCK_BLKNO, blk);
 	if (ret)
 		goto out_blk;
 

Copied: branches/global-heartbeat/libocfs2/slot_map.c (from rev 1071, trunk/libocfs2/slot_map.c)

Modified: branches/global-heartbeat/mkfs.ocfs2/Makefile
===================================================================
--- branches/global-heartbeat/mkfs.ocfs2/Makefile	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/mkfs.ocfs2/Makefile	2005-09-06 02:01:13 UTC (rev 1072)
@@ -12,7 +12,6 @@
 endif
 
 CFLAGS = $(OPTS) $(WARNINGS) 
-CPPFLAGS += $(B0RKEN_ENDIAN)
 
 sbindir = $(root_sbindir)
 SBIN_PROGRAMS = mkfs.ocfs2

Modified: branches/global-heartbeat/mkfs.ocfs2/mkfs.c
===================================================================
--- branches/global-heartbeat/mkfs.ocfs2/mkfs.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/mkfs.ocfs2/mkfs.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -817,7 +817,7 @@
 	errcode_t err;
 	uint32_t blocksize;
 	int sectsize;
-	uint32_t ret;
+	uint64_t ret;
 	struct ocfs2_cluster_group_sizes cgs;
 	uint64_t tmp;
 
@@ -1077,7 +1077,7 @@
 	memset(group->gd, 0, s->blocksize);
 
 	strcpy(group->gd->bg_signature, OCFS2_GROUP_DESC_SIGNATURE);
-	group->gd->bg_generation = cpu_to_le32(s->vol_generation);
+	group->gd->bg_generation = s->vol_generation;
 	group->gd->bg_size = (uint32_t)ocfs2_group_bitmap_size(s->blocksize);
 	group->gd->bg_bits = cpg * bpc;
 	group->gd->bg_chain = chain;
@@ -1396,15 +1396,15 @@
 
 	if (dir->buf) {
 		de = (struct ocfs2_dir_entry *)(dir->buf + dir->last_off);
-		rec_len = le16_to_cpu(de->rec_len);
+		rec_len = de->rec_len;
 		real_len = OCFS2_DIR_REC_LEN(de->name_len);
 
-		if ((le64_to_cpu(de->inode) == 0 && rec_len >= new_rec_len) ||
+		if ((de->inode == 0 && rec_len >= new_rec_len) ||
 		    (rec_len >= real_len + new_rec_len)) {
-			if (le64_to_cpu(de->inode)) {
+			if (de->inode) {
 				de1 =(struct ocfs2_dir_entry *) ((char *) de + real_len);
-				de1->rec_len = cpu_to_le16(le16_to_cpu(de->rec_len) - real_len);
-				de->rec_len = cpu_to_le16(real_len);
+				de1->rec_len = de->rec_len - real_len;
+				de->rec_len = real_len;
 				de = de1;
 			}
 
@@ -1438,12 +1438,12 @@
 
 	de = (struct ocfs2_dir_entry *)p;
 	de->inode = 0;
-	de->rec_len = cpu_to_le16(s->blocksize);
+	de->rec_len = s->blocksize;
 
 got_it:
 	de->name_len = strlen(name);
 
-	de->inode = cpu_to_le64(byte_off >> s->blocksize_bits);
+	de->inode = byte_off >> s->blocksize_bits;
 
 	de->file_type = type;
 
@@ -1554,10 +1554,10 @@
 	memset(di, 0, s->blocksize);
 
 	strcpy(di->i_signature, OCFS2_SUPER_BLOCK_SIGNATURE);
-	di->i_suballoc_slot = cpu_to_le16((__u16)OCFS2_INVALID_SLOT);
-	di->i_suballoc_bit = cpu_to_le16((__u16)-1);
-	di->i_generation = cpu_to_le32(s->vol_generation);
-	di->i_fs_generation = cpu_to_le32(s->vol_generation);
+	di->i_suballoc_slot = (__u16)OCFS2_INVALID_SLOT;
+	di->i_suballoc_bit = (__u16)-1;
+	di->i_generation = s->vol_generation;
+	di->i_fs_generation = s->vol_generation;
 
 	di->i_atime = 0;
 	di->i_ctime = s->format_time;
@@ -1565,34 +1565,32 @@
 	di->i_blkno = super_off >> s->blocksize_bits;
 	di->i_flags = OCFS2_VALID_FL | OCFS2_SYSTEM_FL | OCFS2_SUPER_BLOCK_FL;
 	di->i_clusters = s->volume_size_in_clusters;
-	di->id2.i_super.s_major_rev_level = cpu_to_le16(OCFS2_MAJOR_REV_LEVEL);
-	di->id2.i_super.s_minor_rev_level = cpu_to_le16(OCFS2_MINOR_REV_LEVEL);
-	di->id2.i_super.s_root_blkno = cpu_to_le64(root_rec->fe_off >> s->blocksize_bits);
-	di->id2.i_super.s_system_dir_blkno = cpu_to_le64(sys_rec->fe_off >> s->blocksize_bits);
+	di->id2.i_super.s_major_rev_level = OCFS2_MAJOR_REV_LEVEL;
+	di->id2.i_super.s_minor_rev_level = OCFS2_MINOR_REV_LEVEL;
+	di->id2.i_super.s_root_blkno = root_rec->fe_off >> s->blocksize_bits;
+	di->id2.i_super.s_system_dir_blkno = sys_rec->fe_off >> s->blocksize_bits;
 	di->id2.i_super.s_mnt_count = 0;
-	di->id2.i_super.s_max_mnt_count = cpu_to_le16(OCFS2_DFL_MAX_MNT_COUNT);
+	di->id2.i_super.s_max_mnt_count = OCFS2_DFL_MAX_MNT_COUNT;
 	di->id2.i_super.s_state = 0;
 	di->id2.i_super.s_errors = 0;
-	di->id2.i_super.s_lastcheck = cpu_to_le64(s->format_time);
-	di->id2.i_super.s_checkinterval = cpu_to_le32(OCFS2_DFL_CHECKINTERVAL);
-	di->id2.i_super.s_creator_os = cpu_to_le32(OCFS2_OS_LINUX);
-	di->id2.i_super.s_blocksize_bits = cpu_to_le32(s->blocksize_bits);
-	di->id2.i_super.s_clustersize_bits = cpu_to_le32(s->cluster_size_bits);
-	di->id2.i_super.s_max_slots = cpu_to_le16(s->initial_slots);
-	di->id2.i_super.s_first_cluster_group = cpu_to_le64(s->first_cluster_group_blkno);
+	di->id2.i_super.s_lastcheck = s->format_time;
+	di->id2.i_super.s_checkinterval = OCFS2_DFL_CHECKINTERVAL;
+	di->id2.i_super.s_creator_os = OCFS2_OS_LINUX;
+	di->id2.i_super.s_blocksize_bits = s->blocksize_bits;
+	di->id2.i_super.s_clustersize_bits = s->cluster_size_bits;
+	di->id2.i_super.s_max_slots = s->initial_slots;
+	di->id2.i_super.s_first_cluster_group = s->first_cluster_group_blkno;
 
 	incompat = 0;
-#ifdef CONFIG_ARCH_S390
-	incompat |= OCFS2_FEATURE_INCOMPAT_B0RKEN_ENDIAN;
-#endif
 	if (s->hb_dev)
 		incompat |= OCFS2_FEATURE_INCOMPAT_HEARTBEAT_DEV;
 
-	di->id2.i_super.s_feature_incompat = cpu_to_le32(incompat);
+	di->id2.i_super.s_feature_incompat = incompat;
 
 	strcpy(di->id2.i_super.s_label, s->vol_label);
 	memcpy(di->id2.i_super.s_uuid, s->uuid, 16);
 
+	ocfs2_swap_inode_from_cpu(di);
 	do_pwrite(s, di, s->blocksize, super_off);
 	free(di);
 }
@@ -1640,10 +1638,10 @@
 	memset(di, 0, s->blocksize);
 
 	strcpy(di->i_signature, OCFS2_INODE_SIGNATURE);
-	di->i_generation = cpu_to_le32(s->vol_generation);
-	di->i_fs_generation = cpu_to_le32(s->vol_generation);
-	di->i_suballoc_slot = cpu_to_le16((__u16)OCFS2_INVALID_SLOT);
-        di->i_suballoc_bit = cpu_to_le16(rec->suballoc_bit);
+	di->i_generation = s->vol_generation;
+	di->i_fs_generation = s->vol_generation;
+	di->i_suballoc_slot = (__u16)OCFS2_INVALID_SLOT;
+        di->i_suballoc_bit = rec->suballoc_bit;
 	di->i_blkno = rec->fe_off >> s->blocksize_bits;
 	di->i_uid = 0;
 	di->i_gid = 0;
@@ -1663,13 +1661,13 @@
 
 	if (rec->flags & OCFS2_DEALLOC_FL) {
 		di->id2.i_dealloc.tl_count =
-			cpu_to_le16(ocfs2_truncate_recs_per_inode(s->blocksize));
+			ocfs2_truncate_recs_per_inode(s->blocksize);
 		goto write_out;
 	}
 
 	if (rec->flags & OCFS2_BITMAP_FL) {
-		di->id1.bitmap1.i_used = cpu_to_le32(rec->bi.used_bits);
-		di->id1.bitmap1.i_total = cpu_to_le32(rec->bi.total_bits);
+		di->id1.bitmap1.i_used = rec->bi.used_bits;
+		di->id1.bitmap1.i_total = rec->bi.total_bits;
 	}
 
 	if (rec->cluster_bitmap) {
@@ -1735,6 +1733,7 @@
 	}
 
 write_out:
+	ocfs2_swap_inode_from_cpu(di);
 	do_pwrite(s, di, s->blocksize, rec->fe_off);
 	free(di);
 }
@@ -1777,6 +1776,7 @@
 		 * blkno until now. */
 		gd->bg_parent_dinode = parent_blkno;
 		memcpy(buf, gd, s->blocksize);
+		ocfs2_swap_group_desc((ocfs2_group_desc *)buf);
 		do_pwrite(s, buf, s->cluster_size,
 			  gd->bg_blkno << s->blocksize_bits);
 	}
@@ -1786,14 +1786,22 @@
 static void
 write_group_data(State *s, AllocGroup *group)
 {
-	do_pwrite(s, group->gd, s->blocksize,
-		  group->gd->bg_blkno << s->blocksize_bits);
+	uint64_t blkno = group->gd->bg_blkno;
+	ocfs2_swap_group_desc(group->gd);
+	do_pwrite(s, group->gd, s->blocksize, blkno << s->blocksize_bits);
+	ocfs2_swap_group_desc(group->gd);
 }
 
 static void
 write_directory_data(State *s, DirData *dir)
 {
+	if (dir->buf)
+		ocfs2_swap_dir_entries_from_cpu(dir->buf,
+						dir->record->file_size);
 	write_metadata(s, dir->record, dir->buf);
+	if (dir->buf)
+		ocfs2_swap_dir_entries_to_cpu(dir->buf,
+					      dir->record->file_size);
 }
 
 static void
@@ -1810,8 +1818,9 @@
 	memset(slot_map, 0, slot_map_rec->extent_len);
 
 	for(i = 0; i < num; i++)
-		slot_map[i] = cpu_to_le16(-1);
+		slot_map[i] = -1;
 
+	ocfs2_swap_slot_map(slot_map, num);
 	do_pwrite(s, slot_map, slot_map_rec->extent_len,
 		  slot_map_rec->extent_off);
 
@@ -1861,25 +1870,25 @@
 
 	sb = buf;
 
-	sb->s_header.h_magic     = htonl(JFS_MAGIC_NUMBER);
-	sb->s_header.h_blocktype = htonl(JFS_SUPERBLOCK_V2);
+	sb->s_header.h_magic     = JFS_MAGIC_NUMBER;
+	sb->s_header.h_blocktype = JFS_SUPERBLOCK_V2;
 
-	sb->s_blocksize = cpu_to_be32(s->blocksize);
-	sb->s_maxlen =
-		cpu_to_be32(s->journal_size_in_bytes >> s->blocksize_bits);
+	sb->s_blocksize = s->blocksize;
+	sb->s_maxlen = s->journal_size_in_bytes >> s->blocksize_bits;
 
 	if (s->blocksize == 512)
-		sb->s_first = htonl(2);
+		sb->s_first = 2;
 	else
-		sb->s_first = htonl(1);
+		sb->s_first = 1;
 
-	sb->s_start    = htonl(1);
-	sb->s_sequence = htonl(1);
-	sb->s_errno    = htonl(0);
-	sb->s_nr_users = htonl(1);
+	sb->s_start    = 1;
+	sb->s_sequence = 1;
+	sb->s_errno    = 0;
+	sb->s_nr_users = 1;
 
 	memcpy(sb->s_uuid, s->uuid, sizeof(sb->s_uuid));
 
+	ocfs2_swap_journal_superblock(sb);
 	do_pwrite(s, buf, s->journal_size_in_bytes, journal_off);
 	free(buf);
 }

Modified: branches/global-heartbeat/mkfs.ocfs2/mkfs.h
===================================================================
--- branches/global-heartbeat/mkfs.ocfs2/mkfs.h	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/mkfs.ocfs2/mkfs.h	2005-09-06 02:01:13 UTC (rev 1072)
@@ -52,12 +52,10 @@
 
 #include "ocfs1_fs_compat.h"
 
-typedef unsigned short kdev_t;
-
 #include <signal.h>
 #include <libgen.h>
 
-#include "kernel-jbd.h"
+#include "jbd.h"
 
 
 #ifndef MAX

Modified: branches/global-heartbeat/mkfs.ocfs2/mkfs.ocfs2.8.in
===================================================================
--- branches/global-heartbeat/mkfs.ocfs2/mkfs.ocfs2.8.in	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/mkfs.ocfs2/mkfs.ocfs2.8.in	2005-09-06 02:01:13 UTC (rev 1072)
@@ -1,62 +1,82 @@
 .TH "mkfs.ocfs2" "8" "March 2005" "Version @VERSION@" "OCFS2 Manual Pages"
 .SH "NAME"
-mkfs.ocfs2 \- Build an OCFS2 file system.
+mkfs.ocfs2 \- Creates an \fIOCFS2\fR file system.
 .SH "SYNOPSIS"
 \fBmkfs.ocfs2\fR [ \fB\-b\fR \fIblock\-size\fR ] [ \fB\-C\fR \fIcluster\-size\fR ] [ \fB\-L\fR \fIvolume\-label\fR ] [ \fB\-N\fR \fInumber\-of\-nodes\fR ] [ \fB\-J\fR \fIjournal\-options\fR ] [ \fB\-F\fR ] [ \fB\-q\fR ] [ \fB\-v\fR ] [ \fB\-V\fR ] \fIdevice\fR
 .SH "DESCRIPTION"
 .PP 
-\fBmkfs.ocfs2\fR is used to build an OCFS2 file system on a \fIdevice\fR, usually a partition in a shared disk. In order to prevent data loss, \fBmkfs.ocfs2\fR will not format a specified device if a node has it mounted. Different than OCFS, there is no need to mount the partition exclusively after formatting it.
+\fBmkfs.ocfs2\fR is used to create an \fIOCFS2\fR file system on a \fIdevice\fR, 
+usually a partition on a shared disk. In order to prevent data loss,
+\fBmkfs.ocfs2\fR will not format an existing \fIOCFS2\fR volume if that
+volume is mounted on any node in the cluster. This tool requires the \fIO2CB\fR
+cluster service to be up.
+
 .SH "OPTIONS"
 .TP
 \fB\-b\fR \fIblock\-size\fR
-\fIBlock size\fR can be specified in bytes or kbytes. The value of the /fIblock\-size\fR can range from 512 to 4096 bytes (512-4k).
+Valid block size values are 512, 1K, 2K and 4K bytes per block. If omitted,
+a value will be hueristically determined by the file system size.  A block size
+of 512 bytes is never recommended. Choose 1K, 2K or 4K.
 
 .TP
 \fB\-C\fR \fIcluster\-size\fR
-\fIcluster\-size\fR are specified in kbytes and range from 4k to 1M. The size of the \fIcluster\-size\fR will determine the maximum filesystem size possible for the OCFS2 (32Gb\-8Tb). For database files, 128k \fIcluster\-size\fR is still recommended. For use as a generic filesystem, 4k \fIcluster\-size\fR is recommended.
+Valid cluster size values are 4K, 8K, 16K, 32K, 64K, 128K, 256K,
+512K and 1M. If omitted, a value will be hueristically determined by the
+file system size. For volumes expected to store large files, like database files,
+a \fIcluster\-size\fR of 128K or more is recommended. For others, 16K\-64K.
 
 .TP
 \fB\-L\fR \fIvolume\-label\fR
-\fIVolume\-label\fR is useful when the \fILABEL\fR option is used to mount the partitions. The maximum \fIvolume-label\fR lenght allowed is 64 bytes.
+Set the volume label for the file system. This is 
+useful for mounting\-by\-label. Limit the label length to under 64 bytes.
 
 .TP
-\fB\-N\fR \fInumber\-of\-node\-slots\fR 
-\fInumber\-of\-node\-slots\fR specify the maximum number of nodes that can simultaneously mount the partition. The maximum \fInumber\-of\-node\-slots\fR allowed is 255. That will allow a better control of allocated space and make OCFS2 more efficient.
+\fB\-N\fR \fInumber\-of\-node\-slots\fR
+Valid number ranges from 1 to 255. This number specifies the maximum
+number of nodes that can concurrently mount the partition. If omitted,
+the number defaults to 4. This number can be later increased using \fItunefs.ocfs2\fR.
 
 .TP
 \fB\-J\fR \fIjournal\-options\fR 
-Create the journal using options specified on the command\-line. Journal options are comma separated, and may take an argument using the equals ('=') sign.
-The following journal options are supported:
+Create the journal using options specified on the command\-line. Journal
+options are comma separated, and may take an argument using the equals
+('=') sign. The following journal options are supported:
 .RS 1.2i
 .TP
 \fBsize\fR=\fIjournal\-size\fR
-Create a journal of size \fIjournal\-size\fR. Valid sizes range from 4Mb to 500Mb.
+Create a journal of size \fIjournal\-size\fR. Minimum size is 4M.
+If omitted, a value is heuristically determined by the file system size.
 .RE
 
 .TP
-\fB\-F\fR 
-Force the execution of \fBmkfs.ocfs2\fR. This parameter should be used if the partition was previously used by OCFS2 or when the OCFS2 cluster service is not running.
+\fB\-F\fR
+For existing \fIOCFS2\fR volumes, \fImkfs.ocfs2\fR ensures the volume
+is not mounted on any node in the cluster before formatting. For that to
+work, \fImkfs.ocfs2\fR expects the \fIO2CB\fR cluster service to be running.
+Specify this option to disable this check.
 
 .TP
 \fB\-q\fR 
-Execute \fBmkfs.ocfs2\fR in quiet mode. 
+Quiet mode. 
 
 .TP
 \fB\-v\fR 
-Execute \fBmkfs.ocfs2\fR in verbose mode.
+Verbose mode.
 
 .TP
 \fB\-V\fR 
 Print version and exit.
 
-.SH "BUGS"
-Stuff.
-
 .SH "SEE ALSO"
-.BR ocfs2(8)
+.BR debugfs.ocfs2(8)
+.BR fsck.ocfs2(8)
+.BR tunefs.ocfs2(8)
+.BR mounted.ocfs2(8)
+.BR ocfs2console(8)
+.BR ocfs2cdsl(8)
 
 .SH "AUTHORS"
 Oracle Corporation
 
 .SH "COPYRIGHT"
-Copyright \(co 2002, 2004 Oracle Corporation
+Copyright \(co 2004, 2005 Oracle. All rights reserved.

Modified: branches/global-heartbeat/mounted.ocfs2/mounted.ocfs2.8.in
===================================================================
--- branches/global-heartbeat/mounted.ocfs2/mounted.ocfs2.8.in	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/mounted.ocfs2/mounted.ocfs2.8.in	2005-09-06 02:01:13 UTC (rev 1072)
@@ -1,28 +1,54 @@
 .TH "mounted.ocfs2" "8" "March 2005" "Version @VERSION@" "OCFS2 Manual Pages"
 .SH "NAME"
-mounted.ocfs2 \- detect and print nodes that have an OCFS2 partition mounted.
+mounted.ocfs2 \- Detects all \fIOCFS2\fR volumes on a system.
 .SH "SYNOPSIS"
 \fBmounted.ocfs2\fR [\fB\-d\fR] [\fB\-f\fR] \fIdevice\fR
 .SH "DESCRIPTION"
 .PP 
-\fBmounted.ocfs2\fR is used to verify if there are nodes that have a specific OCFS2 \fIdevice\fR mounted.
+\fBmounted.ocfs2\fR is used to list all \fIOCFS2\fR volumes on a system.
+It can also list all the nodes that have mounted an \fIOCFS2\fR device or
+all \fIOCFS2\fR devices. The tools assumes that the nodes detected on
+the system are part of the same cluster as the one specified in
+\fI/etc/ocfs2/cluster.conf\fR.
+
 .SH "OPTIONS"
 .TP
 \fB\-d\fR
-Perform a quick detection of the \fIdevice\fR. With this option, only the label and uuid will be displayed.
+Performs a quick detection of the \fIdevice\fR or all, if none specified.
+Lists the \fIOCFS2\fR volumes along with their labels and uuids.
 
 .TP
 \fB\-f\fR
-Perform a full detection of the \fIdevice\fR. With this option, the node name will be displayed in addition to the label and uuid.
+Performs a full detection of the \fIdevice\fR or all, if none specified.
+Lists the \fIOCFS2\fR volumes along with the list of nodes mounting the
+volume. If the \fIO2CB\fR cluster service is up, it lists the node names,
+else the global node numbers.
 
-.SH "BUGS"
-Stuff.
+.SH "EXAMPLES"
+[root at node1 ~]# mounted.ocfs2 -d
+.br
+Device           FS     UUID                                  Label
+.br
+/dev/sdb1        ocfs2  26d5dcdf-6d87-45a7-b01a-b98a7791bd61  logs_0405
+.br
 
+[root at node1 ~]# mounted.ocfs2 -f
+.br
+Device           FS     Nodes
+.br
+/dev/sdb1        ocfs2  node15, node1
+.br
+
 .SH "SEE ALSO"
-.BR ocfs2(8)
+.BR mkfs.ocfs2(8)
+.BR fsck.ocfs2(8)
+.BR tunefs.ocfs2(8)
+.BR debugfs.ocfs2(8)
+.BR ocfs2console(8)
+.BR ocfs2cdsl(8)
 
 .SH "AUTHORS"
 Oracle Corporation
 
 .SH "COPYRIGHT"
-Copyright \(co 2002, 2004 Oracle Corporation
+Copyright \(co 2004, 2005 Oracle. All rights reserved.

Modified: branches/global-heartbeat/o2cb_ctl/o2cb_config.c
===================================================================
--- branches/global-heartbeat/o2cb_ctl/o2cb_config.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/o2cb_ctl/o2cb_config.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -23,6 +23,7 @@
 
 #include <string.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -339,10 +340,86 @@
     return rc;
 }
 
+static gint write_file(const gchar *text, const gchar *filename)
+{
+    int rc, fd;
+    GString *template;
+    FILE *file;
+    size_t written, len;
 
+    rc = mkdir("/etc/ocfs2", 0755);
+    if (rc)
+    {
+        rc = -errno;
+        if (rc == -EEXIST)
+            rc = 0;
+        else
+            goto out;
+    }
+
+    rc = -ENOMEM;
+    template = g_string_new(filename);
+    if (!template)
+        goto out;
+
+    g_string_append(template, "XXXXXX");
+    fd = mkstemp(template->str);
+    rc = -errno;
+    if (fd < 0)
+        goto out_free;
+
+    file = fdopen(fd, "w");
+    if (!file)
+    {
+        rc = -errno;
+        close(fd);
+        goto out_unlink;
+    }
+
+    len = strlen(text);
+    written = fwrite(text, sizeof(char), len, file);
+    if (written != len)
+    {
+        if (feof(file))
+            rc = -EIO;
+        else if (ferror(file))
+            rc = -errno;
+        else
+            rc = -EIO;
+
+        fclose(file);
+        goto out_unlink;
+    }
+
+    fchmod(fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+
+    rc = fclose(file);
+    if (rc)
+    {
+        rc = -errno;
+        goto out_unlink;
+    }
+
+    rc = rename(template->str, filename);
+    if (rc)
+        rc = -errno;
+    
+out_unlink:
+    if (rc)
+        unlink(template->str);
+
+out_free:
+    g_string_free(template, TRUE);
+
+out:
+    return rc;
+}
+
+
 gint o2cb_config_store(O2CBConfig *config, const gchar *filename)
 {
     int rc;
+    char *text;
     JConfig *cf;
     O2CBCluster *cluster;
     GList *list;
@@ -358,24 +435,20 @@
         cluster = (O2CBCluster *)list->data;
         rc = o2cb_cluster_store(cf, cluster);
         if (rc)
-            break;
+            goto out;
 
         list = list->next;
     }
 
-    if (!rc)
-    {
-        rc = mkdir("/etc/ocfs2", 0755);
-        if (rc)
-        {
-            rc = -errno;
-            if (rc == -EEXIST)
-                rc = 0;
-        }
-        if (!rc && !j_config_dump_file(cf, filename))
-            rc = -EIO;
-    }
+    rc = -ENOMEM;
+    text = j_config_dump_memory(cf);
+    if (!text)
+        goto out;
 
+    rc = write_file(text, filename);
+    g_free(text);
+
+out:
     return rc;
 }  /* o2cb_config_store() */
 

Modified: branches/global-heartbeat/o2cb_ctl/o2cb_ctl.8.in
===================================================================
--- branches/global-heartbeat/o2cb_ctl/o2cb_ctl.8.in	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/o2cb_ctl/o2cb_ctl.8.in	2005-09-06 02:01:13 UTC (rev 1072)
@@ -1,6 +1,6 @@
 .TH "o2cb_ctl" "8" "March 2005" "Version @VERSION@" "OCFS2 Manual Pages"
 .SH "NAME"
-o2cb_ctl \- Control program for the OCFS2 Cluster Software.
+o2cb_ctl \- Control program for the \fIO2CB\fR cluster service.
 .SH "SYNOPSIS"
 .B o2cb_ctl 
 \fB\-C\fR \fB\-n\fR \fIobject\fR \fB\-t\fR type\fR [\fB\-i\fR] [\fB\-a\fR \fIattribute\fR ]
@@ -22,7 +22,9 @@
 
 .SH "DESCRIPTION"
 .PP 
-\fBo2cb_ctl\fR is the control program for he OCFS2 Cluster Software. Oracle strongly recommends users to make use of \fIocfs2console\fR. \fBo2cb_ctl\fR is used to configure, modify and start the OCFS2 Cluster Software (file \fI/etc/ocfs2/cluster.conf\fR). One should be careful when configuring the cluster to make sure all nodes have the exact same copy of the file \fI/etc/ocfs2/cluster.conf\fR or the cluster will not work properly.
+\fBo2cb_ctl\fR is the control program for the \fIO2CB\fR cluster service.
+One is strongly recommended not to use this tool directly but instead
+use \fIocfs2console\fR to do the same.
 
 .SH "OPTIONS"
 
@@ -54,19 +56,30 @@
 
 .TP
 \fB\-a\fR \fI<attribute>\fR
-With \fB\-C\fR, \fI<attribute>\fR is in format "parameter=value", where the parameter is a valid parameter that can be set in the file \fI/etc/ocfs2/cluster.conf\fR.  With \fB\-I\fR, \fI<attribute>\fR may be "parameter", indicating an attribute to be listed in the output, or it may be "parameter==value", indicating that only objects matching "parameter=value" are to be displayed.
+With \fB\-C\fR, \fI<attribute>\fR is in format "parameter=value", where
+the parameter is a valid parameter that can be set in the file
+\fI/etc/ocfs2/cluster.conf\fR.  With \fB\-I\fR, \fI<attribute>\fR may be
+"parameter", indicating an attribute to be listed in the output, or it
+may be "parameter==value", indicating that only objects matching
+"parameter=value" are to be displayed.
 
 .TP
 \fB\-i\fR
-Valid only with \fB\-C\fR. When creating something (\fInode\fR or \fIcluster\fR), it will also install it in the live cluster. If the parameter is not specified, then only update the \fI/etc/ocfs2/cluster.conf\fR.
+Valid only with \fB\-C\fR. When creating something (\fInode\fR or
+\fIcluster\fR), it will also install it in the live cluster. If the
+parameter is not specified, then only update the
+\fI/etc/ocfs2/cluster.conf\fR.
 
 .TP
 \fB\-n\fR \fIobject\fR
-\fIobject\fR is usually the node name or cluster name. In the \fI/etc/ocfs2/cluster.conf\fR file, it would be the value of the name parameter for any of the sections (\fIcluster\fR or \fInode\fR).
+\fIobject\fR is usually the node name or cluster name. In the
+\fI/etc/ocfs2/cluster.conf\fR file, it would be the value of the name
+parameter for any of the sections (\fIcluster\fR or \fInode\fR).
 
 .TP
 \fB\-o\fR
-Valid only with \fB\-I\fR. Using this parameter, if one asks o2cb_ctl to list all nodes, it will output it in a format suitable for shell parsing.
+Valid only with \fB\-I\fR. Using this parameter, if one asks o2cb_ctl to
+list all nodes, it will output it in a format suitable for shell parsing.
 
 .TP
 \fB\-t\fR \fItype\fR
@@ -74,20 +87,26 @@
 
 .TP
 \fB\-u\fR
-Valid only with \fB\-D\fR. When deleting something (\fInode\fR or \fIcluster\fR), it will also remove it from the live cluster. If the parameter is not specified, then only update the \fI/etc/ocfs2/cluster.conf\fR.
+Valid only with \fB\-D\fR. When deleting something (\fInode\fR or
+\fIcluster\fR), it will also remove it from the live cluster. If the
+parameter is not specified, then only update the
+\fI/etc/ocfs2/cluster.conf\fR.
 
 .TP
 \fB\-z\fR
-Valid only with \fB\-I\fR. This is the default. If one asks o2cb_ctl to list all nodes, it will give a verbose listing.
+Valid only with \fB\-I\fR. This is the default. If one asks o2cb_ctl to
+list all nodes, it will give a verbose listing.
 
 .SH "EXAMPLES"
 
 .HP
 In the cluster "mycluster", create the node "node5":
 
-o2cb_ctl -C -n node5 -t node -a number=5 -a ip_address=139.185.118.5 -a ip_port=7777 \\
+o2cb_ctl -C -n node5 -t node -a number=5
 .br
--a cluster=mycluster
+	-a ip_address=139.185.118.5 -a ip_port=7777
+.br
+	-a cluster=mycluster
 
 .TP
 To query the IP address of node5:
@@ -99,15 +118,16 @@
 
 o2cb_ctl -H -n node5 -a ip_address=130.35.68.5
 
-
-.SH "BUGS"
-Stuff.
-
 .SH "SEE ALSO"
-.BR ocfs2(8)
+.BR mkfs.ocfs2(8)
+.BR fsck.ocfs2(8)
+.BR tunefs.ocfs2(8)
+.BR mounted.ocfs2(8)
+.BR ocfs2console(8)
+.BR ocfs2cdsl(8)
 
 .SH "AUTHORS"
 Oracle Corporation
 
 .SH "COPYRIGHT"
-Copyright \(co 2002, 2004 Oracle Corporation
+Copyright \(co 2004, 2005 Oracle. All rights reserved.

Modified: branches/global-heartbeat/o2cb_ctl/o2cb_ctl.c
===================================================================
--- branches/global-heartbeat/o2cb_ctl/o2cb_ctl.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/o2cb_ctl/o2cb_ctl.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -67,6 +67,7 @@
     GList *oc_objects;
     GList *oc_attrs;
     gboolean oc_compact_info;
+    gboolean oc_changed;
     gboolean oc_modify_running;
     O2CBConfig *oc_config;
 };
@@ -987,6 +988,7 @@
         rc = o2cb_cluster_set_name(cluster, val);
         if (rc)
             return rc;
+        ctxt->oc_changed = TRUE;
     }
     /* FIXME: Should perhaps store config before changing online info */
     if (attr_set(ctxt, "online"))
@@ -1083,7 +1085,8 @@
         goto out_error;
     }
 
-    rc = write_config(ctxt);
+    if (ctxt->oc_changed)
+        rc = write_config(ctxt);
 
 out_error:
     return rc;
@@ -1355,7 +1358,7 @@
 
 out_error:
     return rc;
-}  /* run_change() */
+}  /* run_create() */
 
 gint main(gint argc, gchar *argv[])
 {

Modified: branches/global-heartbeat/ocfs2_hb_ctl/ocfs2_hb_ctl.8.in
===================================================================
--- branches/global-heartbeat/ocfs2_hb_ctl/ocfs2_hb_ctl.8.in	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/ocfs2_hb_ctl/ocfs2_hb_ctl.8.in	2005-09-06 02:01:13 UTC (rev 1072)
@@ -1,6 +1,6 @@
 .TH "ocfs2_hb_ctl" "8" "March 2005" "Version @VERSION@" "OCFS2 Manual Pages"
 .SH "NAME"
-ocfs2_hb_ctl \- Start/stop the ocfs2 heartbeat.
+ocfs2_hb_ctl \- Starts and stops the \fIOCFS2\fR heartbeat on a given device.
 .SH "SYNOPSIS"
 .B ocfs2_hb_ctl 
 \fB-S\fR \fB-d\fR \fI<device>\fR
@@ -22,27 +22,30 @@
 .br
 .SH "DESCRIPTION"
 .PP 
-\fBocfs2_hb_ctl\fR is used to start/stop the heartbeat. It can use either a \fIdevice\fR or \fIuuid\fR.
+\fBocfs2_hb_ctl\fR is used to start and stop the heartbeat on an \fIOCFS2\fR device.
+One can either specify a device name or the device uuid. Users are strongly urged not
+to use this tool directly. \fImount.ocfs2\fR uses this tool to start the heartbeat
+and the module uses it to stop it during umount.
 .SH "OPTIONS"
 .TP
 \fB\-S\fR
-Start the hearbeat of a \fIdevice\fR. This operation can't be performed using \fIuuid\fR.
+Starts the hearbeat of a \fIdevice\fR. The device name must be specified.
 
 .TP
 \fB\-K\fR
-Stop the hearbeat of a \fIdevice\fR. This operation can be performed by using either \fIdevice\fR or \fIuuid\fR.
+Stops the hearbeat of a \fIdevice\fR. One can specify either the device name or the device uuid.
 
 .TP
 \fB\-I\fR
-Prints out ref counts for the region. This operation can be performed by using either \fIdevice\fR or \fIuuid\fR.
+Prints out the hearbeat reference counts for the region. Once can specify either the device name or the device uuid.
 
 .TP
 \fB\-d\fR
-Specifies region by \fIdevice\fR.
+Specify region by device name.
 
 .TP
 \fB\-u\fR
-Specifies region by \fIuuid\fR.
+Specify region by device uuid.
 
 .TP
 \fB\-h\fR
@@ -50,19 +53,22 @@
 
 .TP
 \fBuuid\fR
-Ocfs2 writes a signature to the device when it is formatted (\fBmkfs.ocfs2\fR). To obtain the uuid of a specific \fIdevice\fR, one can use the command.
+\fImkfs.ocfs2\fR creates and populates the superblock with an \fIuuid\fR. To list the \fIuuid\fR of
+device sda1, do:
 .HP 
-mounted.ocfs2 -d /dev/sdxx
+	# mounted.ocfs2 -d /dev/sda1
 
-.SH "BUGS"
-Stuff.
-
 .SH "SEE ALSO"
-.BR 
-o2cb_ctl(8), mounted.ocfs2(8)
+.BR mkfs.ocfs2(8)
+.BR fsck.ocfs2(8)
+.BR tunefs.ocfs2(8)
+.BR mounted.ocfs2(8)
+.BR ocfs2console(8)
+.BR ocfs2cdsl(8)
+.BR debugfs.ocfs2(8)
 
 .SH "AUTHORS"
 Oracle Corporation
 
 .SH "COPYRIGHT"
-Copyright \(co 2002, 2004 Oracle Corporation
+Copyright \(co 2004, 2005 Oracle. All rights reserved.

Modified: branches/global-heartbeat/ocfs2cdsl/ocfs2cdsl.8.in
===================================================================
--- branches/global-heartbeat/ocfs2cdsl/ocfs2cdsl.8.in	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/ocfs2cdsl/ocfs2cdsl.8.in	2005-09-06 02:01:13 UTC (rev 1072)
@@ -5,17 +5,29 @@
 \fBocfs2cdsl\fR [\fB-cfnqvV\fR] [\fB\-t\fR \fIhostname|mach|os|nodenum\fR] \fIfilename\fR
 .SH "DESCRIPTION"
 .PP 
-\fBocfs2cdsl\fR is used to create context dependent symbolic link for \fIfilename\fR (file or directory) for a node. A CDSL \fIfilename\fR will have its own image for a specific node, but a common name in the OCFS2. It is very important that the \fBocfs2ctl\fR command to be issued on all nodes that are part of the cluster and to any subsequent nodes that are added. If the \fBocfs2cdsl\fR command is not executed in some of the nodes, the cdsl directory will not be accessible by them.
+\fBocfs2cdsl\fR is used to create a context dependent symbolic link for
+\fIfilename\fR (file or directory) for a node. A CDSL \fIfilename\fR will
+have its own image for a specific node, but a common name in the OCFS2. It
+is very important that the \fBocfs2ctl\fR command to be issued on all nodes
+that are part of the cluster and to any subsequent nodes that are added. If
+the \fBocfs2cdsl\fR command is not executed in some of the nodes, the cdsl
+directory will not be accessible by them.
 
 .SH "OPTIONS"
 
 .TP
 \fB\-t\fR \fIhostname|mach|os|nodenum\fR
-\fIhostname|mach|os|nodenum\fR - One of these options should be specified in order to create the CDSL. As for information, \fIhostname\fR would be the same as the output of "uname -n", \fImach\fR would be the output of "uname -m", \fIos\fR would the the output of "uname -o" and \fInodenum\fR would be the global node number for the hostname in the \fI/etc/ocfs2/cluster.conf\fR file.
+\fIhostname|mach|os|nodenum\fR - One of these options should be specified
+in order to create the CDSL. As for information, \fIhostname\fR would be
+the same as the output of "uname -n", \fImach\fR would be the output of
+"uname -m", \fIos\fR would the the output of "uname -o" and \fInodenum\fR
+would be the global node number for the hostname in the
+\fI/etc/ocfs2/cluster.conf\fR file.
 
 .TP
 \fB\-c\fR
-During the creation of the CDSL, if the file does exist, the data will be copied to the new location.
+During the creation of the CDSL, if the file does exist, the data will be
+copied to the new location.
 
 .TP
 \fB\-f\fR
@@ -23,7 +35,8 @@
 
 .TP
 \fB\-n\fR
-Will perform a check of all options and motions, but will not perform any change on disk.
+Will perform a check of all options and motions, but will not perform any
+change on disk.
 
 .TP
 \fB\-q\fR
@@ -39,19 +52,35 @@
 
 .SH "EXAMPLE"
 
-If one wants to have a shared ORACLE_HOME installed on an OCFS2 partition, and wants to have node specific configuration \fIfilename\fR in the same shared ORACLE_HOME, one can have the \fIfilename\fR created by ocfs2cdsl. A good example would be the directory $ORACLE_HOME/network/agent. Node1 could have its own view of the directory, which is different from Node2 view, but having the exact same full pathname.
+If one wants to have a shared ORACLE_HOME installed on an OCFS2 partition,
+and wants to have node specific configuration \fIfilename\fR in the same
+shared ORACLE_HOME, one can have the \fIfilename\fR created by ocfs2cdsl.
+A good example would be the directory $ORACLE_HOME/network/agent. Node1
+could have its own view of the directory, which is different from Node2
+view, but having the exact same full pathname.
+.br
 
-ocfs2cdsl -c -t hostname $ORACLE_HOME/network/agent
-.TP
-In the example above, a CDSL directoy will be created and the contents of the \fIagent\fR directoy will copied to the new location. If the same is to be executed on all nodes, and assuming that no changes are made to the directory, each one of the nodes would have the exact same view of the \fIagent\fR directory. In case of change in the \fIagent\fR directory after the creation of the CDSL, only the node performing the change would be able to see it. All other nodes would still have the same initial view of the \fIagent\fR directory.
-.SH "BUGS"
-Stuff.
+	# ocfs2cdsl -c -t hostname $ORACLE_HOME/network/agent
 
+.br
+In the example above, a CDSL directory will be created and the contents of the
+\fIagent\fR directory will copied to the new location. If the same is to be executed
+on all nodes, and assuming that no changes are made to the directory, each one of the
+nodes would have the exact same view of the \fIagent\fR directory. In case of change
+in the \fIagent\fR directory after the creation of the CDSL, only the node performing
+the change would be able to see it. All other nodes would still have the same initial
+view of the \fIagent\fR directory.
+
 .SH "SEE ALSO"
-.BR ocfs2(8)
+.BR mkfs.ocfs2(8)
+.BR fsck.ocfs2(8)
+.BR tunefs.ocfs2(8)
+.BR mounted.ocfs2(8)
+.BR ocfs2console(8)
+.BR debugfs.ocfs2(8)
 
 .SH "AUTHORS"
 Oracle Corporation
 
 .SH "COPYRIGHT"
-Copyright \(co 2002, 2005 Oracle Corporation
+Copyright \(co 2004, 2005 Oracle. All rights reserved.

Modified: branches/global-heartbeat/ocfs2console/ocfs2console.8.in
===================================================================
--- branches/global-heartbeat/ocfs2console/ocfs2console.8.in	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/ocfs2console/ocfs2console.8.in	2005-09-06 02:01:13 UTC (rev 1072)
@@ -1,24 +1,25 @@
 .TH OCFS2CONSOLE 8 "January 2005" "Version @VERSION@" "OCFS2 Manual Pages"
 .SH NAME
-ocfs2console - GUI frontend for OCFS2 management
+ocfs2console - GUI console for \fIOCFS2\fR.
 .SH SYNOPSIS
 .B ocfs2console
 
 .SH DESCRIPTION
 .PP
-\fBocfs2console\fP is a GUI frontend for managing OCFS2 volumes on
-the system. One can mount and unmount volumes, format, view overview
-information and individual files, and view and modify the current cluster
-configuration.
+\fBocfs2console\fP is a GUI front\-end for managing \fIOCFS2\fR volumes.
+This tool is especially recommended to configure the \fIO2CB\fR cluster.
+One can also use this tool to format, tune, mount and umount \fIOCFS2\fR volumes.
 
-.SH BUGS
-Stuff.
-
 .SH SEE ALSO
-.BR ocfs2(5)
+.BR mkfs.ocfs2(8)
+.BR fsck.ocfs2(8)
+.BR tunefs.ocfs2(8)
+.BR mounted.ocfs2(8)
+.BR debugfs.ocfs2(8)
+.BR ocfs2cdsl(8)
 
 .SH AUTHORS
-Oracle
+Oracle Corporation
 
 .SH COPYRIGHT
-Copyright \(co 2002, 2005 Oracle
+Copyright \(co 2004, 2005 Oracle. All rights reserved.

Modified: branches/global-heartbeat/ocfs2console/ocfs2interface/about.py
===================================================================
--- branches/global-heartbeat/ocfs2console/ocfs2interface/about.py	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/ocfs2console/ocfs2interface/about.py	2005-09-06 02:01:13 UTC (rev 1072)
@@ -17,7 +17,7 @@
 
 import sys
 
-OCFS2TOOL_VERSION = '0.9.0'
+OCFS2TOOL_VERSION = '1.1.0'
 
 def print_version():
     print 'OCFS2Console version %s' % OCFS2TOOL_VERSION

Modified: branches/global-heartbeat/tunefs.ocfs2/tunefs.c
===================================================================
--- branches/global-heartbeat/tunefs.ocfs2/tunefs.c	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/tunefs.ocfs2/tunefs.c	2005-09-06 02:01:13 UTC (rev 1072)
@@ -49,11 +49,7 @@
 #include <ocfs2_fs.h>
 #include <ocfs1_fs_compat.h>
 
-/* jfs_compat.h defines these */
-#undef cpu_to_be32
-#undef be32_to_cpu
-typedef unsigned short kdev_t;
-#include <kernel-jbd.h>
+#include <jbd.h>
 
 #include <kernel-list.h>
 

Modified: branches/global-heartbeat/tunefs.ocfs2/tunefs.ocfs2.8.in
===================================================================
--- branches/global-heartbeat/tunefs.ocfs2/tunefs.ocfs2.8.in	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/tunefs.ocfs2/tunefs.ocfs2.8.in	2005-09-06 02:01:13 UTC (rev 1072)
@@ -1,54 +1,64 @@
 .TH "tunefs.ocfs2" "8" "March 2005" "Version @VERSION@" "OCFS2 Manual Pages"
 .SH "NAME"
-tunefs.ocfs2 \- Change OCFS2 partition parameters.
+tunefs.ocfs2 \- Change \fIOCFS2\fR file system parameters.
 .SH "SYNOPSIS"
 \fBtunefs.ocfs2\fR [\fB\-L\fR \fIvolume-label\fR] [\fB\-N\fR \fInumber-of-nodes\fR] [\fB\-J\fR \fIjournal-options\fR] [\fB\-S\fR \fIvolume-size\fR] [\fB\-qvV\fR] \fIdevice\fR
 .SH "DESCRIPTION"
 .PP 
-\fBtunefs.ocfs2\fR is used to adjust OCFS2 file system parameters on disk. In order to prevent data loss, \fBtunefs.ocfs2\fR will not perform any action to a specified device if any node has it mounted. 
+\fBtunefs.ocfs2\fR is used to adjust \fIOCFS2\fR file system parameters on disk.
+In order to prevent data loss, \fBtunefs.ocfs2\fR will not perform any
+action on the specified device, if that device is mounted on any node
+in the cluster. \fIO2CB\fR cluster service should be up to run this tool.
 .SH "OPTIONS"
 .TP
 \fB\-L\fR \fIvolume\-label\fR
-\fIvolume\-label\fR specifiy the new label name of a device. The maximum \fIvolume-label\fR lenght allowed is 64 bytes.
+Change the volume label for the file system. Limit the label
+length to under 64 bytes.
 
 .TP
 \fB\-N\fR \fInumber\-of\-node\-slots\fR
-\fInumber\-of\-node\-slots\fR specify the maximum number of nodes that can simultaneously mount the specific OCFS2 partition. The maximum value allowed for \fInumber\-of\-node\-slots\fR is 255. Note that one can increase the number of node slots, but not decrease it. Future versions may allow decrease of the number of node slots.
+Use this to increase the number of slots inorder to increase the
+number of nodes that can concurrently mount this volume. The maximum
+value is 255.
 
 .TP
 \fB\-J\fR \fIjournal\-options\fR
-Modify the journal using options specified on the command\-line. Journal options are comma separated, and may take an argument using the equals ('=') sign.
-The following journal options are supported:
+Modify the journal using options specified on the command\-line.
+Journal options are comma separated, and may take an argument using
+the equals ('=') sign. The following journal options are supported:
 .RS 1.2i
 .TP
 \fBsize\fR=\fIjournal\-size\fR
-Create a journal of size \fIjournal\-size\fR. Valid sizes range from 4Mb to 500Mb.
+Increase the size of journal files for all the slots. Minimum size is 4M.
 .RE
 
 .TP
-\fB\-S\fR \fIvolume\-size\fR 
-\fIvolume\-size\fR specify the new volume size of an OCFS2 partition. A partition should be physically extended prior to use this option.
+\fB\-S\fR \fIvolume\-size\fR
+Increase the size of the \fIOCFS2\fR volume. \fBThis functionality
+is not operational as of now.\fR
 
 .TP
 \fB\-q\fR 
-Execute \fBtunefs.ocfs2\fR in quiet mode. 
+Quiet mode. 
 
 .TP
 \fB\-v\fR 
-Execute \fBtunefs.ocfs2\fR in verbose mode.
+Verbose mode.
 
 .TP
 \fB\-V\fR 
 Show version and exit.
 
-.SH "BUGS"
-Stuff.
-
 .SH "SEE ALSO"
-.BR ocfs2(8)
+.BR mkfs.ocfs2(8)
+.BR fsck.ocfs2(8)
+.BR debugfs.ocfs2(8)
+.BR mounted.ocfs2(8)
+.BR ocfs2console(8)
+.BR ocfs2cdsl(8)
 
 .SH "AUTHORS"
 Oracle Corporation
 
 .SH "COPYRIGHT"
-Copyright \(co 2002, 2004 Oracle Corporation
+Copyright \(co 2004, 2005 Oracle. All rights reserved.

Modified: branches/global-heartbeat/vendor/common/o2cb.init
===================================================================
--- branches/global-heartbeat/vendor/common/o2cb.init	2005-08-31 23:17:39 UTC (rev 1071)
+++ branches/global-heartbeat/vendor/common/o2cb.init	2005-09-06 02:01:13 UTC (rev 1072)
@@ -92,6 +92,9 @@
 # O2CB_BOOTCLUSTER: If not empty, the name of a cluster to start.
 O2CB_BOOTCLUSTER=${O2CB_BOOTCLUSTER}
 
+# O2CB_HEARTBEAT_THRESHOLD: Iterations before a node is considered dead.
+O2CB_HEARTBEAT_THRESHOLD=${O2CB_HEARTBEAT_THRESHOLD}
+
 EOF
 
     if [ $? != 0 ]
@@ -480,6 +483,9 @@
         eval ${LOAD_ACTIONS[i]}
         if_fail "$?"
     done
+    if [ -n "$O2CB_HEARTBEAT_THRESHOLD" ]; then
+        echo "$O2CB_HEARTBEAT_THRESHOLD" > /proc/fs/ocfs2_nodemanager/hb_dead_threshold
+    fi
 }
 
 load_status()

Copied: branches/global-heartbeat/vendor/common/ocfs2fs (from rev 1071, trunk/vendor/common/ocfs2fs)



More information about the Ocfs2-tools-commits mailing list