* [Qemu-devel] [PATCH] dma-helpers: avoid calling dma_bdrv_unmap() twice
@ 2014-05-23 3:44 Jules Wang
2014-05-23 8:23 ` Paolo Bonzini
2014-05-23 20:32 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
0 siblings, 2 replies; 3+ messages in thread
From: Jules Wang @ 2014-05-23 3:44 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, pbonzini, Jules Wang
Calling dma_bdrv_unmap() twice is not necessary and may cause
potential problems if some code changes.
Signed-off-by: Jules Wang <junqing.wang@cs2c.com.cn>
---
dma-helpers.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dma-helpers.c b/dma-helpers.c
index 5f421e9..53cbe92 100644
--- a/dma-helpers.c
+++ b/dma-helpers.c
@@ -143,12 +143,12 @@ static void dma_bdrv_cb(void *opaque, int ret)
dbs->acb = NULL;
dbs->sector_num += dbs->iov.size / 512;
- dma_bdrv_unmap(dbs);
if (dbs->sg_cur_index == dbs->sg->nsg || ret < 0) {
dma_complete(dbs, ret);
return;
}
+ dma_bdrv_unmap(dbs);
while (dbs->sg_cur_index < dbs->sg->nsg) {
cur_addr = dbs->sg->sg[dbs->sg_cur_index].base + dbs->sg_cur_byte;
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] dma-helpers: avoid calling dma_bdrv_unmap() twice
2014-05-23 3:44 [Qemu-devel] [PATCH] dma-helpers: avoid calling dma_bdrv_unmap() twice Jules Wang
@ 2014-05-23 8:23 ` Paolo Bonzini
2014-05-23 20:32 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2014-05-23 8:23 UTC (permalink / raw)
To: Jules Wang, qemu-devel; +Cc: qemu-trivial
Il 23/05/2014 05:44, Jules Wang ha scritto:
> Calling dma_bdrv_unmap() twice is not necessary and may cause
> potential problems if some code changes.
>
> Signed-off-by: Jules Wang <junqing.wang@cs2c.com.cn>
> ---
> dma-helpers.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/dma-helpers.c b/dma-helpers.c
> index 5f421e9..53cbe92 100644
> --- a/dma-helpers.c
> +++ b/dma-helpers.c
> @@ -143,12 +143,12 @@ static void dma_bdrv_cb(void *opaque, int ret)
>
> dbs->acb = NULL;
> dbs->sector_num += dbs->iov.size / 512;
> - dma_bdrv_unmap(dbs);
>
> if (dbs->sg_cur_index == dbs->sg->nsg || ret < 0) {
> dma_complete(dbs, ret);
> return;
> }
> + dma_bdrv_unmap(dbs);
>
> while (dbs->sg_cur_index < dbs->sg->nsg) {
> cur_addr = dbs->sg->sg[dbs->sg_cur_index].base + dbs->sg_cur_byte;
>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [Qemu-trivial] [PATCH] dma-helpers: avoid calling dma_bdrv_unmap() twice
2014-05-23 3:44 [Qemu-devel] [PATCH] dma-helpers: avoid calling dma_bdrv_unmap() twice Jules Wang
2014-05-23 8:23 ` Paolo Bonzini
@ 2014-05-23 20:32 ` Michael Tokarev
1 sibling, 0 replies; 3+ messages in thread
From: Michael Tokarev @ 2014-05-23 20:32 UTC (permalink / raw)
To: Jules Wang, qemu-devel; +Cc: qemu-trivial, pbonzini
23.05.2014 07:44, Jules Wang wrote:
> Calling dma_bdrv_unmap() twice is not necessary and may cause
> potential problems if some code changes.
>
> Signed-off-by: Jules Wang <junqing.wang@cs2c.com.cn>
> ---
> dma-helpers.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/dma-helpers.c b/dma-helpers.c
> index 5f421e9..53cbe92 100644
> --- a/dma-helpers.c
> +++ b/dma-helpers.c
> @@ -143,12 +143,12 @@ static void dma_bdrv_cb(void *opaque, int ret)
>
> dbs->acb = NULL;
> dbs->sector_num += dbs->iov.size / 512;
> - dma_bdrv_unmap(dbs);
>
> if (dbs->sg_cur_index == dbs->sg->nsg || ret < 0) {
> dma_complete(dbs, ret);
> return;
> }
> + dma_bdrv_unmap(dbs);
>
> while (dbs->sg_cur_index < dbs->sg->nsg) {
> cur_addr = dbs->sg->sg[dbs->sg_cur_index].base + dbs->sg_cur_byte;
Applied to -trivial!
Maybe not-so-trivial, as I had to look at dma_complete() (who calls
dma_bdrv_unmap() ofcourse) to understand what's going on :)
Thank you!
/mjt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-05-23 20:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-23 3:44 [Qemu-devel] [PATCH] dma-helpers: avoid calling dma_bdrv_unmap() twice Jules Wang
2014-05-23 8:23 ` Paolo Bonzini
2014-05-23 20:32 ` [Qemu-devel] [Qemu-trivial] " Michael Tokarev
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).