[Ocfs2-commits] jlbec commits r1048 - branches/format-changes/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Jun 10 21:07:15 CDT 2004


Author: jlbec
Date: 2004-06-10 20:07:13 -0500 (Thu, 10 Jun 2004)
New Revision: 1048

Modified:
   branches/format-changes/src/alloc.c
   branches/format-changes/src/extmap.c
   branches/format-changes/src/file.c
   branches/format-changes/src/ocfs.h
   branches/format-changes/src/sysfile.c
Log:

o ocfs2_extent_list seperated out.  All the renames involved for the
  fields are done.  So, ocfs2_extent_header format is fixed.  Next
  pass renames the structure to ocfs2_extent_block, but that's another
  commit.



Modified: branches/format-changes/src/alloc.c
===================================================================
--- branches/format-changes/src/alloc.c	2004-06-10 22:41:37 UTC (rev 1047)
+++ branches/format-changes/src/alloc.c	2004-06-11 01:07:13 UTC (rev 1048)
@@ -75,13 +75,13 @@
 
 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, 
-				 ocfs2_dinode * FileEntry,
-				 u32 new_clusters, 
-				 struct buffer_head * extent_header_bh, 
-				 u64 *new_eh_blkno, 
-				 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 *eh_bh, 
+				       u64 *new_eh_blkno, 
+      				       ocfs_journal_handle *handle,
+				       struct inode *inode);
 
 static int ocfs_grow_extent_tree(ocfs_super *osb,
 				 struct buffer_head *fe_bh,
@@ -101,7 +101,7 @@
 				  struct inode *inode);
 
 static int ocfs_split_this_tree(ocfs_super * osb, 
-				struct buffer_head *extent_grp_bh, 
+				struct buffer_head *eh_bh, 
 				ocfs_journal_handle *handle,
 				ocfs2_dinode *fe, 
 				struct inode *inode);
@@ -644,7 +644,7 @@
 static int ocfs_allocate_new_data_node(ocfs_super *osb, 
 				       ocfs2_dinode *fe,
 				       u32 new_clusters, 
-				       struct buffer_head *extent_header_bh, 
+				       struct buffer_head *eh_bh, 
 				       u64 *new_eh_blkno,
 				       ocfs_journal_handle *handle,
 				       struct inode *inode)
@@ -659,7 +659,8 @@
 	u64 phys_blkno;
 	__u64 fileOffset = 0;
 	__u64 numSectorsAlloc = 0;
-	ocfs2_extent_header* extent_header = NULL;
+	ocfs2_extent_header *eh = NULL;
+	ocfs2_extent_list *el = NULL;
 	struct buffer_head **header_bhs = NULL;
 	struct buffer_head *bh = NULL;
 	int bh_locked = 0;
@@ -667,8 +668,8 @@
 
 	LOG_ENTRY ();
 	
