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

@@ -577,6 +577,8 @@ void lmfs_invalidate(
bp->data = NULL;
}
}
vm_clear_cache(device);
}
/*===========================================================================*

View File

@@ -60,3 +60,17 @@ int vm_set_cacheblock(void *block, u32_t dev, u64_t dev_offset,
return vm_cachecall(&m, VM_SETCACHEPAGE, block, dev, dev_offset,
ino, ino_offset, flags, blocksize);
}
int
vm_clear_cache(u32_t dev)
{
message m;
assert(dev != NO_DEV);
memset(&m, 0, sizeof(m));
m.m_u.m_vmmcp.dev = dev;
return _taskcall(VM_PROC_NR, VM_CLEARCACHE, &m);
}