Commit graph

248 commits

Author SHA1 Message Date
Con Kolivas 2736118f82 Check for different endian.h includes and variants of le32toh. 2011-03-22 07:57:32 +11:00
Con Kolivas a30efcaa55 Portable generic byteswap for BE. 2011-03-22 00:13:29 +11:00
Con Kolivas 25a018fd9d Update Authors to include Serge Belyshev. 2011-03-21 21:02:05 +11:00
Con Kolivas 95f8b9fd90 Forgot return value. 2011-03-21 20:52:11 +11:00
Con Kolivas 135067a0b4 Yet more #6 BE fixes. 2011-03-21 20:33:43 +11:00
Con Kolivas 279b745cd7 Yet #5 more BE fixes. 2011-03-21 20:31:33 +11:00
Con Kolivas 637b0d5f7c yet yet yet yet more BE fixes. 2011-03-21 20:29:24 +11:00
Con Kolivas 04d3d6a1f5 Read BE fixes. 2011-03-21 20:23:36 +11:00
Con Kolivas 06a76bc4aa Revert "More big endian fixes."
This reverts commit edbcc797e0.

Broke regression text. Needs more attention.
2011-03-21 19:01:24 +11:00
Con Kolivas edbcc797e0 More big endian fixes. 2011-03-21 12:41:36 +11:00
Con Kolivas 280254b8cb Forgot to remove the initial pos offset. 2011-03-21 12:34:57 +11:00
Con Kolivas fd9bbfe64a One last check on limit. 2011-03-21 07:33:35 +11:00
Con Kolivas f87528d14d Forgot to include salt length for next head. 2011-03-20 17:01:33 +11:00
Con Kolivas 30b70dc884 Fixes for non little endian machines. 2011-03-20 16:16:38 +11:00
Con Kolivas 0dad7dcc5a Modify the encrypted version to not write down the rzip chunk size, then keep track of where each block header is written, go back and write 8 bytes of salt before it and encrypt the headers in place. 2011-03-20 15:45:44 +11:00
Con Kolivas e7d33e82d0 Make read_1g able to read from the tmp outbuf if we decide to read from fd_out. 2011-03-19 14:46:06 +11:00
Con Kolivas ff5a5ed054 Use separate lrz_encrypt and lrz_decrypt wrappers to lrz_crypt. 2011-03-19 14:04:22 +11:00
Con Kolivas 63fb1bafea Modify the file format further to make all block header information only encode the number of bytes determined in chunk_bytes instead of 8 full bytes all the time. 2011-03-18 23:18:36 +11:00
ckolivas b8d8ecfe33 Fix warnings.
Patch ~ by Serge Belyshev.
2011-03-18 10:37:09 +11:00
ckolivas e856d481bf Discard hash_iv entirely, using passphrase hash and centralise key generation.
Patch by Serge Belyshev.
2011-03-18 10:22:58 +11:00
Con Kolivas a3e80871c2 Add 8 bytes of random data to the start of every encrypted compressed block and use it along with 8 bytes from the stored salt to make a unique key and IV for encryption. 2011-03-18 00:06:11 +11:00
ckolivas e78069c0d7 Consolidate magic writing to be able to seek to read and encrypt block header data later. 2011-03-17 16:59:27 +11:00
ckolivas 4bc23ee001 Centralise where all encryption/decryption is done, and whether to carry over the IV or not. 2011-03-17 14:10:58 +11:00
ckolivas 660243b8dc Pad out first block if less than CBC_LEN and encrypting or else encryption will fail. 2011-03-17 11:19:34 +11:00
Con Kolivas 76280ffec5 Mlock ivec for it will hold the injection vector. 2011-03-17 00:25:15 +11:00
Con Kolivas a7468ce6e4 Fail if block to encrypt ends up being less than one full block for now, and tidy up code. 2011-03-16 23:13:09 +11:00
Con Kolivas c41cfe9e83 Some decompression code needs more room so simply allocate u_len for s_buf. 2011-03-16 21:48:21 +11:00
Con Kolivas 5fd7c82e1f Implement ciphertext stealing to not have to pad compressed blocks courtesy of Serge Belyshev who saved me hours of debugging thanks! 2011-03-16 21:24:05 +11:00
Con Kolivas 928a0a098a Consolidate padded length throughout. 2011-03-16 10:29:16 +11:00
Con Kolivas bedea4dbec Consolidate cbc padding into a macro. 2011-03-16 10:17:48 +11:00
Con Kolivas ddcc45ebf0 Revert "aes_crypt_cbc always returns zero so ignore its return value."
This reverts commit 4314970b0d.

