aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/affs/affs.h3
-rw-r--r--fs/affs/inode.c25
-rw-r--r--fs/affs/super.c3
3 files changed, 14 insertions, 17 deletions
diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index f05b6155ccc8..a8cbdeb34025 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -171,8 +171,7 @@ extern int affs_rename(struct inode *old_dir, struct dentry *old_dentry,
171extern unsigned long affs_parent_ino(struct inode *dir); 171extern unsigned long affs_parent_ino(struct inode *dir);
172extern struct inode *affs_new_inode(struct inode *dir); 172extern struct inode *affs_new_inode(struct inode *dir);
173extern int affs_notify_change(struct dentry *dentry, struct iattr *attr); 173extern int affs_notify_change(struct dentry *dentry, struct iattr *attr);
174extern void affs_delete_inode(struct inode *inode); 174extern void affs_evict_inode(struct inode *inode);
175extern void affs_clear_inode(struct inode *inode);
176extern struct inode *affs_iget(struct super_block *sb, 175extern struct inode *affs_iget(struct super_block *sb,
177 unsigned long ino); 176 unsigned long ino);
178extern int affs_write_inode(struct inode *inode, 177extern int affs_write_inode(struct inode *inode,
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 6883d5fb84cf..3a0fdec175ba 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -252,23 +252,19 @@ out:
252} 252}
253 253
254void 254void
255affs_delete_inode(struct inode *inode) 255affs_evict_inode(struct inode *inode)
256{
257 pr_debug("AFFS: delete_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink);
258 truncate_inode_pages(&inode->i_data, 0);
259 inode->i_size = 0;
260 affs_truncate(inode);
261 clear_inode(inode);
262 affs_free_block(inode->i_sb, inode->i_ino);
263}
264
265void
266affs_clear_inode(struct inode *inode)
267{ 256{
268 unsigned long cache_page; 257 unsigned long cache_page;
258 pr_debug("AFFS: evict_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink);
259 truncate_inode_pages(&inode->i_data, 0);
269 260
270 pr_debug("AFFS: clear_inode(ino=%lu, nlink=%u)\n", inode->i_ino, inode->i_nlink); 261 if (!inode->i_nlink) {
262 inode->i_size = 0;
263 affs_truncate(inode);
264 }
271 265
266 invalidate_inode_buffers(inode);
267 end_writeback(inode);
272 affs_free_prealloc(inode); 268 affs_free_prealloc(inode);
273 cache_page = (unsigned long)AFFS_I(inode)->i_lc; 269 cache_page = (unsigned long)AFFS_I(inode)->i_lc;
274 if (cache_page) { 270 if (cache_page) {
@@ -280,6 +276,9 @@ affs_clear_inode(struct inode *inode)
280 affs_brelse(AFFS_I(inode)->i_ext_bh); 276 affs_brelse(AFFS_I(inode)->i_ext_bh);
281 AFFS_I(inode)->i_ext_last = ~1; 277 AFFS_I(inode)->i_ext_last = ~1;
282 AFFS_I(inode)->i_ext_bh = NULL; 278 AFFS_I(inode)->i_ext_bh = NULL;
279
280 if (!inode->i_nlink)
281 affs_free_block(inode->i_sb, inode->i_ino);
283} 282}
284 283
285struct inode * 284struct inode *
diff --git a/fs/affs/super.c b/fs/affs/super.c
index 16a3e4765f68..2c804a87c142 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -140,8 +140,7 @@ static const struct super_operations affs_sops = {
140 .alloc_inode = affs_alloc_inode, 140 .alloc_inode = affs_alloc_inode,
141 .destroy_inode = affs_destroy_inode, 141 .destroy_inode = affs_destroy_inode,
142 .write_inode = affs_write_inode, 142 .write_inode = affs_write_inode,
143 .delete_inode = affs_delete_inode, 143 .evict_inode = affs_evict_inode,
144 .clear_inode = affs_clear_inode,
145 .put_super = affs_put_super, 144 .put_super = affs_put_super,
146 .write_super = affs_write_super, 145 .write_super = affs_write_super,
147 .sync_fs = affs_sync_fs, 146 .sync_fs = affs_sync_fs,