mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-02 07:28:21 +00:00
kernel: random page cache fixes
This commit is contained in:
+6
-4
@@ -456,12 +456,13 @@ int vfs_write_iovec(vnode_t *node, iovec_iterator_t *iovec_iterator, size_t size
|
|||||||
|
|
||||||
vmmcache_makedirty(page);
|
vmmcache_makedirty(page);
|
||||||
*written += writesize;
|
*written += writesize;
|
||||||
pageoffset += 1;
|
|
||||||
pagecount -= 1;
|
|
||||||
|
|
||||||
if (flags & V_FFLAGS_NOCACHE)
|
if (flags & V_FFLAGS_NOCACHE)
|
||||||
err = writenocache(node, page, pageoffset * PAGE_SIZE);
|
err = writenocache(node, page, pageoffset * PAGE_SIZE);
|
||||||
|
|
||||||
|
pageoffset += 1;
|
||||||
|
pagecount -= 1;
|
||||||
|
|
||||||
pmm_release(FROM_HHDM(address));
|
pmm_release(FROM_HHDM(address));
|
||||||
if (err)
|
if (err)
|
||||||
goto leave;
|
goto leave;
|
||||||
@@ -567,14 +568,15 @@ int vfs_read_iovec(vnode_t *node, iovec_iterator_t *iovec_iterator, size_t size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
*bytesread += readsize;
|
*bytesread += readsize;
|
||||||
pageoffset += 1;
|
|
||||||
pagecount -= 1;
|
|
||||||
|
|
||||||
if (flags & V_FFLAGS_NOCACHE) {
|
if (flags & V_FFLAGS_NOCACHE) {
|
||||||
// try to turn it into anonymous memory
|
// try to turn it into anonymous memory
|
||||||
vmmcache_evict(page);
|
vmmcache_evict(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pageoffset += 1;
|
||||||
|
pagecount -= 1;
|
||||||
|
|
||||||
pmm_release(FROM_HHDM(address));
|
pmm_release(FROM_HHDM(address));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,10 @@ int vmmcache_getpage(vnode_t *vnode, uintmax_t offset, page_t **res) {
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HOLD_LOCK();
|
||||||
newpage->flags |= PAGE_FLAGS_READY;
|
newpage->flags |= PAGE_FLAGS_READY;
|
||||||
|
RELEASE_LOCK();
|
||||||
|
|
||||||
EVENT_SIGNAL(&pagereadyevent);
|
EVENT_SIGNAL(&pagereadyevent);
|
||||||
*res = newpage;
|
*res = newpage;
|
||||||
}
|
}
|
||||||
@@ -335,7 +338,7 @@ int vmmcache_syncvnode(vnode_t *vnode, uintmax_t offset, size_t size) {
|
|||||||
page_t *page = vnode->pages;
|
page_t *page = vnode->pages;
|
||||||
page_t *vnodedirtylist = NULL;
|
page_t *vnodedirtylist = NULL;
|
||||||
for (; page; page = page->vnodenext) {
|
for (; page; page = page->vnodenext) {
|
||||||
if (page->offset < offset || page->offset >= top || (page->offset & PAGE_FLAGS_DIRTY) == 0)
|
if (page->offset < offset || page->offset >= top || (page->flags & PAGE_FLAGS_DIRTY) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// remove from write list and add to an internal list using the write pointers
|
// remove from write list and add to an internal list using the write pointers
|
||||||
|
|||||||
Reference in New Issue
Block a user