|
@@ -857,6 +857,7 @@ static int do_direct_IO(struct dio *dio)
|
|
|
/* Handle holes */
|
|
/* Handle holes */
|
|
|
if (!buffer_mapped(map_bh)) {
|
|
if (!buffer_mapped(map_bh)) {
|
|
|
char *kaddr;
|
|
char *kaddr;
|
|
|
|
|
+ loff_t i_size_aligned;
|
|
|
|
|
|
|
|
/* AKPM: eargh, -ENOTBLK is a hack */
|
|
/* AKPM: eargh, -ENOTBLK is a hack */
|
|
|
if (dio->rw == WRITE) {
|
|
if (dio->rw == WRITE) {
|
|
@@ -864,8 +865,14 @@ static int do_direct_IO(struct dio *dio)
|
|
|
return -ENOTBLK;
|
|
return -ENOTBLK;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
|
+ * Be sure to account for a partial block as the
|
|
|
|
|
+ * last block in the file
|
|
|
|
|
+ */
|
|
|
|
|
+ i_size_aligned = ALIGN(i_size_read(dio->inode),
|
|
|
|
|
+ 1 << blkbits);
|
|
|
if (dio->block_in_file >=
|
|
if (dio->block_in_file >=
|
|
|
- i_size_read(dio->inode)>>blkbits) {
|
|
|
|
|
|
|
+ i_size_aligned >> blkbits) {
|
|
|
/* We hit eof */
|
|
/* We hit eof */
|
|
|
page_cache_release(page);
|
|
page_cache_release(page);
|
|
|
goto out;
|
|
goto out;
|