-	if (extent_header_bh) {
-		status = ocfs_journal_access(handle, extent_header_bh, 
+	if (eh_bh) {
+		status = ocfs_journal_access(handle, eh_bh, 
 					     OCFS_JOURNAL_ACCESS_WRITE);
 
 		if (status < 0) {
@@ -676,12 +677,13 @@
 			goto finally;
 		}
 
-		extent_header = OCFS_BH_GET_DATA_WRITE(extent_header_bh);
+		eh = OCFS_BH_GET_DATA_WRITE(eh_bh);
+		el = &eh->h_list;
 		bh_locked = 1;
 	}
-	if (extent_header != NULL) {
-		depth = extent_header->h_tree_depth;
-		parent_blk = extent_header->h_blkno;
+	if (eh != NULL) {
+		depth = el->l_tree_depth;
+		parent_blk = eh->h_blkno;
 	} else {
 		depth = fe->i_tree_depth;
 		parent_blk = fe->i_blkno;
@@ -730,13 +732,13 @@
 		OCFS_BH_PUT_DATA(header_bhs[i]);
 	}
 	
-	if (extent_header != NULL) {
-		k = extent_header->h_next_free_rec;
-		extent_header->extents[k].e_cpos =
+	if (eh != NULL) {
+		k = el->l_next_free_rec;
+		el->l_recs[k].e_cpos =
 		     	fe->i_clusters;
-		extent_header->extents[k].e_clusters = new_clusters;
-		extent_header->extents[k].e_blkno = phys_blkno;
-		extent_header->h_next_free_rec++;
+		el->l_recs[k].e_clusters = new_clusters;
+		el->l_recs[k].e_blkno = phys_blkno;
+		el->l_next_free_rec++;
 	} else {
 		k = fe->i_next_free_rec;
 		fe->extents[k].e_cpos = fe->i_clusters;
@@ -748,28 +750,32 @@
 	/* Fill in all the headers and the leaf */
 	for (i = 0; i <= depth; i++) {
 		ocfs2_extent_header *ext;
+		ocfs2_extent_list *el2;
+
 		ext = OCFS_BH_GET_DATA_WRITE(header_bhs[i]);
 
 		ext->h_parent_blk = parent_blk;
-		ext->h_next_free_rec = 1;
 		ext->h_suballoc_blkno =
 			(fileOffset >> osb->sb->s_blocksize_bits) + i;
 		ext->h_suballoc_node = osb->node_num;
-		ext->extents[0].e_cpos = fe->i_clusters;
-		ext->extents[0].e_clusters = new_clusters;
 		ext->h_blkno =
 			(physicalOffset >> osb->sb->s_blocksize_bits) + i;
-		ext->h_tree_depth = (depth - 1 - i);
-		ext->h_records = ocfs_extent_recs_per_eh(osb->sb);
 
+		el2 = &ext->h_list;
+		el2->l_count = ocfs_extent_recs_per_eh(osb->sb);
+		el2->l_next_free_rec = 1;
+		el2->l_recs[0].e_cpos = fe->i_clusters;
+		el2->l_recs[0].e_clusters = new_clusters;
+		el2->l_tree_depth = (depth - 1 - i);
+
 		if (i != depth) {
 			/* fill in each header */
-			ext->extents[0].e_blkno = phys_blkno + (i + 1);
+			el2->l_recs[0].e_blkno = phys_blkno + (i + 1);
 			strcpy(ext->signature,
 			       OCFS_EXTENT_HEADER_SIGNATURE);
 		} else {
 			/* fill in the leaf */
-			ext->extents[0].e_blkno = phys_blkno;
+			el2->l_recs[0].e_blkno = phys_blkno;
 			strcpy(ext->signature,
 			       OCFS_EXTENT_DATA_SIGNATURE);
 			*new_eh_blkno = fe->i_last_eh_blk =
@@ -788,24 +794,25 @@
 		}
 	}
 
-	if (extent_header != NULL) {
+	if (eh != NULL) {
 		/* both needed below in for loop */
-		u64 tmp_blk = extent_header->h_parent_blk;
-		int tree_depth = extent_header->h_tree_depth;
+		u64 tmp_blk = eh->h_parent_blk;
+		int tree_depth = el->l_tree_depth;
 
-		OCFS_BH_PUT_DATA(extent_header_bh);
+		OCFS_BH_PUT_DATA(eh_bh);
 		bh_locked = 0;
-		extent_header = NULL;
+		eh = NULL;
+	       	el = NULL;
 
-		status = ocfs_journal_dirty(handle, extent_header_bh);
+		status = ocfs_journal_dirty(handle, eh_bh);
 		if (status < 0) {
 			LOG_ERROR_STATUS (status);
 			goto finally;
 		}
 
 		/* 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. */
+		 * reuse the eh and el variables now as they're no
+		 * longer needed for their original purpose. */
 		for (i = tree_depth + 1; i < fe->i_tree_depth; i++) {
 			bh = NULL;
 			status = ocfs_read_bh(osb,
@@ -817,32 +824,33 @@
 				goto finally;
 			}
 			status = ocfs_journal_access(handle, bh, 
-						    OCFS_JOURNAL_ACCESS_WRITE);
+						     OCFS_JOURNAL_ACCESS_WRITE);
 			if (status < 0) {
 				LOG_ERROR_STATUS(status);
 				goto finally;
 			}
 
-			extent_header = OCFS_BH_GET_DATA_WRITE(bh);
-			if (!IS_VALID_EXTENT_HEADER(extent_header)) {
+			eh = OCFS_BH_GET_DATA_WRITE(bh);
+			if (!IS_VALID_EXTENT_HEADER(eh)) {
 				OCFS_BH_PUT_DATA(bh);
 				brelse(bh);
 				LOG_ERROR_STATUS (status = -EINVAL);
 				goto finally;
 			}
+			el = &eh->h_list;
 
-			if (extent_header->h_next_free_rec == 0) {
+			if (el->l_next_free_rec == 0) {
 				OCFS_BH_PUT_DATA(bh);
 				brelse(bh);
 				LOG_ERROR_STATUS (status = -EFAIL);
 				goto finally;
 			}
 
-			k = extent_header->h_next_free_rec - 1;
-			extent_header->extents[k].e_clusters +=
+			k = el->l_next_free_rec - 1;
+			el->l_recs[k].e_clusters +=
 				new_clusters;
 
-			tmp_blk = extent_header->h_parent_blk;
+			tmp_blk = eh->h_parent_blk;
 			OCFS_BH_PUT_DATA(bh);
 
 			status = ocfs_journal_dirty(handle, bh);
@@ -859,7 +867,7 @@
 	}
 finally:
 	if (bh_locked)
-		OCFS_BH_PUT_DATA(extent_header_bh);
+		OCFS_BH_PUT_DATA(eh_bh);
 	if (header_bhs) {
 		for (i = 0; i < numSectorsAlloc; i++)
 			if (header_bhs[i])
@@ -883,7 +891,7 @@
 	__s32 k, i;
 	ocfs2_extent_header *eh1 = NULL;
 	ocfs2_extent_header *eh2 = NULL;
-	ocfs2_extent_header *eh3 = NULL;
+	ocfs2_extent_list *el;
 	__u64 physicalOffset;
 	__u64 fileOffset = 0;
 	u64 phys_blkno, parent_blk, last_eh_blkno;
@@ -954,10 +962,10 @@
 	eh1 = OCFS_BH_GET_DATA_WRITE(bhs[0]);
 	/* Copy the File Entry information in to the newly allocated sector */
 	for (k = 0; k < fe->i_records; k++) {
-		eh1->extents[k].e_cpos = fe->extents[k].e_cpos;
-		eh1->extents[k].e_clusters =
+		eh1->h_list.l_recs[k].e_cpos = fe->extents[k].e_cpos;
+		eh1->h_list.l_recs[k].e_clusters =
 			fe->extents[k].e_clusters;
-		eh1->extents[k].e_blkno = fe->extents[k].e_blkno;
+		eh1->h_list.l_recs[k].e_blkno = fe->extents[k].e_blkno;
 	}
 
 	last_eh_blkno = fe->i_last_eh_blk;
@@ -981,30 +989,30 @@
 
 	for (i = 0; i < fe->i_tree_depth; i++) {
 		eh2 = OCFS_BH_GET_DATA_WRITE(bhs[i]);
+		el = &eh2->h_list;
 
-		eh2->h_tree_depth = (fe->i_tree_depth - 1) - i;
-		eh2->h_records = ocfs_extent_recs_per_eh(osb->sb);
+		el->l_tree_depth = (fe->i_tree_depth - 1) - i;
+		el->l_count = ocfs_extent_recs_per_eh(osb->sb);
 
 		strcpy(eh2->signature, OCFS_EXTENT_HEADER_SIGNATURE);
 
 		if (i == 0) {
-			eh2->extents[fe->i_records].e_blkno = phys_blkno + 1;
-			eh2->extents[fe->i_records].e_cpos = fe->i_clusters;
-			eh2->extents[fe->i_records].e_clusters = new_clusters;
+			el->l_recs[fe->i_records].e_blkno = phys_blkno + 1;
+			el->l_recs[fe->i_records].e_cpos = fe->i_clusters;
+			el->l_recs[fe->i_records].e_clusters = new_clusters;
+			el->l_next_free_rec = fe->i_records + 1;
 
-			eh2->h_next_free_rec = fe->i_records + 1;
 			eh2->h_blkno =
 				physicalOffset >> osb->sb->s_blocksize_bits;
 			eh2->h_parent_blk = parent_blk;
 
 			parent_blk = last_eh_blkno = eh2->h_blkno;
 		} else {
-			eh2->extents[0].e_blkno = phys_blkno +
-				(i + 1);
-			eh2->extents[0].e_cpos =
-				fe->i_clusters;
-			eh2->extents[0].e_clusters = new_clusters;
-			eh2->h_next_free_rec = 1;
+			el->l_recs[0].e_blkno = phys_blkno + (i + 1);
+			el->l_recs[0].e_cpos = fe->i_clusters;
+			el->l_recs[0].e_clusters = new_clusters;
+			el->l_next_free_rec = 1;
+
 			eh2->h_suballoc_blkno =
 				(fileOffset >> osb->sb->s_blocksize_bits) + i;
 			eh2->h_suballoc_node = osb->node_num;
@@ -1019,22 +1027,24 @@
 
 	/* Update the Data Segment, which is the last one in our array */
 	eh1 = OCFS_BH_GET_DATA_WRITE(bhs[fe->i_tree_depth]);
+	el = &eh1->h_list;
 
 	i = (fe->i_tree_depth) ? 0 : fe->i_records;
 
-	LOG_TRACE_ARGS ("EntryAvailable is: %d\n", eh1->h_next_free_rec);
+	LOG_TRACE_ARGS ("EntryAvailable is: %d\n", el->l_next_free_rec);
 
 	/* For the time being we are assuming that the newly allocated Extent */
 	/* will have one more entry to accomodate the latest allocation */
 
 	strcpy (eh1->signature, OCFS_EXTENT_DATA_SIGNATURE);
-	eh1->h_tree_depth = -1;
-	eh1->h_records = ocfs_extent_recs_per_eh(osb->sb);
+	el->l_tree_depth = -1;
+	el->l_count = ocfs_extent_recs_per_eh(osb->sb);
 
-	eh1->extents[i].e_cpos = fe->i_clusters;
-	eh1->extents[i].e_clusters = new_clusters;
-	eh1->extents[i].e_blkno = blkno;
-	eh1->h_next_free_rec = i + 1;
+	el->l_recs[i].e_cpos = fe->i_clusters;
+	el->l_recs[i].e_clusters = new_clusters;
+	el->l_recs[i].e_blkno = blkno;
+	el->l_next_free_rec = i + 1;
+
 	eh1->h_suballoc_blkno =
 		(fileOffset >> osb->sb->s_blocksize_bits) +
 		fe->i_tree_depth;
@@ -1076,16 +1086,16 @@
 			goto finally;
 		}
 
-		eh3 = OCFS_BH_GET_DATA_WRITE(bh);
-		if (!IS_VALID_EXTENT_HEADER(eh3) ||
-		    (eh3->h_tree_depth != -1)) {
+		eh1 = OCFS_BH_GET_DATA_WRITE(bh);
+		if (!IS_VALID_EXTENT_HEADER(eh1) ||
+		    (eh1->h_list.l_tree_depth != -1)) {
 			OCFS_BH_PUT_DATA(bh);
 			brelse(bh);
 			LOG_ERROR_STATUS (status = -EINVAL);
 			goto finally;
 		}
 
-		eh3->h_next_leaf_blk = last_eh_blkno;
+		eh1->h_next_leaf_blk = last_eh_blkno;
 		OCFS_BH_PUT_DATA(bh);
 		
 		status = ocfs_journal_dirty(handle, bh);
@@ -1096,7 +1106,7 @@
 		}
 	}
 
-	/* Update the uphdrptr of the three extents pointed to by fe */
+	/* Update the uphdrptr of the extents pointed to by fe */
 	if (fe->i_tree_depth > 0) {
 		int i;
 		struct buffer_head *bh = NULL;
@@ -1120,8 +1130,8 @@
 				goto finally;
 			}
 
-			eh3 = OCFS_BH_GET_DATA_WRITE(bh);
-			eh3->h_parent_blk = new_parent_blk;
+			eh1 = OCFS_BH_GET_DATA_WRITE(bh);
+			eh1->h_parent_blk = new_parent_blk;
 			OCFS_BH_PUT_DATA(bh);
 
 			status = ocfs_journal_dirty(handle, bh);
@@ -1175,10 +1185,11 @@
 	int IncreaseTreeDepth = 0;
 	int k = 0, i;
 	ocfs2_extent_header *eh1 = NULL, *eh2 = NULL;
+	ocfs2_extent_list *el1 = NULL, *el2 = NULL;
 	struct buffer_head *eh1_bh = NULL, *eh2_bh = NULL;
 	int UpdateParent = 0;
 	u64 parent_blk, new_eh_blkno;
-	ocfs2_dinode * fe = NULL;
+	ocfs2_dinode *fe = NULL;
 
 	LOG_ENTRY_ARGS("(blkno=%llu, new_clusters=%u)\n", blkno, new_clusters);
 
@@ -1241,21 +1252,22 @@
 		goto finally;
 	}
 	eh1 = OCFS_BH_GET_DATA_WRITE(eh1_bh);
+	el1 = &eh1->h_list;
 	if (!IS_VALID_EXTENT_HEADER(eh1) ||
-	    (eh1->h_tree_depth != -1)) {
+	    (el1->l_tree_depth != -1)) {
 		LOG_ERROR_STATUS (status = -EINVAL);
 		goto finally;
 	}
 	
-	k = eh1->h_next_free_rec - 1;
+	k = el1->l_next_free_rec - 1;
 	LOG_TRACE_ARGS ("Using local extent for extent Entry = %u\n", k);
-	if (eh1->h_next_free_rec < 1)
-		LOG_ERROR_ARGS ("h_next_free_rec=%d", eh1->h_next_free_rec);
+	if (el1->l_next_free_rec < 1)
+		LOG_ERROR_ARGS ("l_next_free_rec=%d", el1->l_next_free_rec);
 	
 	/* See if we can merge the extents and just increase
 	 * the length */
 	if (k >= 0 &&
-	    ocfs_extent_contig(inode, &(eh1->extents[k]), blkno)) {
+	    ocfs_extent_contig(inode, &(el1->l_recs[k]), blkno)) {
 		OCFS_BH_PUT_DATA(eh1_bh);
 
 		status = ocfs_journal_access(handle, eh1_bh, 
@@ -1266,17 +1278,18 @@
 		}
 
 		eh1 = OCFS_BH_GET_DATA_WRITE(eh1_bh);
+		el1 = &eh1->h_list;
 
-		eh1->extents[k].e_clusters += new_clusters;
+		el1->l_recs[k].e_clusters += new_clusters;
 		status = 0;
 		UpdateParent = 1;
 		goto do_update_parent;
 	}
 
 	/* We cannot merge, give him the next extent */
-	k = eh1->h_next_free_rec;
+	k = el1->l_next_free_rec;
 	
-	if (k != eh1->h_records) {
+	if (k != el1->l_count) {
 		/* we can just add next extent */
 		OCFS_BH_PUT_DATA(eh1_bh);
 
@@ -1288,11 +1301,12 @@
 		}
 
 		eh1 = OCFS_BH_GET_DATA_WRITE(eh1_bh);
+		el1 = &eh1->h_list;
 
-		eh1->extents[k].e_cpos = fe->i_clusters;
-		eh1->extents[k].e_clusters = new_clusters;
-		eh1->extents[k].e_blkno = blkno;
-		eh1->h_next_free_rec++;
+		el1->l_recs[k].e_cpos = fe->i_clusters;
+		el1->l_recs[k].e_clusters = new_clusters;
+		el1->l_recs[k].e_blkno = blkno;
+		el1->l_next_free_rec++;
 		UpdateParent = 1;
 	} else {
 		/* Read the last extent and keep traversing
@@ -1310,6 +1324,7 @@
 				OCFS_BH_PUT_DATA(eh2_bh);
 				brelse(eh2_bh);
 				eh2 = NULL;
+				el2 = NULL;
 				eh2_bh =NULL;
 			}
 			status = ocfs_read_bh(osb,
@@ -1322,19 +1337,20 @@
 				goto finally;
 			}
 			eh2 = OCFS_BH_GET_DATA_READ(eh2_bh);
+			el2 = &eh2->h_list;
 			if (!IS_VALID_EXTENT_HEADER(eh2) ||
-			    (eh2->h_tree_depth < 0)) {
+			    (el2->l_tree_depth < 0)) {
 				LOG_ERROR_STATUS (status = -EINVAL);
 				goto finally;
 			}
 			
-			if ((eh2->h_tree_depth != i) ||
-			    (eh2->h_next_free_rec > eh2->h_records)) {
+			if ((el2->l_tree_depth != i) ||
+			    (el2->l_next_free_rec > el2->l_count)) {
 				LOG_ERROR_STATUS(status = -EINVAL);
 				goto finally;
 			}
 			
-			if (eh2->h_next_free_rec != eh2->h_records)
+			if (el2->l_next_free_rec != el2->l_count)
 				break;
 			
 			parent_blk = eh2->h_parent_blk;
@@ -1343,6 +1359,7 @@
 		if (eh2) {
 			OCFS_BH_PUT_DATA(eh2_bh);
 			eh2 = NULL;
+			el2 = NULL;
 			/* we may still need the bh so don't brelse */
 		}
 
@@ -1403,6 +1420,7 @@
 				if (eh2) {
 					OCFS_BH_PUT_DATA(eh2_bh);
 					eh2 = NULL;
+					el2 = NULL;
 				}
 				brelse(eh2_bh);
 				eh2_bh = NULL;
@@ -1426,27 +1444,28 @@
 			}
 
 			eh2 = OCFS_BH_GET_DATA_WRITE(eh2_bh);
+			el2 = &eh2->h_list;
 			if (!IS_VALID_EXTENT_HEADER(eh2) ||
-			    (eh2->h_tree_depth < 0)) {
+			    (el2->l_tree_depth < 0)) {
 				LOG_ERROR_STATUS (status = -EINVAL);
 				goto finally;
 			}
 			
-			if (eh2->h_next_free_rec == 0) {
+			if (el2->l_next_free_rec == 0) {
 				LOG_ERROR_STATUS (status = -EFAIL);
 				goto finally;
 			}
 			
-			k = eh2->h_next_free_rec - 1;
+			k = el2->l_next_free_rec - 1;
 			
-			eh2->extents[k].e_clusters +=
-				new_clusters;
+			el2->l_recs[k].e_clusters += new_clusters;
 			
 			/* gonna need it if we loop around */
 			parent_blk = eh2->h_parent_blk;
 			
 			OCFS_BH_PUT_DATA(eh2_bh);
 			eh2 = NULL;
+			el2 = NULL;
 
 			status = ocfs_journal_dirty(handle, eh2_bh);
 			if (status < 0) {
@@ -1471,10 +1490,12 @@
 		if (eh1_bh && eh1) {
 			OCFS_BH_PUT_DATA(eh1_bh);
 			eh1 = NULL;
+			el1 = NULL;
 		}
 		if (eh2_bh && eh2) {
 			OCFS_BH_PUT_DATA(eh2_bh);
 			eh2 = NULL;
+			el2 = NULL;
 		}	
 
 		status = ocfs_grow_extent_tree(osb, fe_bh, handle,
@@ -1648,6 +1669,7 @@
 	struct buffer_head *tmp_bh = NULL;
 	char * stack[OCFS_TREE_STACK_SIZE];
 	ocfs2_extent_header *cur_eh; /* convenience, points to TOS */
+	ocfs2_extent_list *cur_el;
 	int tos = 0;
 
 	LOG_ENTRY();
@@ -1662,17 +1684,18 @@
 
 	do {
 		cur_eh = (ocfs2_extent_header *) stack[tos];
-
 		if (!IS_VALID_EXTENT_HEADER(cur_eh)) {
 			LOG_ERROR_STR("Invalid extent header!");
 			goto bail;
 		}
 
-		if (cur_eh->h_tree_depth == -1) {
+		cur_el = &cur_eh->h_list;
+
+		if (cur_el->l_tree_depth == -1) {
 			LOG_TRACE_ARGS("found some data to free (%llu)\n", cur_eh->h_blkno);
-			for(i = 0; i < cur_eh->h_next_free_rec; i++) {
+			for(i = 0; i < cur_el->l_next_free_rec; i++) {
 				/* Free the data associated with each header */
-				ext = &cur_eh->extents[i];
+				ext = &cur_el->l_recs[i];
 				num_clusters = ext->e_clusters;
 				bitmap_offset =
 					(u32)(((ext->e_blkno << osb->sb->s_blocksize_bits) - dstart) >> osb->s_clustersize_bits);
@@ -1687,7 +1710,7 @@
 
 			/* Did we already kill all his children, or
 			 * are they already dead? */
-			if (cur_eh->h_next_free_rec == 0) {
+			if (cur_el->l_next_free_rec == 0) {
 				LOG_TRACE_ARGS("Popping this header (%llu)\n", cur_eh->h_blkno);
 				goto free_meta;
 			}
@@ -1701,12 +1724,13 @@
 
 			/* grow the stack, gotta save off a couple
 			 * things 1st. */
-			victim = cur_eh->h_next_free_rec - 1;
-			tmp_off = cur_eh->extents[victim].e_blkno;
+			victim = cur_el->l_next_free_rec - 1;
+			tmp_off = cur_el->l_recs[victim].e_blkno;
 			tmp_off <<= osb->sb->s_blocksize_bits;
-			cur_eh->h_next_free_rec--;
+			cur_el->l_next_free_rec--;
 
 			cur_eh = NULL;
+			cur_el = NULL;
 			tos++;
 
 			/* should already be null, but we can do this
@@ -1744,6 +1768,7 @@
 		kfree(stack[tos]);
 		stack[tos] = NULL;
 		cur_eh = NULL;
+		cur_el = NULL;
 		tos--;
 	} while (tos >= 0);
 
@@ -1763,8 +1788,8 @@
 				  struct buffer_head *eh_bh,
 				  struct inode *inode) 
 {
-	ocfs2_extent_rec *ext;
 	ocfs2_extent_header *eh = NULL;
+	ocfs2_extent_list *el;
 	int status = -EFAIL;
 	int i;
 
@@ -1782,12 +1807,12 @@
 		goto bail;
 	}
 	
-	ext = eh->extents;
+	el = &eh->h_list;
 	
-	for(i = eh->h_next_free_rec; i < eh->h_records; i++) {
-		ext[i].e_clusters = 0;
-		ext[i].e_blkno = 0;
-		ext[i].e_cpos = 0;
+	for(i = el->l_next_free_rec; i < el->l_count; i++) {
+		el->l_recs[i].e_clusters = 0;
+		el->l_recs[i].e_blkno = 0;
+		el->l_recs[i].e_cpos = 0;
 	}
 
 	OCFS_BH_PUT_DATA(eh_bh);
@@ -1814,16 +1839,17 @@
  * 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,
+				struct buffer_head *eh_bh,
 				ocfs_journal_handle *handle,
 				ocfs2_dinode *fe,
 				struct inode *inode) 
 {
 	int status = -EFAIL;
-	ocfs2_extent_rec *ext;
+	ocfs2_extent_rec *rec;
 	struct buffer_head * bh_stack[OCFS_TREE_STACK_SIZE];
 	ocfs2_extent_header *alloc_eh = NULL;  /* convenience, points to TOS */
-	ocfs2_extent_header *extent_grp;
+	ocfs2_extent_header *eh;
+	ocfs2_extent_list *el;
 	struct buffer_head *tmp_bh = NULL, *tmp_bh2 = NULL;
 	int tos = 0;
 	int i, victim;
@@ -1843,58 +1869,63 @@
 		LOG_ERROR_STR("Truncating file with tree_depth 3, this is not tested and may be unsafe!");
 		LOG_TRACE_STR("Found a tree_depth 3 tree, trimming it.\n");
 
-		status = ocfs_journal_access(handle, extent_grp_bh, 
+		status = ocfs_journal_access(handle, eh_bh, 
 					     OCFS_JOURNAL_ACCESS_WRITE);
 		if (status < 0) {
 			LOG_ERROR_STATUS(status);
 			goto bail;
 		}
-		extent_grp = OCFS_BH_GET_DATA_WRITE(extent_grp_bh);
-		for(i = (extent_grp->h_next_free_rec - 1); i>=0; i--) {
-			ext = &extent_grp->extents[i];
+		eh = OCFS_BH_GET_DATA_WRITE(eh_bh);
+		el = &eh->h_list;
+		for (i = (el->l_next_free_rec - 1); i >= 0; i--) {
+			rec = &el->l_recs[i];
 
 			if (tmp_bh2)
 				brelse(tmp_bh2);
 			tmp_bh2 = NULL;
 			status = ocfs_read_bh(osb,
-					      ext->e_blkno << osb->sb->s_blocksize_bits,
+					      rec->e_blkno << osb->sb->s_blocksize_bits,
 					      &tmp_bh2, 
 					      OCFS_BH_COND_CACHED, inode);
 			if (status < 0) {
-				OCFS_BH_PUT_DATA(extent_grp_bh);
-				extent_grp = NULL;
+				OCFS_BH_PUT_DATA(eh_bh);
+				eh = NULL;
 				brelse(tmp_bh2);
 				LOG_ERROR_STATUS (status);
 				goto bail;
 			}
 			
-			if (ext->e_cpos >= fe->i_clusters) {
+			if (rec->e_cpos >= fe->i_clusters) {
 				/* Trim this whole subtree */
-				status = ocfs_kill_this_tree(osb, tmp_bh2, 
-							     handle, inode);
+				status = ocfs_kill_this_tree(osb,
+							     tmp_bh2, 
+							     handle,
+							     inode);
 				if (status < 0) {
-					OCFS_BH_PUT_DATA(extent_grp_bh);
-					extent_grp = NULL;
+					OCFS_BH_PUT_DATA(eh_bh);
+					eh = NULL;
+					el = NULL;
 					brelse(tmp_bh2);
 					LOG_ERROR_STATUS (status);
 					goto bail;
 				}
-				ext->e_cpos = 0;
-				ext->e_blkno = 0;
-				ext->e_clusters = 0;
-				extent_grp->h_next_free_rec = i;
+				rec->e_cpos = 0;
+				rec->e_blkno = 0;
+				rec->e_clusters = 0;
+				el->l_next_free_rec = i;
 			} else  { /* This is the one we want to split. */
-				ext->e_clusters =
-					fe->i_clusters - ext->e_cpos;
+				rec->e_clusters =
+					fe->i_clusters - rec->e_cpos;
 				break;
 			}
 		}
 
 		/* Write out our new top of the tree duder */
-		OCFS_BH_PUT_DATA(extent_grp_bh);
-		extent_grp = NULL;
+		OCFS_BH_PUT_DATA(eh_bh);
+		eh = NULL;
+		el = NULL;
 
-		status = ocfs_journal_dirty(handle, extent_grp_bh);
+		status = ocfs_journal_dirty(handle, eh_bh);
 		if (status < 0) {
 			LOG_ERROR_STATUS(status);
 			goto bail;
@@ -1905,7 +1936,7 @@
 			LOG_ERROR_STATUS(-EFAIL);
 			goto bail;
 		}
-		extent_grp_bh = tmp_bh2;
+		eh_bh = tmp_bh2;
 
 		/* We want to do the next bit of stuff too */
 		gran = 2;
@@ -1918,62 +1949,66 @@
 	if (gran == 2) {
 		LOG_TRACE_STR("Found a tree_depth 2 tree, trimming it.\n");
 
-		status = ocfs_journal_access(handle, extent_grp_bh, 
+		status = ocfs_journal_access(handle, eh_bh, 
 					     OCFS_JOURNAL_ACCESS_WRITE);
 		if (status < 0) {
 			LOG_ERROR_STATUS(status);
 			goto bail;
 		}
 
-		extent_grp = OCFS_BH_GET_DATA_WRITE(extent_grp_bh);
-		for(i = (extent_grp->h_next_free_rec - 1); i>=0; i--) {
-			ext = &extent_grp->extents[i];
+		eh = OCFS_BH_GET_DATA_WRITE(eh_bh);
+		el = &eh->h_list;
+		for(i = (el->l_next_free_rec - 1); i >= 0; i--) {
+			rec = &el->l_recs[i];
 
 			if (tmp_bh)
 				brelse(tmp_bh);
 			tmp_bh = NULL;
 
 			status = ocfs_read_bh(osb,
-					      ext->e_blkno << osb->sb->s_blocksize_bits,
+					      rec->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;
+				OCFS_BH_PUT_DATA(eh_bh);
+				eh = NULL;
+				el = NULL;
 				brelse(tmp_bh);
 				LOG_ERROR_STATUS (status);
 				goto bail;
 			}
 			
-			if (ext->e_cpos >= fe->i_clusters) {
+			if (rec->e_cpos >= fe->i_clusters) {
 				/* Trim this whole subtree */
 				status = ocfs_kill_this_tree(osb,
 							     tmp_bh, 
 							     handle,
 							     inode);
 				if (status < 0) {
-					OCFS_BH_PUT_DATA(extent_grp_bh);
-					extent_grp = NULL;
+					OCFS_BH_PUT_DATA(eh_bh);
+					eh = NULL;
+					el = NULL;
 					brelse(tmp_bh);
 					LOG_ERROR_STATUS (status);
 					goto bail;
 				}
-				ext->e_cpos = 0;
-				ext->e_blkno = 0;
-				ext->e_clusters = 0;
-				extent_grp->h_next_free_rec = i;
+				rec->e_cpos = 0;
+				rec->e_blkno = 0;
+				rec->e_clusters = 0;
+				el->l_next_free_rec = i;
 			} else  { /* This is the one we want to split. */
-				ext->e_clusters = 
-					fe->i_clusters - ext->e_cpos;
+				rec->e_clusters = 
+					fe->i_clusters - rec->e_cpos;
 				break;
 			}
 		}
 		/* Write out our new top of the tree duder */
-		OCFS_BH_PUT_DATA(extent_grp_bh);
-		extent_grp = NULL;
+		OCFS_BH_PUT_DATA(eh_bh);
+		eh = NULL;
+		el = NULL;
 
-		status = ocfs_journal_dirty(handle, extent_grp_bh);
+		status = ocfs_journal_dirty(handle, eh_bh);
 		if (status < 0) {
 			LOG_ERROR_STATUS(status);
 			goto bail;
@@ -1985,7 +2020,7 @@
 			goto bail;
 		}
 
-		extent_grp_bh = tmp_bh;
+		eh_bh = tmp_bh;
 
 		/* Right now, we don't use 'gran' below here, but just
 		 * in case */
@@ -1998,7 +2033,7 @@
 	for (i =0; i < OCFS_TREE_STACK_SIZE; i++)
 		bh_stack[i] = NULL;
 
-	bh_stack[tos] = extent_grp_bh;
+	bh_stack[tos] = eh_bh;
 
 	/* Ok, find the splitting point (can be a DAT or HDR) */
 	do {
@@ -2013,23 +2048,27 @@
 		}
 
 		alloc_eh = OCFS_BH_GET_DATA_WRITE(bh_stack[tos]);
-
 		if (!IS_VALID_EXTENT_HEADER(alloc_eh)) {
 			LOG_ERROR_STR("Invalid extent header!");
 			goto bail;
 		}
 		
-		if (alloc_eh->h_tree_depth == -1) {
+		el = &alloc_eh->h_list;
+
+		if (el->l_tree_depth == -1) {
 			/* shall we just do away with him? */
-			if (alloc_eh->extents[0].e_cpos >=
-			    fe->i_clusters) {
+			if (el->l_recs[0].e_cpos >= fe->i_clusters) {
 				LOG_TRACE_ARGS("Killing this data extent (%llu)\n", alloc_eh->h_blkno);
 				/* Boundary case - what if this guy is
 				 * the last DAT we should delete
 				 * (i.e., split no more ;) */
 				OCFS_BH_PUT_DATA(bh_stack[tos]);
 				alloc_eh = NULL;
-				status = ocfs_kill_this_tree(osb, bh_stack[tos], handle, inode);
+				el = NULL;
+				status = ocfs_kill_this_tree(osb,
+							     bh_stack[tos],
+							     handle,
+							     inode);
 				if (status < 0) {
 					LOG_ERROR_STATUS (status);
 					goto bail;
@@ -2050,39 +2089,39 @@
 				/* there is a chance the split is at a
 				 * header boundary. this will catch
 				 * it: */
-				ext = &alloc_eh->extents[alloc_eh->h_next_free_rec - 1];
-				if ((ext->e_cpos + ext->e_clusters) == fe->i_clusters) {
+				rec = &el->l_recs[el->l_next_free_rec - 1];
+				if ((rec->e_cpos + rec->e_clusters) == fe->i_clusters) {
 					LOG_TRACE_STR("Ok, hit that boundary in the DAT");
 					goto fix_headers;
 				}
 
 				/* Either kill the data or resize it */
-				for(i = (alloc_eh->h_next_free_rec - 1); i>=0; i--) {
-					ext = &alloc_eh->extents[i];
+				for(i = (el->l_next_free_rec - 1); i >= 0; i--) {
+					rec = &el->l_recs[i];
 
 					/* changed this from > to >= */
 					/* Do we delete it completely? */
-					if (ext->e_cpos >= fe->i_clusters) {
-						total_bytes += (u64)ext->e_clusters << osb->s_clustersize_bits;
+					if (rec->e_cpos >= fe->i_clusters) {
+						total_bytes += (u64)rec->e_clusters << osb->s_clustersize_bits;
 
-						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) {
+						num_clusters = rec->e_clusters;
+						bitmap_offset = (u32)(((rec->e_blkno << osb->sb->s_blocksize_bits) - dstart) >> osb->s_clustersize_bits);
+						rec->e_cpos = 0;
+						rec->e_clusters = 0;
+						rec->e_blkno = 0;
+					} else if ((rec->e_cpos + rec->e_clusters) > fe->i_clusters) {
 						/* Do we shrink it? */
 						/* 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;
+						orig_bytes = (u64)rec->e_clusters << osb->s_clustersize_bits;
+						num_clusters = rec->e_clusters;
+						doff = rec->e_blkno << osb->sb->s_blocksize_bits; 
+						rec->e_clusters = fe->i_clusters - rec->e_cpos;
+						bytes = (u64)rec->e_clusters << osb->s_clustersize_bits;
+						num_clusters -= rec->e_clusters;
 						bitmap_offset = (u32)(((doff + bytes) - dstart) >> osb->s_clustersize_bits);
 						/* we want to exit the
 						 * for loop now */
@@ -2094,7 +2133,7 @@
 						 * to actually delete
 						 * *anything* from
 						 * this extent. */
-						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);
+						LOG_TRACE_ARGS("Not deleting extent %d, e_blkno = %llu, e_clusters = %u, e_cpos = %u\n", i, rec->e_blkno, rec->e_clusters, rec->e_cpos);
 						done = 1;
 						goto skip_bitmap_add;
 					}
@@ -2106,7 +2145,8 @@
 
 skip_bitmap_add:
 					if (done) {
-						alloc_eh->h_next_free_rec=i+1;
+						el->l_next_free_rec =
+							i + 1;
 						break;
 					}
 				} /* For loop */
@@ -2114,8 +2154,10 @@
 				/* Either way, we need to write this back out*/
 				OCFS_BH_PUT_DATA(bh_stack[tos]);
 				alloc_eh = NULL;
+				el = NULL;
 
-				status = ocfs_journal_dirty(handle, bh_stack[tos]);
+				status = ocfs_journal_dirty(handle,
+							    bh_stack[tos]);
 				if (status < 0) {
 					LOG_ERROR_STATUS(status);
 					goto bail;
@@ -2134,15 +2176,17 @@
 					}
 
 					alloc_eh = OCFS_BH_GET_DATA_WRITE(bh_stack[tos]);
-					victim = alloc_eh->h_next_free_rec;
-					alloc_eh->h_next_free_rec++;
+					el = &alloc_eh->h_list;
+					victim = el->l_next_free_rec;
+					el->l_next_free_rec++;
 					/* need to also update
 					 * numbytes on these guys */
-					ext = &alloc_eh->extents[victim];
-					ext->e_clusters -=
+					rec = &el->l_recs[victim];
+					rec->e_clusters -=
 						(u32)(total_bytes >> osb->s_clustersize_bits);
 					OCFS_BH_PUT_DATA(bh_stack[tos]);
 					alloc_eh = NULL;
+					el = NULL;
 					status = ocfs_fix_extent_header(osb, 
 								bh_stack[tos], inode);
 					if (status < 0) {
@@ -2150,7 +2194,7 @@
 						goto bail;
 					}
 					status = ocfs_journal_dirty(handle, 
-								bh_stack[tos]);
+								    bh_stack[tos]);
 					if (status < 0) {
 						LOG_ERROR_STATUS(status);
 						goto bail;
@@ -2165,7 +2209,7 @@
 
 			/* Did we already kill all his children, or
 			 * are they already dead? */
-			if (alloc_eh->h_next_free_rec == 0) {
+			if (el->l_next_free_rec == 0) {
 				/*Ok, we're done with this guy, pop the stack*/
 				LOG_TRACE_ARGS("Popping this header (%llu)\n",
 					       alloc_eh->h_blkno);
@@ -2178,17 +2222,18 @@
 				OCFS_BH_PUT_DATA(bh_stack[tos]);
 				brelse(bh_stack[tos]);
 				alloc_eh = NULL;
+				el = NULL;
 				bh_stack[tos] = NULL;
 				tos--;
 				continue;
 			}
 			/* changed this from > to >= */
 			/* Do we just delete this whole part of the tree? */
-			if (alloc_eh->extents[0].e_cpos >= fe->i_clusters) {
+			if (el->l_recs[0].e_cpos >= fe->i_clusters) {
 				LOG_TRACE_ARGS("whacking this tree: (%llu)\n",
 					       alloc_eh->h_blkno);
 
-				if (alloc_eh->extents[0].e_cpos == fe->i_clusters)
+				if (el->l_recs[0].e_cpos == fe->i_clusters)
 					done = 1;
 
 				OCFS_BH_PUT_DATA(bh_stack[tos]);
@@ -2197,6 +2242,7 @@
 						    handle, inode);
 				brelse(bh_stack[tos]);
 				alloc_eh = NULL;
+				el = NULL;
 				bh_stack[tos] = NULL;
 				tos--;
 				if (tos < 0) {
@@ -2215,14 +2261,16 @@
 				}
 
 				alloc_eh = OCFS_BH_GET_DATA_WRITE(bh_stack[tos]);
+				el = &alloc_eh->h_list;
 
-				victim = alloc_eh->h_next_free_rec;
-				alloc_eh->extents[victim].e_cpos = 0;
-				alloc_eh->extents[victim].e_clusters = 0;
-				alloc_eh->extents[victim].e_blkno = 0;
-				alloc_eh->h_next_free_rec--;
+				victim = el->l_next_free_rec;
+				el->l_recs[victim].e_cpos = 0;
+				el->l_recs[victim].e_clusters = 0;
+				el->l_recs[victim].e_blkno = 0;
+				el->l_next_free_rec--;
 				OCFS_BH_PUT_DATA(bh_stack[tos]);
 				alloc_eh = NULL;
+				el = NULL;
 				/* Here's an interesting boundary
 				 * case. What if we're truncating on a
 				 * boundary between two headers and
@@ -2269,14 +2317,16 @@
 				continue;
 			}
 
-			alloc_eh->h_next_free_rec--;
-			victim = alloc_eh->h_next_free_rec;
-			ext = &alloc_eh->extents[victim];
-			tmp_off = ext->e_blkno << osb->sb->s_blocksize_bits;
+			el->l_next_free_rec--;
+			victim = el->l_next_free_rec;
+			rec = &el->l_recs[victim];
+			tmp_off = rec->e_blkno << osb->sb->s_blocksize_bits;
 			OCFS_BH_PUT_DATA(bh_stack[tos]);
 			alloc_eh = NULL;
+			el = NULL;
 
-			status = ocfs_journal_dirty(handle, bh_stack[tos]);
+			status = ocfs_journal_dirty(handle,
+						    bh_stack[tos]);
 			if (status < 0) {
 				LOG_ERROR_STATUS (status);
 				goto bail;
@@ -2289,8 +2339,10 @@
 				LOG_ERROR_STR("uhoh, not brelsing a buffer " \
 					      "on our stack!\n");
 
-			status = ocfs_read_bh(osb, tmp_off, &bh_stack[tos], 
-					      OCFS_BH_COND_CACHED, inode);
+			status = ocfs_read_bh(osb, tmp_off,
+					      &bh_stack[tos], 
+					      OCFS_BH_COND_CACHED,
+					      inode);
 			if (status < 0) {
 				LOG_ERROR_STATUS (status);
 				goto bail;
@@ -2304,6 +2356,7 @@
 		brelse(bh_stack[tos]);
 		bh_stack[tos] = NULL;
 		alloc_eh = NULL;
+		el = NULL;
 		tos--;
 	} while (tos >= 0);
 	
@@ -2343,8 +2396,9 @@
 				   struct inode *inode) 
 {
 	int status = -EFAIL;
+	struct buffer_head *eh_bh = NULL;
 	ocfs2_extent_header *eh = NULL;
-	struct buffer_head *eh_bh = NULL;
+	ocfs2_extent_list *el;
 	u64 next_blk;
 	int victim;
 
@@ -2379,14 +2433,18 @@
 		goto bail;
 	}
 
-	while (eh->h_tree_depth >= 0) {
+	el = &eh->h_list;
+
+	while (el->l_tree_depth >= 0) {
 		if (!IS_VALID_EXTENT_HEADER(eh)) {
 			LOG_ERROR_STR("Invalid extent header!");
 			goto bail;
 		}
 
-		next_blk = eh->extents[eh->h_next_free_rec - 1].e_blkno;
+		el = &eh->h_list;
 
+		next_blk = el->l_recs[el->l_next_free_rec - 1].e_blkno;
+
 		OCFS_BH_PUT_DATA(eh_bh);
 		brelse(eh_bh);
 		eh = NULL;
@@ -2665,7 +2723,7 @@
 				}
 				eh = OCFS_BH_GET_DATA_READ(eh_bh);
 				if (!IS_VALID_EXTENT_HEADER(eh) ||
-				    (eh->h_tree_depth != -1)) {
+				    (eh->h_list.l_tree_depth != -1)) {
 					LOG_ERROR_STATUS (status = -EINVAL);
 					goto finally;
 				}
@@ -2711,8 +2769,9 @@
 {
 	int status = 0, tempstat;
 	__u32 i, j;
+	struct buffer_head *ext_bh = NULL;
 	ocfs2_extent_header *eh = NULL;
-	struct buffer_head *ext_bh = NULL;
+	ocfs2_extent_list *el;
 	ocfs2_extent_header *tmp = NULL;
 	__u64 childDiskOffset = 0;
 
@@ -2742,12 +2801,13 @@
 			LOG_ERROR_STATUS (status = -EINVAL);
 			goto finally;
 		}
+		el = &eh->h_list;
 
-		for (j = 0; j < eh->h_next_free_rec; j++) {
-			if ((__s64)((u64)(eh->extents[j].e_cpos + eh->extents[j].e_clusters) << osb->s_clustersize_bits) > Vbo)
+		for (j = 0; j < el->l_next_free_rec; j++) {
+			if ((__s64)((u64)(el->l_recs[j].e_cpos + el->l_recs[j].e_clusters) << osb->s_clustersize_bits) > Vbo)
 			{
 				childDiskOffset =
-				    eh->extents[j].e_blkno << osb->sb->s_blocksize_bits;
+				    el->l_recs[j].e_blkno << osb->sb->s_blocksize_bits;
 				break;
 			}
 		}
@@ -2772,7 +2832,7 @@
 
 	tmp = OCFS_BH_GET_DATA_READ(*data_extent_bh);
 	if (!IS_VALID_EXTENT_HEADER(tmp) ||
-	    (tmp->h_tree_depth != -1)) {
+	    (tmp->h_list.l_tree_depth != -1)) {
 		LOG_ERROR_STATUS (status = -EINVAL);
 		OCFS_BH_PUT_DATA(*data_extent_bh);
 		brelse(*data_extent_bh);

Modified: branches/format-changes/src/extmap.c
===================================================================
--- branches/format-changes/src/extmap.c	2004-06-10 22:41:37 UTC (rev 1047)
+++ branches/format-changes/src/extmap.c	2004-06-11 01:07:13 UTC (rev 1048)
@@ -588,7 +588,8 @@
 {
 	int ret = -EFAIL;
 	ocfs2_dinode *fe;
-	ocfs2_extent_header *ext;
+	ocfs2_extent_header *eh;
+        ocfs2_extent_list *el;
 	__s64 tempVbo;
 	__u64 tempSize;
 	int j;
@@ -615,17 +616,18 @@
 	} else {
 		__u64 localLength = 0;
 
-		ext = Buffer;
+		eh = Buffer;
+		el = &eh->h_list;
 
-		for (j = 0; j < ext->h_next_free_rec; 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;
+		for (j = 0; j < el->l_next_free_rec; j++) {
+			if ((__s64)((u64)(el->l_recs[j].e_cpos + el->l_recs[j].e_clusters) << osb->s_clustersize_bits) > (*localVbo)) {
+				tempVbo = (u64)el->l_recs[j].e_cpos << osb->s_clustersize_bits;
+				tempSize = (u64)el->l_recs[j].e_clusters << osb->s_clustersize_bits;
 
 				/* Add the Extent to extent map list */
 				ret = ocfs_add_extent_map_entry_from_rec(osb->sb,
 								Map,
-								&ext->extents[j]);
+								&el->l_recs[j]);
 				if (!ret) {
 					LOG_ERROR_STATUS (ret = -ENOMEM);
 					goto bail;
@@ -647,10 +649,10 @@
 			}
 		}
 
-		if ((ext->h_next_free_rec != ext->h_records) &&
+		if ((el->l_next_free_rec != el->l_count) &&
 		    (*remainingLength)) {
-			LOG_ERROR_ARGS ("h_next_free_rec=%d, rem_len=%llu",
-				ext->h_next_free_rec, *remainingLength);
+			LOG_ERROR_ARGS ("l_next_free_rec=%d, rem_len=%llu",
+				el->l_next_free_rec, *remainingLength);
 		} else
 			ret = 0;
 	}

Modified: branches/format-changes/src/file.c
===================================================================
--- branches/format-changes/src/file.c	2004-06-10 22:41:37 UTC (rev 1047)
+++ branches/format-changes/src/file.c	2004-06-11 01:07:13 UTC (rev 1048)
@@ -417,13 +417,15 @@
  * ocfs_inode_fill_ext_map()
  *
  */
-int ocfs_inode_fill_ext_map(ocfs_super * osb, struct buffer_head * fe_bh, struct inode *inode)
+int ocfs_inode_fill_ext_map(ocfs_super *osb, struct buffer_head *fe_bh,
+			    struct inode *inode)
 {
 	int ret = 0;
 	int j;
 	__u64 tempoff;
-	ocfs2_extent_header *extent = NULL;
-	struct buffer_head *extent_bh = NULL;
+	ocfs2_extent_header *eh = NULL;
+	ocfs2_extent_list *el;
+	struct buffer_head *eh_bh = NULL;
 	ocfs2_dinode *fe = NULL;
 	void *tmp;
 
@@ -463,26 +465,27 @@
 		/* Extents are branched and we are no longer using */
 		/* Local Extents for this File Entry. */
 		
-		ret = ocfs_get_leaf_extent (osb, fe, 0, &extent_bh, inode);
+		ret = ocfs_get_leaf_extent (osb, fe, 0, &eh_bh, inode);
 		if (ret < 0) {
 			LOG_ERROR_STATUS (ret);
 			goto leave;
 		}
 		
 		while (1) {
-			extent = OCFS_BH_GET_DATA_READ(extent_bh);
+			eh = OCFS_BH_GET_DATA_READ(eh_bh);
+			el = &eh->h_list;
 			
-			if (!IS_VALID_EXTENT_HEADER(extent) ||
-                            (extent->h_tree_depth != -1)) {
+			if (!IS_VALID_EXTENT_HEADER(eh) ||
+			    (el->l_tree_depth != -1)) {
 				LOG_ERROR_STATUS(ret = -EFAIL);
 				goto leave;
 			}
 			
-			for (j = 0; j < extent->h_next_free_rec; j++) {
+			for (j = 0; j < el->l_next_free_rec; j++) {
 				/* Add the Extent to extent map */
 				ret = ocfs_add_extent_map_entry_from_rec(osb->sb,
 						       		&OCFS_I(inode)->map,
-                                                                &extent->extents[j]);
+								&el->l_recs[j]);
 				if (!ret) {
 					LOG_ERROR_STATUS (ret =
 							  -ENOMEM);
@@ -490,19 +493,19 @@
 				}
 			}
 			
-			if (extent->h_next_leaf_blk > 0) {
-				if (!extent->h_next_leaf_blk) {
+			if (eh->h_next_leaf_blk > 0) {
+				if (!eh->h_next_leaf_blk) {
 					LOG_ERROR_STATUS (ret = -EFAIL);
 					goto leave;
 				}
-				next_leaf = extent->h_next_leaf_blk;
-				OCFS_BH_PUT_DATA(extent_bh);
-				extent = NULL;
-				extent_bh = NULL;
+				next_leaf = eh->h_next_leaf_blk;
+				OCFS_BH_PUT_DATA(eh_bh);
+				eh = NULL;
+				eh_bh = NULL;
 
 				ret = ocfs_read_bh(osb, 
 						   next_leaf << osb->sb->s_blocksize_bits, 
-						   &extent_bh, 
+						   &eh_bh, 
 						   OCFS_BH_COND_CACHED, inode);
 				if (ret < 0) {
 					LOG_ERROR_STATUS(ret);
@@ -518,10 +521,10 @@
 	if (fe)
 		ocfs_release_file_entry (fe);
 
-	if (extent_bh) {
-		if (extent)
-			OCFS_BH_PUT_DATA(extent_bh);
-		brelse(extent_bh);
+	if (eh_bh) {
+		if (eh)
+			OCFS_BH_PUT_DATA(eh_bh);
+		brelse(eh_bh);
 	}
 
 	LOG_EXIT_STATUS (ret);
@@ -1249,7 +1252,7 @@
 		status = ocfs_allocate_extent(osb, bh, handle,
 					      actualDiskOffset >> osb->sb->s_blocksize_bits,
 					      actualLength >> osb->s_clustersize_bits,
-                                              inode);
+					      inode);
 		if (status < 0) {
 			LOG_ERROR_STATUS (status);
 			goto leave;

Modified: branches/format-changes/src/ocfs.h
===================================================================
--- branches/format-changes/src/ocfs.h	2004-06-10 22:41:37 UTC (rev 1047)
+++ branches/format-changes/src/ocfs.h	2004-06-11 01:07:13 UTC (rev 1048)
@@ -1189,6 +1189,22 @@
 ocfs_local_alloc;
 
 /*
+ * On disk extent list for OCFSv2 (node in the tree)
+ */
+typedef struct _ocfs2_extent_list {
+/*00*/	__s16 l_tree_depth;		/* Extent tree depth from this
+					   point.  -1 means data extents
+					   hang directly off this
+					   header (a leaf) */
+	__u16 l_count;			/* Number of extent records */
+	__u16 l_next_free_rec;		/* Next unused extent slot */
+	__u16 l_reserved1;
+	__u64 l_reserved2;		/* Pad to
+					   sizeof(ocfs2_extent_rec) */
+/*10*/	ocfs2_extent_rec l_recs[0];	/* Extent records */
+} ocfs2_extent_list;
+
+/*
  * On disk inode for OCFS v2
  */
 typedef struct _ocfs2_dinode {
@@ -1251,14 +1267,7 @@
 	__u64 h_next_leaf_blk;		/* Offset on disk, in blocks,
 					   of next leaf header pointing
 					   to data */
-/*30*/	__s16 h_tree_depth;		/* Extent tree depth from this
-					   point.  -1 means data extents
-					   hang directly off this
-					   header (a leaf) */
-	__u16 h_records;		/* Number of extent records */
-	__u16 h_next_free_rec;		/* Next unused extent slot */
-	__u16 h_reserved3;
-/*38*/	ocfs2_extent_rec extents[0];	/* Extent records */
+/*30*/	ocfs2_extent_list h_list;	/* Extent record list */
 } ocfs2_extent_header;
 
 typedef struct _ocfs_dlm_msg_hdr
@@ -1739,12 +1748,13 @@
 					 u64 vbo)
 { 
 	int k;
+	ocfs2_extent_list *el = &eh->h_list;
 	ocfs2_extent_rec *ext;
 	u32 cluster;
 	u64 byte_off;
 
-	for (k = 0; k < eh->h_records; k++) {
-		ext = &eh->extents[k];
+	for (k = 0; k < el->l_count; k++) {
+		ext = &el->l_recs[k];
 
 		cluster = ext->e_cpos + ext->e_clusters;
 		byte_off = cluster << OCFS_SB(sb)->s_clustersize_bits;
@@ -1789,7 +1799,7 @@
 	int size;
 
 	size = sb->s_blocksize -
-		offsetof(struct _ocfs2_extent_header, extents);
+		offsetof(struct _ocfs2_extent_header, h_list.l_recs);
 
 	return size / sizeof(struct _ocfs2_extent_rec);
 }

Modified: branches/format-changes/src/sysfile.c
===================================================================
--- branches/format-changes/src/sysfile.c	2004-06-10 22:41:37 UTC (rev 1047)
+++ branches/format-changes/src/sysfile.c	2004-06-11 01:07:13 UTC (rev 1048)
@@ -589,7 +589,7 @@
 			}
 
 			extent = OCFS_BH_GET_DATA_READ(extent_bh);
-			while (extent->h_tree_depth >= 0) {
+			while (extent->h_list.l_tree_depth >= 0) {
 				__u64 diskoffset;
 
 				if (!IS_VALID_EXTENT_HEADER(extent)) {
@@ -600,15 +600,15 @@
 				k = ocfs_extent_for_offset(osb->sb,
 						     	   extent,
 							   newOffset);
-				if (k == extent->h_records) {
+				if (k == extent->h_list.l_count) {
 					LOG_ERROR_STR ("data extents maxed");
 				}
 
-				if (extent->extents[k].e_blkno == 0) {
+				if (extent->h_list.l_recs[k].e_blkno == 0) {
 					LOG_ERROR_STR ("e_blkno=0");
 				}
 
-				diskoffset = extent->extents[k].e_blkno << osb->sb->s_blocksize_bits;
+				diskoffset = extent->h_list.l_recs[k].e_blkno << osb->sb->s_blocksize_bits;
 
 				OCFS_BH_PUT_DATA(extent_bh);
 				brelse(extent_bh);
@@ -626,21 +626,21 @@
 
 			searchVbo = newOffset;
 
-			OCFS_ASSERT(extent->h_tree_depth == -1);
+			OCFS_ASSERT(extent->h_list.l_tree_depth == -1);
 
 			if (!IS_VALID_EXTENT_HEADER(extent)) {
 				LOG_ERROR_STATUS(status = -EFAIL);
 				goto leave;
 			}
 
-			for (j = 0; j < extent->h_records; j++) {
-				if (((u64)(extent->extents[j].e_cpos + extent->extents[j].e_clusters) << osb->s_clustersize_bits) > newOffset) {
+			for (j = 0; j < extent->h_list.l_count; j++) {
+				if (((u64)(extent->h_list.l_recs[j].e_cpos + extent->h_list.l_recs[j].e_clusters) << osb->s_clustersize_bits) > newOffset) {
 					IoRuns[Runoffset].disk_off =
-						(extent->extents[j].e_blkno << osb->sb->s_blocksize_bits) +
+						(extent->h_list.l_recs[j].e_blkno << osb->sb->s_blocksize_bits) +
 						(newOffset -
-						 ((u64)extent->extents[j].e_cpos << osb->s_clustersize_bits));
+						 ((u64)extent->h_list.l_recs[j].e_cpos << osb->s_clustersize_bits));
 					IoRuns[Runoffset].byte_cnt =
-						(__u32) (((u64)(extent->extents[j].e_cpos + extent->extents[j].e_clusters) << osb->s_clustersize_bits) - newOffset);
+						(__u32) (((u64)(extent->h_list.l_recs[j].e_cpos + extent->h_list.l_recs[j].e_clusters) << osb->s_clustersize_bits) - newOffset);
 					
 					if (IoRuns[Runoffset].
 					    byte_cnt >=
@@ -660,7 +660,7 @@
 						Runs++;
 						Runoffset++;
 						if (Runs >=
-						    extent->h_records)
+						    extent->h_list.l_count)
 						{
 							LOG_ERROR_ARGS ("Runs=%d", Runs);
 						}
@@ -668,7 +668,7 @@
 				}
 			}
 			
-			if (j == extent->h_records) {
+			if (j == extent->h_list.l_count) {
 				OCFS_BH_PUT_DATA(extent_bh);
 				brelse(extent_bh);
 				extent = NULL; extent_bh = NULL;



More information about the Ocfs2-commits mailing list