PERFORCE change 164001 for review
Aditya Sarawgi
truncs at FreeBSD.org
Wed Jun 10 14:50:58 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=164001
Change 164001 by truncs at aditya on 2009/06/10 14:50:20
Migration to the new on disk superblock
Affected files ...
.. //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_linux_balloc.c#5 edit
.. //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_linux_ialloc.c#5 edit
Differences ...
==== //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_linux_balloc.c#5 (text+ko) ====
@@ -186,7 +186,7 @@
unsigned long i;
int bitmap_nr;
struct ext2_group_desc * gdp;
- struct ext2_super_block * es;
+ struct ext2fs * es;
if (!sb) {
printf ("ext2_free_blocks: nonexistent device");
@@ -194,8 +194,8 @@
}
es = sb->e2fs;
lock_super (VFSTOEXT2(mp)->um_devvp);
- if (block < es->s_first_data_block ||
- (block + count) > es->s_blocks_count) {
+ if (block < es->e2fs_first_dblock ||
+ (block + count) > es->e2fs_bcount) {
printf ( "ext2_free_blocks: "
"Freeing blocks not in datazone - "
"block = %lu, count = %lu", block, count);
@@ -205,9 +205,9 @@
ext2_debug ("freeing blocks %lu to %lu\n", block, block+count-1);
- block_group = (block - es->s_first_data_block) /
+ block_group = (block - es->e2fs_first_dblock) /
EXT2_BLOCKS_PER_GROUP(sb);
- bit = (block - es->s_first_data_block) % EXT2_BLOCKS_PER_GROUP(sb);
+ bit = (block - es->e2fs_first_dblock) % EXT2_BLOCKS_PER_GROUP(sb);
if (bit + count > EXT2_BLOCKS_PER_GROUP(sb))
panic ( "ext2_free_blocks: "
"Freeing blocks across group boundary - "
@@ -236,7 +236,7 @@
block);
else {
gdp->bg_free_blocks_count++;
- es->s_free_blocks_count++;
+ es->e2fs_fbcount++;
}
}
@@ -271,7 +271,7 @@
int i, j, k, tmp;
int bitmap_nr;
struct ext2_group_desc * gdp;
- struct ext2_super_block * es;
+ struct ext2fs * es;
#ifdef EXT2FS_DEBUG
static int goal_hits = 0, goal_attempts = 0;
@@ -289,12 +289,12 @@
/*
* First, test whether the goal block is free.
*/
- if (goal < es->s_first_data_block || goal >= es->s_blocks_count)
- goal = es->s_first_data_block;
- i = (goal - es->s_first_data_block) / EXT2_BLOCKS_PER_GROUP(sb);
+ if (goal < es->e2fs_first_dblock || goal >= es->e2fs_bcount)
+ goal = es->e2fs_first_dblock;
+ i = (goal - es->e2fs_first_dblock) / EXT2_BLOCKS_PER_GROUP(sb);
gdp = get_group_desc (mp, i, &bh2);
if (gdp->bg_free_blocks_count > 0) {
- j = ((goal - es->s_first_data_block) % EXT2_BLOCKS_PER_GROUP(sb));
+ j = ((goal - es->e2fs_first_dblock) % EXT2_BLOCKS_PER_GROUP(sb));
#ifdef EXT2FS_DEBUG
if (j)
goal_attempts++;
@@ -400,7 +400,7 @@
ext2_debug ("using block group %d(%d)\n", i, gdp->bg_free_blocks_count);
- tmp = j + i * EXT2_BLOCKS_PER_GROUP(sb) + es->s_first_data_block;
+ tmp = j + i * EXT2_BLOCKS_PER_GROUP(sb) + es->e2fs_first_dblock;
if (/* test_opt (sb, CHECK_STRICT) && we are always strict. */
(tmp == gdp->bg_block_bitmap ||
@@ -432,7 +432,7 @@
(*prealloc_count)++;
}
gdp->bg_free_blocks_count -= *prealloc_count;
- es->s_free_blocks_count -= *prealloc_count;
+ es->e2fs_fbcount -= *prealloc_count;
ext2_debug ("Preallocated a further %lu bits.\n",
*prealloc_count);
}
@@ -447,7 +447,7 @@
wait_on_buffer (bh);
}
****/
- if (j >= es->s_blocks_count) {
+ if (j >= es->e2fs_bcount) {
printf ( "ext2_new_block: "
"block >= blocks count - "
"block_group = %d, block=%d", i, j);
@@ -460,7 +460,7 @@
gdp->bg_free_blocks_count--;
mark_buffer_dirty(bh2);
- es->s_free_blocks_count--;
+ es->e2fs_fbcount--;
sb->e2fs_fmod = 1;
unlock_super (VFSTOEXT2(mp)->um_devvp);
return j;
@@ -471,7 +471,7 @@
{
struct m_ext2fs *sb = VFSTOEXT2(mp)->um_e2fs;
#ifdef EXT2FS_DEBUG
- struct ext2_super_block * es;
+ struct ext2fs * es;
unsigned long desc_count, bitmap_count, x;
int bitmap_nr;
struct ext2_group_desc * gdp;
@@ -493,11 +493,11 @@
bitmap_count += x;
}
ext2_debug( "stored = %lu, computed = %lu, %lu\n",
- es->s_free_blocks_count, desc_count, bitmap_count);
+ es->e2fs_fbcount, desc_count, bitmap_count);
unlock_super (VFSTOEXT2(mp)->um_devvp);
return bitmap_count;
#else
- return sb->e2fs->s_free_blocks_count;
+ return sb->e2fs->e2fs_fbcount;
#endif
}
#endif /* unused */
@@ -506,7 +506,7 @@
struct m_ext2fs * sb,
unsigned char * map)
{
- return test_bit ((block - sb->e2fs->s_first_data_block) %
+ return test_bit ((block - sb->e2fs->e2fs_first_dblock) %
EXT2_BLOCKS_PER_GROUP(sb), map);
}
@@ -534,7 +534,7 @@
{
struct m_ext2fs *sb = VFSTOEXT2(mp)->um_e2fs;
struct buffer_head * bh;
- struct ext2_super_block * es;
+ struct ext2fs * es;
unsigned long desc_count, bitmap_count, x;
unsigned long desc_blocks;
int bitmap_nr;
@@ -554,7 +554,7 @@
bitmap_nr = load_block_bitmap (mp, i);
bh = sb->e2fs_bb[bitmap_nr];
- if (!(es->s_feature_ro_compat &
+ if (!(es->e2fs_features_rocompat &
EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER) ||
ext2_group_sparse(i)) {
if (!test_bit (0, bh->b_data))
@@ -579,13 +579,13 @@
"Inode bitmap for group %d is marked free",
i);
- for (j = 0; j < sb->s_itb_per_group; j++)
+ for (j = 0; j < sb->e2fs_itpg; j++)
if (!block_in_use (gdp->bg_inode_table + j, sb, bh->b_data))
printf ("ext2_check_blocks_bitmap: "
"Block #%d of the inode table in "
"group %d is marked free", j, i);
- x = ext2_count_free (bh, sb->s_blocksize);
+ x = ext2_count_free (bh, sb->e2fs_bsize);
if (gdp->bg_free_blocks_count != x)
printf ("ext2_check_blocks_bitmap: "
"Wrong free blocks count for group %d, "
@@ -593,11 +593,11 @@
gdp->bg_free_blocks_count, x);
bitmap_count += x;
}
- if (es->s_free_blocks_count != bitmap_count)
+ if (es->e2fs_fbcount != bitmap_count)
printf ("ext2_check_blocks_bitmap: "
"Wrong free blocks count in super block, "
"stored = %lu, counted = %lu",
- (unsigned long) es->s_free_blocks_count, bitmap_count);
+ (unsigned long) es->e2fs_fbcount, bitmap_count);
unlock_super (VFSTOEXT2(mp)->um_devvp);
}
#endif /* unused */
==== //depot/projects/soc2009/soc_ext2fs/src/sys/gnu/fs/ext2fs/ext2_linux_ialloc.c#5 (text+ko) ====
@@ -209,7 +209,7 @@
unsigned long bit;
int bitmap_nr;
struct ext2_group_desc * gdp;
- struct ext2_super_block * es;
+ struct ext2fs * es;
if (!inode)
return;
@@ -225,7 +225,7 @@
sb = inode->i_e2fs;
lock_super (DEVVP(inode));
if (inode->i_number < EXT2_FIRST_INO(sb) ||
- inode->i_number > sb->e2fs->s_inodes_count) {
+ inode->i_number > sb->e2fs->e2fs_icount) {
printf ("free_inode reserved inode or nonexistent inode");
unlock_super (DEVVP(inode));
return;
@@ -245,7 +245,7 @@
if (S_ISDIR(inode->i_mode))
gdp->bg_used_dirs_count--;
mark_buffer_dirty(bh2);
- es->s_free_inodes_count++;
+ es->e2fs_ficount++;
}
mark_buffer_dirty(bh);
/*** XXX
@@ -316,7 +316,7 @@
int bitmap_nr;
struct ext2_group_desc * gdp;
struct ext2_group_desc * tmp;
- struct ext2_super_block * es;
+ struct ext2fs * es;
if (!dir)
return 0;
@@ -328,7 +328,7 @@
gdp = NULL; i=0;
if (S_ISDIR(mode)) {
- avefreei = es->s_free_inodes_count /
+ avefreei = es->e2fs_ficount /
sb->e2fs_gcount;
/* I am not yet convinced that this next bit is necessary.
i = dir->u.ext2_i.i_block_group;
@@ -434,7 +434,7 @@
goto repeat;
}
j += i * EXT2_INODES_PER_GROUP(sb) + 1;
- if (j < EXT2_FIRST_INO(sb) || j > es->s_inodes_count) {
+ if (j < EXT2_FIRST_INO(sb) || j > es->e2fs_icount) {
printf ( "ext2_new_inode:"
"reserved inode or inode > inodes count - "
"block_group = %d,inode=%d", i, j);
@@ -445,7 +445,7 @@
if (S_ISDIR(mode))
gdp->bg_used_dirs_count++;
mark_buffer_dirty(bh2);
- es->s_free_inodes_count--;
+ es->e2fs_ficount--;
/* mark_buffer_dirty(sb->u.ext2_sb.s_sbh, 1); */
sb->e2fs_fmod = 1;
unlock_super (DEVVP(dir));
@@ -457,7 +457,7 @@
{
#ifdef EXT2FS_DEBUG
struct m_ext2fs *sb = VFSTOEXT2(mp)->um_e2fs;
- struct ext2_super_block * es;
+ struct ext2fs * es;
unsigned long desc_count, bitmap_count, x;
int bitmap_nr;
struct ext2_group_desc * gdp;
@@ -479,11 +479,11 @@
bitmap_count += x;
}
ext2_debug("stored = %lu, computed = %lu, %lu\n",
- es->s_free_inodes_count, desc_count, bitmap_count);
+ es->e2fs_ficount, desc_count, bitmap_count);
unlock_super (VFSTOEXT2(mp)->um_devvp);
return desc_count;
#else
- return VFSTOEXT2(mp)->um_e2fsb->s_free_inodes_count;
+ return VFSTOEXT2(mp)->um_e2fsb->e2fs_ficount;
#endif
}
#endif /* unused */
@@ -491,7 +491,7 @@
#ifdef LATER
void ext2_check_inodes_bitmap (struct mount * mp)
{
- struct ext2_super_block * es;
+ struct ext2fs * es;
unsigned long desc_count, bitmap_count, x;
int bitmap_nr;
struct ext2_group_desc * gdp;
@@ -515,11 +515,11 @@
gdp->bg_free_inodes_count, x);
bitmap_count += x;
}
- if (es->s_free_inodes_count != bitmap_count)
+ if (es->e2fs_ficount != bitmap_count)
printf ( "ext2_check_inodes_bitmap:"
"Wrong free inodes count in super block, "
"stored = %lu, counted = %lu",
- (unsigned long) es->s_free_inodes_count, bitmap_count);
+ (unsigned long) es->e2fs_ficount, bitmap_count);
unlock_super (sb);
}
#endif
More information about the p4-projects
mailing list