[NETFILTER] Kill lockhelp.h for connrate ------------------------------------------------------------------------------ ip_conntrack_rate.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-) ------------------------------------------------------------------------------ Index: patchlets/connrate/linux/net/ipv4/netfilter/ip_conntrack_rate.c =================================================================== --- patchlets/connrate/linux/net/ipv4/netfilter/ip_conntrack_rate.c (révision 4244) +++ patchlets/connrate/linux/net/ipv4/netfilter/ip_conntrack_rate.c (copie de travail) @@ -13,7 +13,6 @@ #include #include #include -#include /* I wanted to build a simpler and more robust rate estimator than the @@ -96,7 +95,7 @@ #define MAX_TOKENS_IN_WINDOW (0xffffffff - MAX_PACKET_IN_TOKENS) /* Synchronizes all accesses to ip_conntrack_rate structures. */ -static DECLARE_RWLOCK(rate_lock); +static rwlock_t rate_lock = RW_LOCK_UNLOCKED; void ip_conntrack_rate_count(struct ip_conntrack_rate *ctr, unsigned int len) @@ -104,7 +103,7 @@ u_int32_t new_bytes; unsigned long now = jiffies; - WRITE_LOCK(&rate_lock); + write_lock_bh(&rate_lock); new_bytes = (ctr->avgrate * IP_CONNTRACK_RATE_INTERVAL + len * IP_CONNTRACK_RATE_SCALE); if(new_bytes > MAX_TOKENS_IN_WINDOW) @@ -113,7 +112,7 @@ ctr->avgrate = new_bytes / (now - ctr->prev + IP_CONNTRACK_RATE_INTERVAL); ctr->prev = now; - WRITE_UNLOCK(&rate_lock); + write_unlock_bh(&rate_lock); } u_int32_t @@ -121,12 +120,12 @@ { u_int32_t rate; - READ_LOCK(&rate_lock); + read_lock_bh(&rate_lock); /* Rate can not overflow here if IP_CONNTRACK_RATE_INTERVAL is atleast HZ. If it is not, we could change the order of calculations at the possible cost of precision. */ rate = ctr->avgrate * HZ / IP_CONNTRACK_RATE_SCALE; - READ_UNLOCK(&rate_lock); + read_unlock_bh(&rate_lock); return rate; }