1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-27 02:08:54 +00:00

Merge pull request #4292 from m3nu/issue/4289/fix-free-space-calc

Use f_frsize instead of f_bsize to calculate free space. Fixes #4289
This commit is contained in:
TW 2019-01-31 08:34:45 +01:00 committed by GitHub
commit 2db84eada0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -1104,7 +1104,7 @@ def __init__(self, repository, pack=None, unpack=None, transform=None):
def query_size_limit(self): def query_size_limit(self):
stat_fs = os.statvfs(self.basedir) stat_fs = os.statvfs(self.basedir)
available_space = stat_fs.f_bsize * stat_fs.f_bavail available_space = stat_fs.f_bavail * stat_fs.f_frsize
self.size_limit = int(min(available_space * 0.25, 2**31)) self.size_limit = int(min(available_space * 0.25, 2**31))
def key_filename(self, key): def key_filename(self, key):

View file

@ -658,7 +658,7 @@ def check_free_space(self):
logger.warning('Failed to check free space before committing: no statvfs method available') logger.warning('Failed to check free space before committing: no statvfs method available')
return return
# f_bavail: even as root - don't touch the Federal Block Reserve! # f_bavail: even as root - don't touch the Federal Block Reserve!
free_space = st_vfs.f_bavail * st_vfs.f_bsize free_space = st_vfs.f_bavail * st_vfs.f_frsize
logger.debug('check_free_space: required bytes {}, free bytes {}'.format(required_free_space, free_space)) logger.debug('check_free_space: required bytes {}, free bytes {}'.format(required_free_space, free_space))
if free_space < required_free_space: if free_space < required_free_space:
if self.created: if self.created: