use InodeCache when dropping a key to see if a pointer file can be safely reset

The Keys database can hold multiple inode caches for a given key. One for
the annex object, and one for each pointer file, which may not be hard
linked to it.

Inode caches for a key are recorded when its content is added to the annex,
but only if it has known pointer files. This is to avoid the overhead of
maintaining the database when not needed.

When the smudge filter outputs a file's content, the inode cache is not
updated, because git's smudge interface doesn't let us write the file. So,
dropping will fall back to doing an expensive verification then. Ideally,
git's interface would be improved, and then the inode cache could be
updated then too.
This commit is contained in:
Joey Hess 2015-12-09 17:47:05 -04:00
parent 5e8c628d2e
commit ce73a96e4e
Failed to extract signature
6 changed files with 62 additions and 46 deletions

View file

@ -17,6 +17,7 @@ import System.Posix.Signals
import Common.Annex
import qualified Annex
import Annex.Content
import qualified Database.Keys
{- Actions to perform each time ran. -}
startup :: Annex ()
@ -32,4 +33,5 @@ shutdown :: Bool -> Annex ()
shutdown nocommit = do
saveState nocommit
sequence_ =<< M.elems <$> Annex.getState Annex.cleanup
Database.Keys.shutdown
liftIO reapZombies -- zombies from long-running git processes