All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Houston <jim.houston@comcast.net>
To: Andrew Morton <akpm@osdl.org>
Cc: kevcorry@us.ibm.com, linux-kernel@vger.kernel.org,
	dm-devel@redhat.com, torvalds@osdl.org, agk@redhat.com
Subject: Re: [PATCH] 1/1: Device-Mapper: Remove 1024 devices limitation
Date: 06 Jul 2004 19:00:45 -0400	[thread overview]
Message-ID: <1089154845.985.164.camel@new.localdomain> (raw)
In-Reply-To: <20040706152817.38ce1151.akpm@osdl.org>

On Tue, 2004-07-06 at 18:28, Andrew Morton wrote:
> Jim Houston <jim.houston@comcast.net> wrote:
> >
> > On Tue, 2004-07-06 at 17:23, Andrew Morton wrote:
> > > Kevin Corry <kevcorry@us.ibm.com> wrote:
> > > >
> > > > After talking with Alasdair a bit, there might be one bug in the "dm-use-idr"
> > > > patch I submitted before. It seems (based on some comments in lib/idr.c) that
> > > > the idr_find() routine might not return NULL if the desired ID value is not
> > > > in the tree.
> > > 
> > > 
> > > Confused.  idr_find() returns the thing it found, or NULL.  To which
> > > comments do you refer?
> > 
> > Hi Andrew, Kevin,
> > 
> > Kevin is correct.  It's more of the nonsense related to having a counter
> > in the upper bits of the id.  If you call idr_find with an id that is
> > beyond the currently allocated space it ignores the upper bits and
> > returns one of the entries that is in the allocated space.  This
> > aliasing is most annoying.
> 
> erk, OK, we have vestigial bits still.  Note that MAX_ID_SHIFT is now 31 on
> 32-bit, so we're still waggling the top bit.
> 
> > I'm attaching an untested patch which removes the counter in the upper
> > bits of the id and makes idr_find return NULL if the requested id is
> > beyond the allocated space.
> 
> Would you have time to get it tested please?
> 
> >  I suspect that there are problems with
> > id values which are less than zero.
> 
> Me too.  I'd only be confident in the 0..2G range.
> 
> 
> > -#endif
> > +	if (id >= (1 << n))
> > +		return NULL;
> >  	while (n > 0 && p) {
> >  		n -= IDR_BITS;
> >  		p = p->ary[(id >> n) & IDR_MASK];
> > 
> 
> I think the above test is unneeded?

Hi Everyone,

With out the test above an id beyond the allocated space will alias
to one that exists.  Perhaps the highest id currently allocated is 
100, there will be two layers in the radix tree and the while loop
above will only look at the 10 least significant bits.  If you call
idr_find with 1025 it will return the pointer associated with id 1.

The patch I sent was against linux-2.6.7, so I missed the change to
MAX_ID_SHIFT.

Jim Houston - Concurrent Computer Corp.


  reply	other threads:[~2004-07-06 23:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-01 15:35 [PATCH] 1/1: Device-Mapper: Remove 1024 devices limitation Kevin Corry
2004-07-01 21:38 ` Andrew Morton
2004-07-02  2:54   ` Kevin Corry
2004-07-02  3:30     ` Andrew Morton
2004-07-02 17:33       ` Kevin Corry
2004-07-02 19:42         ` Andrew Morton
2004-07-06 18:23           ` Kevin Corry
2004-07-06 21:23             ` Andrew Morton
2004-07-06 21:35               ` Alasdair G Kergon
2004-07-06 22:04                 ` Alasdair G Kergon
2004-07-06 22:20                 ` Andrew Morton
2004-07-06 22:07               ` Jim Houston
2004-07-06 22:28                 ` Andrew Morton
2004-07-06 23:00                   ` Jim Houston [this message]
2004-07-06 23:16                     ` Andrew Morton
2004-07-07 10:58                       ` Jim Houston
2004-07-07 11:10                         ` Andrew Morton
2004-07-12 14:49                           ` Kevin Corry
2004-07-12 18:14                             ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1089154845.985.164.camel@new.localdomain \
    --to=jim.houston@comcast.net \
    --cc=agk@redhat.com \
    --cc=akpm@osdl.org \
    --cc=dm-devel@redhat.com \
    --cc=kevcorry@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.