Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
fbd5b279
Commit
fbd5b279
authored
Jul 10, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1dcbe2a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
12 deletions
+30
-12
bigfile/virtmem.c
bigfile/virtmem.c
+30
-12
No files found.
bigfile/virtmem.c
View file @
fbd5b279
...
...
@@ -230,9 +230,12 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen)
sigsegv_block
(
&
save_sigset
);
virt_lock
();
/*
alloc vma->page_ismappedv[]
*/
/*
start preparing vma
*/
bzero
(
vma
,
sizeof
(
*
vma
));
vma
->
fileh
=
fileh
;
vma
->
f_pgoffset
=
pgoffset
;
/* alloc vma->page_ismappedv[] */
vma
->
page_ismappedv
=
bitmap_alloc0
(
pglen
);
if
(
!
vma
->
page_ismappedv
)
goto
fail
;
...
...
@@ -241,26 +244,41 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen)
vma
->
mmap_overlay
=
(
fops
->
mmap_setup_read
!=
NULL
);
if
(
vma
->
mmap_overlay
)
{
/* wcfs: mmap(base, READ)
+ mmap(fileh->dirty_pages) over it
*/
/* wcfs: mmap(base, READ) */
TODO
(
file
->
blksize
!=
fileh
->
ramh
->
ram
->
pagesize
);
addr
=
fops
->
mmap_setup_read
(
file
,
pgoffset
,
pglen
,
vma
);
if
(
!
addr
)
goto
fail
;
// XXX + mmap(fileh->dirty_pages)
}
else
{
/* !wcfs: allocate address space somewhere */
addr
=
mem_valloc
(
NULL
,
len
);
if
(
!
addr
)
goto
fail
;
}
if
(
!
addr
)
goto
fail
;
/* everything allocated - link it up */
/* vma address range known */
vma
->
addr_start
=
(
uintptr_t
)
addr
;
vma
->
addr_stop
=
vma
->
addr_start
+
len
;
vma
->
fileh
=
fileh
;
vma
->
f_pgoffset
=
pgoffset
;
/* wcfs: mmap(fileh->dirty_pages) over base */
if
(
vma
->
mmap_overlay
)
{
Page
*
page
;
struct
list_head
*
hpage
;
list_for_each
(
hpage
,
&
fileh
->
dirty_pages
)
{
page
=
list_entry
(
hpage
,
typeof
(
*
page
),
in_dirty
);
BUG_ON
(
page
->
state
!=
PAGE_DIRTY
);
if
(
!
(
pgoffset
<=
page
->
f_pgoffset
&&
page
->
f_pgoffset
<
pgoffset
+
pglen
))
continue
;
/* page is out of requested mmap coverage */
// XXX err
// XXX notify watcher that we mmaped RAM page in its range?
page_mmap
(
page
,
vma_page_addr
(
vma
,
page
),
PROT_READ
|
PROT_WRITE
);
bitmap_set_bit
(
vma
->
page_ismappedv
,
page
->
f_pgoffset
-
vma
->
f_pgoffset
);
page_incref
(
page
);
}
}
/* everything allocated - link it up */
// XXX need to init vma->virt_list first?
/* hook vma to fileh->mmaps */
...
...
@@ -276,7 +294,7 @@ out:
fail:
free
(
vma
->
page_ismappedv
);
vma
->
page_ismappedv
=
NULL
;
bzero
(
vma
,
sizeof
(
*
vma
))
;
err
=
-
1
;
goto
out
;
}
...
...
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