Page MenuHomeFreeBSD

D60405.1795844286.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D60405.1795844286.diff

diff --git a/sys/ofed/drivers/infiniband/core/ib_rdma_core.c b/sys/ofed/drivers/infiniband/core/ib_rdma_core.c
--- a/sys/ofed/drivers/infiniband/core/ib_rdma_core.c
+++ b/sys/ofed/drivers/infiniband/core/ib_rdma_core.c
@@ -295,13 +295,29 @@
static int idr_add_uobj(struct ib_uobject *uobj)
{
- /*
- * We start with allocating an idr pointing to NULL. This represents an
- * object which isn't initialized yet. We'll replace it later on with
- * the real object once we commit.
- */
- return xa_alloc(&uobj->ufile->idr, &uobj->id, NULL, xa_limit_32b,
- GFP_KERNEL);
+ struct ib_uverbs_file *ufile = uobj->ufile;
+ u32 id, start;
+ int ret;
+
+ xa_lock(&ufile->idr);
+ start = ufile->idr_next;
+ id = start;
+ do {
+ ret = __xa_insert(&ufile->idr, id, NULL, GFP_KERNEL);
+ if (ret != -EEXIST)
+ break;
+ id++;
+ } while (id != start);
+
+ if (!ret) {
+ uobj->id = id;
+ ufile->idr_next = id + 1;
+ } else if (ret == -EEXIST) {
+ ret = -ENOMEM;
+ }
+ xa_unlock(&ufile->idr);
+
+ return ret;
}
/* Returns the ib_uobject or an error. The caller should check for IS_ERR. */
diff --git a/sys/ofed/drivers/infiniband/core/uverbs.h b/sys/ofed/drivers/infiniband/core/uverbs.h
--- a/sys/ofed/drivers/infiniband/core/uverbs.h
+++ b/sys/ofed/drivers/infiniband/core/uverbs.h
@@ -163,6 +163,7 @@
struct list_head umaps;
struct xarray idr;
+ u32 idr_next;
};
struct ib_uverbs_event {

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 28, 5:38 AM (15 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42032557
Default Alt Text
D60405.1795844286.diff (1 KB)

Event Timeline