|
@@ -2720,18 +2720,16 @@ generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from)
|
|
|
* about to write. We do this *before* the write so that we can return
|
|
|
* without clobbering -EIOCBQUEUED from ->direct_IO().
|
|
|
*/
|
|
|
- if (mapping->nrpages) {
|
|
|
- written = invalidate_inode_pages2_range(mapping,
|
|
|
+ written = invalidate_inode_pages2_range(mapping,
|
|
|
pos >> PAGE_SHIFT, end);
|
|
|
- /*
|
|
|
- * If a page can not be invalidated, return 0 to fall back
|
|
|
- * to buffered write.
|
|
|
- */
|
|
|
- if (written) {
|
|
|
- if (written == -EBUSY)
|
|
|
- return 0;
|
|
|
- goto out;
|
|
|
- }
|
|
|
+ /*
|
|
|
+ * If a page can not be invalidated, return 0 to fall back
|
|
|
+ * to buffered write.
|
|
|
+ */
|
|
|
+ if (written) {
|
|
|
+ if (written == -EBUSY)
|
|
|
+ return 0;
|
|
|
+ goto out;
|
|
|
}
|
|
|
|
|
|
written = mapping->a_ops->direct_IO(iocb, from);
|
|
@@ -2744,10 +2742,8 @@ generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from)
|
|
|
* so we don't support it 100%. If this invalidation
|
|
|
* fails, tough, the write still worked...
|
|
|
*/
|
|
|
- if (mapping->nrpages) {
|
|
|
- invalidate_inode_pages2_range(mapping,
|
|
|
- pos >> PAGE_SHIFT, end);
|
|
|
- }
|
|
|
+ invalidate_inode_pages2_range(mapping,
|
|
|
+ pos >> PAGE_SHIFT, end);
|
|
|
|
|
|
if (written > 0) {
|
|
|
pos += written;
|