Oops, it can return invalid length.
2011-03-16 10:00:20 +11:00
Con Kolivas 2d2a9bc1e9 We're freeing the wrong buffer by mistake should decompression fail. 2011-03-16 09:50:30 +11:00
Con Kolivas 4314970b0d aes_crypt_cbc always returns zero so ignore its return value. 2011-03-16 08:39:05 +11:00
Con Kolivas 519123966a total_read field is no longer used. 2011-03-16 08:32:16 +11:00
Con Kolivas 5da0633893 aes_crypt_cbc will allow you to work on the same buffer, so don't bother allocating a separate buffer.
Allocate slightly more on the buffer that might be used for encryption rather than reallocing.
2011-03-16 00:46:39 +11:00
Con Kolivas c5938c6a8b Implement the actual aes cbc encryption and decryption. 2011-03-15 23:52:39 +11:00
ckolivas 65a681a254 Relative offset is not required in tmp inbuf, it can be safely zeroed. 2011-03-15 11:21:26 +11:00
Con Kolivas 3a8c0b6689 Remove seeks that aren't required and don't work on tmp input buffers.
Clean up open_stream_in.
2011-03-14 21:51:27 +11:00
Con Kolivas c832e80085 More infrastructure to read from temporary buffers on stdin decompression. 2011-03-14 21:19:57 +11:00
Con Kolivas 36e09f206e Begin massive read changes to support using temporary file for STDIN. 2011-03-14 20:22:45 +11:00
Con Kolivas 684959efed Add fields for temporary input buffer and clamp memory accordingly in preparation. 2011-03-14 14:47:26 +11:00
Con Kolivas 5f7a03932b Calculate the total expected size progressively and show it when it's not known. 2011-03-14 13:32:36 +11:00
Con Kolivas 9e772d3140 Make ALL decompression use temporary in-ram buffer whenever possible. 2011-03-14 12:48:40 +11:00
Con Kolivas 27d7c2a031 Tidy. 2011-03-14 12:23:12 +11:00
Con Kolivas 0fe3213a47 Write to physical files if we cannot fit the decompression in ram. 2011-03-14 12:15:54 +11:00
Con Kolivas 37009e2ac5 Make sure to read on an fd if that's what we're supposed to be doing. 2011-03-14 11:25:04 +11:00
Con Kolivas b644240152 write_1g always uses control->fd_out so don't pass fd to it. 2011-03-14 11:15:35 +11:00
Con Kolivas 4a6fa7602f Begin decompressing to stdout via temporary buffer by creating a read/write wrapper. 2011-03-14 10:07:51 +11:00
Con Kolivas f2ddd9022c Ignore the eof flag if the file size is known. 2011-03-13 21:31:03 +11:00
Con Kolivas 8756fe91e2 Enable decompression when file has been chunked stdout and display progress only when expected size is known. 2011-03-13 17:52:23 +11:00
Con Kolivas 6d0ac95170 Remove extra locking that does nothing. 2011-03-13 12:12:37 +11:00
Con Kolivas 6ac74aa9f0 Create a flag to know when the temporary output buffer is in use, in preparation for when we use it on decompression. 2011-03-13 08:34:06 +11:00
Con Kolivas 2f87f62696 Make the tmp out buf slightly larger to account for incompressible data, and check for buffer overflows. 2011-03-13 08:16:46 +11:00
Con Kolivas 11ea12d3ce Forgot to test for TEST_ONLY. 2011-03-12 23:07:52 +11:00
Con Kolivas d067a6ea9e Implement the real workings of writing to a temporary buffer before flushing to stdout. 2011-03-12 22:46:57 +11:00
Con Kolivas 7fbec0a783 Prepare to write compressed output by flushing stdout after each chunk is compressed. 2011-03-12 19:56:08 +11:00
Con Kolivas c75a50f723 Being modifying write_1g function to be able to write to a temporary buffer instead of straight to fd_out.
Split out make_magic to be able to write magic wherever we want later.
2011-03-12 14:13:28 +11:00
Con Kolivas 9444441d51 Modify maximum ram usable when stdout is being used in preparation for temporary in-ram file during stdout and fix summary shown and 32 bit limits. 2011-03-12 12:19:02 +11:00
Con Kolivas fe68b9a3f7 Institute writing and reading of 0.6 file format for compress/decompress. 2011-03-12 11:17:11 +11:00
Con Kolivas 3a00735c24 Fix locking.
Patch by <mike@zentific.com>
2011-03-11 12:29:27 +11:00
Con Kolivas a8dcecd721 fix-undefined-mutex-behavior-rename-stream-variable.
Patch by <mike@zentific.com>
2011-03-11 08:35:15 +11:00
Con Kolivas 643054ae22 Fix threading errors.
Patch by <mike@zentific.com>
2011-03-11 08:33:35 +11:00
Con Kolivas fb2de8cb35 Remove unused offset variable. 2011-03-09 13:33:53 +11:00
Con Kolivas 1b965167ff Remove unused offset variable. 2011-03-09 13:30:20 +11:00
Con Kolivas 11052f56f3 Ignore the lzo_1 return value entirely. 2011-03-09 13:25:33 +11:00
Con Kolivas 2db75fe408 Get rid of trailing whitespace 2011-03-09 08:50:46 +11:00
Con Kolivas 1a7c409e10 header-mangling-part-X-move-all-headers-defines-into 2011-03-09 08:37:26 +11:00
Con Kolivas 99c3ea2ab9 header-mangling-part-3-remove-ugly-hacks-for-liblrzi 2011-03-09 08:36:07 +11:00
Con Kolivas 1511c27aad header-mangling-part-2-move-all-function-prototypes 2011-03-09 08:34:44 +11:00
Con Kolivas f6f0a25ef6 rebase-of-function-split-and-control-additions-to-fu 2011-03-09 08:32:14 +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 3433438a8e Structs in stream.c can be static. 2011-02-26 20:11:43 +11:00
ckolivas f9f880908c Remove the slightly fragile exponential growth buffer size.
It was only speeding up compression a small amount, yet adversely affected compression and would segfault due to the size not being consistent on successive passes.
2011-02-25 10:10:22 +11:00
Con Kolivas dcf62d11a0 Make sure not to make the bufsize larger than the limit.
Drop the page rounding since it is of no demonstrable benefit but adds complexity.
2011-02-24 12:20:06 +11:00
Con Kolivas 22ae326d01 Make it always clear that a failure to allocate a buffer has occurred on compression. 2011-02-24 11:52:30 +11:00
Con Kolivas 402dbbed65 Make sure we don't start shrinking the buffer size. 2011-02-23 15:34:43 +11:00
Con Kolivas 94673d3fe3 Change the LZO testing option to be a bool on/off instead of taking a confusing parameter.
Make the lzo testing message simpler and only appear when max verbose mode is enabled.
2011-02-23 01:15:18 +11:00
Con Kolivas 011344753a With lzma and zpaq, the compression overhead per thread is significant.
As we can work out what that compression overhead is, we can factor that into testing how much ram we can allocate.
There is no advantage to running multiple threads when there is no compression back end so drop to 1 only.
Limit ram for compression back end to 1/3 ram regardless for when OSs lie due to heavy overcommit.
2011-02-22 15:19:31 +11:00
Con Kolivas bcb857d934 Don't add extra threads for single-threaded decompression case. 2011-02-22 00:58:55 +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 88e3df6af1 Print perror before unlinking files.
Join common parts of fatal errors.
Update copyright notices.
Small improvement to visual output.
2011-02-21 16:11:59 +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 74df2b5973 Minor updates to man pages, lrzip.conf example file.
Update main help screen to include environment settings.
Update to respect $TMP environment variable for TMP files.
Updated control structure to include tmpdir pointer.
Update lrzip.conf parser to respect -U -M options.
Update lrzip.conf example to include new parameters.
Reorder main Switch loop in main.c for readability.
Have MAXRAM and control.window be exclusive. MAXRAM wins.
Have UNLIMITED and control.window be exclusive. UNLIMITED wins.
Have UNLIMITED and MAXRAM be exclusive. UNLIMITED wins.
Corrects heuristic computation in rzip.c which would override
MAXRAM or UNLIMITED if control.window set
Show heuristically computed control.window when computed.
Remove display compression level from control.window verbose output.
Update print_verbose format for Testing for incompressible data in stream.c
to omit extra \n.

