Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 192600
b: refs/heads/master
c: 9990b6f
h: refs/heads/master
v: v3
  • Loading branch information
Akinobu Mita authored and Jeff Garzik committed May 14, 2010
1 parent 99595c8 commit e4d87dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b48d58f55aa1d2d0d12378e45663842d4021916e
refs/heads/master: 9990b6f32b5d35e76b4c2a0dd9469f96350c4d9d
19 changes: 3 additions & 16 deletions trunk/drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#include <linux/libata.h>
#include <asm/byteorder.h>
#include <linux/cdrom.h>
#include <linux/ratelimit.h>

#include "libata.h"

Expand Down Expand Up @@ -6706,25 +6707,11 @@ static void __exit ata_exit(void)
subsys_initcall(ata_init);
module_exit(ata_exit);

static unsigned long ratelimit_time;
static DEFINE_SPINLOCK(ata_ratelimit_lock);
static DEFINE_RATELIMIT_STATE(ratelimit, HZ / 5, 1);

int ata_ratelimit(void)
{
int rc;
unsigned long flags;

spin_lock_irqsave(&ata_ratelimit_lock, flags);

if (time_after(jiffies, ratelimit_time)) {
rc = 1;
ratelimit_time = jiffies + (HZ/5);
} else
rc = 0;

spin_unlock_irqrestore(&ata_ratelimit_lock, flags);

return rc;
return __ratelimit(&ratelimit);
}

/**
Expand Down

0 comments on commit e4d87dc

Please sign in to comment.