Subject: Re: ext2fs_statvfs and mtn_stat.
To: Adam Hamsik <haaaad@gmail.com>
From: Antti Kantee <pooka@cs.hut.fi>
List: tech-kern
Date: 08/29/2007 03:04:51
On Wed Aug 29 2007 at 01:38:43 +0200, Adam Hamsik wrote:
> I use ext2fs_vget to translate this inode number to vnode. After that  
> I want to
> read jbd superblock from disk to the memory with VOP_READ. But I  
> receive panic at [1] (panic message is integer divide error code=0)
> 
> Problem is that mp->mnt_stat is not allocated because I mount this  
> disk as non root partition. mp->mnt_stat is structure statvfs and is  
> filled with ext2fs_statvfs function. But this function is called only  
> once from [2].
> 
> I have two problems here. :)
> 
> 1) I don't understand how can this work in real usage, when I mount  
> disk as non root partition. When and where mp->mnt_stat get filled in  
> and why we doesn't call ext2fs_statvfs also in ext2fs_mount. When I  
> try to read file from mounted filesystem mp->mnt_stat is filled with  
> correct data although ext2fs_statvfs was not called and filesystem is  
> mounted as non root. *

mount calls VFS_STATVFS after VFS_MOUNT but before VFS_START.

> 2)what is correct solution for this ? If I add ext2fs_statvfs to the  
> ext2fs_mount everything works. This behaviour is shared across all  
> our ufs based filesystems I checked ffs[4],ext2fs.

I'm not familiar with the problem, but wouldn't using the buffer cache
for the journal file be easier?

Either that, or initialize the file system enough already in mount to
be able to access the journal file via VOP_READ/VOP_WRITE.

Or use VFS_START (tangent question: what uses that anyway?).

-- 
Antti Kantee <pooka@iki.fi>                     Of course he runs NetBSD
http://www.iki.fi/pooka/                          http://www.NetBSD.org/
    "la qualité la plus indispensable du cuisinier est l'exactitude"