diff options
Diffstat (limited to 'net/unix/garbage.c')
| -rw-r--r-- | net/unix/garbage.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 406b6433e467..ebdff3d877a1 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
| @@ -92,7 +92,7 @@ static LIST_HEAD(gc_inflight_list); | |||
| 92 | static LIST_HEAD(gc_candidates); | 92 | static LIST_HEAD(gc_candidates); |
| 93 | static DEFINE_SPINLOCK(unix_gc_lock); | 93 | static DEFINE_SPINLOCK(unix_gc_lock); |
| 94 | 94 | ||
| 95 | atomic_t unix_tot_inflight = ATOMIC_INIT(0); | 95 | unsigned int unix_tot_inflight; |
| 96 | 96 | ||
| 97 | 97 | ||
| 98 | static struct sock *unix_get_socket(struct file *filp) | 98 | static struct sock *unix_get_socket(struct file *filp) |
| @@ -133,7 +133,7 @@ void unix_inflight(struct file *fp) | |||
| 133 | } else { | 133 | } else { |
| 134 | BUG_ON(list_empty(&u->link)); | 134 | BUG_ON(list_empty(&u->link)); |
| 135 | } | 135 | } |
| 136 | atomic_inc(&unix_tot_inflight); | 136 | unix_tot_inflight++; |
| 137 | spin_unlock(&unix_gc_lock); | 137 | spin_unlock(&unix_gc_lock); |
| 138 | } | 138 | } |
| 139 | } | 139 | } |
| @@ -147,7 +147,7 @@ void unix_notinflight(struct file *fp) | |||
| 147 | BUG_ON(list_empty(&u->link)); | 147 | BUG_ON(list_empty(&u->link)); |
| 148 | if (atomic_dec_and_test(&u->inflight)) | 148 | if (atomic_dec_and_test(&u->inflight)) |
| 149 | list_del_init(&u->link); | 149 | list_del_init(&u->link); |
| 150 | atomic_dec(&unix_tot_inflight); | 150 | unix_tot_inflight--; |
| 151 | spin_unlock(&unix_gc_lock); | 151 | spin_unlock(&unix_gc_lock); |
| 152 | } | 152 | } |
| 153 | } | 153 | } |
| @@ -161,7 +161,7 @@ static inline struct sk_buff *sock_queue_head(struct sock *sk) | |||
| 161 | for (skb = sock_queue_head(sk)->next, next = skb->next; \ | 161 | for (skb = sock_queue_head(sk)->next, next = skb->next; \ |
| 162 | skb != sock_queue_head(sk); skb = next, next = skb->next) | 162 | skb != sock_queue_head(sk); skb = next, next = skb->next) |
| 163 | 163 | ||
| 164 | static void scan_inflight(struct sock *x, void (*func)(struct sock *), | 164 | static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *), |
| 165 | struct sk_buff_head *hitlist) | 165 | struct sk_buff_head *hitlist) |
| 166 | { | 166 | { |
| 167 | struct sk_buff *skb; | 167 | struct sk_buff *skb; |
| @@ -185,9 +185,9 @@ static void scan_inflight(struct sock *x, void (*func)(struct sock *), | |||
| 185 | * if it indeed does so | 185 | * if it indeed does so |
| 186 | */ | 186 | */ |
| 187 | struct sock *sk = unix_get_socket(*fp++); | 187 | struct sock *sk = unix_get_socket(*fp++); |
| 188 | if(sk) { | 188 | if (sk) { |
| 189 | hit = true; | 189 | hit = true; |
| 190 | func(sk); | 190 | func(unix_sk(sk)); |
| 191 | } | 191 | } |
| 192 | } | 192 | } |
| 193 | if (hit && hitlist != NULL) { | 193 | if (hit && hitlist != NULL) { |
| @@ -199,7 +199,7 @@ static void scan_inflight(struct sock *x, void (*func)(struct sock *), | |||
| 199 | spin_unlock(&x->sk_receive_queue.lock); | 199 | spin_unlock(&x->sk_receive_queue.lock); |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | static void scan_children(struct sock *x, void (*func)(struct sock *), | 202 | static void scan_children(struct sock *x, void (*func)(struct unix_sock *), |
| 203 | struct sk_buff_head *hitlist) | 203 | struct sk_buff_head *hitlist) |
| 204 | { | 204 | { |
| 205 | if (x->sk_state != TCP_LISTEN) | 205 | if (x->sk_state != TCP_LISTEN) |
| @@ -235,20 +235,18 @@ static void scan_children(struct sock *x, void (*func)(struct sock *), | |||
| 235 | } | 235 | } |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | static void dec_inflight(struct sock *sk) | 238 | static void dec_inflight(struct unix_sock *usk) |
| 239 | { | 239 | { |
| 240 | atomic_dec(&unix_sk(sk)->inflight); | 240 | atomic_dec(&usk->inflight); |
| 241 | } | 241 | } |
| 242 | 242 | ||
| 243 | static void inc_inflight(struct sock *sk) | 243 | static void inc_inflight(struct unix_sock *usk) |
| 244 | { | 244 | { |
| 245 | atomic_inc(&unix_sk(sk)->inflight); | 245 | atomic_inc(&usk->inflight); |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | static void inc_inflight_move_tail(struct sock *sk) | 248 | static void inc_inflight_move_tail(struct unix_sock *u) |
| 249 | { | 249 | { |
| 250 | struct unix_sock *u = unix_sk(sk); | ||
| 251 | |||
| 252 | atomic_inc(&u->inflight); | 250 | atomic_inc(&u->inflight); |
| 253 | /* | 251 | /* |
| 254 | * If this is still a candidate, move it to the end of the | 252 | * If this is still a candidate, move it to the end of the |
