Discussion:
jffs2 statfs issue
ye janboe
2007-07-19 10:01:52 UTC
Permalink
jffs2 can not return correct free space amount.
I checked jffs2_statfs, there is problem.

avail = c->dirty_size + c->free_size;
if (avail > c->sector_size * c->resv_blocks_write)
avail -= c->sector_size * c->resv_blocks_write;
else
avail = 0;

But in jffs2_reserve_space, c->dirty_size will compare to
c->nospc_dirty_size. If dirty < c->nospc_dirty_size, it will return
nospace error.

So I change above code to
dirty = c->dirty_size + c->erasing_size - c->nr_erasing_blocks *
c->sector_size + c->unchecked_size;
if (dirty > c->nospc_dirty_size)
avail = c->dirty_size + c->free_size - c->nospc_dirty_size;
else
avail = c->free_size;

Do this make sense?

Thanks a lot!

Janboe

Loading...