diff options
Diffstat (limited to 'lib/ratelimit.c')
-rw-r--r-- | lib/ratelimit.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/ratelimit.c b/lib/ratelimit.c index 09f5ce1810dc..027a03f4c56d 100644 --- a/lib/ratelimit.c +++ b/lib/ratelimit.c | |||
@@ -16,9 +16,14 @@ | |||
16 | /* | 16 | /* |
17 | * __ratelimit - rate limiting | 17 | * __ratelimit - rate limiting |
18 | * @rs: ratelimit_state data | 18 | * @rs: ratelimit_state data |
19 | * @func: name of calling function | ||
19 | * | 20 | * |
20 | * This enforces a rate limit: not more than @rs->ratelimit_burst callbacks | 21 | * This enforces a rate limit: not more than @rs->burst callbacks |
21 | * in every @rs->ratelimit_jiffies | 22 | * in every @rs->interval |
23 | * | ||
24 | * RETURNS: | ||
25 | * 0 means callbacks will be suppressed. | ||
26 | * 1 means go ahead and do it. | ||
22 | */ | 27 | */ |
23 | int ___ratelimit(struct ratelimit_state *rs, const char *func) | 28 | int ___ratelimit(struct ratelimit_state *rs, const char *func) |
24 | { | 29 | { |
@@ -35,7 +40,7 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func) | |||
35 | * the entity that is holding the lock already: | 40 | * the entity that is holding the lock already: |
36 | */ | 41 | */ |
37 | if (!spin_trylock_irqsave(&rs->lock, flags)) | 42 | if (!spin_trylock_irqsave(&rs->lock, flags)) |
38 | return 1; | 43 | return 0; |
39 | 44 | ||
40 | if (!rs->begin) | 45 | if (!rs->begin) |
41 | rs->begin = jiffies; | 46 | rs->begin = jiffies; |