diff options
| -rw-r--r-- | fs/ubifs/compress.c | 6 | ||||
| -rw-r--r-- | fs/ubifs/ubifs-media.h | 7 |
2 files changed, 10 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, | |||
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | /* | 121 | /* |
| 122 | * Presently, we just require that compression results in less data, | 122 | * If the data compressed only slightly, it is better to leave it |
| 123 | * rather than any defined minimum compression ratio or amount. | 123 | * uncompressed to improve read speed. |
| 124 | */ | 124 | */ |
| 125 | if (ALIGN(*out_len, 8) >= ALIGN(in_len, 8)) | 125 | if (in_len - *out_len < UBIFS_MIN_COMPRESS_DIFF) |
| 126 | goto no_compr; | 126 | goto no_compr; |
| 127 | 127 | ||
| 128 | return; | 128 | return; |
diff --git a/fs/ubifs/ubifs-media.h b/fs/ubifs/ubifs-media.h index 0b378042a3a2..b25fc36cf72f 100644 --- a/fs/ubifs/ubifs-media.h +++ b/fs/ubifs/ubifs-media.h | |||
| @@ -51,6 +51,13 @@ | |||
| 51 | */ | 51 | */ |
| 52 | #define UBIFS_MIN_COMPR_LEN 128 | 52 | #define UBIFS_MIN_COMPR_LEN 128 |
| 53 | 53 | ||
| 54 | /* | ||
| 55 | * If compressed data length is less than %UBIFS_MIN_COMPRESS_DIFF bytes | ||
| 56 | * shorter than uncompressed data length, UBIFS preferes to leave this data | ||
| 57 | * node uncompress, because it'll be read faster. | ||
| 58 | */ | ||
| 59 | #define UBIFS_MIN_COMPRESS_DIFF 64 | ||
| 60 | |||
| 54 | /* Root inode number */ | 61 | /* Root inode number */ |
| 55 | #define UBIFS_ROOT_INO 1 | 62 | #define UBIFS_ROOT_INO 1 |
| 56 | 63 | ||
