[Yaffs] [Yaffs-archive] RE: "du" returns wrong values on yaffs

Stephan Linke Stephan.Linke@epygi.de
Fri, 29 Aug 2003 17:36:23 +0200


Hi Charles,

after reading the comments in asm/stat.h I think that the patch you applied is not correct. The block count (st_blocks) must not be
calculated based on the optimum block size (st_blksize). It must be calculated asuming 512-byte blocks:

	...
	long st_blksize;		/* Optimal block size for I/O.  */
	long long st_blocks;		/* Number 512-byte blocks allocated. */
	...

So the correct calculation is:

	inode->i_blocks = (inode->i_size + 511) >> 9;	/* Number 512-byte blocks allocated. */

(That's the line from JFFS.)

Thanks, Stephan

> -----Original Message-----
> From: Charles Manning [mailto:manningc2@actrix.gen.nz]
> Sent: Mittwoch, 20. August 2003 06:03
> To: Stephan Linke; Yaffs List
> Subject: Re: "du" returns wrong values on yaffs
>
>
> On Tuesday 19 August 2003 21:39, Stephan Linke wrote:
> > Hi,
> > we are using "du" to detect the amount of space occupied by some of our
> > files to keep us from running out of space. Unfortunately YAFFS returns a
> > block count of zero.
> >
> Stepahn I found and ??corrected?? a problem, though I don't know it is 100%
> yet. THis is in cvs.
>
> At best du only provides an estimate and does not account for various other
> overheads (eg. bad blocks, reserved blocks). statfs() , as used by 'df',
> gives a better indicator of free space.
>
> Stephan: please try the new yaffs_fs and see if this helps.
>
> -- Charles
>


---------------------------------------------------------------------------------------
This mailing list is hosted by Toby Churchill open software (www.toby-churchill.org).
If mailing list membership is no longer wanted you can remove yourself from the list by 
sending an email to yaffs-request@toby-churchill.org with the text "unsubscribe" 
(without the quotes) as the subject.