Commit 1b2f309d70daf04b6a97b3753e375654532f6207

Authored by Herbert Xu
Committed by David S. Miller
1 parent 1f501d6252

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>

Showing 2 changed files with 10 additions and 0 deletions Side-by-side Diff

include/linux/rhashtable.h
... ... @@ -65,7 +65,9 @@
65 65 size_t new_size);
66 66 bool (*shrink_decision)(const struct rhashtable *ht,
67 67 size_t new_size);
  68 +#ifdef CONFIG_PROVE_LOCKING
68 69 int (*mutex_is_held)(void);
  70 +#endif
69 71 };
70 72  
71 73 /**
... ... @@ -532,7 +532,9 @@
532 532 * .key_offset = offsetof(struct test_obj, key),
533 533 * .key_len = sizeof(int),
534 534 * .hashfn = arch_fast_hash,
  535 + * #ifdef CONFIG_PROVE_LOCKING
535 536 * .mutex_is_held = &my_mutex_is_held,
  537 + * #endif
536 538 * };
537 539 *
538 540 * Configuration Example 2: Variable length keys
539 541  
... ... @@ -552,7 +554,9 @@
552 554 * .head_offset = offsetof(struct test_obj, node),
553 555 * .hashfn = arch_fast_hash,
554 556 * .obj_hashfn = my_hash_fn,
  557 + * #ifdef CONFIG_PROVE_LOCKING
555 558 * .mutex_is_held = &my_mutex_is_held,
  559 + * #endif
556 560 * };
557 561 */
558 562 int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params)
559 563  
... ... @@ -613,10 +617,12 @@
613 617 #define TEST_PTR ((void *) 0xdeadbeef)
614 618 #define TEST_NEXPANDS 4
615 619  
  620 +#ifdef CONFIG_PROVE_LOCKING
616 621 static int test_mutex_is_held(void)
617 622 {
618 623 return 1;
619 624 }
  625 +#endif
620 626  
621 627 struct test_obj {
622 628 void *ptr;
623 629  
... ... @@ -767,7 +773,9 @@
767 773 .key_offset = offsetof(struct test_obj, value),
768 774 .key_len = sizeof(int),
769 775 .hashfn = arch_fast_hash,
  776 +#ifdef CONFIG_PROVE_LOCKING
770 777 .mutex_is_held = &test_mutex_is_held,
  778 +#endif
771 779 .grow_decision = rht_grow_above_75,
772 780 .shrink_decision = rht_shrink_below_30,
773 781 };