diff options
Diffstat (limited to 'fs/udf/inode.c')
-rw-r--r-- | fs/udf/inode.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index e7533f785636..6d24c2c63f93 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -90,19 +90,16 @@ no_delete: | |||
90 | } | 90 | } |
91 | 91 | ||
92 | /* | 92 | /* |
93 | * If we are going to release inode from memory, we discard preallocation and | 93 | * If we are going to release inode from memory, we truncate last inode extent |
94 | * truncate last inode extent to proper length. We could use drop_inode() but | 94 | * to proper length. We could use drop_inode() but it's called under inode_lock |
95 | * it's called under inode_lock and thus we cannot mark inode dirty there. We | 95 | * and thus we cannot mark inode dirty there. We use clear_inode() but we have |
96 | * use clear_inode() but we have to make sure to write inode as it's not written | 96 | * to make sure to write inode as it's not written automatically. |
97 | * automatically. | ||
98 | */ | 97 | */ |
99 | void udf_clear_inode(struct inode *inode) | 98 | void udf_clear_inode(struct inode *inode) |
100 | { | 99 | { |
101 | struct udf_inode_info *iinfo; | 100 | struct udf_inode_info *iinfo; |
102 | if (!(inode->i_sb->s_flags & MS_RDONLY)) { | 101 | if (!(inode->i_sb->s_flags & MS_RDONLY)) { |
103 | lock_kernel(); | 102 | lock_kernel(); |
104 | /* Discard preallocation for directories, symlinks, etc. */ | ||
105 | udf_discard_prealloc(inode); | ||
106 | udf_truncate_tail_extent(inode); | 103 | udf_truncate_tail_extent(inode); |
107 | unlock_kernel(); | 104 | unlock_kernel(); |
108 | write_inode_now(inode, 0); | 105 | write_inode_now(inode, 0); |
@@ -664,8 +661,12 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block, | |||
664 | udf_split_extents(inode, &c, offset, newblocknum, laarr, &endnum); | 661 | udf_split_extents(inode, &c, offset, newblocknum, laarr, &endnum); |
665 | 662 | ||
666 | #ifdef UDF_PREALLOCATE | 663 | #ifdef UDF_PREALLOCATE |
667 | /* preallocate blocks */ | 664 | /* We preallocate blocks only for regular files. It also makes sense |
668 | udf_prealloc_extents(inode, c, lastblock, laarr, &endnum); | 665 | * for directories but there's a problem when to drop the |
666 | * preallocation. We might use some delayed work for that but I feel | ||
667 | * it's overengineering for a filesystem like UDF. */ | ||
668 | if (S_ISREG(inode->i_mode)) | ||
669 | udf_prealloc_extents(inode, c, lastblock, laarr, &endnum); | ||
669 | #endif | 670 | #endif |
670 | 671 | ||
671 | /* merge any continuous blocks in laarr */ | 672 | /* merge any continuous blocks in laarr */ |