Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
H
hash_backup
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anders Blomdell
hash_backup
Commits
fa36368c
Commit
fa36368c
authored
Apr 21, 2021
by
Anders Blomdell
Browse files
Options
Downloads
Patches
Plain Diff
Use path length in space allocation
parent
db98d4e2
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
secondary.py
+6
-4
6 additions, 4 deletions
secondary.py
with
6 additions
and
4 deletions
secondary.py
+
6
−
4
View file @
fa36368c
...
...
@@ -74,7 +74,7 @@ class Backup:
cwd
=
os
.
path
.
join
(
self
.
mount
,
self
.
path
)
reader
=
tar_stream
.
TarReader
(
self
.
primary_out
)
for
e
in
reader
:
self
.
make_room
(
e
.
size
)
self
.
make_room
(
e
.
size
,
e
.
path
)
e
.
tarfile
.
extract
(
e
,
path
=
cwd
)
pass
...
...
@@ -117,15 +117,17 @@ class Backup:
else
:
self
.
status
.
unchanged
+=
1
def
make_room
(
self
,
size
):
def
get_free_need
(
size
):
def
make_room
(
self
,
size
,
path
=
None
):
def
get_free_need
(
size
,
path
):
stat
=
os
.
statvfs
(
self
.
dst_root
)
free
=
stat
.
f_frsize
*
stat
.
f_bavail
need
=
size
+
stat
.
f_frsize
if
path
:
need
+=
stat
.
f_frsize
*
len
(
path
.
split
(
'
/
'
))
return
(
free
,
need
)
do_log
=
False
while
True
:
free
,
need
=
get_free_need
(
size
)
free
,
need
=
get_free_need
(
size
,
path
)
if
do_log
:
self
.
log
.
MESSAGE
(
"
After, free=%d, need=%d
"
%
(
free
,
need
))
pass
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment