Created
November 28, 2013 12:26
-
-
Save bivald/7691087 to your computer and use it in GitHub Desktop.
Updated version of http://lists.nongnu.org/archive/html/qemu-devel/2012-12/msg03677.html patch to fix xen 4.1 qemu memory leak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- /home/niklas/xen/xen-unpatched/xen/tools/ioemu-remote/hw/xen_disk.c 2013-11-28 13:22:15.000000000 +0100 | |
+++ /home/niklas/xen/xen/tools/ioemu-remote/hw/xen_disk.c 2013-11-27 11:59:23.000000000 +0100 | |
@@ -116,6 +116,31 @@ | |
/* ------------------------------------------------------------- */ | |
+static void ioreq_reset(struct ioreq *ioreq) | |
+{ | |
+ memset(&ioreq->req, 0, sizeof(ioreq->req)); | |
+ ioreq->status = 0; | |
+ ioreq->start = 0; | |
+ ioreq->presync = 0; | |
+ ioreq->postsync = 0; | |
+ /*ioreq->mapped = 0;*/ | |
+ | |
+ memset(ioreq->domids, 0, sizeof(ioreq->domids)); | |
+ memset(ioreq->refs, 0, sizeof(ioreq->refs)); | |
+ ioreq->prot = 0; | |
+ memset(ioreq->page, 0, sizeof(ioreq->page)); | |
+ ioreq->pages = NULL; | |
+ | |
+ ioreq->aio_inflight = 0; | |
+ ioreq->aio_errors = 0; | |
+ | |
+ ioreq->blkdev = NULL; | |
+ memset(&ioreq->list, 0, sizeof(ioreq->list)); | |
+ /*memset(&ioreq->acct, 0, sizeof(ioreq->acct));*/ | |
+ | |
+ qemu_iovec_reset(&ioreq->v); | |
+} | |
+ | |
static struct ioreq *ioreq_start(struct XenBlkDev *blkdev) | |
{ | |
struct ioreq *ioreq = NULL; | |
@@ -127,7 +152,7 @@ | |
ioreq = qemu_mallocz(sizeof(*ioreq)); | |
ioreq->blkdev = blkdev; | |
blkdev->requests_total++; | |
- qemu_iovec_init(&ioreq->v, BLKIF_MAX_SEGMENTS_PER_REQUEST); | |
+ /* qemu_iovec_init(&ioreq->v, BLKIF_MAX_SEGMENTS_PER_REQUEST); */ | |
} else { | |
/* get one from freelist */ | |
ioreq = LIST_FIRST(&blkdev->freelist); | |
@@ -156,7 +181,8 @@ | |
struct XenBlkDev *blkdev = ioreq->blkdev; | |
LIST_REMOVE(ioreq, list); | |
- memset(ioreq, 0, sizeof(*ioreq)); | |
+ /*memset(ioreq, 0, sizeof(*ioreq)); */ | |
+ ioreq_reset(ioreq); | |
ioreq->blkdev = blkdev; | |
LIST_INSERT_HEAD(&blkdev->freelist, ioreq, list); | |
blkdev->requests_finished--; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment