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' :: Integer -> Key -> Annex ()
|
||||||
checkDiskSpace' adjustment key = do
|
checkDiskSpace' adjustment key = do
|
||||||
liftIO $ putStrLn $ "adjust " ++ show adjustment
|
|
||||||
g <- Annex.gitRepo
|
g <- Annex.gitRepo
|
||||||
|
r <- Annex.repoConfig g "diskreserve" ""
|
||||||
|
let reserve = if null r then megabyte else (read r :: Integer)
|
||||||
stats <- liftIO $ getFileSystemStats (gitAnnexDir g)
|
stats <- liftIO $ getFileSystemStats (gitAnnexDir g)
|
||||||
case (stats, keySize key) of
|
case (stats, keySize key) of
|
||||||
(Nothing, _) -> return ()
|
(Nothing, _) -> return ()
|
||||||
(_, Nothing) -> return ()
|
(_, Nothing) -> return ()
|
||||||
(Just (FileSystemStats { fsStatBytesAvailable = have }), Just need) ->
|
(Just (FileSystemStats { fsStatBytesAvailable = have }), Just need) ->
|
||||||
if (need + overhead >= have + adjustment)
|
if (need + reserve > have + adjustment)
|
||||||
then error $ "not enough free space (have " ++
|
then error $ "not enough free space (have " ++
|
||||||
showsize (have + adjustment) ++ "; need " ++
|
showsize (have + adjustment) ++ "; need " ++
|
||||||
showsize (need + overhead) ++ ")"
|
showsize (need + reserve) ++ ")"
|
||||||
else return ()
|
else return ()
|
||||||
where
|
where
|
||||||
showsize i = show i
|
showsize i = show i
|
||||||
-- Adding a file to the annex requires some overhead beyond
|
megabyte :: Integer
|
||||||
-- just the file size; the git index must be updated, etc.
|
megabyte = 1024 * 1024
|
||||||
-- This is an arbitrary value.
|
|
||||||
overhead = 1024 * 1024 -- 1 mb
|
|
||||||
|
|
||||||
{- Removes the write bits from a file. -}
|
{- Removes the write bits from a file. -}
|
||||||
preventWrite :: FilePath -> IO ()
|
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
|
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
|
Linux, FreeBSD, and OSX; check compile-time messages to see if it
|
||||||
is not enabled for your OS.
|
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
|
* Add --fast flag, that can enable less expensive, but also less thurough
|
||||||
versions of some commands.
|
versions of some commands.
|
||||||
* fsck: In fast mode, avoid checking checksums.
|
* 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
|
Default ssh and rsync options to use if a remote does not have
|
||||||
specific options.
|
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`
|
* `annex.version`
|
||||||
|
|
||||||
Automatically maintained, and used to automate upgrades between versions.
|
Automatically maintained, and used to automate upgrades between versions.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue