mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-26 09:47:58 +00:00
repository: check_free_space, special case small repos
This commit is contained in:
parent
80b86709ef
commit
00fae3f3e3
1 changed files with 12 additions and 2 deletions
|
@ -428,8 +428,18 @@ def check_free_space(self):
|
|||
|
||||
required_free_space += self.additional_free_space
|
||||
if not self.append_only:
|
||||
# Keep one full worst-case segment free in non-append-only mode
|
||||
required_free_space += self.max_segment_size + MAX_OBJECT_SIZE
|
||||
full_segment_size = self.max_segment_size + MAX_OBJECT_SIZE
|
||||
if len(self.compact) < 10:
|
||||
# This is mostly for the test suite to avoid overestimated free space needs. This can be annoying
|
||||
# if TMP is a small-ish tmpfs.
|
||||
compact_working_space = sum(self.io.segment_size(segment) - free for segment, free in self.compact.items())
|
||||
logger.debug('check_free_space: few segments, not requiring a full free segment')
|
||||
compact_working_space = min(compact_working_space, full_segment_size)
|
||||
logger.debug('check_free_space: calculated working space for compact as %d bytes', compact_working_space)
|
||||
required_free_space += compact_working_space
|
||||
else:
|
||||
# Keep one full worst-case segment free in non-append-only mode
|
||||
required_free_space += full_segment_size
|
||||
try:
|
||||
st_vfs = os.statvfs(self.path)
|
||||
except OSError as os_error:
|
||||
|
|
Loading…
Reference in a new issue