Remove compression support

The compression patches were an out-of-kernel patch set that was (a)
only available for ext2, (b) something that was never could be
stablized due to file system corruption, and (c) the most recent
patches were for 3.1, last updated in 2011.

The history of the compression patches has been a bit checkered.
There is a long history here at http://e2compr.sourceforge.net which
lists the perspective of the people working on it from the e2compr
side.

From the ext2/3/4 mainline developers' perspective, initial
compression support was added to e2fsprogs in 2000 (in the Linux 2.2
era), but due to stability concerns the kernel patches were never
merged into the mainline kernel.  While there were some sporadic
efforts to try to get the ext2 compression patches working in the 2.4
and 2.6 era, by that time mainline work had moved on to ext4, and the
e2compr approach could only work with 32-bit block numbers and
indirect mapped files.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
diff --git a/configure b/configure
index f59d232..bfd2776 100755
--- a/configure
+++ b/configure
@@ -859,7 +859,6 @@
 enable_symlink_relative_symlinks
 enable_symlink_build
 enable_verbose_makecmds
-enable_compression
 enable_htree
 enable_elf_shlibs
 enable_bsd_shlibs
@@ -1522,7 +1521,6 @@
 
   --enable-symlink-build  use symlinks while building instead of hard links
   --enable-verbose-makecmds enable verbose make command output
-  --enable-compression	  enable EXPERIMENTAL compression support
   --enable-htree      	  enable EXPERIMENTAL htree directory support
   --enable-elf-shlibs	  select ELF shared libraries
   --enable-bsd-shlibs	  select BSD shared libraries
@@ -4902,28 +4900,6 @@
 
 
 
-# Check whether --enable-compression was given.
-if test "${enable_compression+set}" = set; then :
-  enableval=$enable_compression; if test "$enableval" = "no"
-then
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Disabling compression support" >&5
-$as_echo "Disabling compression support" >&6; }
-else
-
-$as_echo "#define ENABLE_COMPRESSION 1" >>confdefs.h
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Enabling compression support" >&5
-$as_echo "Enabling compression support" >&6; }
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Compression support is experimental" >&5
-$as_echo "$as_me: WARNING: Compression support is experimental" >&2;}
-fi
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: Disabling compression support by default" >&5
-$as_echo "Disabling compression support by default" >&6; }
-
-fi
-
 
 # Check whether --enable-htree was given.
 if test "${enable_htree+set}" = set; then :
diff --git a/configure.in b/configure.in
index 9069234..7dfd2be 100644
--- a/configure.in
+++ b/configure.in
@@ -253,23 +253,6 @@
 AC_SUBST(ES)
 AC_SUBST(Q)
 dnl
-dnl handle --enable-compression
-dnl
-AC_ARG_ENABLE([compression],
-[  --enable-compression	  enable EXPERIMENTAL compression support],
-if test "$enableval" = "no"
-then
-	AC_MSG_RESULT([Disabling compression support])
-else
-	AC_DEFINE(ENABLE_COMPRESSION, 1,
-		[Define to 1 if ext2 compression enabled])
-	AC_MSG_RESULT([Enabling compression support])
-	AC_MSG_WARN([Compression support is experimental])
-fi
-,
-AC_MSG_RESULT([Disabling compression support by default])
-)
-dnl
 dnl handle --enable-htree
 dnl
 AH_TEMPLATE([ENABLE_HTREE], [Define to 1 if ext3/4 htree support enabled])
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 791817b..b007f65 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -2874,18 +2874,6 @@
 	inlinedata_fs = (ctx->fs->super->s_feature_incompat &
 			 EXT4_FEATURE_INCOMPAT_INLINE_DATA);
 
-	if (inode->i_flags & EXT2_COMPRBLK_FL) {
-		if (fs->super->s_feature_incompat &
-		    EXT2_FEATURE_INCOMPAT_COMPRESSION)
-			pb.compressed = 1;
-		else {
-			if (fix_problem(ctx, PR_1_COMPR_SET, pctx)) {
-				inode->i_flags &= ~EXT2_COMPRBLK_FL;
-				dirty_inode++;
-			}
-		}
-	}
-
 	if (check_ext_attr(ctx, pctx, block_buf)) {
 		if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
 			goto out;
@@ -3159,28 +3147,6 @@
 	pctx = p->pctx;
 	ctx = p->ctx;
 
-	if (p->compressed && (blk == EXT2FS_COMPRESSED_BLKADDR)) {
-		/* todo: Check that the comprblk_fl is high, that the
-		   blkaddr pattern looks right (all non-holes up to
-		   first EXT2FS_COMPRESSED_BLKADDR, then all
-		   EXT2FS_COMPRESSED_BLKADDR up to end of cluster),
-		   that the feature_incompat bit is high, and that the
-		   inode is a regular file.  If we're doing a "full
-		   check" (a concept introduced to e2fsck by e2compr,
-		   meaning that we look at data blocks as well as
-		   metadata) then call some library routine that
-		   checks the compressed data.  I'll have to think
-		   about this, because one particularly important
-		   problem to be able to fix is to recalculate the
-		   cluster size if necessary.  I think that perhaps
-		   we'd better do most/all e2compr-specific checks
-		   separately, after the non-e2compr checks.  If not
-		   doing a full check, it may be useful to test that
-		   the personality is linux; e.g. if it isn't then
-		   perhaps this really is just an illegal block. */
-		return 0;
-	}
-
 	/*
 	 * For a directory, add logical block zero for processing even if it's
 	 * not mapped or we'll be perennially stuck with broken "." and ".."
@@ -3209,7 +3175,7 @@
 	 * file be contiguous.  (Which can never be true for really
 	 * big files that are greater than a block group.)
 	 */
-	if (!HOLE_BLKADDR(p->previous_block) && p->ino != EXT2_RESIZE_INO) {
+	if (p->previous_block && p->ino != EXT2_RESIZE_INO) {
 		if (p->previous_block+1 != blk) {
 			if (ctx->options & E2F_OPT_FRAGCHECK) {
 				char type = '?';
@@ -3383,11 +3349,6 @@
 	struct problem_context *pctx;
 	e2fsck_t	ctx;
 
-	/*
-	 * Note: This function processes blocks for the bad blocks
-	 * inode, which is never compressed.  So we don't use HOLE_BLKADDR().
-	 */
-
 	if (!blk)
 		return 0;
 
diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c
index cd967f4..64dd269 100644
--- a/e2fsck/pass1b.c
+++ b/e2fsck/pass1b.c
@@ -364,7 +364,7 @@
 	blk64_t	lc, pc;
 	problem_t op;
 
-	if (HOLE_BLKADDR(*block_nr))
+	if (*block_nr == 0)
 		return 0;
 	p = (struct process_block_struct *) priv_data;
 	ctx = p->ctx;
@@ -628,7 +628,7 @@
 	pb = (struct process_block_struct *) priv_data;
 	ctx = pb->ctx;
 
-	if (HOLE_BLKADDR(*block_nr))
+	if (*block_nr == 0)
 		return 0;
 
 	c = EXT2FS_B2C(fs, *block_nr);
@@ -768,7 +768,7 @@
 	ctx = cs->ctx;
 	deferred_dec_badcount(cs);
 
-	if (HOLE_BLKADDR(*block_nr))
+	if (*block_nr == 0)
 		return 0;
 
 	c = EXT2FS_B2C(fs, blockcnt);
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index 94665c6..2c2ed12 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -1590,7 +1590,7 @@
 {
 	struct del_block *p = priv_data;
 
-	if (HOLE_BLKADDR(*block_nr))
+	if (*block_nr == 0)
 		return 0;
 	if ((*block_nr < fs->super->s_first_data_block) ||
 	    (*block_nr >= ext2fs_blocks_count(fs->super)))
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 7042e20..62fce25 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -711,11 +711,6 @@
 	     "or append-only flag set.  "),
 	  PROMPT_CLEAR, PR_PREEN_OK | PR_PREEN_NO | PR_NO_OK },
 
-	/* Compression flag set on an inode when filesystem doesn't support it */
-	{ PR_1_COMPR_SET,
-	  N_("@i %i has @cion flag set on @f without @cion support.  "),
-	  PROMPT_CLEAR, 0 },
-
 	/* Non-zero size for device, fifo or socket inode */
 	{ PR_1_SET_NONZSIZE,
 	  N_("Special (@v/socket/fifo) @i %i has non-zero size.  "),
diff --git a/e2fsck/problem.h b/e2fsck/problem.h
index 19b2301..bc959c4 100644
--- a/e2fsck/problem.h
+++ b/e2fsck/problem.h
@@ -415,8 +415,8 @@
 /* Immutable flag set on a device or socket inode */
 #define PR_1_SET_IMMUTABLE		0x010030
 
-/* Compression flag set on a non-compressed filesystem */
-#define PR_1_COMPR_SET			0x010031
+/* Compression flag set on a non-compressed filesystem -- no longer used*/
+/* #define PR_1_COMPR_SET			0x010031 */
 
 /* Non-zero size on on device, fifo or socket inode */
 #define PR_1_SET_NONZSIZE		0x010032
diff --git a/e2fsck/rehash.c b/e2fsck/rehash.c
index 66e6786..150d5e2 100644
--- a/e2fsck/rehash.c
+++ b/e2fsck/rehash.c
@@ -131,7 +131,7 @@
 						fd->ino);
 
 	dir = (fd->buf+offset);
-	if (HOLE_BLKADDR(*block_nr)) {
+	if (*block_nr == 0) {
 		memset(dir, 0, fs->blocksize);
 		dirent = (struct ext2_dir_entry *) dir;
 		(void) ext2fs_set_rec_len(fs, fs->blocksize, dirent);
diff --git a/e2fsck/super.c b/e2fsck/super.c
index 1e7e749..9eebd4d 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -76,7 +76,7 @@
 	pctx->blk = blk;
 	pctx->blkcount = blockcnt;
 
-	if (HOLE_BLKADDR(blk))
+	if (blk == 0)
 		return 0;
 
 	if ((blk < fs->super->s_first_data_block) ||
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index e629136..3db3480 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -1557,12 +1557,6 @@
 		log_err(ctx, "\n");
 		goto get_newer;
 	}
-#ifdef ENABLE_COMPRESSION
-	if (sb->s_feature_incompat & EXT2_FEATURE_INCOMPAT_COMPRESSION)
-		log_err(ctx, _("%s: warning: compression support "
-			       "is experimental.\n"),
-			ctx->program_name);
-#endif
 #ifndef ENABLE_HTREE
 	if (sb->s_feature_compat & EXT2_FEATURE_COMPAT_DIR_INDEX) {
 		log_err(ctx, _("%s: e2fsck not compiled with HTREE support,\n\t"
diff --git a/lib/config.h.in b/lib/config.h.in
index 0db010f..a4fed6d 100644
--- a/lib/config.h.in
+++ b/lib/config.h.in
@@ -38,9 +38,6 @@
 /* Define to 1 to enable bitmap stats. */
 #undef ENABLE_BMAP_STATS_OPS
 
-/* Define to 1 if ext2 compression enabled */
-#undef ENABLE_COMPRESSION
-
 /* Define to 1 if ext3/4 htree support enabled */
 #undef ENABLE_HTREE
 
diff --git a/lib/e2p/pf.c b/lib/e2p/pf.c
index 788c445..8961727 100644
--- a/lib/e2p/pf.c
+++ b/lib/e2p/pf.c
@@ -37,11 +37,6 @@
 	{ EXT2_NODUMP_FL, "d", "No_Dump" },
 	{ EXT2_NOATIME_FL, "A", "No_Atime" },
 	{ EXT2_COMPR_FL, "c", "Compression_Requested" },
-#ifdef ENABLE_COMPRESSION
-	{ EXT2_COMPRBLK_FL, "B", "Compressed_File" },
-	{ EXT2_DIRTY_FL, "Z", "Compressed_Dirty_File" },
-	{ EXT2_NOCOMPR_FL, "X", "Compression_Raw_Access" },
-#endif
 	{ EXT4_ENCRYPT_FL, "E", "Encrypted" },
 	{ EXT3_JOURNAL_DATA_FL, "j", "Journaled_Data" },
 	{ EXT2_INDEX_FL, "I", "Indexed_directory" },
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index d75dd76..28c4670 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -546,13 +546,6 @@
 #define EXT2_CHECK_MAGIC(struct, code) \
 	  if ((struct)->magic != (code)) return (code)
 
-
-/*
- * For ext2 compression support
- */
-#define EXT2FS_COMPRESSED_BLKADDR ((blk_t) -1)
-#define HOLE_BLKADDR(_b) ((_b) == 0 || (_b) == EXT2FS_COMPRESSED_BLKADDR)
-
 /*
  * Features supported by this version of the library
  */
@@ -564,19 +557,6 @@
 					 EXT2_FEATURE_COMPAT_EXT_ATTR|\
 					 EXT4_FEATURE_COMPAT_SPARSE_SUPER2)
 
-/* This #ifdef is temporary until compression is fully supported */
-#ifdef ENABLE_COMPRESSION
-#ifndef I_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL
-/* If the below warning bugs you, then have
-   `CPPFLAGS=-DI_KNOW_THAT_COMPRESSION_IS_EXPERIMENTAL' in your
-   environment at configure time. */
- #warning "Compression support is experimental"
-#endif
-#define EXT2_LIB_INCOMPAT_COMPRESSION	EXT2_FEATURE_INCOMPAT_COMPRESSION
-#else
-#define EXT2_LIB_INCOMPAT_COMPRESSION	(0)
-#endif
-
 #ifdef CONFIG_MMP
 #define EXT4_LIB_INCOMPAT_MMP		EXT4_FEATURE_INCOMPAT_MMP
 #else
@@ -590,7 +570,6 @@
 #endif
 
 #define EXT2_LIB_FEATURE_INCOMPAT_SUPP	(EXT2_FEATURE_INCOMPAT_FILETYPE|\
-					 EXT2_LIB_INCOMPAT_COMPRESSION|\
 					 EXT3_FEATURE_INCOMPAT_JOURNAL_DEV|\
 					 EXT2_FEATURE_INCOMPAT_META_BG|\
 					 EXT3_FEATURE_INCOMPAT_RECOVER|\