diff mbox

[v2] rfifolock: no need to get thread identifier when nesting

Message ID 1462874348-32396-1-git-send-email-xiecl.fnst@cn.fujitsu.com (mailing list archive)
State New, archived
Headers show

Commit Message

Changlong Xie May 10, 2016, 9:59 a.m. UTC
Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
---
 util/rfifolock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Denis V. Lunev May 10, 2016, 10:25 a.m. UTC | #1
On 05/10/2016 12:59 PM, Changlong Xie wrote:
> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
> ---
>   util/rfifolock.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/util/rfifolock.c b/util/rfifolock.c
> index c22f5fe..084c2f0 100644
> --- a/util/rfifolock.c
> +++ b/util/rfifolock.c
> @@ -58,9 +58,9 @@ void rfifolock_lock(RFifoLock *r)
>               }
>               qemu_cond_wait(&r->cond, &r->lock);
>           }
> +        qemu_thread_get_self(&r->owner_thread);
>       }
>   
> -    qemu_thread_get_self(&r->owner_thread);
>       r->nesting++;
>       qemu_mutex_unlock(&r->lock);
>   }
Reviewed-by: Denis V. Lunev <den@openvz.org>
Stefan Hajnoczi May 12, 2016, 9:42 a.m. UTC | #2
On Tue, May 10, 2016 at 05:59:08PM +0800, Changlong Xie wrote:
> Signed-off-by: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
> ---
>  util/rfifolock.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan
diff mbox

Patch

diff --git a/util/rfifolock.c b/util/rfifolock.c
index c22f5fe..084c2f0 100644
--- a/util/rfifolock.c
+++ b/util/rfifolock.c
@@ -58,9 +58,9 @@  void rfifolock_lock(RFifoLock *r)
             }
             qemu_cond_wait(&r->cond, &r->lock);
         }
+        qemu_thread_get_self(&r->owner_thread);
     }
 
-    qemu_thread_get_self(&r->owner_thread);
     r->nesting++;
     qemu_mutex_unlock(&r->lock);
 }