diff options
author | Evgeniy Dushistov <dushistov@mail.ru> | 2006-06-25 08:47:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:01:03 -0400 |
commit | 50aa4eb0b978f4a0283471c776ed812269ac8af5 (patch) | |
tree | eab23004eac1e89ea87f189c95bdb7c9dbe93ca3 /fs/ufs/truncate.c | |
parent | dd187a2603d9904ddc410441348f0cfc558a5233 (diff) |
[PATCH] ufs: i_blocks wrong count
At now UFS code uses DQUOT_* mechanism, but it also update inode->i_blocks
manually, this cause wrong i_blocks value.
Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/ufs/truncate.c')
-rw-r--r-- | fs/ufs/truncate.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c index 716183d834e..b860a29c4ef 100644 --- a/fs/ufs/truncate.c +++ b/fs/ufs/truncate.c | |||
@@ -112,9 +112,8 @@ static int ufs_trunc_direct (struct inode * inode) | |||
112 | frag1 = ufs_fragnum (frag1); | 112 | frag1 = ufs_fragnum (frag1); |
113 | frag2 = ufs_fragnum (frag2); | 113 | frag2 = ufs_fragnum (frag2); |
114 | 114 | ||
115 | inode->i_blocks -= (frag2-frag1) << uspi->s_nspfshift; | ||
116 | mark_inode_dirty(inode); | ||
117 | ufs_free_fragments (inode, tmp + frag1, frag2 - frag1); | 115 | ufs_free_fragments (inode, tmp + frag1, frag2 - frag1); |
116 | mark_inode_dirty(inode); | ||
118 | frag_to_free = tmp + frag1; | 117 | frag_to_free = tmp + frag1; |
119 | 118 | ||
120 | next1: | 119 | next1: |
@@ -128,8 +127,7 @@ next1: | |||
128 | continue; | 127 | continue; |
129 | 128 | ||
130 | *p = 0; | 129 | *p = 0; |
131 | inode->i_blocks -= uspi->s_nspb; | 130 | |
132 | mark_inode_dirty(inode); | ||
133 | if (free_count == 0) { | 131 | if (free_count == 0) { |
134 | frag_to_free = tmp; | 132 | frag_to_free = tmp; |
135 | free_count = uspi->s_fpb; | 133 | free_count = uspi->s_fpb; |
@@ -140,6 +138,7 @@ next1: | |||
140 | frag_to_free = tmp; | 138 | frag_to_free = tmp; |
141 | free_count = uspi->s_fpb; | 139 | free_count = uspi->s_fpb; |
142 | } | 140 | } |
141 | mark_inode_dirty(inode); | ||
143 | } | 142 | } |
144 | 143 | ||
145 | if (free_count > 0) | 144 | if (free_count > 0) |
@@ -158,9 +157,9 @@ next1: | |||
158 | frag4 = ufs_fragnum (frag4); | 157 | frag4 = ufs_fragnum (frag4); |
159 | 158 | ||
160 | *p = 0; | 159 | *p = 0; |
161 | inode->i_blocks -= frag4 << uspi->s_nspfshift; | 160 | |
162 | mark_inode_dirty(inode); | ||
163 | ufs_free_fragments (inode, tmp, frag4); | 161 | ufs_free_fragments (inode, tmp, frag4); |
162 | mark_inode_dirty(inode); | ||
164 | next3: | 163 | next3: |
165 | 164 | ||
166 | UFSD("EXIT\n"); | 165 | UFSD("EXIT\n"); |
@@ -219,7 +218,7 @@ static int ufs_trunc_indirect (struct inode * inode, unsigned offset, __fs32 *p) | |||
219 | frag_to_free = tmp; | 218 | frag_to_free = tmp; |
220 | free_count = uspi->s_fpb; | 219 | free_count = uspi->s_fpb; |
221 | } | 220 | } |
222 | inode->i_blocks -= uspi->s_nspb; | 221 | |
223 | mark_inode_dirty(inode); | 222 | mark_inode_dirty(inode); |
224 | } | 223 | } |
225 | 224 | ||
@@ -232,9 +231,9 @@ static int ufs_trunc_indirect (struct inode * inode, unsigned offset, __fs32 *p) | |||
232 | if (i >= uspi->s_apb) { | 231 | if (i >= uspi->s_apb) { |
233 | tmp = fs32_to_cpu(sb, *p); | 232 | tmp = fs32_to_cpu(sb, *p); |
234 | *p = 0; | 233 | *p = 0; |
235 | inode->i_blocks -= uspi->s_nspb; | 234 | |
236 | mark_inode_dirty(inode); | ||
237 | ufs_free_blocks (inode, tmp, uspi->s_fpb); | 235 | ufs_free_blocks (inode, tmp, uspi->s_fpb); |
236 | mark_inode_dirty(inode); | ||
238 | ubh_bforget(ind_ubh); | 237 | ubh_bforget(ind_ubh); |
239 | ind_ubh = NULL; | 238 | ind_ubh = NULL; |
240 | } | 239 | } |
@@ -295,9 +294,9 @@ static int ufs_trunc_dindirect (struct inode *inode, unsigned offset, __fs32 *p) | |||
295 | if (i >= uspi->s_apb) { | 294 | if (i >= uspi->s_apb) { |
296 | tmp = fs32_to_cpu(sb, *p); | 295 | tmp = fs32_to_cpu(sb, *p); |
297 | *p = 0; | 296 | *p = 0; |
298 | inode->i_blocks -= uspi->s_nspb; | 297 | |
298 | ufs_free_blocks(inode, tmp, uspi->s_fpb); | ||
299 | mark_inode_dirty(inode); | 299 | mark_inode_dirty(inode); |
300 | ufs_free_blocks (inode, tmp, uspi->s_fpb); | ||
301 | ubh_bforget(dind_bh); | 300 | ubh_bforget(dind_bh); |
302 | dind_bh = NULL; | 301 | dind_bh = NULL; |
303 | } | 302 | } |
@@ -355,9 +354,9 @@ static int ufs_trunc_tindirect (struct inode * inode) | |||
355 | if (i >= uspi->s_apb) { | 354 | if (i >= uspi->s_apb) { |
356 | tmp = fs32_to_cpu(sb, *p); | 355 | tmp = fs32_to_cpu(sb, *p); |
357 | *p = 0; | 356 | *p = 0; |
358 | inode->i_blocks -= uspi->s_nspb; | 357 | |
358 | ufs_free_blocks(inode, tmp, uspi->s_fpb); | ||
359 | mark_inode_dirty(inode); | 359 | mark_inode_dirty(inode); |
360 | ufs_free_blocks (inode, tmp, uspi->s_fpb); | ||
361 | ubh_bforget(tind_bh); | 360 | ubh_bforget(tind_bh); |
362 | tind_bh = NULL; | 361 | tind_bh = NULL; |
363 | } | 362 | } |