Patchwork JFFS2 - increase MAX_SUMMARY_SIZE to address warning

login
register
mail settings
Submitter Scottie Shore
Date Dec. 16, 2010, 10:36 p.m.
Message ID <E29897F6386BC843A2912780030A97F31CA0863F@exchange.iders.ca>
Download mbox | patch
Permalink /patch/75817/
State New
Headers show

Comments

Scottie Shore - Dec. 16, 2010, 10:36 p.m.
Hello,

We frequently see warnings in dmesg similar to the ones below when using JFFS2 on nand flash with 512KiB page size. According to the summary code, this means that the summary size for a page is over MAX_SUMMARY_SIZE of 64KiB, so the summary is discarded.

JFFS2 warning: (549) jffs2_sum_write_data: Not enough space for summary, padsize = -3208
JFFS2 warning: (549) jffs2_sum_write_data: Not enough space for summary, padsize = -3352

The comments with MAX_SUMMARY_SIZE say that 64KiB was chosen so that kmalloc can be used, however other sources say that kmalloc can allocate up to 128KiB. I've updated MAX_SUMMARY_SIZE to 128KiB according to the attached patch and tested on our hardware for about a week with frequent heavy read/write cycles. So far I've encountered no problems, and no further warnings. I'm concerned that a fix this easy may be wrong in a non-obvious way, though.

Are there platforms where this change would not work?
Does this change cause problems that might not be immediately visible?
If there's no concerns about same, could the patch be applied to the mainline code?

Regards,

Scottie Shore
Iders, Inc.
<html>
<body>
Scottie Shore Embedded Software Developer Iders Incorporated 27047 Oakwood Road Oakbank, MB R0E 1J2 Tel (204) 444-5200 ext 282 Fax: (204) 444-5900 [http://www.iders.ca/IDERS_logo.jpg] ________________________________ Iders Incorporated Confidential: ________________________________
 This message is intended solely for the use of the designated recipient(s) and their appointed delegates, and may contain confidential information. Any unauthorized disclosure, copying or distribution of its contents is strictly prohibited. If you have received
 this message in error, please destroy it and advise the sender immediately by phone, Email or facsimile.
</body>
</html>

Patch

--- summary.h	2010-12-16 15:26:19.379409222 -0600
+++ summary.h	2009-09-22 11:19:11.000000000 -0500
@@ -13,11 +13,11 @@ 
 #ifndef JFFS2_SUMMARY_H
 #define JFFS2_SUMMARY_H
 
-/* Limit summary size to 128KiB so that we can kmalloc it. If the summary
+/* Limit summary size to 64KiB so that we can kmalloc it. If the summary
    is larger than that, we have to just ditch it and avoid using summary
    for the eraseblock in question... and it probably doesn't hurt us much
    anyway. */
-#define MAX_SUMMARY_SIZE 131072
+#define MAX_SUMMARY_SIZE 65536
 
 #include <linux/uio.h>
 #include <linux/jffs2.h>