[PATCH 07/13] Fix get_empty_slot()
From: Nadia . Derbey
Date: Fri Apr 11 2008 - 12:22:23 EST
[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@xxxxxxxx>
---
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)
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/