Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp891784imm; Wed, 8 Aug 2018 07:28:44 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzon8iw1fu+uM0bREai0wi0QR08+yinUZdBGxT1x4TSsGAoIjx/wXCL77EDlKzW4PcFNrEK X-Received: by 2002:a62:c90a:: with SMTP id k10-v6mr3183282pfg.180.1533738524199; Wed, 08 Aug 2018 07:28:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533738524; cv=none; d=google.com; s=arc-20160816; b=nfHcluCtvZcJE4NdU6R5LMHTyMDncG4DMWjHMzR3s2+JacmEh/pR0FBHyMEvHar3z5 tYt8nmP1T56QwAP4BLhLhwUpBUMfHDbjmAC6TrKxwLxYQ66IfZZSyvEkLrHPiC487qKF Lqx0csF4lrJEL3O2R/576FMF/maNVqX1FAKnfiwbCk3eF84YKfGHai81fk8YE6S1WQt2 Aq7huJroCi7ezwFAfrDSIfnMUWtddqKizoDYYn0W5t7WbvBMJx6a0gnsev22JpCl8XdN lAvDOVhVHvyfIvMi1qCpgDWXKRDOEI0JpZwycCsJ1OrBO+Zrqd+jH2+MehxGQI2U1iZJ ddew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=msWwEdvEIe7FFhQQyVlJJi+cMxN9EOzPB5m2NARuKqU=; b=oBQn/eBZvYsUPZeMTg1NCqhPvusGTdBczx5LQSx9+AlmfZT1fhmEnX1G+VIoRAFCsZ nfblNh9uzBrr33XhUpsiOj+DB8FGM1ZrlSu906R3zoX8VkAqsQhl8b9FEXNTtfifHLoJ 5085xuO1Jv2yB3MW8ad2x7+DboFlKCwrsX92LYuJFWulwjljLXPCMdzRzyfc2pnWts5V vYxIlDbJup1GMyDXzVfhS598fpOznRjQUOLy4/A5eMkUlzBkomrX5rR1LGtVyu4IBMSs GX/tB5+Dk4R3aI3c18ZhviQu2rWmAEO5zF4cMLI21ZqseMN3eq0RnPjHthlYLq4WNV5N TL5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7-v6si4485931pfe.291.2018.08.08.07.28.29; Wed, 08 Aug 2018 07:28:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727628AbeHHQqB (ORCPT + 99 others); Wed, 8 Aug 2018 12:46:01 -0400 Received: from mx2.suse.de ([195.135.220.15]:55202 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727361AbeHHQpl (ORCPT ); Wed, 8 Aug 2018 12:45:41 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 1AC50AECD; Wed, 8 Aug 2018 14:25:46 +0000 (UTC) From: Juergen Gross To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, linux-block@vger.kernel.org Cc: konrad.wilk@oracle.com, roger.pau@citrix.com, axboe@kernel.dk, boris.ostrovsky@oracle.com, Juergen Gross Subject: [PATCH v2 4/5] xen/blkback: move persistent grants flags to bool Date: Wed, 8 Aug 2018 16:25:27 +0200 Message-Id: <20180808142528.31029-5-jgross@suse.com> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20180808142528.31029-1-jgross@suse.com> References: <20180808142528.31029-1-jgross@suse.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The struct persistent_gnt flags member is meant to be a bitfield of different flags. There is only PERSISTENT_GNT_ACTIVE flag left, so convert it to a bool named "active". Signed-off-by: Juergen Gross --- drivers/block/xen-blkback/blkback.c | 13 ++++++------- drivers/block/xen-blkback/common.h | 7 +------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c index f341ac84b853..2483931a3e01 100644 --- a/drivers/block/xen-blkback/blkback.c +++ b/drivers/block/xen-blkback/blkback.c @@ -255,8 +255,7 @@ static int add_persistent_gnt(struct xen_blkif_ring *ring, } } - bitmap_zero(persistent_gnt->flags, PERSISTENT_GNT_FLAGS_SIZE); - set_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt->flags); + persistent_gnt->active = true; /* Add new node and rebalance tree. */ rb_link_node(&(persistent_gnt->node), parent, new); rb_insert_color(&(persistent_gnt->node), &ring->persistent_gnts); @@ -280,11 +279,11 @@ static struct persistent_gnt *get_persistent_gnt(struct xen_blkif_ring *ring, else if (gref > data->gnt) node = node->rb_right; else { - if(test_bit(PERSISTENT_GNT_ACTIVE, data->flags)) { + if (data->active) { pr_alert_ratelimited("requesting a grant already in use\n"); return NULL; } - set_bit(PERSISTENT_GNT_ACTIVE, data->flags); + data->active = true; atomic_inc(&ring->persistent_gnt_in_use); return data; } @@ -295,10 +294,10 @@ static struct persistent_gnt *get_persistent_gnt(struct xen_blkif_ring *ring, static void put_persistent_gnt(struct xen_blkif_ring *ring, struct persistent_gnt *persistent_gnt) { - if(!test_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt->flags)) + if (!persistent_gnt->active) pr_alert_ratelimited("freeing a grant already unused\n"); persistent_gnt->last_used = jiffies; - clear_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt->flags); + persistent_gnt->active = false; atomic_dec(&ring->persistent_gnt_in_use); } @@ -429,7 +428,7 @@ static void purge_persistent_gnt(struct xen_blkif_ring *ring) BUG_ON(persistent_gnt->handle == BLKBACK_INVALID_HANDLE); - if (test_bit(PERSISTENT_GNT_ACTIVE, persistent_gnt->flags)) + if (persistent_gnt->active) continue; if (!scan_used && !persistent_gnt_timeout(persistent_gnt)) continue; diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h index 7bff72db3b7e..2339b8d39c5e 100644 --- a/drivers/block/xen-blkback/common.h +++ b/drivers/block/xen-blkback/common.h @@ -233,11 +233,6 @@ struct xen_vbd { struct backend_info; -/* Number of available flags */ -#define PERSISTENT_GNT_FLAGS_SIZE 1 -/* This persistent grant is currently in use */ -#define PERSISTENT_GNT_ACTIVE 0 - /* Number of requests that we can fit in a ring */ #define XEN_BLKIF_REQS_PER_PAGE 32 @@ -246,7 +241,7 @@ struct persistent_gnt { grant_ref_t gnt; grant_handle_t handle; unsigned long last_used; - DECLARE_BITMAP(flags, PERSISTENT_GNT_FLAGS_SIZE); + bool active; struct rb_node node; struct list_head remove_node; }; -- 2.13.7