Commit graph

115 commits

Author SHA1 Message Date
Con Kolivas 44ed5727b3 Clean up and fix times displayed.
Merge fixes.
2011-03-07 21:05:20 +11:00
Con Kolivas 9fc551c159 Merge branch 'temp'
Conflicts:
	main.c
2011-03-07 17:25:10 +11:00
Con Kolivas 32e182c95a Check for free space in the right place for compression and give the right message. 2011-03-07 17:00:28 +11:00
Con Kolivas 38eca38743 Unify maxram allocation and limit threads when there isn't enough ram. 2011-03-07 13:23:14 +11:00
Con Kolivas a4ac1b8221 Display the progress percentage and ETA when it's known on STDIN compress. 2011-03-07 13:03:43 +11:00
ckolivas 63566a2992 Control.window was broken comparing to zero max_chunk. 2011-02-28 14:10:46 +11:00
ckolivas ab656aa98a Wrong check in rzip.c will leave a small chunk with unlimited mode. 2011-02-28 14:05:33 +11:00
Con Kolivas 8bdd5688c8 Check for free space before compression/decompression and abort if -f option is not enabled. 2011-02-26 23:10:28 +11:00
Con Kolivas db4f9f5fea Only retry mmapping if it's due to a memory allocation error. 2011-02-26 20:00:26 +11:00
Con Kolivas 7acd389382 Trivial cast to uchar * 2011-02-26 19:45:00 +11:00
Con Kolivas 8bf60c3114 Don't round to page size if the entire buffer will fit, otherwise this generates one extra pass of a tiny chunk. 2011-02-24 11:38:31 +11:00
Con Kolivas 9c8b1ee795 Deprecate the -M option as it is no longer of any significant utility compared to the -U option. 2011-02-22 20:38:39 +11:00
Con Kolivas bb33f7571c Multi-threading speed ups.
Add one more thread on compression and decompression to account for the staggered nature of thread recruitment.
Make the initial buffer slightly smaller and make it progressively larger, thus recruiting threads sooner and more evenly.
This also speeds up decompression for the same reason.
Check the amount of memory being used by each thread on decompression to ensure we don't try to recruit too much ram.
2011-02-22 00:49:50 +11:00
Con Kolivas a7b4708bd2 Use a different failure mode for when perror is unlikely to be set.
Add 2 unlikely wrappers.
2011-02-21 14:51:20 +11:00
Con Kolivas 57e25da244 Update copyright yeah in updated files. 2011-02-20 23:04:44 +11:00
Con Kolivas 8a27dc5057 Changes to make md5 be used for integrity testing.
Add the md5 value to the end of each archive.
This can then be used for integrity testing instead of crc32.
Keep crc in new archives to maintain compatibility with version 0.5 files.
Use md5 integrity testing on decompression when available in preference, and disable calculation of crc32.
Display the choice of integrity testing in verbose output and when -i is used.
Display the md5 and crc values when max verbosity, file info, or display hash is enabled.
Store a new flag in the magic header to show that the md5 value is stored at the end of the file.
Update the magic header information document.
2011-02-20 18:01:19 +11:00
Con Kolivas 44a279579e Add option to display hash information without enabling verbose mode. 2011-02-20 12:20:05 +11:00
Con Kolivas 4036125f94 Make the buffer passed to hash checking page sized which gives a minor speedup. 2011-02-20 12:16:45 +11:00
Con Kolivas 7287ab8a66 Fix md5 process bytes to occur at the same time as crc with the same buffer, saving time. 2011-02-19 10:34:45 +11:00
Con Kolivas d1a70bbb90 Remove the sb.low_top idea by trimming the size of sb.size_low when it gets to the end of the file instead. 2011-02-18 21:14:16 +11:00
Con Kolivas fb2a12744a Implement md5 checking on decompression.
Implement hash check flag to determine whether to show md5sum on compression/decompression or not.
2011-02-18 15:16:13 +11:00
Con Kolivas c2417877bc Being implementing md5 hash checking by importing the md5 code from coreutils.
Implement md5 hash checking on compression by doing the md5 hash check as each sb low buffer has been allocated to avoid going over the file again where possible.
2011-02-18 09:09:40 +11:00
Con Kolivas 2cabb335cb Update copyright notices courtesy of Jari Aalto. 2010-12-16 09:45:21 +11:00
Con Kolivas 427df4cd4a Fix stdin failing due to getting sizes all wrong.
Fix stdin compression values not being shown at end.
Fix inappropriate failure when lzma doesn't compress block.
2010-12-12 17:40:58 +11:00
Con Kolivas 4331ca4058 Move message to after size is finalised. 2010-12-11 12:25:43 +11:00
Con Kolivas 6c33071118 Rationalise the testing now that the default lzma settings use a lot less ram by default. 2010-12-11 01:07:43 +11:00
Con Kolivas 50437a8447 Move the threading on compression to higher up in the code, allowing the next stream to start using compression threads before the previous stream has finished.
This overlapping of compressing streams means that when files are large enough to be split into multiple blocks, all CPUs will be used more effectively throughout the compression, affording a nice speedup.
Move the writing of the chunk byte size and initial headers into the compthread to prevent any races occurring.
Fix a few dodgy callocs that may have been overflowing!
The previous commit reverts were done because the changes designed to speed it up actually slowed it down instead.
2010-12-10 23:51:59 +11:00
Con Kolivas 8dd9b00496 Revert "Make threads spawn at regular intervals along chunk size thus speeding up compression."
This reverts commit 688aa55c79.
2010-12-08 21:25:00 +11:00
Con Kolivas 5be0f6c5c9 Revert "Make sure chunk to compress is of a minimum size."
This reverts commit 8dd1b6ea58.
2010-12-08 21:23:41 +11:00
Con Kolivas dc42add0cf Since 32 bit seems to fall over so easily, get ruthless with limits on it, while still maintaining a large window with sliding mmap. 2010-12-04 08:39:52 +11:00
Con Kolivas 8dd1b6ea58 Make sure chunk to compress is of a minimum size. 2010-12-03 20:02:39 +11:00
Con Kolivas 688aa55c79 Make threads spawn at regular intervals along chunk size thus speeding up compression.
One more fix for unnecessary argument passing.
2010-12-03 19:33:56 +11:00
Con Kolivas 2a4892afa1 Streams passed are constant to some functions, don't pass stream argument to them. 2010-12-03 19:30:56 +11:00
Con Kolivas f2b5852872 Fix divide by zero error when a file is smaller than the page size and compressed with -U. 2010-11-30 11:22:02 +11:00
Con Kolivas f04b8aa15b Tweak defaults some more.
Set maximum size of compression window to chunk size in the case of -M mode and mmap size normally.
Set maximum window to 1.5x ram in -M mode.
2010-11-20 18:29:28 +11:00
Con Kolivas 6929492874 Fix the sliding mmap buffer not working on 2nd pass onwards which was causing a slowdon of death. 2010-11-20 09:44:54 +11:00
Con Kolivas 13ca377279 More tidying up and ensure control window is obeyed. 2010-11-20 09:22:47 +11:00
Con Kolivas 75e675e6dd Bump version number to 0.542.
Choose sane defaults for memory usage since linux ludicriously overcommits.
Use sliding mmap for any compression windows greater than 2/3 ram.
Consolidate and simplify testing of allocatable ram.
Minor tweaks to output.
Round up the size of the high buffer in sliding mmap to one page.
Squeeze a little more out of 32 bit compression windows.
2010-11-20 01:23:08 +11:00
Con Kolivas 25e053ed49 Wrong number of passes. 2010-11-18 23:44:22 +11:00
Con Kolivas 591d791791 Bump version to 0.541.
Limit LZMA window to 300MB on 32 bit as per reports of failure when larger.
Minor documentation and display clean ups.
2010-11-18 23:33:43 +11:00
Con Kolivas 6e4fdc97f8 Implement -p option to specify number of processors to determine thread count.
Remove -P option as failing to set permissions only issues a warning now, removing any requirement for -P.
Change default compression level back to 7 as 9 was not giving significantly better compression but was slowing things down.
2010-11-13 17:36:21 +11:00
Con Kolivas 02de002c58 Reworked the multithreading massively.
Place the data from each stream into a buffer that then is handed over to one thread which is allowed to begin doing the backend compression while the main rzip stream continues operating.
Fork up to as many threads as CPUs and feed data to them in a ring fashion, parallelising the workload as much as possible.
This causes a big speed up on the compression side on SMP machines.
Thread compression is limited to a minimum of 10MB compressed per thread to minimise the compromise to compression of smaller windows.
Alter the progress output to match some of the changes in verbose modes.
2010-11-13 01:26:09 +11:00
Con Kolivas ead0e54182 Drop the upper limit on lzma compression window on 64 bit. It is not necessary.
zpaq will fail with windows bigger than 600MB on 32 bit due to failing testing the 3* malloc test, so limit it to 600MB as well as lzma on 32 bit.
2010-11-07 01:57:23 +11:00
Con Kolivas b8528abee9 Consciously check page size, even though no one's going to build this on a machine with a different page size.
Clean up builds, removing ifdefs from main code.
Make output choices consistent.
2010-11-06 18:17:33 +11:00
Con Kolivas 5ea38c0e44 Ensure file size is correct on compressed file from stdin.
Improve visual output.
Update manpage.
2010-11-06 00:00:44 +11:00
Con Kolivas 017ec9e85a Move the ram allocation phase into rzip_fd to be able to get a more accurate measure of percentage done.
Prevent failure when offset is not a multiple of page size.
Add chunk percentage complete to output.
Tweak output at various verbosities.
Update documentation to reflect improved performance of unlimited mode.
Update benchmark results.
More tidying.
2010-11-05 23:02:58 +11:00
Con Kolivas a66dafe66a Updated benchmark results.
More tidying up.
2010-11-05 14:52:14 +11:00
Con Kolivas 296534921a Unlimited mode is now usable in a meaningful timeframe!
Modify the sliding mmap window to have a 64k smaller buffer which matches the size of the search size, and change the larger lower buffer to make it slide with the main hash search progress. This makes for a MUCH faster unlimited mode, making it actually usable.
Limit windows to 2GB again on 32 bit, but do it when determining the largest size possible in rzip.c.
Implement a linux-kernel like unlikely() wrapper for inbuilt expect, and modify most fatal warnings to be unlikely, and a few places where it's also suitable.
Minor cleanups.
2010-11-05 12:16:43 +11:00
Con Kolivas f422e93232 Update benchmarks.
Minor tweaks to output.
2010-11-05 00:16:18 +11:00
Con Kolivas 29b166629a Huge rewrite of buffer reading in rzip.c. We use a wrapper instead of
accessing the buffer directly, thus allowing us to have window sizes larger than
available ram. This is implemented through the use of a "sliding mmap"
implementation. Sliding mmap uses two mmapped buffers, one large one as
previously, and one page sized smaller one. When an attempt is made to read
beyond the end of the large buffer, the small buffer is remapped to the file
area that's being accessed. While this implementation is 100x slower than direct
mmapping, it allows us to implement unlimited sized compression windows.
Implement the -U option with unlimited sized windows.
Rework the selection of compression windows. Instead of trying to guess how
much ram the machine might be able to access, we try to safely buffer as much
ram as we can, and then use that to determine the file buffer size. Do not
choose an arbitrary upper window limit unless -w is specified.
Rework the -M option to try to buffer the entire file, reducing the buffer
size until we succeed.
Align buffer sizes to page size.
Clean up lots of unneeded variables.
Fix lots of minor logic issues to do with window sizes accepted/passed to rzip
and the compression backends.
More error handling.
Change -L to affect rzip compression level directly as well as backend
compression level and use 9 by default now.
More cleanups of information output.
Use 3 point release numbering in case one minor version has many subversions.
Numerous minor cleanups and tidying.
Updated docs and manpages.
2010-11-04 21:14:55 +11:00
Con Kolivas c106128d1a Fix darwin build and clean up ifdef and incorrect ordered includes at the same time.
All builds were using fakememopen due to incorrect ifdef usage, so make GNU builds actually use memopen again.
2010-11-03 13:14:46 +11:00
Con Kolivas 9c00229ee1 Fix fd_hist check occurring too early on decompress.
fsync after flushing buffer.
Remove unnecessary memset after anonymous mmap.
Do test malloc before compression backend to see how big a chunk can be passed.
2010-11-02 13:50:15 +11:00
Con Kolivas c464975b8d Oops, dropped some code! Fix it. 2010-11-02 00:18:17 +11:00
Con Kolivas 232b268367 Fix file size recording in the magic header when stdin is used. 2010-11-01 19:18:20 +11:00
Con Kolivas 43dd72b9e1 Do real stdin without the stupid temporary files by mmapping into anonymous ram. 2010-11-01 16:45:48 +11:00
Con Kolivas 49336a5e87 Update magic header info.
Move offset check to after reading chunk width.
Realloc instead of free and malloc.
2010-11-01 15:27:35 +11:00
Con Kolivas 1ed2ce423f Change the byte width to be variable depending on chunk size, and write it as a single char describing the next byte width for decompression.
More minor tidying.
2010-11-01 13:28:49 +11:00
Con Kolivas 3a22eb09b3 Fix output to work correctly to screen when stdout is selected.
Make stdout write directly to stdout on decompression without the need for temporary files since there is no need to seek backwards.
Make file testing not actually write the file during test.
More tidying up.
2010-11-01 11:18:58 +11:00
Con Kolivas a9ad1aef0e Start cleaning up all the flag testing with neat macros. 2010-11-01 04:53:53 +11:00
Con Kolivas 2bacbc60d2 We were attempting to truncate mmap to page size when only the offset needed to be.
Fix the longstanding limit on 32 bits that allowed us to allocate only 2GB of ram by moving the big malloc calls to mmap equivalents which allow us to mmap up to 2^44 bytes of anonymous space.
Use progressively smaller preallocation to try and defragment ram prior to real mmap call to increase success rate of allocating ram when it's a significant proportion of total ram.
Don't fail if preallocation is unsuccessful.
Add more detailed error reporting.
Minor cleanups.
2010-11-01 00:19:39 +11:00
Con Kolivas 19c2769061 Fix the page size rounding for mmap to work properly. 2010-10-31 17:02:12 +11:00
Con Kolivas 8d9b64e1ec Change byte width to be dependant on file size.
This will increase speed of compression and generate a smaller file, but not be backward compatible.
Tweak the way memory is allocated to optimise chances of success and minimise slowdown for the machine.
fsync to empty dirty data before allocating large ram to increase chance of mem allocation and decrease disk thrash of write vs read.
Add lots more information to verbose mode.
Lots of code tidying and minor tweaks.
2010-10-31 15:09:05 +11:00
Con Kolivas c5da3a1adb Add more robust checking.
Premalloc ram to improve early detection of being unable to allocate that much ram.
Make sure to always make chunk size a multiple of page size for mmap to work.
Begin changes to make variable byte width offsets in rzip chunks.
Decrease header entries to only 2 byte wide as per original rzip.
Random other tidying.
2010-10-31 10:35:04 +11:00
Con Kolivas d972496aa8 Make messages come via stdout instead of stderror courtesy of Alexander Saprykin 2010-04-25 16:26:00 +10:00
Con Kolivas 6dcceb0b1b Initial import 2010-03-29 10:07:08 +11:00