summaryrefslogtreecommitdiffstats
path: root/fs/ubifs/compress.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-10-26 15:58:25 +0100
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2008-12-03 12:13:50 +0100
commit062e4fee4400f283307cf8ac1b7931c939010229 (patch)
treecacea4a2f65688ad02fa572060155783c4f0377c /fs/ubifs/compress.c
parentMerge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog (diff)
downloadlinux-062e4fee4400f283307cf8ac1b7931c939010229.tar.xz
linux-062e4fee4400f283307cf8ac1b7931c939010229.zip
UBIFS: slight compression optimization
If data does not compress, it is better to leave it uncompressed because we'll read it faster then. So do not compress data if we save less than 64 bytes. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'fs/ubifs/compress.c')
-rw-r--r--fs/ubifs/compress.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ubifs/compress.c b/fs/ubifs/compress.c
index a0ada596b17c..6414d50780e1 100644
--- a/fs/ubifs/compress.c
+++ b/fs/ubifs/compress.c
@@ -119,10 +119,10 @@ void ubifs_compress(const void *in_buf, int in_len, void *out_buf, int *out_len,
}
/*
- * Presently, we just require that compression results in less data,
- * rather than any defined minimum compression ratio or amount.
+ * If the data compressed only slightly, it is better to leave it
+ * uncompressed to improve read speed.
*/
- if (ALIGN(*out_len, 8) >= ALIGN(in_len, 8))
+ if (in_len - *out_len < UBIFS_MIN_COMPRESS_DIFF)
goto no_compr;
return;