From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: [PATCH v2.1 06/15] tmem: cleanup: remove unneed parameter from pgp_free() Date: Wed, 9 Apr 2014 09:26:10 -0400 Message-ID: <1397049979-3479-7-git-send-email-konrad.wilk@oracle.com> References: <1397049979-3479-1-git-send-email-konrad.wilk@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WXsWM-0000si-DX for xen-devel@lists.xenproject.org; Wed, 09 Apr 2014 13:26:30 +0000 In-Reply-To: <1397049979-3479-1-git-send-email-konrad.wilk@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org, jbeulich@suse.com Cc: Bob Liu , Konrad Rzeszutek Wilk List-Id: xen-devel@lists.xenproject.org From: Bob Liu The only difference of the "from_delete" parameter in pgp_free() is one line ASSERT(), this patch moves it the caller to make code more clean. Signed-off-by: Bob Liu Signed-off-by: Konrad Rzeszutek Wilk --- xen/common/tmem.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/xen/common/tmem.c b/xen/common/tmem.c index 47728b9..96d616d 100644 --- a/xen/common/tmem.c +++ b/xen/common/tmem.c @@ -654,15 +654,14 @@ static void pgp_free_data(struct tmem_page_descriptor *pgp, struct tmem_pool *po pgp->size = -1; } -static void pgp_free(struct tmem_page_descriptor *pgp, int from_delete) +static void pgp_free(struct tmem_page_descriptor *pgp) { struct tmem_pool *pool = NULL; ASSERT(pgp->us.obj != NULL); - ASSERT(pgp->us.obj->pool->client != NULL); - if ( from_delete ) - ASSERT(pgp_lookup_in_obj(pgp->us.obj,pgp->index) == NULL); ASSERT(pgp->us.obj->pool != NULL); + ASSERT(pgp->us.obj->pool->client != NULL); + pool = pgp->us.obj->pool; if ( !is_persistent(pool) ) { @@ -743,7 +742,8 @@ static void pgp_delete(struct tmem_page_descriptor *pgp) life = get_cycles() - pgp->timestamp; pgp->us.obj->pool->sum_life_cycles += life; pgp_delist(pgp); - pgp_free(pgp,1); + ASSERT(pgp_lookup_in_obj(pgp->us.obj,pgp->index) == NULL); + pgp_free(pgp); } /* called only indirectly by radix_tree_destroy */ @@ -756,7 +756,7 @@ static void pgp_destroy(void *v) ASSERT(pgp->us.obj != NULL); pgp->us.obj->pgp_count--; ASSERT(pgp->us.obj->pgp_count >= 0); - pgp_free(pgp,0); + pgp_free(pgp); } static int pgp_add_to_obj(struct tmem_object_root *obj, uint32_t index, struct tmem_page_descriptor *pgp) @@ -1354,7 +1354,7 @@ found: } /* pgp already delist, so call pgp_free directly */ - pgp_free(pgp, 1); + pgp_free(pgp); if ( obj->pgp_count == 0 ) { ASSERT_WRITELOCK(&pool->pool_rwlock); -- 1.8.5.3