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 07/13] Fix get_empty_slot()
[PATCH 07/13]

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

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

---
lib/ridr.c | 9 +++------
1 file changed, 3 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:51:34.000000000 +0200
+++ linux-2.6.25-rc8-mm1/lib/ridr.c 2008-04-11 17:55:37.000000000 +0200
@@ -198,7 +198,6 @@ static int ridr_get_empty_slot(struct ri
{
struct ridr_layer *p, *new;
int layers, v, id;
- unsigned long flags;

id = starting_id;
build_up:
@@ -224,23 +223,21 @@ build_up:
* The allocation failed. If we built part of
* the structure tear it down.
*/
- spin_lock_irqsave(&idp->lock, flags);
for (new = p; p && p != idp->top; new = p) {
p = p->ary[0];
new->ary[0] = NULL;
new->bitmap = new->count = 0;
free_layer(new);
}
- spin_unlock_irqrestore(&idp->lock, flags);
return -1;
}
- new->ary[0] = p;
+ rcu_assign_pointer(new->ary[0], p);
new->count = 1;
if (p->bitmap == IDR_FULL)
__set_bit(0, &new->bitmap);
- p = new;
+ rcu_assign_pointer(p, new);
}
- idp->top = p;
+ rcu_assign_pointer(idp->top, p);
idp->layers = layers;
v = sub_alloc(idp, &id, pa);
if (v == -2)
--


\
 
 \ /
  Last update: 2008-04-11 18:29    [from the cache]
©2003-2011 Jasper Spaans