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

Next file: linux/fs/file_table.c
Previous file: linux/fs/buffer.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.15/linux/fs/ext2/truncate.c linux/fs/ext2/truncate.c
@@ -85,6 +85,10 @@
 			memset(bh->b_data, RANDOM_INT, inode->i_sb->s_blocksize);
 			mark_buffer_dirty(bh, 1);
 		}
+		else if (bh) {
+			mark_buffer_clean(bh);
+			bh->b_reuse = 1;
+		}
 		brelse (bh);
 		if (free_count == 0) {
 			block_to_free = tmp;
@@ -160,6 +164,10 @@
 			memset(bh->b_data, RANDOM_INT, inode->i_sb->s_blocksize);
 			mark_buffer_dirty(bh, 1);
 		}
+		else if (bh) {
+			mark_buffer_clean(bh);
+			bh->b_reuse = 1;
+		}
 		brelse (bh);
 		if (free_count == 0) {
 			block_to_free = tmp;
@@ -185,6 +193,7 @@
 		if (ind_bh->b_count != 1)
 			retry = 1;
 		else {
+			ind_bh->b_reuse = 1;
 			tmp = *p;
 			*p = 0;
 			inode->i_blocks -= blocks;
@@ -245,6 +254,7 @@
 		if (dind_bh->b_count != 1)
 			retry = 1;
 		else {
+			dind_bh->b_reuse = 1;
 			tmp = *p;
 			*p = 0;
 			inode->i_blocks -= blocks;
@@ -304,6 +314,7 @@
 		if (tind_bh->b_count != 1)
 			retry = 1;
 		else {
+			tind_bh->b_reuse = 1;
 			tmp = *p;
 			*p = 0;
 			inode->i_blocks -= blocks;

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