diff options
Diffstat (limited to 'fs/jffs2/compr.c')
-rw-r--r-- | fs/jffs2/compr.c | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/fs/jffs2/compr.c b/fs/jffs2/compr.c index 96ed3c9ec3fc..4849a4c9a0e2 100644 --- a/fs/jffs2/compr.c +++ b/fs/jffs2/compr.c | |||
@@ -12,6 +12,8 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
16 | |||
15 | #include "compr.h" | 17 | #include "compr.h" |
16 | 18 | ||
17 | static DEFINE_SPINLOCK(jffs2_compressor_list_lock); | 19 | static DEFINE_SPINLOCK(jffs2_compressor_list_lock); |
@@ -79,7 +81,7 @@ static int jffs2_selected_compress(u8 compr, unsigned char *data_in, | |||
79 | 81 | ||
80 | output_buf = kmalloc(*cdatalen, GFP_KERNEL); | 82 | output_buf = kmalloc(*cdatalen, GFP_KERNEL); |
81 | if (!output_buf) { | 83 | if (!output_buf) { |
82 | printk(KERN_WARNING "JFFS2: No memory for compressor allocation. Compression failed.\n"); | 84 | pr_warn("No memory for compressor allocation. Compression failed.\n"); |
83 | return ret; | 85 | return ret; |
84 | } | 86 | } |
85 | orig_slen = *datalen; | 87 | orig_slen = *datalen; |
@@ -188,7 +190,8 @@ uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
188 | tmp_buf = kmalloc(orig_slen, GFP_KERNEL); | 190 | tmp_buf = kmalloc(orig_slen, GFP_KERNEL); |
189 | spin_lock(&jffs2_compressor_list_lock); | 191 | spin_lock(&jffs2_compressor_list_lock); |
190 | if (!tmp_buf) { | 192 | if (!tmp_buf) { |
191 | printk(KERN_WARNING "JFFS2: No memory for compressor allocation. (%d bytes)\n", orig_slen); | 193 | pr_warn("No memory for compressor allocation. (%d bytes)\n", |
194 | orig_slen); | ||
192 | continue; | 195 | continue; |
193 | } | 196 | } |
194 | else { | 197 | else { |
@@ -235,7 +238,7 @@ uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
235 | cpage_out, datalen, cdatalen); | 238 | cpage_out, datalen, cdatalen); |
236 | break; | 239 | break; |
237 | default: | 240 | default: |
238 | printk(KERN_ERR "JFFS2: unknown compression mode.\n"); | 241 | pr_err("unknown compression mode\n"); |
239 | } | 242 | } |
240 | 243 | ||
241 | if (ret == JFFS2_COMPR_NONE) { | 244 | if (ret == JFFS2_COMPR_NONE) { |
@@ -277,7 +280,8 @@ int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
277 | ret = this->decompress(cdata_in, data_out, cdatalen, datalen); | 280 | ret = this->decompress(cdata_in, data_out, cdatalen, datalen); |
278 | spin_lock(&jffs2_compressor_list_lock); | 281 | spin_lock(&jffs2_compressor_list_lock); |
279 | if (ret) { | 282 | if (ret) { |
280 | printk(KERN_WARNING "Decompressor \"%s\" returned %d\n", this->name, ret); | 283 | pr_warn("Decompressor \"%s\" returned %d\n", |
284 | this->name, ret); | ||
281 | } | 285 | } |
282 | else { | 286 | else { |
283 | this->stat_decompr_blocks++; | 287 | this->stat_decompr_blocks++; |
@@ -287,7 +291,7 @@ int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
287 | return ret; | 291 | return ret; |
288 | } | 292 | } |
289 | } | 293 | } |
290 | printk(KERN_WARNING "JFFS2 compression type 0x%02x not available.\n", comprtype); | 294 | pr_warn("compression type 0x%02x not available\n", comprtype); |
291 | spin_unlock(&jffs2_compressor_list_lock); | 295 | spin_unlock(&jffs2_compressor_list_lock); |
292 | return -EIO; | 296 | return -EIO; |
293 | } | 297 | } |
@@ -299,7 +303,7 @@ int jffs2_register_compressor(struct jffs2_compressor *comp) | |||
299 | struct jffs2_compressor *this; | 303 | struct jffs2_compressor *this; |
300 | 304 | ||
301 | if (!comp->name) { | 305 | if (!comp->name) { |
302 | printk(KERN_WARNING "NULL compressor name at registering JFFS2 compressor. Failed.\n"); | 306 | pr_warn("NULL compressor name at registering JFFS2 compressor. Failed.\n"); |
303 | return -1; | 307 | return -1; |
304 | } | 308 | } |
305 | comp->compr_buf_size=0; | 309 | comp->compr_buf_size=0; |
@@ -309,7 +313,7 @@ int jffs2_register_compressor(struct jffs2_compressor *comp) | |||
309 | comp->stat_compr_new_size=0; | 313 | comp->stat_compr_new_size=0; |
310 | comp->stat_compr_blocks=0; | 314 | comp->stat_compr_blocks=0; |
311 | comp->stat_decompr_blocks=0; | 315 | comp->stat_decompr_blocks=0; |
312 | D1(printk(KERN_DEBUG "Registering JFFS2 compressor \"%s\"\n", comp->name)); | 316 | jffs2_dbg(1, "Registering JFFS2 compressor \"%s\"\n", comp->name); |
313 | 317 | ||
314 | spin_lock(&jffs2_compressor_list_lock); | 318 | spin_lock(&jffs2_compressor_list_lock); |
315 | 319 | ||
@@ -332,15 +336,15 @@ out: | |||
332 | 336 | ||
333 | int jffs2_unregister_compressor(struct jffs2_compressor *comp) | 337 | int jffs2_unregister_compressor(struct jffs2_compressor *comp) |
334 | { | 338 | { |
335 | D2(struct jffs2_compressor *this;) | 339 | D2(struct jffs2_compressor *this); |
336 | 340 | ||
337 | D1(printk(KERN_DEBUG "Unregistering JFFS2 compressor \"%s\"\n", comp->name)); | 341 | jffs2_dbg(1, "Unregistering JFFS2 compressor \"%s\"\n", comp->name); |
338 | 342 | ||
339 | spin_lock(&jffs2_compressor_list_lock); | 343 | spin_lock(&jffs2_compressor_list_lock); |
340 | 344 | ||
341 | if (comp->usecount) { | 345 | if (comp->usecount) { |
342 | spin_unlock(&jffs2_compressor_list_lock); | 346 | spin_unlock(&jffs2_compressor_list_lock); |
343 | printk(KERN_WARNING "JFFS2: Compressor module is in use. Unregister failed.\n"); | 347 | pr_warn("Compressor module is in use. Unregister failed.\n"); |
344 | return -1; | 348 | return -1; |
345 | } | 349 | } |
346 | list_del(&comp->list); | 350 | list_del(&comp->list); |
@@ -377,17 +381,17 @@ int __init jffs2_compressors_init(void) | |||
377 | /* Setting default compression mode */ | 381 | /* Setting default compression mode */ |
378 | #ifdef CONFIG_JFFS2_CMODE_NONE | 382 | #ifdef CONFIG_JFFS2_CMODE_NONE |
379 | jffs2_compression_mode = JFFS2_COMPR_MODE_NONE; | 383 | jffs2_compression_mode = JFFS2_COMPR_MODE_NONE; |
380 | D1(printk(KERN_INFO "JFFS2: default compression mode: none\n");) | 384 | jffs2_dbg(1, "default compression mode: none\n"); |
381 | #else | 385 | #else |
382 | #ifdef CONFIG_JFFS2_CMODE_SIZE | 386 | #ifdef CONFIG_JFFS2_CMODE_SIZE |
383 | jffs2_compression_mode = JFFS2_COMPR_MODE_SIZE; | 387 | jffs2_compression_mode = JFFS2_COMPR_MODE_SIZE; |
384 | D1(printk(KERN_INFO "JFFS2: default compression mode: size\n");) | 388 | jffs2_dbg(1, "default compression mode: size\n"); |
385 | #else | 389 | #else |
386 | #ifdef CONFIG_JFFS2_CMODE_FAVOURLZO | 390 | #ifdef CONFIG_JFFS2_CMODE_FAVOURLZO |
387 | jffs2_compression_mode = JFFS2_COMPR_MODE_FAVOURLZO; | 391 | jffs2_compression_mode = JFFS2_COMPR_MODE_FAVOURLZO; |
388 | D1(printk(KERN_INFO "JFFS2: default compression mode: favourlzo\n");) | 392 | jffs2_dbg(1, "default compression mode: favourlzo\n"); |
389 | #else | 393 | #else |
390 | D1(printk(KERN_INFO "JFFS2: default compression mode: priority\n");) | 394 | jffs2_dbg(1, "default compression mode: priority\n"); |
391 | #endif | 395 | #endif |
392 | #endif | 396 | #endif |
393 | #endif | 397 | #endif |