Skip to contentSkip to conversation

PATCH tinny confusion cleanup in 2.4.3

PATCH Martin Dalecki 1 participant 1 message Apr 18, 2001

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hello!

The attached patch remove the get_hardblock_size() function entierly from the kernel. This is due to the fact that this function is compleatly
unneccessary due to the existance of get_hardsect_size(), which got introduced to properly encapsulate acesses to the hardsec_size[]. As a side effect this is reducing the number of module call-entrypoints by one, which is a Good Thing TM.

Plase just apply it...

fs/buffer.c +0 -19
diff -urN linux/fs/buffer.c linux-new/fs/buffer.c
@@ -555,25 +555,6 @@
 	return bh;
 }
 
-unsigned int get_hardblocksize(kdev_t dev)
-{
-	/*
-	 * 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) {
-		int 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 buffer_insert_inode_queue(struct buffer_head *bh, struct inode *inode)
 {
 	spin_lock(&lru_list_lock);
fs/ext2/super.c +6 -9
diff -urN linux/fs/ext2/super.c linux-new/fs/ext2/super.c
@@ -24,6 +24,7 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/locks.h>
+#include <linux/blkdev.h>
 #include <asm/uaccess.h>
 
 
@@ -404,11 +405,9 @@
 	 * This is important for devices that have a hardware
 	 * sectorsize that is larger than the default.
 	 */
-	blocksize = get_hardblocksize(dev);
-	if( blocksize == 0 || blocksize < BLOCK_SIZE )
-	  {
+	blocksize = get_hardsect_size(dev);
+	if(blocksize < BLOCK_SIZE )
 	    blocksize = BLOCK_SIZE;
-	  }
 
 	sb->u.ext2_sb.s_mount_opt = 0;
 	if (!parse_options ((char *) data, &sb_block, &resuid, &resgid,
@@ -482,11 +481,9 @@
 		 * Make sure the blocksize for the filesystem is larger
 		 * than the hardware sectorsize for the machine.
 		 */
-		hblock = get_hardblocksize(dev);
-		if(    (hblock != 0)
-		    && (sb->s_blocksize < hblock) )
-		{
-			printk("EXT2-fs: blocksize too small for device.\n");
+		hblock = get_hardsect_size(dev);
+		if (sb->s_blocksize < hblock) {
+			printk(KERN_ERR "EXT2-fs: blocksize too small for device.\n");
 			goto failed_mount;
 		}
 
fs/isofs/inode.c +15 -14
diff -urN linux/fs/isofs/inode.c linux-new/fs/isofs/inode.c
@@ -27,6 +27,7 @@
 #include <linux/nls.h>
 #include <linux/ctype.h>
 #include <linux/smp_lock.h>
+#include <linux/blkdev.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -493,21 +494,21 @@
 	printk("iocharset = %s\n", opt.iocharset);
 #endif
 
- 	/*
- 	 * First of all, get the hardware blocksize for this device.
- 	 * If we don't know what it is, or the hardware blocksize is
- 	 * larger than the blocksize the user specified, then use
- 	 * that value.
- 	 */
- 	blocksize = get_hardblocksize(dev);
- 	if(blocksize > opt.blocksize) {
- 	    /*
- 	     * Force the blocksize we are going to use to be the
- 	     * hardware blocksize.
- 	     */
- 	    opt.blocksize = blocksize;
+	/*
+	 * First of all, get the hardware blocksize for this device.
+	 * If we don't know what it is, or the hardware blocksize is
+	 * larger than the blocksize the user specified, then use
+	 * that value.
+	 */
+	blocksize = get_hardsect_size(dev);
+	if(blocksize > opt.blocksize) {
+	    /*
+	     * Force the blocksize we are going to use to be the
+	     * hardware blocksize.
+	     */
+	    opt.blocksize = blocksize;
 	}
- 
+
 	blocksize_bits = 0;
 	{
 	  int i = opt.blocksize;
fs/minix/inode.c +4 -3
diff -urN linux/fs/minix/inode.c linux-new/fs/minix/inode.c
@@ -21,6 +21,7 @@
 #include <linux/init.h>
 #include <linux/smp_lock.h>
 #include <linux/highuid.h>
+#include <linux/blkdev.h>
 
 #include <asm/system.h>
 #include <asm/bitops.h>
@@ -179,7 +180,7 @@
 	const char * errmsg;
 	struct inode *root_inode;
 	unsigned int hblock;
-	
+
 	/* N.B. These should be compile-time tests.
 	   Unfortunately that is impossible. */
 	if (32 != sizeof (struct minix_inode))
@@ -187,8 +188,8 @@
 	if (64 != sizeof(struct minix2_inode))
 		panic("bad V2 i-node size");
 
-	hblock = get_hardblocksize(dev);
-	if (hblock && hblock > BLOCK_SIZE)
+	hblock = get_hardsect_size(dev);
+	if (hblock > BLOCK_SIZE)
 		goto out_bad_hblock;
 
 	set_blocksize(dev, BLOCK_SIZE);
fs/udf/super.c +1 -2
diff -urN linux/fs/udf/super.c linux-new/fs/udf/super.c
@@ -344,8 +344,7 @@
 udf_set_blocksize(struct super_block *sb, int bsize)
 {
 	/* Use specified block size if specified */
-	if (!(sb->s_blocksize = get_hardblocksize(sb->s_dev)))
-		sb->s_blocksize = 2048;
+	sb->s_blocksize = get_hardsect_size(sb->s_dev);
 	if (bsize > sb->s_blocksize)
 		sb->s_blocksize = bsize;
 
include/linux/fs.h +0 -1
diff -urN linux/include/linux/fs.h linux-new/include/linux/fs.h
@@ -1249,7 +1249,6 @@
 		__bforget(buf);
 }
 extern void set_blocksize(kdev_t, int);
-extern unsigned int get_hardblocksize(kdev_t);
 extern struct buffer_head * bread(kdev_t, int, int);
 extern void wakeup_bdflush(int wait);
 
kernel/ksyms.c +0 -1
diff -urN linux/kernel/ksyms.c linux-new/kernel/ksyms.c
@@ -182,7 +182,6 @@
 EXPORT_SYMBOL(inode_change_ok);
 EXPORT_SYMBOL(write_inode_now);
 EXPORT_SYMBOL(notify_change);
-EXPORT_SYMBOL(get_hardblocksize);
 EXPORT_SYMBOL(set_blocksize);
 EXPORT_SYMBOL(getblk);
 EXPORT_SYMBOL(bdget);