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

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

diff -u --recursive --new-file v2.3.7/linux/fs/ext2/truncate.c linux/fs/ext2/truncate.c
@@ -158,7 +158,7 @@
 }
 
 #define DATA_BUFFER_USED(bh) \
-	((bh->b_count > 1) || buffer_locked(bh))
+	(bh->b_count || buffer_locked(bh))
 
 static int trunc_direct (struct inode * inode)
 {
@@ -177,12 +177,11 @@
 
 		bh = find_buffer(inode->i_dev, tmp, inode->i_sb->s_blocksize);
 		if (bh) {
-			bh->b_count++;
 			if (DATA_BUFFER_USED(bh)) {
-				brelse(bh);
 				retry = 1;
 				continue;
 			}
+			bh->b_count++;
 		}
 
 		*p = 0;
@@ -254,12 +253,11 @@
 		 */
 		bh = find_buffer(inode->i_dev, tmp, inode->i_sb->s_blocksize);
 		if (bh) {
-			bh->b_count++;
 			if (DATA_BUFFER_USED(bh)) {
-				brelse(bh);
 				retry = 1;
 				continue;
 			}
+			bh->b_count++;
 		}
 
 		*ind = 0;

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