diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2014-11-13 05:11:20 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-11-13 15:13:05 -0500 |
commit | 1b2f309d70daf04b6a97b3753e375654532f6207 (patch) | |
tree | 1cd88fc0d8891c65264b17f84903b9efa87dd165 /lib/rhashtable.c | |
parent | 1f501d62523f0d5fd152006e16938ee674932c1b (diff) |
rhashtable: Move mutex_is_held under PROVE_LOCKING
The rhashtable function mutex_is_held is only used when PROVE_LOCKING
is enabled. This patch makes the mutex_is_held field in rhashtable
optional depending on PROVE_LOCKING.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib/rhashtable.c')
-rw-r--r-- | lib/rhashtable.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 081be3ba9ea8..c7654b6f5f64 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c | |||
@@ -532,7 +532,9 @@ static size_t rounded_hashtable_size(struct rhashtable_params *params) | |||
532 | * .key_offset = offsetof(struct test_obj, key), | 532 | * .key_offset = offsetof(struct test_obj, key), |
533 | * .key_len = sizeof(int), | 533 | * .key_len = sizeof(int), |
534 | * .hashfn = arch_fast_hash, | 534 | * .hashfn = arch_fast_hash, |
535 | * #ifdef CONFIG_PROVE_LOCKING | ||
535 | * .mutex_is_held = &my_mutex_is_held, | 536 | * .mutex_is_held = &my_mutex_is_held, |
537 | * #endif | ||
536 | * }; | 538 | * }; |
537 | * | 539 | * |
538 | * Configuration Example 2: Variable length keys | 540 | * Configuration Example 2: Variable length keys |
@@ -552,7 +554,9 @@ static size_t rounded_hashtable_size(struct rhashtable_params *params) | |||
552 | * .head_offset = offsetof(struct test_obj, node), | 554 | * .head_offset = offsetof(struct test_obj, node), |
553 | * .hashfn = arch_fast_hash, | 555 | * .hashfn = arch_fast_hash, |
554 | * .obj_hashfn = my_hash_fn, | 556 | * .obj_hashfn = my_hash_fn, |
557 | * #ifdef CONFIG_PROVE_LOCKING | ||
555 | * .mutex_is_held = &my_mutex_is_held, | 558 | * .mutex_is_held = &my_mutex_is_held, |
559 | * #endif | ||
556 | * }; | 560 | * }; |
557 | */ | 561 | */ |
558 | int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params) | 562 | int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params) |
@@ -613,10 +617,12 @@ EXPORT_SYMBOL_GPL(rhashtable_destroy); | |||
613 | #define TEST_PTR ((void *) 0xdeadbeef) | 617 | #define TEST_PTR ((void *) 0xdeadbeef) |
614 | #define TEST_NEXPANDS 4 | 618 | #define TEST_NEXPANDS 4 |
615 | 619 | ||
620 | #ifdef CONFIG_PROVE_LOCKING | ||
616 | static int test_mutex_is_held(void) | 621 | static int test_mutex_is_held(void) |
617 | { | 622 | { |
618 | return 1; | 623 | return 1; |
619 | } | 624 | } |
625 | #endif | ||
620 | 626 | ||
621 | struct test_obj { | 627 | struct test_obj { |
622 | void *ptr; | 628 | void *ptr; |
@@ -767,7 +773,9 @@ static int __init test_rht_init(void) | |||
767 | .key_offset = offsetof(struct test_obj, value), | 773 | .key_offset = offsetof(struct test_obj, value), |
768 | .key_len = sizeof(int), | 774 | .key_len = sizeof(int), |
769 | .hashfn = arch_fast_hash, | 775 | .hashfn = arch_fast_hash, |
776 | #ifdef CONFIG_PROVE_LOCKING | ||
770 | .mutex_is_held = &test_mutex_is_held, | 777 | .mutex_is_held = &test_mutex_is_held, |
778 | #endif | ||
771 | .grow_decision = rht_grow_above_75, | 779 | .grow_decision = rht_grow_above_75, |
772 | .shrink_decision = rht_shrink_below_30, | 780 | .shrink_decision = rht_shrink_below_30, |
773 | }; | 781 | }; |