Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 69621
b: refs/heads/master
c: 6814d7a
h: refs/heads/master
i:
  69619: 8295df0
v: v3
  • Loading branch information
Andrew Morton authored and Linus Torvalds committed Oct 16, 2007
1 parent 480fac8 commit b7138d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 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: 4b49643fbb3fa8bf4910f82be02d45e94e8972a4
refs/heads/master: 6814d7a91289ceb143285975e244a8f00fd3a830
18 changes: 7 additions & 11 deletions trunk/mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1865,29 +1865,25 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
do {
unsigned long index;
unsigned long offset;
unsigned long maxlen;
size_t copied;

offset = (pos & (PAGE_CACHE_SIZE -1)); /* Within page */
index = pos >> PAGE_CACHE_SHIFT;
bytes = PAGE_CACHE_SIZE - offset;

/* Limit the size of the copy to the caller's write size */
bytes = min(bytes, count);

/*
* Limit the size of the copy to that of the current segment,
* because fault_in_pages_readable() doesn't know how to walk
* segments.
*/
bytes = min(bytes, cur_iov->iov_len - iov_base);
if (bytes > count)
bytes = count;

/*
* Bring in the user page that we will copy from _first_.
* Otherwise there's a nasty deadlock on copying from the
* same page as we're writing to, without it being marked
* up-to-date.
*/
fault_in_pages_readable(buf, bytes);
maxlen = cur_iov->iov_len - iov_base;
if (maxlen > bytes)
maxlen = bytes;
fault_in_pages_readable(buf, maxlen);

page = __grab_cache_page(mapping,index,&cached_page,&lru_pvec);
if (!page) {
Expand Down

0 comments on commit b7138d4

Please sign in to comment.