diskreserve setting
Add annex.diskreserve config setting, to control how much free space to reserve for other purposes and avoid using (defaults to 1 mb).
This commit is contained in:
parent
c21998722c
commit
368e20eb84
3 changed files with 16 additions and 7 deletions
13
Content.hs
13
Content.hs
|
@ -119,24 +119,23 @@ checkDiskSpace = checkDiskSpace' 0
|
|||
|
||||
checkDiskSpace' :: Integer -> Key -> Annex ()
|
||||
checkDiskSpace' adjustment key = do
|
||||
liftIO $ putStrLn $ "adjust " ++ show adjustment
|
||||
g <- Annex.gitRepo
|
||||
r <- Annex.repoConfig g "diskreserve" ""
|
||||
let reserve = if null r then megabyte else (read r :: Integer)
|
||||
stats <- liftIO $ getFileSystemStats (gitAnnexDir g)
|
||||
case (stats, keySize key) of
|
||||
(Nothing, _) -> return ()
|
||||
(_, Nothing) -> return ()
|
||||
(Just (FileSystemStats { fsStatBytesAvailable = have }), Just need) ->
|
||||
if (need + overhead >= have + adjustment)
|
||||
if (need + reserve > have + adjustment)
|
||||
then error $ "not enough free space (have " ++
|
||||
showsize (have + adjustment) ++ "; need " ++
|
||||
showsize (need + overhead) ++ ")"
|
||||
showsize (need + reserve) ++ ")"
|
||||
else return ()
|
||||
where
|
||||
showsize i = show i
|
||||
-- Adding a file to the annex requires some overhead beyond
|
||||
-- just the file size; the git index must be updated, etc.
|
||||
-- This is an arbitrary value.
|
||||
overhead = 1024 * 1024 -- 1 mb
|
||||
megabyte :: Integer
|
||||
megabyte = 1024 * 1024
|
||||
|
||||
{- Removes the write bits from a file. -}
|
||||
preventWrite :: FilePath -> IO ()
|
||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -5,6 +5,8 @@ git-annex (0.20110321) UNRELEASED; urgency=low
|
|||
with git-annex 0.24 or earlier.) The code is believed to work on
|
||||
Linux, FreeBSD, and OSX; check compile-time messages to see if it
|
||||
is not enabled for your OS.
|
||||
* Add annex.diskreserve config setting, to control how much free space
|
||||
to reserve for other purposes and avoid using (defaults to 1 mb).
|
||||
* Add --fast flag, that can enable less expensive, but also less thurough
|
||||
versions of some commands.
|
||||
* fsck: In fast mode, avoid checking checksums.
|
||||
|
|
|
@ -377,6 +377,14 @@ Here are all the supported configuration settings.
|
|||
Default ssh and rsync options to use if a remote does not have
|
||||
specific options.
|
||||
|
||||
* `annex.diskreserve`
|
||||
|
||||
Amount of disk space to reserve. Disk space is checked when transferring
|
||||
content to avoid running out, and additional free space can be reserved
|
||||
via this option, to make space for more important content (such as git
|
||||
commit logs). The units are bytes.
|
||||
The default reserve is 1048576 (1 megabyte).
|
||||
|
||||
* `annex.version`
|
||||
|
||||
Automatically maintained, and used to automate upgrades between versions.
|
||||
|
|
Loading…
Reference in a new issue