annex.fastcopy
Added annex.fastcopy and remote.name.annex-fastcopy config setting. When set, this allows the copy_file_range syscall to be used, which can eg allow for server-side copies on NFS. (For fastest copying, also disable annex.verify or remote.name.annex-verify.) This is a simple implementation, that does not handle resuming as well as it possibly could. It can be used with both local git remotes (including on NFS), and directory special remotes. Other types of remotes could in theory also support it, so I've left the config documented as a general thing.
This commit is contained in:
parent
6468a39e92
commit
73060eea51
10 changed files with 151 additions and 66 deletions
|
@ -43,7 +43,12 @@ copyMetaDataParams meta = map snd $ filter fst
|
|||
|
||||
{- The cp command is used, because I hate reinventing the wheel,
|
||||
- and because this allows easy access to features like cp --reflink
|
||||
- and preserving metadata. -}
|
||||
- and preserving metadata.
|
||||
-
|
||||
- This uses --reflink=auto when supported, which allows for fast copies
|
||||
- using reflinks or the copy_file_range syscall. Whatever cp thinks is
|
||||
- best. --reflink=auto is the default of recent versions of cp, but is
|
||||
- used explicitly to support older versions. -}
|
||||
copyFileExternal :: CopyMetaData -> OsPath -> OsPath -> IO Bool
|
||||
copyFileExternal meta src dest = do
|
||||
-- Delete any existing dest file because an unwritable file
|
||||
|
@ -81,8 +86,8 @@ copyCoW meta src dest
|
|||
| otherwise = return False
|
||||
where
|
||||
-- Note that in coreutils 9.0, cp uses CoW by default,
|
||||
-- without needing an option. This s only needed to support
|
||||
-- older versions.
|
||||
-- without needing an option. But, this makes it fail if it is
|
||||
-- unable to make a CoW copy.
|
||||
params = Param "--reflink=always" : copyMetaDataParams meta
|
||||
|
||||
{- Create a hard link if the filesystem allows it, and fall back to copying
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue