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

@@ -978,6 +978,9 @@
/* To VM: identify cache block in FS */
#define VM_SETCACHEPAGE (VM_RQ_BASE+27)
/* To VM: clear all cache blocks for a device */
#define VM_CLEARCACHE (VM_RQ_BASE+28)
/* To VFS: fields for request from VM. */
# define VFS_VMCALL_REQ m10_i1
# define VFS_VMCALL_FD m10_i2

View File

@@ -72,6 +72,8 @@ int vm_set_cacheblock(void *block, u32_t dev, u64_t dev_offset,
void *vm_map_cacheblock(u32_t dev, u64_t dev_offset,
u64_t ino, u64_t ino_offset, u32_t *flags, int blocksize);
int vm_clear_cache(u32_t dev);
/* flags for vm cache functions */
#define VMMC_FLAGS_LOCKED 0x01 /* someone is updating the flags; don't read/write */
#define VMMC_DIRTY 0x02 /* dirty buffer and it may not be evicted */