[Ocfs2-commits] jlbec commits r1008 - in branches/format-changes/src: . inc

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Jun 4 18:59:05 CDT 2004


Author: jlbec
Date: 2004-06-04 17:59:03 -0500 (Fri, 04 Jun 2004)
New Revision: 1008

Modified:
   branches/format-changes/src/alloc.c
   branches/format-changes/src/buffer_head_io.c
   branches/format-changes/src/dir.c
   branches/format-changes/src/dlm.c
   branches/format-changes/src/extmap.c
   branches/format-changes/src/file.c
   branches/format-changes/src/inc/ocfs.h
   branches/format-changes/src/inc/ocfs_buffer_head.h
   branches/format-changes/src/inc/ocfs_journal.h
   branches/format-changes/src/inc/proto.h
   branches/format-changes/src/inode.c
   branches/format-changes/src/journal.c
   branches/format-changes/src/lockres.c
   branches/format-changes/src/namei.c
   branches/format-changes/src/nm.c
   branches/format-changes/src/super.c
   branches/format-changes/src/sysfile.c
   branches/format-changes/src/vote.c
Log:

o ocfs_alloc_ext is now called ocfs_extent_rec.  Why, because it is
  an extent record.  Duh.
o ocfs_extent_rec now uses clusters for its file virtual offset and
  extent length fields.  We allocate in clusters, why should we
  account in anything else?
o ocfs_extent_rec now uses blocks for its physical disk offsets.  I
  mean, duh, again.
o This has created a MESS OF SHIFTS.  This is because the rest of
  alloc.c does all of its work in bytes.  Someone, someday, needs to
  make everything cluster-centric.  I, however, am to fried right now.
  I am also too afraid of breaking some subtle behavior that has no
  buisness existing.  There are too many of those, and we have no idea
  where they are.



Modified: branches/format-changes/src/alloc.c
===================================================================
--- branches/format-changes/src/alloc.c	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/alloc.c	2004-06-04 22:59:03 UTC (rev 1008)
@@ -66,20 +66,24 @@
 static int ocfs_kill_this_tree(ocfs_super *osb, struct buffer_head *extent_grp_bh, 
 			       ocfs_journal_handle *handle, struct inode *inode);
 static int ocfs_allocate_new_data_node (ocfs_super * osb, 
-				 ocfs_file_entry * FileEntry,
-				 __u64 actualDiskOffset, __u64 actualLength, 
+				 ocfs2_dinode * FileEntry,
+				 u32 new_clusters, 
 				 struct buffer_head * extent_header_bh, 
 				 __u64 * NewExtentOffset, 
-				 ocfs_journal_handle *handle, struct inode *inode);
+				 ocfs_journal_handle *handle,
+				 struct inode *inode);
 
-static int ocfs_grow_extent_tree (ocfs_super * osb, struct buffer_head *fe_bh,
-				  ocfs_journal_handle *handle, __u64 disk_off,
-				  __u64 length, struct inode *inode);
+static int ocfs_grow_extent_tree(ocfs_super *osb,
+				 struct buffer_head *fe_bh,
+				 ocfs_journal_handle *handle,
+				 u64 blkno,
+			       	 u32 new_clusters, struct inode *inode);
 
