[haiku-development] VFS and vnodes

  • From: Julian Harnath <julian.harnath@xxxxxxxxxxxxxx>
  • To: haiku-development <haiku-development@xxxxxxxxxxxxx>
  • Date: Mon, 9 Jun 2014 12:00:03 +0200

Hello!

I'm currently working on a file-system add-on and have a few questions 
regarding VNode usage in the VFS APIs.

There is fs_vnode_ops::read_dir(), where the FS add-on is supposed read 
directory entries and fill them into dirent structs, which includes the 
vnode ID.

Now, when an FS has file handles larger than sizeof(ino_t), it cannot 
store sufficient information to find the node in the ID alone. So it 
has to create a "fake" ID or hash of the handle and use that as vnode 
ID... and to later find it again, insert a mapping from the ID to the 
actual handle into some kind of global map. Or do I misunderstand 
something?

The next question then is, how long do I have to retain the entry in 
the global map? I can't retain it forever or the map would keep growing 
without limits. For the case of fs_node_ops::lookup(), it's simpler 
because I can remove it when put_vnode() is called. But for read_dir() 
I can't even be sure that get_vnode() is ever called for an ID I assign 
there, or can I?

--
So long, jua


Other related posts: