Commit 429f08e9 authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller

[IPV4]: Consolidate the ip cork destruction in ip_output.c

The ip_push_pending_frames and ip_flush_pending_frames do the
same things to flush the sock's cork. Move this into a separate
function and save ~80 bytes from the .text
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e011ff48
...@@ -1183,6 +1183,17 @@ ssize_t ip_append_page(struct sock *sk, struct page *page, ...@@ -1183,6 +1183,17 @@ ssize_t ip_append_page(struct sock *sk, struct page *page,
return err; return err;
} }
static void ip_cork_release(struct inet_sock *inet)
{
inet->cork.flags &= ~IPCORK_OPT;
kfree(inet->cork.opt);
inet->cork.opt = NULL;
if (inet->cork.rt) {
ip_rt_put(inet->cork.rt);
inet->cork.rt = NULL;
}
}
/* /*
* Combined all pending IP fragments on the socket as one IP datagram * Combined all pending IP fragments on the socket as one IP datagram
* and push them out. * and push them out.
...@@ -1276,13 +1287,7 @@ int ip_push_pending_frames(struct sock *sk) ...@@ -1276,13 +1287,7 @@ int ip_push_pending_frames(struct sock *sk)
} }
out: out:
inet->cork.flags &= ~IPCORK_OPT; ip_cork_release(inet);
kfree(inet->cork.opt);
inet->cork.opt = NULL;
if (inet->cork.rt) {
ip_rt_put(inet->cork.rt);
inet->cork.rt = NULL;
}
return err; return err;
error: error:
...@@ -1295,19 +1300,12 @@ int ip_push_pending_frames(struct sock *sk) ...@@ -1295,19 +1300,12 @@ int ip_push_pending_frames(struct sock *sk)
*/ */
void ip_flush_pending_frames(struct sock *sk) void ip_flush_pending_frames(struct sock *sk)
{ {
struct inet_sock *inet = inet_sk(sk);
struct sk_buff *skb; struct sk_buff *skb;
while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL) while ((skb = __skb_dequeue_tail(&sk->sk_write_queue)) != NULL)
kfree_skb(skb); kfree_skb(skb);
inet->cork.flags &= ~IPCORK_OPT; ip_cork_release(inet_sk(sk));
kfree(inet->cork.opt);
inet->cork.opt = NULL;
if (inet->cork.rt) {
ip_rt_put(inet->cork.rt);
inet->cork.rt = NULL;
}
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment