In our FS when we're in ->unlink() and i_nlink becomes 0, we have to record this inode in the table of orphans, and remove it from there in ->delete_inode(). This is needed to be able to dispose of orphans in case of an unclean reboot on the next mount. AFAIK, ext3 has something similar. I just figured that this could be optimized - in most cases ->delete_inode() is called right after ->unlink(), and I wanted to avoid putting the inode to the orphan table in those cases.Yes, ext3 has something similar. But actually ext3 would have to insert
inode in the orphan list anyway - in delete_inode we do truncate and
for it we also insert the inode into the orphan list because truncate
can be too large to fit into a single transaction.
Hmm, I'm just not sure whether unlink cannot somehow race with open
(at least I don't see any lock that would prevent open while unlink is
in progress)...