patch-2.3.26 linux/fs/fat/file.c

Next file: linux/fs/fat/inode.c
Previous file: linux/fs/ext2/truncate.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.25/linux/fs/fat/file.c linux/fs/fat/file.c
@@ -182,6 +182,7 @@
 
 void fat_truncate(struct inode *inode)
 {
+	struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
 	int cluster;
 
 	/* Why no return value?  Surely the disk could fail... */
@@ -189,9 +190,9 @@
 		return /* -EPERM */;
 	if (IS_IMMUTABLE(inode))
 		return /* -EPERM */;
-	cluster = SECTOR_SIZE*MSDOS_SB(inode->i_sb)->cluster_size;
+	cluster = SECTOR_SIZE*sbi->cluster_size;
 	MSDOS_I(inode)->i_realsize = ((inode->i_size-1) | (SECTOR_SIZE-1)) + 1;
-	(void) fat_free(inode,(inode->i_size+(cluster-1))/cluster);
+	fat_free(inode,(inode->i_size+(cluster-1))>>sbi->cluster_bits);
 	MSDOS_I(inode)->i_attrs |= ATTR_ARCH;
 	inode->i_ctime = inode->i_mtime = CURRENT_TIME;
 	mark_inode_dirty(inode);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)