patch-2.1.32 linux/fs/buffer.c

Next file: linux/fs/exec.c
Previous file: linux/fs/binfmt_em86.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.31/linux/fs/buffer.c linux/fs/buffer.c
@@ -29,6 +29,7 @@
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
 #include <linux/vmalloc.h>
+#include <linux/blkdev.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -498,6 +499,31 @@
 	}
 }
 
+unsigned int get_hardblocksize(kdev_t dev)
+{
+  int blksize = 0;
+
+  /*
+   * Get the hard sector size for the given device.  If we don't know
+   * what it is, return 0.
+   */
+
+  if (hardsect_size[MAJOR(dev)] != NULL)
+    {
+      blksize = hardsect_size[MAJOR(dev)][MINOR(dev)];
+      if (blksize != 0)
+	{
+	  return blksize;
+	}
+  }
+
+  /*
+   * We don't know what the hardware sector size for this device is.
+   * Return 0 indicating that we don't know.
+   */
+  return 0;
+}
+
 void set_blocksize(kdev_t dev, int size)
 {
 	extern int *blksize_size[];
@@ -979,17 +1005,15 @@
 static inline void recover_reusable_buffer_heads(void)
 {
 	if (reuse_list) {
-		struct buffer_head *bh;
-		unsigned long flags;
+		struct buffer_head *head;
+
+		head = xchg(&reuse_list, NULL);
 	
-		save_flags(flags);
 		do {
-			cli();
-			bh = reuse_list;
-			reuse_list = bh->b_next_free;
-			restore_flags(flags);
+			struct buffer_head *bh = head;
+			head = head->b_next_free;
 			put_unused_buffer_head(bh);
-		} while (reuse_list);
+		} while (head);
 	}
 }
 

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