Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-ds-flatfs
Commits
99c0640e
Unverified
Commit
99c0640e
authored
Sep 10, 2018
by
Kevin Atkinson
Committed by
GitHub
Sep 10, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #47 from b5/switch_defer
check error before defer-removing disk usage file
parents
d25f80d9
21dc9bb7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
flatfs.go
flatfs.go
+5
-4
No files found.
flatfs.go
View file @
99c0640e
...
...
@@ -863,6 +863,11 @@ func (fs *Datastore) checkpointLoop() {
func
(
fs
*
Datastore
)
writeDiskUsageFile
(
du
int64
,
doSync
bool
)
{
tmp
,
err
:=
ioutil
.
TempFile
(
fs
.
path
,
"du-"
)
if
err
!=
nil
{
log
.
Warningf
(
"cound not write disk usage: %v"
,
err
)
return
}
removed
:=
false
defer
func
()
{
if
!
removed
{
...
...
@@ -870,10 +875,6 @@ func (fs *Datastore) writeDiskUsageFile(du int64, doSync bool) {
_
=
os
.
Remove
(
tmp
.
Name
())
}
}()
if
err
!=
nil
{
log
.
Warningf
(
"cound not write disk usage: %v"
,
err
)
return
}
toWrite
:=
fs
.
storedValue
toWrite
.
DiskUsage
=
du
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment