| Submitter | Kevin Wolf |
|---|---|
| Date | Sept. 24, 2012, 2:26 p.m. |
| Message ID | <1348496808-8159-4-git-send-email-kwolf@redhat.com> |
| Download | mbox | patch |
| Permalink | /patch/186431/ |
| State | New |
| Headers | show |
Comments
Patch
diff --git a/block.c b/block.c index 4c0e7f5..458bcc9 100644 --- a/block.c +++ b/block.c @@ -2168,6 +2168,13 @@ int bdrv_enable_write_cache(BlockDriverState *bs) void bdrv_set_enable_write_cache(BlockDriverState *bs, bool wce) { bs->enable_write_cache = wce; + + /* so a reopen() will preserve wce */ + if (wce) { + bs->open_flags |= BDRV_O_CACHE_WB; + } else { + bs->open_flags &= ~BDRV_O_CACHE_WB; + } } int bdrv_is_encrypted(BlockDriverState *bs)