patch-2.2.18 linux/fs/ext2/truncate.c
Next file: linux/fs/fat/cache.c
Previous file: linux/fs/ext2/ioctl.c
Back to the patch index
Back to the overall index
- Lines: 78
- Date:
Mon Sep 11 17:37:18 2000
- Orig file:
v2.2.17/fs/ext2/truncate.c
- Orig date:
Fri Apr 21 12:46:42 2000
diff -u --new-file --recursive --exclude-from /usr/src/exclude v2.2.17/fs/ext2/truncate.c linux/fs/ext2/truncate.c
@@ -130,11 +130,7 @@
goto in_use;
if (bh->b_count == 1) {
- int tmp;
- if (ind_bh)
- tmp = le32_to_cpu(*p);
- else
- tmp = *p;
+ int tmp = le32_to_cpu(*p);
*p = 0;
inode->i_blocks -= (inode->i_sb->s_blocksize / 512);
mark_inode_dirty(inode);
@@ -170,7 +166,7 @@
for (i = direct_block ; i < EXT2_NDIR_BLOCKS ; i++) {
u32 * p = inode->u.ext2_i.i_data + i;
- int tmp = *p;
+ int tmp = le32_to_cpu(*p);
if (!tmp)
continue;
@@ -215,11 +211,11 @@
unsigned long block_to_free = 0, free_count = 0;
int indirect_block, addr_per_block, blocks;
- tmp = dind_bh ? le32_to_cpu(*p) : *p;
+ tmp = le32_to_cpu(*p);
if (!tmp)
return 0;
ind_bh = bread (inode->i_dev, tmp, inode->i_sb->s_blocksize);
- if (tmp != (dind_bh ? le32_to_cpu(*p) : *p)) {
+ if (tmp != le32_to_cpu(*p)) {
brelse (ind_bh);
return 1;
}
@@ -297,11 +293,11 @@
int i, tmp, retry = 0;
int dindirect_block, addr_per_block;
- tmp = tind_bh ? le32_to_cpu(*p) : *p;
+ tmp = le32_to_cpu(*p);
if (!tmp)
return 0;
dind_bh = bread (inode->i_dev, tmp, inode->i_sb->s_blocksize);
- if (tmp != (tind_bh ? le32_to_cpu(*p) : *p)) {
+ if (tmp != le32_to_cpu(*p)) {
brelse (dind_bh);
return 1;
}
@@ -346,7 +342,8 @@
if (!(tmp = *p))
return 0;
- tind_bh = bread (inode->i_dev, tmp, inode->i_sb->s_blocksize);
+ tind_bh = bread (inode->i_dev, le32_to_cpu(tmp),
+ inode->i_sb->s_blocksize);
if (tmp != *p) {
brelse (tind_bh);
return 1;
@@ -355,7 +352,7 @@
if (!tind_bh) {
ext2_error(inode->i_sb, "trunc_tindirect",
"Read failure, inode=%ld, block=%d",
- inode->i_ino, tmp);
+ inode->i_ino, le32_to_cpu(tmp));
*p = 0;
mark_inode_dirty(inode);
return 0;
@@ -391,6 +388,8 @@
return;
if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
return;
+
+ ext2_remove_suid(inode);
ext2_discard_prealloc(inode);
while (1) {
retry = trunc_direct(inode);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)