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

Ian McDonnell ian@brightstareng.com
Fri, 29 Apr 2005 10:07:06 -0400


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 = yaffs_SuperToDevice(sb);
    T(YAFFS_TRACE_OS,(KERN_DEBUG"yaffs_statfs\n"));

@@ -1214,12 +1215,13 @@
    buf->f_type = YAFFS_MAGIC;
    buf->f_bsize = sb->s_blocksize;
    buf->f_namelen = 255;
-   buf->f_blocks = (dev->endBlock - dev->startBlock + 1) * 
YAFFS_CHUNKS_PER
_BLOCK/
-                               (sb->s_blocksize/YAFFS_BYTES_PER
_CHUNK);
+   buf->f_blocks = ((dev->endBlock - dev->startBlock + 1) *
+       dev->nChunksPerBlock * dev->nBytesPerChunk) / 
sb->s_blocksize;
    buf->f_files = 0;
    buf->f_ffree = 0;
    buf->f_bfree = yaffs_GetNumberOfFreeChunks(dev)/
-                               (sb->s_blocksize/YAFFS_BYTES_PER
_CHUNK);
+       (sb->s_blocksize/dev->nBytesPerChunk);
+
    buf->f_bavail =  buf->f_bfree;

    yaffs_GrossUnlock(dev);