Calculation of JFFS2 free space

Josh Boyer jwboyer at gmail.com
Thu Feb 8 13:43:39 EST 2007


On 2/8/07, Sohn Chung-MCG31424 <ChungSohn at motorola.com> wrote:
>
> Hello,
> I am using JFFS2 (Linux 2.6.10) on the Large Page NAND flash.
> The size of JFFS2 partition is 7M. While applications were holding some
> files,
> I copied over an 8M file to this partition to make the filesystem full.
> After I got the out of space message, I issued the 'df' command.
>
> The output of df was:
> # df /jffs2
> /dev/mtdblock/3    7168   7023   136   98% /jffs2
>
> # cd /jffs2
> # touch foo
> touch: foo: No space left on device
>
> The jffs2_statfs returned 136K as the available space.
> After the filesystem is full, how the application program can figure out
> the real available space on JFFS2 before write?

You currently can't from userspace.  The df output is a best-estimate
returned by JFFS2 given that it has to reserve some blocks for normal
operation.

What would be nice is some sysfs entries to export some of this
information, without requiring JFFS2_DEBUG to be set.

josh




More information about the linux-mtd mailing list