only define some variables if legacy EXT2FS_ENABLE_SWAPFS is enabled
diff --git a/e2fsprogs/ext2fs/closefs.c b/e2fsprogs/ext2fs/closefs.c
index 8539a1c..23e6332 100644
--- a/e2fsprogs/ext2fs/closefs.c
+++ b/e2fsprogs/ext2fs/closefs.c
@@ -205,15 +205,18 @@
 
 errcode_t ext2fs_flush(ext2_filsys fs)
 {
-	dgrp_t		i,j;
+	dgrp_t		i;
 	blk_t		group_block;
 	errcode_t	retval;
 	unsigned long	fs_state;
 	struct ext2_super_block *super_shadow = 0;
 	struct ext2_group_desc *group_shadow = 0;
-	struct ext2_group_desc *s, *t;
 	char	*group_ptr;
 	int	old_desc_blocks;
+#ifdef EXT2FS_ENABLE_SWAPFS
+	dgrp_t		j;
+	struct ext2_group_desc *s, *t;
+#endif
 	
 	EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
 
diff --git a/e2fsprogs/ext2fs/ind_block.c b/e2fsprogs/ext2fs/ind_block.c
index 3519048..c9fd86a 100644
--- a/e2fsprogs/ext2fs/ind_block.c
+++ b/e2fsprogs/ext2fs/ind_block.c
@@ -22,9 +22,11 @@
 errcode_t ext2fs_read_ind_block(ext2_filsys fs, blk_t blk, void *buf)
 {
 	errcode_t	retval;
+#ifdef EXT2FS_ENABLE_SWAPFS
 	blk_t		*block_nr;
 	int		i;
 	int		limit = fs->blocksize >> 2;
+#endif
 
 	if ((fs->flags & EXT2_FLAG_IMAGE_FILE) &&
 	    (fs->io != fs->image_io))
@@ -46,9 +48,11 @@
 
 errcode_t ext2fs_write_ind_block(ext2_filsys fs, blk_t blk, void *buf)
 {
+#ifdef EXT2FS_ENABLE_SWAPFS
 	blk_t		*block_nr;
 	int		i;
 	int		limit = fs->blocksize >> 2;
+#endif
 
 	if (fs->flags & EXT2_FLAG_IMAGE_FILE)
 		return 0;
diff --git a/e2fsprogs/ext2fs/openfs.c b/e2fsprogs/ext2fs/openfs.c
index d27c1b9..e8f1649 100644
--- a/e2fsprogs/ext2fs/openfs.c
+++ b/e2fsprogs/ext2fs/openfs.c
@@ -86,10 +86,13 @@
 	ext2_filsys	fs;
 	errcode_t	retval;
 	unsigned long	i;
-	int		j, groups_per_block, blocks_per_group;
+	int		groups_per_block, blocks_per_group;
 	blk_t		group_block, blk;
 	char		*dest, *cp;
+#ifdef EXT2FS_ENABLE_SWAPFS
+	int j;
 	struct ext2_group_desc *gdp;
+#endif
 	
 	EXT2_CHECK_MAGIC(manager, EXT2_ET_MAGIC_IO_MANAGER);