Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp94118imm; Thu, 21 Jun 2018 14:34:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK8HiNwrez3RfRjJvmCcqC1WgstWOxRr/pA2csM+EuJ75OdQafiRrXuTWerBGIs+LFhAr/z X-Received: by 2002:a62:f407:: with SMTP id r7-v6mr28835874pff.47.1529616856760; Thu, 21 Jun 2018 14:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529616856; cv=none; d=google.com; s=arc-20160816; b=mA76nbwNdsHe04yl/2VJA/BaX8R5lYRuznLWELoc6Te0lT0svvU486BuehJk3qJQTr kMLOGL0d2iTKa891A9hNffHAv8pblvAUBfITVzQt22kM55GoNBQbsaeenrsSFNlIGSuF aiM6ECLMnloGU9r4obTZTmlRyt9bYVkBVXtjKu6HtFvaatE0iai9dEBCkG+Rd2ar2+DC ux3NJzMwWzys7ztT+5jPTvim1LXdpEj6gEdjIs1hFAQpNE8yX4frPgv1+R+MJO2R2Fda yJRaHwrN8y2TBb2w8CTbWC1VD6Qju8iPfsVsmgrTiVYLutCTM8+3ziJ3qlhrZCR186s1 gXig== 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=UZLX8SnVbDLAC15aGgIwzkKSoZoL4gXIz1I11KZy8AM=; b=HiYbonVPvb206y/Jy6G/w6df4mhole/fXpY9y0pHAykVrmYjLSq/uGWR5VyPndwUYV E6wMzJzYiAsCs9pKKOq+3OkmKD/JC6kORSTHCwjAJ83+ArszOxQjzazjaMm8UgJ8ysBn H4buCJ7pJOciUJV1v3Dau9uB9HttGLQd3gea8VisOKF4OdtOIDsb2WUgQSCvgNwIU6sq T1aHZcDXZN3di4DTLkoumPPxwJkwD1bg0jCkocGzqu995loZt2NQ42B9ELFSFCIQzRQz 4K29OZZPgi0ty/RD22JkwWDwlKurNWQ/g4kGBPeRPQQLMg6UYLJlE9Ps9qNyFVQKCt7X WCLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Bjfgqofq; 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 k18-v6si5889037pll.404.2018.06.21.14.34.01; Thu, 21 Jun 2018 14:34:16 -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=Bjfgqofq; 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 S934132AbeFUVdA (ORCPT + 99 others); Thu, 21 Jun 2018 17:33:00 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:41786 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933958AbeFUV3K (ORCPT ); Thu, 21 Jun 2018 17:29:10 -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=UZLX8SnVbDLAC15aGgIwzkKSoZoL4gXIz1I11KZy8AM=; b=BjfgqofqlGN+JfjEa1scQDk0a aFn9oPxJEe+69O2SJK2X0cQ8gdUpmZ3TvTrwbSHkZsyWZBfiYTBxj5tAc0Kpkin5+LeQ/qgFrGnZX roiyTV2KiIur4Ioob4BSJuA61XeAvqB4Mi4JC0o5waZuzQnz2XfQHS8m7caTwakzravVxr6mNoSi0 OlWbstveMTJ4HiI6B+mNjM6hHmNIQdwy7BDOy44sHukGBPs0lm97T0g/r0RyxoVUmAjep1vw17YLt QJHpWfTk7dHViXLNldhs14eaRCXPe3dl2td6vyegpdECGgSCrOIq//wjBrMW1p0MYvpDABbOSbVA5 niwl/Uwow==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fW78f-0001bl-27; Thu, 21 Jun 2018 21:29:09 +0000 From: Matthew Wilcox To: linux-kernel@vger.kernel.org Cc: Matthew Wilcox , "David S. Miller" , Kirill Tkhai , Andrei Vagin , "Eric W. Biederman" , Eric Dumazet , Florian Westphal , netdev@vger.kernel.org Subject: [PATCH 12/26] Convert net_namespace to new IDA API Date: Thu, 21 Jun 2018 14:28:21 -0700 Message-Id: <20180621212835.5636-13-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 Signed-off-by: Matthew Wilcox --- net/core/net_namespace.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index a11e03f920d3..f447cebdcea3 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -973,22 +973,18 @@ static int register_pernet_operations(struct list_head *list, int error; if (ops->id) { -again: - error = ida_get_new_above(&net_generic_ids, MIN_PERNET_OPS_ID, ops->id); - if (error < 0) { - if (error == -EAGAIN) { - ida_pre_get(&net_generic_ids, GFP_KERNEL); - goto again; - } + error = ida_alloc_min(&net_generic_ids, MIN_PERNET_OPS_ID, + GFP_KERNEL); + if (error < 0) return error; - } + *ops->id = error; max_gen_ptrs = max(max_gen_ptrs, *ops->id + 1); } error = __register_pernet_operations(list, ops); if (error) { rcu_barrier(); if (ops->id) - ida_remove(&net_generic_ids, *ops->id); + ida_free(&net_generic_ids, *ops->id); } return error; @@ -999,7 +995,7 @@ static void unregister_pernet_operations(struct pernet_operations *ops) __unregister_pernet_operations(ops); rcu_barrier(); if (ops->id) - ida_remove(&net_generic_ids, *ops->id); + ida_free(&net_generic_ids, *ops->id); } /** -- 2.17.1