From 06ff08f391e0297c4fcde63b801e6992d2238ae2 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Wed, 22 Oct 2008 14:23:00 +0300 Subject: Define the worst case compression constant It will be used in the next patches. Signed-off-by: Artem Bityutskiy --- mkfs.ubifs/compr.h | 8 ++++++++ mkfs.ubifs/mkfs.ubifs.c | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'mkfs.ubifs') diff --git a/mkfs.ubifs/compr.h b/mkfs.ubifs/compr.h index c76a5b9..e3dd95c 100644 --- a/mkfs.ubifs/compr.h +++ b/mkfs.ubifs/compr.h @@ -23,6 +23,14 @@ #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, diff --git a/mkfs.ubifs/mkfs.ubifs.c b/mkfs.ubifs/mkfs.ubifs.c index 65ebc8c..18ede49 100644 --- a/mkfs.ubifs/mkfs.ubifs.c +++ b/mkfs.ubifs/mkfs.ubifs.c @@ -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 -- cgit v1.2.3