Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 87096
b: refs/heads/master
c: f700926
h: refs/heads/master
v: v3
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Mar 11, 2008
1 parent 58db9cf commit a0b8560
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 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: 21bbb39c376ce6beeeb549d155f0d53dc76ed000
refs/heads/master: f7009264c519603b8ec67c881bd368a56703cfc9
22 changes: 10 additions & 12 deletions trunk/mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1742,21 +1742,27 @@ size_t iov_iter_copy_from_user(struct page *page,
}
EXPORT_SYMBOL(iov_iter_copy_from_user);

static void __iov_iter_advance_iov(struct iov_iter *i, size_t bytes)
void iov_iter_advance(struct iov_iter *i, size_t bytes)
{
BUG_ON(i->count < bytes);

if (likely(i->nr_segs == 1)) {
i->iov_offset += bytes;
i->count -= bytes;
} else {
const struct iovec *iov = i->iov;
size_t base = i->iov_offset;

/*
* The !iov->iov_len check ensures we skip over unlikely
* zero-length segments.
* zero-length segments (without overruning the iovec).
*/
while (bytes || !iov->iov_len) {
int copy = min(bytes, iov->iov_len - base);
while (bytes || unlikely(!iov->iov_len && i->count)) {
int copy;

copy = min(bytes, iov->iov_len - base);
BUG_ON(!i->count || i->count < copy);
i->count -= copy;
bytes -= copy;
base += copy;
if (iov->iov_len == base) {
Expand All @@ -1768,14 +1774,6 @@ static void __iov_iter_advance_iov(struct iov_iter *i, size_t bytes)
i->iov_offset = base;
}
}

void iov_iter_advance(struct iov_iter *i, size_t bytes)
{
BUG_ON(i->count < bytes);

__iov_iter_advance_iov(i, bytes);
i->count -= bytes;
}
EXPORT_SYMBOL(iov_iter_advance);

/*
Expand Down

0 comments on commit a0b8560

Please sign in to comment.