[RFC][E2FSPROGS][PATCH 6/8]

Alexandre Ratchov <[email protected]>
Newsgroups gmane.comp.file-systems.ext2.devel
Message-ID <[email protected]>
Introduce 64bit extents physical block number.


Index: e2fsprogs-upstream/lib/ext2fs/block.c
===================================================================
--- e2fsprogs-upstream.orig/lib/ext2fs/block.c	2006-05-18 13:58:48.000000000 +0200
+++ e2fsprogs-upstream/lib/ext2fs/block.c	2006-05-18 13:58:53.000000000 +0200
@@ -55,7 +55,7 @@
         ix = EXT_FIRST_INDEX(eh);
         printf("this node has %d indexs\n",eh->e_num);
         for (i = 0; i < eh->eh_entries; i++, ix++) {
-                printf("index %d, block = %d, leaf = %d\n", i,
+                printf("index %d, block = %d, leaf = %llu\n", i,
 		       ix->ei_block, ix->ei_leaf);
         }
 }
@@ -120,7 +120,7 @@
 			}
 			nh = (struct ext3_extent_header *)block_buf;
 			show_header(nh);
-			if (nh->eh_magic != EXT3_EXT_MAGIC)
+			if (nh->eh_magic != EXT3_EXT64_MAGIC)
 			{
 				ret |= BLOCK_ERROR;
 				ext2fs_free_mem(&block_buf);
@@ -462,7 +462,7 @@
         ext2fs_read_inode(fs, ino, &inode);
         if (inode.i_flags & EXT3_EXTENTS_FL) {
                 eh = (struct ext3_extent_header *)&inode.i_block[0];
-                if (eh->eh_magic == EXT3_EXT_MAGIC) {
+                if (eh->eh_magic == EXT3_EXT64_MAGIC) {
 		        show_header(eh);
                         ret = block_iterate_extents(eh, fs, &ctx);
                         goto abort_exit;
Index: e2fsprogs-upstream/lib/ext2fs/bmap.c
===================================================================
--- e2fsprogs-upstream.orig/lib/ext2fs/bmap.c	2006-05-18 13:58:48.000000000 +0200
+++ e2fsprogs-upstream/lib/ext2fs/bmap.c	2006-05-18 13:58:53.000000000 +0200
@@ -64,7 +64,7 @@
 				return BLOCK_ERROR;
 			}
 			nh = (struct ext3_extent_header *)block_buf;
-			if (nh->eh_magic != EXT3_EXT_MAGIC) {
+			if (nh->eh_magic != EXT3_EXT64_MAGIC) {
 				ext2fs_free_mem(&block_buf);
 				return BLOCK_ERROR;
 			}
@@ -203,7 +203,7 @@
 
 	if (inode->i_flags & EXT3_EXTENTS_FL) {
 		eh = (struct ext3_extent_header *)&inode->i_block[0];
-		if (eh->eh_magic == EXT3_EXT_MAGIC)
+		if (eh->eh_magic == EXT3_EXT64_MAGIC)
 			return block_extents_bmap(eh, fs, block, phys_blk);
 		else
 			return BLOCK_ERROR;
Index: e2fsprogs-upstream/lib/ext2fs/mkdir.c
===================================================================
--- e2fsprogs-upstream.orig/lib/ext2fs/mkdir.c	2006-05-18 13:58:48.000000000 +0200
+++ e2fsprogs-upstream/lib/ext2fs/mkdir.c	2006-05-18 13:59:30.000000000 +0200
@@ -91,7 +91,7 @@
 		struct ext3_extent_header *eh = (struct ext3_extent_header *)inode.i_block;
 		struct ext3_extent *ex = EXT_FIRST_EXTENT(eh);
 
-		 eh->eh_magic = EXT3_EXT_MAGIC;
+		 eh->eh_magic = EXT3_EXT64_MAGIC;
 		 eh->eh_depth = 0;
 		 eh->eh_entries = 1;
 		 eh->eh_max = (sizeof(inode.i_block) - sizeof(struct ext3_extent_header))
Index: e2fsprogs-upstream/lib/ext2fs/ext3_extents.h
===================================================================
--- e2fsprogs-upstream.orig/lib/ext2fs/ext3_extents.h	2006-05-18 13:58:48.000000000 +0200
+++ e2fsprogs-upstream/lib/ext2fs/ext3_extents.h	2006-05-18 13:58:53.000000000 +0200
@@ -71,8 +71,7 @@
 struct ext3_extent {
 	__u32	ee_block;	/* first logical block extent covers */
 	__u16	ee_len;		/* number of blocks covered by extent */
-	__u16	ee_start_hi;	/* high 16 bits of physical block */
-	__u32	ee_start;	/* low 32 bigs of physical block */
+	__u64	ee_start;	/* physical block */
 };
 
 /*
@@ -81,10 +80,8 @@
  */
 struct ext3_extent_idx {
 	__u32	ei_block;	/* index covers logical blocks from 'block' */
-	__u32	ei_leaf;	/* pointer to the physical block of the next *
+	__u64	ei_leaf;	/* pointer to the physical block of the next *
 				 * level. leaf or next index could bet here */
-	__u16	ei_leaf_hi;	/* high 16 bits of physical block */
-	__u16	ei_unused;
 };
 
 /*
@@ -98,7 +95,8 @@
 	__u32	eh_generation;	/* generation of the tree */
 };
 
-#define EXT3_EXT_MAGIC		0xf30a
+#define EXT3_EXT48_MAGIC		0xf30a
+#define EXT3_EXT64_MAGIC		0xf30b
 
 /*
  * array of ext3_ext_path contains path to some extent
@@ -106,7 +104,7 @@
  * 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;


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.