From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org ([198.137.202.133]:41154 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726457AbeGKM4i (ORCPT ); Wed, 11 Jul 2018 08:56:38 -0400 Date: Wed, 11 Jul 2018 05:52:19 -0700 From: Matthew Wilcox To: Dominique Martinet 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: <20180711125219.GA23640@bombadil.infradead.org> References: <20180628132629.3148-1-willy@infradead.org> <20180628132629.3148-3-willy@infradead.org> <20180711124038.GB835@nautica> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180711124038.GB835@nautica> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, Jul 11, 2018 at 02:40:38PM +0200, Dominique Martinet wrote: > 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) > > - ret = p9_idpool_get(clnt->fidpool); > > - if (ret < 0) > > - goto error; > > - fid->fid = ret; > > - ... > > + 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 Happy to fix that. It shouldn't actually happen, of course. I can't imagine us having 4 billion FIDs in use at once. > 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. I don't understand your assertion that this is a change of behaviour. The implementation of p9_idpool_get() uses idr_alloc(), not idr_alloc_cyclic(), so I don't believe I've changed which FID would be allocated.