Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 349237
b: refs/heads/master
c: 82bda61
h: refs/heads/master
i:
  349235: c523b1b
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Jan 21, 2013
1 parent 35c516b commit 800686e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 30 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: b74aa930ef49a3c0d8e4c1987f89decac768fb2c
refs/heads/master: 82bda6195615891181115f579a480aa5001ce7e9
38 changes: 9 additions & 29 deletions trunk/net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1706,27 +1706,15 @@ static bool spd_fill_page(struct splice_pipe_desc *spd,
return false;
}

static inline void __segment_seek(struct page **page, unsigned int *poff,
unsigned int *plen, unsigned int off)
{
unsigned long n;

*poff += off;
n = *poff / PAGE_SIZE;
if (n)
*page = nth_page(*page, n);

*poff = *poff % PAGE_SIZE;
*plen -= off;
}

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

if (!*len)
return true;

Expand All @@ -1737,24 +1725,16 @@ static bool __splice_segment(struct page *page, unsigned int poff,
}

/* ignore any bits we already processed */
if (*off) {
__segment_seek(&page, &poff, &plen, *off);
*off = 0;
}

do {
unsigned int flen = min(*len, plen);
poff += *off;
plen -= *off;
*off = 0;

/* the linear region may spread across several pages */
flen = min_t(unsigned int, flen, PAGE_SIZE - poff);
flen = min(*len, plen);

if (spd_fill_page(spd, pipe, page, &flen, poff, skb, linear, sk))
return true;

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

} while (*len && plen);
*len -= flen;

return false;
}
Expand Down

0 comments on commit 800686e

Please sign in to comment.