PERFORCE change 164014 for review
Aditya Sarawgi
truncs at FreeBSD.org
Wed Jun 10 16:09:21 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=164014
Change 164014 by truncs at aditya on 2009/06/10 16:09:08
Migration to new on disk superblock completed.
Affected files ...
.. //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_readwrite.c#5 edit
.. //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_vfsops.c#7 edit
.. //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/fs.h#5 edit
Differences ...
==== //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_readwrite.c#5 (text+ko) ====
@@ -242,7 +242,7 @@
*/
flags |= B_CLRBUF;
#if 0
- if (fs->s_frag_size > xfersize)
+ if (fs->e2fs_fsize > xfersize)
flags |= B_CLRBUF;
else
flags &= ~B_CLRBUF;
==== //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_vfsops.c#7 (text+ko) ====
@@ -108,10 +108,10 @@
VFS_SET(ext2fs_vfsops, ext2fs, 0);
-static int ext2_check_sb_compat(struct ext2_super_block *es, struct cdev *dev,
+static int ext2_check_sb_compat(struct ext2fs *es, struct cdev *dev,
int ronly);
static int compute_sb_data(struct vnode * devvp,
- struct ext2_super_block * es, struct m_ext2fs * fs);
+ struct ext2fs * es, struct m_ext2fs * fs);
static const char *ext2_opts[] = { "from", "export", "acls", "noexec",
"noatime", "union", "suiddir", "multilabel", "nosymfollow",
@@ -172,7 +172,7 @@
error = ext2_flushfiles(mp, flags, td);
vfs_unbusy(mp);
if (!error && fs->e2fs_wasvalid) {
- fs->e2fs->s_state |= EXT2_VALID_FS;
+ fs->e2fs->e2fs_state |= EXT2_VALID_FS;
ext2_sbupdate(ump, MNT_WAIT);
}
fs->e2fs_ronly = 1;
@@ -214,11 +214,11 @@
if (error)
return (error);
- if ((fs->e2fs->s_state & EXT2_VALID_FS) == 0 ||
- (fs->e2fs->s_state & EXT2_ERROR_FS)) {
+ if ((fs->e2fs->e2fs_state & EXT2_VALID_FS) == 0 ||
+ (fs->e2fs->e2fs_state & EXT2_ERROR_FS)) {
if (mp->mnt_flag & MNT_FORCE) {
printf(
-"WARNING: %s was not properly "dismounted\n", fs->e2fs_fsmnt);
+"WARNING: %s was not properly dismounted\n", fs->e2fs_fsmnt);
} else {
printf(
"WARNING: R/W mount of %s denied. Filesystem is not clean - run fsck\n",
@@ -226,7 +226,7 @@
return (EPERM);
}
}
- fs->e2fs->s_state &= ~EXT2_VALID_FS;
+ fs->e2fs->e2fs_state &= ~EXT2_VALID_FS;
ext2_sbupdate(ump, MNT_WAIT);
fs->e2fs_ronly = 0;
MNT_ILOCK(mp);
@@ -307,7 +307,7 @@
ext2_check_descriptors(struct m_ext2fs *sb)
{
struct ext2_group_desc *gdp = NULL;
- unsigned long block = sb->e2fs->s_first_data_block;
+ unsigned long block = sb->e2fs->e2fs_first_dblock;
int desc_block = 0;
int i;
@@ -348,23 +348,23 @@
}
static int
-ext2_check_sb_compat(struct ext2_super_block *es, struct cdev *dev, int ronly)
+ext2_check_sb_compat(struct ext2fs *es, struct cdev *dev, int ronly)
{
- if (es->s_magic != EXT2_SUPER_MAGIC) {
+ if (es->e2fs_magic != EXT2_SUPER_MAGIC) {
printf("ext2fs: %s: wrong magic number %#x (expected %#x)\n",
- devtoname(dev), es->s_magic, EXT2_SUPER_MAGIC);
+ devtoname(dev), es->e2fs_magic, EXT2_SUPER_MAGIC);
return (1);
}
if (es->s_rev_level > EXT2_GOOD_OLD_REV) {
- if (es->s_feature_incompat & ~EXT2_FEATURE_INCOMPAT_SUPP) {
+ if (es->e2fs_features_incompat & ~EXT2_FEATURE_INCOMPAT_SUPP) {
printf(
"WARNING: mount of %s denied due to unsupported optional features\n",
devtoname(dev));
return (1);
}
if (!ronly &&
- (es->s_feature_ro_compat & ~EXT2_FEATURE_RO_COMPAT_SUPP)) {
+ (es->e2fs_features_rocompat & ~EXT2_FEATURE_RO_COMPAT_SUPP)) {
printf("WARNING: R/W mount of %s denied due to "
"unsupported optional features\n", devtoname(dev));
return (1);
@@ -378,30 +378,30 @@
* data in the ext2_super_block structure read in.
*/
static int
-compute_sb_data(struct vnode *devvp, struct ext2_super_block *es,
+compute_sb_data(struct vnode *devvp, struct ext2fs *es,
struct m_ext2fs *fs)
{
int db_count, error;
int i, j;
int logic_sb_block = 1; /* XXX for now */
- fs->e2fs_bsize = EXT2_MIN_BLOCK_SIZE << es->s_log_block_size;
- fs->e2fs_bshift = EXT2_MIN_BLOCK_LOG_SIZE + es->s_log_block_size;
- fs->e2fs_fsbtodb = es->s_log_block_size + 1;
+ fs->e2fs_bsize = EXT2_MIN_BLOCK_SIZE << es->e2fs_log_bsize;
+ fs->e2fs_bshift = EXT2_MIN_BLOCK_LOG_SIZE + es->e2fs_log_bsize;
+ fs->e2fs_fsbtodb = es->e2fs_log_bsize + 1;
fs->e2fs_qbmask = fs->e2fs_bsize - 1;
- fs->e2fs_blocksize_bits = es->s_log_block_size + 10;
- fs->e2fs_fsize = EXT2_MIN_FRAG_SIZE << es->s_log_frag_size;
+ fs->e2fs_blocksize_bits = es->e2fs_log_bsize + 10;
+ fs->e2fs_fsize = EXT2_MIN_FRAG_SIZE << es->e2fs_log_fsize;
if (fs->e2fs_fsize)
fs->e2fs_fpb = fs->e2fs_bsize / fs->e2fs_fsize;
- fs->e2fs_bpg = es->s_blocks_per_group;
- fs->e2fs_fpg = es->s_frags_per_group;
- fs->e2fs_ipg = es->s_inodes_per_group;
- if (es->s_rev_level == EXT2_GOOD_OLD_REV) {
+ fs->e2fs_bpg = es->e2fs_bpg;
+ fs->e2fs_fpg = es->e2fs_fpg;
+ fs->e2fs_ipg = es->e2fs_ipg;
+ if (es->e2fs_rev == EXT2_GOOD_OLD_REV) {
fs->e2fs_first_inode = EXT2_GOOD_OLD_FIRST_INO;
fs->e2fs_isize = EXT2_GOOD_OLD_INODE_SIZE;
} else {
- fs->e2fs_first_inode = es->s_first_ino;
- fs->e2fs_isize = es->s_inode_size;
+ fs->e2fs_first_inode = es->e2fs_first_ino;
+ fs->e2fs_isize = es->e2fs_inode_size;
/*
* Simple sanity check for superblock inode size value.
@@ -418,7 +418,7 @@
fs->e2fs_itpg = fs->e2fs_ipg /fs->e2fs_ipb;
fs->e2fs_descpb = fs->e2fs_bsize / sizeof (struct ext2_group_desc);
/* s_resuid / s_resgid ? */
- fs->e2fs_gcount = (es->s_blocks_count - es->s_first_data_block +
+ fs->e2fs_gcount = (es->e2fs_bcount - 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);
@@ -464,7 +464,7 @@
fs->e2fs_lib = 0;
fs->e2fs_lbb = 0;
if (es->s_rev_level == EXT2_GOOD_OLD_REV ||
- (es->s_feature_ro_compat & EXT2_FEATURE_RO_COMPAT_LARGE_FILE) == 0)
+ (es->e2fs_features_rocompat & EXT2_FEATURE_RO_COMPAT_LARGE_FILE) == 0)
fs->e2fs_maxfilesize = 0x7fffffff;
else
fs->e2fs_maxfilesize = 0x7fffffffffffffff;
@@ -490,7 +490,7 @@
struct vnode *vp, *mvp, *devvp;
struct inode *ip;
struct buf *bp;
- struct ext2_super_block *es;
+ struct ext2fs *es;
struct m_ext2fs *fs;
int error;
@@ -511,13 +511,13 @@
*/
if ((error = bread(devvp, SBLOCK, SBSIZE, NOCRED, &bp)) != 0)
return (error);
- es = (struct ext2_super_block *)bp->b_data;
+ es = (struct ext2fs *)bp->b_data;
if (ext2_check_sb_compat(es, devvp->v_rdev, 0) != 0) {
brelse(bp);
return (EIO); /* XXX needs translation */
}
fs = VFSTOEXT2(mp)->um_e2fs;
- bcopy(bp->b_data, fs->e2fs, sizeof(struct ext2_super_block));
+ bcopy(bp->b_data, fs->e2fs, sizeof(struct ext2fs));
if((error = compute_sb_data(devvp, es, fs)) != 0) {
brelse(bp);
@@ -621,13 +621,13 @@
ump = NULL;
if ((error = bread(devvp, SBLOCK, SBSIZE, NOCRED, &bp)) != 0)
goto out;
- es = (struct ext2_super_block *)bp->b_data;
+ es = (struct ext2fs *)bp->b_data;
if (ext2_check_sb_compat(es, dev, ronly) != 0) {
error = EINVAL; /* XXX needs translation */
goto out;
}
- if ((es->s_state & EXT2_VALID_FS) == 0 ||
- (es->s_state & EXT2_ERROR_FS)) {
+ if ((es->e2fs_state & EXT2_VALID_FS) == 0 ||
+ (es->e2fs_state & EXT2_ERROR_FS)) {
if (ronly || (mp->mnt_flag & MNT_FORCE)) {
printf(
"WARNING: Filesystem was not properly dismounted\n");
@@ -648,9 +648,9 @@
*/
ump->um_e2fs = malloc(sizeof(struct m_ext2fs),
M_EXT2MNT, M_WAITOK);
- ump->um_e2fs->e2fs = malloc(sizeof(struct ext2_super_block),
+ ump->um_e2fs->e2fs = malloc(sizeof(struct ext2fs),
M_EXT2MNT, M_WAITOK);
- bcopy(es, ump->um_e2fs->e2fs, (u_int)sizeof(struct ext2_super_block));
+ bcopy(es, ump->um_e2fs->e2fs, (u_int)sizeof(struct ext2fs));
if ((error = compute_sb_data(devvp, ump->um_e2fs->e2fs, ump->um_e2fs)))
goto out;
@@ -667,10 +667,10 @@
* If the fs is not mounted read-only, make sure the super block is
* always written back on a sync().
*/
- fs->e2fs_wasvalid = fs->e2fs->s_state & EXT2_VALID_FS ? 1 : 0;
+ fs->e2fs_wasvalid = fs->e2fs->e2fs_state & EXT2_VALID_FS ? 1 : 0;
if (ronly == 0) {
fs->e2fs_fmod = 1; /* mark it modified */
- fs->e2fs->s_state &= ~EXT2_VALID_FS; /* set fs invalid */
+ fs->e2fs->e2fs_state &= ~EXT2_VALID_FS; /* set fs invalid */
}
mp->mnt_data = ump;
mp->mnt_stat.f_fsid.val[0] = dev2udev(dev);
@@ -690,7 +690,7 @@
* ufs_bmap w/o changse!
*/
ump->um_nindir = EXT2_ADDR_PER_BLOCK(fs);
- ump->um_bptrtodb = fs->e2fs->s_log_block_size + 1;
+ ump->um_bptrtodb = fs->e2fs->e2fs_log_bsize + 1;
ump->um_seqinc = EXT2_FRAGS_PER_BLOCK(fs);
if (ronly == 0)
ext2_sbupdate(ump, MNT_WAIT);
@@ -737,7 +737,7 @@
ronly = fs->e2fs_ronly;
if (ronly == 0) {
if (fs->e2fs_wasvalid)
- fs->e2fs->s_state |= EXT2_VALID_FS;
+ fs->e2fs->e2fs_state |= EXT2_VALID_FS;
ext2_sbupdate(ump, MNT_WAIT);
}
@@ -791,7 +791,7 @@
{
struct ext2mount *ump;
struct m_ext2fs *fs;
- struct ext2_super_block *es;
+ struct ext2fs *es;
unsigned long overhead;
int i, nsb;
@@ -799,20 +799,20 @@
fs = ump->um_e2fs;
es = fs->e2fs;
- if (es->s_magic != EXT2_SUPER_MAGIC)
+ if (es->e2fs_magic != EXT2_SUPER_MAGIC)
panic("ext2_statfs - magic number spoiled");
/*
* Compute the overhead (FS structures)
*/
- if (es->s_feature_ro_compat & EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) {
+ if (es->e2fs_features_rocompat & EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) {
nsb = 0;
for (i = 0 ; i < fs->e2fs_gcount; i++)
if (ext2_group_sparse(i))
nsb++;
} else
nsb = fs->e2fs_gcount;
- overhead = es->s_first_data_block +
+ overhead = es->e2fs_first_dblock +
/* Superblocks and block group descriptors: */
nsb * (1 + fs->e2fs_gdbcount) +
/* Inode bitmap, block bitmap, and inode table: */
@@ -820,11 +820,11 @@
sbp->f_bsize = EXT2_FRAG_SIZE(fs);
sbp->f_iosize = EXT2_BLOCK_SIZE(fs);
- sbp->f_blocks = es->s_blocks_count - overhead;
- sbp->f_bfree = es->s_free_blocks_count;
- sbp->f_bavail = sbp->f_bfree - es->s_r_blocks_count;
- sbp->f_files = es->s_inodes_count;
- sbp->f_ffree = es->s_free_inodes_count;
+ sbp->f_blocks = es->e2fs_bcount - overhead;
+ sbp->f_bfree = es->e2fs_fbcount;
+ sbp->f_bavail = sbp->f_bfree - es->e2fs_rbcount;
+ sbp->f_files = es->e2fs_icount;
+ sbp->f_ffree = es->e2fs_ficount;
return (0);
}
@@ -905,7 +905,7 @@
*/
if (fs->e2fs_fmod != 0) {
fs->e2fs_fmod = 0;
- fs->e2fs->s_wtime = time_second;
+ fs->e2fs->e2fs_wtime = time_second;
if ((error = ext2_sbupdate(ump, waitfor)) != 0)
allerror = error;
}
@@ -1058,7 +1058,7 @@
ufhp = (struct ufid *)fhp;
fs = VFSTOEXT2(mp)->um_e2fs;
if (ufhp->ufid_ino < ROOTINO ||
- ufhp->ufid_ino > fs->e2fs_gcount * fs->e2fs->s_inodes_per_group)
+ ufhp->ufid_ino > fs->e2fs_gcount * fs->e2fs->e2fs_ipg)
return (ESTALE);
error = VFS_VGET(mp, ufhp->ufid_ino, LK_EXCLUSIVE, &nvp);
@@ -1085,12 +1085,12 @@
ext2_sbupdate(struct ext2mount *mp, int waitfor)
{
struct m_ext2fs *fs = mp->um_e2fs;
- struct ext2_super_block *es = fs->e2fs;
+ struct ext2fs *es = fs->e2fs;
struct buf *bp;
int error = 0;
bp = getblk(mp->um_devvp, SBLOCK, SBSIZE, 0, 0, 0);
- bcopy((caddr_t)es, bp->b_data, (u_int)sizeof(struct ext2_super_block));
+ bcopy((caddr_t)es, bp->b_data, (u_int)sizeof(struct ext2fs));
if (waitfor == MNT_WAIT)
error = bwrite(bp);
else
==== //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/fs.h#5 (text+ko) ====
@@ -93,9 +93,9 @@
* Give cylinder group number for a file system block.
* Give cylinder group block number for a file system block.
*/
-#define dtog(fs, d) (((d) - fs->e2fs->s_first_data_block) / \
+#define dtog(fs, d) (((d) - fs->e2fs->e2fs_first_dblock) / \
EXT2_BLOCKS_PER_GROUP(fs))
-#define dtogd(fs, d) (((d) - fs->e2fs->s_first_data_block) % \
+#define dtogd(fs, d) (((d) - fs->e2fs->e2fs_first_dblock) % \
EXT2_BLOCKS_PER_GROUP(fs))
/*
More information about the p4-projects
mailing list