aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs
diff options
context:
space:
mode:
authorEvgeniy Dushistov <dushistov@mail.ru>2006-06-25 08:47:26 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 13:01:03 -0400
commit50aa4eb0b978f4a0283471c776ed812269ac8af5 (patch)
treeeab23004eac1e89ea87f189c95bdb7c9dbe93ca3 /fs/ufs
parentdd187a2603d9904ddc410441348f0cfc558a5233 (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')
-rw-r--r--fs/ufs/balloc.c3
-rw-r--r--fs/ufs/truncate.c25
2 files changed, 12 insertions, 16 deletions
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index 7a4735f591bc..62193db34346 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -395,7 +395,6 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
395 if (result) { 395 if (result) {
396 *p = cpu_to_fs32(sb, result); 396 *p = cpu_to_fs32(sb, result);
397 *err = 0; 397 *err = 0;
398 inode->i_blocks += count << uspi->s_nspfshift;
399 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); 398 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
400 } 399 }
401 unlock_super(sb); 400 unlock_super(sb);
@@ -409,7 +408,6 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
409 result = ufs_add_fragments (inode, tmp, oldcount, newcount, err); 408 result = ufs_add_fragments (inode, tmp, oldcount, newcount, err);
410 if (result) { 409 if (result) {
411 *err = 0; 410 *err = 0;
412 inode->i_blocks += count << uspi->s_nspfshift;
413 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); 411 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
414 unlock_super(sb); 412 unlock_super(sb);
415 UFSD("EXIT, result %u\n", result); 413 UFSD("EXIT, result %u\n", result);
@@ -444,7 +442,6 @@ unsigned ufs_new_fragments(struct inode * inode, __fs32 * p, unsigned fragment,
444 442
445 *p = cpu_to_fs32(sb, result); 443 *p = cpu_to_fs32(sb, result);
446 *err = 0; 444 *err = 0;
447 inode->i_blocks += count << uspi->s_nspfshift;
448 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); 445 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);
449 unlock_super(sb); 446 unlock_super(sb);
450 if (newcount < request) 447 if (newcount < request)
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index 716183d834e7..b860a29c4ef2 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
120next1: 119next1:
@@ -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 }