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
Container Registry
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
redox-os
redoxfs
Commits
ae715277
Verified
Commit
ae715277
authored
1 year ago
by
Jeremy Soller
Browse files
Options
Downloads
Patches
Plain Diff
Cache current fmap size
parent
4048f541
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#13494
failed
1 year ago
Stage: build
Stage: test
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mount/redox/resource.rs
+21
-13
21 additions, 13 deletions
src/mount/redox/resource.rs
with
21 additions
and
13 deletions
src/mount/redox/resource.rs
+
21
−
13
View file @
ae715277
...
...
@@ -310,8 +310,10 @@ pub struct FileResource {
seek
:
isize
,
uid
:
u32
,
}
#[derive(Debug)]
pub
struct
FileMmapInfo
{
base
:
*
mut
u8
,
size
:
usize
,
ranges
:
RangeTree
<
Fmap
>
,
pub
open_fds
:
usize
,
}
...
...
@@ -319,6 +321,7 @@ impl Default for FileMmapInfo {
fn
default
()
->
Self
{
Self
{
base
:
core
::
ptr
::
null_mut
(),
size
:
0
,
ranges
:
RangeTree
::
new
(),
open_fds
:
0
,
}
...
...
@@ -443,12 +446,12 @@ impl<D: Disk> Resource<D> for FileResource {
// obtained by the caller.
let
fmap_info
=
fmaps
.get_mut
(
&
self
.node_ptr
.id
())
.ok_or
(
Error
::
new
(
EBADFD
))
?
;
let
max_offset
=
fmap_info
.ranges
.end
(
);
if
offset
+
alig
ne
d
_size
as
u64
>
ma
x_offset
{
if
fmap_info
.base
.is_null
()
{
fmap_info
.base
=
unsafe
{
let
new_size
=
(
offset
as
usize
+
aligned_size
)
.next_multiple_of
(
PAGE_SIZE
);
if
ne
w
_size
>
f
ma
p_info
.size
{
fmap_info
.base
=
if
fmap_info
.base
.is_null
()
{
unsafe
{
syscall
::
fmap
(
!
0
,
&
Map
{
size
:
offset
as
usize
+
alig
ne
d
_size
,
size
:
ne
w
_size
,
// PRIVATE/SHARED doesn't matter once the pages are passed in the fmap
// handler.
flags
:
MapFlags
::
PROT_READ
|
MapFlags
::
PROT_WRITE
|
MapFlags
::
MAP_PRIVATE
,
...
...
@@ -456,15 +459,20 @@ impl<D: Disk> Resource<D> for FileResource {
offset
:
0
,
address
:
0
,
})
?
as
*
mut
u8
}
;
}
}
else
{
let
new_size
=
(
offset
as
usize
+
aligned_size
)
.next_multiple_of
(
PAGE_SIZE
);
let
old_size
=
max_offset
as
usize
;
fmap_info
.base
=
unsafe
{
syscall
::
syscall5
(
syscall
::
SYS_MREMAP
,
fmap_info
.base
as
usize
,
old_size
,
0
,
new_size
,
syscall
::
MremapFlags
::
empty
()
.bits
()
|
(
PROT_READ
|
PROT_WRITE
)
.bits
())
?
as
*
mut
u8
};
}
unsafe
{
syscall
::
syscall5
(
syscall
::
SYS_MREMAP
,
fmap_info
.base
as
usize
,
fmap_info
.size
,
0
,
new_size
,
syscall
::
MremapFlags
::
empty
()
.bits
()
|
(
PROT_READ
|
PROT_WRITE
)
.bits
()
)
?
as
*
mut
u8
}
};
fmap_info
.size
=
new_size
;
}
let
affected_fmaps
=
fmap_info
.ranges
.remove_and_unused
(
offset
..
offset
+
aligned_size
as
u64
);
...
...
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