svn commit: r252099 - stable/9/sys/fs/ext2fs

Pedro F. Giffuni pfg at FreeBSD.org
Sat Jun 22 21:32:01 UTC 2013


Author: pfg
Date: Sat Jun 22 21:31:59 2013
New Revision: 252099
URL: http://svnweb.freebsd.org/changeset/base/252099

Log:
  MFC	r251809, r251952, r252012:
  
  Re-sort ext2fs headers to make things easier to find.
  
  In the ext2fs driver we have a mixture of headers:
  
  - The ext2_ prefixed headers have strong influence from NetBSD
  and are carry specific ext2/3/4 information.
  - The unprefixed headers are inspired on UFS and carry implementation
  specific information.
  
  Do some small adjustments so that the information is easier to
  find coming from either UFS or the NetBSD implementation.
  
  Also
  - Set MAXMNTLEN nearer to where it is used.
  - Move EXT2_LINK_MAX to ext2_dir.h .
  - Rename some prefixes in the Block Group Descriptor fields.

Modified:
  stable/9/sys/fs/ext2fs/ext2_alloc.c
  stable/9/sys/fs/ext2fs/ext2_balloc.c
  stable/9/sys/fs/ext2fs/ext2_dinode.h
  stable/9/sys/fs/ext2fs/ext2_dir.h
  stable/9/sys/fs/ext2fs/ext2fs.h
  stable/9/sys/fs/ext2fs/fs.h
  stable/9/sys/fs/ext2fs/inode.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)

Modified: stable/9/sys/fs/ext2fs/ext2_alloc.c
==============================================================================
--- stable/9/sys/fs/ext2fs/ext2_alloc.c	Sat Jun 22 17:28:57 2013	(r252098)
+++ stable/9/sys/fs/ext2fs/ext2_alloc.c	Sat Jun 22 21:31:59 2013	(r252099)
@@ -46,10 +46,10 @@
 #include <sys/syslog.h>
 #include <sys/buf.h>
 
+#include <fs/ext2fs/fs.h>
 #include <fs/ext2fs/inode.h>
 #include <fs/ext2fs/ext2_mount.h>
 #include <fs/ext2fs/ext2fs.h>
-#include <fs/ext2fs/fs.h>
 #include <fs/ext2fs/ext2_extern.h>
 
 static daddr_t	ext2_alloccg(struct inode *, int, daddr_t, int);

Modified: stable/9/sys/fs/ext2fs/ext2_balloc.c
==============================================================================
--- stable/9/sys/fs/ext2fs/ext2_balloc.c	Sat Jun 22 17:28:57 2013	(r252098)
+++ stable/9/sys/fs/ext2fs/ext2_balloc.c	Sat Jun 22 21:31:59 2013	(r252099)
@@ -44,11 +44,13 @@
 #include <sys/mount.h>
 #include <sys/vnode.h>
 
+#include <fs/ext2fs/fs.h>
 #include <fs/ext2fs/inode.h>
 #include <fs/ext2fs/ext2fs.h>
-#include <fs/ext2fs/fs.h>
+#include <fs/ext2fs/ext2_dinode.h>
 #include <fs/ext2fs/ext2_extern.h>
 #include <fs/ext2fs/ext2_mount.h>
