Commit fef266580e5cf897a1b63528fc6b1185e2d6bb87

Authored by Mark Fasheh
Committed by Linus Torvalds
1 parent e85b565233

[PATCH] update filesystems for new delete_inode behavior

Update the file systems in fs/ implementing a delete_inode() callback to
call truncate_inode_pages().  One implementation note: In developing this
patch I put the calls to truncate_inode_pages() at the very top of those
filesystems delete_inode() callbacks in order to retain the previous
behavior.  I'm guessing that some of those could probably be optimized.

Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Acked-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 20 changed files with 30 additions and 0 deletions Side-by-side Diff

... ... @@ -255,6 +255,7 @@
255 255 affs_delete_inode(struct inode *inode)
256 256 {
257 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);
258 259 inode->i_size = 0;
259 260 if (S_ISREG(inode->i_mode))
260 261 affs_truncate(inode);
... ... @@ -143,6 +143,8 @@
143 143  
144 144 dprintf("ino=%08lx\n", inode->i_ino);
145 145  
  146 + truncate_inode_pages(&inode->i_data, 0);
  147 +
146 148 if (inode->i_ino < BFS_ROOT_INO || inode->i_ino > info->si_lasti) {
147 149 printf("invalid ino=%08lx\n", inode->i_ino);
148 150 return;
... ... @@ -71,6 +71,8 @@
71 71 */
72 72 void ext2_delete_inode (struct inode * inode)
73 73 {
  74 + truncate_inode_pages(&inode->i_data, 0);
  75 +
74 76 if (is_bad_inode(inode))
75 77 goto no_delete;
76 78 EXT2_I(inode)->i_dtime = get_seconds();
... ... @@ -187,6 +187,8 @@
187 187 {
188 188 handle_t *handle;
189 189  
  190 + truncate_inode_pages(&inode->i_data, 0);
  191 +
190 192 if (is_bad_inode(inode))
191 193 goto no_delete;
192 194  
... ... @@ -335,6 +335,8 @@
335 335  
336 336 static void fat_delete_inode(struct inode *inode)
337 337 {
  338 + truncate_inode_pages(&inode->i_data, 0);
  339 +
338 340 if (!is_bad_inode(inode)) {
339 341 inode->i_size = 0;
340 342 fat_truncate(inode);
fs/hostfs/hostfs_kern.c
... ... @@ -284,6 +284,7 @@
284 284  
285 285 static void hostfs_delete_inode(struct inode *inode)
286 286 {
  287 + truncate_inode_pages(&inode->i_data, 0);
287 288 if(HOSTFS_I(inode)->fd != -1) {
288 289 close_file(&HOSTFS_I(inode)->fd);
289 290 HOSTFS_I(inode)->fd = -1;
... ... @@ -284,6 +284,7 @@
284 284  
285 285 void hpfs_delete_inode(struct inode *inode)
286 286 {
  287 + truncate_inode_pages(&inode->i_data, 0);
287 288 lock_kernel();
288 289 hpfs_remove_fnode(inode->i_sb, inode->i_ino);
289 290 unlock_kernel();
... ... @@ -1744,6 +1744,7 @@
1744 1744 D3(printk("jffs_delete_inode(): inode->i_ino == %lu\n",
1745 1745 inode->i_ino));
1746 1746  
  1747 + truncate_inode_pages(&inode->i_data, 0);
1747 1748 lock_kernel();
1748 1749 inode->i_size = 0;
1749 1750 inode->i_blocks = 0;
... ... @@ -132,6 +132,8 @@
132 132 (JFS_IP(inode)->fileset != cpu_to_le32(FILESYSTEM_I)))
133 133 return;
134 134  
  135 + truncate_inode_pages(&inode->i_data, 0);
  136 +
135 137 if (test_cflag(COMMIT_Freewmap, inode))
136 138 jfs_free_zero_link(inode);
137 139  
... ... @@ -24,6 +24,7 @@
24 24  
25 25 static void minix_delete_inode(struct inode *inode)
26 26 {
  27 + truncate_inode_pages(&inode->i_data, 0);
27 28 inode->i_size = 0;
28 29 minix_truncate(inode);
29 30 minix_free_inode(inode);
... ... @@ -286,6 +286,8 @@
286 286 static void
287 287 ncp_delete_inode(struct inode *inode)
288 288 {
  289 + truncate_inode_pages(&inode->i_data, 0);
  290 +
289 291 if (S_ISDIR(inode->i_mode)) {
290 292 DDPRINTK("ncp_delete_inode: put directory %ld\n", inode->i_ino);
291 293 }
... ... @@ -146,6 +146,8 @@
146 146 {
147 147 dprintk("NFS: delete_inode(%s/%ld)\n", inode->i_sb->s_id, inode->i_ino);
148 148  
  149 + truncate_inode_pages(&inode->i_data, 0);
  150 +
149 151 nfs_wb_all(inode);
150 152 /*
151 153 * The following should never happen...
... ... @@ -60,6 +60,8 @@
60 60 struct proc_dir_entry *de;
61 61 struct task_struct *tsk;
62 62  
  63 + truncate_inode_pages(&inode->i_data, 0);
  64 +
63 65 /* Let go of any associated process */
64 66 tsk = PROC_I(inode)->task;
65 67 if (tsk)
... ... @@ -63,6 +63,7 @@
63 63 static void qnx4_delete_inode(struct inode *inode)
64 64 {
65 65 QNX4DEBUG(("qnx4: deleting inode [%lu]\n", (unsigned long) inode->i_ino));
  66 + truncate_inode_pages(&inode->i_data, 0);
66 67 inode->i_size = 0;
67 68 qnx4_truncate(inode);
68 69 lock_kernel();
... ... @@ -33,6 +33,8 @@
33 33 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb);
34 34 struct reiserfs_transaction_handle th;
35 35  
  36 + truncate_inode_pages(&inode->i_data, 0);
  37 +
36 38 reiserfs_write_lock(inode->i_sb);
37 39  
38 40 /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */
... ... @@ -331,6 +331,7 @@
331 331 smb_delete_inode(struct inode *ino)
332 332 {
333 333 DEBUG1("ino=%ld\n", ino->i_ino);
  334 + truncate_inode_pages(&ino->i_data, 0);
334 335 lock_kernel();
335 336 if (smb_close(ino))
336 337 PARANOIA("could not close inode %ld\n", ino->i_ino);
... ... @@ -292,6 +292,7 @@
292 292  
293 293 static void sysv_delete_inode(struct inode *inode)
294 294 {
  295 + truncate_inode_pages(&inode->i_data, 0);
295 296 inode->i_size = 0;
296 297 sysv_truncate(inode);
297 298 lock_kernel();
... ... @@ -87,6 +87,8 @@
87 87 */
88 88 void udf_delete_inode(struct inode * inode)
89 89 {
  90 + truncate_inode_pages(&inode->i_data, 0);
  91 +
90 92 if (is_bad_inode(inode))
91 93 goto no_delete;
92 94  
... ... @@ -804,6 +804,7 @@
804 804  
805 805 void ufs_delete_inode (struct inode * inode)
806 806 {
  807 + truncate_inode_pages(&inode->i_data, 0);
807 808 /*UFS_I(inode)->i_dtime = CURRENT_TIME;*/
808 809 lock_kernel();
809 810 mark_inode_dirty(inode);
... ... @@ -666,6 +666,7 @@
666 666 struct shmem_inode_info *info = SHMEM_I(inode);
667 667  
668 668 if (inode->i_op->truncate == shmem_truncate) {
  669 + truncate_inode_pages(inode->i_mapping, 0);
669 670 shmem_unacct_size(info->flags, inode->i_size);
670 671 inode->i_size = 0;
671 672 shmem_truncate(inode);