Commit 50aa4eb0b978f4a0283471c776ed812269ac8af5

Authored by Evgeniy Dushistov
Committed by Linus Torvalds
1 parent dd187a2603

[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>

Showing 2 changed files with 12 additions and 16 deletions Side-by-side Diff

... ... @@ -395,7 +395,6 @@
395 395 if (result) {
396 396 *p = cpu_to_fs32(sb, result);
397 397 *err = 0;
398   - inode->i_blocks += count << uspi->s_nspfshift;
399 398 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
400 399 }
401 400 unlock_super(sb);
... ... @@ -409,7 +408,6 @@
409 408 result = ufs_add_fragments (inode, tmp, oldcount, newcount, err);
410 409 if (result) {
411 410 *err = 0;
412   - inode->i_blocks += count << uspi->s_nspfshift;
413 411 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
414 412 unlock_super(sb);
415 413 UFSD("EXIT, result %u\n", result);
... ... @@ -444,7 +442,6 @@
444 442  
445 443 *p = cpu_to_fs32(sb, result);
446 444 *err = 0;
447   - inode->i_blocks += count << uspi->s_nspfshift;
448 445 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
449 446 unlock_super(sb);
450 447 if (newcount < request)
... ... @@ -112,9 +112,8 @@
112 112 frag1 = ufs_fragnum (frag1);
113 113 frag2 = ufs_fragnum (frag2);
114 114  
115   - inode->i_blocks -= (frag2-frag1) << uspi->s_nspfshift;
116   - mark_inode_dirty(inode);
117 115 ufs_free_fragments (inode, tmp + frag1, frag2 - frag1);
  116 + mark_inode_dirty(inode);
118 117 frag_to_free = tmp + frag1;
119 118  
120 119 next1:
... ... @@ -128,8 +127,7 @@
128 127 continue;
129 128  
130 129 *p = 0;
131   - inode->i_blocks -= uspi->s_nspb;
132   - mark_inode_dirty(inode);
  130 +
133 131 if (free_count == 0) {
134 132 frag_to_free = tmp;
135 133 free_count = uspi->s_fpb;
... ... @@ -140,6 +138,7 @@
140 138 frag_to_free = tmp;
141 139 free_count = uspi->s_fpb;
142 140 }
  141 + mark_inode_dirty(inode);
143 142 }
144 143  
145 144 if (free_count > 0)
146 145  
... ... @@ -158,9 +157,9 @@
158 157 frag4 = ufs_fragnum (frag4);
159 158  
160 159 *p = 0;
161   - inode->i_blocks -= frag4 << uspi->s_nspfshift;
162   - mark_inode_dirty(inode);
  160 +
163 161 ufs_free_fragments (inode, tmp, frag4);
  162 + mark_inode_dirty(inode);
164 163 next3:
165 164  
166 165 UFSD("EXIT\n");
... ... @@ -219,7 +218,7 @@
219 218 frag_to_free = tmp;
220 219 free_count = uspi->s_fpb;
221 220 }
222   - inode->i_blocks -= uspi->s_nspb;
  221 +
223 222 mark_inode_dirty(inode);
224 223 }
225 224  
226 225  
... ... @@ -232,9 +231,9 @@
232 231 if (i >= uspi->s_apb) {
233 232 tmp = fs32_to_cpu(sb, *p);
234 233 *p = 0;
235   - inode->i_blocks -= uspi->s_nspb;
236   - mark_inode_dirty(inode);
  234 +
237 235 ufs_free_blocks (inode, tmp, uspi->s_fpb);
  236 + mark_inode_dirty(inode);
238 237 ubh_bforget(ind_ubh);
239 238 ind_ubh = NULL;
240 239 }
241 240  
... ... @@ -295,9 +294,9 @@
295 294 if (i >= uspi->s_apb) {
296 295 tmp = fs32_to_cpu(sb, *p);
297 296 *p = 0;
298   - inode->i_blocks -= uspi->s_nspb;
  297 +
  298 + ufs_free_blocks(inode, tmp, uspi->s_fpb);
299 299 mark_inode_dirty(inode);
300   - ufs_free_blocks (inode, tmp, uspi->s_fpb);
301 300 ubh_bforget(dind_bh);
302 301 dind_bh = NULL;
303 302 }
304 303  
... ... @@ -355,9 +354,9 @@
355 354 if (i >= uspi->s_apb) {
356 355 tmp = fs32_to_cpu(sb, *p);
357 356 *p = 0;
358   - inode->i_blocks -= uspi->s_nspb;
  357 +
  358 + ufs_free_blocks(inode, tmp, uspi->s_fpb);
359 359 mark_inode_dirty(inode);
360   - ufs_free_blocks (inode, tmp, uspi->s_fpb);
361 360 ubh_bforget(tind_bh);
362 361 tind_bh = NULL;
363 362 }