jffs2 statfs issue

From: ye janboe
Date: Thu Jul 19 2007 - 06:31:36 EST


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/