aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs/balloc.c
diff options
context:
space:
mode:
authorEvgeniy Dushistov <dushistov@mail.ru>2007-03-16 17:38:09 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-03-16 22:25:03 -0400
commit4b25a37e2093146c1f9aa436b832b7d4ef880ca4 (patch)
tree435db82996e6114eea94f8315c699c7c9904615b /fs/ufs/balloc.c
parent5431bf97ce69065ed07de1ff12543d0800817b83 (diff)
[PATCH] ufs: zeroize the rest of block in truncate
This patch fix behaviour in such test scenario: lseek(fd, BIG_OFFSET) write(fd, buf, sizeof(buf)) truncate(BIG_OFFSET) truncate(BIG_OFFSET + sizeof(buf)) read(fd, buf...) Because of if file big enough(BIG_OFFSET) we start allocate space by block, ordinary block size > page size, so we should zeroize the rest of block in truncate(except last framgnet, about which VFS should care), to not get garbage, when we extend file. Also patch corrects conversion from pointer to block to physical block number, this helps in case of not common used UFS types. And add to debug output inode number. Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ufs/balloc.c')
-rw-r--r--fs/ufs/balloc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index b8fa34af87cc..841ac25fd950 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -482,8 +482,9 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
482 if (result) { 482 if (result) {
483 ufs_clear_frags(inode, result + oldcount, newcount - oldcount, 483 ufs_clear_frags(inode, result + oldcount, newcount - oldcount,
484 locked_page != NULL); 484 locked_page != NULL);
485 ufs_change_blocknr(inode, fragment - oldcount, oldcount, tmp, 485 ufs_change_blocknr(inode, fragment - oldcount, oldcount,
486 result, locked_page); 486 uspi->s_sbbase + tmp,
487 uspi->s_sbbase + result, locked_page);
487 ufs_cpu_to_data_ptr(sb, p, result); 488 ufs_cpu_to_data_ptr(sb, p, result);
488 *err = 0; 489 *err = 0;
489 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count); 490 UFS_I(inode)->i_lastfrag = max_t(u32, UFS_I(inode)->i_lastfrag, fragment + count);