Skip to contentSkip to conversation

question about jffs2: jffs2_scan_dirty_space() return value

DISCUSSION Roman Borisov 1 participant 1 message Oct 15, 2010 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

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