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
bc041be8
Commit
bc041be8
authored
Feb 22, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
d874ccae
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
0 deletions
+21
-0
bigfile/virtmem.c
bigfile/virtmem.c
+15
-0
include/wendelin/bigfile/virtmem.h
include/wendelin/bigfile/virtmem.h
+4
-0
wcfs/wcfs.go
wcfs/wcfs.go
+2
-0
No files found.
bigfile/virtmem.c
View file @
bc041be8
...
@@ -226,6 +226,7 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen)
...
@@ -226,6 +226,7 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen)
goto
fail
;
goto
fail
;
/* allocate address space somewhere */
/* allocate address space somewhere */
// XXX overlay: -> mmap(base, READ)
addr
=
mem_valloc
(
NULL
,
len
);
addr
=
mem_valloc
(
NULL
,
len
);
if
(
!
addr
)
if
(
!
addr
)
goto
fail
;
goto
fail
;
...
@@ -382,6 +383,8 @@ int fileh_dirty_writeout(BigFileH *fileh, enum WriteoutFlags flags)
...
@@ -382,6 +383,8 @@ int fileh_dirty_writeout(BigFileH *fileh, enum WriteoutFlags flags)
}
}
/* page.state -> PAGE_LOADED and correct mappings RW -> R */
/* page.state -> PAGE_LOADED and correct mappings RW -> R */
// XXX adjust(wcfs): just remmap base file? (but it does not yet have stored changes)
// XXX -> vma_remove_readonly_overlay()?
if
(
flags
&
WRITEOUT_MARKSTORED
)
{
if
(
flags
&
WRITEOUT_MARKSTORED
)
{
page
->
state
=
PAGE_LOADED
;
page
->
state
=
PAGE_LOADED
;
list_del_init
(
&
page
->
in_dirty
);
list_del_init
(
&
page
->
in_dirty
);
...
@@ -588,6 +591,8 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
...
@@ -588,6 +591,8 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
/* continuing on_pagefault() - see (1) there ... */
/* continuing on_pagefault() - see (1) there ... */
// XXX overlay: assert write
/* (2) vma, addr -> fileh, pagen ;idx of fileh page covering addr */
/* (2) vma, addr -> fileh, pagen ;idx of fileh page covering addr */
fileh
=
vma
->
fileh
;
fileh
=
vma
->
fileh
;
pagen
=
vma_addr_fpgoffset
(
vma
,
addr
);
pagen
=
vma_addr_fpgoffset
(
vma
,
addr
);
...
@@ -595,6 +600,8 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
...
@@ -595,6 +600,8 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
/* (3) fileh, pagen -> page (via pagemap) */
/* (3) fileh, pagen -> page (via pagemap) */
page
=
pagemap_get
(
&
fileh
->
pagemap
,
pagen
);
page
=
pagemap_get
(
&
fileh
->
pagemap
,
pagen
);
// XXX overlay: assert !page
/* (4) no page found - allocate new from ram */
/* (4) no page found - allocate new from ram */
while
(
!
page
)
{
while
(
!
page
)
{
page
=
ramh_alloc_page
(
fileh
->
ramh
,
pagen
);
page
=
ramh_alloc_page
(
fileh
->
ramh
,
pagen
);
...
@@ -663,6 +670,9 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
...
@@ -663,6 +670,9 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
pageram
=
page_mmap
(
page
,
NULL
,
PROT_READ
|
PROT_WRITE
);
pageram
=
page_mmap
(
page
,
NULL
,
PROT_READ
|
PROT_WRITE
);
TODO
(
!
pageram
);
// XXX err
TODO
(
!
pageram
);
// XXX err
// XXX overlay: copy data from base image, page.state=DIRTY
// XXX overlay: goto inject_page
/* loadblk() -> pageram memory */
/* loadblk() -> pageram memory */
blk
=
page
->
f_pgoffset
;
// NOTE because blksize = pagesize
blk
=
page
->
f_pgoffset
;
// NOTE because blksize = pagesize
...
@@ -732,6 +742,7 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
...
@@ -732,6 +742,7 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
return
VM_RETRY
;
return
VM_RETRY
;
}
}
inject_page:
/* (6) page data ready. Mmap it atomically into vma address space, or mprotect
/* (6) page data ready. Mmap it atomically into vma address space, or mprotect
* appropriately if it was already mmaped. */
* appropriately if it was already mmaped. */
int
prot
=
PROT_READ
;
int
prot
=
PROT_READ
;
...
@@ -741,6 +752,9 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
...
@@ -741,6 +752,9 @@ VMFaultResult vma_on_pagefault(VMA *vma, uintptr_t addr, int write)
newstate
=
PAGE_DIRTY
;
newstate
=
PAGE_DIRTY
;
}
}
// XXX overlay: assert !vma->page_ismappedv[blk]
// XXX overlay: mmap page to all vma of this fileh.
if
(
!
bitmap_test_bit
(
vma
->
page_ismappedv
,
page
->
f_pgoffset
-
vma
->
f_pgoffset
))
{
if
(
!
bitmap_test_bit
(
vma
->
page_ismappedv
,
page
->
f_pgoffset
-
vma
->
f_pgoffset
))
{
// XXX err
// XXX err
page_mmap
(
page
,
vma_page_addr
(
vma
,
page
),
prot
);
page_mmap
(
page
,
vma_page_addr
(
vma
,
page
),
prot
);
...
@@ -939,6 +953,7 @@ static void vma_page_ensure_unmapped(VMA *vma, Page *page)
...
@@ -939,6 +953,7 @@ static void vma_page_ensure_unmapped(VMA *vma, Page *page)
return
;
return
;
/* mmap empty PROT_NONE address space instead of page memory */
/* mmap empty PROT_NONE address space instead of page memory */
// XXX overlay: remmap to base image
mem_xvalloc
(
vma_page_addr
(
vma
,
page
),
page_size
(
page
));
mem_xvalloc
(
vma_page_addr
(
vma
,
page
),
page_size
(
page
));
bitmap_clear_bit
(
vma
->
page_ismappedv
,
page
->
f_pgoffset
-
vma
->
f_pgoffset
);
bitmap_clear_bit
(
vma
->
page_ismappedv
,
page
->
f_pgoffset
-
vma
->
f_pgoffset
);
...
...
include/wendelin/bigfile/virtmem.h
View file @
bc041be8
...
@@ -154,6 +154,10 @@ struct VMA {
...
@@ -154,6 +154,10 @@ struct VMA {
*/
*/
int
fileh_open
(
BigFileH
*
fileh
,
BigFile
*
file
,
RAM
*
ram
);
int
fileh_open
(
BigFileH
*
fileh
,
BigFile
*
file
,
RAM
*
ram
);
// XXX + fileh_open_overlay(fileh, file, base, ram) ?
// here base is glued data from head/bigfile/file + revX/bigfile/file overwrites.
// file will be used only to storeblk (loadblk=BUG).
/* close fileh
/* close fileh
*
*
...
...
wcfs/wcfs.go
View file @
bc041be8
...
@@ -1621,6 +1621,8 @@ func main() {
...
@@ -1621,6 +1621,8 @@ func main() {
go
root
.
zwatcher
(
ctx
)
go
root
.
zwatcher
(
ctx
)
// TODO handle autoexit
// TODO handle autoexit
// (exit when kernel forgets all our inodes - wcfs.py keeps .wcfs/zurl
// opened, so when all inodes has been forgotten - we know all wcfs.py clients exited)
_
=
autoexit
_
=
autoexit
// serve client requests
// serve client requests
...
...
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