+
 /*
  * Balloc defines the structure of filesystem storage
  * by allocating the physical blocks on a device given

Modified: stable/9/sys/fs/ext2fs/ext2_dinode.h
==============================================================================
--- stable/9/sys/fs/ext2fs/ext2_dinode.h	Sat Jun 22 17:28:57 2013	(r252098)
+++ stable/9/sys/fs/ext2fs/ext2_dinode.h	Sat Jun 22 21:31:59 2013	(r252099)
@@ -81,6 +81,16 @@
 				    EXT2F_ROCOMPAT_EXTRA_ISIZE))
 
 /*
+ * Constants relative to the data blocks
+ */
+#define	EXT2_NDIR_BLOCKS		12
+#define	EXT2_IND_BLOCK			EXT2_NDIR_BLOCKS
+#define	EXT2_DIND_BLOCK			(EXT2_IND_BLOCK + 1)
+#define	EXT2_TIND_BLOCK			(EXT2_DIND_BLOCK + 1)
+#define	EXT2_N_BLOCKS			(EXT2_TIND_BLOCK + 1)
+#define EXT2_MAXSYMLINKLEN		(EXT2_N_BLOCKS * sizeof(uint32_t))
+
+/*
  * Structure of an inode on the disk
  */
 struct ext2fs_dinode {

Modified: stable/9/sys/fs/ext2fs/ext2_dir.h
==============================================================================
--- stable/9/sys/fs/ext2fs/ext2_dir.h	Sat Jun 22 17:28:57 2013	(r252098)
+++ stable/9/sys/fs/ext2fs/ext2_dir.h	Sat Jun 22 21:31:59 2013	(r252099)
@@ -53,6 +53,12 @@ struct	ext2fs_direct_2 {
 	uint8_t e2d_type;		/* file type */
 	char e2d_name[EXT2FS_MAXNAMLEN];/* name with length<=EXT2FS_MAXNAMLEN */
 };
+
+/*
+ * Maximal count of links to a file
+ */
+#define EXT2_LINK_MAX	32000
+
 /*
  * Ext2 directory file types.  Only the low 3 bits are used.  The
  * other bits are reserved for now.

Modified: stable/9/sys/fs/ext2fs/ext2fs.h
==============================================================================
--- stable/9/sys/fs/ext2fs/ext2fs.h	Sat Jun 22 17:28:57 2013	(r252098)
+++ stable/9/sys/fs/ext2fs/ext2fs.h	Sat Jun 22 21:31:59 2013	(r252099)
@@ -40,38 +40,6 @@
 #include <sys/types.h>
 
 /*
- * Maximal count of links to a file
- */
-#define EXT2_LINK_MAX		32000
-
-/*
- * A summary of contiguous blocks of various sizes is maintained
- * in each cylinder group. Normally this is set by the initial
- * value of fs_maxcontig.
- *
- * XXX:FS_MAXCONTIG is set to 16 to conserve space. Here we set
- * EXT2_MAXCONTIG to 32 for better performance.
- */
-#define EXT2_MAXCONTIG		32
-
-/*
- * Constants relative to the data blocks
- */
-#define	EXT2_NDIR_BLOCKS		12
-#define	EXT2_IND_BLOCK			EXT2_NDIR_BLOCKS
-#define	EXT2_DIND_BLOCK			(EXT2_IND_BLOCK + 1)
-#define	EXT2_TIND_BLOCK			(EXT2_DIND_BLOCK + 1)
-#define	EXT2_N_BLOCKS			(EXT2_TIND_BLOCK + 1)
-#define EXT2_MAXSYMLINKLEN		(EXT2_N_BLOCKS * sizeof(uint32_t))
-
-/*
- * The path name on which the file system is mounted is maintained
- * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
- * the super block for this name.
- */
-#define MAXMNTLEN 512
-
-/*
  * Super block for an ext2fs file system.
  */
 struct ext2fs {
@@ -141,6 +109,12 @@ struct ext2fs {
 	uint32_t  reserved2[162];	/* Padding to the end of the block */	
 };
 
+/*
+ * The path name on which the file system is mounted is maintained
+ * in fs_fsmnt. MAXMNTLEN defines the amount of space allocated in
+ * the super block for this name.
+ */
+#define MAXMNTLEN 512
 
 /*
  * In-Memory Superblock
@@ -175,11 +149,12 @@ struct m_ext2fs {
 	struct   csum *e2fs_clustersum; /* cluster summary in each cyl group */
 };
 
-/*
- * The second extended file system version
- */
-#define E2FS_DATE		"95/08/09"
-#define E2FS_VERSION		"0.5b"
+/* cluster summary information */
+
+struct csum {
+	int8_t   cs_init; /* cluster summary has been initialized */
+	int32_t *cs_sum;  /* cluster summary array */
+};
 
 /*
  * The second extended file system magic number
@@ -192,9 +167,6 @@ struct m_ext2fs {
 #define E2FS_REV0		0	/* The good old (original) format */
 #define E2FS_REV1		1 	/* V2 format w/ dynamic inode sizes */
 
-#define E2FS_CURRENT_REV	E2FS_REV0
-#define E2FS_MAX_SUPP_REV	E2FS_REV1
-
 #define E2FS_REV0_INODE_SIZE 128
 
 /*
@@ -251,23 +223,6 @@ struct m_ext2fs {
 	( EXT2_SB(sb)->e2fs->e2fs_features_incompat & htole32(mask) )
 
 /*
- * Definitions of behavior on errors
- */
-#define E2FS_BEH_CONTINUE		1	/* continue operation */
-#define E2FS_BEH_READONLY		2	/* remount fs read only */
-#define E2FS_BEH_PANIC			3	/* cause panic */
-#define E2FS_BEH_DEFAULT		E2FS_BEH_CONTINUE
-
-/*
- * OS identification
- */
-#define E2FS_OS_LINUX		0
-#define E2FS_OS_HURD		1
-#define E2FS_OS_MASIX		2
-#define E2FS_OS_FREEBSD		3
-#define E2FS_OS_LITES		4
-
-/*
  * File clean flags
  */
 #define	E2FS_ISCLEAN			0x0001	/* Unmounted cleanly */
@@ -282,20 +237,14 @@ struct ext2_gd {
 	uint16_t ext2bgd_nbfree;	/* number of free blocks */
 	uint16_t ext2bgd_nifree;	/* number of free inodes */
 	uint16_t ext2bgd_ndirs;		/* number of directories */
-	uint16_t ext2bgd_flags;		/* block group flags */
-	uint32_t ext2bgd_x_bitmap;	/* snapshot exclusion bitmap loc. */
-	uint16_t ext2bgd_b_bmap_csum;	/* block bitmap checksum */
-	uint16_t ext2bgd_i_bmap_csum;	/* inode bitmap checksum */
-	uint16_t ext2bgd_i_unused;	/* unused inode count */
-	uint16_t ext2bgd_csum;		/* group descriptor checksum */
+	uint16_t ext4bgd_flags;		/* block group flags */
+	uint32_t ext4bgd_x_bitmap;	/* snapshot exclusion bitmap loc. */
+	uint16_t ext4bgd_b_bmap_csum;	/* block bitmap checksum */
+	uint16_t ext4bgd_i_bmap_csum;	/* inode bitmap checksum */
+	uint16_t ext4bgd_i_unused;	/* unused inode count */
+	uint16_t ext4bgd_csum;		/* group descriptor checksum */
 };
 
-/* cluster summary information */
-
-struct csum {
-	int8_t   cs_init; /* cluster summary has been initialized */
-	int32_t *cs_sum;  /* cluster summary array */
-};
 
 /* EXT2FS metadatas are stored in little-endian byte order. These macros
  * helps reading these metadatas

Modified: stable/9/sys/fs/ext2fs/fs.h
==============================================================================
--- stable/9/sys/fs/ext2fs/fs.h	Sat Jun 22 17:28:57 2013	(r252098)
+++ stable/9/sys/fs/ext2fs/fs.h	Sat Jun 22 21:31:59 2013	(r252099)
@@ -65,6 +65,16 @@
 #define MAXMNTLEN	512
 
 /*
+ * A summary of contiguous blocks of various sizes is maintained
+ * in each cylinder group. Normally this is set by the initial
+ * value of fs_maxcontig.
+ *
+ * XXX:FS_MAXCONTIG is set to 16 to conserve space. Here we set
+ * EXT2_MAXCONTIG to 32 for better performance.
+ */
+#define EXT2_MAXCONTIG	32
+
+/*
  * Grigoriy Orlov <gluk at ptci.ru> has done some extensive work to fine
  * tune the layout preferences for directories within a filesystem.
  * His algorithm can be tuned by adjusting the following parameters

Modified: stable/9/sys/fs/ext2fs/inode.h
==============================================================================
--- stable/9/sys/fs/ext2fs/inode.h	Sat Jun 22 17:28:57 2013	(r252098)
+++ stable/9/sys/fs/ext2fs/inode.h	Sat Jun 22 21:31:59 2013	(r252099)
@@ -41,14 +41,14 @@
 #include <sys/lock.h>
 #include <sys/queue.h>
 
-#define	NDADDR	12			/* Direct addresses in inode. */
-#define	NIADDR	3			/* Indirect addresses in inode. */
-
 /*
  * This must agree with the definition in <ufs/ufs/dir.h>.
  */
 #define	doff_t		int32_t
 
+#define	NDADDR	12			/* Direct addresses in inode. */
+#define	NIADDR	3			/* Indirect addresses in inode. */
+
 /*
  * The inode is used to describe each active (or recently active) file in the
  * EXT2FS filesystem. It is composed of two types of information. The first


More information about the svn-src-all mailing list