-static int _squish_extent_entries(ocfs_super *osb, ocfs_alloc_ext *extarr, 
+static int _squish_extent_entries(ocfs_super *osb,
+				  ocfs_extent_rec *extarr, 
 				  __u16 *freeExtent, 
 				  ocfs_journal_handle *handle,
-				  __u64 FileSize, int flag, 
+				  u32 num_clusters, int flag, 
 				  struct inode *inode);
 
 static int ocfs_fix_extent_group(ocfs_super *osb, struct buffer_head *group_bh, struct inode *inode);
@@ -87,10 +91,10 @@
 static int ocfs_split_this_tree(ocfs_super * osb, 
 				struct buffer_head *extent_grp_bh, 
 				ocfs_journal_handle *handle,
-				ocfs_file_entry *fe, 
+				ocfs2_dinode *fe, 
 				struct inode *inode);
 
-static int ocfs_update_last_ext_ptr(ocfs_super *osb, ocfs_file_entry *fe, struct inode *inode);
+static int ocfs_update_last_ext_ptr(ocfs_super *osb, ocfs2_dinode *fe, struct inode *inode);
 
 static int ocfs_free_vol_block (ocfs_super * osb, ocfs_journal_handle *handle,
 				ocfs_free_rec * FreeLog, __u32 NodeNum, 
@@ -115,7 +119,19 @@
 				      __u64 * bitoff, __u64 * bitcount, 
 				      ocfs_journal_handle *handle);
 static int ocfs_local_find_clear_bits(ocfs_super *osb, ocfs_local_alloc *alloc, __u32 numbits);
+static int ocfs_extent_contig(struct inode *inode, ocfs_extent_rec *ext,
+                              u64 blkno);
 
+static int ocfs_extent_contig(struct inode *inode, ocfs_extent_rec *ext,
+                              u64 blkno)
+{
+	u64 start_blkno = ext->e_blkno;
+
+	start_blkno += ocfs_clusters_to_blocks(inode->i_sb,
+                                               ext->e_clusters);
+	return (start_blkno == blkno);
+}
+
 /* this is a good candidate for an inline function. */
 int ocfs_process_bitmap_free_head(ocfs_super *osb, ocfs_bitmap_free_head *f) 
 {
@@ -388,7 +404,7 @@
 
 	/* release all locks */
 	if (free_vol_bits) {
-		ocfs_file_entry *bm_lock;
+		ocfs2_dinode *bm_lock;
 
 		status = ocfs_journal_access(handle, globalbh, 
 					     OCFS_JOURNAL_ACCESS_WRITE);
@@ -397,7 +413,7 @@
 			goto abort;
 		}
 
-		bm_lock = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(globalbh);   /* write */
+		bm_lock = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(globalbh);   /* write */
 		bm_lock->u.bitinfo.used_bits = ocfs_count_bits(&osb->cluster_bitmap);
 		OCFS_BH_PUT_DATA(globalbh);
 
@@ -606,11 +622,13 @@
 /* ocfs_allocate_new_data_node()
  *
  */
-static int ocfs_allocate_new_data_node (ocfs_super * osb, 
-				 ocfs_file_entry * FileEntry,
-				 __u64 actualDiskOffset, __u64 actualLength, 
-				 struct buffer_head * extent_header_bh, 
-				 __u64 * NewExtentOffset, ocfs_journal_handle *handle, struct inode *inode)
+static int ocfs_allocate_new_data_node(ocfs_super *osb, 
+				       ocfs2_dinode *fe,
+				       u32 new_clusters, 
+				       struct buffer_head *extent_header_bh, 
+				       __u64 *NewExtentOffset,
+				       ocfs_journal_handle *handle,
+				       struct inode *inode)
 {
 	int status = 0;
 	__u8 *buff = NULL;
@@ -619,6 +637,7 @@
 	__u32 allocSize;
 	__u64 upHeaderPtr;
 	__u64 physicalOffset;
+	u64 phys_blkno;
 	__u64 fileOffset = 0;
 	__u64 numSectorsAlloc = 0;
 	__u64 lastExtPointer;
@@ -646,9 +665,9 @@
 		depth = extent_header->granularity;
 		upHeaderPtr = extent_header->this_ext;
 	} else {
-		depth = FileEntry->i_tree_depth;
+		depth = fe->i_tree_depth;
 		upHeaderPtr =
-			FileEntry->i_blkno << osb->sb->s_blocksize_bits;
+			fe->i_blkno << inode->i_sb->s_blocksize_bits;
 	}
 
 	numSectorsAlloc = NUM_SECTORS_IN_LEAF_NODE + depth;
@@ -662,6 +681,7 @@
 		LOG_ERROR_STATUS (status);
 		goto finally;
 	}
+	phys_blkno = physicalOffset >> osb->sb->s_blocksize_bits;
 
 	size = sizeof(struct buffer_head *) * numSectorsAlloc;
 	header_bhs = ocfs_malloc(size);
@@ -695,20 +715,21 @@
 	
 	if (extent_header != NULL) {
 		k = extent_header->next_free_ext;
-		extent_header->extents[k].file_off = FileEntry->i_clusters << osb->s_clustersize_bits;
-		extent_header->extents[k].num_bytes = actualLength;
-		extent_header->extents[k].disk_off = physicalOffset;
+		extent_header->extents[k].e_cpos =
+		     	fe->i_clusters;
+		extent_header->extents[k].e_clusters = new_clusters;
+		extent_header->extents[k].e_blkno = phys_blkno;
 		extent_header->next_free_ext++;
 	} else {
-		k = FileEntry->i_next_free_ext;
-		FileEntry->extents[k].file_off = FileEntry->i_clusters << osb->s_clustersize_bits;
-		FileEntry->extents[k].num_bytes = actualLength;
-		FileEntry->extents[k].disk_off = physicalOffset;
-		FileEntry->i_next_free_ext++;
+		k = fe->i_next_free_ext;
+		fe->extents[k].e_cpos = fe->i_clusters;
+		fe->extents[k].e_clusters = new_clusters;
+		fe->extents[k].e_blkno = phys_blkno;
+		fe->i_next_free_ext++;
 	}
 
 
-	lastExtPointer = FileEntry->last_ext_ptr;
+	lastExtPointer = fe->last_ext_ptr;
 
 	/* Fill in all the headers and the leaf */
 	for (i = 0; i <= depth; i++) {
@@ -720,24 +741,24 @@
 		ext->next_free_ext = 1;
 		ext->alloc_file_off = fileOffset + (osb->sect_size * i);
 		ext->alloc_node = osb->node_num;
-		ext->extents[0].file_off = FileEntry->i_clusters << osb->s_clustersize_bits;
-		ext->extents[0].num_bytes = actualLength;
+		ext->extents[0].e_cpos = fe->i_clusters;
+		ext->extents[0].e_clusters = new_clusters;
 		ext->this_ext = (__u64) (physicalOffset + (osb->sect_size * i));
 
 		if (i != depth) {
 			/* fill in each header */
 			ext->type = OCFS_EXTENT_HEADER;
-			ext->extents[0].disk_off = (__u64) (physicalOffset + (osb->sect_size * (i + 1)));
+			ext->extents[0].e_blkno = phys_blkno + (i + 1);
 			ext->granularity = (depth - 1 - i);
 			strcpy (ext->signature, OCFS_EXTENT_HEADER_SIGNATURE);
 		} else {
 			/* fill in the leaf */
 			ext->type = OCFS_EXTENT_DATA; 
-			ext->extents[0].disk_off = actualDiskOffset;
+			ext->extents[0].e_blkno = phys_blkno;
 			ext->curr_sect = 1; 
 			ext->max_sects = NUM_SECTORS_IN_LEAF_NODE;
 			strcpy (ext->signature, OCFS_EXTENT_DATA_SIGNATURE);
-			(*NewExtentOffset) = FileEntry->last_ext_ptr = ext->this_ext;
+			(*NewExtentOffset) = fe->last_ext_ptr = ext->this_ext;
 		}
 
 		upHeaderPtr = lastExtPointer = ext->this_ext;
@@ -770,7 +791,7 @@
 		/* gotta fix up his parent extents now. We totally
 		 * reuse the extent_header variable now as it's no
 		 * longer needed for it's original purpose. */
-		for (i = tree_depth + 1; i < FileEntry->i_tree_depth; i++) {
+		for (i = tree_depth + 1; i < fe->i_tree_depth; i++) {
 			bh = NULL;
 			status = ocfs_read_bh (osb, up_hdr_node_ptr, &bh, OCFS_BH_COND_CACHED, inode);
 			if (status < 0) {
@@ -800,7 +821,8 @@
 			}
 
 			k = extent_header->next_free_ext - 1;
-			extent_header->extents[k].num_bytes += actualLength;
+			extent_header->extents[k].e_clusters +=
+				new_clusters;
 
 			up_hdr_node_ptr = extent_header->up_hdr_node_ptr;
 			OCFS_BH_PUT_DATA(bh);
@@ -814,8 +836,8 @@
 
 			brelse(bh);
 		}
-		k = FileEntry->i_next_free_ext - 1;
-		FileEntry->extents[k].num_bytes += actualLength;
+		k = fe->i_next_free_ext - 1;
+		fe->extents[k].e_clusters += new_clusters;
 	}
 finally:
 	if (bh_locked)
@@ -833,7 +855,11 @@
 /* ocfs_grow_extent_tree()
  *
  */
-static int ocfs_grow_extent_tree (ocfs_super * osb, struct buffer_head *fe_bh, ocfs_journal_handle *handle, __u64 disk_off, __u64 length, struct inode *inode)
+static int ocfs_grow_extent_tree(ocfs_super * osb,
+				 struct buffer_head *fe_bh,
+				 ocfs_journal_handle *handle,
+				 u64 blkno, u32 new_clusters,
+				 struct inode *inode)
 {
 	int status = 0;
 	__s32 k, i;
@@ -842,15 +868,17 @@
 	ocfs_extent_group *ext = NULL;
 	__u64 physicalOffset;
 	__u64 fileOffset = 0;
+	u64 phys_blkno;
 	__u64 upHeaderPtr, lastExtentPtr;
 	__u32 AllocSize;
 	__u64 new_up_hdr_ptr = 0;
 	struct buffer_head **bhs = NULL;
 	int numbhs = 0;
 	void *buf;
-	ocfs_file_entry * fe = NULL, *real_fe = NULL;
+	ocfs2_dinode * fe = NULL, *real_fe = NULL;
 
-	LOG_ENTRY_ARGS("(0x%p, 0x%p, %llu, %llu\n", osb, fe, disk_off, length);
+	LOG_ENTRY_ARGS("(0x%p, 0x%p, %llu, %u\n", osb, fe, blkno,
+		       new_clusters);
 
 	/* too complicated to deal with both reads and writes to the structure     */
 	/* just save off a copy and replace the fe_bh with the new data at the end */
@@ -859,7 +887,7 @@
 		LOG_ERROR_STATUS (status = -ENOMEM);
 		goto finally;
 	}
-	real_fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(fe_bh); /* read */
+	real_fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(fe_bh); /* read */
 	memcpy(fe, real_fe, osb->sect_size);
 	OCFS_BH_PUT_DATA(fe_bh);
 	real_fe = NULL;
@@ -884,11 +912,11 @@
 		LOG_ERROR_STATUS (status);
 		goto finally;
 	}
+	phys_blkno = physicalOffset >> osb->sb->s_blocksize_bits;
 
 	for (i = 0; i < numbhs; i++) {
 		bhs[i] = getblk(OCFS_GET_BLOCKDEV(osb->sb), 
-				(physicalOffset + i * osb->sect_size) >> 
-				  osb->sect_size_bits, 
+				phys_blkno + i,
 				osb->sb->s_blocksize);
 		if (bhs[i] == NULL) {
 			status = -EIO;
@@ -896,12 +924,12 @@
 			goto finally;
 		}
 		buf = OCFS_BH_GET_DATA_WRITE(bhs[i]);  /* write */
-		memset(buf, 0, osb->sect_size);
+		memset(buf, 0, osb->sb->s_blocksize);
 		set_buffer_uptodate(bhs[i]);
 		OCFS_BH_PUT_DATA(bhs[i]);
 	}
 
-	if (physicalOffset == 0) {
+	if (phys_blkno == 0) {
 		LOG_ERROR_STATUS(status = -ENOMEM);
 		goto finally;
 	}
@@ -909,9 +937,10 @@
 	OcfsExtent = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(bhs[0]);  /* write */
 	/* Copy the File Entry information in to the newly allocated sector */
 	for (k = 0; k < OCFS_MAX_FILE_ENTRY_EXTENTS; k++) {
-		OcfsExtent->extents[k].file_off = fe->extents[k].file_off;
-		OcfsExtent->extents[k].num_bytes = fe->extents[k].num_bytes;
-		OcfsExtent->extents[k].disk_off = fe->extents[k].disk_off;
+		OcfsExtent->extents[k].e_cpos = fe->extents[k].e_cpos;
+		OcfsExtent->extents[k].e_clusters =
+			fe->extents[k].e_clusters;
+		OcfsExtent->extents[k].e_blkno = fe->extents[k].e_blkno;
 	}
 
 	OcfsExtent->last_ext_ptr = fe->last_ext_ptr;
@@ -940,9 +969,9 @@
 		strcpy (ExtentHeader->signature, OCFS_EXTENT_HEADER_SIGNATURE);
 
 		if (i == 0) {
-			ExtentHeader->extents[OCFS_MAX_FILE_ENTRY_EXTENTS].disk_off = physicalOffset + osb->sect_size;
-			ExtentHeader->extents[OCFS_MAX_FILE_ENTRY_EXTENTS].file_off = fe->i_clusters << osb->s_clustersize_bits;
-			ExtentHeader->extents[OCFS_MAX_FILE_ENTRY_EXTENTS].num_bytes = length;
+			ExtentHeader->extents[OCFS_MAX_FILE_ENTRY_EXTENTS].e_blkno = phys_blkno + 1;
+			ExtentHeader->extents[OCFS_MAX_FILE_ENTRY_EXTENTS].e_cpos = fe->i_clusters;
+			ExtentHeader->extents[OCFS_MAX_FILE_ENTRY_EXTENTS].e_clusters = new_clusters;
 
 			ExtentHeader->next_free_ext = OCFS_MAX_FILE_ENTRY_EXTENTS + 1;
 			ExtentHeader->this_ext = physicalOffset;
@@ -952,9 +981,11 @@
 			upHeaderPtr = ExtentHeader->this_ext;
 			lastExtentPtr = ExtentHeader->this_ext;
 		} else {
-			ExtentHeader->extents[0].disk_off = physicalOffset + (osb->sect_size * (i + 1));
-			ExtentHeader->extents[0].file_off = fe->i_clusters << osb->s_clustersize_bits;
-			ExtentHeader->extents[0].num_bytes = length;
+			ExtentHeader->extents[0].e_blkno = phys_blkno +
+				(i + 1);
+			ExtentHeader->extents[0].e_cpos =
+				fe->i_clusters;
+			ExtentHeader->extents[0].e_clusters = new_clusters;
 			ExtentHeader->next_free_ext = 1;
 			ExtentHeader->alloc_file_off = fileOffset + (osb->sect_size * i);
 			ExtentHeader->alloc_node = osb->node_num;
@@ -980,9 +1011,9 @@
 
 	strcpy (OcfsExtent->signature, OCFS_EXTENT_DATA_SIGNATURE);
 
-	OcfsExtent->extents[i].file_off = fe->i_clusters << osb->s_clustersize_bits;
-	OcfsExtent->extents[i].num_bytes = length;
-	OcfsExtent->extents[i].disk_off = disk_off;
+	OcfsExtent->extents[i].e_cpos = fe->i_clusters;
+	OcfsExtent->extents[i].e_clusters = new_clusters;
+	OcfsExtent->extents[i].e_blkno = blkno;
 	OcfsExtent->curr_sect = 1;
 	OcfsExtent->max_sects = NUM_SECTORS_IN_LEAF_NODE;
 	OcfsExtent->type = OCFS_EXTENT_DATA;
@@ -1053,7 +1084,7 @@
 
 		status = 0;
 		for (i = 0; i < OCFS_MAX_FILE_ENTRY_EXTENTS; ++i) {
-			offset = fe->extents[i].disk_off;
+			offset = fe->extents[i].e_blkno << osb->sb->s_blocksize_bits;
 			status = ocfs_read_bh(osb, offset, &bh, OCFS_BH_COND_CACHED, inode);
 			if (status < 0) {
 				LOG_ERROR_STATUS(status);
@@ -1082,24 +1113,24 @@
 
 	/* Clear all the extent information from File Entry */
 	for (i = 0; i < OCFS_MAX_FILE_ENTRY_EXTENTS; i++) {
-		fe->extents[i].file_off = 0;
-		fe->extents[i].num_bytes = 0;
-		fe->extents[i].disk_off = 0;
+		fe->extents[i].e_cpos = 0;
+		fe->extents[i].e_clusters = 0;
+		fe->extents[i].e_blkno = 0;
 	}
 
 	/* Update the File Entry Extent */
 
 	LOG_TRACE_ARGS("fe->i_clusters = %u\n", fe->i_clusters);
-	fe->extents[0].file_off = 0;
-	fe->extents[0].num_bytes = (fe->i_clusters << osb->s_clustersize_bits) + length;
-	fe->extents[0].disk_off = physicalOffset;
+	fe->extents[0].e_cpos = 0;  /* FIXME: not needed */
+	fe->extents[0].e_clusters = fe->i_clusters + new_clusters;
+	fe->extents[0].e_blkno = phys_blkno;
 	fe->last_ext_ptr = lastExtentPtr;
 	fe->i_next_free_ext = 1;
 
 finally:
 
 	if (fe) {
-		real_fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(fe_bh);  /* write */
+		real_fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(fe_bh);  /* write */
 		memcpy(real_fe, fe, osb->sect_size);
 		OCFS_BH_PUT_DATA(fe_bh);
 		real_fe = NULL;
@@ -1114,7 +1145,10 @@
  *
  * You need to be holding node_alloc_sem!
  */
-int ocfs_allocate_extent (ocfs_super * osb, struct buffer_head *fe_bh, ocfs_journal_handle *handle, __u64 actualDiskOffset, __u64 actualLength, struct inode *inode)
+int ocfs_allocate_extent(ocfs_super *osb, struct buffer_head *fe_bh,
+			 ocfs_journal_handle *handle,
+			 u64 blkno, u32 new_clusters,
+			 struct inode *inode)
 {
 	int status = 0;
 	int IncreaseTreeDepth = 0;
@@ -1123,43 +1157,45 @@
 	struct buffer_head *extent_bh = NULL, *extent_header_bh = NULL;
 	int UpdateParent = 0;
 	__u64 newExtentOff, up_ptr;
-	ocfs_file_entry * FileEntry = NULL;
+	ocfs2_dinode * fe = NULL;
 
-	LOG_ENTRY_ARGS("(actualDiskOffset=%llu, actualLength=%llu)\n", actualDiskOffset, actualLength);
+	LOG_ENTRY_ARGS("(blkno=%llu, new_clusters=%u)\n", blkno, new_clusters);
 
-	FileEntry = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(fe_bh);  /* write */
-	OCFS_ASSERT (FileEntry);
+	fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(fe_bh);  /* write */
+	OCFS_ASSERT (fe);
 
-	if (!IS_VALID_FILE_ENTRY (FileEntry)) {
+	if (!IS_VALID_FILE_ENTRY (fe)) {
 		LOG_ERROR_STATUS(status = -EINVAL);
 		goto finally;
 	}
 
-	if (FileEntry->i_tree_depth < 0) {
+	if (fe->i_tree_depth < 0) {
 		LOG_TRACE_STR("Using local extents");
 		/* We are still using the local extents of File Entry */
-		if (FileEntry->i_next_free_ext > OCFS_MAX_FILE_ENTRY_EXTENTS) {
+		if (fe->i_next_free_ext > OCFS_MAX_FILE_ENTRY_EXTENTS) {
 			LOG_ERROR_STATUS(status = -EINVAL);
 			goto finally;
 		}
 
-		k = FileEntry->i_next_free_ext - 1;
-		if (k >= 0 && OCFS_EXTENT_MERGEABLE (&FileEntry->extents[k], actualDiskOffset)) {
+		k = fe->i_next_free_ext - 1;
+		if (k >= 0 &&
+		    ocfs_extent_contig(inode, &fe->extents[k], blkno)) {
 			/* See if we can merge the extents and just increase the length */
 			LOG_TRACE_ARGS ("Using local extent for extent Entry = %u\n", k);
-			FileEntry->extents[k].num_bytes += actualLength;
+			fe->extents[k].e_clusters += new_clusters;
 			goto finally;
 		}
 
 		/* We cannot merge try to give him the next extent */
-		k = FileEntry->i_next_free_ext;
+		k = fe->i_next_free_ext;
 		if (k != OCFS_MAX_FILE_ENTRY_EXTENTS) {
 			/* file_off for the new extent will be equal
 			 * to the previous allocation size of file */
-			FileEntry->extents[k].file_off = FileEntry->i_clusters << osb->s_clustersize_bits;
-			FileEntry->extents[k].num_bytes = actualLength;
-			FileEntry->extents[k].disk_off = actualDiskOffset;
-			FileEntry->i_next_free_ext++;
+			fe->extents[k].e_cpos =
+				fe->i_clusters;
+			fe->extents[k].e_clusters = new_clusters;
+			fe->extents[k].e_blkno = blkno;
+			fe->i_next_free_ext++;
 			goto finally;
 		}
 		/* We have no more room in the fe, must increase
@@ -1170,13 +1206,13 @@
 	LOG_TRACE_STR("Using NON-local extents");
 
 	/*** Nonlocal Extents ***/
-	if (FileEntry->i_tree_depth > 3)
-		LOG_ERROR_ARGS ("tree_depth=%d", FileEntry->i_tree_depth);
+	if (fe->i_tree_depth > 3)
+		LOG_ERROR_ARGS ("tree_depth=%d", fe->i_tree_depth);
 	
 	/* This File is no longer using Local Extents */
 	IncreaseTreeDepth = 0;
 	
-	status = ocfs_read_bh(osb, FileEntry->last_ext_ptr, &extent_bh, OCFS_BH_COND_CACHED, inode);
+	status = ocfs_read_bh(osb, fe->last_ext_ptr, &extent_bh, OCFS_BH_COND_CACHED, inode);
 	if (status < 0) {
 		LOG_ERROR_STATUS (status = -EINVAL);
 		goto finally;
@@ -1194,13 +1230,14 @@
 	
 	/* See if we can merge the extents and just increase
 	 * the length */
-	if (k >= 0 && OCFS_EXTENT_MERGEABLE (&(extent->extents[k]), actualDiskOffset)) {
+	if (k >= 0 &&
+	    ocfs_extent_contig(inode, &(extent->extents[k]), blkno)) {
 		OCFS_BH_PUT_DATA(extent_bh);
 		ocfs_journal_access(handle, extent_bh, 
 				    OCFS_JOURNAL_ACCESS_WRITE);
 		extent = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(extent_bh); /* write */ /* journal_access */
 
-		extent->extents[k].num_bytes += actualLength;
+		extent->extents[k].e_clusters += new_clusters;
 		status = 0;
 		UpdateParent = 1;
 		goto do_update_parent;
@@ -1216,9 +1253,9 @@
 				    OCFS_JOURNAL_ACCESS_WRITE);
 		extent = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(extent_bh); /* write */ /* journal access */
 
-		extent->extents[k].file_off = FileEntry->i_clusters << osb->s_clustersize_bits;
-		extent->extents[k].num_bytes = actualLength;
-		extent->extents[k].disk_off = actualDiskOffset;
+		extent->extents[k].e_cpos = fe->i_clusters;
+		extent->extents[k].e_clusters = new_clusters;
+		extent->extents[k].e_blkno = blkno;
 		extent->next_free_ext++;
 		UpdateParent = 1;
 	} else {
@@ -1228,10 +1265,10 @@
 		 * upward till we find a free extent or we are
 		 * at the top and need to create another
 		 * level. */
-		if (FileEntry->i_tree_depth > 0)
+		if (fe->i_tree_depth > 0)
 			up_hdr_node_ptr = extent->up_hdr_node_ptr;
 
-		for (i = 0; i < FileEntry->i_tree_depth; i++) {
+		for (i = 0; i < fe->i_tree_depth; i++) {
 			/* if we loop back around */
 			if (extent_header) {
 				OCFS_BH_PUT_DATA(extent_header_bh);
@@ -1260,7 +1297,7 @@
 				break;
 			
 			up_hdr_node_ptr = extent_header->up_hdr_node_ptr;
-		} /* for (i = 0; i < FileEntry->i_tree_depth; i++) */
+		} /* for (i = 0; i < fe->i_tree_depth; i++) */
 		
 		if (extent_header) {
 			OCFS_BH_PUT_DATA(extent_header_bh);
@@ -1271,19 +1308,19 @@
 		/* if we got to the top, then we're at the FE. Check
 		 * if the FE is full -- if so, then we need to
 		 * increase the tree_depth. */
-		if (i == FileEntry->i_tree_depth &&
-		    FileEntry->i_next_free_ext == OCFS_MAX_FILE_ENTRY_EXTENTS) {
+		if (i == fe->i_tree_depth &&
+		    fe->i_next_free_ext == OCFS_MAX_FILE_ENTRY_EXTENTS) {
 			IncreaseTreeDepth = 1;
 			goto increase_depth;
 		}
 		/* ok, we need to add a branch. pass in NULL
 		 * if we need a whole branch, otherwise the
 		 * extent which needs the new leaf */
-		status = ocfs_allocate_new_data_node (osb, FileEntry, 
-						      actualDiskOffset,
-						      actualLength, 
-						      extent_header_bh,
-						      &newExtentOff, handle, inode);
+		status = ocfs_allocate_new_data_node(osb, fe, 
+						     new_clusters, 
+						     extent_header_bh,
+						     &newExtentOff,
+						     handle, inode);
 		if (status < 0) {
 			LOG_ERROR_STATUS(status);
 			goto finally;
@@ -1295,7 +1332,7 @@
 		extent = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(extent_bh); /* write */ /* journal access */
 
 		extent->next_data_ext = newExtentOff;
-		FileEntry->last_ext_ptr = newExtentOff;
+		fe->last_ext_ptr = newExtentOff;
 	}
 	
 do_update_parent:
@@ -1313,7 +1350,7 @@
 	}
 	
 	if (!IncreaseTreeDepth && UpdateParent) {
-		for (i = 0; i < FileEntry->i_tree_depth; i++) {
+		for (i = 0; i < fe->i_tree_depth; i++) {
 			
 			/* next two if's are for loop around */
 			if (extent_header_bh) {
@@ -1352,7 +1389,8 @@
 			
 			k = extent_header->next_free_ext - 1;
 			
-			extent_header->extents[k].num_bytes += actualLength;
+			extent_header->extents[k].e_clusters +=
+				new_clusters;
 			
 			/* gonna need it if we loop around */
 			up_ptr = extent_header->up_hdr_node_ptr;
@@ -1366,9 +1404,9 @@
 			}
 		}
 		
-		k = FileEntry->i_next_free_ext - 1;
+		k = fe->i_next_free_ext - 1;
 		
-		FileEntry->extents[k].num_bytes += actualLength;
+		fe->extents[k].e_clusters += new_clusters;
 	}
 	
 	if (status < 0) {
@@ -1379,7 +1417,7 @@
 increase_depth:
 	if (IncreaseTreeDepth) {
 		OCFS_BH_PUT_DATA(fe_bh);
-		FileEntry = NULL;
+		fe = NULL;
 		if (extent_bh && extent) {
 			OCFS_BH_PUT_DATA(extent_bh);
 			extent = NULL;
@@ -1389,7 +1427,9 @@
 			extent_header = NULL;
 		}	
 
-		status = ocfs_grow_extent_tree(osb, fe_bh, handle, actualDiskOffset, actualLength, inode);
+		status = ocfs_grow_extent_tree(osb, fe_bh, handle,
+					       blkno, new_clusters,
+					       inode);
 		if (status < 0) {
 			LOG_ERROR_STATUS(status);
 			goto finally;
@@ -1406,15 +1446,16 @@
 		 * ocfs_add_extent_map_entry merges them into a single
 		 * mapping run.So just adding this entry will be
 		 * fine. */
-		if (FileEntry == NULL)
-			FileEntry = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(fe_bh); /* read */
+		if (fe == NULL)
+			fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(fe_bh); /* read */
 
-		Vbo = FileEntry->i_clusters << osb->s_clustersize_bits;
-		Lbo = actualDiskOffset;
+		Vbo = (u64)fe->i_clusters << osb->s_clustersize_bits;
+		Lbo = blkno << osb->sb->s_blocksize_bits;
 
 		/* Add the Entry to the extent map list */
-		if (!ocfs_add_extent_map_entry (osb, &OCFS_I(inode)->map, Vbo, 
-						Lbo, actualLength))
+		if (!ocfs_add_extent_map_entry(osb, &OCFS_I(inode)->map,
+					       Vbo, Lbo,
+					       (u64)new_clusters << osb->s_clustersize_bits))
 			LOG_ERROR_STATUS (status = -EFAIL);
 	}
 
@@ -1432,7 +1473,7 @@
 			OCFS_BH_PUT_DATA(extent_header_bh);
 		brelse(extent_header_bh);
 	}
-	if (FileEntry) {
+	if (fe) {
 		OCFS_BH_PUT_DATA(fe_bh);
 	}
 
@@ -1451,11 +1492,17 @@
  * 'flag' seems to be an indicator that (if true) tells us that we already know
  *	we're gonna have to clear out all of extarr.
  */
-static int _squish_extent_entries(ocfs_super *osb, ocfs_alloc_ext *extarr, __u16 *freeExtent, ocfs_journal_handle *handle, __u64 FileSize, int flag, struct inode *inode) 
+static int _squish_extent_entries(ocfs_super *osb,
+				  ocfs_extent_rec *extarr,
+				  __u16 *freeExtent,
+				  ocfs_journal_handle *handle,
+				  u32 num_clusters, int flag,
+				  struct inode *inode) 
 {
 	int status = 0;
 	int FirstTime = 1;
-	ocfs_alloc_ext *ext; 
+	__u64 FileSize = (u64)num_clusters << osb->s_clustersize_bits; /* FIXME get rid of this and use num_clusters!! */
+	ocfs_extent_rec *ext; 
 	__u32 i, csize = osb->s_clustersize_bits,
 	    numBitsAllocated = 0, bitmapOffset = 0, 
 	    firstfree = *freeExtent;
@@ -1469,12 +1516,12 @@
 
 	firstfree = *freeExtent;
 
-	/* loop through the used alloc_extents */
+	/* loop through the used ocfs_extent_recs */
 	for (i = 0; i < firstfree; i++) { 
 		ext = &(extarr[i]); 
-		bytes = ext->num_bytes; 
-		foff = ext->file_off; 
-		doff = ext->disk_off; 
+		bytes = (u64)ext->e_clusters << osb->s_clustersize_bits;
+		foff = (u64)ext->e_cpos << osb->s_clustersize_bits; 
+		doff = ext->e_blkno << osb->sb->s_blocksize_bits; 
 		actualSize = (bytes + foff);
 		if (flag || actualSize > FileSize) { 
 			if (flag || foff >= FileSize) { 
@@ -1482,16 +1529,19 @@
 					*freeExtent = i; 
 					FirstTime = 0; 
 				} 
-				numBitsAllocated = (__u32) (bytes>>csize); 
+				numBitsAllocated = ext->e_clusters; 
 				bitmapOffset = (__u32) ((doff - dstart) >> csize); 
-				ext->num_bytes = ext->disk_off = ext->file_off = 0; 
+				ext->e_clusters = ext->e_blkno =
+					ext->e_cpos = 0; 
 			} else { 
 				if (FirstTime) { 
 					*freeExtent = i + 1; 
 					FirstTime = 0; 
 				} 
 				origLength = bytes; 
-				ext->num_bytes = bytes = FileSize - foff; 
+				bytes = FileSize - foff; 
+				ext->e_clusters =
+					(u32)(bytes >> osb->s_clustersize_bits);
 				lengthTobeFreed = origLength - bytes; 
 				if (lengthTobeFreed == 0) { 
 					continue; 
@@ -1540,11 +1590,10 @@
 	int status = -EFAIL;
 	int i;
 	__u32 victim;
-	__u32 csize = osb->s_clustersize_bits;
 	__u64 dstart = osb->vol_layout.data_start_off;
 	__u64 tmp_off;
-	__u32 num_sectors = 0, bitmap_offset = 0;
-	ocfs_alloc_ext *ext;
+	__u32 num_clusters = 0, bitmap_offset = 0;
+	ocfs_extent_rec *ext;
 	struct buffer_head *tmp_bh = NULL;
 	char * stack[OCFS_TREE_STACK_SIZE];
 	ocfs_extent_group * cur_extent; /* convenience, points to TOS */
@@ -1574,9 +1623,10 @@
 			for(i = 0; i < cur_extent->next_free_ext; i++) {
 				/* Free the data associated with each header */
 				ext = &cur_extent->extents[i];
-				num_sectors = (__u32) (ext->num_bytes >> csize);
-				bitmap_offset = (__u32) ((ext->disk_off - dstart) >> csize);
-				status = ocfs_handle_add_commit_bits(handle, num_sectors, bitmap_offset, -1, DISK_ALLOC_VOLUME);
+				num_clusters = ext->e_clusters;
+				bitmap_offset =
+					(u32)(((ext->e_blkno << osb->sb->s_blocksize_bits) - dstart) >> osb->s_clustersize_bits);
+				status = ocfs_handle_add_commit_bits(handle, num_clusters, bitmap_offset, -1, DISK_ALLOC_VOLUME);
 				if (status < 0) {
 					LOG_ERROR_STATUS (status);
 					goto bail;
@@ -1602,7 +1652,8 @@
 			/* grow the stack, gotta save off a couple
 			 * things 1st. */
 			victim = cur_extent->next_free_ext - 1;
-			tmp_off = cur_extent->extents[victim].disk_off;
+			tmp_off = cur_extent->extents[victim].e_blkno;
+			tmp_off <<= osb->sb->s_blocksize_bits;
 			cur_extent->next_free_ext--;
 
 			cur_extent = NULL;
@@ -1657,7 +1708,7 @@
 
 static int ocfs_fix_extent_group(ocfs_super *osb, struct buffer_head *group_bh, struct inode *inode) 
 {
-	ocfs_alloc_ext *ext;
+	ocfs_extent_rec *ext;
 	ocfs_extent_group *group = NULL;
 	int status=-EFAIL;
 	int i;
@@ -1680,9 +1731,9 @@
 	ext = group->extents;
 	
 	for(i=group->next_free_ext; i < OCFS_MAX_DATA_EXTENTS; i++) {
-		ext[i].num_bytes = 0;
-		ext[i].disk_off = 0;
-		ext[i].file_off = 0;
+		ext[i].e_clusters = 0;
+		ext[i].e_blkno = 0;
+		ext[i].e_cpos = 0;
 	}
 
 	OCFS_BH_PUT_DATA(group_bh);
@@ -1708,20 +1759,23 @@
  * write it so that it can.
  * TODO: This function should be split up into a couple smaller ones.
  */
-static int ocfs_split_this_tree(ocfs_super * osb, struct buffer_head *extent_grp_bh, ocfs_journal_handle *handle, ocfs_file_entry *fe, struct inode *inode) 
+static int ocfs_split_this_tree(ocfs_super *osb,
+				struct buffer_head *extent_grp_bh,
+				ocfs_journal_handle *handle,
+				ocfs2_dinode *fe,
+				struct inode *inode) 
 {
 	int status = -EFAIL;
-	__u64 newsize = fe->i_clusters << osb->s_clustersize_bits;
-	ocfs_alloc_ext *ext;
+	ocfs_extent_rec *ext;
 	struct buffer_head * bh_stack[OCFS_TREE_STACK_SIZE];
 	ocfs_extent_group * AllocExtent = NULL;/* convenience, points to TOS */
 	ocfs_extent_group *extent_grp;
 	struct buffer_head *tmp_bh = NULL, *tmp_bh2 = NULL;
 	int tos = 0;
 	int i, victim;
-	__u64 bytes, foff, doff, orig_bytes, dstart = osb->vol_layout.data_start_off, total_bytes, tmp_off;
-       	__u32 csize = osb->s_clustersize_bits;
-	__u32 num_sectors, bitmap_offset;
+	__u64 bytes, doff, orig_bytes, dstart = osb->vol_layout.data_start_off, tmp_off;
+	__u64 total_bytes;  /* FIXME needs to be clusters!!! */
+	__u32 num_clusters, bitmap_offset;
 	int done = 0;
 	int gran = fe->i_tree_depth;
 	int needs_brelse = 0;
@@ -1747,7 +1801,9 @@
 			if (tmp_bh2)
 				brelse(tmp_bh2);
 			tmp_bh2 = NULL;
-			status = ocfs_read_bh(osb, ext->disk_off, &tmp_bh2, 
+			status = ocfs_read_bh(osb,
+					      ext->e_blkno << osb->sb->s_blocksize_bits,
+					      &tmp_bh2, 
 					      OCFS_BH_COND_CACHED, inode);
 			if (status < 0) {
 				OCFS_BH_PUT_DATA(extent_grp_bh);
@@ -1757,7 +1813,7 @@
 				goto bail;
 			}
 			
-			if (ext->file_off >= newsize) {
+			if (ext->e_cpos >= fe->i_clusters) {
 				/* Trim this whole subtree */
 				status = ocfs_kill_this_tree(osb, tmp_bh2, 
 							     handle, inode);
@@ -1768,12 +1824,13 @@
 					LOG_ERROR_STATUS (status);
 					goto bail;
 				}
-				ext->file_off = 0;
-				ext->disk_off = 0;
-				ext->num_bytes = 0;
+				ext->e_cpos = 0;
+				ext->e_blkno = 0;
+				ext->e_clusters = 0;
 				extent_grp->next_free_ext = i;
 			} else  { /* This is the one we want to split. */
-				ext->num_bytes = newsize - ext->file_off;
+				ext->e_clusters =
+					fe->i_clusters - ext->e_cpos;
 				break;
 			}
 		}
@@ -1821,8 +1878,11 @@
 				brelse(tmp_bh);
 			tmp_bh = NULL;
 
-			status = ocfs_read_bh(osb, ext->disk_off, &tmp_bh, 
-					      OCFS_BH_COND_CACHED, inode);
+			status = ocfs_read_bh(osb,
+					      ext->e_blkno << osb->sb->s_blocksize_bits,
+					      &tmp_bh, 
+					      OCFS_BH_COND_CACHED,
+					      inode);
 			if (status < 0) {
 				OCFS_BH_PUT_DATA(extent_grp_bh);
 				extent_grp = NULL;
@@ -1831,10 +1891,12 @@
 				goto bail;
 			}
 			
-			if (ext->file_off >= newsize) {
+			if (ext->e_cpos >= fe->i_clusters) {
 				/* Trim this whole subtree */
-				status = ocfs_kill_this_tree(osb, tmp_bh, 
-							     handle, inode);
+				status = ocfs_kill_this_tree(osb,
+							     tmp_bh, 
+							     handle,
+							     inode);
 				if (status < 0) {
 					OCFS_BH_PUT_DATA(extent_grp_bh);
 					extent_grp = NULL;
@@ -1842,12 +1904,13 @@
 					LOG_ERROR_STATUS (status);
 					goto bail;
 				}
-				ext->file_off = 0;
-				ext->disk_off = 0;
-				ext->num_bytes = 0;
+				ext->e_cpos = 0;
+				ext->e_blkno = 0;
+				ext->e_clusters = 0;
 				extent_grp->next_free_ext = i;
 			} else  { /* This is the one we want to split. */
-				ext->num_bytes = newsize - ext->file_off;
+				ext->e_clusters = 
+					fe->i_clusters - ext->e_cpos;
 				break;
 			}
 		}
@@ -1904,7 +1967,8 @@
 		
 		if (IS_VALID_EXTENT_DATA(AllocExtent)) {
 			/* shall we just do away with him? */
-			if (AllocExtent->extents[0].file_off >= newsize) {
+			if (AllocExtent->extents[0].e_cpos >=
+			    fe->i_clusters) {
 				LOG_TRACE_ARGS("Killing this data extent (%llu)\n", AllocExtent->this_ext);
 				/* Boundary case - what if this guy is
 				 * the last DAT we should delete
@@ -1933,7 +1997,7 @@
 				 * header boundary. this will catch
 				 * it: */
 				ext = &AllocExtent->extents[AllocExtent->next_free_ext - 1];
-				if ((ext->file_off + ext->num_bytes)==newsize){
+				if ((ext->e_cpos + ext->e_clusters) == fe->i_clusters) {
 					LOG_TRACE_STR("Ok, hit that boundary in the DAT");
 					goto fix_headers;
 				}
@@ -1944,25 +2008,31 @@
 
 					/* changed this from > to >= */
 					/* Do we delete it completely? */
-					if (ext->file_off >= newsize) {
-						total_bytes+=ext->num_bytes;
+					if (ext->e_cpos >= fe->i_clusters) {
+						total_bytes += (u64)ext->e_clusters << osb->s_clustersize_bits;
 
-						num_sectors = (__u32) (ext->num_bytes >> csize);
-						bitmap_offset = (__u32) ((ext->disk_off - dstart) >> csize);
-						ext->file_off = 0;
-						ext->num_bytes = 0;
-						ext->disk_off = 0;
-					} else if ((ext->file_off + ext->num_bytes) > newsize) {
+						num_clusters = ext->e_clusters;
+						bitmap_offset = (u32)(((ext->e_blkno << osb->sb->s_blocksize_bits) - dstart) >> osb->s_clustersize_bits);
+						ext->e_cpos = 0;
+						ext->e_clusters = 0;
+						ext->e_blkno = 0;
+					} else if ((ext->e_cpos + ext->e_clusters) > fe->i_clusters) {
 						/* Do we shrink it? */
-						orig_bytes = ext->num_bytes;
-						doff = ext->disk_off; 
-						foff = ext->file_off;
-						bytes = ext->num_bytes = newsize - foff;
-						num_sectors = (__u32) ((orig_bytes - bytes) >> csize);
-						bitmap_offset = (__u32) (((doff + bytes) - dstart) >> csize);
+						/* FIXME
+						 * this is soooo a
+						 * hodge-podge of bytes
+						 * and clusters
+						 */
+						orig_bytes = (u64)ext->e_clusters << osb->s_clustersize_bits;
+						num_clusters = ext->e_clusters;
+						doff = ext->e_blkno << osb->sb->s_blocksize_bits; 
+						ext->e_clusters = fe->i_clusters - ext->e_cpos;
+						bytes = (u64)ext->e_clusters << osb->s_clustersize_bits;
+						num_clusters -= ext->e_clusters;
+						bitmap_offset = (u32)(((doff + bytes) - dstart) >> osb->s_clustersize_bits);
 						/* we want to exit the
 						 * for loop now */
-						total_bytes+= (orig_bytes - bytes);
+						total_bytes += (orig_bytes - bytes);
 						done = 1;
 					} else {
 						/* if we get here,
@@ -1970,11 +2040,11 @@
 						 * to actually delete
 						 * *anything* from
 						 * this extent. */
-						LOG_TRACE_ARGS("Not deleting extent %d, disk_off = %llu, num_bytes = %llu, file_off = %llu\n", i, ext->disk_off, ext->num_bytes, ext->file_off);
+						LOG_TRACE_ARGS("Not deleting extent %d, e_blkno = %llu, e_clusters = %u, e_cpos = %u\n", i, ext->e_blkno, ext->e_clusters, ext->e_cpos);
 						done = 1;
 						goto skip_bitmap_add;
 					}
-					status = ocfs_handle_add_commit_bits(handle, num_sectors, bitmap_offset, -1, DISK_ALLOC_VOLUME);
+					status = ocfs_handle_add_commit_bits(handle, num_clusters, bitmap_offset, -1, DISK_ALLOC_VOLUME);
 					if (status < 0) {
 						LOG_ERROR_STATUS (status);
 						goto bail;
@@ -2015,7 +2085,8 @@
 					/* need to also update
 					 * numbytes on these guys */
 					ext = &AllocExtent->extents[victim];
-					ext->num_bytes-= total_bytes;
+					ext->e_clusters -=
+						(u32)(total_bytes >> osb->s_clustersize_bits);
 					OCFS_BH_PUT_DATA(bh_stack[tos]);
 					AllocExtent = NULL;
 					status = ocfs_fix_extent_group(osb, 
@@ -2059,11 +2130,11 @@
 			}
 			/* changed this from > to >= */
 			/* Do we just delete this whole part of the tree? */
-			if (AllocExtent->extents[0].file_off >= newsize) {
+			if (AllocExtent->extents[0].e_cpos >= fe->i_clusters) {
 				LOG_TRACE_ARGS("whacking this tree: (%llu)\n",
 					       AllocExtent->this_ext);
 
-				if (AllocExtent->extents[0].file_off ==newsize)
+				if (AllocExtent->extents[0].e_cpos == fe->i_clusters)
 					done = 1;
 
 				OCFS_BH_PUT_DATA(bh_stack[tos]);
@@ -2092,9 +2163,9 @@
 				AllocExtent = (ocfs_extent_group *) OCFS_BH_GET_DATA_WRITE(bh_stack[tos]); /* write */ /* journal access */
 
 				victim = AllocExtent->next_free_ext;
-				AllocExtent->extents[victim].file_off = 0;
-				AllocExtent->extents[victim].num_bytes = 0;
-				AllocExtent->extents[victim].disk_off = 0;
+				AllocExtent->extents[victim].e_cpos = 0;
+				AllocExtent->extents[victim].e_clusters = 0;
+				AllocExtent->extents[victim].e_blkno = 0;
 				AllocExtent->next_free_ext--;
 				OCFS_BH_PUT_DATA(bh_stack[tos]);
 				AllocExtent = NULL;
@@ -2147,7 +2218,7 @@
 			AllocExtent->next_free_ext--;
 			victim = AllocExtent->next_free_ext;
 			ext = &AllocExtent->extents[victim];
-			tmp_off = ext->disk_off;
+			tmp_off = ext->e_blkno << osb->sb->s_blocksize_bits;
 			OCFS_BH_PUT_DATA(bh_stack[tos]);
 			AllocExtent = NULL;
 
@@ -2213,7 +2284,7 @@
  *  various ext headers and dats off the system previously in the
  *  truncate path.
  */
-static int ocfs_update_last_ext_ptr(ocfs_super *osb, ocfs_file_entry *fe, struct inode *inode) 
+static int ocfs_update_last_ext_ptr(ocfs_super *osb, ocfs2_dinode *fe, struct inode *inode) 
 {
 	int status = -EFAIL;
 	ocfs_extent_group *extent = NULL;
@@ -2236,7 +2307,9 @@
 
         /* Ugly magic -1 */
 	victim = fe->i_next_free_ext - 1;
-	status = ocfs_read_bh(osb, fe->extents[victim].disk_off, &extent_bh, 
+	status = ocfs_read_bh(osb,
+			      fe->extents[victim].e_blkno << osb->sb->s_blocksize_bits,
+			      &extent_bh, 
 			      OCFS_BH_CACHED, inode);
 	if (status < 0) {
 		LOG_ERROR_STATUS(status);
@@ -2257,7 +2330,7 @@
 			goto bail;
 		}
 
-		next_ext = extent->extents[extent->next_free_ext - 1].disk_off;
+		next_ext = extent->extents[extent->next_free_ext - 1].e_blkno << osb->sb->s_blocksize_bits;
 
 		OCFS_BH_PUT_DATA(extent_bh);
 		brelse(extent_bh);
@@ -2293,25 +2366,25 @@
  * before leaving this function, but that's pretty much up to the
  * caller!
  */
-int ocfs_free_extents_for_truncate (ocfs_super * osb, ocfs_file_entry * FileEntry, ocfs_journal_handle *handle, struct inode *inode)
+int ocfs_free_extents_for_truncate(ocfs_super *osb,
+				   ocfs2_dinode *fe,
+				   ocfs_journal_handle *handle,
+				   struct inode *inode)
 {
 	int status = 0;
 	struct buffer_head *extent_bh = NULL;
-	__u64 alloc_size;
 	int i, j;
 	int updated_lep; /* used to mark whether fe->last_ext_ptr has
 			   * been updated */
 
 	LOG_ENTRY ();
 
-	alloc_size = FileEntry->i_clusters << osb->s_clustersize_bits;
-
 	/* local extents */
-	if (FileEntry->i_tree_depth < 0) {
-		status = _squish_extent_entries(osb, FileEntry->extents, 
-						&FileEntry->i_next_free_ext, 
-						handle, alloc_size, 0, 
-						inode);
+	if (fe->i_tree_depth < 0) {
+		status = _squish_extent_entries(osb, fe->extents, 
+						&fe->i_next_free_ext, 
+						handle, fe->i_clusters,
+						0, inode);
 		if (status < 0) {
 			LOG_ERROR_STATUS (status);
 			goto finally;
@@ -2319,23 +2392,25 @@
 		goto finally;
 	}
 
-	LOG_TRACE_ARGS("non-local extents. taking that code path, truncating to alloc_size of (%llu)\n", alloc_size);
+	LOG_TRACE_ARGS("non-local extents. taking that code path, truncating to i_clusters of (%u)\n", fe->i_clusters);
 	/* non-local extents */
 
 	updated_lep = 0;
 
 	/* Loop backwards through only the used free extent headers here */
-	for (i = (FileEntry->i_next_free_ext - 1); i >= 0; i--) {
+	for (i = (fe->i_next_free_ext - 1); i >= 0; i--) {
 		LOG_TRACE_ARGS("at top of loop, i = %d\n", i);
 		/* Go ahead and read that bit of the tree - we'll need it. */
-		status = ocfs_read_bh(osb, FileEntry->extents[i].disk_off,
-				      &extent_bh, OCFS_BH_CACHED, inode);
+		status = ocfs_read_bh(osb,
+				      fe->extents[i].e_blkno << osb->sb->s_blocksize_bits,
+				      &extent_bh, OCFS_BH_CACHED,
+				      inode);
 		if (status < 0) {
 			LOG_ERROR_STATUS(status);
 			goto finally;
 		}
 		/* Figure out, do we want to kill this whole tree? */
-		if (FileEntry->extents[i].file_off >= alloc_size) {
+		if (fe->extents[i].e_cpos >= fe->i_clusters) {
 			LOG_TRACE_ARGS("Found an entire tree to delete!\n");
 			
 			status = ocfs_kill_this_tree(osb, extent_bh, handle, inode);
@@ -2343,15 +2418,15 @@
 				LOG_ERROR_STATUS(status);
 				goto finally;
 			}
-			/* Ok, update the FileEntry */
-			FileEntry->extents[i].file_off = 0;
-			FileEntry->extents[i].disk_off = 0;
-			FileEntry->extents[i].num_bytes = 0;
-			FileEntry->i_next_free_ext = i;
+			/* Ok, update the fe */
+			fe->extents[i].e_cpos = 0;
+			fe->extents[i].e_blkno = 0;
+			fe->extents[i].e_clusters = 0;
+			fe->i_next_free_ext = i;
 		} else { /* Ok, we only want part of it. */
 			LOG_TRACE_ARGS("Splitting this tree!\n");
 			status = ocfs_split_this_tree(osb, extent_bh, 
-						      handle, FileEntry, 
+						      handle, fe, 
 						      inode);
 			if (status < 0) {
 				LOG_ERROR_STATUS(status);
@@ -2359,12 +2434,16 @@
 			}
 
 			/* Ok, update the FileEntry */
-			LOG_TRACE_ARGS("Alright. num_bytes = (%llu), alloc_size = (%llu) file_off = (%llu)\n", FileEntry->extents[i].num_bytes, alloc_size, FileEntry->extents[i].file_off);
-			FileEntry->extents[i].num_bytes = alloc_size;
+			LOG_TRACE_ARGS("Alright. e_clusters = (%u), i_clusters = (%u) e_cpos = (%u)\n",
+				       fe->extents[i].e_clusters,
+				       fe->i_clusters,
+				       fe->extents[i].e_cpos);
+			fe->extents[i].e_clusters = fe->i_clusters;
 			for (j=0; j < i; j++) 
-				FileEntry->extents[i].num_bytes += FileEntry->extents[j].num_bytes;
+				fe->extents[i].e_clusters +=
+					fe->extents[j].e_clusters;
 
-			FileEntry->i_next_free_ext = i + 1;
+			fe->i_next_free_ext = i + 1;
 			/* We're done - we can't split more than one
 			 * parts of the tree. */
 			updated_lep = 1;
@@ -2375,14 +2454,14 @@
 	}
 
 	/* Ok, trunc to zero is a special case, doofus */
-	if (alloc_size == 0) {
-		FileEntry->last_ext_ptr = 0;
-		FileEntry->i_tree_depth = -1;
+	if (fe->i_clusters == 0) {
+		fe->last_ext_ptr = 0;
+		fe->i_tree_depth = -1;
 		updated_lep = 1;
 	}
 
 	if (!updated_lep) {
-		status = ocfs_update_last_ext_ptr(osb, FileEntry, inode);
+		status = ocfs_update_last_ext_ptr(osb, fe, inode);
 		if (status < 0) {
 			LOG_ERROR_STATUS(status);
 			goto finally;
@@ -2411,7 +2490,7 @@
 int ocfs_lookup_file_allocation (ocfs_super * osb, __s64 Vbo, __s64 * Lbo, __u32 sectors, u32 *sector_count, struct inode *inode)
 {
 	int status = -EFAIL;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	struct buffer_head *fe_bh = NULL;
 	ocfs_extent_group *OcfsExtent = NULL;
 	struct buffer_head *ext_bh = NULL;
@@ -2447,14 +2526,14 @@
 		goto finally;
 	}
 
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
 
 	if (!IS_VALID_FILE_ENTRY (fe)) {
 		LOG_ERROR_STATUS (status = -EINVAL);
 		goto finally;
 	}
 
-	if (!INODE_JOURNAL(inode) && Vbo >= (__s64)(fe->i_clusters << osb->s_clustersize_bits)) {
+	if (!INODE_JOURNAL(inode) && Vbo >= (__s64)((u64)fe->i_clusters << osb->s_clustersize_bits)) {
 		LOG_ERROR_ARGS ("vbo=%llu, fe->i_clusters=%u alloc_size=%llu", 
 				Vbo, fe->i_clusters,
 				OCFS_I(inode)->alloc_size);
@@ -2555,21 +2634,22 @@
 /* ocfs_get_leaf_extent()
  * '*data_exent_bh' should be NULL.
  */
-int ocfs_get_leaf_extent (ocfs_super * osb, ocfs_file_entry * FileEntry, __s64 Vbo, struct buffer_head **data_extent_bh, struct inode *inode)
+int ocfs_get_leaf_extent(ocfs_super *osb, ocfs2_dinode *fe,
+			 __s64 Vbo, struct buffer_head **data_extent_bh,
+			 struct inode *inode)
 {
 	int status = 0, tempstat;
 	__u32 i, j;
-	ocfs_extent_group *ExtentHeader = NULL;
+	ocfs_extent_group *eh = NULL;
 	struct buffer_head *ext_bh = NULL;
 	ocfs_extent_group *tmp = NULL;
 	__u64 childDiskOffset = 0;
 
 	LOG_ENTRY ();
 
-	for (i = 0; i < FileEntry->i_next_free_ext; i++) {
-		if ((__s64) (FileEntry->extents[i].file_off +
-			   FileEntry->extents[i].num_bytes) > Vbo) {
-			childDiskOffset = FileEntry->extents[i].disk_off;
+	for (i = 0; i < fe->i_next_free_ext; i++) {
+		if ((__s64)((u64)(fe->extents[i].e_cpos + fe->extents[i].e_clusters) << osb->s_clustersize_bits) > Vbo) {
+			childDiskOffset = fe->extents[i].e_blkno << osb->sb->s_blocksize_bits;
 			break;
 		}
 	}
@@ -2579,25 +2659,24 @@
 		goto finally;
 	}
 
-	for (i = 0; i < FileEntry->i_tree_depth; i++) {
+	for (i = 0; i < fe->i_tree_depth; i++) {
 		tempstat = ocfs_read_bh(osb, childDiskOffset, &ext_bh, OCFS_BH_COND_CACHED, inode);
 		if (tempstat < 0) {
 			LOG_ERROR_STATUS (status = tempstat);
 			goto finally;
 		}
 
-		ExtentHeader = (ocfs_extent_group *) OCFS_BH_GET_DATA_READ(ext_bh); /* read */
-		if (!IS_VALID_EXTENT_HEADER(ExtentHeader)) {
+		eh = (ocfs_extent_group *) OCFS_BH_GET_DATA_READ(ext_bh); /* read */
+		if (!IS_VALID_EXTENT_HEADER(eh)) {
 			LOG_ERROR_STATUS (status = -EINVAL);
 			goto finally;
 		}
 
-		for (j = 0; j < ExtentHeader->next_free_ext; j++) {
-			if ((__s64) (ExtentHeader->extents[j].file_off +
-				   ExtentHeader->extents[j].num_bytes) > Vbo)
+		for (j = 0; j < eh->next_free_ext; j++) {
+			if ((__s64)((u64)(eh->extents[j].e_cpos + eh->extents[j].e_clusters) << osb->s_clustersize_bits) > Vbo)
 			{
 				childDiskOffset =
-				    ExtentHeader->extents[j].disk_off;
+				    eh->extents[j].e_blkno << osb->sb->s_blocksize_bits;
 				break;
 			}
 		}
@@ -2605,7 +2684,7 @@
 		OCFS_BH_PUT_DATA(ext_bh);
 		brelse(ext_bh);
 		ext_bh = NULL;
-		ExtentHeader = NULL;
+		eh = NULL;
 	}
 
 	if (*data_extent_bh) {
@@ -2632,7 +2711,7 @@
 	OCFS_BH_PUT_DATA(*data_extent_bh);
 finally:
 	if (ext_bh) {
-		if (ExtentHeader)
+		if (eh)
 			OCFS_BH_PUT_DATA(ext_bh);
 		brelse(ext_bh);
 	}
@@ -2666,7 +2745,7 @@
 	static __u32 LargeAllocOffset = 0;
 	static __u32 SmallAllocOffset = 0;
 	struct buffer_head *bh = NULL;
-	ocfs_file_entry *bm_lock = NULL;
+	ocfs2_dinode *bm_lock = NULL;
 	__u32 bitmapblocks; /* we only care about the valid blocks */
 	int local_lock = 0;
 	int local_inode = 0;
@@ -2712,7 +2791,7 @@
 		goto leave;
 	}
 
-	bm_lock = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(bh); /* write */
+	bm_lock = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(bh); /* write */
 
 	ClusterCount = (__u32) ((__u64) (file_size + (osb->vol_layout.cluster_size-1)) >> 
 				osb->s_clustersize_bits);
@@ -2721,7 +2800,7 @@
 		status = 0;
 		goto leave;
 	}
-	ByteCount = ClusterCount << osb->s_clustersize_bits;
+	ByteCount = (u64)ClusterCount << osb->s_clustersize_bits;
 	if (ByteCount == 0) {
 		LOG_ERROR_STR ("DISK_FULL?: Bytecount==0");
 		status = 0;
@@ -2864,7 +2943,7 @@
 	__u32 bm_file = 0;
 	__u32 alloc_file = 0;
 	struct buffer_head *bh = NULL;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	int needs_uninit = 0;
 	int delay_lockrel = 0;
 	struct inode *inode = NULL; /* alloc bitmap file inode */
@@ -2922,13 +3001,13 @@
 	}
 
 	numBits = ((FileSize + (blockSize-1)) >> blockSizeBits);
-	numBytes = numBits << blockSizeBits;
+	numBytes = (u64)numBits << blockSizeBits;
 
 	/* Read in the bitmap file for the dir alloc and look for the
 	 * required space, if found */
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(bh); /* read */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(bh); /* read */
 	fileSize = fe->i_size;
-	allocSize = fe->i_clusters << osb->s_clustersize_bits;
+	allocSize = (u64)fe->i_clusters << osb->s_clustersize_bits;
 	OCFS_BH_PUT_DATA(bh);
 	
 	prevFileSize = fileSize;
@@ -2995,11 +3074,12 @@
 			LOG_ERROR_STATUS (status);
 			goto leave;
 		}
-		fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(bh); /* read */
+		fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(bh); /* read */
 		/* we wrote it back out in ocfs_extend_system_file so
 		 * we can trust the sizes here */
 		fileSize = fe->i_size;
-		allocSize = fe->i_clusters << osb->s_clustersize_bits;
+		allocSize =
+			(u64)fe->i_clusters << osb->s_clustersize_bits;
 		OCFS_BH_PUT_DATA(bh);
 
 		if (needs_uninit)
@@ -3067,21 +3147,22 @@
  * ocfs_free_file_extents()
  *
  */
-int ocfs_free_file_extents (ocfs_super * osb, struct buffer_head *fe_bh,
-			    ocfs_journal_handle *handle, struct inode *inode)
+int ocfs_free_file_extents(ocfs_super *osb, struct buffer_head *fe_bh,
+			   ocfs_journal_handle *handle,
+			   struct inode *inode)
 {
 	int status = 0;
 	__u32 i;
 	__u32 numBitsAllocated = 0, bitmapOffset = 0;
 	ocfs_extent_group *extent = NULL;
 	struct buffer_head *extent_bh = NULL;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	__u64 offset;
 
 	LOG_ENTRY ();
 
 	offset = GET_INODE_FEOFF(inode);
-	fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(fe_bh); /* read */
+	fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(fe_bh); /* read */
 	if (offset != (fe->i_blkno << osb->sb->s_blocksize_bits))
 		BUG();
 	OCFS_BH_PUT_DATA(fe_bh);
@@ -3089,15 +3170,14 @@
 	if (inode)
 		SET_BH_SEQNUM(inode, fe_bh);
 
-	fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(fe_bh); /* read */
+	fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(fe_bh); /* read */
 
 	if (fe->i_tree_depth < 0) {
 		for (i = 0; i < fe->i_next_free_ext; i++) {
-			numBitsAllocated = (__u32) (fe->extents[i].num_bytes >>
-						  osb->s_clustersize_bits);
+			numBitsAllocated = fe->extents[i].e_clusters;
 
 			bitmapOffset =
-			    (__u32) ((fe->extents[i].disk_off -
+			    (__u32)(((fe->extents[i].e_blkno << osb->sb->s_blocksize_bits) -
 				    osb->vol_layout.data_start_off) >>
 				   osb->s_clustersize_bits);
 
@@ -3107,7 +3187,8 @@
 		}
 	} else {
 		for (i = 0; i < fe->i_next_free_ext; i++) {
-			status = ocfs_read_bh(osb, fe->extents[i].disk_off, 
+			status = ocfs_read_bh(osb,
+					      fe->extents[i].e_blkno << osb->sb->s_blocksize_bits, 
 					      &extent_bh, OCFS_BH_COND_CACHED, inode);
 			if (status < 0) {
 				LOG_ERROR_STATUS (status);
@@ -3330,7 +3411,7 @@
 	OCFS_BH_PUT_DATA(osb->local_alloc_bh);
 
 	/* we try to use find_contig_space_from_bitmap here for now. */
-	alloc_bytes = ocfs_local_alloc_window_bits(osb) << osb->s_clustersize_bits;
+	alloc_bytes = (u64)ocfs_local_alloc_window_bits(osb) << osb->s_clustersize_bits;
 	LOG_TRACE_ARGS("Allocating %llu bytes (%u clusters) for a "
 		       "new window.\n", alloc_bytes, 
 		       ocfs_local_alloc_window_bits(osb));

Modified: branches/format-changes/src/buffer_head_io.c
===================================================================
--- branches/format-changes/src/buffer_head_io.c	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/buffer_head_io.c	2004-06-04 22:59:03 UTC (rev 1008)
@@ -194,9 +194,9 @@
  * ocfs_read_bhs()
  *
  */
-int ocfs_read_bhs (ocfs_super * osb, __u64 off, __u64 len, 
-				 struct buffer_head *bhs[], int flags, 
-				 struct inode *inode)
+int ocfs_read_bhs(ocfs_super *osb, __u64 off, __u64 len, 
+		  struct buffer_head *bhs[], int flags, 
+	 	  struct inode *inode)
 {
 	int status = 0;
 	struct super_block *sb;

Modified: branches/format-changes/src/dir.c
===================================================================
--- branches/format-changes/src/dir.c	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/dir.c	2004-06-04 22:59:03 UTC (rev 1008)
@@ -274,10 +274,11 @@
 	offset = le16_to_cpu(de->rec_len) + le16_to_cpu(de1->rec_len);
 	de = (struct ocfs2_dir_entry *) ((char *) de1 + le16_to_cpu(de1->rec_len));
 	while (offset < inode->i_size ) {
-		if (!bh || (void *) de >= (void *) (bh->b_data+sb->s_blocksize)) {
+		if (!bh || (void *) de >= (void *) (bh->b_data + sb->s_blocksize)) {
 			OCFS_BH_PUT_DATA(bh);
 			brelse (bh);
-			bh = ocfs_bread (NULL, inode, offset >> sb->s_blocksize_bits, 0, &err, 0);
+			bh = ocfs_bread(NULL, inode,
+				      	offset >> sb->s_blocksize_bits, 0, &err, 0);
 			if (!bh) {
 				LOG_ERROR_ARGS ("directory #%llu contains a hole at offset %lu\n",
 					GET_INODE_FEOFF(inode), offset);

Modified: branches/format-changes/src/dlm.c
===================================================================
--- branches/format-changes/src/dlm.c	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/dlm.c	2004-06-04 22:59:03 UTC (rev 1008)
@@ -222,7 +222,7 @@
 	int status = -ETIMEDOUT;
 	int tmpstat = -ETIMEDOUT;
 	__u32 timewaited = 0;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	struct buffer_head *bh = NULL;
 	__u32 curr_master;
 	__u8 lock_level;
@@ -241,7 +241,7 @@
 			LOG_ERROR_STATUS (status = tmpstat);
 			goto finally;
 		}
-		fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(bh); /* read */
+		fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(bh); /* read */
 		curr_master = DISK_LOCK(fe)->curr_master;
 		lock_level = DISK_LOCK(fe)->file_lock;
 		OCFS_BH_PUT_DATA(bh);
@@ -256,7 +256,7 @@
 		if (!IS_NODE_ALIVE (&osb->publ_map, curr_master, osb->max_nodes)) {
 			/* Reset the lock as not owned and return success?? */
 			/* This needs to be under some sort of cluster wide lock */
-			fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(bh); /* write */
+			fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(bh); /* write */
 			DISK_LOCK(fe)->curr_master = OCFS_INVALID_NODE_NUM;
 			DISK_LOCK(fe)->file_lock = OCFS_DLM_NO_LOCK;
 			OCFS_BH_PUT_DATA(bh);
@@ -295,7 +295,7 @@
 	int status = -ETIMEDOUT;
 	int tmpstat = -ETIMEDOUT;
 	__u32 timewaited = 0;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	struct buffer_head *bh = NULL;
 	__u32 curr_master;
 	__u8 lock_level;
@@ -315,7 +315,7 @@
 			LOG_ERROR_STATUS (status = tmpstat);
 			goto finally;
 		}
-		fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(bh); /* read */
+		fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(bh); /* read */
 		curr_master = DISK_LOCK(fe)->curr_master;
 		lock_level = DISK_LOCK(fe)->file_lock;
 		OCFS_BH_PUT_DATA(bh);
@@ -329,7 +329,7 @@
 		    (!TEST_NODE_IN_RECOVERY(osb, curr_master))) {
 			/* Reset the lock as not owned and return success?? */
 			/* This needs to be under some sort of cluster wide lock, */
-			fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(bh); /* write */
+			fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(bh); /* write */
 			DISK_LOCK(fe)->curr_master = OCFS_INVALID_NODE_NUM;
 			DISK_LOCK(fe)->file_lock = OCFS_DLM_NO_LOCK;
 			OCFS_BH_PUT_DATA(bh);
@@ -408,7 +408,7 @@
 					goto finally;
 				}
 				LOG_TRACE_ARGS("broke cache lock, setting to NO_LOCK\n");
-				fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(bh); /* write */
+				fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(bh); /* write */
 				DISK_LOCK(fe)->file_lock = OCFS_DLM_NO_LOCK;
 				lock_level = OCFS_DLM_NO_LOCK;
 				OCFS_BH_PUT_DATA(bh);
@@ -648,7 +648,7 @@
 {
 	int status = 0;
 	__u64 offset = 0;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	int changed = 0;
 	ocfs_lock_res *lockres = GET_INODE_LOCKRES(inode);
 	
@@ -670,13 +670,13 @@
 		}
 	}
 
-	fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(*bh); /* read */
+	fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(*bh); /* read */
 
 	if (flags & DLOCK_FLAG_MASTER && 
 	    DISK_LOCK(fe)->curr_master != lockres->master_node_num) {
 		if (!changed) {
 			OCFS_BH_PUT_DATA(*bh);
-			fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(*bh); /* write */
+			fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(*bh); /* write */
 		}
 		changed = 1;
 		DISK_LOCK(fe)->curr_master = lockres->master_node_num;
@@ -686,7 +686,7 @@
 	    DISK_LOCK(fe)->file_lock != lockres->lock_type) {
 		if (!changed) {
 			OCFS_BH_PUT_DATA(*bh);
-			fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(*bh); /* write */
+			fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(*bh); /* write */
 		}
 		changed = 1;
 		DISK_LOCK(fe)->file_lock = lockres->lock_type;
@@ -704,7 +704,7 @@
 		if (!ocfs_node_map_is_equal(&disk_map, &lockres->oin_openmap)) {
 			if (!changed) {
 				OCFS_BH_PUT_DATA(*bh);
-				fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(*bh); /* write */
+				fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(*bh); /* write */
 			}
 			changed = 1;
 			ocfs_set_disk_lock_open_map(osb, DISK_LOCK(fe), &lockres->oin_openmap);
@@ -715,7 +715,7 @@
 	    DISK_LOCK(fe)->dlock_seq_num != lockres->last_upd_seq_num) {
 		if (!changed) {
 			OCFS_BH_PUT_DATA(*bh);
-			fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(*bh); /* write */
+			fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(*bh); /* write */
 		}
 		changed = 1;
 		DISK_LOCK(fe)->dlock_seq_num = lockres->last_upd_seq_num;
@@ -845,7 +845,7 @@
 		   __u32 flags, struct buffer_head **bh, struct inode *inode)
 {
 	int status = -EFAIL;
-	ocfs_file_entry *disklock = NULL;
+	ocfs2_dinode *disklock = NULL;
 	__u32 updated = 0;
 	ocfs_lock_res *lockres = GET_INODE_LOCKRES(inode);
 	int k = 0;
@@ -892,7 +892,7 @@
 			LOG_ERROR_STATUS (status);
 			goto finally;
 		}
-		disklock = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(*b); /* read */
+		disklock = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(*b); /* read */
 
 		if (!IS_VALID_FILE_ENTRY(disklock))
 			BUG();
@@ -1070,7 +1070,7 @@
 	__u64 lockseqno;
 	int cachelock = 0;
 	int disk_vote = 0;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	struct buffer_head *tmpbh = NULL, **b = NULL;
 	__u32 curr_master;
 	int lockflags = (lock_id >= osb->vol_layout.bitmap_off ? OCFS_BH_CACHED : 0);
@@ -1106,7 +1106,7 @@
 			goto finito;
 		}
 	}
-	fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(*b); /* read */
+	fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(*b); /* read */
 #if 0
 	ocfs_node_map_init(osb, &openmap);
 	ocfs_get_disk_lock_open_map(osb, DISK_LOCK(fe), &openmap);
@@ -1193,7 +1193,7 @@
 	}
 
 finally:
-	fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(*b); /* write */
+	fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(*b); /* write */
 
 	LOG_TRACE_ARGS("writing lock now... releasemaster: %s, level: %d, master: %d\n",
 		       flags & FLAG_FILE_RELEASE_MASTER ? "yes" : "no", 
@@ -1340,7 +1340,7 @@
 	ocfs_node_map open_map;
 	__u64 lockseqnum = 0;
 	int tmpstat;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	__u64 lock_id;
 	__u32 lock_write_flags = DLOCK_FLAG_MASTER | DLOCK_FLAG_LOCK | DLOCK_FLAG_OPEN_MAP;
 	__u32 lock_type = requested_lock;
@@ -1378,7 +1378,7 @@
 		need_to_zap_buffers = 1;
 	} else {
 		if (bh) {
-			fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(bh); /* read */
+			fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(bh); /* read */
 			/* may not need to rewrite the lock later if we already have a cachelock */
 			need_lock_write = (DISK_LOCK(fe)->curr_master != osb->node_num ||
 					DISK_LOCK(fe)->file_lock != OCFS_DLM_ENABLE_CACHE_LOCK);
@@ -1490,7 +1490,7 @@
 
 	/* pick up any change to the open map */
 	if (bh) {
-		fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(bh); /* read */
+		fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(bh); /* read */
 		ocfs_get_disk_lock_open_map(osb, DISK_LOCK(fe), 
 					    &lockres->oin_openmap);
 		OCFS_BH_PUT_DATA(bh);

Modified: branches/format-changes/src/extmap.c
===================================================================
--- branches/format-changes/src/extmap.c	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/extmap.c	2004-06-04 22:59:03 UTC (rev 1008)
@@ -581,32 +581,30 @@
 /* ocfs_update_extent_map()
  *
  */
-int ocfs_update_extent_map (ocfs_super * osb, ocfs_extent_map * Map, void *Buffer, __s64 * localVbo, __u64 * remainingLength, ocfs_ext_flag Flag)
+int ocfs_update_extent_map(ocfs_super *osb, ocfs_extent_map *Map,
+			   void *Buffer, __s64 *localVbo,
+			   __u64 *remainingLength, ocfs_ext_flag Flag)
 {
 	int ret = -EFAIL;
-	ocfs_file_entry *FileEntry;
-	ocfs_extent_group *OcfsExtent;
+	ocfs2_dinode *fe;
+	ocfs_extent_group *ext;
 	__s64 tempVbo;
-	__s64 tempLbo;
 	__u64 tempSize;
 	int j;
 
 	LOG_ENTRY ();
 
 	if (Flag == LOCAL_EXT) {
-		FileEntry = (ocfs_file_entry *) Buffer;
+		fe = (ocfs2_dinode *)Buffer;
 
-		OCFS_ASSERT(FileEntry->i_tree_depth < 0);
+		OCFS_ASSERT(fe->i_tree_depth < 0);
 
-		for (j = 0; j < FileEntry->i_next_free_ext; j++) {
-			tempVbo = FileEntry->extents[j].file_off;
-			tempLbo = FileEntry->extents[j].disk_off;
-			tempSize = FileEntry->extents[j].num_bytes;
-
+		for (j = 0; j < fe->i_next_free_ext; j++) {
 			/* Add the Extent to extent map list */
 			ret =
-			    ocfs_add_extent_map_entry (osb, Map, tempVbo, tempLbo,
-						   tempSize);
+				ocfs_add_extent_map_entry_from_rec(osb->sb,
+								   Map,
+								   &fe->extents[j]);
 			if (!ret) {
 				LOG_ERROR_STATUS (ret = -ENOMEM);
 				goto bail;
@@ -616,21 +614,17 @@
 	} else {
 		__u64 localLength = 0;
 
-		OcfsExtent = (ocfs_extent_group *) Buffer;
+		ext = (ocfs_extent_group *)Buffer;
 
-		for (j = 0; j < OcfsExtent->next_free_ext; j++) {
-			if ((__s64) (OcfsExtent->extents[j].file_off +
-				   OcfsExtent->extents[j].num_bytes) >
-			    (*localVbo)) {
-				tempVbo = OcfsExtent->extents[j].file_off;
-				tempLbo = OcfsExtent->extents[j].disk_off;
-				tempSize = OcfsExtent->extents[j].num_bytes;
+		for (j = 0; j < ext->next_free_ext; j++) {
+			if ((__s64)((u64)(ext->extents[j].e_cpos + ext->extents[j].e_clusters) << osb->s_clustersize_bits) > (*localVbo)) {
+				tempVbo = (u64)ext->extents[j].e_cpos << osb->s_clustersize_bits;
+				tempSize = (u64)ext->extents[j].e_clusters << osb->s_clustersize_bits;
 
 				/* Add the Extent to extent map list */
-				ret =
-				    ocfs_add_extent_map_entry (osb, Map, tempVbo,
-							   tempLbo,
-							   (__u32) tempSize);
+				ret = ocfs_add_extent_map_entry_from_rec(osb->sb,
+								Map,
+								&ext->extents[j]);
 				if (!ret) {
 					LOG_ERROR_STATUS (ret = -ENOMEM);
 					goto bail;
@@ -652,10 +646,10 @@
 			}
 		}
 
-		if ((OcfsExtent->next_free_ext != OCFS_MAX_DATA_EXTENTS) &&
+		if ((ext->next_free_ext != OCFS_MAX_DATA_EXTENTS) &&
 		    (*remainingLength)) {
 			LOG_ERROR_ARGS ("next_free_extent=%d, rem_len=%llu",
-				OcfsExtent->next_free_ext, *remainingLength);
+				ext->next_free_ext, *remainingLength);
 		} else
 			ret = 0;
 	}
@@ -665,7 +659,29 @@
 	return ret;
 }				/* ocfs_update_extent_map */
 
+
 /*
+ * ocfs_add_extent_map_entry_from_rec()
+ *
+ * Add and entry using the fields of an ocfs_extent_rec.
+ *
+ * FIXME This should be coalesced with ocfs_add_extent_map_entry
+ * once all callers use this function.
+ */
+int ocfs_add_extent_map_entry_from_rec(struct super_block *sb,
+				       ocfs_extent_map *extmap,
+				       ocfs_extent_rec *rec)
+{
+	u64 vbo = (u64)rec->e_cpos << OCFS_SB(sb)->s_clustersize_bits;
+	u64 lbo = rec->e_blkno << sb->s_blocksize_bits;
+	u64 bytes =
+		(u64)rec->e_clusters << OCFS_SB(sb)->s_clustersize_bits;
+	return ocfs_add_extent_map_entry(OCFS_SB(sb), extmap,
+					 vbo, lbo, bytes);
+}
+
+
+/*
  * ocfs_add_extent_map_entry()
  *
  * adds an entry to an extent map
@@ -674,6 +690,7 @@
  */
 int ocfs_add_extent_map_entry (ocfs_super * osb, ocfs_extent_map * Map, __s64 Vbo, __s64 Lbo, __u64 ByteCount)
 {
+	/* FIXME take ocfs_extent_rec */
 	int ret;
 
 	LOG_ENTRY ();

Modified: branches/format-changes/src/file.c
===================================================================
--- branches/format-changes/src/file.c	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/file.c	2004-06-04 22:59:03 UTC (rev 1008)
@@ -45,7 +45,7 @@
 static int ocfs_truncate_file (ocfs_super * osb, __u64 file_off, __u64 file_size, struct inode *inode);
 
 
-static void ocfs_fe_set_attributes(ocfs_file_entry *fe, struct iattr *attr)
+static void ocfs_fe_set_attributes(ocfs2_dinode *fe, struct iattr *attr)
 {
 	if (attr->ia_valid & ATTR_SIZE)
 		fe->i_size = attr->ia_size;
@@ -91,7 +91,7 @@
 			   ocfs_journal_handle *handle, struct inode *inode)
 {
 	int status = 0;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	int local_handle = 1;
 
 	LOG_ENTRY ();
@@ -99,7 +99,7 @@
 	if (handle)
 		local_handle = 0;
 
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
 	if (!IS_VALID_FILE_ENTRY(fe)) {
 		OCFS_BH_PUT_DATA(fe_bh);
 		status = -EINVAL;
@@ -109,7 +109,7 @@
 
 	/* why do we update these here? */
 	OCFS_I(inode)->alloc_size =
-		fe->i_clusters << osb->s_clustersize_bits;
+		(u64)fe->i_clusters << osb->s_clustersize_bits;
 	OCFS_I(inode)->chng_seq_num = DISK_LOCK(fe)->dlock_seq_num;
 	if (fe->i_blkno == 0)
 		LOG_ERROR_STR ("this_sector=0");
@@ -412,13 +412,10 @@
 {
 	int ret = 0;
 	int j;
-	__s64 tempVbo;
-	__s64 tempLbo;
-	__u64 tempSize;
 	__u64 tempoff;
 	ocfs_extent_group *extent = NULL;
 	struct buffer_head *extent_bh = NULL;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	void *tmp;
 
 	LOG_ENTRY ();
@@ -432,7 +429,7 @@
 		goto leave;
 	}
 	tmp = OCFS_BH_GET_DATA_READ(fe_bh); /* read */
-	memcpy(fe, tmp, sizeof(ocfs_file_entry));
+	memcpy(fe, tmp, sizeof(ocfs2_dinode));
 	OCFS_BH_PUT_DATA(fe_bh);
 	tempoff = fe->i_blkno << osb->sb->s_blocksize_bits;
 
@@ -442,16 +439,10 @@
 
 	if (fe->i_tree_depth < 0) {
 		for (j = 0; j < fe->i_next_free_ext; j++) {
-			tempVbo = fe->extents[j].file_off;
-			tempLbo = fe->extents[j].disk_off;
-			tempSize = fe->extents[j].num_bytes;
-			
 			/* Add the Extent to extent map */
-			ret = ocfs_add_extent_map_entry (osb, 
-							 &OCFS_I(inode)->map,
-							  tempVbo, 
-							  tempLbo, 
-							  tempSize);
+			ret = ocfs_add_extent_map_entry_from_rec(osb->sb, 
+					       		&OCFS_I(inode)->map,
+				      			&fe->extents[j]);
 			if (!ret) {
 				LOG_ERROR_STATUS (ret = -ENOMEM);
 				goto leave;
@@ -478,16 +469,10 @@
 			}
 			
 			for (j = 0; j < extent->next_free_ext; j++) {
-				tempVbo = extent->extents[j].file_off;
-				tempLbo = extent->extents[j].disk_off;
-				tempSize = extent->extents[j].num_bytes;
-				
 				/* Add the Extent to extent map */
-				ret = ocfs_add_extent_map_entry (osb,
-								 &OCFS_I(inode)->map,
-								 tempVbo,
-								 tempLbo,
-								 tempSize);
+				ret = ocfs_add_extent_map_entry_from_rec(osb->sb,
+						       		&OCFS_I(inode)->map,
+                                                                &extent->extents[j]);
 				if (!ret) {
 					LOG_ERROR_STATUS (ret =
 							  -ENOMEM);
@@ -582,7 +567,7 @@
 {
 	int status = 0;
 	int tmpstat;
-	ocfs_file_entry *fileEntry = NULL;
+	ocfs2_dinode *fileEntry = NULL;
 	int have_disk_lock = 0;
 	__u64 lockId = 0;
 	__u32 lockFlags = 0, locktype = 0;
@@ -597,7 +582,7 @@
 		goto leave;
 	}
 
-	fileEntry = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(bh); /* read */
+	fileEntry = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(bh); /* read */
 
 	if (!IS_VALID_FILE_ENTRY(fileEntry)) {
 		LOG_ERROR_ARGS ("Invalid fe at offset %llu", file_off);
@@ -642,7 +627,7 @@
 		goto leave;
 	}
 
-	fileEntry = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(bh); /* write */
+	fileEntry = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(bh); /* write */
 
 	fileEntry->i_mtime = OCFS_CURRENT_TIME;
 
@@ -940,7 +925,7 @@
 static int ocfs_truncate_file (ocfs_super * osb, __u64 file_off, __u64 file_size, struct inode *inode)
 {
 	int status = 0, tmpstat;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	__u64 lockId = 0;
 	__u32 lockFlags = 0, locktype = 0;
 	int have_disk_lock = 0;
@@ -969,7 +954,7 @@
 		goto leave;
 	}
 
-	fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(bh); /* read */
+	fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(bh); /* read */
 	if (!IS_VALID_FILE_ENTRY(fe)) {
 		LOG_ERROR_ARGS ("Invalid fe at offset %llu", file_off);
 		status = -EFAIL;
@@ -1007,7 +992,7 @@
 
 	down(&OCFS_I(inode)->priv_sem);
 
-	fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(bh); /* write */
+	fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(bh); /* write */
 
 	/* the file entry might have changed underneath us (while
 	 * waiting on the lock). make sure the size is still a valid
@@ -1025,7 +1010,7 @@
 	}
 
 	fe->i_size = file_size;
-	fe->i_clusters = new_alloc_size >> osb->s_clustersize_bits;
+	fe->i_clusters = (u32)(new_alloc_size >> osb->s_clustersize_bits);
 
 	status = ocfs_free_extents_for_truncate (osb, fe, handle, inode);
 	if (status < 0) {
@@ -1087,7 +1072,7 @@
 {
 	int status = 0;
 	int tmpstat;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	__u64 tempOffset = 0;
 	__u64 current_alloc;
 	__u64 alloc_size = 0;
@@ -1119,7 +1104,7 @@
 		goto leave;
 	}
 
-	fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(bh); /* read */
+	fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(bh); /* read */
 
 	if (!IS_VALID_FILE_ENTRY(fe)) {
 		printk("fe->signature=%8s\n", fe->i_signature);
@@ -1129,7 +1114,7 @@
 		goto leave;
 	}
 
-	current_alloc = fe->i_clusters << osb->s_clustersize_bits;
+	current_alloc = (u64)fe->i_clusters << osb->s_clustersize_bits;
 	alloc_size = file_size - current_alloc;
 	OCFS_BH_PUT_DATA(bh);
 	fe = NULL;
@@ -1152,7 +1137,7 @@
 
 		/* Grab a lock on the entry found if we have more than
 		 * 1 extents and also make this node the master*/
-		fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(bh); /* read */
+		fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(bh); /* read */
 
 		/* now we always take an EXTEND lock */
 		lockId = fe->i_blkno << osb->sb->s_blocksize_bits;
@@ -1179,7 +1164,7 @@
 		goto leave;
 	}
 
-	fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(bh); /* write */ /* journal access */
+	fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(bh); /* write */ /* journal access */
 
 	if (file_size > (__s64)current_alloc) {
 		alloc_size = file_size - current_alloc;
@@ -1232,8 +1217,8 @@
 			unsigned long block;
 			struct super_block *sb = osb->sb;
 
-			for (block = actualDiskOffset >> osb->sect_size_bits; 
-			     block < (actualDiskOffset+actualLength) >> osb->sect_size_bits;
+			for (block = (unsigned long)(actualDiskOffset >> osb->sect_size_bits); 
+			     block < (unsigned long)((actualDiskOffset+actualLength) >> osb->sect_size_bits);
 			     block++) {
 				LOG_TRACE_ARGS("setting block %lu as new!\n", block);
 				alloc_bh = getblk(OCFS_GET_BLOCKDEV(sb), block, sb->s_blocksize);
@@ -1251,21 +1236,22 @@
 
 		ocfs_handle_add_inode(handle, ext_alloc_inode);
 		status = ocfs_allocate_extent(osb, bh, handle,
-					      actualDiskOffset,
-					      actualLength, inode);
+					      actualDiskOffset >> osb->sb->s_blocksize_bits,
+					      actualLength >> osb->s_clustersize_bits,
+                                              inode);
 		if (status < 0) {
 			LOG_ERROR_STATUS (status);
 			goto leave;
 		}
-		fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(bh); /* write */ /* journal access */
+		fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(bh); /* write */ /* journal access */
 
 		/* update the total allocation size here */
 		fe->i_clusters += 
-			(actualLength >> osb->s_clustersize_bits);
+			(u32)(actualLength >> osb->s_clustersize_bits);
 
 		down (&(OCFS_I(inode)->priv_sem));
 		OCFS_I(inode)->alloc_size =
-			fe->i_clusters << osb->s_clustersize_bits;
+			(u64)fe->i_clusters << osb->s_clustersize_bits;
 		up (&(OCFS_I(inode)->priv_sem));
 
 		/* no need to do OCFS_SECTOR_ALIGN once the allocation size is correct. */

Modified: branches/format-changes/src/inc/ocfs.h
===================================================================
--- branches/format-changes/src/inc/ocfs.h	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/inc/ocfs.h	2004-06-04 22:59:03 UTC (rev 1008)
@@ -333,10 +333,11 @@
 ** File Entry contains this information
 */
 /* OCFS2 file flags */
-#define  OCFS2_VALID_FL			(0x1)
-#define  OCFS2_CHANGE_FL		(0x2)
-#define  OCFS2_MARK_FOR_DELETION_FL	(0x4)
-#define  OCFS2_NAME_DELETED_FL		(0x8)
+#define OCFS2_VALID_FL			(0x1)
+#define OCFS2_CHANGE_FL			(0x2)
+#define OCFS2_MARK_FOR_DELETION_FL	(0x4)
+#define OCFS2_NAME_DELETED_FL		(0x8)
+#define	OCFS2_SYSTEM_FL			(0x10)
 
 
 #define  INVALID_NODE_POINTER                -1
@@ -419,24 +420,7 @@
 #define  IS_VALID_NODE_NUM(node)      \
 	(((node) >= 0) && ((node) < OCFS_MAXIMUM_NODES))
 
-#define  OCFS_GET_EXTENT(vbo, extent, k) \
-	do { \
-		for ((k) = 0; (k) < OCFS_MAX_DATA_EXTENTS; (k)++) { \
-      			if((__s64)((extent)->extents[(k)].file_off + \
-	      			   (extent)->extents[(k)].num_bytes) > (vbo)) \
-	    		break; \
-		} \
-	}  while(0)
 
-#define  OCFS_GET_FILE_ENTRY_EXTENT(vbo, fileentry, k)                    \
-	      do {                                                        \
-		for ((k) = 0; (k) < OCFS_MAX_FILE_ENTRY_EXTENTS; (k)++) { \
-		  if((__s64)((fileentry)->extents[(k)].file_off +           \
-		     (fileentry)->extents[(k)].length) > (vbo))           \
-		    break;                                                \
-		}                                                         \
-	      } while(0)
-
 #define  CHECK_FOR_LAST_EXTENT(fileentry, k)                              \
 	      do {                                                        \
 		for((k) = 0; (k) < OCFS_MAX_FILE_ENTRY_EXTENTS; (k)++) {  \
@@ -505,9 +489,6 @@
 ocfs_protocol;
 
 
-#define OCFS_EXTENT_MERGEABLE(ext, off)	\
-			(((ext)->disk_off + (ext)->num_bytes) == (off))
-
 #define OCFS_IS_VALID_EXTENT(__ext, __typ)	 ({			\
 	int __ret = 0;						\
 	switch (__typ) {						\
@@ -528,8 +509,8 @@
 #define ocfs_free_extent_entry(ext)   kmem_cache_free(OcfsGlobalCtxt.extent_cache, ext)
 
 
-#define ocfs_allocate_file_entry()  ((ocfs_file_entry *)({ \
-	ocfs_file_entry *FileEntry = NULL; \
+#define ocfs_allocate_file_entry()  ((ocfs2_dinode *)({ \
+	ocfs2_dinode *FileEntry = NULL; \
 	FileEntry = kmem_cache_alloc (OcfsGlobalCtxt.fe_cache, GFP_NOFS); \
 	if (FileEntry != NULL) \
  	  memset (FileEntry, 0, OCFS_SECTOR_SIZE); \
@@ -899,7 +880,7 @@
 	atomic_t          i_clean_buffer_seq;
 	__u32             flags; /* see below */
 
-	/* stolen right off of ocfs_file_entry */
+	/* stolen right off of ocfs2_dinode */
 	union {
 		__u64 fe_private;
 		__u64 child_dirnode;
@@ -1251,17 +1232,12 @@
 */
 extern ocfs_global_ctxt OcfsGlobalCtxt;
 
-typedef struct _ocfs_alloc_ext		// CLASS
-{
-	/* Starting offset within the file */
-	__u64 file_off;			// DISKPTR
-	/* Number of bytes used by this alloc */
-	/* WARNING!: should never be greater than LONG_MAX! */
-	__u64 num_bytes;		// NUMBER RANGE(0,LONG_MAX)
-	/* Physical Disk Offset */
-	__u64 disk_off;			// DISKPTR
-}
-ocfs_alloc_ext;				// END CLASS
+typedef struct _ocfs_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 */
+/*10*/
+} ocfs_extent_rec;	
 
 typedef struct _ocfs_publish		// CLASS
 {
@@ -1307,7 +1283,7 @@
 /*
  * On disk file entry (inode) for OCFS v2
  */
-typedef struct _ocfs_file_entry {
+typedef struct _ocfs2_dinode {
 /*00*/	__u8 i_signature[8];		/* Signature for validation */
 	__u32 i_generation;		/* Generation number */
 	__u32 i_suballoc_node;		/* Node suballocater this inode
@@ -1344,8 +1320,8 @@
 	__u16 i_next_free_ext;		/* Next unused extent slot */
 	__u32 i_reserved3;
 /*A0*/	__u64 last_ext_ptr;		/* Pointer to last extdat */
-/*A8*/	ocfs_alloc_ext extents[OCFS_MAX_FILE_ENTRY_EXTENTS];  // EXTENT[OCFS_MAX_FILE_ENTRY_EXTENTS]
-} ocfs_file_entry;
+/*A8*/	ocfs_extent_rec extents[OCFS_MAX_FILE_ENTRY_EXTENTS];  // EXTENT[OCFS_MAX_FILE_ENTRY_EXTENTS]
+} ocfs2_dinode;
 
 typedef struct _ocfs_extent_group			// CLASS
 {
@@ -1366,7 +1342,7 @@
 	__u64 alloc_file_off;				// DISKPTR
 	__u64 last_ext_ptr;				// DISKPTR
 	__u64 up_hdr_node_ptr;				// DISKPTR
-	ocfs_alloc_ext extents[OCFS_MAX_DATA_EXTENTS];	// EXTENT[OCFS_MAX_DATA_EXTENTS]
+	ocfs_extent_rec extents[OCFS_MAX_DATA_EXTENTS];	// EXTENT[OCFS_MAX_DATA_EXTENTS]
 }
 ocfs_extent_group;					// END CLASS
 
@@ -1855,8 +1831,47 @@
 	return ret;
 }
 
+static inline int ocfs_extent_for_offset(struct super_block *sb,
+					 ocfs_extent_group *eh,
+					 u64 vbo)
+{ 
+	int k;
+	ocfs_extent_rec *ext;
+	u32 cluster;
+	u64 byte_off;
 
+	for (k = 0; k < OCFS_MAX_DATA_EXTENTS; k++) {
+		ext = &eh->extents[k];
 
+		cluster = ext->e_cpos + ext->e_clusters;
+		byte_off = cluster << OCFS_SB(sb)->s_clustersize_bits;
+
+      		if (byte_off >= vbo)
+	    		break;
+	}
+
+	return k;
+}
+
+static inline u64 ocfs_clusters_to_blocks(struct super_block *sb,
+		    			  u32 clusters)
+{
+	int c_to_b_bits = OCFS_SB(sb)->s_clustersize_bits -
+		sb->s_blocksize_bits;
+
+	return (u64)clusters << c_to_b_bits;
+}
+
+static inline u32 ocfs_blocks_to_clusters(struct super_block *sb,
+					  u64 blocks)
+{
+	int b_to_c_bits = OCFS_SB(sb)->s_clustersize_bits -
+		sb->s_blocksize_bits;
+
+	return (u32)(blocks >> b_to_c_bits);
+}
+
+
 /*  
  *  Trans Lock:
  *  Right now OCFS2 only supports a single transaction at a

Modified: branches/format-changes/src/inc/ocfs_buffer_head.h
===================================================================
--- branches/format-changes/src/inc/ocfs_buffer_head.h	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/inc/ocfs_buffer_head.h	2004-06-04 22:59:03 UTC (rev 1008)
@@ -299,7 +299,7 @@
 #define OCFS_PRINT_FE_SIZE(bh)						      \
 do {									      \
 	if (bh) {							      \
-		ocfs_file_entry *__fe = bh->b_data;			      \
+		ocfs2_dinode *__fe = bh->b_data;			      \
 		if (IS_VALID_FILE_ENTRY(__fe)) {			      \
 			printk("ocfs2: %s:%d fe_check: file_size = (%llu), "  \
 				"this_sector = (%llu)\n",		      \

Modified: branches/format-changes/src/inc/ocfs_journal.h
===================================================================
--- branches/format-changes/src/inc/ocfs_journal.h	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/inc/ocfs_journal.h	2004-06-04 22:59:03 UTC (rev 1008)
@@ -43,7 +43,7 @@
 };
 
 struct _ocfs_super;
-struct _ocfs_file_entry;
+struct _ocfs2_dinode;
 struct _ocfs_journal_handle;
 
 /* most of the ocfs_journal structure is protected by the

Modified: branches/format-changes/src/inc/proto.h
===================================================================
--- branches/format-changes/src/inc/proto.h	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/inc/proto.h	2004-06-04 22:59:03 UTC (rev 1008)
@@ -34,7 +34,7 @@
 				 __u32 nodenum, __u32 type);
 int ocfs_allocate_extent(ocfs_super *osb, struct buffer_head *fe_bh,
 			 ocfs_journal_handle *handle,
-			 __u64 actualDiskOffset, __u64 actualLength,
+			 u64 blkno, u32 new_clusters,
 			 struct inode *inode);
 int ocfs_alloc_node_block(ocfs_super *osb, __u64 FileSize,
 			  __u64 *DiskOffset, __u64 *file_off,
@@ -52,13 +52,13 @@
 		    __u64 *cluster_off, __u64 *cluster_count,
 		    int sysfile, ocfs_journal_handle *handle);
 int ocfs_free_extents_for_truncate(ocfs_super *osb,
-				   ocfs_file_entry *FileEntry,
+				   ocfs2_dinode *fe,
 				   ocfs_journal_handle *handle,
 				   struct inode *inode);
 int ocfs_free_file_extents(ocfs_super *osb, struct buffer_head *fe_bh,
 			   ocfs_journal_handle *handle,
 			   struct inode *inode);
-int ocfs_get_leaf_extent(ocfs_super *osb, ocfs_file_entry *FileEntry,
+int ocfs_get_leaf_extent(ocfs_super *osb, ocfs2_dinode *fe,
 			 __s64 Vbo, struct buffer_head **data_extent_bh,
 			 struct inode *inode);
 int ocfs_load_local_alloc(ocfs_super *osb);
@@ -137,6 +137,9 @@
 void ocfs_get_disk_lock_open_map(ocfs_super *osb, ocfs_disk_lock *lock, ocfs_node_map *open_map);
 
 /* extmap.c */
+int ocfs_add_extent_map_entry_from_rec(struct super_block *sb,
+				       ocfs_extent_map *extmap,
+				       ocfs_extent_rec *rec);
 int ocfs_add_extent_map_entry(ocfs_super *osb, ocfs_extent_map *Map,
 			      __s64 Vbo, __s64 Lbo, __u64 ByteCount);
 void ocfs_delete_all_extent_maps(ocfs_super *osb, struct inode *oin);
@@ -236,7 +239,7 @@
 			struct buffer_head *fe_bh);
 int ocfs_inode_init_private(struct inode *inode);
 int ocfs_inode_revalidate(struct dentry *dentry);
-void ocfs_populate_inode(struct inode *inode, ocfs_file_entry *fe,
+void ocfs_populate_inode(struct inode *inode, ocfs2_dinode *fe,
 			 int create_ino);
 void ocfs_put_inode(struct inode *inode);
 void ocfs_read_inode(struct inode *inode);

Modified: branches/format-changes/src/inode.c
===================================================================
--- branches/format-changes/src/inode.c	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/inode.c	2004-06-04 22:59:03 UTC (rev 1008)
@@ -177,7 +177,7 @@
 {
 	struct inode *inode = NULL;
 	struct super_block *sb = osb->sb;
-	ocfs_file_entry *fe;
+	ocfs2_dinode *fe;
 	ocfs_find_inode_args args;
 	__u32 flags = 0;
 
@@ -217,7 +217,7 @@
 	if (fe_bh) {
 		/* best case -- we can figure out what we need from
 		 * the file entry! */
-		fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(fe_bh);
+		fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(fe_bh);
 		if (!IS_VALID_FILE_ENTRY(fe)) {
 			OCFS_BH_PUT_DATA(fe_bh);
 			LOG_ERROR_STATUS(-EINVAL);
@@ -302,7 +302,7 @@
 {
 	ocfs_find_inode_args *args = NULL;
 	int ret = 0;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 
 	LOG_ENTRY_ARGS ("(0x%p, %lu, 0x%p)\n", inode, ino, opaque);
 	
@@ -368,7 +368,7 @@
  * ocfs_populate_inode()
  *
  */
-void ocfs_populate_inode(struct inode *inode, ocfs_file_entry *fe,
+void ocfs_populate_inode(struct inode *inode, ocfs2_dinode *fe,
 		     	 int create_ino)
 {
 	struct super_block *sb;
@@ -415,7 +415,7 @@
 	SET_INODE_FEOFF(inode, offset);
 
 	OCFS_I(inode)->alloc_size =
-		(fe->i_clusters << osb->s_clustersize_bits);
+		(u64)fe->i_clusters << osb->s_clustersize_bits;
 	OCFS_I(inode)->inode = inode;
 	OCFS_I(inode)->chng_seq_num = DISK_LOCK(fe)->dlock_seq_num;
 	OCFS_I(inode)->u.fe_private = fe->u.fe_private;
@@ -508,7 +508,7 @@
 	struct super_block *sb;
 	ocfs_super *osb;
 	__u64 feoff = 0ULL;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	struct buffer_head *bh = NULL;
 	int status;
 	int sysfile = 0;
@@ -545,7 +545,7 @@
 	} else
 		bh = args->fe_bh;
 
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(bh); /* read */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(bh); /* read */
 
         if (S_ISCHR(fe->i_mode) || S_ISBLK(fe->i_mode))
             inode->i_rdev = ocfs_decode_dev(le64_to_cpu(fe->u.i_rdev));
@@ -589,7 +589,7 @@
 {
 	ocfs_find_inode_args *args = NULL;
 	int ret = 0;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 
 	LOG_ENTRY_ARGS ("(0x%p, %lu, %llu, 0x%p)\n", inode, inode->i_ino, GET_INODE_FEOFF(inode), opaque);
 
@@ -806,7 +806,7 @@
 	int err = -EIO;
 	ocfs_super *osb;
 	int status;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	__u64 entryOffset;
 	struct buffer_head *bh = NULL;
 
@@ -820,6 +820,7 @@
 
 	osb = OCFS_SB(inode->i_sb);
 
+#warning This really needs blocksize fixup
 	if ((iblock << 9) > PATH_MAX + 1) {
 		LOG_ERROR_ARGS ("file offset > PATH_MAX: %lu", iblock << 9);
 		goto bail;
@@ -832,7 +833,7 @@
 		LOG_ERROR_STATUS (status);
 		goto bail;
 	}
-	fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(bh); /* read */
+	fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(bh); /* read */
 
 	if (!IS_VALID_FILE_ENTRY (fe)) {
 		OCFS_BH_PUT_DATA(bh);
@@ -841,14 +842,14 @@
 	}
 
 	if ((iblock << 9) >=
-	    (__s64)(fe->i_clusters << osb->s_clustersize_bits)) {
+	    (__s64)((u64)fe->i_clusters << osb->s_clustersize_bits)) {
 		OCFS_BH_PUT_DATA(bh);
 		LOG_ERROR_ARGS ("file offset is outside the allocated size: %lu",
 		     iblock << 9);
 		goto bail;
 	}
 
-	map_bh(bh_result, inode->i_sb, (fe->extents[0].disk_off >> osb->sect_size_bits) + iblock);
+	map_bh(bh_result, inode->i_sb, fe->extents[0].e_blkno + iblock);
 	OCFS_BH_PUT_DATA(bh);
 
 	err = 0;
@@ -1763,7 +1764,7 @@
 {
 	int status = 0;
 	struct buffer_head *fe_bh = NULL;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	__u64 offset;
 
 	/* We are setting the oin Updated flag in the end. */
@@ -1795,7 +1796,7 @@
 		LOG_ERROR_STATUS (status);
 		goto leave;
 	}
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
 
 	/* Make sure that what we found is not a directory. */
 	if ((OCFS_I(inode)->oin_flags & OCFS_OIN_DIRECTORY))
@@ -1815,7 +1816,7 @@
 	}
 
 	if ((OCFS_I(inode)->alloc_size !=
-	     (__s64)(fe->i_clusters << osb->s_clustersize_bits)) ||
+	     (__s64)((u64)fe->i_clusters << osb->s_clustersize_bits)) ||
 	    (inode->i_size != (__s64) fe->i_size) ||
 	    (OCFS_I(inode)->chng_seq_num != DISK_LOCK(fe)->dlock_seq_num) ||
 	    inode->i_uid != fe->i_uid ||
@@ -1824,14 +1825,14 @@
 	    inode->i_nlink != fe->i_links_count){
 
 		if (OCFS_I(inode)->alloc_size >
-		    (__s64)(fe->i_clusters << osb->s_clustersize_bits)) {
+		    (__s64)((u64)fe->i_clusters << osb->s_clustersize_bits)) {
 			ocfs_extent_map_destroy (&OCFS_I(inode)->map);
 			ocfs_extent_map_init (&OCFS_I(inode)->map);
 		}
 
 		LOG_TRACE_STR("Allocsize, filesize or seq no did not match");
 		OCFS_I(inode)->alloc_size = 
-			(fe->i_clusters << osb->s_clustersize_bits);
+			(u64)fe->i_clusters << osb->s_clustersize_bits;
 		inode->i_size = fe->i_size;
 printk("verifyupdate: setting nlink from %d to %d for %llu\n", inode->i_nlink, fe->i_links_count, GET_INODE_FEOFF(inode));
 		inode->i_nlink = fe->i_links_count;
@@ -1846,7 +1847,7 @@
 		OCFS_SET_INODE_TIME(inode, i_mtime, fe->i_mtime);
 		if (!S_ISDIR (inode->i_mode) &&
 		    (OCFS_I(inode)->alloc_size !=
-		     (__s64)(fe->i_clusters << osb->s_clustersize_bits) ||
+		     (__s64)((u64)fe->i_clusters << osb->s_clustersize_bits) ||
 		     inode->i_size != (__s64) fe->i_size ||
 		     OCFS_I(inode)->chng_seq_num != DISK_LOCK(fe)->dlock_seq_num)) {
 			*needs_trunc = 1;
@@ -1862,21 +1863,13 @@
 		}
 
 		if (fe->i_tree_depth < 0) {
-			__s64 tempVbo;
-			__s64 tempLbo;
-			__u64 tempSize;
 			__u32 j;
 
 			/* Add the Extents to extent map */
 			for (j = 0; j < fe->i_next_free_ext; j++) {
-				tempVbo = fe->extents[j].file_off;
-				tempLbo = fe->extents[j].disk_off;
-				tempSize = fe->extents[j].num_bytes;
-
-				if (!ocfs_add_extent_map_entry (osb, 
-								&OCFS_I(inode)->map,
-								tempVbo, tempLbo,
-								tempSize))
+				if (!ocfs_add_extent_map_entry_from_rec(osb->sb, 
+                                                               &OCFS_I(inode)->map,
+                                                               &fe->extents[j]))
 					goto leave;
 			}
 		}

Modified: branches/format-changes/src/journal.c
===================================================================
--- branches/format-changes/src/journal.c	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/journal.c	2004-06-04 22:59:03 UTC (rev 1008)
@@ -908,7 +908,7 @@
 	int status = -1;
 	struct inode *inode = NULL; /* the journal inode */
 	journal_t * k_journal = NULL;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	__u64 lock_id = 0;
 	struct buffer_head *bh = NULL;
 	__u64 alloc_size;
@@ -948,7 +948,7 @@
 			LOG_ERROR_STR("Could not get lock on journal!");
 		goto done;
 	}
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(bh); /* read */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(bh); /* read */
 
 	/* should be exactly eight megs.  need to run tuneocfs otherwise. */
 	if (fe->i_size != OCFS_JOURNAL_DEFAULT_SIZE) {
@@ -968,7 +968,7 @@
 	LOG_TRACE_ARGS("fe->i_clusters = %u\n", fe->i_clusters);
 
 	/* gonna need this later */
-	alloc_size = fe->i_clusters << osb->s_clustersize_bits;
+	alloc_size = (u64)fe->i_clusters << osb->s_clustersize_bits;
 	LOG_TRACE_ARGS("fe->i_blkno = %llu\n", fe->i_blkno);
 	inode->i_size = fe->i_size;
 	OCFS_BH_PUT_DATA(bh);
@@ -1330,7 +1330,7 @@
 {
 	int status = -1;
 	__u64 lock_id = 0;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	struct inode *inode = NULL;
 	journal_t *k_journal = NULL;
 	struct buffer_head *bh = NULL;
@@ -1406,9 +1406,9 @@
 	printk("ocfs2: Recovering node %d from device (%u,%u)\n", node_num, 
 	       MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev));
 
-	fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(bh); /* read */
+	fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(bh); /* read */
 	/* gonna need this later */
-	alloc_size = fe->i_clusters << osb->s_clustersize_bits;
+	alloc_size = (u64)fe->i_clusters << osb->s_clustersize_bits;
 	OCFS_BH_PUT_DATA(bh);
 	fe = NULL;
 

Modified: branches/format-changes/src/lockres.c
===================================================================
--- branches/format-changes/src/lockres.c	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/lockres.c	2004-06-04 22:59:03 UTC (rev 1008)
@@ -56,7 +56,7 @@
 {
 	int status = 0;
 	struct buffer_head *tmpbh = NULL, **b = NULL;
-	ocfs_file_entry *fe;
+	ocfs2_dinode *fe;
 	int flags;
 	ocfs_lock_res *lockres = GET_INODE_LOCKRES(inode);;
 
@@ -85,7 +85,7 @@
 			goto finally;
 		}
 
-		fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(*b); /* read */
+		fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(*b); /* read */
 		if (!IS_VALID_FILE_ENTRY(fe))
 			BUG();
 

Modified: branches/format-changes/src/namei.c
===================================================================
--- branches/format-changes/src/namei.c	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/namei.c	2004-06-04 22:59:03 UTC (rev 1008)
@@ -75,7 +75,7 @@
 #endif
 {
 	int status;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	struct buffer_head *fe_bh = NULL, *dirent_bh = NULL;
 	struct inode *inode = NULL;
 	struct super_block *sb = dir->i_sb;
@@ -101,7 +101,7 @@
 	if (status < 0)
 		goto bail_add;
 	
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
 	if (!IS_VALID_FILE_ENTRY(fe)) {
 		printk("ocfs2: invalid file entry!  parent=%llu, name='%*s'\n",
 		       GET_INODE_FEOFF(dir), dentry->d_name.len, 
@@ -140,7 +140,7 @@
 	__u64 parent_off, file_off;
 	ocfs_journal_handle *handle = NULL;
 	ocfs_super *osb;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	struct buffer_head *new_fe_bh = NULL;
 	struct inode *inode = NULL;
 
@@ -204,7 +204,7 @@
 		goto leave;
 	}
 
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(new_fe_bh); /* read */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(new_fe_bh); /* read */
 
 	ocfs_populate_inode (inode, fe, 1);
 	insert_inode_hash (inode);
@@ -263,7 +263,7 @@
 			LOG_ERROR_STATUS(status);
 			goto leave;
 		}
-		fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_WRITE(parent_fe_bh); /* write */
+		fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_WRITE(parent_fe_bh); /* write */
 		fe->i_links_count++;
 		OCFS_BH_PUT_DATA(parent_fe_bh);
 		fe = NULL;
@@ -321,7 +321,7 @@
 			     struct inode *inode)
 {
 	int status = 0;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	__u64 disk_off = 0;
 	__u64 fileOffset = 0;
 	struct inode *inode_alloc_inode = NULL;
@@ -362,7 +362,7 @@
 		goto leave;
 	}
 
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_WRITE(*new_fe_bh); /* write */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_WRITE(*new_fe_bh); /* write */
 	memset (fe, 0, osb->sect_size);
 	inode->i_ino = ino_from_off(osb->sb, disk_off);
         /*
@@ -501,7 +501,7 @@
 	ocfs_super *osb = OCFS_SB(dir->i_sb);
 	__u64 fileOff = GET_INODE_FEOFF(inode);
 	struct inode *parentInode = dentry->d_parent->d_inode;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	__u32 lockFlags = (S_ISDIR (inode->i_mode) ? (FLAG_FILE_DELETE | FLAG_DIR) : FLAG_FILE_DELETE);
 	struct buffer_head *fe_bh = NULL;
 	struct buffer_head *parent_node_bh = NULL; /* parent locknode */
@@ -614,7 +614,7 @@
 	 * here if we set the modify bit on this buffer, but haven't
 	 * journal_dirtied it yet. Otherwise, it'll stay modified even
 	 * after the abort_trans. */
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
 	if (S_ISDIR (inode->i_mode))
 		fe->i_links_count = 0;
 	else 
@@ -652,14 +652,14 @@
 	 	* delete_inode, truncate or similar)
 	 	*/
 		if (S_ISDIR (inode->i_mode)) {
-			ocfs_file_entry *dirfe;
+			ocfs2_dinode *dirfe;
 			status = ocfs_journal_access(handle, parent_node_bh, 
 						     OCFS_JOURNAL_ACCESS_WRITE);
 			if (status < 0) {
 				LOG_ERROR_STATUS(status);
 				goto leave;
 			}
-			dirfe = (ocfs_file_entry *) OCFS_BH_GET_DATA_WRITE(parent_node_bh);
+			dirfe = (ocfs2_dinode *) OCFS_BH_GET_DATA_WRITE(parent_node_bh);
 			dirfe->i_links_count--;
 			OCFS_BH_PUT_DATA(parent_node_bh);
 			status = ocfs_journal_dirty(handle, fe_bh);
@@ -850,11 +850,11 @@
 	int status = 0;
 	struct inode *old_inode = old_dentry->d_inode;
 	struct inode *new_inode = new_dentry->d_inode;
-	ocfs_file_entry *newfe = NULL, *oldfe = NULL;
+	ocfs2_dinode *newfe = NULL, *oldfe = NULL;
 	struct buffer_head *oldfe_bh = NULL;
 	struct buffer_head *newfe_bh = NULL;
 	struct buffer_head *insert_bh = NULL;
-	ocfs_file_entry *tmpfe = NULL;
+	ocfs2_dinode *tmpfe = NULL;
 	ocfs_super *osb = NULL;
 	__u64 oldOffset, newDirOff, oldDirOff;
 	__u64 newfe_lockid = 0;
@@ -1036,7 +1036,7 @@
 	 * away first */
 	if (new_de) {
 		/* TODO: change this block to the ext3-style orphan model */
-		newfe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(newfe_bh); /* read */
+		newfe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(newfe_bh); /* read */
 		if (S_ISDIR(newfe->i_mode))
 			newfe_flags = FLAG_DIR;
 		newfe_flags |= FLAG_FILE_DELETE;
@@ -1075,7 +1075,7 @@
 		 * here if we set the modify bit on this buffer, but haven't
 		 * journal_dirtied it yet. Otherwise, it'll stay modified even
 		 * after the abort_trans. */
-		newfe = (ocfs_file_entry *) OCFS_BH_GET_DATA_WRITE(newfe_bh); /* write */
+		newfe = (ocfs2_dinode *) OCFS_BH_GET_DATA_WRITE(newfe_bh); /* write */
 		if (S_ISDIR (new_inode->i_mode) && !empty_dir(new_inode)) {
 			status = -ENOTEMPTY;
 			OCFS_BH_PUT_DATA(newfe_bh);
@@ -1284,7 +1284,7 @@
 	int l;
 	struct buffer_head *new_fe_bh = NULL;
 	struct buffer_head *parent_fe_bh = NULL;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	ocfs_journal_handle *handle = NULL;
 	int got_lock = 0;
 
@@ -1338,7 +1338,7 @@
 		goto abort_trans;
 	}
 
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(new_fe_bh); /* read */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(new_fe_bh); /* read */
 	file_off = fe->i_blkno << osb->sb->s_blocksize_bits;
 	OCFS_BH_PUT_DATA(new_fe_bh);
 	fe = NULL;
@@ -1354,7 +1354,7 @@
 	}
 	inode->i_rdev = OCFS_NODEV;
 
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(new_fe_bh); /* read */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(new_fe_bh); /* read */
 	ocfs_populate_inode (inode, fe, 1);
 	OCFS_BH_PUT_DATA(new_fe_bh);
 	fe = NULL;
@@ -1463,7 +1463,7 @@
 	struct super_block * sb;
 	int retval, status;
 	char *buf = NULL;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 
 	sb = dir->i_sb;
 
@@ -1502,7 +1502,7 @@
 				/* update the parent file entry file size */
 				status = ocfs_journal_access(handle, parent_fe_bh, OCFS_JOURNAL_ACCESS_WRITE);
 				buf = OCFS_BH_GET_DATA_WRITE(parent_fe_bh); /* write */
-				fe = (ocfs_file_entry *)buf;
+				fe = (ocfs2_dinode *)buf;
 				fe->i_size = dir->i_size;
 				OCFS_BH_PUT_DATA(parent_fe_bh);
 				buf = NULL;
@@ -1794,7 +1794,7 @@
 	int tmpstat;
 	struct buffer_head *bh = NULL;
 	struct buffer_head *parent_fe_bh = NULL;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 
 	if (S_ISDIR(inode->i_mode))
 		return -EPERM;
@@ -1838,7 +1838,7 @@
 	if (err < 0)
 		goto bail;
 
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_WRITE(bh);
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_WRITE(bh);
 	fe->i_links_count++;
 	inode->i_nlink = fe->i_links_count;
 	inode->i_ctime = CURRENT_TIME;

Modified: branches/format-changes/src/nm.c
===================================================================
--- branches/format-changes/src/nm.c	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/nm.c	2004-06-04 22:59:03 UTC (rev 1008)
@@ -609,7 +609,7 @@
 	ocfs_lock_res *lockres = NULL;
 	__u32 flags, num_nodes;
 	__u64 offset;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	ocfs_vote *vote = NULL;
 	struct buffer_head *fe_bh = NULL, *vote_bh = NULL;
 	int vote_type = INVALID_REQUEST, vote_response = 0;
@@ -855,7 +855,7 @@
 				if (status < 0)
 					LOG_ERROR_STATUS (status);
 				if (status >= 0) {
-					fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
+					fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
 					DISK_LOCK(fe)->curr_master = node_num;
 					OCFS_BH_PUT_DATA(fe_bh);
 					status = ocfs_write_bh(osb, fe_bh, 0, inode);
@@ -975,12 +975,12 @@
 				break;
 			}
 	
-			fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
+			fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
 			is_dir = S_ISDIR(fe->i_mode);
 			is_locked = DISK_LOCK(fe)->file_lock > OCFS_DLM_NO_LOCK;
 			if (vote_type == CHANGE_MASTER) {
 				OCFS_BH_PUT_DATA(fe_bh);
-				fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
+				fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
 				if (inode && OCFS_I(inode)->open_hndl_cnt) {
 					ocfs_node_map_init(osb, &disk_map);
 					ocfs_get_disk_lock_open_map(osb, DISK_LOCK(fe), &disk_map);
@@ -998,7 +998,7 @@
 			if (is_locked || vote_type == CHANGE_MASTER) {
 				if (vote_type == RELEASE_CACHE) {
 					LOG_TRACE_STR("release cache vote, setting to NO_LOCK");
-					fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
+					fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
 					DISK_LOCK(fe)->file_lock = OCFS_DLM_NO_LOCK;
 					OCFS_BH_PUT_DATA(fe_bh);
 				}
@@ -1030,7 +1030,7 @@
 				LOG_ERROR_STATUS (status);
 				break;
 			}
-			fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(fe_bh); /* read */
+			fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(fe_bh); /* read */
 
 			if ((fe->i_flags & OCFS2_NAME_DELETED_FL) ||
 			    (!(fe->i_flags & OCFS2_VALID_FL))) {
@@ -1039,7 +1039,7 @@
 			} else {
 				ocfs_node_map_init(osb, &disk_map);
 				OCFS_BH_PUT_DATA(fe_bh);
-				fe = (ocfs_file_entry *)OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
+				fe = (ocfs2_dinode *)OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
 				ocfs_get_disk_lock_open_map(osb, DISK_LOCK(fe), &disk_map);
 				ocfs_node_map_set_bit(&disk_map, node_num);
 				ocfs_set_disk_lock_open_map(osb, DISK_LOCK(fe), &disk_map);

Modified: branches/format-changes/src/super.c
===================================================================
--- branches/format-changes/src/super.c	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/super.c	2004-06-04 22:59:03 UTC (rev 1008)
@@ -680,7 +680,7 @@
 	__u32 numbits, freebits = 0;
 	unsigned int reserved_bits;
 	int status = 0;
-	ocfs_file_entry *bm_lock = NULL;
+	ocfs2_dinode *bm_lock = NULL;
 	struct buffer_head *bh = NULL;
 
 	LOG_ENTRY_ARGS ("(%p, %p)\n", sb, buf);
@@ -693,7 +693,7 @@
 		LOG_ERROR_STR("failed to read bitmap data");
 		return -EIO;
 	}
-	bm_lock = (ocfs_file_entry *)OCFS_BH_GET_DATA_READ(bh); /* read */
+	bm_lock = (ocfs2_dinode *)OCFS_BH_GET_DATA_READ(bh); /* read */
 	if (numbits >= bm_lock->u.bitinfo.used_bits)
 	    freebits = numbits - bm_lock->u.bitinfo.used_bits;
 

Modified: branches/format-changes/src/sysfile.c
===================================================================
--- branches/format-changes/src/sysfile.c	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/sysfile.c	2004-06-04 22:59:03 UTC (rev 1008)
@@ -41,7 +41,7 @@
 /* Tracing */
 #define OCFS_DEBUG_CONTEXT    OCFS_DEBUG_CONTEXT_SYSFILE
 
-static int ocfs_find_extents_of_system_file (ocfs_super * osb, __u64 file_off, __u64 Length, ocfs_file_entry * fe, void **Buffer, __u32 * NumEntries);
+static int ocfs_find_extents_of_system_file (ocfs_super * osb, __u64 file_off, __u64 Length, ocfs2_dinode * fe, void **Buffer, __u32 * NumEntries);
 
 static struct inode * _ocfs_get_system_file_inode(ocfs_super *osb, int file_type, __u32 node);
 
@@ -119,7 +119,7 @@
 int ocfs_read_system_file (ocfs_super * osb, __u32 FileId, struct buffer_head *bhs[], __u64 Length, __u64 Offset)
 {
 	int status = 0;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	void *extentBuffer = NULL;
 	__u32 numExts = 0, i, j, numblocks;
 	ocfs_io_runs *IoRuns = NULL;
@@ -137,7 +137,7 @@
 		goto leave;
 	}
 
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
 
 	if (!IS_VALID_FILE_ENTRY (fe)) {
 		LOG_ERROR_STATUS(status = -EINVAL);
@@ -203,7 +203,7 @@
 	int status = 0;
 	__u64 StartOffset = 0;
 	void *Buffer = NULL;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	ocfs_io_runs *IoRuns;
 	__u32 NumExts = 0;
 	struct buffer_head *fe_bh = NULL;
@@ -218,7 +218,7 @@
 		goto leave;
 	}
 
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
 
 	if (!IS_VALID_FILE_ENTRY (fe)) {
 		LOG_ERROR_STATUS(status = -EINVAL);
@@ -259,7 +259,7 @@
 int ocfs_get_system_file_size (ocfs_super * osb, __u32 FileId, __u64 * Length, __u64 * AllocSize)
 {
 	int status = 0;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	__u64 offset;
 	struct buffer_head *fe_bh = NULL;
 
@@ -275,7 +275,7 @@
 		goto leave;
 	}
 
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
 
 	if (!IS_VALID_FILE_ENTRY (fe)) {
 		LOG_ERROR_ARGS("offset=%llu", offset);
@@ -284,7 +284,7 @@
 	}
 
 	*Length = (__u64)fe->i_size;
-	*AllocSize = (__u64)(fe->i_clusters << osb->s_clustersize_bits);
+	*AllocSize = (u64)fe->i_clusters << osb->s_clustersize_bits;
 
 leave:
 	if (fe) {
@@ -311,7 +311,7 @@
 	int status = 0;
 	__u64 actualDiskOffset = 0, actualLength = 0;
 	int local_fe = 0;
-	ocfs_file_entry *fe = NULL;
+	ocfs2_dinode *fe = NULL;
 	__u64 alloc_size;
 	int numbhs, i;
 	char *data;
@@ -329,14 +329,14 @@
 			goto leave;
 		}
 	}
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_READ(fe_bh); /* read */
 
 	if (!IS_VALID_FILE_ENTRY (fe)) {
 		OCFS_BH_PUT_DATA(fe_bh);
 		LOG_ERROR_STATUS (status = -EINVAL);
 		goto leave;
 	}
-	alloc_size = fe->i_clusters << osb->s_clustersize_bits;
+	alloc_size = (u64)fe->i_clusters << osb->s_clustersize_bits;
 	OCFS_BH_PUT_DATA(fe_bh);
 	fe = NULL;
 
@@ -368,8 +368,10 @@
 		actualLength =
 		    (__u64) (numClusterAlloc * osb->vol_layout.cluster_size);
 
-		status = ocfs_allocate_extent (osb, fe_bh, handle,  
-					       actualDiskOffset, actualLength, NULL);
+		status = ocfs_allocate_extent(osb, fe_bh, handle,  
+					      actualDiskOffset >> osb->sb->s_blocksize_bits,
+					      actualLength >> osb->s_clustersize_bits,
+					      NULL);
 		if (status < 0) {
 			LOG_ERROR_STATUS (status);
 			goto leave;
@@ -377,7 +379,7 @@
 		
 		if (zero) {
 			/* I think at this point, this can be journalled too */
-			numbhs = actualLength >> osb->sect_size_bits;
+			numbhs = (int)(actualLength >> osb->sb->s_blocksize_bits);
 
 			bhs = ocfs_malloc(numbhs*sizeof(struct buffer_head *));
 			if (!bhs) {
@@ -415,8 +417,9 @@
 	} else
 		actualLength = 0;
 		
-	fe = (ocfs_file_entry *) OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
-	fe->i_clusters += (actualLength >> osb->s_clustersize_bits);
+	fe = (ocfs2_dinode *) OCFS_BH_GET_DATA_WRITE(fe_bh); /* write */
+	fe->i_clusters +=
+		(u32)(actualLength >> osb->s_clustersize_bits);
 	fe->i_size = FileSize;
 
 	DISK_LOCK(fe)->curr_master = osb->node_num;
@@ -446,7 +449,7 @@
  * Searches for the extents in the file entry passed starting from
  * file offset up to the length specified.
  */
-static int ocfs_find_extents_of_system_file (ocfs_super * osb, __u64 file_off, __u64 Length, ocfs_file_entry * fe, void **Buffer, __u32 * NumEntries)
+static int ocfs_find_extents_of_system_file (ocfs_super * osb, __u64 file_off, __u64 Length, ocfs2_dinode * fe, void **Buffer, __u32 * NumEntries)
 {
 	int status = -EFAIL;
 	__u32 size;
@@ -513,15 +516,12 @@
 
 	if (fe->i_tree_depth < 0) {
 		for (j = 0; j < OCFS_MAX_FILE_ENTRY_EXTENTS; j++) {
-			if ((fe->extents[j].file_off +
-			     fe->extents[j].num_bytes) > newOffset) {
+			if (((u64)(fe->extents[j].e_cpos + fe->extents[j].e_clusters) << osb->s_clustersize_bits) > newOffset) {
 				IoRuns[Runoffset].disk_off =
-				    fe->extents[j].disk_off +
-				    (newOffset - fe->extents[j].file_off);
+				    (fe->extents[j].e_blkno << osb->sb->s_blocksize_bits) +
+				    (newOffset - ((u64)fe->extents[j].e_cpos << osb->s_clustersize_bits));
 				IoRuns[Runoffset].byte_cnt =
-				    (__u32) ((fe->extents[j].file_off +
-					    fe->extents[j].num_bytes) -
-					   newOffset);
+				    (__u32)(((u64)(fe->extents[j].e_cpos + fe->extents[j].e_clusters) << osb->s_clustersize_bits) - newOffset);
 				if (IoRuns[Runoffset].byte_cnt >=
 				    remainingLength) {
 					IoRuns[Runoffset].byte_cnt =
@@ -549,9 +549,7 @@
 			/* Keep going downwards looking for the Entry, till 
 			 * we hit the last Data entry */
 			for (k = 0; k < OCFS_MAX_FILE_ENTRY_EXTENTS; k++) {
-				if ((__s64) (fe->extents[k].file_off +
-					   fe->extents[k].num_bytes) >
-				    newOffset) {
+				if ((__s64)((u64)(fe->extents[k].e_cpos + fe->extents[k].e_clusters) << osb->s_clustersize_bits) > newOffset) {
 					break;
 				}
 			}
@@ -560,12 +558,15 @@
 				LOG_ERROR_STR ("data extents maxed");
 			}
 
-			if (fe->extents[k].disk_off == 0) {
-				LOG_ERROR_STR ("disk_off=0");
+			if (fe->extents[k].e_blkno == 0) {
+				LOG_ERROR_STR ("e_blkno=0");
 			}
 
-			status = ocfs_read_bh(osb, fe->extents[k].disk_off,
-					      &extent_bh, OCFS_BH_COND_CACHED, NULL);
+			status = ocfs_read_bh(osb,
+					      fe->extents[k].e_blkno << osb->sb->s_blocksize_bits,
+					      &extent_bh,
+					      OCFS_BH_COND_CACHED,
+					      NULL);
 			if (status < 0) {
 				LOG_ERROR_STATUS (status);
 				goto leave;
@@ -580,16 +581,18 @@
 					goto leave;
 				}
 
-				OCFS_GET_EXTENT ((__s64) newOffset, extent, k);
+				k = ocfs_extent_for_offset(osb->sb,
+						     	   extent,
+							   newOffset);
 				if (k == OCFS_MAX_DATA_EXTENTS) {
 					LOG_ERROR_STR ("data extents maxed");
 				}
 
-				if (extent->extents[k].disk_off == 0) {
-					LOG_ERROR_STR ("disk_off=0");
+				if (extent->extents[k].e_blkno == 0) {
+					LOG_ERROR_STR ("e_blkno=0");
 				}
 
-				diskoffset = extent->extents[k].disk_off;
+				diskoffset = extent->extents[k].e_blkno << osb->sb->s_blocksize_bits;
 
 				OCFS_BH_PUT_DATA(extent_bh);
 				brelse(extent_bh);
@@ -616,23 +619,13 @@
 			}
 
 			for (j = 0; j < OCFS_MAX_DATA_EXTENTS; j++) {
-				if ((extent->extents[j].file_off +
-				     extent->extents[j].
-				     num_bytes) > newOffset) {
+				if (((u64)(extent->extents[j].e_cpos + extent->extents[j].e_clusters) << osb->s_clustersize_bits) > newOffset) {
 					IoRuns[Runoffset].disk_off =
-						extent->extents[j].
-						disk_off + (newOffset -
-							    extent->
-							    extents[j].
-							    file_off);
+						(extent->extents[j].e_blkno << osb->sb->s_blocksize_bits) +
+						(newOffset -
+						 ((u64)extent->extents[j].e_cpos << osb->s_clustersize_bits));
 					IoRuns[Runoffset].byte_cnt =
-						(__u32) ((extent->
-							  extents[j].
-							  file_off +
-							  extent->
-							  extents[j].
-							  num_bytes) -
-							 newOffset);
+						(__u32) (((u64)(extent->extents[j].e_cpos + extent->extents[j].e_clusters) << osb->s_clustersize_bits) - newOffset);
 					
 					if (IoRuns[Runoffset].
 					    byte_cnt >=

Modified: branches/format-changes/src/vote.c
===================================================================
--- branches/format-changes/src/vote.c	2004-06-04 22:06:42 UTC (rev 1007)
+++ branches/format-changes/src/vote.c	2004-06-04 22:59:03 UTC (rev 1008)
@@ -1096,30 +1096,34 @@
 
 // expects that "target" is already inited with correct 
 // num_nodes, and that "from" is of course wide enough
+/* Force le32 as the endian format for on-disk node maps */
+#define OCFS_NODE_MAP_DISK_BITS_PER_LONG 32
+#define OCFS_NODE_MAP_DISK_BITS_TO_LONGS(bits) \
+	(((bits)+OCFS_NODE_MAP_DISK_BITS_PER_LONG-1)/OCFS_NODE_MAP_DISK_BITS_PER_LONG)
 void ocfs_node_map_set_from_disk(ocfs_node_map *target, void *from)
 {
-	int i, num_longs; 
-	unsigned long *p = from;
+	int i, num_u32; 
+	u32 *t = (u32 *)target->map;
+	u32 *f = from;
 
 	OCFS_ASSERT(target->num_nodes > 0);
 
-	num_longs = BITS_TO_LONGS(target->num_nodes);
-#warning need le32_to_cpu or whatever here
-	for (i=0; i<num_longs; i++)
-		target->map[i] = p[i];
+	num_u32 = OCFS_NODE_MAP_DISK_BITS_TO_LONGS(target->num_nodes);
+	for (i = 0; i < num_u32; i++)
+		t[i] = le32_to_cpu(f[i]);
 }
 
 void ocfs_node_map_set_to_disk(void *target, ocfs_node_map *from)
 {
-	int i, num_longs; 
-	unsigned long *p = target;
+	int i, num_u32; 
+	u32 *t = target;
+	u32 *f = (u32 *)from->map;
 
 	OCFS_ASSERT(from->num_nodes > 0);
 
-	num_longs = BITS_TO_LONGS(from->num_nodes);
-#warning need cpu_to_le32 or whatever here
-	for (i=0; i<num_longs; i++)
-		p[i] = from->map[i];
+	num_u32 = OCFS_NODE_MAP_DISK_BITS_TO_LONGS(from->num_nodes);
+	for (i=0; i<num_u32; i++)
+		t[i] = cpu_to_le32(f[i]);
 }
 
 /* returns 1 if bit is the only bit set in target, 0 otherwise */



More information about the Ocfs2-commits mailing list