aboutsummaryrefslogtreecommitdiff
path: root/datapath/table.c
diff options
context:
space:
mode:
authorJesse Gross <jesse@nicira.com>2010-12-04 11:50:53 -0800
committerJesse Gross <jesse@nicira.com>2010-12-13 13:40:13 -0800
commite1040c772fbebc3abe9e7222f9c540112c4dca81 (patch)
treed5e014048d1656b1843599f2e62afc8b9b13920a /datapath/table.c
parentd3097efff7c612e25cbbcf4913c703a73b57e523 (diff)
datapath: Add usage of __rcu annotation.
Sparse can warn about incorrect usage of RCU via direct access to points when used in conjuction with __rcu and CONFIG_SPARSE_RCU. This adds the necessary annotations. Signed-off-by: Jesse Gross <jesse@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'datapath/table.c')
-rw-r--r--datapath/table.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/datapath/table.c b/datapath/table.c
index c6614e13..28063085 100644
--- a/datapath/table.c
+++ b/datapath/table.c
@@ -161,7 +161,7 @@ void tbl_deferred_destroy(struct tbl *table, void (*destructor)(struct tbl_node
call_rcu(&table->rcu, destroy_table_rcu);
}
-static struct tbl_bucket **find_bucket(struct tbl *table, u32 hash)
+static struct tbl_bucket __rcu **find_bucket(struct tbl *table, u32 hash)
{
unsigned int l1 = (hash & (table->n_buckets - 1)) >> TBL_L1_SHIFT;
unsigned int l2 = hash & ((1 << TBL_L2_BITS) - 1);
@@ -197,7 +197,7 @@ static int search_bucket(const struct tbl_bucket *bucket, void *target, u32 hash
struct tbl_node *tbl_lookup(struct tbl *table, void *target, u32 hash,
int (*cmp)(const struct tbl_node *, void *))
{
- struct tbl_bucket **bucketp = find_bucket(table, hash);
+ struct tbl_bucket __rcu **bucketp = find_bucket(table, hash);
struct tbl_bucket *bucket = rcu_dereference(*bucketp);
int index;
@@ -230,7 +230,7 @@ int tbl_foreach(struct tbl *table,
{
unsigned int i, j, k;
for (i = 0; i < table->n_buckets >> TBL_L1_BITS; i++) {
- struct tbl_bucket **l2 = table->buckets[i];
+ struct tbl_bucket __rcu **l2 = table->buckets[i];
for (j = 0; j < TBL_L1_SIZE; j++) {
struct tbl_bucket *bucket = rcu_dereference(l2[j]);
if (!bucket)
@@ -318,7 +318,7 @@ static void free_bucket_rcu(struct rcu_head *rcu)
*/
int tbl_insert(struct tbl *table, struct tbl_node *target, u32 hash)
{
- struct tbl_bucket **oldp = find_bucket(table, hash);
+ struct tbl_bucket __rcu **oldp = find_bucket(table, hash);
struct tbl_bucket *old = rcu_dereference(*oldp);
unsigned int n = old ? old->n_objs : 0;
struct tbl_bucket *new = bucket_alloc(n + 1);
@@ -356,7 +356,7 @@ int tbl_insert(struct tbl *table, struct tbl_node *target, u32 hash)
*/
int tbl_remove(struct tbl *table, struct tbl_node *target)
{
- struct tbl_bucket **oldp = find_bucket(table, target->hash);
+ struct tbl_bucket __rcu **oldp = find_bucket(table, target->hash);
struct tbl_bucket *old = rcu_dereference(*oldp);
unsigned int n = old->n_objs;
struct tbl_bucket *new;