question about jffs2: jffs2_scan_dirty_space() return value

Roman Borisov ext-roman.borisov at nokia.com
Fri Oct 15 07:59:40 EDT 2010


hello,

The question was born when I discovered that in fs/jffs2/scan.c 
jffs2_scan_medium() a return value from fs/jffs2/nodelist.c 
jffs2_scan_dirty_space() is not checked;
However return value from jffs2_scan_dirty_space() is checked anywhere else.
jffs2_scan_dirty_space() investigation showed that it can't return 
anything except 0;

The question is: should the jffs2_scan_dirty_space() be changed to 
return some error instead BUG() macro for example?
<code>
     if (unlikely(size > jeb->free_size)) {
         printk(KERN_CRIT "Dirty space 0x%x larger then free_size 0x%x 
(wasted 0x%x)\n",
                size, jeb->free_size, jeb->wasted_size);
-        BUG();
+    return some_error;
     }
</code>
In this case we also should update jffs2_scan_medium() to check the 
error code.

Thanks,
Roman




More information about the linux-mtd mailing list