diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-17 11:38:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-17 11:38:30 -0500 |
commit | c397f8fa4379040bada53256c848e62c8b060392 (patch) | |
tree | 8101efb5c0c3b0a73e5e65f3474843c0914cc4d0 /mm/filemap.c | |
parent | 796e1c55717e9a6ff5c81b12289ffa1ffd919b6f (diff) | |
parent | aaaf5fbf56f16c81a653713cc333b18ad6e25ea9 (diff) |
Merge branch 'akpm' (patches from Andrew)
Merge fifth set of updates from Andrew Morton:
- A few things which were awaiting merges from linux-next:
- rtc
- ocfs2
- misc others
- Willy's "dax" feature: direct fs access to memory (mainly NV-DIMMs)
which isn't backed by pageframes.
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (37 commits)
rtc: add driver for DS1685 family of real time clocks
MAINTAINERS: add entry for Maxim PMICs on Samsung boards
lib/Kconfig: use bool instead of boolean
powerpc: drop _PAGE_FILE and pte_file()-related helpers
ocfs2: set append dio as a ro compat feature
ocfs2: wait for orphan recovery first once append O_DIRECT write crash
ocfs2: complete the rest request through buffer io
ocfs2: do not fallback to buffer I/O write if appending
ocfs2: allocate blocks in ocfs2_direct_IO_get_blocks
ocfs2: implement ocfs2_direct_IO_write
ocfs2: add orphan recovery types in ocfs2_recover_orphans
ocfs2: add functions to add and remove inode in orphan dir
ocfs2: prepare some interfaces used in append direct io
MAINTAINERS: fix spelling mistake & remove trailing WS
dax: does not work correctly with virtual aliasing caches
brd: rename XIP to DAX
ext4: add DAX functionality
dax: add dax_zero_page_range
ext2: get rid of most mentions of XIP in ext2
ext2: remove ext2_aops_xip
...
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index d9f5336552d7..ad7242043bdb 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1695,8 +1695,7 @@ generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) | |||
1695 | loff_t *ppos = &iocb->ki_pos; | 1695 | loff_t *ppos = &iocb->ki_pos; |
1696 | loff_t pos = *ppos; | 1696 | loff_t pos = *ppos; |
1697 | 1697 | ||
1698 | /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */ | 1698 | if (io_is_direct(file)) { |
1699 | if (file->f_flags & O_DIRECT) { | ||
1700 | struct address_space *mapping = file->f_mapping; | 1699 | struct address_space *mapping = file->f_mapping; |
1701 | struct inode *inode = mapping->host; | 1700 | struct inode *inode = mapping->host; |
1702 | size_t count = iov_iter_count(iter); | 1701 | size_t count = iov_iter_count(iter); |
@@ -1723,9 +1722,11 @@ generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) | |||
1723 | * we've already read everything we wanted to, or if | 1722 | * we've already read everything we wanted to, or if |
1724 | * there was a short read because we hit EOF, go ahead | 1723 | * there was a short read because we hit EOF, go ahead |
1725 | * and return. Otherwise fallthrough to buffered io for | 1724 | * and return. Otherwise fallthrough to buffered io for |
1726 | * the rest of the read. | 1725 | * the rest of the read. Buffered reads will not work for |
1726 | * DAX files, so don't bother trying. | ||
1727 | */ | 1727 | */ |
1728 | if (retval < 0 || !iov_iter_count(iter) || *ppos >= size) { | 1728 | if (retval < 0 || !iov_iter_count(iter) || *ppos >= size || |
1729 | IS_DAX(inode)) { | ||
1729 | file_accessed(file); | 1730 | file_accessed(file); |
1730 | goto out; | 1731 | goto out; |
1731 | } | 1732 | } |
@@ -2582,18 +2583,20 @@ ssize_t __generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
2582 | if (err) | 2583 | if (err) |
2583 | goto out; | 2584 | goto out; |
2584 | 2585 | ||
2585 | /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */ | 2586 | if (io_is_direct(file)) { |
2586 | if (unlikely(file->f_flags & O_DIRECT)) { | ||
2587 | loff_t endbyte; | 2587 | loff_t endbyte; |
2588 | 2588 | ||
2589 | written = generic_file_direct_write(iocb, from, pos); | 2589 | written = generic_file_direct_write(iocb, from, pos); |
2590 | if (written < 0 || written == count) | ||
2591 | goto out; | ||
2592 | |||
2593 | /* | 2590 | /* |
2594 | * direct-io write to a hole: fall through to buffered I/O | 2591 | * If the write stopped short of completing, fall back to |
2595 | * for completing the rest of the request. | 2592 | * buffered writes. Some filesystems do this for writes to |
2593 | * holes, for example. For DAX files, a buffered write will | ||
2594 | * not succeed (even if it did, DAX does not handle dirty | ||
2595 | * page-cache pages correctly). | ||
2596 | */ | 2596 | */ |
2597 | if (written < 0 || written == count || IS_DAX(inode)) | ||
2598 | goto out; | ||
2599 | |||
2597 | pos += written; | 2600 | pos += written; |
2598 | count -= written; | 2601 | count -= written; |
2599 | 2602 | ||