Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp95398imm; Thu, 21 Jun 2018 14:35:54 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIMi1DFa7FrHFuCI0WdcBjkfh5Zt+Kf7qyandzXW2wE+MHotqLj0hA/9hyQwTYQvaYJo0QP X-Received: by 2002:a17:902:9344:: with SMTP id g4-v6mr30292810plp.10.1529616954176; Thu, 21 Jun 2018 14:35:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529616954; cv=none; d=google.com; s=arc-20160816; b=EybrzxafV9M9MK/CmkKW1IypKL5OW0BxaBC0s5iT5HeL+4Z0lkkZxLJ/OtRVfnFa8F ygYctRTPi3UqsPwWHvGpgrXqgiwHR607X1DsQggvjc4J49qU+y4z6GLOr8/oAXyQpWTh uN3FSPVFSq7SKCB+cGsxSa4BlKjZJXuU9iJ0r3Ig+rBmfIMCNiKohM1GHVub+k9pI3RH 03t9MrnyZrmAvOqWNr5ZQctCntqoJGXb/75l+Bau55NNnI1SeOmrWlittZ+2j2LRuzXi mkMoia3rWD/evD1XSYXwJDF/up5OjQIDhoQPUZ5zwAWW6AggVKoeQDZiPUAaaZL21hRk mD/w== 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:dkim-signature:arc-authentication-results; bh=Oc67Ns0UqOibrElXxRnwBGD88abnMwJHxmq49BxxDuY=; b=rJoafKjdeF3Gnze697OIotV5YFs2ufF/qogmZAlDWErj2rostqOPcc62dk81vqzYAy oQnluVgsrDrPzCgv/MaSoTnWm3ekA0gSkKx5R35Y3iOl2dY+AAvbS0h+XVO3ftgS9hr8 n2ipXwjWk3LVBoLSlKQcIDg6Yz3/nqhaRd2+5HdVi2rMOJvmVx0r/CSW94LApgofw5d/ fxyn86+7hulj1U8L6gj8eBk0j0165Sfe/sTkf6saL/p6+a3/eVYc5M9QGvSk+ZB+eDHQ yjD4hBIn96pWtUcObCBSQNE4+ugrZZ8LNwVZ9Wf4ZClbarkp9qb+EX1ELuAO53eIeOLA +Rrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=DhsEveRO; 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 l138-v6si5718449pfd.355.2018.06.21.14.35.39; Thu, 21 Jun 2018 14:35:54 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=DhsEveRO; 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 S933953AbeFUVfI (ORCPT + 99 others); Thu, 21 Jun 2018 17:35:08 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:41736 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933916AbeFUV3G (ORCPT ); Thu, 21 Jun 2018 17:29:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Oc67Ns0UqOibrElXxRnwBGD88abnMwJHxmq49BxxDuY=; b=DhsEveROzIB5k0YbN+7cyrnh5 TIOl1yNPU4f8giWVOUKmlgu4QLB7DqynCbBoT5ACrzOY114reXYajxl7aY18uXKBrU8HFUf0PjXqQ +qj0+V1RiKqDcS32JE8UPyj7wDXZtjRTlxJAc0U24yZHoYzb2sihqSuF+d2p+F9E0N/jkgNO57JM9 GyLyrALTLUNNRKaLR1HZljPWowalsmQUe02kGe1ggQvL6kc6Vu1guBrV1dnIGXNa19kdghIrAZarH AJjUUxyxPosJRw37ok2hprpqy2KlKIzOnpXOpWOAReAMPXyuD2/5ZykhbePwQR0SCmTIiAYn7LXQc yJeaTr3kw==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fW78a-0001ae-O8; Thu, 21 Jun 2018 21:29:04 +0000 From: Matthew Wilcox To: linux-kernel@vger.kernel.org Cc: Matthew Wilcox , Jens Axboe , Johannes Thumshirn , Ming Lei , Sagi Grimberg , Hannes Reinecke , Christophe JAILLET , Christos Gkekas , Bart Van Assche , Joe Perches , linux-block@vger.kernel.org Subject: [PATCH 04/26] mtip32xx: Convert to new IDA API Date: Thu, 21 Jun 2018 14:28:13 -0700 Message-Id: <20180621212835.5636-5-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180621212835.5636-1-willy@infradead.org> References: <20180621212835.5636-1-willy@infradead.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Removes a use of ida_pre_get() and a personalised spinlock. Signed-off-by: Matthew Wilcox --- drivers/block/mtip32xx/mtip32xx.c | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c index c73626decb46..2b6d6bce76df 100644 --- a/drivers/block/mtip32xx/mtip32xx.c +++ b/drivers/block/mtip32xx/mtip32xx.c @@ -118,7 +118,6 @@ static struct dentry *dfs_device_status; static u32 cpu_use[NR_CPUS]; -static DEFINE_SPINLOCK(rssd_index_lock); static DEFINE_IDA(rssd_index_ida); static int mtip_block_initialize(struct driver_data *dd); @@ -3768,20 +3767,10 @@ static int mtip_block_initialize(struct driver_data *dd) goto alloc_disk_error; } - /* Generate the disk name, implemented same as in sd.c */ - do { - if (!ida_pre_get(&rssd_index_ida, GFP_KERNEL)) { - rv = -ENOMEM; - goto ida_get_error; - } - - spin_lock(&rssd_index_lock); - rv = ida_get_new(&rssd_index_ida, &index); - spin_unlock(&rssd_index_lock); - } while (rv == -EAGAIN); - - if (rv) + rv = ida_alloc(&rssd_index_ida, GFP_KERNEL); + if (rv < 0) goto ida_get_error; + index = rv; rv = rssd_disk_name_format("rssd", index, @@ -3923,9 +3912,7 @@ static int mtip_block_initialize(struct driver_data *dd) block_queue_alloc_tag_error: mtip_hw_debugfs_exit(dd); disk_index_error: - spin_lock(&rssd_index_lock); - ida_remove(&rssd_index_ida, index); - spin_unlock(&rssd_index_lock); + ida_free(&rssd_index_ida, index); ida_get_error: put_disk(dd->disk); @@ -4013,9 +4000,7 @@ static int mtip_block_remove(struct driver_data *dd) } dd->disk = NULL; - spin_lock(&rssd_index_lock); - ida_remove(&rssd_index_ida, dd->index); - spin_unlock(&rssd_index_lock); + ida_free(&rssd_index_ida, dd->index); /* De-initialize the protocol layer. */ mtip_hw_exit(dd); @@ -4055,9 +4040,7 @@ static int mtip_block_shutdown(struct driver_data *dd) dd->queue = NULL; } - spin_lock(&rssd_index_lock); - ida_remove(&rssd_index_ida, dd->index); - spin_unlock(&rssd_index_lock); + ida_free(&rssd_index_ida, dd->index); return 0; } -- 2.17.1