]> www.infradead.org Git - mtd-utils.git/commitdiff
Define the worst case compression constant
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 22 Oct 2008 11:23:00 +0000 (14:23 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 22 Oct 2008 12:31:12 +0000 (15:31 +0300)
It will be used in the next patches.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
mkfs.ubifs/compr.h
mkfs.ubifs/mkfs.ubifs.c

index c76a5b9bbd89e4bc2a05a26b96a86aceae076b09..e3dd95ce1487b6f44a8bf33c935e3c0cb8a8932f 100644 (file)
 #ifndef __UBIFS_COMPRESS_H__
 #define __UBIFS_COMPRESS_H__
 
+/*
+ * Compressors may end-up with more data in the output buffer than in the input
+ * buffer. This constant defined the worst case factor, i.e. we assume that the
+ * output buffer may be at max. WORST_COMPR_FACTOR times larger than input
+ * buffer.
+ */
+#define WORST_COMPR_FACTOR 4
+
 enum compression_type
 {
        MKFS_UBIFS_COMPR_NONE,
index 65ebc8cf53c42bb668936845f8376e6d40e52be0..18ede4904b3b47002d6b9d3c7536e7389797f9c6 100644 (file)
@@ -28,7 +28,8 @@
 #define HASH_TABLE_SIZE 10099
 
 /* The node buffer must allow for worst case compression */
-#define NODE_BUFFER_SIZE (UBIFS_DATA_NODE_SZ + UBIFS_BLOCK_SIZE * 4)
+#define NODE_BUFFER_SIZE (UBIFS_DATA_NODE_SZ + \
+                         UBIFS_BLOCK_SIZE * WORST_COMPR_FACTOR)
 
 /* Default time granularity in nanoseconds */
 #define DEFAULT_TIME_GRAN 1000000000