Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

file system building

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


Magnus.Ahltorp at abc

Jan 1, 1998, 5:47 PM

Post #1 of 3 (329 views)
Permalink
file system building

I'm porting a file system right now from {Free,Net,Open}BSD to Linux
(2.0), and I have bumped into a few problems.
When I do a lookup() I post a message to a userland daemon and put myself
on a wait queue. When the userland daemon posts an answer with the right
info I put the result into the dcache. Before I do this, I get a wrapper
inode (called xnode). The xnode has a pointer to the corresponding inode
and the inode has its u.generic_ip pointing to the xnode.
The file system is not inode driven, which forces me to invent a inode
number for the iget(). I choose this inode number to the address of the
xnode.
The problem is, when the inode is cached in the dcache, it must have been
created by the iget(sb,xnode), and the reference count should be 0 (if
noone uses it). But, if I let the reference count drop to 0, the inode
will be deallocated. If I then do a dcache lookup, I will get an inode
number that does not map to an inode anymore. I will try to do an
iget(sb,xnode) on it, but since my read_inode does not do much, I get
something completly useless.
I the above BSD kernels, the reference count is allowed to drop to 0, and
the kernel tells me when it needs it for reuse.
I could of course cache it for only the period it's needed, but then it's
not very efficient.
Thanks for any help,
Magnus


whawes at star

Jan 1, 1998, 7:23 PM

Post #2 of 3 (308 views)
Permalink
Re: file system building [In reply to]

Magnus Ahltorp wrote:
> The problem is, when the inode is cached in the dcache, it must have been
> created by the iget(sb,xnode), and the reference count should be 0 (if
> noone uses it). But, if I let the reference count drop to 0, the inode
> will be deallocated. If I then do a dcache lookup, I will get an inode
> number that does not map to an inode anymore. I will try to do an
> iget(sb,xnode) on it, but since my read_inode does not do much, I get
> something completly useless.
Inodes being held by the dcache should have a use count of 1 -- the
normal state of an inode in use is that only the dentry has a reference
to it. The life of the dentry then determines the life of the inode;
when the dentry is released, the inode count goes to 0 and the inode is
usually freed almost immediately.
Regards,
Bill


aem at netcom

Jan 3, 1998, 11:34 AM

Post #3 of 3 (311 views)
Permalink
Re: file system building [In reply to]

> The file system is not inode driven, which forces me to invent a inode
> number for the iget(). I choose this inode number to the address of the
> xnode.
Just make sure the inode number is the same for a given object.
Seems many programs care about inode numbers.
> The problem is, when the inode is cached in the dcache, it must have been
> created by the iget(sb,xnode), and the reference count should be 0
Stuff in the dcache has an inode count >0 as dcache is using the inode.
--
Andrew E. Mileski mailto:aem [at] netcom

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.