aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jfs/inode.c')
-rw-r--r--fs/jfs/inode.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/fs/jfs/inode.c b/fs/jfs/inode.c
index ed9ba6fe04f5..79e6cda28181 100644
--- a/fs/jfs/inode.c
+++ b/fs/jfs/inode.c
@@ -317,9 +317,24 @@ static ssize_t jfs_direct_IO(int rw, struct kiocb *iocb,
317{ 317{
318 struct file *file = iocb->ki_filp; 318 struct file *file = iocb->ki_filp;
319 struct inode *inode = file->f_mapping->host; 319 struct inode *inode = file->f_mapping->host;
320 ssize_t ret;
320 321
321 return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, 322 ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov,
322 offset, nr_segs, jfs_get_block, NULL); 323 offset, nr_segs, jfs_get_block, NULL);
324
325 /*
326 * In case of error extending write may have instantiated a few
327 * blocks outside i_size. Trim these off again.
328 */
329 if (unlikely((rw & WRITE) && ret < 0)) {
330 loff_t isize = i_size_read(inode);
331 loff_t end = offset + iov_length(iov, nr_segs);
332
333 if (end > isize)
334 vmtruncate(inode, isize);
335 }
336
337 return ret;
323} 338}
324 339
325const struct address_space_operations jfs_aops = { 340const struct address_space_operations jfs_aops = {