Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
redoxfs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Will Angenent
redoxfs
Commits
53a3f6d7
Verified
Commit
53a3f6d7
authored
6 years ago
by
jD91mZM2
Browse files
Options
Downloads
Patches
Plain Diff
Fmaps: Fix bug with syncing
parent
e9a7181e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mount/redox/resource.rs
+8
-4
8 additions, 4 deletions
src/mount/redox/resource.rs
with
8 additions
and
4 deletions
src/mount/redox/resource.rs
+
8
−
4
View file @
53a3f6d7
...
@@ -204,14 +204,17 @@ impl FileResource {
...
@@ -204,14 +204,17 @@ impl FileResource {
fn
sync_fmap
<
D
:
Disk
>
(
&
mut
self
,
maps
:
&
mut
Fmaps
,
fs
:
&
mut
FileSystem
<
D
>
)
->
Result
<
()
>
{
fn
sync_fmap
<
D
:
Disk
>
(
&
mut
self
,
maps
:
&
mut
Fmaps
,
fs
:
&
mut
FileSystem
<
D
>
)
->
Result
<
()
>
{
if
let
Some
((
i
,
key_exact
))
=
self
.fmap
.as_ref
()
{
if
let
Some
((
i
,
key_exact
))
=
self
.fmap
.as_ref
()
{
let
(
_
,
value
)
=
maps
.index
(
*
i
)
.as_mut
()
.expect
(
"mapping dropped while still referenced"
);
let
(
key_round
,
value
)
=
maps
.index
(
*
i
)
.as_mut
()
.expect
(
"mapping dropped while still referenced"
);
let
rel_offset
=
key_exact
.offset
-
key_round
.offset
;
// Minimum out of our size and the original file size
// Minimum out of our size and the original file size
let
actual_size
=
value
.actual_size
.min
(
key_exact
.size
);
let
actual_size
=
(
value
.actual_size
-
rel_offset
)
.min
(
key_exact
.size
);
let
mut
count
=
0
;
let
mut
count
=
0
;
while
count
<
actual_size
{
while
count
<
actual_size
{
let
mtime
=
SystemTime
::
now
()
.duration_since
(
UNIX_EPOCH
)
.unwrap
();
let
mtime
=
SystemTime
::
now
()
.duration_since
(
UNIX_EPOCH
)
.unwrap
();
match
fs
.write_node
(
self
.block
,
key_exact
.offset
as
u64
+
count
as
u64
,
&
value
.buffer
[
count
..
actual_size
],
match
fs
.write_node
(
self
.block
,
key_exact
.offset
as
u64
+
count
as
u64
,
&
value
.buffer
[
rel_offset
..
][
count
..
actual_size
],
mtime
.as_secs
(),
mtime
.subsec_nanos
())
?
{
mtime
.as_secs
(),
mtime
.subsec_nanos
())
?
{
0
=>
{
0
=>
{
eprintln!
(
"Fmap failed to write whole buffer, encountered EOF early."
);
eprintln!
(
"Fmap failed to write whole buffer, encountered EOF early."
);
...
@@ -306,7 +309,8 @@ impl<D: Disk> Resource<D> for FileResource {
...
@@ -306,7 +309,8 @@ impl<D: Disk> Resource<D> for FileResource {
let
mut
content
=
vec!
[
0
;
key_round
.size
];
let
mut
content
=
vec!
[
0
;
key_round
.size
];
let
mut
count
=
0
;
let
mut
count
=
0
;
while
count
<
key_round
.size
{
while
count
<
key_round
.size
{
match
fs
.read_node
(
self
.block
,
key_round
.offset
as
u64
+
count
as
u64
,
&
mut
content
[
count
..
])
?
{
match
fs
.read_node
(
self
.block
,
key_round
.offset
as
u64
+
count
as
u64
,
&
mut
content
[
key_round
.offset
..
][
count
..
key_round
.size
])
?
{
0
=>
break
,
0
=>
break
,
n
=>
count
+=
n
n
=>
count
+=
n
}
}
...
...
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