diff options
author | Christoph Hellwig <hch@lst.de> | 2010-06-04 05:29:53 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-08-09 16:47:29 -0400 |
commit | eafdc7d190a944c755a9fe68573c193e6e0217e7 (patch) | |
tree | 915c3cc8004706fabf88eae1ab123a3fa0147516 /fs/hfsplus/inode.c | |
parent | 256249584bda1a9357e2d29987a37f5b2df035f6 (diff) |
sort out blockdev_direct_IO variants
Move the call to vmtruncate to get rid of accessive blocks to the callers
in prepearation of the new truncate calling sequence. This was only done
for DIO_LOCKING filesystems, so the __blockdev_direct_IO_newtrunc variant
was not needed anyway. Get rid of blockdev_direct_IO_no_locking and
its _newtrunc variant while at it as just opencoding the two additional
paramters is shorted than the name suffix.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/hfsplus/inode.c')
-rw-r--r-- | fs/hfsplus/inode.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index 9bbb82924a22..486021773911 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
@@ -105,9 +105,24 @@ static ssize_t hfsplus_direct_IO(int rw, struct kiocb *iocb, | |||
105 | { | 105 | { |
106 | struct file *file = iocb->ki_filp; | 106 | struct file *file = iocb->ki_filp; |
107 | struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host; | 107 | struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host; |
108 | ssize_t ret; | ||
108 | 109 | ||
109 | return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, | 110 | ret = blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, |
110 | offset, nr_segs, hfsplus_get_block, NULL); | 111 | offset, nr_segs, hfsplus_get_block, NULL); |
112 | |||
113 | /* | ||
114 | * In case of error extending write may have instantiated a few | ||
115 | * blocks outside i_size. Trim these off again. | ||
116 | */ | ||
117 | if (unlikely((rw & WRITE) && ret < 0)) { | ||
118 | loff_t isize = i_size_read(inode); | ||
119 | loff_t end = offset + iov_length(iov, nr_segs); | ||
120 | |||
121 | if (end > isize) | ||
122 | vmtruncate(inode, isize); | ||
123 | } | ||
124 | |||
125 | return ret; | ||
111 | } | 126 | } |
112 | 127 | ||
113 | static int hfsplus_writepages(struct address_space *mapping, | 128 | static int hfsplus_writepages(struct address_space *mapping, |