hw/block/nvme: flush write cache when disabled
If the write cache is disabled with a Set Features command, flush it if currently enabled. Signed-off-by: Klaus Jensen <k.jensen@samsung.com> Reviewed-by: Dmitry Fomichev <dmitry.fomichev@wdc.com> Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Message-Id: <20200706061303.246057-11-its@irrelevant.dk>
This commit is contained in:
parent
46ac29c38b
commit
d21d37f5ab
@ -1181,6 +1181,10 @@ static uint16_t nvme_set_feature(NvmeCtrl *n, NvmeCmd *cmd, NvmeRequest *req)
|
||||
|
||||
break;
|
||||
case NVME_VOLATILE_WRITE_CACHE:
|
||||
if (!(dw11 & 0x1) && blk_enable_write_cache(n->conf.blk)) {
|
||||
blk_flush(n->conf.blk);
|
||||
}
|
||||
|
||||
blk_set_enable_write_cache(n->conf.blk, dw11 & 1);
|
||||
break;
|
||||
case NVME_NUMBER_OF_QUEUES:
|
||||
|
Loading…
Reference in New Issue
Block a user