aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf
diff options
context:
space:
mode:
Diffstat (limited to 'fs/udf')
-rw-r--r--fs/udf/ialloc.c2
-rw-r--r--fs/udf/inode.c48
-rw-r--r--fs/udf/super.c3
-rw-r--r--fs/udf/udfdecl.h3
4 files changed, 21 insertions, 35 deletions
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c
index 18cd7111185d..75d9304d0dc3 100644
--- a/fs/udf/ialloc.c
+++ b/fs/udf/ialloc.c
@@ -31,8 +31,6 @@ void udf_free_inode(struct inode *inode)
31 struct super_block *sb = inode->i_sb; 31 struct super_block *sb = inode->i_sb;
32 struct udf_sb_info *sbi = UDF_SB(sb); 32 struct udf_sb_info *sbi = UDF_SB(sb);
33 33
34 clear_inode(inode);
35
36 mutex_lock(&sbi->s_alloc_mutex); 34 mutex_lock(&sbi->s_alloc_mutex);
37 if (sbi->s_lvid_bh) { 35 if (sbi->s_lvid_bh) {
38 struct logicalVolIntegrityDescImpUse *lvidiu = 36 struct logicalVolIntegrityDescImpUse *lvidiu =
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index ecddcc2ed746..fc48f37aa2dd 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -68,37 +68,23 @@ static void udf_update_extents(struct inode *,
68static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int); 68static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int);
69 69
70 70
71void udf_delete_inode(struct inode *inode) 71void udf_evict_inode(struct inode *inode)
72{
73 truncate_inode_pages(&inode->i_data, 0);
74
75 if (is_bad_inode(inode))
76 goto no_delete;
77
78 inode->i_size = 0;
79 udf_truncate(inode);
80 lock_kernel();
81
82 udf_update_inode(inode, IS_SYNC(inode));
83 udf_free_inode(inode);
84
85 unlock_kernel();
86 return;
87
88no_delete:
89 clear_inode(inode);
90}
91
92/*
93 * If we are going to release inode from memory, we truncate last inode extent
94 * to proper length. We could use drop_inode() but it's called under inode_lock
95 * and thus we cannot mark inode dirty there. We use clear_inode() but we have
96 * to make sure to write inode as it's not written automatically.
97 */
98void udf_clear_inode(struct inode *inode)
99{ 72{
100 struct udf_inode_info *iinfo = UDF_I(inode); 73 struct udf_inode_info *iinfo = UDF_I(inode);
74 int want_delete = 0;
101 75
76 truncate_inode_pages(&inode->i_data, 0);
77
78 if (!inode->i_nlink && !is_bad_inode(inode)) {
79 want_delete = 1;
80 inode->i_size = 0;
81 udf_truncate(inode);
82 lock_kernel();
83 udf_update_inode(inode, IS_SYNC(inode));
84 unlock_kernel();
85 }
86 invalidate_inode_buffers(inode);
87 end_writeback(inode);
102 if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB && 88 if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB &&
103 inode->i_size != iinfo->i_lenExtents) { 89 inode->i_size != iinfo->i_lenExtents) {
104 printk(KERN_WARNING "UDF-fs (%s): Inode %lu (mode %o) has " 90 printk(KERN_WARNING "UDF-fs (%s): Inode %lu (mode %o) has "
@@ -108,9 +94,13 @@ void udf_clear_inode(struct inode *inode)
108 (unsigned long long)inode->i_size, 94 (unsigned long long)inode->i_size,
109 (unsigned long long)iinfo->i_lenExtents); 95 (unsigned long long)iinfo->i_lenExtents);
110 } 96 }
111
112 kfree(iinfo->i_ext.i_data); 97 kfree(iinfo->i_ext.i_data);
113 iinfo->i_ext.i_data = NULL; 98 iinfo->i_ext.i_data = NULL;
99 if (want_delete) {
100 lock_kernel();
101 udf_free_inode(inode);
102 unlock_kernel();
103 }
114} 104}
115 105
116static int udf_writepage(struct page *page, struct writeback_control *wbc) 106static int udf_writepage(struct page *page, struct writeback_control *wbc)
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 612d1e2e285a..f9f4a9a0ea2b 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -175,8 +175,7 @@ static const struct super_operations udf_sb_ops = {
175 .alloc_inode = udf_alloc_inode, 175 .alloc_inode = udf_alloc_inode,
176 .destroy_inode = udf_destroy_inode, 176 .destroy_inode = udf_destroy_inode,
177 .write_inode = udf_write_inode, 177 .write_inode = udf_write_inode,
178 .delete_inode = udf_delete_inode, 178 .evict_inode = udf_evict_inode,
179 .clear_inode = udf_clear_inode,
180 .put_super = udf_put_super, 179 .put_super = udf_put_super,
181 .sync_fs = udf_sync_fs, 180 .sync_fs = udf_sync_fs,
182 .statfs = udf_statfs, 181 .statfs = udf_statfs,
diff --git a/fs/udf/udfdecl.h b/fs/udf/udfdecl.h
index 2bac0354891f..6995ab1f4305 100644
--- a/fs/udf/udfdecl.h
+++ b/fs/udf/udfdecl.h
@@ -139,8 +139,7 @@ extern struct buffer_head *udf_expand_dir_adinicb(struct inode *, int *, int *);
139extern struct buffer_head *udf_bread(struct inode *, int, int, int *); 139extern struct buffer_head *udf_bread(struct inode *, int, int, int *);
140extern void udf_truncate(struct inode *); 140extern void udf_truncate(struct inode *);
141extern void udf_read_inode(struct inode *); 141extern void udf_read_inode(struct inode *);
142extern void udf_delete_inode(struct inode *); 142extern void udf_evict_inode(struct inode *);
143extern void udf_clear_inode(struct inode *);
144extern int udf_write_inode(struct inode *, struct writeback_control *wbc); 143extern int udf_write_inode(struct inode *, struct writeback_control *wbc);
145extern long udf_block_map(struct inode *, sector_t); 144extern long udf_block_map(struct inode *, sector_t);
146extern int udf_extend_file(struct inode *, struct extent_position *, 145extern int udf_extend_file(struct inode *, struct extent_position *,