views:

151

answers:

2

I can't think of an example where the reference count of a file may not be zero even when it is no longer possible to refer a directory or file.

The only example that I could find for a general graph directory structure is this:

example of general graph

(Node 1 would be the north node, Node 2 would be the node Node 1 is pointing too, and so on and so forth)

If I wanted to delete Node 1, it should be okay since there is only one reference to it (Node 8).

So my question would be: Could anyone give me an example where the reference count is not zero even if it is no longer possible to refer to that file/directory?

This is for a presentation that I would be presenting tomorrow for class. I tried searching for an answer on the net but they all just say the same thing without giving a concrete example. Or maybe I'm just dumb. :)

+1  A: 

You're almost there. Suppose you have a whole complicated tree structure connected to your ring, and then you delete the link to your ring. What would happen to the file reference counts?

(The answer does depend somewhat on how reference counts are maintained.)

Rex Kerr
Thanks man. I see that the ring gets isolated from the "main" tree, hence it won't be accessible anymore.
Ramon Marco Navarro
A: 

What happens when a directory contains a folder that inside has link to the root directory itself?

something like:

DIR1 <------------------+
  +--- files            |
  +--- DIR2             |
         +---files      |
         +---DIR1 ------+

Suppose to want to remove (outer) DIR1 from the folder that contains it..

Jack