e2compr-0.4.52-alpha.patch build instructions

Released under the GPL V 2 license.

All new changes copyright (C) Matthias Winkler Apr 17, 2008
e-mail: <matthiaswinkler@gmx.de>


Installation:
=============

1. untar:
	> tar -xzf  linux-X.X.XX-e2compr-0.4.52.patch.tgz

2. change to you kernel directory

3. make clean:
	> make clean

3. patch:
	> patch -p1 <  ../patch/to/patch/linux-X.X.XX-e2compr-0.4.52.patch

   see if any rejects occured:
	> find | grep .rej
	
   WARNING: This rejects, if any, should be fixed manually!

4. config:
	> make oldconfig
	> make menuconfig
   Now enable at least the ext2-compression feature:
   Filesystems:   
	     <*> Second extended fs support                                     
         [ ]   Ext2 extended attributes                                     
         [ ]   Ext2 execute in place support                                
         [*]   Ext2 file compression (DANGEROUS)                          
                 Ext2 file compression options  ---> 

5. make:
	> make 
	> make modules_install



Making patches:
===============
I enclosed my script to create patches from source. I always keep
two sourcetrees of a patched kernel and a clean, vanilla kernel.
To create a new patch from these sources you can just use the 
enclosed mke2c_patch script. Therefore edit the mke2c_patch to 
fit your needs (path to kernel directories).


Recent changes:
===============

17 April 2008
	* first patch for kernel 2.6.25 released

20 March 2008
        * EXT2_COMPRESS_WHEN_CLU didn't work. this feature enables 
          compression during file write. 

5 Oct 2007
	* First offical Sourceforge release as version 0.4.51
	* TODO: figure out what is necessary to enable swap 
	  suppport for e2compr again (see mm/swapfile.c).		 

27 Sep 2007
	Matthias Winkler <m.winkler@unicon-ka.de>
	* System stalled with a lot of I/O during de-compression of
	  USB-Sticks, too. I replaced mark_buffer_dirty 
	  with set_buffer_dirty. This achieves that ONLY the buffers 
	  and not the pages are marked. Then I write back the 
	  buffers with ll_rw_block() at the end of 
	  ext2_decompress_cluster() and ext2_decompress_pages(). 
	  This should stop flooding the system with dirty pages. 
	  Because now every routine waits for its newly dirtied buffers.	  
	  My system with 128MB of RAM is responding much more better during
	  compression/decompression now. Desompression also seems
	  to be a bit faster. 
	  (this change is active: #ifndef E2C_GENERIC_OSYNC)  

25 Sep 2007
	Matthias Winkler <m.winkler@unicon-ka.de>
	* System stalled with a lot of I/O during compression of
	  USB-Sticks. Seems generic_osync_inode() should not be 
	  called in ext2_compress_cluster. Therefore I replaced
	  it with ll_rw_block() to write the modified blocks
	  directly back to disk. This gave also a ~100% better
	  performance for compression.
	
9 Sep 2007
	Matthias Winkler <m.winkler@unicon-ka.de>
	* fixed bdev-bug. this bug appeared primarily when
	  files contained holes. A page with holes, which 
	  was dirty caused ext2_get_cluster_blocks [ext2_get_block()]
	  to create ALL blocks of the page, even if there were holes!
	  These allocated hole-blocks weren't set to 0 anywhere and
	  therefore contained invalid data. I changed the
	  code to never allocate these holes.
	  
	* ext2_truncate() added again to ext2_compress_cluster for
	  uncompressed clusters. Fixes filesize errors reported by 
	  "e2fsck -f /dev/..."	  

24 Aug 2007
	Matthias Winkler <m.winkler@unicon-ka.de>
	
	Major changes:	
	* completly ported inode->i_mutex
	
	* clever CONFIG_GZ_HACK to reject "uncompressable" files 
	  (according to their extension) early. The IOCTL in ioctl.c 
	  which sets the compression on the file already rejects such 
	  extensions now.
	 
	* new create_empty_buffers_e2c() was necessary, because the
	  "extra"-pages should NOT have a valid i_mapping! Further the
	  buffers needed to be initalized right.
	
	* proper block initalization (bdev-bug) in:
	   - create_empty_buffers_e2c()
	   - ext2_get_cluster_blocks
	   
	* in file.c copied:  
	  ...with one single change at ext2_mapping_read in label page_ok:
	  A new Page-Flag (page-flags.h) the so called "PG_compr"-Flag is 
	  checked to assure the corresponding page is not under 
	  compression/decompression. This was necessary because
	  generic_mapping_read() doesn't lock() the page in ALL cases!!!
	  Otherwise the generic_mapping_read() would have to lock EVERY page
	  in the whole system before returning it....
	  
	* Fixed HiMem-Support: Balanced ALL kamp/kunmap calls. Unbalanced
	  functions cause the system to hang at "kmap_himem()" after some 
	  time. Can be seen with magic-sysctrl "altgr + prtscr + W".
	
	* ext2_decompres_cluster() didn't mark uptodate pages for writeback.
	  Don't know how this method could EVER have worked...
	  
	* ext2_compress_cluster() caused an always increasing amount of dirty-pages
	  (cat /proc/vmstat) which couldn't be wrote back by sync/umount.
	  I think this was due the ClearPageDirty at the end of ext2_compress_cluster().
	  
	* introduced ext2_get_dcount() to savely determine if a file is really "open"
	  and to abort compression/decompression in such a case. 
	  
	* Removed gzip completely and not working assembler code. Replaced by the
	  kernels built-in zlib, which is pretty the same code... 
	
	* New kernel configuration interface
	 
	* Rollback of some unecessary "fixes"...
	
	TODO:
	
	* HiMem-Support:
	  One might try to use kmap_atomic instead of kamp in ext2_readpage. kmap_atomic
	  doesn't block and might speed up the regular page reading. might.		
	
20 April 2007
	Andreas:
		
	* Replaced GZIP with zlib of the kernel because the assembly versions of existing
	  compression modules crashed.
	  
	* Replaced gzip with the kernel zlib, which is built-in anyway
	
	* Initial HiMem-Support. 


06 Mar 2007

	Terry Loveall <loveall@iinet.com>

	* adapted linux-2.6.10-e2compr-0.4.45-alpha0126.diff to 2.6.18.5 kernel

	* replaced most instances of down/up(inode->i_sem) with 
	  lock/unlock(inode->i_mutex). For exception see file.c, below.

	* made various printk regularizations to uniquely identify each printk
	  instance. Inserted missing KERN_DEBUG and KERN_WARNING.

	* 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 filesize 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

	* file.c:
	  removed file->f_error code since f_error no longer in file struct.
	  ext2_file_write: changed down/up i_sem to down_read/up_read i_alloc_sem

	* inode.c:
	  bug fix: ext2_get_block: restored changed: loop to bforget

	* ioctl.c:
	  ext2_ioctl: scrubbed 'B' flag on file uncompress.

	* match[56]86.S:
	  made code dependent on #ifdef CONFIG_REGPARM to compile with either
	  register variable or stack variable parameter passing.