Changes by Peter Hyman <pete@peterhyman.com>
2011-02-21 12:03:08 +11:00
Con Kolivas 57e25da244 Update copyright yeah in updated files. 2011-02-20 23:04:44 +11:00
Con Kolivas 626e0be281 Convert semaphore primitives to pthread_mutexes making them more portable, thus allowing multithreading to work on OSX. 2011-02-17 00:24:28 +11:00
Con Kolivas 05c5326df3 Revert "OSX doesn't support unnamed semaphores so to make it work, fake the threading by just creating the threads and waiting for them to finish."
This reverts commit b81542cea4.

Revert the change bypassing semaphores in OSX in preparation for changing the semaphores to mutexes.
2011-02-16 17:40:50 +11:00
Con Kolivas b81542cea4 OSX doesn't support unnamed semaphores so to make it work, fake the threading by just creating the threads and waiting for them to finish.
This is done by making the semaphore wrappers null functions on osx and closing the thread in the creation wrapper.
Move the wrappers to rzip.h to make this change clean.
2011-02-11 12:22:09 +11:00
Con Kolivas f2d33c00f8 Cast the mallocs to their variable type.
Check that read and write actually return greater than zero.
2011-02-11 11:46:58 +11:00
Con Kolivas 3879807865 Try limiting stream_read in unzip_literal and just returning how much was read. 2011-02-10 16:57:22 +11:00
Con Kolivas 9a3bfe33d1 Revert "Make sure to read the full length asked of unzip_literal."
This reverts commit 499ae18cef.

