PERFORCE change 179744 for review
Zheng Liu
lz at FreeBSD.org
Fri Jun 18 03:45:44 UTC 2010
http://p4web.freebsd.org/@@179744?ac=10
Change 179744 by lz at gnehzuil-freebsd on 2010/06/18 03:45:38
Modify super block, inode and group descriptor data structures to
adapt to ext4 file system.
Affected files ...
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_alloc.c#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_balloc.c#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_bmap.c#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_dinode.h#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_dir.h#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_extern.h#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_inode.c#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_inode_cnv.c#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_lookup.c#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_mount.h#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_readwrite.c#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_rsv_win.h#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_subr.c#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_vfsops.c#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_vnops.c#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2fs.h#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/fs.h#2 edit
.. //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/inode.h#2 edit
Differences ...
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_alloc.c#2 (text+ko) ====
@@ -116,7 +116,7 @@
ump = ip->i_ump;
bbp = (char *)bp->b_data;
- if (fs->e2fs_gd[cg].ext2bgd_nbfree == 0)
+ if (fs->e2fs_gd[cg].ext2bgd_nbfree_lo == 0)
return (0);
if (bpref < 0)
@@ -174,8 +174,8 @@
gotit:
setbit(bbp, (daddr_t)bno);
EXT2_LOCK(ump);
- fs->e2fs->e2fs_fbcount--;
- fs->e2fs_gd[cg].ext2bgd_nbfree--;
+ fs->e2fs->e2fs_fbcount_lo--;
+ fs->e2fs_gd[cg].ext2bgd_nbfree_lo--;
fs->e2fs_fmod = 1;
EXT2_UNLOCK(ump);
bdwrite(bp);
@@ -492,13 +492,13 @@
ump = ip->i_ump;
mtx_assert(EXT2_MTX(ump), MA_OWNED);
- if (size == fs->e2fs_bsize && fs->e2fs->e2fs_fbcount == 0)
+ if (size == fs->e2fs_bsize && fs->e2fs->e2fs_fbcount_lo == 0)
goto nospace;
if (cred->cr_uid != 0 &&
- fs->e2fs->e2fs_fbcount < fs->e2fs->e2fs_rbcount)
+ fs->e2fs->e2fs_fbcount_lo < fs->e2fs->e2fs_rbcount_lo)
goto nospace;
- if (bpref >= fs->e2fs->e2fs_bcount)
+ if (bpref >= fs->e2fs->e2fs_bcount_lo)
bpref = 0;
if (bpref == 0)
cg = ino_to_cg(fs, ip->i_number);
@@ -506,11 +506,11 @@
cg = dtog(fs, bpref);
/* If cg has some free blocks, then try to allocate a free block from this cg */
- if (fs->e2fs_gd[cg].ext2bgd_nbfree > 0) {
+ if (fs->e2fs_gd[cg].ext2bgd_nbfree_lo > 0) {
/* Read block bitmap from buffer */
EXT2_UNLOCK(ump);
error = bread(ip->i_devvp,
- fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap),
+ fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap_lo),
(int)fs->e2fs_bsize, NOCRED, &bp);
if (error) {
brelse(bp);
@@ -531,11 +531,11 @@
/* Just need to try to allocate a free block from rest groups. */
cg = (cg + 1) % fs->e2fs_gcount;
for (i = 1; i < fs->e2fs_gcount; i++) {
- if (fs->e2fs_gd[cg].ext2bgd_nbfree > 0) {
+ if (fs->e2fs_gd[cg].ext2bgd_nbfree_lo > 0) {
/* Read block bitmap from buffer */
EXT2_UNLOCK(ump);
error = bread(ip->i_devvp,
- fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap),
+ fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap_lo),
(int)fs->e2fs_bsize, NOCRED, &bp);
if (error) {
brelse(bp);
@@ -602,12 +602,12 @@
if (cred == NOCRED)
panic("ext2_alloc: missing credential");
#endif /* DIAGNOSTIC */
- if (size == fs->e2fs_bsize && fs->e2fs->e2fs_fbcount == 0)
+ if (size == fs->e2fs_bsize && fs->e2fs->e2fs_fbcount_lo == 0)
goto nospace;
if (cred->cr_uid != 0 &&
- fs->e2fs->e2fs_fbcount < fs->e2fs->e2fs_rbcount)
+ fs->e2fs->e2fs_fbcount_lo < fs->e2fs->e2fs_rbcount_lo)
goto nospace;
- if (bpref >= fs->e2fs->e2fs_bcount)
+ if (bpref >= fs->e2fs->e2fs_bcount_lo)
bpref = 0;
if (bpref == 0)
cg = ino_to_cg(fs, ip->i_number);
@@ -929,7 +929,7 @@
fs = pip->i_e2fs;
avgifree = fs->e2fs->e2fs_ficount / fs->e2fs_gcount;
- avgbfree = fs->e2fs->e2fs_fbcount / fs->e2fs_gcount;
+ avgbfree = fs->e2fs->e2fs_fbcount_lo / fs->e2fs_gcount;
avgndir = fs->e2fs_total_dir / fs->e2fs_gcount;
/*
@@ -941,18 +941,18 @@
mincg = prefcg;
minndir = fs->e2fs_ipg;
for (cg = prefcg; cg < fs->e2fs_gcount; cg++)
- if (fs->e2fs_gd[cg].ext2bgd_ndirs < minndir &&
- fs->e2fs_gd[cg].ext2bgd_nifree >= avgifree &&
- fs->e2fs_gd[cg].ext2bgd_nbfree >= avgbfree) {
+ if (fs->e2fs_gd[cg].ext2bgd_ndirs_lo < minndir &&
+ fs->e2fs_gd[cg].ext2bgd_nifree_lo >= avgifree &&
+ fs->e2fs_gd[cg].ext2bgd_nbfree_lo >= avgbfree) {
mincg = cg;
- minndir = fs->e2fs_gd[cg].ext2bgd_ndirs;
+ minndir = fs->e2fs_gd[cg].ext2bgd_ndirs_lo;
}
for (cg = 0; cg < prefcg; cg++)
- if (fs->e2fs_gd[cg].ext2bgd_ndirs < minndir &&
- fs->e2fs_gd[cg].ext2bgd_nifree >= avgifree &&
- fs->e2fs_gd[cg].ext2bgd_nbfree >= avgbfree) {
+ if (fs->e2fs_gd[cg].ext2bgd_ndirs_lo < minndir &&
+ fs->e2fs_gd[cg].ext2bgd_nifree_lo >= avgifree &&
+ fs->e2fs_gd[cg].ext2bgd_nbfree_lo >= avgbfree) {
mincg = cg;
- minndir = fs->e2fs_gd[cg].ext2bgd_ndirs;
+ minndir = fs->e2fs_gd[cg].ext2bgd_ndirs_lo;
}
return (mincg);
@@ -989,16 +989,16 @@
*/
prefcg = ino_to_cg(fs, pip->i_number);
for (cg = prefcg; cg < fs->e2fs_gcount; cg++)
- if (fs->e2fs_gd[cg].ext2bgd_ndirs < maxndir &&
- fs->e2fs_gd[cg].ext2bgd_nifree >= minifree &&
- fs->e2fs_gd[cg].ext2bgd_nbfree >= minbfree) {
+ if (fs->e2fs_gd[cg].ext2bgd_ndirs_lo < maxndir &&
+ fs->e2fs_gd[cg].ext2bgd_nifree_lo >= minifree &&
+ fs->e2fs_gd[cg].ext2bgd_nbfree_lo >= minbfree) {
if (fs->e2fs_contigdirs[cg] < maxcontigdirs)
return (cg);
}
for (cg = 0; cg < prefcg; cg++)
- if (fs->e2fs_gd[cg].ext2bgd_ndirs < maxndir &&
- fs->e2fs_gd[cg].ext2bgd_nifree >= minifree &&
- fs->e2fs_gd[cg].ext2bgd_nbfree >= minbfree) {
+ if (fs->e2fs_gd[cg].ext2bgd_ndirs_lo < maxndir &&
+ fs->e2fs_gd[cg].ext2bgd_nifree_lo >= minifree &&
+ fs->e2fs_gd[cg].ext2bgd_nbfree_lo >= minbfree) {
if (fs->e2fs_contigdirs[cg] < maxcontigdirs)
return (cg);
}
@@ -1006,10 +1006,10 @@
* This is a backstop when we have deficit in space.
*/
for (cg = prefcg; cg < fs->e2fs_gcount; cg++)
- if (fs->e2fs_gd[cg].ext2bgd_nifree >= avgifree)
+ if (fs->e2fs_gd[cg].ext2bgd_nifree_lo >= avgifree)
return (cg);
for (cg = 0; cg < prefcg; cg++)
- if (fs->e2fs_gd[cg].ext2bgd_nifree >= avgifree)
+ if (fs->e2fs_gd[cg].ext2bgd_nifree_lo >= avgifree)
break;
return (cg);
}
@@ -1130,11 +1130,11 @@
/* XXX ondisk32 */
fs = ip->i_e2fs;
ump = ip->i_ump;
- if (fs->e2fs_gd[cg].ext2bgd_nbfree == 0)
+ if (fs->e2fs_gd[cg].ext2bgd_nbfree_lo == 0)
return (0);
EXT2_UNLOCK(ump);
error = bread(ip->i_devvp, fsbtodb(fs,
- fs->e2fs_gd[cg].ext2bgd_b_bitmap),
+ fs->e2fs_gd[cg].ext2bgd_b_bitmap_lo),
(int)fs->e2fs_bsize, NOCRED, &bp);
if (error) {
brelse(bp);
@@ -1195,8 +1195,8 @@
#endif
setbit(bbp, (daddr_t)bno);
EXT2_LOCK(ump);
- fs->e2fs->e2fs_fbcount--;
- fs->e2fs_gd[cg].ext2bgd_nbfree--;
+ fs->e2fs->e2fs_fbcount_lo--;
+ fs->e2fs_gd[cg].ext2bgd_nbfree_lo--;
fs->e2fs_fmod = 1;
EXT2_UNLOCK(ump);
bdwrite(bp);
@@ -1222,11 +1222,11 @@
ipref = 0;
fs = ip->i_e2fs;
ump = ip->i_ump;
- if (fs->e2fs_gd[cg].ext2bgd_nifree == 0)
+ if (fs->e2fs_gd[cg].ext2bgd_nifree_lo == 0)
return (0);
EXT2_UNLOCK(ump);
error = bread(ip->i_devvp, fsbtodb(fs,
- fs->e2fs_gd[cg].ext2bgd_i_bitmap),
+ fs->e2fs_gd[cg].ext2bgd_i_bitmap_lo),
(int)fs->e2fs_bsize, NOCRED, &bp);
if (error) {
brelse(bp);
@@ -1267,11 +1267,11 @@
gotit:
setbit(ibp, ipref);
EXT2_LOCK(ump);
- fs->e2fs_gd[cg].ext2bgd_nifree--;
+ fs->e2fs_gd[cg].ext2bgd_nifree_lo--;
fs->e2fs->e2fs_ficount--;
fs->e2fs_fmod = 1;
if ((mode & IFMT) == IFDIR) {
- fs->e2fs_gd[cg].ext2bgd_ndirs++;
+ fs->e2fs_gd[cg].ext2bgd_ndirs_lo++;
fs->e2fs_total_dir++;
}
EXT2_UNLOCK(ump);
@@ -1298,14 +1298,14 @@
fs = ip->i_e2fs;
ump = ip->i_ump;
cg = dtog(fs, bno);
- if ((u_int)bno >= fs->e2fs->e2fs_bcount) {
+ if ((u_int)bno >= fs->e2fs->e2fs_bcount_lo) {
printf("bad block %lld, ino %llu\n", (long long)bno,
(unsigned long long)ip->i_number);
ext2_fserr(fs, ip->i_uid, "bad block");
return;
}
error = bread(ip->i_devvp,
- fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap),
+ fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_b_bitmap_lo),
(int)fs->e2fs_bsize, NOCRED, &bp);
if (error) {
brelse(bp);
@@ -1320,8 +1320,8 @@
}
clrbit(bbp, bno);
EXT2_LOCK(ump);
- fs->e2fs->e2fs_fbcount++;
- fs->e2fs_gd[cg].ext2bgd_nbfree++;
+ fs->e2fs->e2fs_fbcount_lo++;
+ fs->e2fs_gd[cg].ext2bgd_nbfree_lo++;
fs->e2fs_fmod = 1;
EXT2_UNLOCK(ump);
bdwrite(bp);
@@ -1354,7 +1354,7 @@
cg = ino_to_cg(fs, ino);
error = bread(pip->i_devvp,
- fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_i_bitmap),
+ fsbtodb(fs, fs->e2fs_gd[cg].ext2bgd_i_bitmap_lo),
(int)fs->e2fs_bsize, NOCRED, &bp);
if (error) {
brelse(bp);
@@ -1371,9 +1371,9 @@
clrbit(ibp, ino);
EXT2_LOCK(ump);
fs->e2fs->e2fs_ficount++;
- fs->e2fs_gd[cg].ext2bgd_nifree++;
+ fs->e2fs_gd[cg].ext2bgd_nifree_lo++;
if ((mode & IFMT) == IFDIR) {
- fs->e2fs_gd[cg].ext2bgd_ndirs--;
+ fs->e2fs_gd[cg].ext2bgd_ndirs_lo--;
fs->e2fs_total_dir--;
}
fs->e2fs_fmod = 1;
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_balloc.c#2 (text+ko) ====
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_bmap.c#2 (text+ko) ====
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_dinode.h#2 (text+ko) ====
@@ -29,8 +29,6 @@
#ifndef _FS_EXT2FS_EXT2_DINODE_H_
#define _FS_EXT2FS_EXT2_DINODE_H_
-#define e2di_size_high e2di_dacl
-
/*
* Inode flags
* The current implementation uses only EXT2_IMMUTABLE and EXT2_APPEND flags
@@ -43,8 +41,22 @@
#define EXT2_APPEND 0x00000020 /* writes to file may only append */
#define EXT2_NODUMP 0x00000040 /* do not dump file */
#define EXT2_NOATIME 0x00000080 /* do not update atime */
+/* NOT implementation. Reserved for compression usage. */
+#define EXT4_DIRTY 0x00000100
+#define EXT4_COMPRBLK 0x00000200 /* One or more compressed clusters */
+#define EXT4_NOCOMPR 0x00000400 /* Don't compress */
+#define EXT4_ECOMPR 0x00000800 /* Compression error */
+/* End compression flags */
+#define EXT4_INDEX 0x00001000 /* Hash-indexed directory */
+#define EXT4_IMAGIC 0x00002000 /* AFS directory */
+#define EXT4_JOURNAL_DATA 0x00004000 /* File data should be journaled */
+#define EXT4_NOTAIL 0x00008000 /* File tail should not be merged */
+#define EXT4_DIRSYNC 0x00010000 /* dirsync behavior */
+#define EXT4_TOPDIR 0x00020000 /* top of directory hierarchies */
+#define EXT4_HUGE_FILE 0x00040000 /* Set to each huge file */
+#define EXT4_EXTENTS 0x00080000 /* Inode uses extents */
+#define EXT4_RESERVED 0x80000000 /* Reserved for ext4 lib */
-
/*
* Structure of an inode on the disk
*/
@@ -60,18 +72,52 @@
u_int16_t e2di_nlink; /* 26: File link count */
u_int32_t e2di_nblock; /* 28: Blocks count */
u_int32_t e2di_flags; /* 32: Status flags (chflags) */
- u_int32_t e2di_linux_reserved1; /* 36 */
+ union {
+ struct {
+ u_int32_t e2di_version;
+ } linux1;
+ struct {
+ u_int32_t e2di_translator;
+ } hurd1;
+ struct {
+ u_int32_t e2di_reserved1;
+ } masix1;
+ } osd1; /* 36: */
u_int32_t e2di_blocks[EXT2_N_BLOCKS]; /* 40: disk blocks */
u_int32_t e2di_gen; /* 100: generation number */
u_int32_t e2di_facl; /* 104: file ACL (not implemented) */
u_int32_t e2di_dacl; /* 108: dir ACL (not implemented) */
+#define e2di_size_high e2di_dacl
u_int32_t e2di_faddr; /* 112: fragment address */
- u_int8_t e2di_nfrag; /* 116: fragment number */
- u_int8_t e2di_fsize; /* 117: fragment size */
- u_int16_t e2di_linux_reserved2; /* 118 */
- u_int16_t e2di_uid_high; /* 120: Owner UID top 16 bits */
- u_int16_t e2di_gid_high; /* 122: Owner GID top 16 bits */
- u_int32_t e2di_linux_reserved3; /* 124 */
+ union {
+ struct {
+ u_int16_t 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;
+ u_int32_t e2di_l_reserved2;
+ } linux2;
+ struct {
+ u_int16_t e2di_h_reserved1;
+ u_int16_t e2di_h_mode_high;
+ u_int16_t e2di_h_uid_high;
+ u_int16_t e2di_h_gid_high;
+ u_int32_t e2di_h_author;
+ } hurd2;
+ struct {
+ u_int16_t e2di_m_reserved1;
+ u_int16_t e2di_m_facl_high;
+ u_int32_t e2di_reserved2[2];
+ } masix2;
+ } osd2;
+ u_int16_t e2di_extra_isize;
+ u_int16_t e2di_pad;
+ u_int32_t e2di_ctime_extra;
+ u_int32_t e2di_mtime_extra;
+ u_int32_t e2di_atime_extra;
+ u_int32_t e2di_crtime;
+ u_int32_t e2di_crtime_extra;
+ u_int32_t e2di_version_hi;
};
#endif /* _FS_EXT2FS_EXT2_DINODE_H_ */
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_dir.h#2 (text+ko) ====
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_extern.h#2 (text+ko) ====
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_inode.c#2 (text+ko) ====
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_inode_cnv.c#2 (text+ko) ====
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_lookup.c#2 (text+ko) ====
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_mount.h#2 (text+ko) ====
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_readwrite.c#2 (text+ko) ====
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_rsv_win.h#2 (text+ko) ====
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_subr.c#2 (text+ko) ====
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_vfsops.c#2 (text+ko) ====
@@ -288,7 +288,8 @@
return (1);
}
if (es->e2fs_rev > E2FS_REV0) {
- if (es->e2fs_features_incompat & ~EXT2F_INCOMPAT_SUPP) {
+ /*if (es->e2fs_features_incompat & ~EXT2F_INCOMPAT_SUPP) {*/
+ if (es->e2fs_features_incompat & ~EXT4F_INCOMPAT_SUPP) {
printf(
"WARNING: mount of %s denied due to unsupported optional features\n",
devtoname(dev));
@@ -350,7 +351,7 @@
fs->e2fs_itpg = fs->e2fs_ipg /fs->e2fs_ipb;
fs->e2fs_descpb = fs->e2fs_bsize / sizeof (struct ext2_gd);
/* s_resuid / s_resgid ? */
- fs->e2fs_gcount = (es->e2fs_bcount - es->e2fs_first_dblock +
+ fs->e2fs_gcount = (es->e2fs_bcount_lo - es->e2fs_first_dblock +
EXT2_BLOCKS_PER_GROUP(fs) - 1) / EXT2_BLOCKS_PER_GROUP(fs);
db_count = (fs->e2fs_gcount + EXT2_DESC_PER_BLOCK(fs) - 1) /
EXT2_DESC_PER_BLOCK(fs);
@@ -385,7 +386,7 @@
}
fs->e2fs_total_dir = 0;
for (i=0; i < fs->e2fs_gcount; i++){
- fs->e2fs_total_dir += fs->e2fs_gd[i].ext2bgd_ndirs;
+ fs->e2fs_total_dir += fs->e2fs_gd[i].ext2bgd_ndirs_lo;
fs->e2fs_contigdirs[i] = 0;
}
if (es->e2fs_rev == E2FS_REV0 ||
@@ -752,9 +753,9 @@
sbp->f_bsize = EXT2_FRAG_SIZE(fs);
sbp->f_iosize = EXT2_BLOCK_SIZE(fs);
- sbp->f_blocks = fs->e2fs->e2fs_bcount - overhead;
- sbp->f_bfree = fs->e2fs->e2fs_fbcount;
- sbp->f_bavail = sbp->f_bfree - fs->e2fs->e2fs_rbcount;
+ sbp->f_blocks = fs->e2fs->e2fs_bcount_lo - overhead;
+ sbp->f_bfree = fs->e2fs->e2fs_fbcount_lo;
+ sbp->f_bavail = sbp->f_bfree - fs->e2fs->e2fs_rbcount_lo;
sbp->f_files = fs->e2fs->e2fs_icount;
sbp->f_ffree = fs->e2fs->e2fs_ficount;
return (0);
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2_vnops.c#2 (text+ko) ====
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/ext2fs.h#2 (text+ko) ====
@@ -73,7 +73,7 @@
/*
* Maximal count of links to a file
*/
-#define EXT2_LINK_MAX 32000
+#define EXT2_LINK_MAX 65000
/*
* Constants relative to the data blocks
@@ -97,9 +97,9 @@
*/
struct ext2fs {
u_int32_t e2fs_icount; /* Inode count */
- u_int32_t e2fs_bcount; /* blocks count */
- u_int32_t e2fs_rbcount; /* reserved blocks count */
- u_int32_t e2fs_fbcount; /* free blocks count */
+ u_int32_t e2fs_bcount_lo; /* blocks count */
+ u_int32_t e2fs_rbcount_lo; /* reserved blocks count */
+ u_int32_t e2fs_fbcount_lo; /* free blocks count */
u_int32_t e2fs_ficount; /* free inodes count */
u_int32_t e2fs_first_dblock; /* first data block */
u_int32_t e2fs_log_bsize; /* block size = 1024*(2^e2fs_log_bsize) */
@@ -132,8 +132,36 @@
char e2fs_vname[16]; /* volume name */
char e2fs_fsmnt[64]; /* name mounted on */
u_int32_t e2fs_algo; /* For comcate for dir */
- u_int16_t e2fs_reserved_ngdb; /* # of reserved gd blocks for resize */
- u_int32_t reserved2[204];
+ u_int8_t e2fs_prealloc_blk; /* number of blocks to try to preallocate */
+ u_int8_t e2fs_prealloc_dblk; /* number of dirs to preallocate */
+ u_int16_t e2fs_reserved_ngdb; /* # of reserved gd blocks for resize */
+ u_int8_t e2fs_journal_uuid[16]; /* uuid of journal superblock */
+ u_int32_t e2fs_journal_inum; /* inode number of journal file */
+ u_int32_t e2fs_journal_dev; /* device number of journal file */
+ u_int32_t e2fs_last_orphan; /* start of list of inodes to delete */
+ u_int32_t e2fs_hash_seed[4]; /* HTREE hash seed */
+ u_int8_t e2fs_def_hash_ver; /* default hash version to use */
+ u_int8_t e2fs_char_pad;
+ u_int16_t e2fs_desc_size; /* size of group descriptor */
+ u_int32_t e2fs_def_mnt_opts;
+ u_int32_t e2fs_first_meta_bg; /* first metablock block group */
+ u_int32_t e2fs_mkfs_time; /* when the fs was created */
+ u_int32_t e2fs_jnl_blks[17]; /* backup of the journal inode */
+ u_int32_t e2fs_bcount_hi; /* block count */
+ u_int32_t e2fs_rbcount_hi; /* reserved blocks count */
+ u_int32_t e2fs_fbcount_hi; /* free blocks count */
+ 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 */
+ u_int32_t e2fs_flags; /* miscellaneous flags */
+ u_int16_t e2fs_raid_stride; /* RAID stride */
+ u_int16_t e2fs_mmpintv; /* number of seconds to wait in MMP checking */
+ u_int64_t e2fs_mmpblk; /* block for multi-mount protection */
+ u_int32_t e2fs_raid_stripe_wid;/* blocks on all data disks (N * stride) */
+ u_int8_t e2fs_log_gpf; /* FLEX_BG group size */
+ u_int8_t e2fs_char_pad2;
+ u_int16_t e2fs_pad;
+ u_int64_t e2fs_kbytes_written; /* number of lifetime kilobytes written */
+ u_int32_t reserved2[160];
};
@@ -207,9 +235,20 @@
#define EXT2F_ROCOMPAT_SPARSESUPER 0x0001
#define EXT2F_ROCOMPAT_LARGEFILE 0x0002
#define EXT2F_ROCOMPAT_BTREE_DIR 0x0004
+#define EXT4F_ROCOMPAT_HUGE_FILE 0x0008
+#define EXT4F_ROCOMPAT_GDT_CSUM 0x0010
+#define EXT4F_ROCOMPAT_DIR_NLINK 0x0020
+#define EXT4F_ROCOMPAT_EXTRA_ISIZE 0x0040
#define EXT2F_INCOMPAT_COMP 0x0001
#define EXT2F_INCOMPAT_FTYPE 0x0002
+#define EXT4F_INCOMPAT_RECOVER 0x0004
+#define EXT4F_INCOMPAT_JOURNAL_DEV 0x0008
+#define EXT4F_INCOMPAT_META_BG 0x0010
+#define EXT4F_INCOMPAT_EXTENTS 0x0040
+#define EXT4F_INCOMPAT_64BIT 0x0080
+#define EXT4F_INCOMPAT_MMP 0x0100
+#define EXT4F_INCOMPAT_FLEX_BG 0X0200
/*
* Features supported in this implementation
@@ -225,6 +264,20 @@
#define EXT2F_INCOMPAT_SUPP EXT2F_INCOMPAT_FTYPE
/*
+ * Features supported in ext4 read-only mode
+ */
+#define EXT4F_INCOMPAT_SUPP (EXT2F_INCOMPAT_FTYPE \
+ | EXT4F_INCOMPAT_EXTENTS \
+ | EXT4F_INCOMPAT_FLEX_BG)
+#define EXT4F_ROCOMPAT_SUPP (EXT2F_ROCOMPAT_SPARSESUPER \
+ | EXT2F_ROCOMPAT_LARGEFILE \
+ | EXT2F_ROCOMPAT_BTREE_DIR \
+ | EXT4F_ROCOMPAT_GDT_CSUM \
+ | EXT4F_ROCOMPAT_DIR_NLINK \
+ | EXT4F_ROCOMPAT_EXTRA_ISIZE \
+ | EXT4F_ROCOMPAT_HUGE_FILE)
+
+/*
* Feature set definitions
*/
#define EXT2_HAS_COMPAT_FEATURE(sb,mask) \
@@ -260,14 +313,24 @@
/* ext2 file system block group descriptor */
struct ext2_gd {
- u_int32_t ext2bgd_b_bitmap; /* blocks bitmap block */
- u_int32_t ext2bgd_i_bitmap; /* inodes bitmap block */
- u_int32_t ext2bgd_i_tables; /* inodes table block */
- u_int16_t ext2bgd_nbfree; /* number of free blocks */
- u_int16_t ext2bgd_nifree; /* number of free inodes */
- u_int16_t ext2bgd_ndirs; /* number of directories */
- u_int16_t reserved;
- u_int32_t reserved2[3];
+ u_int32_t ext2bgd_b_bitmap_lo; /* blocks bitmap block */
+ u_int32_t ext2bgd_i_bitmap_lo; /* inodes bitmap block */
+ u_int32_t ext2bgd_i_tables_lo; /* inodes table block */
+ u_int16_t ext2bgd_nbfree_lo; /* number of free blocks */
+ u_int16_t ext2bgd_nifree_lo; /* number of free inodes */
+ u_int16_t ext2bgd_ndirs_lo; /* number of directories */
+ u_int16_t ext2bgd_flags; /* EXT4_BG_flags */
+ u_int32_t reserved[2];
+ u_int16_t ext2bgd_i_tables_unused_lo; /* number of unused inodes */
+ u_int16_t ext2bgd_chksum; /* crc16 checksum */
+ u_int32_t ext2bgd_b_bitmap_hi; /* blocks bitmap block MSB */
+ u_int32_t ext2bgd_i_bitmap_hi; /* inodes bitmap block MSB */
+ u_int32_t ext2bgd_i_tables_hi; /* inodes table block MSB */
+ u_int16_t ext2bgd_nbfree_hi; /* number of free blocks MSB */
+ u_int16_t ext2bgd_nifree_hi; /* number of free inodes MSB */
+ u_int16_t ext2bgd_ndirs_hi; /* number of directories MSB */
+ u_int16_t ext2bgd_i_tables_unused_hi; /* number of unused inodes MSB */
+ u_int32_t reserved2[3];
};
/* EXT2FS metadatas are stored in little-endian byte order. These macros
@@ -280,7 +343,7 @@
* Macro-instructions used to manage several block sizes
*/
#define EXT2_MIN_BLOCK_SIZE 1024
-#define EXT2_MAX_BLOCK_SIZE 4096
+#define EXT2_MAX_BLOCK_SIZE 65536
#define EXT2_MIN_BLOCK_LOG_SIZE 10
#if defined(_KERNEL)
# define EXT2_BLOCK_SIZE(s) ((s)->e2fs_bsize)
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/fs.h#2 (text+ko) ====
@@ -93,7 +93,7 @@
/* get block containing inode from its number x */
#define ino_to_fsba(fs, x) \
- ((fs)->e2fs_gd[ino_to_cg((fs), (x))].ext2bgd_i_tables + \
+ ((fs)->e2fs_gd[ino_to_cg((fs), (x))].ext2bgd_i_tables_lo + \
(((x) - 1) % (fs)->e2fs->e2fs_ipg) / (fs)->e2fs_ipb)
/* get offset for inode in block */
==== //depot/projects/soc2010/ext4fs/src/sys/fs/ext2fs/inode.h#2 (text+ko) ====
More information about the p4-projects
mailing list