Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Jul 2010 11:52:33 GMT
From:      Zheng Liu <lz@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 181362 for review
Message-ID:  <201007231152.o6NBqXiE041023@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@181362?ac=10

Change 181362 by lz@gnehzuil-freebsd on 2010/07/23 11:51:52

	       Make ext2fs support EXTRA_ISIZE feature.
	
	       * support feautres:
	               + HAS_JOURNAL (Not support this feautre. It just can read
	                 data when file system is with this feature.)
	               + FILETYPE
	               + SPARSE_SUPER
	               + HUGE_FILE
	               + EXTENTS (Now it just can read data from ext4 extents.)
	               + DIR_NLINK
	               + UNINIT_BG (It don't be required in read-only mode.)
	               + FLEX_BG (It don't be required in read-only mode.)
	               + EXTRA_ISIZE (It don't be required in read-only mode.)

Affected files ...

.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_vfsops.c#9 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2fs.h#5 edit

Differences ...

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

@@ -64,6 +64,7 @@
 #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 *);
@@ -404,6 +405,27 @@
 		fs->e2fs_maxfilesize = 0x7fffffff;
 	else
 		fs->e2fs_maxfilesize = 0x7fffffffffffffff;
+
+        /* check inode size */
+        if (fs->e2fs_isize > E2FS_REV0_INODE_SIZE) {
+                fs->e2fs_want_extra_isize = sizeof(struct ext2fs_dinode) -
+                    E2FS_REV0_INODE_SIZE;
+
+                if (es->e2fs_features_rocompat & EXT4F_ROCOMPAT_EXTRA_ISIZE) {
+                        if (fs->e2fs_want_extra_isize < es->e2fs_want_extra_isize)
+                                fs->e2fs_want_extra_isize = es->e2fs_want_extra_isize;
+                        if (fs->e2fs_want_extra_isize < es->e2fs_min_extra_isize)
+                                fs->e2fs_want_extra_isize = es->e2fs_min_extra_isize;
+                }
+        }
+
+        if (E2FS_REV0_INODE_SIZE + fs->e2fs_want_extra_isize >
+            fs->e2fs_isize) {
+                printf("EXT2-fs: no space for extra inode.\n");
+                return (EIO);
+        }
+
+
 	return (0);
 }
 

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

@@ -221,6 +221,9 @@
         u_int8_t e2fs_log_gpf;    /* FLEX_BG group size */
         int      e2fs_descpbbits;
         struct ext4_flex_groups *e2fs_fg;
+
+        u_int16_t e2fs_min_extra_isize;        /* all inodes have at least some bytes */
+        u_int16_t e2fs_want_extra_isize;       /* new inodes should reserve some bytes */
 };
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007231152.o6NBqXiE041023>