From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Fam Zheng" <fam@euphon.net>, "Kevin Wolf" <kwolf@redhat.com>,
qemu-block@nongnu.org, "Max Reitz" <mreitz@redhat.com>,
"Hanna Reitz" <hreitz@redhat.com>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>
Subject: [PATCH 4/5] block/nvme: Pass BDRVNVMeState* handle to nvme_free_queue_pair()
Date: Wed, 6 Oct 2021 18:49:30 +0200 [thread overview]
Message-ID: <20211006164931.172349-5-philmd@redhat.com> (raw)
In-Reply-To: <20211006164931.172349-1-philmd@redhat.com>
In the next commit we want to access BDRVNVMeState from
nvme_free_queue_pair() callee. Pass it along first.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
block/nvme.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/block/nvme.c b/block/nvme.c
index e4f336d79c2..6e476f54b9f 100644
--- a/block/nvme.c
+++ b/block/nvme.c
@@ -183,19 +183,19 @@ static bool nvme_init_queue(BDRVNVMeState *s, NVMeQueue *q,
return r == 0;
}
-static void nvme_free_queue(NVMeQueue *q)
+static void nvme_free_queue(BDRVNVMeState *s, NVMeQueue *q)
{
qemu_vfree(q->queue);
}
-static void nvme_free_queue_pair(NVMeQueuePair *q)
+static void nvme_free_queue_pair(BDRVNVMeState *s, NVMeQueuePair *q)
{
trace_nvme_free_queue_pair(q->index, q, &q->cq, &q->sq);
if (q->completion_bh) {
qemu_bh_delete(q->completion_bh);
}
- nvme_free_queue(&q->sq);
- nvme_free_queue(&q->cq);
+ nvme_free_queue(s, &q->sq);
+ nvme_free_queue(s, &q->cq);
qemu_vfree(q->prp_list_pages);
qemu_mutex_destroy(&q->lock);
g_free(q);
@@ -270,7 +270,7 @@ static NVMeQueuePair *nvme_create_queue_pair(BDRVNVMeState *s,
return q;
fail:
- nvme_free_queue_pair(q);
+ nvme_free_queue_pair(s, q);
return NULL;
}
@@ -693,7 +693,7 @@ static bool nvme_add_io_queue(BlockDriverState *bs, Error **errp)
s->queue_count++;
return true;
out_error:
- nvme_free_queue_pair(q);
+ nvme_free_queue_pair(s, q);
return false;
}
@@ -918,7 +918,7 @@ static void nvme_close(BlockDriverState *bs)
BDRVNVMeState *s = bs->opaque;
for (unsigned i = 0; i < s->queue_count; ++i) {
- nvme_free_queue_pair(s->queues[i]);
+ nvme_free_queue_pair(s, s->queues[i]);
}
g_free(s->queues);
aio_set_event_notifier(bdrv_get_aio_context(bs),
--
2.31.1
next prev parent reply other threads:[~2021-10-06 16:59 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-06 16:49 [PATCH 0/5] block/nvme: Fix a memory leak in nvme_free_queue_pair() Philippe Mathieu-Daudé
2021-10-06 16:49 ` [PATCH 1/5] block/nvme: Automatically free qemu_memalign() with QEMU_AUTO_VFREE Philippe Mathieu-Daudé
2021-10-07 13:29 ` Stefan Hajnoczi
2021-10-06 16:49 ` [PATCH 2/5] block/nvme: Display CQ/SQ pointer in nvme_free_queue_pair() Philippe Mathieu-Daudé
2021-10-07 13:29 ` Stefan Hajnoczi
2021-10-06 16:49 ` [PATCH 3/5] block/nvme: Extract nvme_free_queue() from nvme_free_queue_pair() Philippe Mathieu-Daudé
2021-10-07 13:29 ` Stefan Hajnoczi
2021-10-06 16:49 ` Philippe Mathieu-Daudé [this message]
2021-10-07 13:30 ` [PATCH 4/5] block/nvme: Pass BDRVNVMeState* handle to nvme_free_queue_pair() Stefan Hajnoczi
2021-10-06 16:49 ` [PATCH 5/5] block/nvme: Fix memory leak from nvme_init_queue() Philippe Mathieu-Daudé
2021-10-06 16:58 ` Philippe Mathieu-Daudé
2021-10-07 13:29 ` Stefan Hajnoczi
2021-10-07 13:34 ` Philippe Mathieu-Daudé
2021-11-02 12:33 ` Kevin Wolf
2021-11-02 12:36 ` Philippe Mathieu-Daudé
2021-11-02 14:50 ` Kevin Wolf
2021-11-02 15:17 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211006164931.172349-5-philmd@redhat.com \
--to=philmd@redhat.com \
--cc=fam@euphon.net \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).