Commit 4d18f19b authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a3299f60
......@@ -1179,7 +1179,8 @@ void test_file_access_mmapbase(void)
RAM *ram;
BigFileH fh_struct, *fh = &fh_struct;
VMA vma_struct, *vma = &vma_struct;
Page *page0, *page2, *page3;
// Page *page0, *page2, *page3;
Page *page2;
size_t PS, PSb;
int fd, err;
......
/* Wendelin.bigfile | Virtual memory
* Copyright (C) 2014-2015 Nexedi SA and Contributors.
* Copyright (C) 2014-2019 Nexedi SA and Contributors.
* Kirill Smelkov <kirr@nexedi.com>
*
* This program is free software: you can Use, Study, Modify and Redistribute
......@@ -222,9 +222,9 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen)
{
void *addr;
size_t len = pglen * fileh->ramh->ram->pagesize;
int err = 0;
BigFile *file = fileh->file;
const bigfile_ops *fops = file->file_ops;
int err = 0;
sigset_t save_sigset;
sigsegv_block(&save_sigset);
......@@ -241,13 +241,14 @@ 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 */
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 {
/* allocate address space somewhere */
/* !wcfs: allocate address space somewhere */
addr = mem_valloc(NULL, len);
if (!addr)
goto fail;
......@@ -407,8 +408,8 @@ int fileh_dirty_writeout(BigFileH *fileh, enum WriteoutFlags flags)
}
/* 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()?
// XXX wcfs: just remmap base file? (but it does not yet have stored changes)
// XXX -> vma_remove_readonly_overlay()?
if (flags & WRITEOUT_MARKSTORED) {
page->state = PAGE_LOADED;
list_del_init(&page->in_dirty);
......@@ -452,6 +453,7 @@ void fileh_dirty_discard(BigFileH *fileh)
BUG_ON(page->state != PAGE_DIRTY);
page_drop_memory(page);
// XXX wcfs: remmap page(s) to base file
}
BUG_ON(!list_empty(&fileh->dirty_pages));
......@@ -475,6 +477,8 @@ void fileh_invalidate_page(BigFileH *fileh, pgoff_t pgoffset)
/* it's an error to invalidate fileh while writeout is in progress */
BUG_ON(fileh->writeout_inprogress);
// XXX wcfs: invalidate_page must not be called (wcfs handles invalidations itself)
// XXX or allow invalidate anyway (e.g. DIRTY -> base) ?
page = pagemap_get(&fileh->pagemap, pgoffset);
if (page) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment