VM: readd support for forgetting cached FS blocks

Not all services involved in block I/O go through VM to access the
blocks they need.  As a result, the blocks in VM may become stale,
possibly causing corruption when the stale copy is restored by a
service that does go through VM later on.  This patch restores support
for forgetting cached blocks that belong to a particular device, and
makes the relevant file systems use this functionality 1) when
requested by VFS through REQ_FLUSH, and 2) upon unmount.

Change-Id: I0758c5ed8fe4b5ba81d432595d2113175776aff8
This commit is contained in:
David van Moolenbroek
2013-09-15 18:55:42 +02:00
committed by Lionel Sambuc
parent df724f2e14
commit b48542d914
15 changed files with 75 additions and 14 deletions

View File

@@ -224,16 +224,6 @@ panic(const char *fmt, ...)
exit(1);
}
int vm_forgetblock(u64_t id)
{
return ENOSYS;
}
void vm_forgetblocks(void)
{
return;
}
int
vm_info_stats(struct vm_stats_info *vsi)
{
@@ -274,6 +264,11 @@ void *vm_map_cacheblock(u32_t dev, u64_t dev_offset,
return MAP_FAILED;
}
int vm_clear_cache(u32_t dev)
{
return 0;
}
int
main(int argc, char *argv[])
{

View File

@@ -177,6 +177,8 @@ main(int argc, char *argv[])
writepipe(&info);
vm_clear_cache(MYDEV);
return 0;
}

View File

@@ -1,7 +1,7 @@
service testvm {
ipc ALL; # All system ipc targets allowed
system BASIC; # Only basic kernel calls allowed
vm MAPCACHEPAGE SETCACHEPAGE;
vm MAPCACHEPAGE SETCACHEPAGE CLEARCACHE;
io NONE; # No I/O range allowed
irq NONE; # No IRQ allowed
sigmgr rs; # Signal manager is RS