Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1739071
| From | Christoph Hellwig <hch@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/4] idr: Add a function idr_get() |
| Date | 2017-09-25 15:50 +0200 |
| Message-ID | <utBVL-735-9@gated-at.bofh.it> (permalink) |
| References | <utB9n-6tv-9@gated-at.bofh.it> <utB9o-6tv-19@gated-at.bofh.it> <utBCq-6Vt-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Sep 25, 2017 at 09:20:07AM -0400, Rik van Riel wrote:
> > +++ b/lib/idr.c
> > @@ -135,6 +135,17 @@ void *idr_get_next_ext(struct idr *idr, unsigned
> > long *nextid)
> > }
> > EXPORT_SYMBOL(idr_get_next_ext);
> >
> > +void * idr_get(struct idr *idr, int *id)
> > +{
> > + struct radix_tree_node *node;
> > + void __rcu **slot = NULL;
> > +
> > + __radix_tree_lookup(&idr->idr_rt, *id, &node, &slot);
> > + if (!slot)
> > + return NULL;
> > + return node;
> > +}
>
> I should have noticed this (much) earlier, but doesn't idr_get do
> essentially the same thing as idr_find?
>
> Also, wouldn't you want to return the pid pointer from slot,
> rather than a pointer to the entire radix tree node?
It also seems rather odd to pass id by reference here just to
dereference it a little later.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 2/4] idr: Add a function idr_get() Gargi Sharma <gs051095@gmail.com> - 2017-09-25 15:00 +0200
Re: [PATCH 2/4] idr: Add a function idr_get() Rik van Riel <riel@surriel.com> - 2017-09-25 15:30 +0200
Re: [PATCH 2/4] idr: Add a function idr_get() Christoph Hellwig <hch@infradead.org> - 2017-09-25 15:50 +0200
Re: [PATCH 2/4] idr: Add a function idr_get() Oleg Nesterov <oleg@redhat.com> - 2017-09-25 16:20 +0200
Re: [PATCH 2/4] idr: Add a function idr_get() Gargi Sharma <gs051095@gmail.com> - 2017-09-25 19:50 +0200
csiph-web