diff options
-rw-r--r-- | fs/ext4/ext4.h | 3 | ||||
-rw-r--r-- | fs/ext4/ialloc.c | 2 | ||||
-rw-r--r-- | fs/ext4/inode.c | 11 | ||||
-rw-r--r-- | fs/ext4/super.c | 10 |
4 files changed, 16 insertions, 10 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 19a4de57128a..6a0d52ca1434 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -1571,7 +1571,8 @@ extern int ext4_write_inode(struct inode *, struct writeback_control *); | |||
1571 | extern int ext4_setattr(struct dentry *, struct iattr *); | 1571 | extern int ext4_setattr(struct dentry *, struct iattr *); |
1572 | extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, | 1572 | extern int ext4_getattr(struct vfsmount *mnt, struct dentry *dentry, |
1573 | struct kstat *stat); | 1573 | struct kstat *stat); |
1574 | extern void ext4_delete_inode(struct inode *); | 1574 | extern void ext4_evict_inode(struct inode *); |
1575 | extern void ext4_clear_inode(struct inode *); | ||
1575 | extern int ext4_sync_inode(handle_t *, struct inode *); | 1576 | extern int ext4_sync_inode(handle_t *, struct inode *); |
1576 | extern void ext4_dirty_inode(struct inode *); | 1577 | extern void ext4_dirty_inode(struct inode *); |
1577 | extern int ext4_change_inode_journal_flag(struct inode *, int); | 1578 | extern int ext4_change_inode_journal_flag(struct inode *, int); |
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 25c4b3173fd9..07e791a856da 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c | |||
@@ -222,7 +222,7 @@ void ext4_free_inode(handle_t *handle, struct inode *inode) | |||
222 | is_directory = S_ISDIR(inode->i_mode); | 222 | is_directory = S_ISDIR(inode->i_mode); |
223 | 223 | ||
224 | /* Do this BEFORE marking the inode not in use or returning an error */ | 224 | /* Do this BEFORE marking the inode not in use or returning an error */ |
225 | clear_inode(inode); | 225 | ext4_clear_inode(inode); |
226 | 226 | ||
227 | es = EXT4_SB(sb)->s_es; | 227 | es = EXT4_SB(sb)->s_es; |
228 | if (ino < EXT4_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) { | 228 | if (ino < EXT4_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) { |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 1fb390359bc5..c6d365f9c663 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -167,11 +167,16 @@ int ext4_truncate_restart_trans(handle_t *handle, struct inode *inode, | |||
167 | /* | 167 | /* |
168 | * Called at the last iput() if i_nlink is zero. | 168 | * Called at the last iput() if i_nlink is zero. |
169 | */ | 169 | */ |
170 | void ext4_delete_inode(struct inode *inode) | 170 | void ext4_evict_inode(struct inode *inode) |
171 | { | 171 | { |
172 | handle_t *handle; | 172 | handle_t *handle; |
173 | int err; | 173 | int err; |
174 | 174 | ||
175 | if (inode->i_nlink) { | ||
176 | truncate_inode_pages(&inode->i_data, 0); | ||
177 | goto no_delete; | ||
178 | } | ||
179 | |||
175 | if (!is_bad_inode(inode)) | 180 | if (!is_bad_inode(inode)) |
176 | dquot_initialize(inode); | 181 | dquot_initialize(inode); |
177 | 182 | ||
@@ -245,13 +250,13 @@ void ext4_delete_inode(struct inode *inode) | |||
245 | */ | 250 | */ |
246 | if (ext4_mark_inode_dirty(handle, inode)) | 251 | if (ext4_mark_inode_dirty(handle, inode)) |
247 | /* If that failed, just do the required in-core inode clear. */ | 252 | /* If that failed, just do the required in-core inode clear. */ |
248 | clear_inode(inode); | 253 | ext4_clear_inode(inode); |
249 | else | 254 | else |
250 | ext4_free_inode(handle, inode); | 255 | ext4_free_inode(handle, inode); |
251 | ext4_journal_stop(handle); | 256 | ext4_journal_stop(handle); |
252 | return; | 257 | return; |
253 | no_delete: | 258 | no_delete: |
254 | clear_inode(inode); /* We must guarantee clearing of inode... */ | 259 | ext4_clear_inode(inode); /* We must guarantee clearing of inode... */ |
255 | } | 260 | } |
256 | 261 | ||
257 | typedef struct { | 262 | typedef struct { |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 4e8983a9811b..f627a6a4c317 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -813,8 +813,10 @@ static void destroy_inodecache(void) | |||
813 | kmem_cache_destroy(ext4_inode_cachep); | 813 | kmem_cache_destroy(ext4_inode_cachep); |
814 | } | 814 | } |
815 | 815 | ||
816 | static void ext4_clear_inode(struct inode *inode) | 816 | void ext4_clear_inode(struct inode *inode) |
817 | { | 817 | { |
818 | invalidate_inode_buffers(inode); | ||
819 | end_writeback(inode); | ||
818 | dquot_drop(inode); | 820 | dquot_drop(inode); |
819 | ext4_discard_preallocations(inode); | 821 | ext4_discard_preallocations(inode); |
820 | if (EXT4_JOURNAL(inode)) | 822 | if (EXT4_JOURNAL(inode)) |
@@ -1100,14 +1102,13 @@ static const struct super_operations ext4_sops = { | |||
1100 | .destroy_inode = ext4_destroy_inode, | 1102 | .destroy_inode = ext4_destroy_inode, |
1101 | .write_inode = ext4_write_inode, | 1103 | .write_inode = ext4_write_inode, |
1102 | .dirty_inode = ext4_dirty_inode, | 1104 | .dirty_inode = ext4_dirty_inode, |
1103 | .delete_inode = ext4_delete_inode, | 1105 | .evict_inode = ext4_evict_inode, |
1104 | .put_super = ext4_put_super, | 1106 | .put_super = ext4_put_super, |
1105 | .sync_fs = ext4_sync_fs, | 1107 | .sync_fs = ext4_sync_fs, |
1106 | .freeze_fs = ext4_freeze, | 1108 | .freeze_fs = ext4_freeze, |
1107 | .unfreeze_fs = ext4_unfreeze, | 1109 | .unfreeze_fs = ext4_unfreeze, |
1108 | .statfs = ext4_statfs, | 1110 | .statfs = ext4_statfs, |
1109 | .remount_fs = ext4_remount, | 1111 | .remount_fs = ext4_remount, |
1110 | .clear_inode = ext4_clear_inode, | ||
1111 | .show_options = ext4_show_options, | 1112 | .show_options = ext4_show_options, |
1112 | #ifdef CONFIG_QUOTA | 1113 | #ifdef CONFIG_QUOTA |
1113 | .quota_read = ext4_quota_read, | 1114 | .quota_read = ext4_quota_read, |
@@ -1121,12 +1122,11 @@ static const struct super_operations ext4_nojournal_sops = { | |||
1121 | .destroy_inode = ext4_destroy_inode, | 1122 | .destroy_inode = ext4_destroy_inode, |
1122 | .write_inode = ext4_write_inode, | 1123 | .write_inode = ext4_write_inode, |
1123 | .dirty_inode = ext4_dirty_inode, | 1124 | .dirty_inode = ext4_dirty_inode, |
1124 | .delete_inode = ext4_delete_inode, | 1125 | .evict_inode = ext4_evict_inode, |
1125 | .write_super = ext4_write_super, | 1126 | .write_super = ext4_write_super, |
1126 | .put_super = ext4_put_super, | 1127 | .put_super = ext4_put_super, |
1127 | .statfs = ext4_statfs, | 1128 | .statfs = ext4_statfs, |
1128 | .remount_fs = ext4_remount, | 1129 | .remount_fs = ext4_remount, |
1129 | .clear_inode = ext4_clear_inode, | ||
1130 | .show_options = ext4_show_options, | 1130 | .show_options = ext4_show_options, |
1131 | #ifdef CONFIG_QUOTA | 1131 | #ifdef CONFIG_QUOTA |
1132 | .quota_read = ext4_quota_read, | 1132 | .quota_read = ext4_quota_read, |