mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-06 17:21:22 +00:00
dm: storage: support cache mode toggling
1. support "writeback" and "writethru" mode toggling for virtio-blk
conditionally. When starting DM with "writethru" parameter in
virtio-blk, guest OS could not toggle cache mode. When starting DM
with "writeback" parameter in virtio-blk, guest OS could toggle
cache mode.
------------------------------
DM cmdline | toggle support
------------+-----------------
writeback | yes
writethru | no
------------------------------
2. To toggle cache mode, run below command in guest OS:
echo "write back" > /sys/devices/xxx/vdx/cache_type
OR
echo "write through" > /sys/devices/xxx/vdx/cache_type
Signed-off-by: Conghui Chen <conghui.chen@intel.com>
Reviewed-by: Shuo Liu <shuo.a.liu@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
This commit is contained in:
@@ -951,3 +951,29 @@ blockif_candelete(struct blockif_ctxt *bc)
|
||||
assert(bc->magic == BLOCKIF_SIG);
|
||||
return bc->candelete;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
blockif_get_wce(struct blockif_ctxt *bc)
|
||||
{
|
||||
assert(bc->magic == BLOCKIF_SIG);
|
||||
return bc->wce;
|
||||
}
|
||||
|
||||
void
|
||||
blockif_set_wce(struct blockif_ctxt *bc, uint8_t wce)
|
||||
{
|
||||
assert(bc->magic == BLOCKIF_SIG);
|
||||
bc->wce = wce;
|
||||
}
|
||||
|
||||
int
|
||||
blockif_flush_all(struct blockif_ctxt *bc)
|
||||
{
|
||||
int err;
|
||||
|
||||
err=0;
|
||||
assert(bc->magic == BLOCKIF_SIG);
|
||||
if (fsync(bc->fd))
|
||||
err = errno;
|
||||
return err;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user