aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hpfs/file.c
diff options
context:
space:
mode:
authorMarco Stornelli <marco.stornelli@gmail.com>2012-12-15 05:53:50 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-12-20 18:40:00 -0500
commit70b31c4c88e253f4c2066367401118edab957614 (patch)
tree20aa6e37f7e5d7b9c82fbe58f3647bec90060a9b /fs/hpfs/file.c
parentc8cf464bc5cfa689357796db2294c4b2474095fb (diff)
hpfs: drop vmtruncate
Removed vmtruncate Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/hpfs/file.c')
-rw-r--r--fs/hpfs/file.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c
index 89d2a5803ae3..fbfe2df5624b 100644
--- a/fs/hpfs/file.c
+++ b/fs/hpfs/file.c
@@ -50,7 +50,7 @@ static secno hpfs_bmap(struct inode *inode, unsigned file_secno)
50 return disk_secno; 50 return disk_secno;
51} 51}
52 52
53static void hpfs_truncate(struct inode *i) 53void hpfs_truncate(struct inode *i)
54{ 54{
55 if (IS_IMMUTABLE(i)) return /*-EPERM*/; 55 if (IS_IMMUTABLE(i)) return /*-EPERM*/;
56 hpfs_lock_assert(i->i_sb); 56 hpfs_lock_assert(i->i_sb);
@@ -105,6 +105,16 @@ static int hpfs_readpage(struct file *file, struct page *page)
105 return block_read_full_page(page,hpfs_get_block); 105 return block_read_full_page(page,hpfs_get_block);
106} 106}
107 107
108static void hpfs_write_failed(struct address_space *mapping, loff_t to)
109{
110 struct inode *inode = mapping->host;
111
112 if (to > inode->i_size) {
113 truncate_pagecache(inode, to, inode->i_size);
114 hpfs_truncate(inode);
115 }
116}
117
108static int hpfs_write_begin(struct file *file, struct address_space *mapping, 118static int hpfs_write_begin(struct file *file, struct address_space *mapping,
109 loff_t pos, unsigned len, unsigned flags, 119 loff_t pos, unsigned len, unsigned flags,
110 struct page **pagep, void **fsdata) 120 struct page **pagep, void **fsdata)
@@ -115,11 +125,8 @@ static int hpfs_write_begin(struct file *file, struct address_space *mapping,
115 ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, 125 ret = cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata,
116 hpfs_get_block, 126 hpfs_get_block,
117 &hpfs_i(mapping->host)->mmu_private); 127 &hpfs_i(mapping->host)->mmu_private);
118 if (unlikely(ret)) { 128 if (unlikely(ret))
119 loff_t isize = mapping->host->i_size; 129 hpfs_write_failed(mapping, pos + len);
120 if (pos + len > isize)
121 vmtruncate(mapping->host, isize);
122 }
123 130
124 return ret; 131 return ret;
125} 132}
@@ -166,6 +173,5 @@ const struct file_operations hpfs_file_ops =
166 173
167const struct inode_operations hpfs_file_iops = 174const struct inode_operations hpfs_file_iops =
168{ 175{
169 .truncate = hpfs_truncate,
170 .setattr = hpfs_setattr, 176 .setattr = hpfs_setattr,
171}; 177};