]> git.neil.brown.name Git - LaFS.git/commit
Fix freeing of inodes and ->dblock
authorNeilBrown <neilb@suse.de>
Sun, 2 Aug 2009 09:29:49 +0000 (19:29 +1000)
committerNeilBrown <neilb@suse.de>
Sun, 2 Aug 2009 09:29:49 +0000 (19:29 +1000)
commitf20cd9bd206404bfcc70a18f2dfae29688f2db3b
tree6a444c1788a15309e37dfc6ee1346fc837afddf2
parent3c6880c296f3ed4d268afd4643efbfac929b0db1
Fix freeing of inodes and ->dblock

The inode and the dblock each have a reference to the other.  Neither
are counted because:
   We don't want the inode to refcnt the dblock as that wastes space.
   We don't want the dblock to refcnt the inode as that stops it from
     being freed.

So when either is freed, it must remove the reference from the other.
To ease locking,  when the inode is freed it converts the reference,
if present, to a counted reference (using the same rule as
lafs_inode_dblock), then flags the inode for destruction and drops
the reference.

When the last reference to a dblock is dropped, it removes
both references and the calls destroy_inode again.

Notes that the dblock only exists while the inode exists - as soon
as the inode is destroyed, any dblock that might be around will
quickly get destroyed too, and the inode destruction is delayed until
this point.
index.c
super.c