kernel: random page cache fixes

This commit is contained in:
Matheus
2025-10-13 00:12:24 -03:00
parent 7f9dacedf0
commit 049b9c9ad6
2 changed files with 10 additions and 5 deletions
+6 -4
View File
@@ -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));
}
+4 -1
View File
@@ -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