patch-1.3.9 linux/fs/ext2/truncate.c

Next file: linux/fs/hpfs/Makefile
Previous file: linux/fs/ext2/super.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.8/linux/fs/ext2/truncate.c linux/fs/ext2/truncate.c
@@ -354,9 +354,10 @@
 	 * zeroed in case it ever becomes accessible again because of
 	 * subsequent file growth.
 	 */
-	offset = inode->i_size % inode->i_sb->s_blocksize;
+	offset = inode->i_size & (inode->i_sb->s_blocksize - 1);
 	if (offset) {
-		bh = ext2_bread (inode, inode->i_size / inode->i_sb->s_blocksize,
+		bh = ext2_bread (inode,
+				 inode->i_size >> EXT2_BLOCK_SIZE_BITS(inode->i_sb),
 				 0, &err);
 		if (bh) {
 			memset (bh->b_data + offset, 0,

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov with Sam's (original) version
of this