patch-1.3.16 linux/fs/buffer.c

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

diff -u --recursive --new-file v1.3.15/linux/fs/buffer.c linux/fs/buffer.c
@@ -720,8 +720,9 @@
 	bh->b_dirt=0;
 	bh->b_lock=0;
 	bh->b_uptodate=0;
-	bh->b_flushtime = 0;
+	bh->b_flushtime=0;
 	bh->b_req=0;
+	bh->b_reuse=0;
 	bh->b_dev=dev;
 	bh->b_blocknr=block;
 	insert_into_queues(bh);
@@ -788,6 +789,15 @@
 		if (--buf->b_count)
 			return;
 		wake_up(&buffer_wait);
+		if (buf->b_reuse) {
+			if (!buf->b_lock && !buf->b_dirt && !buf->b_wait) {
+			    	buf->b_reuse = 0;
+				if(buf->b_dev == 0xffff) panic("brelse: Wrong list");
+				remove_from_queues(buf);
+				buf->b_dev = 0xffff;
+				put_last_free(buf);
+			}
+		}
 		return;
 	}
 	printk("VFS: brelse: Trying to free free buffer\n");

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