mirror of https://github.com/xqemu/xqemu.git
Block layer patches for 2.8.0-rc2
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJYPZu6AAoJEH8JsnLIjy/W1IAP/AwV0sWafsSMnWiz/4NVqeh3 Yk2cBtxCBmnq1y+PilLoZBdHui/RumwVuZKaShs3JA1n5CB1AjsVtEVl/6rQM7lv yymLr32pODuf4eaGwGY09FqTiL0Erlm846zbSDjkiKbTYoKpzRv0PT2iiA6yTnjO Mrs5nG7kEWdXPZ0ZsJyEyU3+vs7rNg+4N/VfTdPmCrV5DVBvAeCawM6JXHQNc7LV ER6Y8W9PAu5mYqwekjAW07lPCudytAsOTrbTTO9Sv/+kZUdKEmv7ZHJrPdECCb6N vcPOYOzKsEvvR8E0YZtuJDK9W4RTakxdlTste+TtW3VSt1Cs0zpvCFytaGuC+Kmq mhlA4lYLDvaiNOMl09SvIjjxGI7+FO+1XsY7e4rI5PJzOKWZMFOIwQMNxE3B2qUI dxd6izf7fzF4V5uDDwHTJ8TAiJDSAe6Bkz+vzipQtu5NARl/isbQuIPIGXPkxZln fkCYA8/7EXrLXqd3khiRqEHS60ZtNgfm4ss8euMlWAgJAz0RLC1d/XhOIxaCQOg3 R/F9UdJAon6mfOgamZs5yzJgaPU6M90g/QipMB3Ub00VODacTiA81QUjZdEgELBB zvhgeja7qdIvOh9r9heCCuUTmkWRRppmkrKdqFLowZ2aWosISy/UjiPTGdjDdq7Z LsfYiRXsW94FmNXdKCqg =3WTz -----END PGP SIGNATURE----- Merge remote-tracking branch 'kwolf/tags/for-upstream' into staging Block layer patches for 2.8.0-rc2 # gpg: Signature made Tue 29 Nov 2016 03:16:10 PM GMT # gpg: using RSA key 0x7F09B272C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" # Primary key fingerprint: DC3D EB15 9A9A F95D 3D74 56FE 7F09 B272 C88F 2FD6 * kwolf/tags/for-upstream: docs: Specify that cache-clean-interval is only supported in Linux qcow2: Remove stale comment qcow2: Allow 'cache-clean-interval' in Linux only qcow2: Make qcow2_cache_table_release() work only in Linux Message-id: 1480436227-2211-1-git-send-email-kwolf@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
commit
f05234df63
|
@ -22,7 +22,6 @@
|
||||||
* THE SOFTWARE.
|
* THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Needed for CONFIG_MADVISE */
|
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "block/block_int.h"
|
#include "block/block_int.h"
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
@ -66,7 +65,8 @@ static inline int qcow2_cache_get_table_idx(BlockDriverState *bs,
|
||||||
static void qcow2_cache_table_release(BlockDriverState *bs, Qcow2Cache *c,
|
static void qcow2_cache_table_release(BlockDriverState *bs, Qcow2Cache *c,
|
||||||
int i, int num_tables)
|
int i, int num_tables)
|
||||||
{
|
{
|
||||||
#if QEMU_MADV_DONTNEED != QEMU_MADV_INVALID
|
/* Using MADV_DONTNEED to discard memory is a Linux-specific feature */
|
||||||
|
#ifdef CONFIG_LINUX
|
||||||
BDRVQcow2State *s = bs->opaque;
|
BDRVQcow2State *s = bs->opaque;
|
||||||
void *t = qcow2_cache_get_table_addr(bs, c, i);
|
void *t = qcow2_cache_get_table_addr(bs, c, i);
|
||||||
int align = getpagesize();
|
int align = getpagesize();
|
||||||
|
@ -74,7 +74,7 @@ static void qcow2_cache_table_release(BlockDriverState *bs, Qcow2Cache *c,
|
||||||
size_t offset = QEMU_ALIGN_UP((uintptr_t) t, align) - (uintptr_t) t;
|
size_t offset = QEMU_ALIGN_UP((uintptr_t) t, align) - (uintptr_t) t;
|
||||||
size_t length = QEMU_ALIGN_DOWN(mem_size - offset, align);
|
size_t length = QEMU_ALIGN_DOWN(mem_size - offset, align);
|
||||||
if (length > 0) {
|
if (length > 0) {
|
||||||
qemu_madvise((uint8_t *) t + offset, length, QEMU_MADV_DONTNEED);
|
madvise((uint8_t *) t + offset, length, MADV_DONTNEED);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -668,6 +668,14 @@ static int qcow2_update_options_prepare(BlockDriverState *bs,
|
||||||
r->cache_clean_interval =
|
r->cache_clean_interval =
|
||||||
qemu_opt_get_number(opts, QCOW2_OPT_CACHE_CLEAN_INTERVAL,
|
qemu_opt_get_number(opts, QCOW2_OPT_CACHE_CLEAN_INTERVAL,
|
||||||
s->cache_clean_interval);
|
s->cache_clean_interval);
|
||||||
|
#ifndef CONFIG_LINUX
|
||||||
|
if (r->cache_clean_interval != 0) {
|
||||||
|
error_setg(errp, QCOW2_OPT_CACHE_CLEAN_INTERVAL
|
||||||
|
" not supported on this host");
|
||||||
|
ret = -EINVAL;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (r->cache_clean_interval > UINT_MAX) {
|
if (r->cache_clean_interval > UINT_MAX) {
|
||||||
error_setg(errp, "Cache clean interval too big");
|
error_setg(errp, "Cache clean interval too big");
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
|
|
@ -160,5 +160,6 @@ If unset, the default value for this parameter is 0 and it disables
|
||||||
this feature.
|
this feature.
|
||||||
|
|
||||||
Note that this functionality currently relies on the MADV_DONTNEED
|
Note that this functionality currently relies on the MADV_DONTNEED
|
||||||
argument for madvise() to actually free the memory, so it is not
|
argument for madvise() to actually free the memory. This is a
|
||||||
useful in systems that don't follow that behavior.
|
Linux-specific feature, so cache-clean-interval is not supported in
|
||||||
|
other systems.
|
||||||
|
|
Loading…
Reference in New Issue