qemu-kvmde 磁盘cache参数
qemu-kvmde 磁盘cache的参数有一下五种,在建立虚拟机的过程中 通过下面的函数设定int bdrv_parse_cache_mode(const char *mode, int *flags, bool *writethrough){*flags &= ~BDRV_O_CACHE_MASK;if (!strcmp(mode, "off") || !strcmp
·
qemu-kvmde 磁盘cache的参数有一下五种,在建立虚拟机的过程中 通过下面的函数设定
int bdrv_parse_cache_mode(const char *mode, int *flags, bool *writethrough)
{
*flags &= ~BDRV_O_CACHE_MASK;
if (!strcmp(mode, "off") || !strcmp(mode, "none")) {
*writethrough = false;
*flags |= BDRV_O_NOCACHE;
} else if (!strcmp(mode, "directsync")) {
*writethrough = true;
*flags |= BDRV_O_NOCACHE;
} else if (!strcmp(mode, "writeback")) {
*writethrough = false;
} else if (!strcmp(mode, "unsafe")) {
*writethrough = false;
*flags |= BDRV_O_NO_FLUSH;
} else if (!strcmp(mode, "writethrough")) {
*writethrough = true;
} else {
return -1;
}
return 0;
}
这五种的详细解释如下:其中默认是writeback
https://www.suse.com/documentation/sles11/book_kvm/data/sect1_1_chapter_book_kvm.html
更多推荐
已为社区贡献14条内容
所有评论(0)