[Yaffs] Re: CVS updates (fix for bogus df stats)

Charles Manning manningc2@actrix.gen.nz
Sat, 30 Apr 2005 06:17:44 +1200


Hi Ian
Thanx for this. This is pretty much the same as the patch I put into CVS =
a=20
few hours back.

The patch I put in handles the cases where the chunk size > Linux block s=
ize=20
or other way around, while I believe the patch you have here only handles=
 the=20
one case.

Thanx

-- Charles




On Saturday 30 April 2005 02:07, Ian McDonnell wrote:
> Sergei,
>
> Following patch should fix 'df' stats.
>
> -imcd
>
>
> diff -Naur orig-yaffs2/yaffs_fs.c yaffs2/yaffs_fs.c
> --- orig-yaffs2/yaffs_fs.c      2004-12-16 23:39:04.000000000
> -0500
> +++ yaffs2/yaffs_fs.c   2005-04-29 10:02:34.000000000 -0400
> @@ -1206,6 +1206,7 @@
>  static int yaffs_statfs(struct super_block *sb, struct statfs
> *buf)
>  #endif
>  {
> +   // yaffs_DeviceStruct
>     yaffs_Device *dev =3D yaffs_SuperToDevice(sb);
>     T(YAFFS_TRACE_OS,(KERN_DEBUG"yaffs_statfs\n"));
>
> @@ -1214,12 +1215,13 @@
>     buf->f_type =3D YAFFS_MAGIC;
>     buf->f_bsize =3D sb->s_blocksize;
>     buf->f_namelen =3D 255;
> -   buf->f_blocks =3D (dev->endBlock - dev->startBlock + 1) *
> YAFFS_CHUNKS_PER
> _BLOCK/
> -                               (sb->s_blocksize/YAFFS_BYTES_PER
> _CHUNK);
> +   buf->f_blocks =3D ((dev->endBlock - dev->startBlock + 1) *
> +       dev->nChunksPerBlock * dev->nBytesPerChunk) /
> sb->s_blocksize;
>     buf->f_files =3D 0;
>     buf->f_ffree =3D 0;
>     buf->f_bfree =3D yaffs_GetNumberOfFreeChunks(dev)/
> -                               (sb->s_blocksize/YAFFS_BYTES_PER
> _CHUNK);
> +       (sb->s_blocksize/dev->nBytesPerChunk);
> +
>     buf->f_bavail =3D  buf->f_bfree;
>
>     yaffs_GrossUnlock(dev);
>
>
> _______________________________________________
> yaffs mailing list
> yaffs@stoneboat.aleph1.co.uk
> http://stoneboat.aleph1.co.uk/cgi-bin/mailman/listinfo/yaffs