Message ID | 1446044465-19312-3-git-send-email-den@openvz.org |
---|---|
State | New |
Headers | show |
On Wed, Oct 28, 2015 at 06:01:03PM +0300, Denis V. Lunev wrote: > This helper is necessary to ensure locking constraints. > > Signed-off-by: Denis V. Lunev <den@openvz.org> > CC: Stefan Hajnoczi <stefanha@redhat.com> > CC: Paolo Bonzini <pbonzini@redhat.com> > --- > async.c | 5 +++++ > include/block/aio.h | 3 +++ > 2 files changed, 8 insertions(+) > > diff --git a/async.c b/async.c > index bdc64a3..4a9250e 100644 > --- a/async.c > +++ b/async.c > @@ -361,3 +361,8 @@ void aio_context_release(AioContext *ctx) > { > rfifolock_unlock(&ctx->lock); > } > + > +int aio_context_is_locked(AioContext *ctx) s/int/bool/ The name aio_context_acquired_by_current_thread() would be clearer (but longer) than aio_context_is_locked().
diff --git a/async.c b/async.c index bdc64a3..4a9250e 100644 --- a/async.c +++ b/async.c @@ -361,3 +361,8 @@ void aio_context_release(AioContext *ctx) { rfifolock_unlock(&ctx->lock); } + +int aio_context_is_locked(AioContext *ctx) +{ + return rfifolock_is_locked(&ctx->lock); +} diff --git a/include/block/aio.h b/include/block/aio.h index bcc7d43..d20c7b8 100644 --- a/include/block/aio.h +++ b/include/block/aio.h @@ -166,6 +166,9 @@ void aio_context_acquire(AioContext *ctx); /* Relinquish ownership of the AioContext. */ void aio_context_release(AioContext *ctx); +/* Check that AioContext is locked by the caller. */ +int aio_context_is_locked(AioContext *ctx); + /** * aio_bh_new: Allocate a new bottom half structure. *
This helper is necessary to ensure locking constraints. Signed-off-by: Denis V. Lunev <den@openvz.org> CC: Stefan Hajnoczi <stefanha@redhat.com> CC: Paolo Bonzini <pbonzini@redhat.com> --- async.c | 5 +++++ include/block/aio.h | 3 +++ 2 files changed, 8 insertions(+)