mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +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);
|
||||
*written += writesize;
|
||||
pageoffset += 1;
|
||||
pagecount -= 1;
|
||||
|
||||
if (flags & V_FFLAGS_NOCACHE)
|
||||
err = writenocache(node, page, pageoffset * PAGE_SIZE);
|
||||
|
||||
pageoffset += 1;
|
||||
pagecount -= 1;
|
||||
|
||||
pmm_release(FROM_HHDM(address));
|
||||
if (err)
|
||||
goto leave;
|
||||
@@ -567,14 +568,15 @@ int vfs_read_iovec(vnode_t *node, iovec_iterator_t *iovec_iterator, size_t size,
|
||||
}
|
||||
|
||||
*bytesread += readsize;
|
||||
pageoffset += 1;
|
||||
pagecount -= 1;
|
||||
|
||||
if (flags & V_FFLAGS_NOCACHE) {
|
||||
// try to turn it into anonymous memory
|
||||
vmmcache_evict(page);
|
||||
}
|
||||
|
||||
pageoffset += 1;
|
||||
pagecount -= 1;
|
||||
|
||||
pmm_release(FROM_HHDM(address));
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,10 @@ int vmmcache_getpage(vnode_t *vnode, uintmax_t offset, page_t **res) {
|
||||
return error;
|
||||
}
|
||||
|
||||
HOLD_LOCK();
|
||||
newpage->flags |= PAGE_FLAGS_READY;
|
||||
RELEASE_LOCK();
|
||||
|
||||
EVENT_SIGNAL(&pagereadyevent);
|
||||
*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 *vnodedirtylist = NULL;
|
||||
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;
|
||||
|
||||
// remove from write list and add to an internal list using the write pointers
|
||||
|
||||
Reference in New Issue
Block a user