Wrong fix, revert it.
2011-02-10 16:46:35 +11:00
Con Kolivas 499ae18cef Make sure to read the full length asked of unzip_literal. 2011-02-10 15:30:31 +11:00
Con Kolivas 2a0553bc54 Revert "Decompress more than one stream at a time if there are threads free and the end of one stream is reached."
This reverts commit 8ee9ef64f5.

This change is unreliable. Hence revert it and all dependent patches.
2011-02-09 12:39:15 +11:00
Con Kolivas 8239635038 Revert "Limit the maximum number of threads on stream 0 to 1 again as stream 1 data always appear after a chunk of stream 0 data."
This reverts commit 0b0f6db606.
2011-02-09 12:39:02 +11:00
Con Kolivas 44399d88ac Revert "Check we dont go over control.threads when trying to fill the other stream."
This reverts commit 0bded0a7d9.
2011-02-09 12:38:32 +11:00
Con Kolivas 0bded0a7d9 Check we dont go over control.threads when trying to fill the other stream.
Update comments to reflect when we can go over control.threads.
2011-02-09 11:07:38 +11:00
Con Kolivas 0b0f6db606 Limit the maximum number of threads on stream 0 to 1 again as stream 1 data always appear after a chunk of stream 0 data. 2011-02-09 10:45:03 +11:00
Con Kolivas 8ee9ef64f5 Decompress more than one stream at a time if there are threads free and the end of one stream is reached.
Still limit total threads running to control.threads.
This affords a small speedup on decompression.
2011-02-08 11:58:01 +11:00
Con Kolivas aa00c29fba The free semaphore is now only updated from the main process on decompression so there are no synchronisation concerns.
Remove the free semaphore and the fragile use of sem_trywait and replace it with a simple busy flag for threads on decompression.
2011-02-08 08:55:36 +11:00
Con Kolivas 9c2b86fec6 We are flushing the wrong file on decompression. Make sure we flush the file out. 2011-02-08 08:27:22 +11:00
Con Kolivas 6b73eb1394 We do not need to wait for the main process to be ready to receive the data from the threads before shutting them down.
Only wait for the "ready" semaphore if we've failed to decompress in parallel.
This affords a small speedup on decompression.
2011-02-06 11:58:47 +11:00
Con Kolivas 8d110e3366 Remove the check for interleaved streams as it wasn't achieving anything.
Make sure the thread has really exited before moving on, and set the free semaphore from outside the thread once it has joined.
2011-02-06 11:21:36 +11:00
Con Kolivas 4efa81b1d0 Relax the memory allocation testing when no back end compression will be used. 2011-02-06 09:00:43 +11:00
Con Kolivas f7a27cbde5 Flush writes to disk before allocating more ram, avoids one more fsync at the end of compression.
Add fsyncing to decompression as well, improving reliability of allocating more ram.
2010-12-18 10:02:19 +11:00
Con Kolivas e1bb9ebda5 There's a bug where archives with multiple stream 0 entries per chunk can be corrupted on decompression with threading enabled.
Until the bug is tracked down, disable multithreaded decompression when an archive with interleaved stream 0/1 entries is detected.
2010-12-18 00:50:49 +11:00
Con Kolivas 2cabb335cb Update copyright notices courtesy of Jari Aalto. 2010-12-16 09:45:21 +11:00
Con Kolivas becb08129c gotti spotted that bzip2 and gzip would fail if they encountered an incompressible block instead of returning it uncompressed, and provided a patch for it.
Tweaked the patch slightly for style.
2010-12-15 22:54:15 +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 34f76fa73c Don't wait on a semaphore the 2nd time attempting to compress/decompress.
Wait for all ucompthreads to be free.
Destroy the semaphores used by ucompthreads when a stream_in is closed.
2010-12-12 10:39:52 +11:00
Con Kolivas 351cfced8a Return the correct buffer on decompression failure in case decompression will be attempted again. 2010-12-11 14:25:07 +11:00
Con Kolivas aeeeedcab2 Cope with multithreaded memory failures better.
Instead of failing completely, detect when a failure has occurred, and serialise work for that thread to decrease the memory required to complete compression / decompression.
Do that by waiting for the thread before it to complete before trying to work on that block again.
Check internally when lzma compress has failed and try a lower compression level before falling back to bzip2 compression.
2010-12-11 13:19:34 +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 a6ab7c875b Limit the number of threads decompressing stream 0 to just 1 since it's always followed by stream 1 chunks, and it may lead to failure to decompress due to running out of memory by running too many threads. 2010-12-11 00:04:30 +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 e0265b33e1 Default compression level and window size on lzma is set to 7 which is the highest it goes.
Scale the 9 levels down to the 7 that lzma has.
This makes the default lzma compression level 5 which is what lzma normally has, and uses a lot less ram and is significantly faster than previously, but at the cost of giving slightly less compression.
2010-12-08 20:53:26 +11:00
Con Kolivas c3dfcfcec1 Update version number to 0.544.
Change suggested maximum compression in README to disable threading with -p 1.
Use bzip2 as a fallback compression when lzma fails due to internal memory errors as may happen on 32 bits.
2010-12-04 21:36:51 +11:00
Con Kolivas 23e89b06af Minor output consistency tidying. 2010-12-04 09:04:38 +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 2da407a178 Change decompression threading to have a group of threads for each stream (2 in total), thus making mulithreaded decompression more robust. 2010-12-03 19:35:48 +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 22da2ee76d Push version number to 0.543.
Update docs.
2010-11-24 21:08:35 +11:00
Con Kolivas 6f2b94be3b Fix the case where a compressed file has more than one stream 0 entry per block.
Limit lzma windows to 300MB in the right place on 32 bit only.
Make the main process less nice than the backend threads since it tends to be the rate limiting step.
2010-11-24 20:12:19 +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 fa757007d6 Refix the off-by-one that wasn't off-by-one. 2010-11-18 23:36:17 +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 2b08c6e280 Implement massive multithreading decompression.
This is done by taking each stream of data on read in into separate buffers for up to as many threads as CPUs.
As each thread's data becomes available, feed it into runzip once it is requests more of the stream.
Provided there are enough chunks in the originally compressed data, this provides a massive speedup potentially proportional to the number of CPUs. The slower the backend compression, the better the speed up (i.e. zpaq is the best sped up).
Fix the output of zpaq compress and decompress from trampling on itself and racing and consuming a lot of CPU time printing to the console.
When limiting cwindow to 6 on 32 bits, ensure that control.window is also set.
When testing for the maximum size of testmalloc, the multiple used was out by one, so increase it.
Minor output tweaks.
2010-11-16 21:25:32 +11:00
Con Kolivas e9957e1115 Fix zpaq compression now updating the console too much because it's now so much faster it uses up a lot of CPU time just ouputting to the screen.
Do this by updating only every 10%, and print separate updates for each thread.
2010-11-13 08:33:30 +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 5505097b2f Implement multithreaded back end compression by splitting up the compression stream into multiple threads, dependant on the number of CPUs detected.
This facilitates a massive speed up on SMP machines proportional to the number of CPUs during the back end compression phase, but does so at some cost to the final size.
Limit the number of threads to ensure that each thread at least works on a window of STREAM_BUFSIZE.
Disable the lzma threading library as it does not contribute any more to the scalability of this new approach, yet compromises compression.
Increase the size of the windows passed to all the compression back end types now as they need more to split them up into multiple threads, and the number of blocks increases the compressed size slightly.
2010-11-10 20:56:17 +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 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 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 1e88273ffc Minor fixes. 2010-11-02 00:08:35 +11:00
Con Kolivas 772fbf602e Reinstitute 2GB window limit on 32 bit. It still doesn't work. However we can now decompress larger windows.
Do more mmap in place of malloc.
Update docs.
Remove redundant code.
2010-11-01 22:55:59 +11:00
Con Kolivas 0e09c9ec24 Reinstate the temporary file for decompression from stdin. Seeking makes that option broken without the temporary file.
Start documenting the new features in this version.
Minor tidying.
2010-11-01 21:37:55 +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 cb27097cb4 A few more cleanups to avoid using temporary files for stdout and testing on decompression. 2010-11-01 12:50:20 +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 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