public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* JFFS2: real free capacity of the partition
@ 2008-07-03 16:17 Sergei Poselenov
  2008-07-07 16:15 ` Sergei Poselenov
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Poselenov @ 2008-07-03 16:17 UTC (permalink / raw)
  To: linux-mtd

Hello,

Probably this is a trivial question and won't take much of your time.

A simple test on a JFFS2 partition:

# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtdblock1            1024       376       648  37% /etc
# dd if=/dev/urandom of=tmp bs=1024 count=2900
dd: tmp: No space left on device
# rm tmp
# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtdblock1            1024       372       652  36% /etc

Why additional space appeared?

I've noted, that this effect:
- appeared only on the well-used partition, not on the
   fresh-created one.
- appeared only after filling up the device
- appeared only once. On subsequent tests, the free space was
reported without magic increases.


Is this is an effect of the JFFS2 garbage collector?
Is there any method to learn the real available capacity of the
mounted partition?

Thanks in advance,
Sergei

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: JFFS2: real free capacity of the partition
  2008-07-03 16:17 JFFS2: real free capacity of the partition Sergei Poselenov
@ 2008-07-07 16:15 ` Sergei Poselenov
  2008-07-11 17:32   ` David Woodhouse
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Poselenov @ 2008-07-07 16:15 UTC (permalink / raw)
  To: linux-mtd

Hello all,

Seems I found why is that happens.
In jffs2_statfs() the wasted_size is excluded
from calculation:
...
    avail = c->dirty_size + c->free_size;
...

Could someone explain for what reason?
Have I understand it right - on the certain conditions, the
wasted space can be converted to dirty space?

Regards,
Sergei

Sergei Poselenov wrote:
> Hello,
> 
> Probably this is a trivial question and won't take much of your time.
> 
> A simple test on a JFFS2 partition:
> 
> # df
> Filesystem           1k-blocks      Used Available Use% Mounted on
> /dev/mtdblock1            1024       376       648  37% /etc
> # dd if=/dev/urandom of=tmp bs=1024 count=2900
> dd: tmp: No space left on device
> # rm tmp
> # df
> Filesystem           1k-blocks      Used Available Use% Mounted on
> /dev/mtdblock1            1024       372       652  36% /etc
> 
> Why additional space appeared?
> 
> I've noted, that this effect:
> - appeared only on the well-used partition, not on the
>   fresh-created one.
> - appeared only after filling up the device
> - appeared only once. On subsequent tests, the free space was
> reported without magic increases.
> 
> 
> Is this is an effect of the JFFS2 garbage collector?
> Is there any method to learn the real available capacity of the
> mounted partition?
> 
> Thanks in advance,
> Sergei
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: JFFS2: real free capacity of the partition
  2008-07-07 16:15 ` Sergei Poselenov
@ 2008-07-11 17:32   ` David Woodhouse
  0 siblings, 0 replies; 3+ messages in thread
From: David Woodhouse @ 2008-07-11 17:32 UTC (permalink / raw)
  To: Sergei Poselenov; +Cc: linux-mtd

On Mon, 2008-07-07 at 20:15 +0400, Sergei Poselenov wrote:
> Seems I found why is that happens.
> In jffs2_statfs() the wasted_size is excluded
> from calculation:
> ...
>     avail = c->dirty_size + c->free_size;
> ...
> 
> Could someone explain for what reason?
> Have I understand it right - on the certain conditions, the
> wasted space can be converted to dirty space?

Wasted space is just the same as dirty space, really. The only
difference is that we don't expect it to be reclaimed by garbage
collection. The small spaces at the end of an eraseblock, for example,
are still likely to be there when we write a new eraseblock full of
data. There'll still be a small amount of wasted space at the end of the
new block.

That's why we treat 'wasted' space differently from dirty space --
otherwise the GC might just keep going for ever and ever, trying to
reclaim 'dirty' space but always not quite managing to reclaim as much
as it needs.

-- 
dwmw2

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-11 17:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-03 16:17 JFFS2: real free capacity of the partition Sergei Poselenov
2008-07-07 16:15 ` Sergei Poselenov
2008-07-11 17:32   ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox