Revision 0aa217e4
b/block.h | ||
---|---|---|
37 | 37 |
bdrv_file_open()) */ |
38 | 38 |
#define BDRV_O_NOCACHE 0x0020 /* do not use the host page cache */ |
39 | 39 |
#define BDRV_O_CACHE_WB 0x0040 /* use write-back caching */ |
40 |
#define BDRV_O_CACHE_DEF 0x0080 /* use default caching */ |
|
41 | 40 |
|
42 |
#define BDRV_O_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_CACHE_WB | BDRV_O_CACHE_DEF)
|
|
41 |
#define BDRV_O_CACHE_MASK (BDRV_O_NOCACHE | BDRV_O_CACHE_WB) |
|
43 | 42 |
|
44 | 43 |
void bdrv_info(Monitor *mon); |
45 | 44 |
void bdrv_info_stats(Monitor *mon); |
b/block/qcow2.c | ||
---|---|---|
145 | 145 |
QCowHeader header; |
146 | 146 |
uint64_t ext_end; |
147 | 147 |
|
148 |
/* Performance is terrible right now with cache=writethrough due mainly |
|
149 |
* to reference count updates. If the user does not explicitly specify |
|
150 |
* a caching type, force to writeback caching. |
|
151 |
*/ |
|
152 |
if ((flags & BDRV_O_CACHE_DEF)) { |
|
153 |
flags |= BDRV_O_CACHE_WB; |
|
154 |
flags &= ~BDRV_O_CACHE_DEF; |
|
155 |
} |
|
156 | 148 |
ret = bdrv_file_open(&s->hd, filename, flags); |
157 | 149 |
if (ret < 0) |
158 | 150 |
return ret; |
b/qemu-options.hx | ||
---|---|---|
148 | 148 |
|
149 | 149 |
Some block drivers perform badly with @option{cache=writethrough}, most notably, |
150 | 150 |
qcow2. If performance is more important than correctness, |
151 |
@option{cache=writeback} should be used with qcow2. By default, if no explicit |
|
152 |
caching is specified for a qcow2 disk image, @option{cache=writeback} will be |
|
153 |
used. For all other disk types, @option{cache=writethrough} is the default. |
|
151 |
@option{cache=writeback} should be used with qcow2. |
|
154 | 152 |
|
155 | 153 |
Instead of @option{-cdrom} you can use: |
156 | 154 |
@example |
b/vl.c | ||
---|---|---|
2239 | 2239 |
unit_id = -1; |
2240 | 2240 |
translation = BIOS_ATA_TRANSLATION_AUTO; |
2241 | 2241 |
index = -1; |
2242 |
cache = 3;
|
|
2242 |
cache = 1;
|
|
2243 | 2243 |
|
2244 | 2244 |
if (machine->use_scsi) { |
2245 | 2245 |
type = IF_SCSI; |
... | ... | |
2557 | 2557 |
bdrv_flags |= BDRV_O_NOCACHE; |
2558 | 2558 |
else if (cache == 2) /* write-back */ |
2559 | 2559 |
bdrv_flags |= BDRV_O_CACHE_WB; |
2560 |
else if (cache == 3) /* not specified */ |
|
2561 |
bdrv_flags |= BDRV_O_CACHE_DEF; |
|
2562 | 2560 |
if (bdrv_open2(bdrv, file, bdrv_flags, drv) < 0) { |
2563 | 2561 |
fprintf(stderr, "qemu: could not open disk image %s\n", |
2564 | 2562 |
file); |
Also available in: Unified diff