Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 200314
b: refs/heads/master
c: 1d862f4
h: refs/heads/master
v: v3
  • Loading branch information
Miklos Szeredi authored and Jens Axboe committed Jun 10, 2010
1 parent 957a0d2 commit c8395c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 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: 3e6c05052c262ebe7fdd85e75e9d4f956cdd8d82
refs/heads/master: 1d862f41222b7f385bada9f85a67ca5592ffd33e
13 changes: 10 additions & 3 deletions trunk/fs/pipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,13 +1145,20 @@ static long pipe_set_size(struct pipe_inode_info *pipe, unsigned long nr_pages)
* and adjust the indexes.
*/
if (pipe->nrbufs) {
const unsigned int tail = pipe->nrbufs & (pipe->buffers - 1);
const unsigned int head = pipe->nrbufs - tail;
unsigned int tail;
unsigned int head;

tail = pipe->curbuf + pipe->nrbufs;
if (tail < pipe->buffers)
tail = 0;
else
tail &= (pipe->buffers - 1);

head = pipe->nrbufs - tail;
if (head)
memcpy(bufs, pipe->bufs + pipe->curbuf, head * sizeof(struct pipe_buffer));
if (tail)
memcpy(bufs + head, pipe->bufs + pipe->curbuf, tail * sizeof(struct pipe_buffer));
memcpy(bufs + head, pipe->bufs, tail * sizeof(struct pipe_buffer));
}

pipe->curbuf = 0;
Expand Down

0 comments on commit c8395c3

Please sign in to comment.