questions about jffs2 jffs2_erase_pending_blocks in erase.c

Joakim Tjernlund joakim.tjernlund at transmode.se
Tue Oct 5 17:43:28 EDT 2010


>
> Again apologies if I'm doing this wrong, I rarely poke at the kernel
> and only have a few days experience looking at jffs2 and don't
> understand the "big picture" yet, but I'm seeing some things I don't
> understand and would be grateful for any help.  Please contact me
> off-list if you want to send me a "you are so stupid, it's supposed to
> be doing that", in fact I'd welcome that over silence.  I'd even thank
> you.
>
> My question:
>
> jffs2_erase_pending_blocks is only called with 1 or 0 as count arguments.
>
>  nodemgmt.c jffs2_reserve_space  121 jffs2_erase_pending_blocks(c, 1);
>  nodemgmt.c jffs2_find_nextblock 248 jffs2_erase_pending_blocks(c, 1);
>  super.c    jffs2_write_super     67 jffs2_erase_pending_blocks(c, 0);
>
> The test  if (!--count) seems to be testing for (count == 1) as the
> decrement happens first.  If count is 0 it will be decremented
> negative, underflow and wrap around to positive, and then eventually
> hit 0 4 billion loop interations later.
>
> Thanks in advance to anyone looking at this,

Yes, this will ensure JFFS2 erases until the list(s) are
empty.
Also, latest kernel has reworked this area so you might want to update.




More information about the linux-mtd mailing list