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
9cb90a6e
Commit
9cb90a6e
authored
Mar 24, 2018
by
Kevin Atkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log errors in writeDiskUsageFile()
parent
2df76d73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
flatfs.go
flatfs.go
+7
-0
No files found.
flatfs.go
View file @
9cb90a6e
...
...
@@ -813,6 +813,9 @@ func (fs *Datastore) checkpointLoop() {
du
:=
atomic
.
LoadInt64
(
&
fs
.
diskUsage
)
if
!
more
{
// shutting down
fs
.
writeDiskUsageFile
(
du
)
if
fs
.
dirty
{
log
.
Errorf
(
"could not right final value of disk usage to file, future estimates may be inaccurate"
)
}
fs
.
done
<-
true
return
}
...
...
@@ -844,19 +847,23 @@ func (fs *Datastore) checkpointLoop() {
func
(
fs
*
Datastore
)
writeDiskUsageFile
(
du
int64
)
{
tmp
,
err
:=
ioutil
.
TempFile
(
fs
.
path
,
"du-"
)
if
err
!=
nil
{
log
.
Warningf
(
"cound not write disk usage: %v"
,
err
)
return
}
encoder
:=
json
.
NewEncoder
(
tmp
)
if
err
:=
encoder
.
Encode
(
&
fs
.
storedValue
);
err
!=
nil
{
log
.
Warningf
(
"cound not write disk usage: %v"
,
err
)
return
}
if
err
:=
tmp
.
Close
();
err
!=
nil
{
log
.
Warningf
(
"cound not write disk usage: %v"
,
err
)
return
}
if
err
:=
os
.
Rename
(
tmp
.
Name
(),
filepath
.
Join
(
fs
.
path
,
DiskUsageFile
));
err
!=
nil
{
log
.
Warningf
(
"cound not write disk usage: %v"
,
err
)
return
}
...
...
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