| 1101 | #define CACHE_NEG_PROMOTION_THRESH 2 |
| 1102 | |
| 1103 | static bool |
| 1104 | cache_neg_hit_prep(struct namecache *ncp) |
| 1105 | { |
| 1106 | struct negstate *ns; |
| 1107 | u_char n; |
| 1108 | |
| 1109 | ns = NCP2NEGSTATE(ncp); |
| 1110 | n = atomic_load_char(&ns->neg_hit); |
| 1111 | for (;;) { |
| 1112 | if (n >= CACHE_NEG_PROMOTION_THRESH) |
| 1113 | return (false); |
| 1114 | if (atomic_fcmpset_8(&ns->neg_hit, &n, n + 1)) |
| 1115 | break; |
| 1116 | } |
| 1117 | return (n + 1 == CACHE_NEG_PROMOTION_THRESH); |
| 1118 | } |
| 1119 | |
| 1120 | /* |
| 1121 | * Nothing to do here but it is provided for completeness as some |
no test coverage detected