Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 126250
b: refs/heads/master
c: 48b47c5
h: refs/heads/master
v: v3
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Jan 6, 2009
1 parent d045041 commit 062059d
Show file tree
Hide file tree
Showing 2 changed files with 6 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: 48aae42556e5ea1ba0d8ddab25352706577af2ed
refs/heads/master: 48b47c561e41525061b5bc0cfd67d6367fd11dc4
16 changes: 5 additions & 11 deletions trunk/mm/filemap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,8 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
goto out; /* skip atime */
size = i_size_read(inode);
if (pos < size) {
retval = filemap_write_and_wait(mapping);
retval = filemap_write_and_wait_range(mapping, pos,
pos + iov_length(iov, nr_segs) - 1);
if (!retval) {
retval = mapping->a_ops->direct_IO(READ, iocb,
iov, pos, nr_segs);
Expand Down Expand Up @@ -2059,18 +2060,10 @@ generic_file_direct_write(struct kiocb *iocb, const struct iovec *iov,
if (count != ocount)
*nr_segs = iov_shorten((struct iovec *)iov, *nr_segs, count);

/*
* Unmap all mmappings of the file up-front.
*
* This will cause any pte dirty bits to be propagated into the
* pageframes for the subsequent filemap_write_and_wait().
*/
write_len = iov_length(iov, *nr_segs);
end = (pos + write_len - 1) >> PAGE_CACHE_SHIFT;
if (mapping_mapped(mapping))
unmap_mapping_range(mapping, pos, write_len, 0);

written = filemap_write_and_wait(mapping);
written = filemap_write_and_wait_range(mapping, pos, pos + write_len - 1);
if (written)
goto out;

Expand Down Expand Up @@ -2290,7 +2283,8 @@ generic_file_buffered_write(struct kiocb *iocb, const struct iovec *iov,
* the file data here, to try to honour O_DIRECT expectations.
*/
if (unlikely(file->f_flags & O_DIRECT) && written)
status = filemap_write_and_wait(mapping);
status = filemap_write_and_wait_range(mapping,
pos, pos + written - 1);

return written ? written : status;
}
Expand Down

0 comments on commit 062059d

Please sign in to comment.