aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ramfs
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2010-05-27 08:42:19 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2010-05-27 22:15:47 -0400
commit3322e79a3860fd0d50e3c1879b2e98ac582c0ff6 (patch)
tree58ebfb1742c996dd9a40593c33c9ea1ff958efe8 /fs/ramfs
parent15c6fd9786dfaab43547bf60df6fa63170fb64fc (diff)
fs: convert simple fs to new truncate
Convert simple filesystems: ramfs, configfs, sysfs, block_dev to new truncate sequence. Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ramfs')
-rw-r--r--fs/ramfs/file-mmu.c1
-rw-r--r--fs/ramfs/file-nommu.c7
2 files changed, 5 insertions, 3 deletions
diff --git a/fs/ramfs/file-mmu.c b/fs/ramfs/file-mmu.c
index 50020501c5eb..4884ac5ae9be 100644
--- a/fs/ramfs/file-mmu.c
+++ b/fs/ramfs/file-mmu.c
@@ -50,5 +50,6 @@ const struct file_operations ramfs_file_operations = {
50}; 50};
51 51
52const struct inode_operations ramfs_file_inode_operations = { 52const struct inode_operations ramfs_file_inode_operations = {
53 .setattr = simple_setattr,
53 .getattr = simple_getattr, 54 .getattr = simple_getattr,
54}; 55};
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index 869f2d80183d..d532c20fc179 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -146,7 +146,7 @@ static int ramfs_nommu_resize(struct inode *inode, loff_t newsize, loff_t size)
146 return ret; 146 return ret;
147 } 147 }
148 148
149 ret = vmtruncate(inode, newsize); 149 ret = simple_setsize(inode, newsize);
150 150
151 return ret; 151 return ret;
152} 152}
@@ -169,7 +169,8 @@ static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia)
169 169
170 /* pick out size-changing events */ 170 /* pick out size-changing events */
171 if (ia->ia_valid & ATTR_SIZE) { 171 if (ia->ia_valid & ATTR_SIZE) {
172 loff_t size = i_size_read(inode); 172 loff_t size = inode->i_size;
173
173 if (ia->ia_size != size) { 174 if (ia->ia_size != size) {
174 ret = ramfs_nommu_resize(inode, ia->ia_size, size); 175 ret = ramfs_nommu_resize(inode, ia->ia_size, size);
175 if (ret < 0 || ia->ia_valid == ATTR_SIZE) 176 if (ret < 0 || ia->ia_valid == ATTR_SIZE)
@@ -182,7 +183,7 @@ static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia)
182 } 183 }
183 } 184 }
184 185
185 ret = inode_setattr(inode, ia); 186 generic_setattr(inode, ia);
186 out: 187 out:
187 ia->ia_valid = old_ia_valid; 188 ia->ia_valid = old_ia_valid;
188 return ret; 189 return ret;