[PATCH] 5/6 Remove unused block variables from group descriptor loops

Eric Sandeen <[email protected]> Wed, 16 Aug 2006 15:52:08 -0500
Newsgroups gmane.comp.file-systems.ext2.devel
Message-ID <[email protected]>
While investigating patch 4/6, several variables popped up which were set but never tested.

Signed-off-by: Eric Sandeen <[email protected]>

Index: e2fsprogs-1.39-test/e2fsck/pass1.c
===================================================================
--- e2fsprogs-1.39-test.orig/e2fsck/pass1.c
+++ e2fsprogs-1.39-test/e2fsck/pass1.c
@@ -1981,14 +1981,13 @@ static void handle_fs_bad_blocks(e2fsck_
 static void mark_table_blocks(e2fsck_t ctx)
 {
 	ext2_filsys fs = ctx->fs;
-	blk_t	block, b;
+	blk_t	b;
 	dgrp_t	i;
 	int	j;
 	struct problem_context pctx;
 	
 	clear_problem_context(&pctx);
 	
-	block = fs->super->s_first_data_block;
 	for (i = 0; i < fs->group_desc_count; i++) {
 		pctx.group = i;
 
@@ -2049,7 +2048,6 @@ static void mark_table_blocks(e2fsck_t c
 				     fs->group_desc[i].bg_inode_bitmap);
 			}
 		}
-		block += fs->super->s_blocks_per_group;
 	}
 }
 	
Index: e2fsprogs-1.39-test/lib/ext2fs/closefs.c
===================================================================
--- e2fsprogs-1.39-test.orig/lib/ext2fs/closefs.c
+++ e2fsprogs-1.39-test/lib/ext2fs/closefs.c
@@ -206,7 +206,6 @@ static errcode_t write_backup_super(ext2
 errcode_t ext2fs_flush(ext2_filsys fs)
 {
 	dgrp_t		i,j;
-	blk_t		group_block;
 	errcode_t	retval;
 	unsigned long	fs_state;
 	struct ext2_super_block *super_shadow = 0;
@@ -275,7 +274,6 @@ errcode_t ext2fs_flush(ext2_filsys fs)
 	 * Write out the master group descriptors, and the backup
 	 * superblocks and group descriptors.
 	 */
-	group_block = fs->super->s_first_data_block;
 	group_ptr = (char *) group_shadow;
 	if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
 		old_desc_blocks = fs->super->s_first_meta_bg;
Index: e2fsprogs-1.39-test/misc/e2image.c
===================================================================
--- e2fsprogs-1.39-test.orig/misc/e2image.c
+++ e2fsprogs-1.39-test/misc/e2image.c
@@ -287,7 +287,6 @@ static void mark_table_blocks(ext2_filsy
 			ext2fs_mark_block_bitmap(meta_block_map,
 				 fs->group_desc[i].bg_inode_bitmap);
 		}
-		first_block += fs->super->s_blocks_per_group;
 	}
 }
 
Index: e2fsprogs-1.39-test/lib/ext2fs/initialize.c
===================================================================
--- e2fsprogs-1.39-test.orig/lib/ext2fs/initialize.c
+++ e2fsprogs-1.39-test/lib/ext2fs/initialize.c
@@ -99,7 +99,6 @@ errcode_t ext2fs_initialize(const char *
 	int		frags_per_block;
 	unsigned int	rem;
 	unsigned int	overhead = 0;
-	blk_t		group_block;
 	unsigned int	ipg;
 	dgrp_t		i;
 	blk_t		numblocks;
@@ -362,7 +361,6 @@ retry:
 	 * inode table have not been allocated (and in fact won't be
 	 * by this routine), they are accounted for nevertheless.
 	 */
-	group_block = super->s_first_data_block;
 	super->s_free_blocks_count = 0;
 	for (i = 0; i < fs->group_desc_count; i++) {
 		numblocks = ext2fs_reserve_super_and_bgd(fs, i, fs->block_map);
@@ -372,8 +370,6 @@ retry:
 		fs->group_desc[i].bg_free_inodes_count =
 			fs->super->s_inodes_per_group;
 		fs->group_desc[i].bg_used_dirs_count = 0;
-		
-		group_block += super->s_blocks_per_group;
 	}
 	
 	ext2fs_mark_super_dirty(fs);
Index: e2fsprogs-1.39-test/resize/resize2fs.c
===================================================================
--- e2fsprogs-1.39-test.orig/resize/resize2fs.c
+++ e2fsprogs-1.39-test/resize/resize2fs.c
@@ -537,14 +537,13 @@ errout:
 static errcode_t mark_table_blocks(ext2_filsys fs,
 				   ext2fs_block_bitmap bmap)
 {
-	blk_t			block, b;
+	blk_t			b;
 	unsigned int		j;
 	dgrp_t			i;
 	unsigned long		meta_bg_size;
 	unsigned int		old_desc_blocks;
 
 	meta_bg_size = (fs->blocksize / sizeof (struct ext2_group_desc));
-	block = fs->super->s_first_data_block;
 	if (fs->super->s_feature_incompat & EXT2_FEATURE_INCOMPAT_META_BG)
 		old_desc_blocks = fs->super->s_first_meta_bg;
 	else
@@ -572,7 +571,6 @@ static errcode_t mark_table_blocks(ext2_
 		 */
 		ext2fs_mark_block_bitmap(bmap,
 					 fs->group_desc[i].bg_inode_bitmap);
-		block += fs->super->s_blocks_per_group;
 	}
 	return 0;
 }



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642