From patchwork Sun Feb 3 01:21:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejun Heo X-Patchwork-Id: 2085361 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 929E040148 for ; Sun, 3 Feb 2013 01:24:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754268Ab3BCBXS (ORCPT ); Sat, 2 Feb 2013 20:23:18 -0500 Received: from mail-da0-f41.google.com ([209.85.210.41]:62063 "EHLO mail-da0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754247Ab3BCBXQ (ORCPT ); Sat, 2 Feb 2013 20:23:16 -0500 Received: by mail-da0-f41.google.com with SMTP id e20so2199341dak.0 for ; Sat, 02 Feb 2013 17:23:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=y/1rMU1vq6u0yCOHqHUzBAgJYP7fyR3fMH70QVfwDjg=; b=PgUyNWMuM9fkCGEABe0GcUGN/pbL7HQ0WGuAAQJjb8PQrDJjfBjWdtbjtBhtvoxTL8 b3rGZE9ttow9qeumXVAfl7LkHHgHs2dzeU4rU1iDpBsnbxqy+VQ7714c0ZfqRZlkKnSt npRu7F5i/p1vGKk1ZDT6qbxKmkxv3SeBpdau9zymxXDLB1HGx13gckP6XX9+9RZxE3vY r1iKiHHBmaRteFM39EUG0XZAsjJSr2+mvWZPsSb3wSR3Dtv5PDlwUokSbjr1bdCcVawq zoV24+93bPf4g6fPsj260fw5Qskm1TgTfoIoUaMJp1ujaLSb8p5A+DT1btJtGGKYsy9S +4Kw== X-Received: by 10.66.83.165 with SMTP id r5mr41499442pay.3.1359854595736; Sat, 02 Feb 2013 17:23:15 -0800 (PST) Received: from htj.dyndns.org (c-69-181-251-227.hsd1.ca.comcast.net. [69.181.251.227]) by mx.google.com with ESMTPS id hs2sm13149467pbc.22.2013.02.02.17.23.14 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 02 Feb 2013 17:23:15 -0800 (PST) From: Tejun Heo To: akpm@linux-foundation.org Cc: linux-kernel@vger.kernel.org, rusty@rustcorp.com.au, bfields@fieldses.org, skinsbursky@parallels.com, ebiederm@xmission.com, jmorris@namei.org, axboe@kernel.dk, Tejun Heo , Trond Myklebust , linux-nfs@vger.kernel.org Subject: [PATCH 61/62] nfs4client: convert to idr_alloc() Date: Sat, 2 Feb 2013 17:21:02 -0800 Message-Id: <1359854463-2538-62-git-send-email-tj@kernel.org> X-Mailer: git-send-email 1.8.1 In-Reply-To: <1359854463-2538-1-git-send-email-tj@kernel.org> References: <1359854463-2538-1-git-send-email-tj@kernel.org> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Convert to the much saner new idr interface. Only compile tested. Signed-off-by: Tejun Heo Signed-off-by: Tejun Heo Cc: Trond Myklebust Cc: linux-nfs@vger.kernel.org --- This patch depends on an earlier idr changes and I think it would be best to route these together through -mm. Please holler if there's any objection. Thanks. fs/nfs/nfs4client.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index acc3472..ff314f6 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -29,15 +29,14 @@ static int nfs_get_cb_ident_idr(struct nfs_client *clp, int minorversion) if (clp->rpc_ops->version != 4 || minorversion != 0) return ret; -retry: - if (!idr_pre_get(&nn->cb_ident_idr, GFP_KERNEL)) - return -ENOMEM; + idr_preload(GFP_KERNEL); spin_lock(&nn->nfs_client_lock); - ret = idr_get_new(&nn->cb_ident_idr, clp, &clp->cl_cb_ident); + ret = idr_alloc(&nn->cb_ident_idr, clp, 0, 0, GFP_NOWAIT); + if (ret >= 0) + clp->cl_cb_ident = ret; spin_unlock(&nn->nfs_client_lock); - if (ret == -EAGAIN) - goto retry; - return ret; + idr_preload_end(); + return ret < 0 ? ret : 0; } #ifdef CONFIG_NFS_V4_1