diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-06-06 07:08:19 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-08-09 16:48:03 -0400 |
commit | ac14a95b5239d37b6082c3791b88d7ab4e8e444c (patch) | |
tree | b7a763b2e25de51730104e14fffd5b4ec035b415 /fs/ext3 | |
parent | 0f3f63a4700d7c5aed51491b0113a257cf290a56 (diff) |
convert ext3 to ->evict_inode()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/ialloc.c | 12 | ||||
-rw-r--r-- | fs/ext3/inode.c | 37 | ||||
-rw-r--r-- | fs/ext3/super.c | 14 |
3 files changed, 28 insertions, 35 deletions
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index 498021eb88fb..4ab72db3559e 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
@@ -119,20 +119,8 @@ void ext3_free_inode (handle_t *handle, struct inode * inode) | |||
119 | ino = inode->i_ino; | 119 | ino = inode->i_ino; |
120 | ext3_debug ("freeing inode %lu\n", ino); | 120 | ext3_debug ("freeing inode %lu\n", ino); |
121 | 121 | ||
122 | /* | ||
123 | * Note: we must free any quota before locking the superblock, | ||
124 | * as writing the quota to disk may need the lock as well. | ||
125 | */ | ||
126 | dquot_initialize(inode); | ||
127 | ext3_xattr_delete_inode(handle, inode); | ||
128 | dquot_free_inode(inode); | ||
129 | dquot_drop(inode); | ||
130 | |||
131 | is_directory = S_ISDIR(inode->i_mode); | 122 | is_directory = S_ISDIR(inode->i_mode); |
132 | 123 | ||
133 | /* Do this BEFORE marking the inode not in use or returning an error */ | ||
134 | clear_inode (inode); | ||
135 | |||
136 | es = EXT3_SB(sb)->s_es; | 124 | es = EXT3_SB(sb)->s_es; |
137 | if (ino < EXT3_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) { | 125 | if (ino < EXT3_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) { |
138 | ext3_error (sb, "ext3_free_inode", | 126 | ext3_error (sb, "ext3_free_inode", |
diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c index b04d11936683..cc55cecf9fbc 100644 --- a/fs/ext3/inode.c +++ b/fs/ext3/inode.c | |||
@@ -190,18 +190,28 @@ static int truncate_restart_transaction(handle_t *handle, struct inode *inode) | |||
190 | } | 190 | } |
191 | 191 | ||
192 | /* | 192 | /* |
193 | * Called at the last iput() if i_nlink is zero. | 193 | * Called at inode eviction from icache |
194 | */ | 194 | */ |
195 | void ext3_delete_inode (struct inode * inode) | 195 | void ext3_evict_inode (struct inode *inode) |
196 | { | 196 | { |
197 | struct ext3_block_alloc_info *rsv; | ||
197 | handle_t *handle; | 198 | handle_t *handle; |
199 | int want_delete = 0; | ||
198 | 200 | ||
199 | if (!is_bad_inode(inode)) | 201 | if (!inode->i_nlink && !is_bad_inode(inode)) { |
200 | dquot_initialize(inode); | 202 | dquot_initialize(inode); |
203 | want_delete = 1; | ||
204 | } | ||
201 | 205 | ||
202 | truncate_inode_pages(&inode->i_data, 0); | 206 | truncate_inode_pages(&inode->i_data, 0); |
203 | 207 | ||
204 | if (is_bad_inode(inode)) | 208 | ext3_discard_reservation(inode); |
209 | rsv = EXT3_I(inode)->i_block_alloc_info; | ||
210 | EXT3_I(inode)->i_block_alloc_info = NULL; | ||
211 | if (unlikely(rsv)) | ||
212 | kfree(rsv); | ||
213 | |||
214 | if (!want_delete) | ||
205 | goto no_delete; | 215 | goto no_delete; |
206 | 216 | ||
207 | handle = start_transaction(inode); | 217 | handle = start_transaction(inode); |
@@ -238,15 +248,22 @@ void ext3_delete_inode (struct inode * inode) | |||
238 | * having errors), but we can't free the inode if the mark_dirty | 248 | * having errors), but we can't free the inode if the mark_dirty |
239 | * fails. | 249 | * fails. |
240 | */ | 250 | */ |
241 | if (ext3_mark_inode_dirty(handle, inode)) | 251 | if (ext3_mark_inode_dirty(handle, inode)) { |
242 | /* If that failed, just do the required in-core inode clear. */ | 252 | /* If that failed, just dquot_drop() and be done with that */ |
243 | clear_inode(inode); | 253 | dquot_drop(inode); |
244 | else | 254 | end_writeback(inode); |
255 | } else { | ||
256 | ext3_xattr_delete_inode(handle, inode); | ||
257 | dquot_free_inode(inode); | ||
258 | dquot_drop(inode); | ||
259 | end_writeback(inode); | ||
245 | ext3_free_inode(handle, inode); | 260 | ext3_free_inode(handle, inode); |
261 | } | ||
246 | ext3_journal_stop(handle); | 262 | ext3_journal_stop(handle); |
247 | return; | 263 | return; |
248 | no_delete: | 264 | no_delete: |
249 | clear_inode(inode); /* We must guarantee clearing of inode... */ | 265 | end_writeback(inode); |
266 | dquot_drop(inode); | ||
250 | } | 267 | } |
251 | 268 | ||
252 | typedef struct { | 269 | typedef struct { |
@@ -2564,7 +2581,7 @@ out_stop: | |||
2564 | * If this was a simple ftruncate(), and the file will remain alive | 2581 | * If this was a simple ftruncate(), and the file will remain alive |
2565 | * then we need to clear up the orphan record which we created above. | 2582 | * then we need to clear up the orphan record which we created above. |
2566 | * However, if this was a real unlink then we were called by | 2583 | * However, if this was a real unlink then we were called by |
2567 | * ext3_delete_inode(), and we allow that function to clean up the | 2584 | * ext3_evict_inode(), and we allow that function to clean up the |
2568 | * orphan info for us. | 2585 | * orphan info for us. |
2569 | */ | 2586 | */ |
2570 | if (inode->i_nlink) | 2587 | if (inode->i_nlink) |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 6c953bb255e7..a951fd5c081c 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -527,17 +527,6 @@ static void destroy_inodecache(void) | |||
527 | kmem_cache_destroy(ext3_inode_cachep); | 527 | kmem_cache_destroy(ext3_inode_cachep); |
528 | } | 528 | } |
529 | 529 | ||
530 | static void ext3_clear_inode(struct inode *inode) | ||
531 | { | ||
532 | struct ext3_block_alloc_info *rsv = EXT3_I(inode)->i_block_alloc_info; | ||
533 | |||
534 | dquot_drop(inode); | ||
535 | ext3_discard_reservation(inode); | ||
536 | EXT3_I(inode)->i_block_alloc_info = NULL; | ||
537 | if (unlikely(rsv)) | ||
538 | kfree(rsv); | ||
539 | } | ||
540 | |||
541 | static inline void ext3_show_quota_options(struct seq_file *seq, struct super_block *sb) | 530 | static inline void ext3_show_quota_options(struct seq_file *seq, struct super_block *sb) |
542 | { | 531 | { |
543 | #if defined(CONFIG_QUOTA) | 532 | #if defined(CONFIG_QUOTA) |
@@ -783,14 +772,13 @@ static const struct super_operations ext3_sops = { | |||
783 | .destroy_inode = ext3_destroy_inode, | 772 | .destroy_inode = ext3_destroy_inode, |
784 | .write_inode = ext3_write_inode, | 773 | .write_inode = ext3_write_inode, |
785 | .dirty_inode = ext3_dirty_inode, | 774 | .dirty_inode = ext3_dirty_inode, |
786 | .delete_inode = ext3_delete_inode, | 775 | .evict_inode = ext3_evict_inode, |
787 | .put_super = ext3_put_super, | 776 | .put_super = ext3_put_super, |
788 | .sync_fs = ext3_sync_fs, | 777 | .sync_fs = ext3_sync_fs, |
789 | .freeze_fs = ext3_freeze, | 778 | .freeze_fs = ext3_freeze, |
790 | .unfreeze_fs = ext3_unfreeze, | 779 | .unfreeze_fs = ext3_unfreeze, |
791 | .statfs = ext3_statfs, | 780 | .statfs = ext3_statfs, |
792 | .remount_fs = ext3_remount, | 781 | .remount_fs = ext3_remount, |
793 | .clear_inode = ext3_clear_inode, | ||
794 | .show_options = ext3_show_options, | 782 | .show_options = ext3_show_options, |
795 | #ifdef CONFIG_QUOTA | 783 | #ifdef CONFIG_QUOTA |
796 | .quota_read = ext3_quota_read, | 784 | .quota_read = ext3_quota_read, |