aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 7f425f18c158..681da61080bc 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2720,18 +2720,16 @@ generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from)
2720 * about to write. We do this *before* the write so that we can return 2720 * about to write. We do this *before* the write so that we can return
2721 * without clobbering -EIOCBQUEUED from ->direct_IO(). 2721 * without clobbering -EIOCBQUEUED from ->direct_IO().
2722 */ 2722 */
2723 if (mapping->nrpages) { 2723 written = invalidate_inode_pages2_range(mapping,
2724 written = invalidate_inode_pages2_range(mapping,
2725 pos >> PAGE_SHIFT, end); 2724 pos >> PAGE_SHIFT, end);
2726 /* 2725 /*
2727 * If a page can not be invalidated, return 0 to fall back 2726 * If a page can not be invalidated, return 0 to fall back
2728 * to buffered write. 2727 * to buffered write.
2729 */ 2728 */
2730 if (written) { 2729 if (written) {
2731 if (written == -EBUSY) 2730 if (written == -EBUSY)
2732 return 0; 2731 return 0;
2733 goto out; 2732 goto out;
2734 }
2735 } 2733 }
2736 2734
2737 written = mapping->a_ops->direct_IO(iocb, from); 2735 written = mapping->a_ops->direct_IO(iocb, from);
@@ -2744,10 +2742,8 @@ generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from)
2744 * so we don't support it 100%. If this invalidation 2742 * so we don't support it 100%. If this invalidation
2745 * fails, tough, the write still worked... 2743 * fails, tough, the write still worked...
2746 */ 2744 */
2747 if (mapping->nrpages) { 2745 invalidate_inode_pages2_range(mapping,
2748 invalidate_inode_pages2_range(mapping, 2746 pos >> PAGE_SHIFT, end);
2749 pos >> PAGE_SHIFT, end);
2750 }
2751 2747
2752 if (written > 0) { 2748 if (written > 0) {
2753 pos += written; 2749 pos += written;