Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
609ea777
Commit
609ea777
authored
Dec 20, 2017
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix BTRFS: stat.st_blocks may not be correct until synced.
Yes, I'm using BTRFS now...
parent
ba4d873c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
filesystem-disk-test.c++
c++/src/kj/filesystem-disk-test.c++
+6
-1
No files found.
c++/src/kj/filesystem-disk-test.c++
View file @
609ea777
...
...
@@ -843,9 +843,12 @@ KJ_TEST("DiskFile holes") {
file
->
writeAll
(
"foobar"
);
file
->
write
(
1
<<
20
,
StringPtr
(
"foobar"
).
asBytes
());
// Some filesystems, like BTRFS, report zero `spaceUsed` until synced.
file
->
datasync
();
// Allow for block sizes as low as 512 bytes and as high as 64k.
auto
meta
=
file
->
stat
();
KJ_EXPECT
(
meta
.
spaceUsed
>=
2
*
512
);
KJ_EXPECT
(
meta
.
spaceUsed
>=
2
*
512
,
meta
.
spaceUsed
);
KJ_EXPECT
(
meta
.
spaceUsed
<=
2
*
65536
);
byte
buf
[
7
];
...
...
@@ -868,6 +871,7 @@ KJ_TEST("DiskFile holes") {
#endif
file
->
truncate
(
1
<<
21
);
file
->
datasync
();
KJ_EXPECT
(
file
->
stat
().
spaceUsed
==
meta
.
spaceUsed
);
KJ_EXPECT
(
file
->
read
(
1
<<
20
,
buf
)
==
7
);
KJ_EXPECT
(
StringPtr
(
reinterpret_cast
<
char
*>
(
buf
),
6
)
==
"foobar"
);
...
...
@@ -890,6 +894,7 @@ KJ_TEST("DiskFile holes") {
// Try punching a hole with zero().
file
->
zero
(
1
<<
20
,
4096
);
file
->
datasync
();
#if !_WIN32
// TODO(someday): This doesn't work on Windows. I don't know why. We're definitely using the
// proper ioctl. Oh well.
...
...
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