Index: linux-2.6.11.7/fs/ext3/extents.c
===================================================================
--- linux-2.6.11.7.orig/fs/ext3/extents.c
+++ linux-2.6.11.7/fs/ext3/extents.c
@@ -2,9 +2,10 @@
  * Copyright (c) 2003, Cluster File Systems, Inc, info@clusterfs.com
  * Written by Alex Tomas <alex@clusterfs.com>
  *
- * Architecture independence:
- *   Copyright (c) 2005, Bull S.A.
- *   Written by Pierre Peiffer <pierre.peiffer@bull.net>
+ * Copyright (c) 2005, BULL SA.
+ * Added by Pierre Peiffer <pierre.peiffer@bull.net>
+ *    - Arch-independence
+ *    - Physical block addressed by a 64 bits integer.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -138,12 +139,13 @@ static int ext3_ext_dirty(handle_t *hand
 	return err;
 }
 
-static int inline
+static long long inline
 ext3_ext_new_block(handle_t *handle, struct ext3_extents_tree *tree,
 			struct ext3_ext_path *path, struct ext3_extent *ex,
 			int *err)
 {
-	int goal, depth, newblock;
+	unsigned long long goal, newblock;
+	int depth;
 	struct inode *inode;
 
 	EXT_ASSERT(tree);
@@ -156,8 +158,8 @@ ext3_ext_new_block(handle_t *handle, str
 		goal = path[depth-1].p_block;
 	} else {
 		struct ext3_inode_info *ei = EXT3_I(inode);
-		unsigned long bg_start;
-		unsigned long colour;
+		unsigned long long bg_start;
+		unsigned long long colour;
 
 		bg_start = (ei->i_block_group *
 				EXT3_BLOCKS_PER_GROUP(inode->i_sb)) +
@@ -238,13 +240,13 @@ static void ext3_ext_show_path(struct ex
 	ext_debug(tree, "path:");
 	for (k = 0; k <= l; k++, path++) {
 		if (path->p_idx) {
-		  ext_debug(tree, "  %d->%d", le32_to_cpu(path->p_idx->ei_block),
-			    le32_to_cpu(path->p_idx->ei_leaf));
+		  ext_debug(tree, "  %d->%lld", le32_to_cpu(path->p_idx->ei_block),
+			    le64_to_cpu(path->p_idx->ei_leaf));
 		} else if (path->p_ext) {
-			ext_debug(tree, "  %d:%d:%d",
+			ext_debug(tree, "  %d:%d:%lld",
 				  le32_to_cpu(path->p_ext->ee_block),
 				  le16_to_cpu(path->p_ext->ee_len),
-				  le32_to_cpu(path->p_ext->ee_start));
+				  le64_to_cpu(path->p_ext->ee_start));
 		} else
 			ext_debug(tree, "  []");
 	}
@@ -268,10 +270,10 @@ static void ext3_ext_show_leaf(struct ex
 	ex = EXT_FIRST_EXTENT(eh);
 
 	for (i = 0; i < le16_to_cpu(eh->eh_entries); i++, ex++) {
-		ext_debug(tree, "%d:%d:%d ",
+		ext_debug(tree, "%d:%d:%lld ",
 				  le32_to_cpu(ex->ee_block),
 				  le16_to_cpu(ex->ee_len),
-				  le32_to_cpu(ex->ee_start));
+				  le64_to_cpu(ex->ee_start));
 	}
 	ext_debug(tree, "\n");
 #endif
@@ -320,17 +322,17 @@ ext3_ext_binsearch_idx(struct ext3_exten
 
 	ix += l;
 	path->p_idx = ix;
-	ext_debug(tree, "  -> %d->%d ",
+	ext_debug(tree, "  -> %d->%lld ",
 		  le32_to_cpu(path->p_idx->ei_block),
-		  le32_to_cpu(path->p_idx->ei_leaf));
+		  le64_to_cpu(path->p_idx->ei_leaf));
 
 	while (l++ < r) {
 	  if (block < le32_to_cpu(ix->ei_block)) 
 			break;
 		path->p_idx = ix++;
 	}
-	ext_debug(tree, "  -> %d->%d\n", le32_to_cpu(path->p_idx->ei_block),
-		  le32_to_cpu(path->p_idx->ei_leaf));
+	ext_debug(tree, "  -> %d->%lld\n", le32_to_cpu(path->p_idx->ei_block),
+		  le64_to_cpu(path->p_idx->ei_leaf));
 
 #ifdef CHECK_BINSEARCH 
 	{
@@ -397,9 +399,9 @@ ext3_ext_binsearch(struct ext3_extents_t
 
 	ex += l;
 	path->p_ext = ex;
-	ext_debug(tree, "  -> %d:%d:%d ",
+	ext_debug(tree, "  -> %d:%lld:%d ",
 		        le32_to_cpu(path->p_ext->ee_block),
-		        le32_to_cpu(path->p_ext->ee_start),
+		        le64_to_cpu(path->p_ext->ee_start),
 		        le16_to_cpu(path->p_ext->ee_len));
 
 	while (l++ < r) {
@@ -483,7 +485,7 @@ ext3_ext_find_extent(struct ext3_extents
 		ext_debug(tree, "depth %d: num %d, max %d\n",
 			  ppos, le16_to_cpu(eh->eh_entries), le16_to_cpu(eh->eh_max));
 		ext3_ext_binsearch_idx(tree, path + ppos, block);
-		path[ppos].p_block = le32_to_cpu(path[ppos].p_idx->ei_leaf);
+		path[ppos].p_block = le64_to_cpu(path[ppos].p_idx->ei_leaf);
 		path[ppos].p_depth = i;
 		path[ppos].p_ext = NULL;
 
@@ -531,7 +533,7 @@ err:
 static int ext3_ext_insert_index(handle_t *handle,
 				struct ext3_extents_tree *tree,
 				struct ext3_ext_path *curp,
-				int logical, int ptr)
+				int logical, long long ptr)
 {
 	struct ext3_extent_idx *ix;
 	int len, err;
@@ -546,7 +548,7 @@ static int ext3_ext_insert_index(handle_
 		if (curp->p_idx != EXT_LAST_INDEX(curp->p_hdr)) {
 			len = (len - 1) * sizeof(struct ext3_extent_idx);
 			len = len < 0 ? 0 : len;
-			ext_debug(tree, "insert new index %d after: %d. "
+			ext_debug(tree, "insert new index %d after: %lld. "
 					"move %d from 0x%p to 0x%p\n",
 					logical, ptr, len,
 					(curp->p_idx + 1), (curp->p_idx + 2));
@@ -557,7 +559,7 @@ static int ext3_ext_insert_index(handle_
 		/* insert before */
 		len = len * sizeof(struct ext3_extent_idx);
 		len = len < 0 ? 0 : len;
-		ext_debug(tree, "insert new index %d before: %d. "
+		ext_debug(tree, "insert new index %d before: %lld. "
 				"move %d from 0x%p to 0x%p\n",
 				logical, ptr, len,
 				curp->p_idx, (curp->p_idx + 1));
@@ -566,7 +568,7 @@ static int ext3_ext_insert_index(handle_
 	}
 
 	ix->ei_block = cpu_to_le32(logical);
-	ix->ei_leaf = cpu_to_le32(ptr);
+	ix->ei_leaf = cpu_to_le64(ptr);
 	curp->p_hdr->eh_entries = cpu_to_le16(le16_to_cpu(curp->p_hdr->eh_entries)+1);
 
 	EXT_ASSERT(le16_to_cpu(curp->p_hdr->eh_entries)
@@ -598,9 +600,9 @@ static int ext3_ext_split(handle_t *hand
 	struct ext3_extent_idx *fidx;
 	struct ext3_extent *ex;
 	int i = at, k, m, a;
-	unsigned long newblock, oldblock;
+	unsigned long long newblock, oldblock;
 	__le32 border;
-	int *ablocks = NULL; /* array of allocated blocks */
+	unsigned long long *ablocks = NULL; /* array of allocated blocks */
 	int err = 0;
 
 	/* make decision: where to split? */
@@ -633,10 +635,10 @@ static int ext3_ext_split(handle_t *hand
 	 * we need this to handle errors and free blocks
 	 * upon them
 	 */
-	ablocks = kmalloc(sizeof(unsigned long) * depth, GFP_NOFS);
+	ablocks = kmalloc(sizeof(unsigned long long) * depth, GFP_NOFS);
 	if (!ablocks)
 		return -ENOMEM;
-	memset(ablocks, 0, sizeof(unsigned long) * depth);
+	memset(ablocks, 0, sizeof(unsigned long long) * depth);
 
 	/* allocate all needed blocks */
 	ext_debug(tree, "allocate %d blocks for indexes/leaf\n", depth - at);
@@ -650,7 +652,7 @@ static int ext3_ext_split(handle_t *hand
 	/* initialize new leaf */
 	newblock = ablocks[--a];
 	EXT_ASSERT(newblock);
-	bh = sb_getblk(tree->inode->i_sb, newblock);
+	bh = sb_getblk(tree->inode->i_sb, (sector_t)newblock);
 	if (!bh) {
 		err = -EIO;
 		goto cleanup;
@@ -675,9 +677,9 @@ static int ext3_ext_split(handle_t *hand
 	path[depth].p_ext++;
 	while (path[depth].p_ext <=
 			EXT_MAX_EXTENT(path[depth].p_hdr)) {
-		ext_debug(tree, "move %d:%d:%d in new leaf %lu\n",
+		ext_debug(tree, "move %d:%lld:%d in new leaf %llu\n",
 			        le32_to_cpu(path[depth].p_ext->ee_block),
-			        le32_to_cpu(path[depth].p_ext->ee_start),
+			        le64_to_cpu(path[depth].p_ext->ee_start),
 			        le16_to_cpu(path[depth].p_ext->ee_len),
 				newblock);
 		/*memmove(ex++, path[depth].p_ext++,
@@ -722,7 +724,7 @@ static int ext3_ext_split(handle_t *hand
 	while (k--) {
 		oldblock = newblock;
 		newblock = ablocks[--a];
-		bh = sb_getblk(tree->inode->i_sb, newblock);
+		bh = sb_getblk(tree->inode->i_sb, (sector_t)newblock);
 		if (!bh) {
 			err = -EIO;
 			goto cleanup;
@@ -739,9 +741,9 @@ static int ext3_ext_split(handle_t *hand
 		neh->eh_depth = cpu_to_le16(depth - i); 
 		fidx = EXT_FIRST_INDEX(neh);
 		fidx->ei_block = border;
-		fidx->ei_leaf = cpu_to_le32(oldblock);
+		fidx->ei_leaf = cpu_to_le64(oldblock);
 
-		ext_debug(tree,	"int.index at %d (block %lu): %lu -> %lu\n",
+		ext_debug(tree,	"int.index at %d (block %llu): %lu -> %llu\n",
 			  i, newblock, le32_to_cpu(border), oldblock);
 		/* copy indexes */
 		m = 0;
@@ -752,10 +754,10 @@ static int ext3_ext_split(handle_t *hand
 		EXT_ASSERT(EXT_MAX_INDEX(path[i].p_hdr) ==
 				EXT_LAST_INDEX(path[i].p_hdr));
 		while (path[i].p_idx <= EXT_MAX_INDEX(path[i].p_hdr)) {
-			ext_debug(tree, "%d: move %d:%d in new index %lu\n",
+			ext_debug(tree, "%d: move %d:%lld in new index %llu\n",
 					i,
 				        le32_to_cpu(path[i].p_idx->ei_block),
-				        le32_to_cpu(path[i].p_idx->ei_leaf),
+				        le64_to_cpu(path[i].p_idx->ei_leaf),
 				        newblock);
 			/*memmove(++fidx, path[i].p_idx++,
 					sizeof(struct ext3_extent_idx));
@@ -807,7 +809,7 @@ cleanup:
 		for (i = 0; i < depth; i++) {
 			if (!ablocks[i])
 				continue;
-			ext3_free_blocks(handle, tree->inode, ablocks[i], 1);
+			ext3_free_blocks(handle, tree->inode, (unsigned long)ablocks[i], 1);
 		}
 	}
 	kfree(ablocks);
@@ -831,7 +833,7 @@ static int ext3_ext_grow_indepth(handle_
 	struct ext3_extent_header *neh;
 	struct ext3_extent_idx *fidx;
 	struct buffer_head *bh;
-	unsigned long newblock;
+	unsigned long long newblock;
 	int err = 0;
 
 	newblock = ext3_ext_new_block(handle, tree, path, newext, &err);
@@ -879,13 +881,13 @@ static int ext3_ext_grow_indepth(handle_
 	curp->p_idx = EXT_FIRST_INDEX(curp->p_hdr);
 	/* FIXME: it works, but actually path[0] can be index */
 	curp->p_idx->ei_block = EXT_FIRST_EXTENT(path[0].p_hdr)->ee_block;
-	curp->p_idx->ei_leaf = cpu_to_le32(newblock);
+	curp->p_idx->ei_leaf = cpu_to_le64(newblock);
 
 	neh = EXT_ROOT_HDR(tree);
 	fidx = EXT_FIRST_INDEX(neh);
-	ext_debug(tree, "new root: num %d(%d), lblock %d, ptr %d\n",
+	ext_debug(tree, "new root: num %d(%d), lblock %d, ptr %lld\n",
 		  le16_to_cpu(neh->eh_entries), le16_to_cpu(neh->eh_max),
-		  le32_to_cpu(fidx->ei_block), le32_to_cpu(fidx->ei_leaf)); 
+		  le32_to_cpu(fidx->ei_block), le64_to_cpu(fidx->ei_leaf));
 
 	neh->eh_depth = cpu_to_le16(path->p_depth + 1);
 	err = ext3_ext_dirty(handle, tree, curp);
@@ -1120,11 +1122,11 @@ int ext3_ext_insert_extent(handle_t *han
 
 	/* try to insert block into found extent and return */
 	if (ex && ext3_can_extents_be_merged(tree, ex, newext)) {
-		ext_debug(tree, "append %d block to %d:%d (from %d)\n",
+		ext_debug(tree, "append %d block to %d:%d (from %lld)\n",
 			        le16_to_cpu(newext->ee_len),
 			        le32_to_cpu(ex->ee_block),
 			        le16_to_cpu(ex->ee_len),
-			        le32_to_cpu(ex->ee_start));
+			        le64_to_cpu(ex->ee_start));
 		if ((err = ext3_ext_get_access(handle, tree, path + depth)))
 			return err;
 		ex->ee_len = cpu_to_le16(le16_to_cpu(ex->ee_len)
@@ -1180,9 +1182,9 @@ has_space:
 
 	if (!nearex) {
 		/* there is no extent in this leaf, create first one */
-		ext_debug(tree, "first extent in the leaf: %d:%d:%d\n",
+		ext_debug(tree, "first extent in the leaf: %d:%lld:%d\n",
 			        le32_to_cpu(newext->ee_block),
-			        le32_to_cpu(newext->ee_start),
+			        le64_to_cpu(newext->ee_start),
 			        le16_to_cpu(newext->ee_len));
 		path[depth].p_ext = EXT_FIRST_EXTENT(eh);
 	} else if (le32_to_cpu(newext->ee_block)
@@ -1192,10 +1194,10 @@ has_space:
 			len = EXT_MAX_EXTENT(eh) - nearex;
 			len = (len - 1) * sizeof(struct ext3_extent);
 			len = len < 0 ? 0 : len;
-			ext_debug(tree, "insert %d:%d:%d after: nearest 0x%p, "
+			ext_debug(tree, "insert %d:%lld:%d after: nearest 0x%p, "
 					"move %d from 0x%p to 0x%p\n",
 				        le32_to_cpu(newext->ee_block),
-				        le32_to_cpu(newext->ee_start),
+				        le64_to_cpu(newext->ee_start),
 				        le16_to_cpu(newext->ee_len),
 					nearex, len, nearex + 1, nearex + 2);
 			memmove(nearex + 2, nearex + 1, len);
@@ -1205,10 +1207,10 @@ has_space:
  		EXT_ASSERT(newext->ee_block != nearex->ee_block);
 		len = (EXT_MAX_EXTENT(eh) - nearex) * sizeof(struct ext3_extent);
 		len = len < 0 ? 0 : len;
-		ext_debug(tree, "insert %d:%d:%d before: nearest 0x%p, "
+		ext_debug(tree, "insert %d:%lld:%d before: nearest 0x%p, "
 				"move %d from 0x%p to 0x%p\n",
 				le32_to_cpu(newext->ee_block),
-				le32_to_cpu(newext->ee_start),
+				le64_to_cpu(newext->ee_start),
 				le16_to_cpu(newext->ee_len),
 				nearex, len, nearex + 1, nearex + 2);
 		memmove(nearex + 1, nearex, len);
@@ -1220,8 +1222,6 @@ has_space:
 	nearex->ee_block = newext->ee_block;
 	nearex->ee_start = newext->ee_start;
 	nearex->ee_len = newext->ee_len;
-	/* FIXME: support for large fs */
-	nearex->ee_start_hi = 0;
 
 merge:
 	/* try to merge extents to the right */
@@ -1331,7 +1331,7 @@ int ext3_ext_walk_space(struct ext3_exte
 		} else {
 		        cbex.ec_block = le32_to_cpu(ex->ee_block);
 		        cbex.ec_len = le16_to_cpu(ex->ee_len);
-		        cbex.ec_start = le32_to_cpu(ex->ee_start);
+		        cbex.ec_start = le64_to_cpu(ex->ee_start);
 			cbex.ec_type = EXT3_EXT_CACHE_EXTENT;
 		}
 
@@ -1368,7 +1368,7 @@ int ext3_ext_walk_space(struct ext3_exte
 
 static inline void
 ext3_ext_put_in_cache(struct ext3_extents_tree *tree, __u32 block,
-			__u32 len, __u32 start, int type)
+			__u32 len, __u64 start, int type)
 {
 	EXT_ASSERT(len > 0);
 	if (tree->cex) {
@@ -1446,13 +1446,13 @@ ext3_ext_in_cache(struct ext3_extents_tr
 			cex->ec_type == EXT3_EXT_CACHE_EXTENT);
 	if (block >= cex->ec_block && block < cex->ec_block + cex->ec_len) {
 	        ex->ee_block = cpu_to_le32(cex->ec_block);
-	        ex->ee_start = cpu_to_le32(cex->ec_start);
+	        ex->ee_start = cpu_to_le64(cex->ec_start);
 	        ex->ee_len = cpu_to_le16(cex->ec_len);
-		ext_debug(tree, "%lu cached by %lu:%lu:%lu\n",
+		ext_debug(tree, "%lu cached by %lu:%lu:%llu\n",
 				(unsigned long) block,
 				(unsigned long) cex->ec_block,
 				(unsigned long) cex->ec_len,
-				(unsigned long) cex->ec_start);
+				(unsigned long long) cex->ec_start);
 		return cex->ec_type;
 	}
 
@@ -1470,22 +1470,22 @@ int ext3_ext_rm_idx(handle_t *handle, st
 {
 	struct buffer_head *bh;
 	int err;
-	unsigned long leaf;
+	unsigned long long leaf;
 	
 	/* free index block */
 	path--;
-	leaf = le32_to_cpu(path->p_idx->ei_leaf);
+	leaf = le64_to_cpu(path->p_idx->ei_leaf);
 	EXT_ASSERT(path->p_hdr->eh_entries);
 	if ((err = ext3_ext_get_access(handle, tree, path)))
 		return err;
 	path->p_hdr->eh_entries = cpu_to_le16(le16_to_cpu(path->p_hdr->eh_entries)-1);
 	if ((err = ext3_ext_dirty(handle, tree, path)))
 		return err;
-	ext_debug(tree, "index is empty, remove it, free block %d\n",
+	ext_debug(tree, "index is empty, remove it, free block %lld\n",
 		        leaf);
-	bh = sb_find_get_block(tree->inode->i_sb, leaf);
-	ext3_forget(handle, 1, tree->inode, bh, leaf);
-	ext3_free_blocks(handle, tree->inode, leaf, 1);
+	bh = sb_find_get_block(tree->inode->i_sb, (sector_t)leaf);
+	ext3_forget(handle, 1, tree->inode, bh, (int)leaf);
+	ext3_free_blocks(handle, tree->inode, (int)leaf, 1);
 	return err;
 }
 
@@ -1698,8 +1698,8 @@ ext3_ext_rm_leaf(handle_t *handle, struc
 		if (err)
 			goto out;
 
-		ext_debug(tree, "new extent: %u:%u:%u\n",
-			        block, num, le32_to_cpu(ex->ee_start));
+		ext_debug(tree, "new extent: %u:%u:%llu\n",
+			        block, num, le64_to_cpu(ex->ee_start));
 		ex--;
 		ex_ee_block = le32_to_cpu(ex->ee_block);
 		ex_ee_len = le16_to_cpu(ex->ee_len);
@@ -1835,11 +1835,11 @@ int ext3_ext_remove_space(struct ext3_ex
 				path[i].p_idx);
 		if (ext3_ext_more_to_rm(path + i)) {
 			/* go to the next level */
-			ext_debug(tree, "move to level %d (block %d)\n",
-				  i + 1, le32_to_cpu(path[i].p_idx->ei_leaf));
+			ext_debug(tree, "move to level %d (block %lld)\n",
+				  i + 1, le64_to_cpu(path[i].p_idx->ei_leaf));
 			memset(path + i + 1, 0, sizeof(*path));
 			path[i+1].p_bh =
-			  sb_bread(sb, le32_to_cpu(path[i].p_idx->ei_leaf));
+			  sb_bread(sb, (int)le64_to_cpu(path[i].p_idx->ei_leaf));
 			if (!path[i+1].p_bh) {
 				/* should we reset i_size? */
 				err = -EIO;
@@ -1985,8 +1985,8 @@ static int ext3_ext_mergable(struct ext3
 				struct ext3_extent *ex2)
 {
 	/* FIXME: support for large fs */
-        if (le32_to_cpu(ex1->ee_start) + le16_to_cpu(ex1->ee_len)
-	    == le32_to_cpu(ex2->ee_start))
+        if (le64_to_cpu(ex1->ee_start) + le16_to_cpu(ex1->ee_len)
+	    == le64_to_cpu(ex2->ee_start))
 		return 1;
 	return 0;
 }
@@ -2038,10 +2038,11 @@ ext3_remove_blocks(struct ext3_extents_t
 	if (from >= le32_to_cpu(ex->ee_block)
 	    && to == le32_to_cpu(ex->ee_block) + le16_to_cpu(ex->ee_len) - 1) {
 		/* tail removal */
-		unsigned long num, start;
+	        unsigned long num;
+		unsigned long long start;
 		num = le32_to_cpu(ex->ee_block) + le16_to_cpu(ex->ee_len) - from;
-		start = le32_to_cpu(ex->ee_start) + le16_to_cpu(ex->ee_len) - num;
-		ext_debug(tree, "free last %lu blocks starting %lu\n",
+		start = le64_to_cpu(ex->ee_start) + le16_to_cpu(ex->ee_len) - num;
+		ext_debug(tree, "free last %lu blocks starting %llu\n",
 				num, start);
 		for (i = 0; i < num; i++) {
 			bh = sb_find_get_block(tree->inode->i_sb, start + i);
@@ -2060,7 +2061,7 @@ ext3_remove_blocks(struct ext3_extents_t
 	return 0;
 }
 
-static int ext3_ext_find_goal(struct inode *inode,
+static long long ext3_ext_find_goal(struct inode *inode,
 				struct ext3_ext_path *path, unsigned long block)
 {
 	struct ext3_inode_info *ei = EXT3_I(inode);
@@ -2074,7 +2075,7 @@ static int ext3_ext_find_goal(struct ino
 		
 		/* try to predict block placement */
 		if ((ex = path[depth].p_ext))
-		        return le32_to_cpu(ex->ee_start)
+		        return le64_to_cpu(ex->ee_start)
 			       + (block - le32_to_cpu(ex->ee_block));
 
 		/* it looks index is empty
@@ -2091,12 +2092,12 @@ static int ext3_ext_find_goal(struct ino
 	return bg_start + colour + block;
 }
 
-static int ext3_new_block_cb(handle_t *handle, struct ext3_extents_tree *tree,
+static long long ext3_new_block_cb(handle_t *handle, struct ext3_extents_tree *tree,
 				struct ext3_ext_path *path,
 				struct ext3_extent *ex, int *err)
 {
 	struct inode *inode = tree->inode;
-	int newblock, goal;
+	long long newblock, goal;
 	unsigned short len;
 	
 	EXT_ASSERT(path);
@@ -2105,20 +2106,20 @@ static int ext3_new_block_cb(handle_t *h
 	EXT_ASSERT(ex->ee_len);
 	
 	/* reuse block from the extent to order data/metadata */
-	newblock = le32_to_cpu(ex->ee_start);
+	newblock = le64_to_cpu(ex->ee_start);
 	len = le16_to_cpu(ex->ee_len) - 1;
 	if (len == 0) {
 		/* allocate new block for the extent */
 		goal = ext3_ext_find_goal(inode, path, le32_to_cpu(ex->ee_block));
-		ex->ee_start = cpu_to_le32(ext3_new_block(handle, inode, goal, err));
+		ex->ee_start = cpu_to_le64(ext3_new_block(handle, inode, goal, err));
 		if (ex->ee_start == 0) {
 			/* error occured: restore old extent */
-		        ex->ee_start = cpu_to_le32(newblock);
+		        ex->ee_start = cpu_to_le64(newblock);
 			return 0;
 		}
 	}
 	else {
-	  ex->ee_start = cpu_to_le32(newblock+1);
+	  ex->ee_start = cpu_to_le64(newblock+1);
 	  ex->ee_len = cpu_to_le16(len);
 	}
 	return newblock;
@@ -2151,7 +2152,8 @@ int ext3_ext_get_block(handle_t *handle,
 	struct ext3_ext_path *path = NULL;
 	struct ext3_extent newex;
 	struct ext3_extent *ex;
-	int goal, newblock, err = 0, depth;
+	long long goal, newblock;
+	int err = 0, depth;
 	struct ext3_extents_tree tree;
 
 	__clear_bit(BH_New, &bh_result->b_state);
@@ -2173,7 +2175,7 @@ int ext3_ext_get_block(handle_t *handle,
 			/* block is already allocated */
 		        newblock = iblock
 		                   - le32_to_cpu(newex.ee_block)
-			           + le32_to_cpu(newex.ee_start);
+			           + le64_to_cpu(newex.ee_start);
 			goto out;
 		} else {
 			EXT_ASSERT(0);
@@ -2199,13 +2201,13 @@ int ext3_ext_get_block(handle_t *handle,
 
 	if ((ex = path[depth].p_ext)) {
 	        unsigned long ee_block = le32_to_cpu(ex->ee_block);
-		unsigned long ee_start = le32_to_cpu(ex->ee_start);
+		unsigned long long ee_start = le64_to_cpu(ex->ee_start);
 		unsigned short ee_len  = le16_to_cpu(ex->ee_len);
 		/* if found exent covers block, simple return it */
 	        if (iblock >= ee_block
 		    && iblock < ee_block + ee_len) {
 			newblock = iblock - ee_block + ee_start;
-			ext_debug(&tree, "%d fit into %d:%d -> %d\n",
+			ext_debug(&tree, "%d fit into %d:%d -> %lld\n",
 					(int) iblock, ee_block, ee_len,
 					newblock);
 			ext3_ext_put_in_cache(&tree, ee_block,
@@ -2230,12 +2232,12 @@ int ext3_ext_get_block(handle_t *handle,
 	newblock = ext3_new_block(handle, inode, goal, &err);
 	if (!newblock)
 		goto out2;
-	ext_debug(&tree, "allocate new block: goal %d, found %d\n",
+	ext_debug(&tree, "allocate new block: goal %d, found %lld\n",
 			goal, newblock);
 
 	/* try to insert new extent into found leaf and return */
 	newex.ee_block = cpu_to_le32(iblock);
-	newex.ee_start = cpu_to_le32(newblock);
+	newex.ee_start = cpu_to_le64(newblock);
 	newex.ee_len = cpu_to_le16(1);
 	err = ext3_ext_insert_extent(handle, &tree, path, &newex);
 	if (err)
@@ -2245,7 +2247,7 @@ int ext3_ext_get_block(handle_t *handle,
 		EXT3_I(inode)->i_disksize = inode->i_size;
 
 	/* previous routine could use block we allocated */
-	newblock = le32_to_cpu(newex.ee_start);
+	newblock = le64_to_cpu(newex.ee_start);
 	__set_bit(BH_New, &bh_result->b_state);
 
 	ext3_ext_put_in_cache(&tree, iblock, 1,
Index: linux-2.6.11.7/include/linux/ext3_extents.h
===================================================================
--- linux-2.6.11.7.orig/include/linux/ext3_extents.h
+++ linux-2.6.11.7/include/linux/ext3_extents.h
@@ -78,8 +78,7 @@ do {							\
 struct ext3_extent {
 	__le32	ee_block;	/* first logical block extent covers */
 	__le16	ee_len;		/* number of blocks covered by extent */
-	__le16	ee_start_hi;	/* high 16 bits of physical block */
-	__le32	ee_start;	/* low 32 bigs of physical block */
+	__le64	ee_start;	/* physical block */
 };
 
 /*
@@ -88,10 +87,9 @@ struct ext3_extent {
  */
 struct ext3_extent_idx {
 	__le32	ei_block;	/* index covers logical blocks from 'block' */
-	__le32	ei_leaf;	/* pointer to the physical block of the next *
+	__le64	ei_leaf;	/* pointer to the physical block of the next *
 				 * level. leaf or next index could bet here */
-	__le16	ei_leaf_hi;	/* high 16 bits of physical block */
-	__u16	ei_unused;
+
 };
 
 /*
@@ -113,7 +111,7 @@ struct ext3_extent_header {	
  * truncate uses it to simulate recursive walking
  */
 struct ext3_ext_path {
-	__u32				p_block;
+	__u64				p_block;
 	__u16				p_depth;
 	struct ext3_extent		*p_ext;
 	struct ext3_extent_idx		*p_idx;
@@ -129,7 +127,7 @@ struct ext3_ext_path {
  * storage for cached extent
  */
 struct ext3_ext_cache {
-	__u32	ec_start;
+	__u64	ec_start;
 	__u32	ec_block;
 	__u32	ec_len;
 	__u32	ec_type;
@@ -164,7 +162,7 @@ struct ext3_extents_helpers {
 	int (*remove_extent)(struct ext3_extents_tree *,
 				struct ext3_extent *, unsigned long,
 				unsigned long);
-	int (*new_block)(handle_t *, struct ext3_extents_tree *,
+	long long (*new_block)(handle_t *, struct ext3_extents_tree *,
 				struct ext3_ext_path *, struct ext3_extent *,
 				int *);
 };
