patch-2.1.44 linux/fs/buffer.c

Next file: linux/fs/dcache.c
Previous file: linux/fs/binfmt_misc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.43/linux/fs/buffer.c linux/fs/buffer.c
@@ -495,17 +495,18 @@
 
 static inline struct buffer_head * find_buffer(kdev_t dev, int block, int size)
 {		
-	struct buffer_head * tmp;
-
-	for (tmp = hash(dev,block) ; tmp != NULL ; tmp = tmp->b_next)
-		if (tmp->b_blocknr == block && tmp->b_dev == dev) {
-			if (tmp->b_size == size)
-				return tmp;
+	struct buffer_head * next;
 
-			printk("VFS: Wrong blocksize on device %s\n",
-			       kdevname(dev));
-			return NULL;
-		}
+	next = hash(dev,block);
+	for (;;) {
+		struct buffer_head *tmp = next;
+		if (!next)
+			break;
+		next = tmp->b_next;
+		if (tmp->b_blocknr != block || tmp->b_size != size || tmp->b_dev != dev)
+			continue;
+		return tmp;
+	}
 	return NULL;
 }
 
@@ -518,10 +519,11 @@
  */
 struct buffer_head * get_hash_table(kdev_t dev, int block, int size)
 {
-	struct buffer_head * bh;
-
 	for (;;) {
-		if (!(bh=find_buffer(dev,block,size)))
+		struct buffer_head * bh;
+
+		bh=find_buffer(dev,block,size);
+		if (!bh)
 			return NULL;
 		bh->b_count++;
 		wait_on_buffer(bh);
@@ -1610,6 +1612,7 @@
 				 next->b_count--;
 			 }
 	}
+	run_task_queue(&tq_disk);
 #ifdef DEBUG
 	if (ncount) printk("sync_old_buffers: %d dirty buffers not on dirty list\n", ncount);
 	printk("Wrote %d/%d buffers\n", nwritten, ndirty);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov