diff --git a/doc/lrzip.conf.example b/doc/lrzip.conf.example index 8bc43c4..d07aea1 100644 --- a/doc/lrzip.conf.example +++ b/doc/lrzip.conf.example @@ -15,9 +15,6 @@ # Use -U setting, Unlimited ram. Yes or No # UNLIMITED = NO -# Use -M setting, Maximum ram. Yes or No -# MAXRAM = NO - # Compression Method, rzip, gzip, bzip2, lzo, or lzma (default), or zpaq. # If specified here, command line options not usable. # COMPRESSIONMETHOD = lzma diff --git a/lrztar b/lrztar index 4026eef..c0de2b9 100755 --- a/lrztar +++ b/lrztar @@ -23,14 +23,14 @@ function lrztar_local() { local p="${@:1:$(($#-1))}" s="${!#}" tname= fname= \ v_w=0 v_O=0 v_S=0 v_D=0 v_p=0 v_q=0 v_L=0 \ - v_n=0 v_l=0 v_b=0 v_g=0 v_z=0 v_M=0 v_U=0 \ + v_n=0 v_l=0 v_b=0 v_g=0 v_z=0 v_U=0 \ v_T=0 v_N=0 v_v=0 v_f=0 v_d=0 v_h=0 \ v_H=0 v_c=0 v_k=0 x= i= OPTERR=0 trap '[[ -z $tname ]] || rm -rf "$tname" &> /dev/null' 1 2 3 15 which tar &> /dev/null || { printf "lrztar: no tar in your path\n"; return 1; } which lrzip &> /dev/null || { printf "lrztar: no lrzip in your path\n"; return 1; } - while getopts w:O:S:DqL:nlbgzMUT:N:p:vfodtVhHck x; do + while getopts w:O:S:DqL:nlbgzUT:N:p:vfodtVhHck x; do [[ $x == [otV] ]] || ((v_$x=1)) &> /dev/null \ || { printf "lrztar: invalid option for lrztar %s\n" "$x"; return 1; } done diff --git a/main.c b/main.c index 2460acb..21f6534 100644 --- a/main.c +++ b/main.c @@ -52,7 +52,6 @@ static void usage(void) print_output(" -z zpaq compression (best, extreme compression, extremely slow)\n"); print_output("Low level options:\n"); print_output(" -L level set lzma/bzip2/gzip compression level (1-9, default 7)\n"); - print_output(" -M Maximum window (all available ram)\n"); print_output(" -N value Set nice value to value (default 19)\n"); print_output(" -p value Set processor count to override number of threads\n"); print_output(" -T value Compression threshold with LZO test. (0 (nil) - 10 (high), default 1)\n"); @@ -643,7 +642,7 @@ int main(int argc, char *argv[]) else if (!strstr(eptr,"NOCONFIG")) read_config(&control); - while ((c = getopt(argc, argv, "L:h?dS:tVvDfqo:w:nlbMUO:T:N:p:gziHck")) != -1) { + while ((c = getopt(argc, argv, "L:h?dS:tVvDfqo:w:nlbUO:T:N:p:gziHck")) != -1) { switch (c) { case 'b': if (control.flags & FLAG_NOT_LZMA) @@ -691,9 +690,6 @@ int main(int argc, char *argv[]) if (control.compression_level < 1 || control.compression_level > 9) failure("Invalid compression level (must be 1-9)\n"); break; - case 'M': - control.flags |= FLAG_MAXRAM; - break; case 'n': if (control.flags & FLAG_NOT_LZMA) failure("Can only use one of -l, -b, -g, -z or -n\n"); @@ -785,13 +781,8 @@ int main(int argc, char *argv[]) control.flags |= FLAG_SHOW_PROGRESS; } - /* perform checks on MAXRAM, UNLIMITED, and control.window */ - if (MAXRAM && UNLIMITED) { - print_err("Cannot have -U and -M, MAX window disabled.\n"); - control.flags ^= MAXRAM; - } - if ((MAXRAM || UNLIMITED) && control.window) { - print_err("If -M or -U used, cannot specify a window size with -w.\n"); + if (UNLIMITED && control.window) { + print_err("If -U used, cannot specify a window size with -w.\n"); control.window = 0; } @@ -868,15 +859,10 @@ int main(int argc, char *argv[]) print_verbose("Compression Window: %lld = %lldMB\n", control.window, control.window * 100ull); /* show heuristically computed window size */ if (!control.window && !UNLIMITED) { - if (MAXRAM && !STDIN) - temp_chunk = control.ramsize / 2 * 3; - else - temp_chunk = control.ramsize / 3 * 2; + temp_chunk = control.ramsize / 3 * 2; temp_window = temp_chunk / (100 * 1024 * 1024); print_verbose("Heuristically Computed Compression Window: %lld = %lldMB\n", temp_window, temp_window * 100ull); } - if (MAXRAM) - print_verbose("Using all available RAM for Window size\n"); if (UNLIMITED) print_verbose("Using Unlimited Window size\n"); } diff --git a/man/lrzip.1 b/man/lrzip.1 index 638bfb5..d1f117f 100644 --- a/man/lrzip.1 +++ b/man/lrzip.1 @@ -55,7 +55,6 @@ Options affecting compression: \-z zpaq compression (best, extreme compression, extremely slow) Low level options: \-L level set lzma/bzip2/gzip compression level (1\-9, default 7) - \-M Maximum window (all available ram) \-N value Set nice value to value (default 19) \-p value Set processor count to override number of threads \-T value Compression threshold with LZO test. (0 (nil) - 10 (high), default 1) @@ -101,23 +100,15 @@ Set the compression level from 1 to 9. The default is to use level 7, which gives good all round compression. The compression level is also strongly related to how much memory lrzip uses. See the \-w option for details. .IP -.IP "\fB-M \fP" -Maximum window size\&. If this option is set, then lrzip tries to load the -entire file into ram as one big compression window, and will reduce the size of -the window until it does fit. This may induce a hefty swap load on your machine -but can also give dramatic size advantages when your file is the size of your -ram or larger. -.IP .IP "\fB-U \fP" Unlimited window size\&. If this option is set, and the file being compressed does not fit into the available ram, lrzip will use a moving second buffer as a "sliding mmap" which emulates having infinite ram. This will provide the most possible compression in the first rzip stage which can improve the compression of ultra large files when they're bigger than the available ram. However it runs -progressively slower the larger the difference between ram and the file size so -it is worth trying the \-M option first to see if the whole file can be accessed -in one pass, and then if not, it should be used together with the \-M option (if -at all). +progressively slower the larger the difference between ram and the file size, +so is best reserved for when the smallest possible size is desired on a very +large file, and the time taken is not important. .IP .IP "\fB-T 0\&.\&.10\fP" Sets the LZO compression threshold when testing a data chunk when slower diff --git a/rzip.c b/rzip.c index 49ec57b..0ee8c61 100644 --- a/rzip.c +++ b/rzip.c @@ -773,11 +773,8 @@ void rzip_fd(int fd_in, int fd_out) control.max_mmap = MIN(control.max_mmap, two_gig); round_to_page(&control.max_mmap); - /* Set maximum chunk size to proportion of ram according to mode */ - if (MAXRAM && !STDIN) - control.max_chunk = control.ramsize / 2 * 3; - else - control.max_chunk = control.ramsize / 3 * 2; + /* Set maximum chunk size to 2/3 of ram */ + control.max_chunk = control.ramsize / 3 * 2; if (UNLIMITED) control.max_chunk = control.st_size; if (control.window) diff --git a/rzip.h b/rzip.h index 4e5ca1c..19f3322 100644 --- a/rzip.h +++ b/rzip.h @@ -212,12 +212,11 @@ static inline i64 get_ram(void) #define FLAG_STDIN (1 << 12) #define FLAG_STDOUT (1 << 13) #define FLAG_INFO (1 << 14) -#define FLAG_MAXRAM (1 << 15) -#define FLAG_UNLIMITED (1 << 16) -#define FLAG_HASH (1 << 17) -#define FLAG_MD5 (1 << 18) -#define FLAG_CHECK (1 << 19) -#define FLAG_KEEP_BROKEN (1 << 20) +#define FLAG_UNLIMITED (1 << 15) +#define FLAG_HASH (1 << 16) +#define FLAG_MD5 (1 << 17) +#define FLAG_CHECK (1 << 18) +#define FLAG_KEEP_BROKEN (1 << 19) #define FLAG_VERBOSE (FLAG_VERBOSITY | FLAG_VERBOSITY_MAX) #define FLAG_NOT_LZMA (FLAG_NO_COMPRESS | FLAG_LZO_COMPRESS | FLAG_BZIP2_COMPRESS | FLAG_ZLIB_COMPRESS | FLAG_ZPAQ_COMPRESS) @@ -239,7 +238,6 @@ static inline i64 get_ram(void) #define STDIN (control.flags & FLAG_STDIN) #define STDOUT (control.flags & FLAG_STDOUT) #define INFO (control.flags & FLAG_INFO) -#define MAXRAM (control.flags & FLAG_MAXRAM) #define UNLIMITED (control.flags & FLAG_UNLIMITED) #define HASH_CHECK (control.flags & FLAG_HASH) #define HAS_MD5 (control.flags & FLAG_MD5) diff --git a/util.c b/util.c index 66f890e..d0c7b87 100644 --- a/util.c +++ b/util.c @@ -151,9 +151,6 @@ void read_config( struct rzip_control *control ) else if (!strcasecmp(parameter, "unlimited")) { if (!strcasecmp(parametervalue, "yes")) control->flags |= FLAG_UNLIMITED; - } else if (!strcasecmp(parameter, "maxram")) { - if (!strcasecmp(parametervalue, "yes")) - control->flags |= FLAG_MAXRAM; } else if (!strcasecmp(parameter, "compressionlevel")) { control->compression_level = atoi(parametervalue); if ( control->compression_level < 1 || control->compression_level > 9 )