Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp651779imm; Wed, 11 Jul 2018 08:41:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpel4AEn+ROgiF9aPCGYOvmbshjB/FrXFlDd4Le9tJwxg1G6ZIs+Hqv+7ZzoZ5YRqBAU2xrM X-Received: by 2002:a63:231a:: with SMTP id j26-v6mr26854482pgj.138.1531323713953; Wed, 11 Jul 2018 08:41:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531323713; cv=none; d=google.com; s=arc-20160816; b=iD6bk5hnd/JcaaoaWFKSSSEVqXpjO0unJG9aGhlUAYwA+UAiRLtWEGBpJPTLhgiKVI 4csarz+zIbtzWBzS1OmeDUnY0YGk6m5FXa0MStatAcmNp1+JW66/SmLVHm7fbYUHZrxi YouVovNrTLwbPcU75bg5xjbD24ggo5RdASoCx5hQp16xBmAQDuqn2YUFjh3yTOAIlsS7 XJVxbgbxt3FF7agJILARpwLzK9sg9ANTWTEBZ3dKNBxHvmmYLHGnBeuKKENcpttPJ1OH i2Ux2bQNV6dUGccGggTHZZDPysYUBWM6Bm79C3wIpr4rQ1xUiO5ixFpMWhvgEQ4pcJQJ r/mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=BqW8wz76nARXkOCNkLVFP/AUbwloyME8A3QZ3DzrJxc=; b=q953p7UjiOkqJ1akG4SD4QvRWX2kms2deB5zr20edgHODEaFUqXmp2Kzfm0MQN5Evh KJpSCzcCsuK+/trM1kxc3JXOjySJtfilU7SuUlPV0n1PIsAHYjvapzunkCJqqsyxq2cD ff1Osautlj41ZCpBxSksN2UMSX8ZMH6Abj0XCzqS6xOulcdR3xG0ZAHBxFRnpL3hx4A6 xb66tBC/On80e63hSo8+o3dUI8kHtv+i1/dFfLShwRDsCPB0CiPFTNfjsquPT95ZmYIC LAwjy1aWiMz5Zig2yCRa1R2mnKcHObzIBuWaVIElHwXR3BFjBabZEkWE7ZX6VozOl2cs Zscg== 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 r7-v6si9832161pgn.491.2018.07.11.08.41.38; Wed, 11 Jul 2018 08:41:53 -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 S1726751AbeGKMpE (ORCPT + 99 others); Wed, 11 Jul 2018 08:45:04 -0400 Received: from nautica.notk.org ([91.121.71.147]:41120 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbeGKMpE (ORCPT ); Wed, 11 Jul 2018 08:45:04 -0400 Received: by nautica.notk.org (Postfix, from userid 1001) id EB7E8C009; Wed, 11 Jul 2018 14:40:53 +0200 (CEST) Date: Wed, 11 Jul 2018 14:40:38 +0200 From: Dominique Martinet To: Matthew Wilcox Cc: v9fs-developer@lists.sourceforge.net, Latchesar Ionkov , Eric Van Hensbergen , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Ron Minnich Subject: Re: [V9fs-developer] [PATCH 2/6] 9p: Replace the fidlist with an IDR Message-ID: <20180711124038.GB835@nautica> References: <20180628132629.3148-1-willy@infradead.org> <20180628132629.3148-3-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180628132629.3148-3-willy@infradead.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Matthew Wilcox wrote on Thu, Jun 28, 2018: > diff --git a/net/9p/client.c b/net/9p/client.c > index f8d58b0852fe..bbab82f22c20 100644 > --- a/net/9p/client.c > +++ b/net/9p/client.c > @@ -908,30 +908,27 @@ static struct p9_fid *p9_fid_create(struct p9_client *clnt) > { > int ret; > struct p9_fid *fid; > - unsigned long flags; > > p9_debug(P9_DEBUG_FID, "clnt %p\n", clnt); > fid = kmalloc(sizeof(struct p9_fid), GFP_KERNEL); > if (!fid) > return NULL; > > - ret = p9_idpool_get(clnt->fidpool); > - if (ret < 0) > - goto error; > - fid->fid = ret; > - > memset(&fid->qid, 0, sizeof(struct p9_qid)); > fid->mode = -1; > fid->uid = current_fsuid(); > fid->clnt = clnt; > fid->rdir = NULL; > - spin_lock_irqsave(&clnt->lock, flags); > - list_add(&fid->flist, &clnt->fidlist); > - spin_unlock_irqrestore(&clnt->lock, flags); > > - return fid; > + idr_preload(GFP_KERNEL); > + spin_lock_irq(&clnt->lock); > + ret = idr_alloc_u32(&clnt->fids, fid, &fid->fid, UINT_MAX, GFP_NOWAIT); There's also a P9_NOFID that we shouldn't use, so the max here should be P9_NOFID - 1 That aside this introduces a change of behaviour that fid used to be alloc'd linearily from 0 which no longer holds true, that breaks one serveur (nfs-ganesha just returns ERANGE) but others seem to handle this just fine so they'll just need to fix that server. max aside this looks good. -- Dominique Martinet