Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 349238
b: refs/heads/master
c: bc9540c
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jan 21, 2013
1 parent 800686e commit da8311c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 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: 82bda6195615891181115f579a480aa5001ce7e9
refs/heads/master: bc9540c637c3d8712ccbf9dcf28621f380ed5e64
28 changes: 15 additions & 13 deletions trunk/net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i)

static struct page *linear_to_page(struct page *page, unsigned int *len,
unsigned int *offset,
struct sk_buff *skb, struct sock *sk)
struct sock *sk)
{
struct page_frag *pfrag = sk_page_frag(sk);

Expand Down Expand Up @@ -1682,14 +1682,14 @@ static bool spd_can_coalesce(const struct splice_pipe_desc *spd,
static bool spd_fill_page(struct splice_pipe_desc *spd,
struct pipe_inode_info *pipe, struct page *page,
unsigned int *len, unsigned int offset,
struct sk_buff *skb, bool linear,
bool linear,
struct sock *sk)
{
if (unlikely(spd->nr_pages == MAX_SKB_FRAGS))
return true;

if (linear) {
page = linear_to_page(page, len, &offset, skb, sk);
page = linear_to_page(page, len, &offset, sk);
if (!page)
return true;
}
Expand All @@ -1708,13 +1708,11 @@ static bool spd_fill_page(struct splice_pipe_desc *spd,

static bool __splice_segment(struct page *page, unsigned int poff,
unsigned int plen, unsigned int *off,
unsigned int *len, struct sk_buff *skb,
unsigned int *len,
struct splice_pipe_desc *spd, bool linear,
struct sock *sk,
struct pipe_inode_info *pipe)
{
unsigned int flen;

if (!*len)
return true;

Expand All @@ -1729,12 +1727,16 @@ static bool __splice_segment(struct page *page, unsigned int poff,
plen -= *off;
*off = 0;

flen = min(*len, plen);

if (spd_fill_page(spd, pipe, page, &flen, poff, skb, linear, sk))
return true;
do {
unsigned int flen = min(*len, plen);

*len -= flen;
if (spd_fill_page(spd, pipe, page, &flen, poff,
linear, sk))
return true;
poff += flen;
plen -= flen;
*len -= flen;
} while (*len && plen);

return false;
}
Expand All @@ -1757,7 +1759,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
if (__splice_segment(virt_to_page(skb->data),
(unsigned long) skb->data & (PAGE_SIZE - 1),
skb_headlen(skb),
offset, len, skb, spd,
offset, len, spd,
skb_head_is_locked(skb),
sk, pipe))
return true;
Expand All @@ -1770,7 +1772,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,

if (__splice_segment(skb_frag_page(f),
f->page_offset, skb_frag_size(f),
offset, len, skb, spd, false, sk, pipe))
offset, len, spd, false, sk, pipe))
return true;
}

Expand Down

0 comments on commit da8311c

Please sign in to comment.