25 Mar 2007 Terry Loveall * compress.c: bug fix: ext2_count_blocks: init head_bh for each iteration. bug fix: ext2_count_blocks: add set clen=ulen for uncompressable clusters. bug fix: ext2_compress_cluster: replacement and inlining of an invalidate_inode_buffers function to keep root filesystem changes uptodate on disk (prevents umounting root file system to update). warning fix: ext2_compress_cluster: various variables initialized. ext2_compress_cluster: removed #ifdef NDEBUG bug fix: ext2_compress_cluster: defined maxclus, calculate and set for: bug fix: ext2_compress_cluster: set i_size for uncompressed clusters. ext2_cleanup_compressed_inode: changed error message to indicate 'Z' flag was caused by trying to un/compress already open file. bug fix: cp to compr dir: Truncate uncompressed files to their uncompressed length, i.e. force kernel to update inode and sb * inode.c: bug fix: ext2_get_block: restored changed: loop to bforget * ioctl.c: ext2_ioctl: scrubbed 'B' flag on file uncompress. 28 Feb 2005 Yabo Ding , * Corrected page unlocking in inode.c. 19 Feb 2005 Paul Whittaker * Added corrections le32_to_cpu in critical areas of compress.c * Optimized function exit code in inode.c. 26 Jan 2005 Paul Whittaker * ../Kconfig: Added EXT2_FS dependency for algorithms (such that they behave like dep_tristate under the old system). Partially fixed a problem with GZIP not being set as the default if eligible. Updated the help for most items. * compress.c: commented out quota-disabled assertion, as it applies too generally. * ../../arch/i386/defconfig: corrected missing and obsolete default options. * ../../include/linux/assert.h, ../../include/linux/ext2_fs_c.h, debug.h, ioctl.c, lzo/{Makefile,lzoconf.h}: for tidiness, moved assert.h into this directory, and amended other files as required. is an obsolete Linux-2.2-ism; this really ought to be fixed properly at some stage. * compress.c: update for 2.6.10: buffer_insert_list() no longer exists, instantiated the body of this function inline instead. * file.c: update for 2.6.10: current->rlim is now current->signal->rlim. * super.c, inode.c: update for 2.6.10: ext2_put_inode had been removed, so I had to reinstate it (for e2compr use only). 30 Sep 2004 Paul Whittaker * compress.c: fixed LZRW3A availability mistake in ext2_algorithm_table. * new-method-howto.c: updated. 29 Sep 2004 Paul Whittaker * ioctl.c: for completeness, added atomic_read to a commented-out i_count access. * Readme.e2compr: minor corrections. 02 Aug 2004 Paul Whittaker * lzrw3a/lzrw3a.c: added (UBYTE *) casts to avoid compiler warnings. 01 May 2004 Paul Whittaker * inode.c: fix from Guy Bilodeau : zero the epg array after failed ext2_get_cluster_extra_pages() before exiting ext2_readpage(). * compress.c: fixes from Guy Bilodeau : in ext2_get_cluster_pages() and ext2_get_cluster_extra_pages() npg must be int, otherwise "while (--npg >= 0)" is never true; NULL-test epg[npg] in ext2_get_cluster_extra_pages() before attempting page release. 25 Mar 2004 Version 0.4.44 released. Paul Whittaker * Makefile, {bzip2,gzip,lzo,lzrw3a,lzv1}/Makefile: changed target names to ext2-compr-{bzip2,gzip,lzo,lzwr3a,lzv1}. This both ensures that the revised automatic module loading scheme works (see below), and removes any possible ambiguity as to an algorithm module's purpose. * bzip/, lzrw/, lzv/: renamed to bzip2, lzrw3a and lzv1 respectively, for consistency with kernel config defines and algorithm names in compress.c. 29 Feb 2004 * compress.c, inode.c, ioctl.c: changed code preceding request_module() to request the algorithm by name rather than number. The modules.conf aliases are therefore no longer required (removed Modules.e2compr). 22 Feb 2004 Paul Whittaker * ext2_fs_c.h, compress.c: fixed broken trace_e2c() calls, associated with EXT2_COMPR_REPORT instead of EXT2_COMPR_DEBUG. 17 Feb 2004 Paul Whittaker * ioctl.c: added S_ISREG safety checks to EXT2_IOC_SETCOMPRMETHOD ioctl to prevent inadvertent marking of directories with EXT2_DIRTY_FL and EXT2_CLEANUP_FL, or attempts to decompress them. 22 Jan 2004 Paul Whittaker * various: reinstated the LZRW3A algorithm using code from an old 2.2 kernel patch, and updated e2compr-lzrw3a.c with module author, description and license info. LZRW3A was removed due to concerns with patent encumbrances, however LZRW3 is still used in the Linux ftape driver, and public opinion is that LZW-derivatives of this sort ought to be OK to use in GPL code. * compress.c: allow for the case where a WA is legitimately NULL when ext2_register_compression_module() is called. This can happen! * ext2_fs_c.h: CONFIG_EXT2_DEFAULT_COMPR_METHOD_NONE is never defined, should be CONFIG_EXT2_DEFAULT_COMPR_METHOD_DEFER. 19 Jan 2004 Version 0.4.43a released Paul Whittaker * lzo/lzoconf.h, lzo/lzo_conf.h: minimal modifications to allow compilation with -nostdinc. This code is a mess! * inode.c: fixed a broken EXT2_COMPR_REPORT_VERBOSE printk. * compress.c: moved n_clusters assignment ahead of its first use. * compress.c, file.c, iname.c: use atomic_read() to read i_count. * gzip/Makefile, gzip/deflate.c: Simplified #ifs such that assembly routines are used in a wider range of circumstances; assume user has at least a 586 if CONFIG_EXT2_COMPR_X86_CODE is set, and assume it is a 686 or better if CONFIG_X86_F00F_WORKS_OK=y. * Configure.help: various updates, removed entry for LZRW3A algorithm. * bzip/init.c,gzip/e2compr_gzip.c,lzo/e2compr_lzo.c,lzv/e2compr_lzv.c: Add module info. * bzip/lib_bzip_e.c: Removed superfluous ##s. * inode.c: e2compr additions to module info. * ioctl.c: change obsolete refs to fsuser() to capable(CAP_FOWNER). * compress.c: change EXT2_COMPR_DEBUG to EXT2_COMPR_REPORT_VERBOSE * compress.c: integrate compression verification fixes from Ulrich Holeschak . * Readme.e2compr, e2compress.txt, ext2_compression: updated URLs and contact details. * project name reverted to "e2compr", relocated to sourceforge.net. CHANGES.e2compress integrated into this file. 15 Mar 2003 Paul Whittaker * compress.c, inode.c: updated for page wait queues (2.4.20 kernel). Changes from 0.4.42 to 0.4.43 : =============================== Pierre Peiffer Denis Richard - Deadlock correction when compressing cluster and sync pages. - Management of MAPPED and DIRTY buffer flags. - Test of block number in compression. - Test if page is dirty to allocate buffer on device when compressing. - When decompress cluster use the size of the cluster and not the size of the file, because it can be called from vmtruncate (the size of the file has already changed). - Management of working area lock. - When (de)compress file containing holes, the data must be moved and not only the block number. - New function ext2_decompress_pages() to allocate blocks for a cluster already (block) decompressed. It is now called in ext2_decompress_cluster() and not only in ext2_file_write(). Changes from 0.4.41 to 0.4.42 : =============================== Pierre Peiffer Denis Richard - Delete the i_blocks field decrementation (Thanks to Peter Wächtler). - Clear dirty bit of buffers not in compressed area, after compression. - Unlock pages before sync of inode, after compression. - Change parameters (OSYNC_METADATA|OSYNC_DATA) of generic_osync_inode() calls to write data inode. - Ext2_readpage() returns an error code. - Allocation of working area even when readonly mount. - Clear dirty bit of buffers after uncompress in ext2_readpage. - Unlock page after free buffers in error case in ext2_readpage. Version 0.4.41 is the first version of e2compress patch for kernel 2.4.16 ========================================================================= Pierre Peiffer Denis Richard 1998-12-16 Peter Moulder * compress.c (ext2_register_compression_module): Unlock working area before we exit, even if ENOMEM. Set ext2_rd_wa_size correctly if decompression needs > compression needs. (Never happens with current algorithms, but in the process I simplified the code a little.) (ext2_decompress_inode): Moved assertion to before blocking calls, and added a non-asserted test (of the same condition) after the blocking calls. (ext2_cleanup_compressed_inode): Repeat some tests after some blocking calls (down, DQUOT_INIT). * ext2_fs_c.h: Remove last remnants of `ifndef EXT2_HOLEMAP' code. (ext2_offset_is_clu_boundary): Tiny efficiency tweek. 1998-11-30 Peter Moulder * compress.c (ext2_compress_cluster, ext2_decompress_cluster): * ioctl.c (ext2_ioctl): * file.c (ext2_readpage): Make request_module() call dependent on CONFIG_KMOD. 1998-11-22 Peter Moulder * compress.c (ext2_mark_algorithm_use): Adjust s_rev_level when adding compression to the superblock. 1998-11-01 Jan Rêkorajski * Merged with patch 0.4.21 * Updated defconfigs for all architectures * Cleared some forgotten code 1998-10-31 Jan Rêkorajski * Made yesterday statement false :) I followed Peter's sugestion to make working area pointer a parameter to de/compression functions. Now there is no problem selecting both CONFIG_EXT2_SEPARATE_WORK_AREAS and CONFIG_EXT2_VERIFY_COMPRESSION. 1998-10-30 Jan Rêkorajski * Hello, my name is Dexter, and I'm boy genius ;) * Ha, nailed The Bug, and squashed it :) The problem with separate work areas was due to compression verification. It's clear that CONFIG_EXT2_SEPARATE_WORK_AREAS and CONFIG_EXT2_VERIFY_COMPRESSION are mutually exclusive. Now, only fix the *config stuff and I'm done with "known bug" hunting. 1998-10-28 Jan Rêkorajski * OK, working area pointers separated. Didn't help :( Oopsed while testing. Seems that "critical bug" was something more... * Fixed a bug in ext2_register_compression_module, I forgot to put locks around memory reallocation. 1998-10-26 (later that day ;) Jan Rêkorajski * more separate areas work... Now I know what is that pjm's "critical bug", it's fundametal design screw up. (Structures do _NOT_ change their size magically, sizeof is a const, so using ext2_wa[0/1] was a BAD idea) Only 6 more (ext2_wa != NULL) lines to go... 1998-10-26 Jan Rêkorajski * patch against 2.1.126 * started fixing separate work areas problems (a.k.a. races ;) Every algorithm uses separate variables to store pointers to read/write work areas. Now they can compress and decompress in the same time. Apparently, it will save us a lot of memory :) See this: ALG C MEM D MEM --------------------- bzip2 ~150K ~150K gzip 200K 64K lzo ~128K 0K lzrw ~16K ~16K lzv 32K 0K --------------------- MAX 200K 150K So, in worst case with separate work areas we save ~50K _kernel_, _unswappable_ memory :) 1998-11-01 Peter Moulder * Misc small changes. 1998-10-18 Jan Rêkorajski * compress.c: fix "off by one" maxlen in ex2_compress_cluster * modularized bzip2, gzip, lzo, lzv, lzrw - added ext2_compress_(un)register_module see new-method-howto.c or lzv/e2compr_lzv.c * updated gzip to zlib 1.1.3 (was 0.93!) * fixed lzo - yes it works now :) 1998-06-30 Peter Moulder * binfmt_elf.c (elf_core_dump): * binfmt_aout.c (do_aout_core_dump): Fix deadlock. OK, make that 0.4.15. * Release e2compr-0.4.14-patch-2.1.107. * truncate.c, binfmt_aout.c: resolve with 2.1.107. * truncate.c: Don't test feature flag; EXT2_COMPRESSED_BLKADDR is proof enough. 1998-06-15 Peter Moulder * compress.c: Reset i_next_alloc_block and i_next_alloc goal to zero after compressing a cluster. 1998-06-11 Peter Moulder * compress.c: Fix [stupid] race condition. Added many diagnostic checks, too, which I haven't yet removed. 1998-06-10 Peter Moulder * ext2_fs_c.h: Add aliases for some #definitions. 1998-06-09 Peter Moulder * file.c (ext2_readpage): Allow for page sizes bigger than 8KB, for certain ARM processors. * ioctl.c (ext2_ioctl): Remove spurious ext2_warning about "COMPRBLK w/o COMPR". 1998-06-06 Peter Moulder * inode.c (block_getblk): Moved COMPRESSED_BLKADDR macro to ext2_fs_c.h, and removed the inode parameter. We no longer consult the superblock to check for e2compr support; if the block address is 0xffffffff then we say it's compressed. 1998-05-21 Peter Moulder * compress.c (ext2_count_blocks): Do more consistency checks on cluster head. (ext2_compress_cluster): Improve information display for changing b_blockno problem. Check return code of ext2_get_key(). 1998-05-12 Peter Moulder * compress.c (ext2_cleanup_compressed_inode, ext2_decompress_inode): Use DQUOT_INIT() for 2.1.101+ kernels. 1998-03-07 Peter Moulder * compress.c, lzo/, ext2_fs_c.h: Add lzo algorithm. (Patch sent in by Chris Old .) 1998-03-06 Peter Moulder * compress.c, file.c (ext2_readpage), ext2_fs_c.h: Support CONFIG_EXT2_SEPARATE_WORK_AREAS. * Release 0.4.2. 1998-03-02 Peter Moulder * ioctl.c (ext2_ioctl: EXT2_IOC_SETFLAGS): Properly clear EXT2_DIRTY_FL if we drop EXT2_COMPR_FL. 1998-02-12 Peter Moulder * compress.c (ext2_decompress_inode, ext2_cleanup_compressed_inode): Initialise quotas. 1998-01-24 Peter Moulder * compress.c (ext2_get_cluster_blocks): Number of blocks to fetch shouldn't be calculated from i_size; just use clu_nblocks. (i_size is short when truncate() is called.) I suspect that this change should also apply to 0.3.6. 1998-01-09 Peter Moulder CHANGES FOR 0.4.0. (Various files.) * Get rid of ,compressed cluster` bitmaps. Store EXT2_COMPRESSED_BLKADDR (new constant, currently 0xffffffff) in last blockno of cluster to mark as compressed. * First cluster is no longer in general the same size as other clusters of a file. See ext2_first_cluster_nblocks() and surrounding macros in ext2_fs.h. * Blocknos stored contiguously at the beginning of the cluster rather than having holes in places where uncompressed data has holes. * Mark incompatibilities in s_feature_incompat and s_algorithm_usage_bitmap (new field). * Always use i_sem, never I_LOCK. (This change is overdue, and should probably be back-ported.) * ioctl.c: Allow EXT2_ECOMPR_FL to be either raised from userspace (not just cleared). * ioctl.c: Don't ,raise EXT2_DIRTY_FL just because of toggling of EXT2_NOCOMPR_FL`. * ext2_fs.h, ioctl.h: New ioctl EXT2_IOC_RECOGNIZE_COMPRESSED to replace EXT2_IOC_SETCLUSTERBIT. EXT2_IOC_CLRCLUSTERBIT has been removed. * Have ext2_ioctl() decompress the file immediately if EXT2_COMPR_FL is cleared from a regular file. Report the error if the request couldn't be carried out. * Use two-level compression method table. ext2_algorithm_table keeps the `name', `avail', `init', `compress', `decompress' fields, while there is a new ext2_method_table with two fields: an index into ext2_algorithm_table, and an argument to the de/compressor. See compress.c. * Writes are compressed as soon as the end of a cluster is reached, instead of waiting until close(). * EXT2_IOC_SETCOMPRMETHOD doesn't fail for unknown compression method. However, it writes 1 or 0 to *arg depending on whether or not (respectively) the requested method is known to the kernel. * fs/Config.in: CONFIG_EXT2_COMPRESS question only asked if CONFIG_EXPERIMENTAL=y. * arch/*/defconfig: Default answer for CONFIG_EXT2_COMPRESS changed to `n'. * Do checksum on _compressed_ data not uncompressed. The intent is to prevent data corruption from skrogging kernel memory or causing illegal memory references. The `reserved_2' field has been removed from the cluster head and replaced with `checksum'. * Removed `bitmap' and `reserved0' from cluster head and replaced with `holemap' and `holemap_nbytes'. holemap[] is a bitmap of where to put holes. (It is declared as a zero-length array of unsigned char.) Unlike the former `bitmap' field, we don't include holes at the end of the cluster, a `1' represents a hole instead of a `0' in `bitmap', and of course it is variable-length. This paves the way for longer clusters. However, I haven't yet increased the length of clen or ulen, which would be necessary for clusters longer than 64KB, and desirable (no 0==64K hack) even for 64KB clusters. * New methods `never' and `auto'. `auto' is largely unimplemented (see compress.c). * Gratuitous name changes. Many things using word `uncompress' changed to `decompress'. (`Decompressed' always means `having been decompressed', whereas `uncompressed' can also (and usually does) mean `not having been compressed'.) ext2_put_compressed_cluster() split into ext2_cleanup_compressed_cluster() and ext2_decompress_inode(). head->len becomes head->ulen. CONFIG_EXT2_USE_* becomes s/USE/HAVE/. EXT2_COMPR_DEBUG* become EXT2_COMPR_REPORT*. Maybe some other things. Tue Dec 9 19:53:12 1997 Peter Moulder * ioctl.c (ext2_ioctl): Don't ,try to prevent 4KB clusters on machines with 8KB pages`. Mon Dec 8 17:48:19 1997 Peter Moulder * namei.c (ext2_create): implement CONFIG_GZ_HACK * compress.c (ext2_lock_wa): call signal_pending() instead of testing the bitmaps. (Necessary for 2.1.68 POSIX.1b signal handling.) * file.c (ext2_readpage): Attempt to correct rare bug for machines with 8KB (or larger) pages. Mon Dec 8 16:31:38 1997 Peter Moulder * inode.c, ext2_fs.h: Add support for a couple of e2compr- reserved inodes. (This change will probably be reversed, but it's harmless for now.) Fri Aug 1 15:10:48 1997 Peter Moulder * compress.c (ext2_unlock_wa): Call schedule() if other processes are waiting for the working area. Sat Jul 26 08:28:08 1997 Peter Moulder * Makefile: e2compr files were getting compiled even if CONFIG_EXT2_COMPRESS wasn't defined. Makefile now tests for this being defined. * acl.c: Not even root gets write access to a file with a compression error. * compress.c (ext2_get_cluster_bit): Reverse change of Apr 21, i.e. return any positive number instead of converting to 1. (Apr 21 change was needlessly cautious.) * inode.c: * compress.c: * file.c: Access to the cluster head does endian conversion. Access to inode has endian conversion in 2.1 but not in 2.0 -- just like the standard kernel. * ext2_byteorder.h: new file. (Only needed in 2.0.) * file.c (ext2_readpage): Rewrite. Handles errors better. Also takes better care of working area lock. * compress.c: * file.c: * inode.c: * truncate.c: Change printk level to KERN_DEBUG for things surrounded by EXT2_COMPR_REPORT*. * inode.c: Allow bmap() if EXT2_NOCOMPR_FL set. * inode.c: Don't take high bit of i_flags into compr_meth. (The high bit is reserved for ext2 lib.) Also, don't write it from compr_meth (though the result should be the same: the bit is set to zero). * ioctl.c (ext2_ioctl): Call verify_area in a few places where previously we didn't. * super.c (ext2_setup_super): The debug string on mount didn't seem to be printing, so I changed `%p' to `%lx' (plus an appropriate cast) to see if it would change things. * compress.c (ext2_uncompress_cluster, ext2_uncompress_blocks): In the consistency checks, consider the head size as well as compr_len in calculation. * gzip/deflate.c (deflate_fast, deflate_slow): * lzv/lzv1.c: Yield CPU every fifth of a second (ifdef __KERNEL__). * include/linux/ext2_fs.h: Change definition of EXT2_ECOMPR_FL from 0x0080 to 0x0800 to avoid clash with EXT2_NOATIME_FL in 2.1. * Change name EXT2_MAX_CLUSTER_SIZE to EXT2_MAX_CLUSTER_BLOCKS. Tue Apr 29 12:00:00 1997 Peter Moulder * ioctl.c (ext2_ioctl): Call invalidate_inode_pages() if EXT2_NOCOMPR_FL is toggled. Mon Apr 21 15:50:16 1997 Peter Moulder * ext2_fs.h (ext2_cluster_is_compressed): If ext2_get_cluster_bit() returns error then pass the error back. * compress.c (ext2_get_cluster_bit): Return 1 rather than any +ve num. ext2_cluster_is_compressed() is the only caller. * compress.c (ext2_free_key,ext2_get_key,ext2_next_key): Make static. Thu Jan 16 12:00:00 1997 Peter Moulder * file.c (ext2_mmap): Previously we would deny mmap access if there were an error or if compression were disabled (NOCOMPR). These checks have both been removed. It was wrong to disallow mmap access to a file with NOCOMPR, but it's more questionable whether or not we should allow compression to a file with ECOMPR. This file is not very accurate, particularly the older changes.