summaryrefslogtreecommitdiffstats
path: root/fs/ufs/truncate.c
diff options
context:
space:
mode:
authorEvgeniy Dushistov <dushistov@mail.ru>2006-06-25 14:47:26 +0200
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-25 19:01:03 +0200
commit50aa4eb0b978f4a0283471c776ed812269ac8af5 (patch)
treeeab23004eac1e89ea87f189c95bdb7c9dbe93ca3 /fs/ufs/truncate.c
parent[PATCH] ufs: little directory lookup optimization (diff)
downloadlinux-50aa4eb0b978f4a0283471c776ed812269ac8af5.tar.xz
linux-50aa4eb0b978f4a0283471c776ed812269ac8af5.zip
[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.c25
1 files changed, 12 insertions, 13 deletions
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)
frag1 = ufs_fragnum (frag1);
frag2 = ufs_fragnum (frag2);
- inode->i_blocks -= (frag2-frag1) << uspi->s_nspfshift;
- mark_inode_dirty(inode);
ufs_free_fragments (inode, tmp + frag1, frag2 - frag1);
+ mark_inode_dirty(inode);
frag_to_free = tmp + frag1;
next1:
@@ -128,8 +127,7 @@ next1:
continue;
*p = 0;
- inode->i_blocks -= uspi->s_nspb;
- mark_inode_dirty(inode);
+
if (free_count == 0) {
frag_to_free = tmp;
free_count = uspi->s_fpb;
@@ -140,6 +138,7 @@ next1:
frag_to_free = tmp;
free_count = uspi->s_fpb;
}
+ mark_inode_dirty(inode);
}
if (free_count > 0)
@@ -158,9 +157,9 @@ next1:
frag4 = ufs_fragnum (frag4);
*p = 0;
- inode->i_blocks -= frag4 << uspi->s_nspfshift;
- mark_inode_dirty(inode);
+
ufs_free_fragments (inode, tmp, frag4);
+ mark_inode_dirty(inode);
next3:
UFSD("EXIT\n");
@@ -219,7 +218,7 @@ static int ufs_trunc_indirect (struct inode * inode, unsigned offset, __fs32 *p)
frag_to_free = tmp;
free_count = uspi->s_fpb;
}
- inode->i_blocks -= uspi->s_nspb;
+
mark_inode_dirty(inode);
}
@@ -232,9 +231,9 @@ static int ufs_trunc_indirect (struct inode * inode, unsigned offset, __fs32 *p)
if (i >= uspi->s_apb) {
tmp = fs32_to_cpu(sb, *p);
*p = 0;
- inode->i_blocks -= uspi->s_nspb;
- mark_inode_dirty(inode);
+
ufs_free_blocks (inode, tmp, uspi->s_fpb);
+ mark_inode_dirty(inode);
ubh_bforget(ind_ubh);
ind_ubh = NULL;
}
@@ -295,9 +294,9 @@ static int ufs_trunc_dindirect (struct inode *inode, unsigned offset, __fs32 *p)
if (i >= uspi->s_apb) {
tmp = fs32_to_cpu(sb, *p);
*p = 0;
- inode->i_blocks -= uspi->s_nspb;
+
+ ufs_free_blocks(inode, tmp, uspi->s_fpb);
mark_inode_dirty(inode);
- ufs_free_blocks (inode, tmp, uspi->s_fpb);
ubh_bforget(dind_bh);
dind_bh = NULL;
}
@@ -355,9 +354,9 @@ static int ufs_trunc_tindirect (struct inode * inode)
if (i >= uspi->s_apb) {
tmp = fs32_to_cpu(sb, *p);
*p = 0;
- inode->i_blocks -= uspi->s_nspb;
+
+ ufs_free_blocks(inode, tmp, uspi->s_fpb);
mark_inode_dirty(inode);
- ufs_free_blocks (inode, tmp, uspi->s_fpb);
ubh_bforget(tind_bh);
tind_bh = NULL;
}