aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/filemap.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index b7749a92021c..01842867c9d2 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1428,30 +1428,28 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
1428 if (!count) 1428 if (!count)
1429 goto out; /* skip atime */ 1429 goto out; /* skip atime */
1430 size = i_size_read(inode); 1430 size = i_size_read(inode);
1431 if (pos < size) { 1431 retval = filemap_write_and_wait_range(mapping, pos,
1432 retval = filemap_write_and_wait_range(mapping, pos,
1433 pos + iov_length(iov, nr_segs) - 1); 1432 pos + iov_length(iov, nr_segs) - 1);
1434 if (!retval) { 1433 if (!retval) {
1435 retval = mapping->a_ops->direct_IO(READ, iocb, 1434 retval = mapping->a_ops->direct_IO(READ, iocb,
1436 iov, pos, nr_segs); 1435 iov, pos, nr_segs);
1437 } 1436 }
1438 if (retval > 0) { 1437 if (retval > 0) {
1439 *ppos = pos + retval; 1438 *ppos = pos + retval;
1440 count -= retval; 1439 count -= retval;
1441 } 1440 }
1442 1441
1443 /* 1442 /*
1444 * Btrfs can have a short DIO read if we encounter 1443 * Btrfs can have a short DIO read if we encounter
1445 * compressed extents, so if there was an error, or if 1444 * compressed extents, so if there was an error, or if
1446 * we've already read everything we wanted to, or if 1445 * we've already read everything we wanted to, or if
1447 * there was a short read because we hit EOF, go ahead 1446 * there was a short read because we hit EOF, go ahead
1448 * and return. Otherwise fallthrough to buffered io for 1447 * and return. Otherwise fallthrough to buffered io for
1449 * the rest of the read. 1448 * the rest of the read.
1450 */ 1449 */
1451 if (retval < 0 || !count || *ppos >= size) { 1450 if (retval < 0 || !count || *ppos >= size) {
1452 file_accessed(filp); 1451 file_accessed(filp);
1453 goto out; 1452 goto out;
1454 }
1455 } 1453 }
1456 } 1454 }
1457 1455