lkml.org 
[lkml]   [2008]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 06/13] Fix sub_alloc()
[PATCH 06/13]

This patch only fixes the sub_alloc() portion of ridr.c, to make it RCU based.

Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net>

---
lib/ridr.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

Index: linux-2.6.25-rc8-mm1/lib/ridr.c
===================================================================
--- linux-2.6.25-rc8-mm1.orig/lib/ridr.c 2008-04-11 17:47:48.000000000 +0200
+++ linux-2.6.25-rc8-mm1/lib/ridr.c 2008-04-11 17:51:34.000000000 +0200
@@ -135,9 +135,9 @@ static int sub_alloc(struct ridr *idp, i

id = *starting_id;
restart:
- p = idp->top;
+ rcu_assign_pointer(p, idp->top);
l = idp->layers;
- pa[l--] = NULL;
+ rcu_assign_pointer(pa[l--], NULL);
while (1) {
/*
* We run around this while until we reach the leaf node...
@@ -152,7 +152,7 @@ static int sub_alloc(struct ridr *idp, i
id = (id | ((1 << (IDR_BITS * l)) - 1)) + 1;

/* if already at the top layer, we need to grow */
- p = pa[l];
+ rcu_assign_pointer(p, pa[l]);
if (!p) {
*starting_id = id;
return -2;
@@ -182,14 +182,14 @@ static int sub_alloc(struct ridr *idp, i
new = alloc_layer(idp);
if (!new)
return -1;
- p->ary[m] = new;
+ rcu_assign_pointer(p->ary[m], new);
p->count++;
}
- pa[l--] = p;
+ rcu_assign_pointer(pa[l--], p);
p = p->ary[m];
}

- pa[l] = p;
+ rcu_assign_pointer(pa[l], p);
return id;
}

--


\
 
 \ /
  Last update: 2008-04-11 18:29    [W:0.122 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site