diff options
author | Phillip Lougher <phillip@squashfs.org.uk> | 2014-04-28 04:08:40 +0100 |
---|---|---|
committer | Phillip Lougher <phillip@squashfs.org.uk> | 2014-04-28 04:08:40 +0100 |
commit | a4f95d1b9e3f8ff5a7af37437f0b35b6e1b8f2b7 (patch) | |
tree | 3def44ec135120d1bc10b42c32c0f40bd2d2046e | |
parent | aa759ce59837c1b709d3cba88762db1cd4c698b0 (diff) | |
download | squashfs-tools-a4f95d1b9e3f8ff5a7af37437f0b35b6e1b8f2b7.tar.gz |
mksquashfs: fix larger than physical memory check
Get_physical_memory() should have been returning the full amount of
memory in the system, rather than the amount of physical memory
taken by default (physical memory / SQUASHFS_TAKE).
This inadvertantly broke the "larger than physical memory" check because
it assumed get_physical_memory() returned the full amount. In fact it
broke running Mksquashfs without -mem because the default amount of
memory taken failed the check (default amount of memory taken is
always going to be greater than or equal to the default amount of memory
taken!).
Apologies to anyone affected by the breakage.
Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
-rw-r--r-- | squashfs-tools/mksquashfs.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c index f33cb20..bbc2785 100644 --- a/squashfs-tools/mksquashfs.c +++ b/squashfs-tools/mksquashfs.c @@ -4028,7 +4028,6 @@ void initialise_threads(int readq, int fragq, int bwriteq, int fwriteq, { int i; sigset_t sigmask, old_mask; - int phys_mem = get_physical_memory(); int total_mem = readq; int reader_size; int fragment_size; @@ -4055,7 +4054,7 @@ void initialise_threads(int readq, int fragq, int bwriteq, int fwriteq, BAD_ERROR("Queue sizes rediculously too large\n"); total_mem += fwriteq; - if(total_mem >= phys_mem) { + if(total_mem > get_physical_memory()) { ERROR("Total queue sizes larger than physical memory.\n"); ERROR("Mksquashfs will exhaust physical memory and thrash.\n"); BAD_ERROR("Queues too large\n"); @@ -4846,8 +4845,7 @@ int get_physical_memory() BAD_ERROR("Mksquashfs requires more physical memory than is " "available!\n"); - /* Only take 1/SQUASHFS_TAKE of physical memory */ - return phys_mem / SQUASHFS_TAKE; + return phys_mem; } @@ -4890,7 +4888,7 @@ int main(int argc, char *argv[]) int fragq; int bwriteq; int fwriteq; - int total_mem = get_physical_memory(); + int total_mem = get_physical_memory() / SQUASHFS_TAKE; int progress = TRUE; int force_progress = FALSE; struct file_buffer **fragment = NULL; |