PERFORCE change 180233 for review

Zheng Liu lz at FreeBSD.org
Sat Jun 26 07:10:31 UTC 2010


http://p4web.freebsd.org/@@180233?ac=10

Change 180233 by lz at gnehzuil-freebsd on 2010/06/26 07:10:18

	       Modify ext2_vget to adapt ext4 file system.

Affected files ...

.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_dinode.h#3 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_inode_cnv.c#3 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_vfsops.c#3 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/inode.h#3 edit

Differences ...

==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_dinode.h#3 (text+ko) ====

@@ -63,14 +63,14 @@
 struct ext2fs_dinode {
 	u_int16_t	e2di_mode;	/*   0: IFMT, permissions; see below. */
 	u_int16_t	e2di_uid;	/*   2: Owner UID */
-	u_int32_t	e2di_size;	/*	 4: Size (in bytes) */
+	u_int32_t	e2di_size_lo;	/*	 4: Size (in bytes) */
 	u_int32_t	e2di_atime;	/*	 8: Access time */
 	u_int32_t	e2di_ctime;	/*	12: Create time */
 	u_int32_t	e2di_mtime;	/*	16: Modification time */
 	u_int32_t	e2di_dtime;	/*	20: Deletion time */
 	u_int16_t	e2di_gid;	/*  24: Owner GID */
 	u_int16_t	e2di_nlink;	/*  26: File link count */
-	u_int32_t	e2di_nblock;	/*  28: Blocks count */
+	u_int32_t	e2di_nblock_lo;	/*  28: Blocks count */
 	u_int32_t	e2di_flags;	/*  32: Status flags (chflags) */
         union {
                 struct {
@@ -92,6 +92,7 @@
         union {
                 struct {
                         u_int16_t e2di_l_blk_high;
+#define e2di_nblock_high        osd2.linux2.e2di_l_blk_high
                         u_int16_t e2di_l_facl_high;
                         u_int16_t e2di_l_uid_high;
                         u_int16_t e2di_l_gid_high;

==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_inode_cnv.c#3 (text+ko) ====

@@ -49,7 +49,7 @@
 	printf( "User: %5lu Group: %5lu  Size: %lu\n",
 		(unsigned long)in->i_uid, (unsigned long)in->i_gid,
 		(unsigned long)in->i_size);
-	printf( "Links: %3d Blockcount: %d\n",
+	printf( "Links: %3d Blockcount: %lld\n",
 		in->i_nlink, in->i_blocks);
 	printf( "ctime: 0x%x", in->i_ctime);
 	printf( "atime: 0x%x", in->i_atime);
@@ -77,7 +77,7 @@
 	   I can see that this might lead to problems in an undelete.
 	*/
 	ip->i_mode = ei->e2di_nlink ? ei->e2di_mode : 0;
-	ip->i_size = ei->e2di_size;
+	ip->i_size = ei->e2di_size_lo;
 	if (S_ISREG(ip->i_mode))
 		ip->i_size |= ((u_int64_t)ei->e2di_size_high) << 32;
 	ip->i_atime = ei->e2di_atime;
@@ -87,7 +87,10 @@
 	ip->i_flags |= (ei->e2di_flags & EXT2_APPEND) ? SF_APPEND : 0;
 	ip->i_flags |= (ei->e2di_flags & EXT2_IMMUTABLE) ? SF_IMMUTABLE : 0;
 	ip->i_flags |= (ei->e2di_flags & EXT2_NODUMP) ? UF_NODUMP : 0;
-	ip->i_blocks = ei->e2di_nblock;
+        if (ip->i_e2fs->e2fs->e2fs_features_incompat & EXT4F_ROCOMPAT_HUGE_FILE)
+                ip->i_blocks = ((int64_t)(ei->e2di_nblock_high)) << 32 | ei->e2di_nblock_lo;
+        else
+                ip->i_blocks = ei->e2di_nblock_lo;
 	ip->i_gen = ei->e2di_gen;
 	ip->i_uid = ei->e2di_uid;
 	ip->i_gid = ei->e2di_gid;
@@ -115,7 +118,7 @@
 	   has been deleted, this would correspond to a zero link count
 	 */
 	ei->e2di_dtime = ei->e2di_nlink ? 0 : ip->i_mtime;
-	ei->e2di_size = ip->i_size;
+	ei->e2di_size_lo = ip->i_size;
 	if (S_ISREG(ip->i_mode))
 		ei->e2di_size_high = ip->i_size >> 32;
 	ei->e2di_atime = ip->i_atime;
@@ -126,7 +129,7 @@
 	ei->e2di_flags |= (ip->i_flags & SF_APPEND) ? EXT2_APPEND: 0;
 	ei->e2di_flags |= (ip->i_flags & SF_IMMUTABLE) ? EXT2_IMMUTABLE: 0;
 	ei->e2di_flags |= (ip->i_flags & UF_NODUMP) ? EXT2_NODUMP: 0;
-	ei->e2di_nblock = ip->i_blocks;
+	ei->e2di_nblock_lo = ip->i_blocks;
 	ei->e2di_gen = ip->i_gen;
 	ei->e2di_uid = ip->i_uid;
 	ei->e2di_gid = ip->i_gid;

==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_vfsops.c#3 (text+ko) ====

@@ -61,6 +61,8 @@
 #include <fs/ext2fs/fs.h>
 #include <fs/ext2fs/ext2_extern.h>
 #include <fs/ext2fs/ext2fs.h>
+#include <fs/ext2fs/ext2_dinode.h>
+
 
 static int	ext2_flushfiles(struct mount *mp, int flags, struct thread *td);
 static int	ext2_mountfs(struct vnode *, struct mount *);
@@ -945,6 +947,7 @@
 		for(i = used_blocks; i < EXT2_NDIR_BLOCKS; i++)
 			ip->i_db[i] = 0;
 	}
+
 /*
 	ext2_print_inode(ip);
 */

==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/inode.h#3 (text+ko) ====

@@ -97,7 +97,7 @@
 	int32_t		i_db[NDADDR];	/* Direct disk blocks. */
 	int32_t		i_ib[NIADDR];	/* Indirect disk blocks. */
 	u_int32_t	i_flags;	/* Status flags (chflags). */
-	int32_t		i_blocks;	/* Blocks actually held. */
+	int64_t		i_blocks;	/* Blocks actually held. */
 	int32_t		i_gen;		/* Generation number. */
 	u_int32_t	i_uid;		/* File owner. */
 	u_int32_t	i_gid;		/* File group. */


More information about the p4-projects mailing list