From: Jeff Layton <jlayton@redhat.com>
To: akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, tj@kernel.org,
Jack Morgenstein <jackm@dev.mellanox.co.il>,
Or Gerlitz <ogerlitz@mellanox.com>,
Roland Dreier <roland@purestorage.com>,
linux-rdma@vger.kernel.org
Subject: [PATCH v2 3/6] mlx4: convert to using idr_alloc_cyclic
Date: Wed, 27 Mar 2013 15:29:35 -0400 [thread overview]
Message-ID: <1364412578-7462-4-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1364412578-7462-1-git-send-email-jlayton@redhat.com>
(Note: compile tested only)
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Jack Morgenstein <jackm@dev.mellanox.co.il>
Cc: Or Gerlitz <ogerlitz@mellanox.com>
Cc: Roland Dreier <roland@purestorage.com>
Cc: linux-rdma@vger.kernel.org
---
drivers/infiniband/hw/mlx4/cm.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/mlx4/cm.c b/drivers/infiniband/hw/mlx4/cm.c
index add98d0..d1f5f1d 100644
--- a/drivers/infiniband/hw/mlx4/cm.c
+++ b/drivers/infiniband/hw/mlx4/cm.c
@@ -204,7 +204,6 @@ static struct id_map_entry *
id_map_alloc(struct ib_device *ibdev, int slave_id, u32 sl_cm_id)
{
int ret;
- static int next_id;
struct id_map_entry *ent;
struct mlx4_ib_sriov *sriov = &to_mdev(ibdev)->sriov;
@@ -223,9 +222,8 @@ id_map_alloc(struct ib_device *ibdev, int slave_id, u32 sl_cm_id)
idr_preload(GFP_KERNEL);
spin_lock(&to_mdev(ibdev)->sriov.id_map_lock);
- ret = idr_alloc(&sriov->pv_id_table, ent, next_id, 0, GFP_NOWAIT);
+ ret = idr_alloc_cyclic(&sriov->pv_id_table, ent, 0, 0, GFP_NOWAIT);
if (ret >= 0) {
- next_id = max(ret + 1, 0);
ent->pv_cm_id = (u32)ret;
sl_id_map_add(ibdev, ent);
list_add_tail(&ent->list, &sriov->cm_list);
--
1.7.11.7
next prev parent reply other threads:[~2013-03-27 19:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-27 19:29 [PATCH v2 0/6] idr: add idr_alloc_cyclic and convert existing cyclic users Jeff Layton
2013-03-27 19:29 ` [PATCH v2 1/6] idr: introduce idr_alloc_cyclic Jeff Layton
2013-03-27 19:29 ` [PATCH v2 2/6] amso1100: convert to using idr_alloc_cyclic Jeff Layton
2013-03-27 19:35 ` Tejun Heo
2013-03-27 19:29 ` Jeff Layton [this message]
2013-03-27 19:29 ` [PATCH v2 4/6] nfsd: convert nfs4_alloc_stid to use idr_alloc_cyclic Jeff Layton
2013-04-03 19:24 ` J. Bruce Fields
2013-03-27 19:29 ` [PATCH v2 5/6] inotify: convert inotify_add_to_idr " Jeff Layton
2013-03-27 19:29 ` [PATCH v2 6/6] sctp: convert sctp_assoc_set_id " Jeff Layton
2013-03-28 13:53 ` Neil Horman
2013-03-28 14:04 ` Neil Horman
2013-03-31 10:23 ` Jeff Layton
2013-03-27 19:38 ` [PATCH v2 0/6] idr: add idr_alloc_cyclic and convert existing cyclic users Tejun Heo
2013-03-27 19:50 ` Andrew Morton
2013-03-27 19:58 ` Jeff Layton
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=1364412578-7462-4-git-send-email-jlayton@redhat.com \
--to=jlayton@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=jackm@dev.mellanox.co.il \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=ogerlitz@mellanox.com \
--cc=roland@purestorage.com \
--cc=tj@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®