Ver Fonte

Merge branch 'net-const'

Jeff Garzik há 19 anos atrás
pai
commit
46153552b4
97 ficheiros alterados com 950 adições e 808 exclusões
  1. 3 2
      arch/mips/kernel/time.c
  2. 21 3
      drivers/char/pcmcia/cm4000_cs.c
  3. 20 3
      drivers/char/pcmcia/cm4040_cs.c
  4. 1 0
      drivers/ide/legacy/ide-cs.c
  5. 10 12
      drivers/mtd/redboot.c
  6. 2 2
      drivers/net/3c59x.c
  7. 1 1
      drivers/net/8139cp.c
  8. 2 2
      drivers/net/8139too.c
  9. 5 5
      drivers/net/bnx2.c
  10. 42 42
      drivers/net/bnx2_fw.h
  11. 1 1
      drivers/net/bonding/bond_alb.c
  12. 1 1
      drivers/net/bonding/bond_main.c
  13. 1 1
      drivers/net/chelsio/subr.c
  14. 1 1
      drivers/net/dgrs.c
  15. 2 2
      drivers/net/dgrs_firmware.c
  16. 2 2
      drivers/net/dl2k.c
  17. 2 2
      drivers/net/eepro100.c
  18. 2 2
      drivers/net/epic100.c
  19. 1 1
      drivers/net/fealnx.c
  20. 1 1
      drivers/net/hamachi.c
  21. 2 2
      drivers/net/natsemi.c
  22. 1 1
      drivers/net/ne2k-pci.c
  23. 1 1
      drivers/net/ns83820.c
  24. 1 1
      drivers/net/pcmcia/3c574_cs.c
  25. 1 1
      drivers/net/pcmcia/3c589_cs.c
  26. 1 0
      drivers/net/pcmcia/axnet_cs.c
  27. 1 1
      drivers/net/pcmcia/fmvj18x_cs.c
  28. 1 1
      drivers/net/pcmcia/nmclan_cs.c
  29. 1 1
      drivers/net/pcmcia/pcnet_cs.c
  30. 2 2
      drivers/net/pcmcia/smc91c92_cs.c
  31. 1 1
      drivers/net/pcmcia/xirc2ps_cs.c
  32. 3 3
      drivers/net/pcnet32.c
  33. 1 1
      drivers/net/phy/phy.c
  34. 2 2
      drivers/net/plip.c
  35. 1 1
      drivers/net/ppp_synctty.c
  36. 2 2
      drivers/net/r8169.c
  37. 4 4
      drivers/net/s2io.c
  38. 1 1
      drivers/net/sb1000.c
  39. 1 1
      drivers/net/sis190.c
  40. 4 4
      drivers/net/sis900.c
  41. 7 7
      drivers/net/skfp/fplustm.c
  42. 2 2
      drivers/net/skfp/pcmplc.c
  43. 1 1
      drivers/net/skfp/skfddi.c
  44. 2 2
      drivers/net/starfire.c
  45. 2 2
      drivers/net/sundance.c
  46. 1 1
      drivers/net/sungem_phy.c
  47. 2 2
      drivers/net/tg3.c
  48. 1 1
      drivers/net/typhoon.c
  49. 4 1
      drivers/net/wireless/hostap/hostap_cs.c
  50. 3 3
      drivers/net/yellowfin.c
  51. 22 18
      drivers/pcmcia/ds.c
  52. 52 33
      drivers/scsi/aha152x.c
  53. 1 1
      drivers/scsi/aha152x.h
  54. 0 21
      drivers/scsi/jazz_esp.c
  55. 15 14
      drivers/scsi/megaraid/megaraid_sas.c
  56. 1 3
      drivers/scsi/pcmcia/aha152x_stub.c
  57. 2 2
      drivers/scsi/scsi_error.c
  58. 1 1
      drivers/scsi/scsi_lib.c
  59. 14 2
      drivers/scsi/scsi_scan.c
  60. 1 2
      drivers/scsi/scsi_transport_fc.c
  61. 1 1
      drivers/scsi/sg.c
  62. 2 0
      drivers/scsi/sym53c8xx_2/sym_hipd.c
  63. 12 133
      fs/9p/fid.c
  64. 2 4
      fs/9p/fid.h
  65. 1 0
      fs/9p/v9fs.c
  66. 1 0
      fs/9p/v9fs_vfs.h
  67. 8 37
      fs/9p/vfs_dentry.c
  68. 40 66
      fs/9p/vfs_file.c
  69. 312 166
      fs/9p/vfs_inode.c
  70. 8 3
      fs/9p/vfs_super.c
  71. 1 0
      fs/ocfs2/cluster/masklog.c
  72. 1 1
      fs/ocfs2/cluster/masklog.h
  73. 3 1
      fs/ocfs2/cluster/nodemanager.c
  74. 12 2
      fs/ocfs2/cluster/tcp.c
  75. 0 5
      fs/ocfs2/cluster/tcp.h
  76. 3 5
      fs/ocfs2/dlm/dlmcommon.h
  77. 5 7
      fs/ocfs2/dlm/dlmdebug.c
  78. 19 20
      fs/ocfs2/dlm/dlmdomain.c
  79. 2 2
      fs/ocfs2/dlm/dlmmaster.c
  80. 12 11
      fs/ocfs2/dlm/dlmrecovery.c
  81. 36 2
      fs/ocfs2/extent_map.c
  82. 1 50
      fs/ocfs2/file.c
  83. 1 0
      fs/ocfs2/heartbeat.c
  84. 45 1
      fs/ocfs2/inode.c
  85. 93 31
      fs/ocfs2/journal.c
  86. 4 3
      fs/ocfs2/ocfs2.h
  87. 0 1
      fs/ocfs2/ocfs2_fs.h
  88. 11 0
      fs/ocfs2/super.c
  89. 7 7
      fs/reiserfs/file.c
  90. 2 6
      fs/reiserfs/inode.c
  91. 1 2
      fs/reiserfs/journal.c
  92. 1 0
      include/asm-powerpc/eeh.h
  93. 9 0
      include/pcmcia/device_id.h
  94. 1 1
      kernel/sysctl.c
  95. 2 2
      kernel/timer.c
  96. 2 1
      mm/mempolicy.c
  97. 2 1
      mm/oom_kill.c

+ 3 - 2
arch/mips/kernel/time.c

@@ -163,7 +163,7 @@ void do_gettimeofday(struct timeval *tv)
 	unsigned long seq;
 	unsigned long seq;
 	unsigned long lost;
 	unsigned long lost;
 	unsigned long usec, sec;
 	unsigned long usec, sec;
-	unsigned long max_ntp_tick = tick_usec - tickadj;
+	unsigned long max_ntp_tick;
 
 
 	do {
 	do {
 		seq = read_seqbegin(&xtime_lock);
 		seq = read_seqbegin(&xtime_lock);
@@ -178,12 +178,13 @@ void do_gettimeofday(struct timeval *tv)
 		 * Better to lose some accuracy than have time go backwards..
 		 * Better to lose some accuracy than have time go backwards..
 		 */
 		 */
 		if (unlikely(time_adjust < 0)) {
 		if (unlikely(time_adjust < 0)) {
+			max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj;
 			usec = min(usec, max_ntp_tick);
 			usec = min(usec, max_ntp_tick);
 
 
 			if (lost)
 			if (lost)
 				usec += lost * max_ntp_tick;
 				usec += lost * max_ntp_tick;
 		} else if (unlikely(lost))
 		} else if (unlikely(lost))
-			usec += lost * tick_usec;
+			usec += lost * (USEC_PER_SEC / HZ);
 
 
 		sec = xtime.tv_sec;
 		sec = xtime.tv_sec;
 		usec += (xtime.tv_nsec / 1000);
 		usec += (xtime.tv_nsec / 1000);

+ 21 - 3
drivers/char/pcmcia/cm4000_cs.c

@@ -13,11 +13,12 @@
   *
   *
   * (C) 2000,2001,2002,2003,2004 Omnikey AG
   * (C) 2000,2001,2002,2003,2004 Omnikey AG
   *
   *
-  * (C) 2005 Harald Welte <laforge@gnumonks.org>
+  * (C) 2005-2006 Harald Welte <laforge@gnumonks.org>
   * 	- Adhere to Kernel CodingStyle
   * 	- Adhere to Kernel CodingStyle
   * 	- Port to 2.6.13 "new" style PCMCIA
   * 	- Port to 2.6.13 "new" style PCMCIA
   * 	- Check for copy_{from,to}_user return values
   * 	- Check for copy_{from,to}_user return values
   * 	- Use nonseekable_open()
   * 	- Use nonseekable_open()
+  * 	- add class interface for udev device creation
   *
   *
   * All rights reserved. Licensed under dual BSD/GPL license.
   * All rights reserved. Licensed under dual BSD/GPL license.
   */
   */
@@ -56,7 +57,7 @@ module_param(pc_debug, int, 0600);
 #else
 #else
 #define DEBUGP(n, rdr, x, args...)
 #define DEBUGP(n, rdr, x, args...)
 #endif
 #endif
-static char *version = "cm4000_cs.c v2.4.0gm5 - All bugs added by Harald Welte";
+static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte";
 
 
 #define	T_1SEC		(HZ)
 #define	T_1SEC		(HZ)
 #define	T_10MSEC	msecs_to_jiffies(10)
 #define	T_10MSEC	msecs_to_jiffies(10)
@@ -156,6 +157,7 @@ struct cm4000_dev {
 		/*queue*/ 4*sizeof(wait_queue_head_t))
 		/*queue*/ 4*sizeof(wait_queue_head_t))
 
 
 static dev_link_t *dev_table[CM4000_MAX_DEV];
 static dev_link_t *dev_table[CM4000_MAX_DEV];
+static struct class *cmm_class;
 
 
 /* This table doesn't use spaces after the comma between fields and thus
 /* This table doesn't use spaces after the comma between fields and thus
  * violates CodingStyle.  However, I don't really think wrapping it around will
  * violates CodingStyle.  However, I don't really think wrapping it around will
@@ -1937,6 +1939,9 @@ static int cm4000_attach(struct pcmcia_device *p_dev)
 	link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
 	link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
 	cm4000_config(link, i);
 	cm4000_config(link, i);
 
 
+	class_device_create(cmm_class, NULL, MKDEV(major, i), NULL,
+			    "cmm%d", i);
+
 	return 0;
 	return 0;
 }
 }
 
 
@@ -1962,6 +1967,8 @@ static void cm4000_detach(struct pcmcia_device *p_dev)
 	dev_table[devno] = NULL;
 	dev_table[devno] = NULL;
  	kfree(dev);
  	kfree(dev);
 
 
+	class_device_destroy(cmm_class, MKDEV(major, devno));
+
 	return;
 	return;
 }
 }
 
 
@@ -1995,8 +2002,18 @@ static struct pcmcia_driver cm4000_driver = {
 
 
 static int __init cmm_init(void)
 static int __init cmm_init(void)
 {
 {
+	int rc;
+
 	printk(KERN_INFO "%s\n", version);
 	printk(KERN_INFO "%s\n", version);
-	pcmcia_register_driver(&cm4000_driver);
+
+	cmm_class = class_create(THIS_MODULE, "cardman_4000");
+	if (!cmm_class)
+		return -1;
+
+	rc = pcmcia_register_driver(&cm4000_driver);
+	if (rc < 0)
+		return rc;
+
 	major = register_chrdev(0, DEVICE_NAME, &cm4000_fops);
 	major = register_chrdev(0, DEVICE_NAME, &cm4000_fops);
 	if (major < 0) {
 	if (major < 0) {
 		printk(KERN_WARNING MODULE_NAME
 		printk(KERN_WARNING MODULE_NAME
@@ -2012,6 +2029,7 @@ static void __exit cmm_exit(void)
 	printk(KERN_INFO MODULE_NAME ": unloading\n");
 	printk(KERN_INFO MODULE_NAME ": unloading\n");
 	pcmcia_unregister_driver(&cm4000_driver);
 	pcmcia_unregister_driver(&cm4000_driver);
 	unregister_chrdev(major, DEVICE_NAME);
 	unregister_chrdev(major, DEVICE_NAME);
+	class_destroy(cmm_class);
 };
 };
 
 
 module_init(cmm_init);
 module_init(cmm_init);

+ 20 - 3
drivers/char/pcmcia/cm4040_cs.c

@@ -3,12 +3,13 @@
  *
  *
  * (c) 2000-2004 Omnikey AG (http://www.omnikey.com/)
  * (c) 2000-2004 Omnikey AG (http://www.omnikey.com/)
  *
  *
- * (C) 2005 Harald Welte <laforge@gnumonks.org>
+ * (C) 2005-2006 Harald Welte <laforge@gnumonks.org>
  * 	- add support for poll()
  * 	- add support for poll()
  * 	- driver cleanup
  * 	- driver cleanup
  * 	- add waitqueues
  * 	- add waitqueues
  * 	- adhere to linux kernel coding style and policies
  * 	- adhere to linux kernel coding style and policies
  * 	- support 2.6.13 "new style" pcmcia interface
  * 	- support 2.6.13 "new style" pcmcia interface
+ * 	- add class interface for udev device creation
  *
  *
  * The device basically is a USB CCID compliant device that has been
  * The device basically is a USB CCID compliant device that has been
  * attached to an I/O-Mapped FIFO.
  * attached to an I/O-Mapped FIFO.
@@ -53,7 +54,7 @@ module_param(pc_debug, int, 0600);
 #endif
 #endif
 
 
 static char *version =
 static char *version =
-"OMNIKEY CardMan 4040 v1.1.0gm4 - All bugs added by Harald Welte";
+"OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte";
 
 
 #define	CCID_DRIVER_BULK_DEFAULT_TIMEOUT  	(150*HZ)
 #define	CCID_DRIVER_BULK_DEFAULT_TIMEOUT  	(150*HZ)
 #define	CCID_DRIVER_ASYNC_POWERUP_TIMEOUT 	(35*HZ)
 #define	CCID_DRIVER_ASYNC_POWERUP_TIMEOUT 	(35*HZ)
@@ -67,6 +68,7 @@ static char *version =
 static void reader_release(dev_link_t *link);
 static void reader_release(dev_link_t *link);
 
 
 static int major;
 static int major;
+static struct class *cmx_class;
 
 
 #define		BS_READABLE	0x01
 #define		BS_READABLE	0x01
 #define		BS_WRITABLE	0x02
 #define		BS_WRITABLE	0x02
@@ -696,6 +698,9 @@ static int reader_attach(struct pcmcia_device *p_dev)
 	link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
 	link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
 	reader_config(link, i);
 	reader_config(link, i);
 
 
+	class_device_create(cmx_class, NULL, MKDEV(major, i), NULL,
+			    "cmx%d", i);
+
 	return 0;
 	return 0;
 }
 }
 
 
@@ -721,6 +726,8 @@ static void reader_detach(struct pcmcia_device *p_dev)
 	dev_table[devno] = NULL;
 	dev_table[devno] = NULL;
 	kfree(dev);
 	kfree(dev);
 
 
+	class_device_destroy(cmx_class, MKDEV(major, devno));
+
 	return;
 	return;
 }
 }
 
 
@@ -755,8 +762,17 @@ static struct pcmcia_driver reader_driver = {
 
 
 static int __init cm4040_init(void)
 static int __init cm4040_init(void)
 {
 {
+	int rc;
+
 	printk(KERN_INFO "%s\n", version);
 	printk(KERN_INFO "%s\n", version);
-	pcmcia_register_driver(&reader_driver);
+	cmx_class = class_create(THIS_MODULE, "cardman_4040");
+	if (!cmx_class)
+		return -1;
+
+	rc = pcmcia_register_driver(&reader_driver);
+	if (rc < 0)
+		return rc;
+
 	major = register_chrdev(0, DEVICE_NAME, &reader_fops);
 	major = register_chrdev(0, DEVICE_NAME, &reader_fops);
 	if (major < 0) {
 	if (major < 0) {
 		printk(KERN_WARNING MODULE_NAME
 		printk(KERN_WARNING MODULE_NAME
@@ -771,6 +787,7 @@ static void __exit cm4040_exit(void)
 	printk(KERN_INFO MODULE_NAME ": unloading\n");
 	printk(KERN_INFO MODULE_NAME ": unloading\n");
 	pcmcia_unregister_driver(&reader_driver);
 	pcmcia_unregister_driver(&reader_driver);
 	unregister_chrdev(major, DEVICE_NAME);
 	unregister_chrdev(major, DEVICE_NAME);
+	class_destroy(cmx_class);
 }
 }
 
 
 module_init(cm4040_init);
 module_init(cm4040_init);

+ 1 - 0
drivers/ide/legacy/ide-cs.c

@@ -445,6 +445,7 @@ static struct pcmcia_device_id ide_ids[] = {
 	PCMCIA_DEVICE_PROD_ID12("PCMCIA", "PnPIDE", 0x281f1c5d, 0x0c694728),
 	PCMCIA_DEVICE_PROD_ID12("PCMCIA", "PnPIDE", 0x281f1c5d, 0x0c694728),
 	PCMCIA_DEVICE_PROD_ID12("SHUTTLE TECHNOLOGY LTD.", "PCCARD-IDE/ATAPI Adapter", 0x4a3f0ba0, 0x322560e1),
 	PCMCIA_DEVICE_PROD_ID12("SHUTTLE TECHNOLOGY LTD.", "PCCARD-IDE/ATAPI Adapter", 0x4a3f0ba0, 0x322560e1),
 	PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003),
 	PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003),
+	PCMCIA_DEVICE_PROD_ID1("TRANSCEND    512M   ", 0xd0909443),
 	PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852),
 	PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852),
 	PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209),
 	PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209),
 	PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e),
 	PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e),

+ 10 - 12
drivers/mtd/redboot.c

@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: redboot.c,v 1.18 2005/11/07 11:14:21 gleixner Exp $
+ * $Id: redboot.c,v 1.19 2005/12/01 10:03:51 dwmw2 Exp $
  *
  *
  * Parse RedBoot-style Flash Image System (FIS) tables and
  * Parse RedBoot-style Flash Image System (FIS) tables and
  * produce a Linux partition array to match.
  * produce a Linux partition array to match.
@@ -92,10 +92,10 @@ static int parse_redboot_partitions(struct mtd_info *master,
 		if (!memcmp(buf[i].name, "FIS directory", 14)) {
 		if (!memcmp(buf[i].name, "FIS directory", 14)) {
 			/* This is apparently the FIS directory entry for the
 			/* This is apparently the FIS directory entry for the
 			 * FIS directory itself.  The FIS directory size is
 			 * FIS directory itself.  The FIS directory size is
-			 * one erase block, if the buf[i].size field is
+			 * one erase block; if the buf[i].size field is
 			 * swab32(erasesize) then we know we are looking at
 			 * swab32(erasesize) then we know we are looking at
 			 * a byte swapped FIS directory - swap all the entries!
 			 * a byte swapped FIS directory - swap all the entries!
-			 * (NOTE: this is 'size' not 'data_length', size is
+			 * (NOTE: this is 'size' not 'data_length'; size is
 			 * the full size of the entry.)
 			 * the full size of the entry.)
 			 */
 			 */
 			if (swab32(buf[i].size) == master->erasesize) {
 			if (swab32(buf[i].size) == master->erasesize) {
@@ -104,15 +104,13 @@ static int parse_redboot_partitions(struct mtd_info *master,
 					/* The unsigned long fields were written with the
 					/* The unsigned long fields were written with the
 					 * wrong byte sex, name and pad have no byte sex.
 					 * wrong byte sex, name and pad have no byte sex.
 					 */
 					 */
-#					define do_swab32(x) (x) = swab32(x)
-					do_swab32(buf[j].flash_base);
-					do_swab32(buf[j].mem_base);
-					do_swab32(buf[j].size);
-					do_swab32(buf[j].entry_point);
-					do_swab32(buf[j].data_length);
-					do_swab32(buf[j].desc_cksum);
-					do_swab32(buf[j].file_cksum);
-#					undef do_swab32
+					swab32s(&buf[j].flash_base);
+					swab32s(&buf[j].mem_base);
+					swab32s(&buf[j].size);
+					swab32s(&buf[j].entry_point);
+					swab32s(&buf[j].data_length);
+					swab32s(&buf[j].desc_cksum);
+					swab32s(&buf[j].file_cksum);
 				}
 				}
 			}
 			}
 			break;
 			break;

+ 2 - 2
drivers/net/3c59x.c

@@ -842,7 +842,7 @@ enum xcvr_types {
 	XCVR_100baseFx, XCVR_MII=6, XCVR_NWAY=8, XCVR_ExtMII=9, XCVR_Default=10,
 	XCVR_100baseFx, XCVR_MII=6, XCVR_NWAY=8, XCVR_ExtMII=9, XCVR_Default=10,
 };
 };
 
 
-static struct media_table {
+static const struct media_table {
 	char *name;
 	char *name;
 	unsigned int media_bits:16,		/* Bits to set in Wn4_Media register. */
 	unsigned int media_bits:16,		/* Bits to set in Wn4_Media register. */
 		mask:8,						/* The transceiver-present bit in Wn3_Config.*/
 		mask:8,						/* The transceiver-present bit in Wn3_Config.*/
@@ -1446,7 +1446,7 @@ static int __devinit vortex_probe1(struct device *gendev,
 	}
 	}
 
 
 	{
 	{
-		static const char * ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
+		static const char * const ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
 		unsigned int config;
 		unsigned int config;
 		EL3WINDOW(3);
 		EL3WINDOW(3);
 		vp->available_media = ioread16(ioaddr + Wn3_Options);
 		vp->available_media = ioread16(ioaddr + Wn3_Options);

+ 1 - 1
drivers/net/8139cp.c

@@ -1276,7 +1276,7 @@ static int cp_change_mtu(struct net_device *dev, int new_mtu)
 }
 }
 #endif /* BROKEN */
 #endif /* BROKEN */
 
 
-static char mii_2_8139_map[8] = {
+static const char mii_2_8139_map[8] = {
 	BasicModeCtrl,
 	BasicModeCtrl,
 	BasicModeStatus,
 	BasicModeStatus,
 	0,
 	0,

+ 2 - 2
drivers/net/8139too.c

@@ -229,7 +229,7 @@ typedef enum {
 
 
 
 
 /* indexed by board_t, above */
 /* indexed by board_t, above */
-static struct {
+static const struct {
 	const char *name;
 	const char *name;
 	u32 hw_flags;
 	u32 hw_flags;
 } board_info[] __devinitdata = {
 } board_info[] __devinitdata = {
@@ -1192,7 +1192,7 @@ static int __devinit read_eeprom (void __iomem *ioaddr, int location, int addr_l
 #define mdio_delay()	RTL_R8(Config4)
 #define mdio_delay()	RTL_R8(Config4)
 
 
 
 
-static char mii_2_8139_map[8] = {
+static const char mii_2_8139_map[8] = {
 	BasicModeCtrl,
 	BasicModeCtrl,
 	BasicModeStatus,
 	BasicModeStatus,
 	0,
 	0,

+ 5 - 5
drivers/net/bnx2.c

@@ -46,7 +46,7 @@ typedef enum {
 } board_t;
 } board_t;
 
 
 /* indexed by board_t, above */
 /* indexed by board_t, above */
-static struct {
+static const struct {
 	char *name;
 	char *name;
 } board_info[] __devinitdata = {
 } board_info[] __devinitdata = {
 	{ "Broadcom NetXtreme II BCM5706 1000Base-T" },
 	{ "Broadcom NetXtreme II BCM5706 1000Base-T" },
@@ -3476,7 +3476,7 @@ bnx2_test_registers(struct bnx2 *bp)
 {
 {
 	int ret;
 	int ret;
 	int i;
 	int i;
-	static struct {
+	static const struct {
 		u16   offset;
 		u16   offset;
 		u16   flags;
 		u16   flags;
 		u32   rw_mask;
 		u32   rw_mask;
@@ -3891,7 +3891,7 @@ reg_test_err:
 static int
 static int
 bnx2_do_mem_test(struct bnx2 *bp, u32 start, u32 size)
 bnx2_do_mem_test(struct bnx2 *bp, u32 start, u32 size)
 {
 {
-	static u32 test_pattern[] = { 0x00000000, 0xffffffff, 0x55555555,
+	static const u32 test_pattern[] = { 0x00000000, 0xffffffff, 0x55555555,
 		0xaaaaaaaa , 0xaa55aa55, 0x55aa55aa };
 		0xaaaaaaaa , 0xaa55aa55, 0x55aa55aa };
 	int i;
 	int i;
 
 
@@ -3916,7 +3916,7 @@ bnx2_test_memory(struct bnx2 *bp)
 {
 {
 	int ret = 0;
 	int ret = 0;
 	int i;
 	int i;
-	static struct {
+	static const struct {
 		u32   offset;
 		u32   offset;
 		u32   len;
 		u32   len;
 	} mem_tbl[] = {
 	} mem_tbl[] = {
@@ -5122,7 +5122,7 @@ static struct {
 
 
 #define STATS_OFFSET32(offset_name) (offsetof(struct statistics_block, offset_name) / 4)
 #define STATS_OFFSET32(offset_name) (offsetof(struct statistics_block, offset_name) / 4)
 
 
-static unsigned long bnx2_stats_offset_arr[BNX2_NUM_STATS] = {
+static const unsigned long bnx2_stats_offset_arr[BNX2_NUM_STATS] = {
     STATS_OFFSET32(stat_IfHCInOctets_hi),
     STATS_OFFSET32(stat_IfHCInOctets_hi),
     STATS_OFFSET32(stat_IfHCInBadOctets_hi),
     STATS_OFFSET32(stat_IfHCInBadOctets_hi),
     STATS_OFFSET32(stat_IfHCOutOctets_hi),
     STATS_OFFSET32(stat_IfHCOutOctets_hi),

+ 42 - 42
drivers/net/bnx2_fw.h

@@ -14,20 +14,20 @@
  * accompanying it.
  * accompanying it.
  */
  */
 
 
-static int bnx2_COM_b06FwReleaseMajor = 0x1;
-static int bnx2_COM_b06FwReleaseMinor = 0x0;
-static int bnx2_COM_b06FwReleaseFix = 0x0;
-static u32 bnx2_COM_b06FwStartAddr = 0x080008b4;
-static u32 bnx2_COM_b06FwTextAddr = 0x08000000;
-static int bnx2_COM_b06FwTextLen = 0x57bc;
-static u32 bnx2_COM_b06FwDataAddr = 0x08005840;
-static int bnx2_COM_b06FwDataLen = 0x0;
-static u32 bnx2_COM_b06FwRodataAddr = 0x080057c0;
-static int bnx2_COM_b06FwRodataLen = 0x58;
-static u32 bnx2_COM_b06FwBssAddr = 0x08005860;
-static int bnx2_COM_b06FwBssLen = 0x88;
-static u32 bnx2_COM_b06FwSbssAddr = 0x08005840;
-static int bnx2_COM_b06FwSbssLen = 0x1c;
+static const int bnx2_COM_b06FwReleaseMajor = 0x1;
+static const int bnx2_COM_b06FwReleaseMinor = 0x0;
+static const int bnx2_COM_b06FwReleaseFix = 0x0;
+static const u32 bnx2_COM_b06FwStartAddr = 0x080008b4;
+static const u32 bnx2_COM_b06FwTextAddr = 0x08000000;
+static const int bnx2_COM_b06FwTextLen = 0x57bc;
+static const u32 bnx2_COM_b06FwDataAddr = 0x08005840;
+static const int bnx2_COM_b06FwDataLen = 0x0;
+static const u32 bnx2_COM_b06FwRodataAddr = 0x080057c0;
+static const int bnx2_COM_b06FwRodataLen = 0x58;
+static const u32 bnx2_COM_b06FwBssAddr = 0x08005860;
+static const int bnx2_COM_b06FwBssLen = 0x88;
+static const u32 bnx2_COM_b06FwSbssAddr = 0x08005840;
+static const int bnx2_COM_b06FwSbssLen = 0x1c;
 static u32 bnx2_COM_b06FwText[(0x57bc/4) + 1] = {
 static u32 bnx2_COM_b06FwText[(0x57bc/4) + 1] = {
 	0x0a00022d, 0x00000000, 0x00000000, 0x0000000d, 0x636f6d20, 0x322e352e,
 	0x0a00022d, 0x00000000, 0x00000000, 0x0000000d, 0x636f6d20, 0x322e352e,
 	0x38000000, 0x02050802, 0x00000000, 0x00000003, 0x00000014, 0x00000032,
 	0x38000000, 0x02050802, 0x00000000, 0x00000003, 0x00000014, 0x00000032,
@@ -2325,20 +2325,20 @@ static u32 bnx2_rv2p_proc2[] = {
 	0x0000000c, 0x29520000, 0x00000018, 0x80000002, 0x0000000c, 0x29800000,
 	0x0000000c, 0x29520000, 0x00000018, 0x80000002, 0x0000000c, 0x29800000,
 	0x00000018, 0x00570000 };
 	0x00000018, 0x00570000 };
 
 
-static int bnx2_TPAT_b06FwReleaseMajor = 0x1;
-static int bnx2_TPAT_b06FwReleaseMinor = 0x0;
-static int bnx2_TPAT_b06FwReleaseFix = 0x0;
-static u32 bnx2_TPAT_b06FwStartAddr = 0x08000860;
-static u32 bnx2_TPAT_b06FwTextAddr = 0x08000800;
-static int bnx2_TPAT_b06FwTextLen = 0x122c;
-static u32 bnx2_TPAT_b06FwDataAddr = 0x08001a60;
-static int bnx2_TPAT_b06FwDataLen = 0x0;
-static u32 bnx2_TPAT_b06FwRodataAddr = 0x00000000;
-static int bnx2_TPAT_b06FwRodataLen = 0x0;
-static u32 bnx2_TPAT_b06FwBssAddr = 0x08001aa0;
-static int bnx2_TPAT_b06FwBssLen = 0x250;
-static u32 bnx2_TPAT_b06FwSbssAddr = 0x08001a60;
-static int bnx2_TPAT_b06FwSbssLen = 0x34;
+static const int bnx2_TPAT_b06FwReleaseMajor = 0x1;
+static const int bnx2_TPAT_b06FwReleaseMinor = 0x0;
+static const int bnx2_TPAT_b06FwReleaseFix = 0x0;
+static const u32 bnx2_TPAT_b06FwStartAddr = 0x08000860;
+static const u32 bnx2_TPAT_b06FwTextAddr = 0x08000800;
+static const int bnx2_TPAT_b06FwTextLen = 0x122c;
+static const u32 bnx2_TPAT_b06FwDataAddr = 0x08001a60;
+static const int bnx2_TPAT_b06FwDataLen = 0x0;
+static const u32 bnx2_TPAT_b06FwRodataAddr = 0x00000000;
+static const int bnx2_TPAT_b06FwRodataLen = 0x0;
+static const u32 bnx2_TPAT_b06FwBssAddr = 0x08001aa0;
+static const int bnx2_TPAT_b06FwBssLen = 0x250;
+static const u32 bnx2_TPAT_b06FwSbssAddr = 0x08001a60;
+static const int bnx2_TPAT_b06FwSbssLen = 0x34;
 static u32 bnx2_TPAT_b06FwText[(0x122c/4) + 1] = {
 static u32 bnx2_TPAT_b06FwText[(0x122c/4) + 1] = {
 	0x0a000218, 0x00000000, 0x00000000, 0x0000000d, 0x74706174, 0x20322e35,
 	0x0a000218, 0x00000000, 0x00000000, 0x0000000d, 0x74706174, 0x20322e35,
 	0x2e313100, 0x02050b01, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 	0x2e313100, 0x02050b01, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -2540,20 +2540,20 @@ static u32 bnx2_TPAT_b06FwRodata[(0x0/4) + 1] = { 0x0 };
 static u32 bnx2_TPAT_b06FwBss[(0x250/4) + 1] = { 0x0 };
 static u32 bnx2_TPAT_b06FwBss[(0x250/4) + 1] = { 0x0 };
 static u32 bnx2_TPAT_b06FwSbss[(0x34/4) + 1] = { 0x0 };
 static u32 bnx2_TPAT_b06FwSbss[(0x34/4) + 1] = { 0x0 };
 
 
-static int bnx2_TXP_b06FwReleaseMajor = 0x1;
-static int bnx2_TXP_b06FwReleaseMinor = 0x0;
-static int bnx2_TXP_b06FwReleaseFix = 0x0;
-static u32 bnx2_TXP_b06FwStartAddr = 0x080034b0;
-static u32 bnx2_TXP_b06FwTextAddr = 0x08000000;
-static int bnx2_TXP_b06FwTextLen = 0x5748;
-static u32 bnx2_TXP_b06FwDataAddr = 0x08005760;
-static int bnx2_TXP_b06FwDataLen = 0x0;
-static u32 bnx2_TXP_b06FwRodataAddr = 0x00000000;
-static int bnx2_TXP_b06FwRodataLen = 0x0;
-static u32 bnx2_TXP_b06FwBssAddr = 0x080057a0;
-static int bnx2_TXP_b06FwBssLen = 0x1c4;
-static u32 bnx2_TXP_b06FwSbssAddr = 0x08005760;
-static int bnx2_TXP_b06FwSbssLen = 0x38;
+static const int bnx2_TXP_b06FwReleaseMajor = 0x1;
+static const int bnx2_TXP_b06FwReleaseMinor = 0x0;
+static const int bnx2_TXP_b06FwReleaseFix = 0x0;
+static const u32 bnx2_TXP_b06FwStartAddr = 0x080034b0;
+static const u32 bnx2_TXP_b06FwTextAddr = 0x08000000;
+static const int bnx2_TXP_b06FwTextLen = 0x5748;
+static const u32 bnx2_TXP_b06FwDataAddr = 0x08005760;
+static const int bnx2_TXP_b06FwDataLen = 0x0;
+static const u32 bnx2_TXP_b06FwRodataAddr = 0x00000000;
+static const int bnx2_TXP_b06FwRodataLen = 0x0;
+static const u32 bnx2_TXP_b06FwBssAddr = 0x080057a0;
+static const int bnx2_TXP_b06FwBssLen = 0x1c4;
+static const u32 bnx2_TXP_b06FwSbssAddr = 0x08005760;
+static const int bnx2_TXP_b06FwSbssLen = 0x38;
 static u32 bnx2_TXP_b06FwText[(0x5748/4) + 1] = {
 static u32 bnx2_TXP_b06FwText[(0x5748/4) + 1] = {
 	0x0a000d2c, 0x00000000, 0x00000000, 0x0000000d, 0x74787020, 0x322e352e,
 	0x0a000d2c, 0x00000000, 0x00000000, 0x0000000d, 0x74787020, 0x322e352e,
 	0x38000000, 0x02050800, 0x0000000a, 0x000003e8, 0x0000ea60, 0x00000000,
 	0x38000000, 0x02050800, 0x0000000a, 0x000003e8, 0x0000ea60, 0x00000000,

+ 1 - 1
drivers/net/bonding/bond_alb.c

@@ -1261,7 +1261,7 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
 	struct ethhdr *eth_data;
 	struct ethhdr *eth_data;
 	struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
 	struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
 	struct slave *tx_slave = NULL;
 	struct slave *tx_slave = NULL;
-	static u32 ip_bcast = 0xffffffff;
+	static const u32 ip_bcast = 0xffffffff;
 	int hash_size = 0;
 	int hash_size = 0;
 	int do_tx_balance = 1;
 	int do_tx_balance = 1;
 	u32 hash_index = 0;
 	u32 hash_index = 0;

+ 1 - 1
drivers/net/bonding/bond_main.c

@@ -131,7 +131,7 @@ MODULE_PARM_DESC(arp_ip_target, "arp targets in n.n.n.n form");
 
 
 /*----------------------------- Global variables ----------------------------*/
 /*----------------------------- Global variables ----------------------------*/
 
 
-static const char *version =
+static const char * const version =
 	DRV_DESCRIPTION ": v" DRV_VERSION " (" DRV_RELDATE ")\n";
 	DRV_DESCRIPTION ": v" DRV_VERSION " (" DRV_RELDATE ")\n";
 
 
 LIST_HEAD(bond_dev_list);
 LIST_HEAD(bond_dev_list);

+ 1 - 1
drivers/net/chelsio/subr.c

@@ -686,7 +686,7 @@ int t1_init_hw_modules(adapter_t *adapter)
  */
  */
 static void __devinit get_pci_mode(adapter_t *adapter, struct chelsio_pci_params *p)
 static void __devinit get_pci_mode(adapter_t *adapter, struct chelsio_pci_params *p)
 {
 {
-	static unsigned short speed_map[] = { 33, 66, 100, 133 };
+	static const unsigned short speed_map[] = { 33, 66, 100, 133 };
 	u32 pci_mode;
 	u32 pci_mode;
 
 
 	pci_read_config_dword(adapter->pdev, A_PCICFG_MODE, &pci_mode);
 	pci_read_config_dword(adapter->pdev, A_PCICFG_MODE, &pci_mode);

+ 1 - 1
drivers/net/dgrs.c

@@ -993,7 +993,7 @@ dgrs_download(struct net_device *dev0)
 	int		is;
 	int		is;
 	unsigned long	i;
 	unsigned long	i;
 
 
-	static int	iv2is[16] = {
+	static const int iv2is[16] = {
 				0, 0, 0, ES4H_IS_INT3,
 				0, 0, 0, ES4H_IS_INT3,
 				0, ES4H_IS_INT5, 0, ES4H_IS_INT7,
 				0, ES4H_IS_INT5, 0, ES4H_IS_INT7,
 				0, 0, ES4H_IS_INT10, ES4H_IS_INT11,
 				0, 0, ES4H_IS_INT10, ES4H_IS_INT11,

+ 2 - 2
drivers/net/dgrs_firmware.c

@@ -1,4 +1,4 @@
-static int dgrs_firmnum = 550;
+static const int dgrs_firmnum = 550;
 static char dgrs_firmver[] = "$Version$";
 static char dgrs_firmver[] = "$Version$";
 static char dgrs_firmdate[] = "11/16/96 03:45:15";
 static char dgrs_firmdate[] = "11/16/96 03:45:15";
 static unsigned char dgrs_code[] __initdata = {
 static unsigned char dgrs_code[] __initdata = {
@@ -9963,4 +9963,4 @@ static unsigned char dgrs_code[] __initdata = {
 	109,46,99,0,114,99,0,0,48,120,0,0,
 	109,46,99,0,114,99,0,0,48,120,0,0,
 	0,0,0,0,0,0,0,0,0,0,0,0
 	0,0,0,0,0,0,0,0,0,0,0,0
 	} ;
 	} ;
-static int dgrs_ncode = 119520 ;
+static const int dgrs_ncode = 119520 ;

+ 2 - 2
drivers/net/dl2k.c

@@ -90,8 +90,8 @@ module_param(tx_coalesce, int, 0); /* HW xmit count each TxDMAComplete */
 #define EnableInt() \
 #define EnableInt() \
 writew(DEFAULT_INTR, ioaddr + IntEnable)
 writew(DEFAULT_INTR, ioaddr + IntEnable)
 
 
-static int max_intrloop = 50;
-static int multicast_filter_limit = 0x40;
+static const int max_intrloop = 50;
+static const int multicast_filter_limit = 0x40;
 
 
 static int rio_open (struct net_device *dev);
 static int rio_open (struct net_device *dev);
 static void rio_timer (unsigned long data);
 static void rio_timer (unsigned long data);

+ 2 - 2
drivers/net/eepro100.c

@@ -27,7 +27,7 @@
 		rx_align support: enables rx DMA without causing unaligned accesses.
 		rx_align support: enables rx DMA without causing unaligned accesses.
 */
 */
 
 
-static const char *version =
+static const char * const version =
 "eepro100.c:v1.09j-t 9/29/99 Donald Becker http://www.scyld.com/network/eepro100.html\n"
 "eepro100.c:v1.09j-t 9/29/99 Donald Becker http://www.scyld.com/network/eepro100.html\n"
 "eepro100.c: $Revision: 1.36 $ 2000/11/17 Modified by Andrey V. Savochkin <saw@saw.sw.com.sg> and others\n";
 "eepro100.c: $Revision: 1.36 $ 2000/11/17 Modified by Andrey V. Savochkin <saw@saw.sw.com.sg> and others\n";
 
 
@@ -469,7 +469,7 @@ static const char i82558_config_cmd[CONFIG_DATA_SIZE] = {
 	0x31, 0x05, };
 	0x31, 0x05, };
 
 
 /* PHY media interface chips. */
 /* PHY media interface chips. */
-static const char *phys[] = {
+static const char * const phys[] = {
 	"None", "i82553-A/B", "i82553-C", "i82503",
 	"None", "i82553-A/B", "i82553-C", "i82503",
 	"DP83840", "80c240", "80c24", "i82555",
 	"DP83840", "80c240", "80c24", "i82555",
 	"unknown-8", "unknown-9", "DP83840A", "unknown-11",
 	"unknown-8", "unknown-9", "DP83840A", "unknown-11",

+ 2 - 2
drivers/net/epic100.c

@@ -225,7 +225,7 @@ struct epic_chip_info {
 
 
 
 
 /* indexed by chip_t */
 /* indexed by chip_t */
-static struct epic_chip_info pci_id_tbl[] = {
+static const struct epic_chip_info pci_id_tbl[] = {
 	{ "SMSC EPIC/100 83c170",
 	{ "SMSC EPIC/100 83c170",
 	 EPIC_IOTYPE, EPIC_TOTAL_SIZE, TYPE2_INTR | NO_MII | MII_PWRDWN },
 	 EPIC_IOTYPE, EPIC_TOTAL_SIZE, TYPE2_INTR | NO_MII | MII_PWRDWN },
 	{ "SMSC EPIC/100 83c170",
 	{ "SMSC EPIC/100 83c170",
@@ -291,7 +291,7 @@ enum CommandBits {
 			 RxDone | RxStarted | RxEarlyWarn | RxOverflow | RxFull)
 			 RxDone | RxStarted | RxEarlyWarn | RxOverflow | RxFull)
 #define EpicNormalEvent	(0x0000ffff & ~EpicNapiEvent)
 #define EpicNormalEvent	(0x0000ffff & ~EpicNapiEvent)
 
 
-static u16 media2miictl[16] = {
+static const u16 media2miictl[16] = {
 	0, 0x0C00, 0x0C00, 0x2000,  0x0100, 0x2100, 0, 0,
 	0, 0x0C00, 0x0C00, 0x2000,  0x0100, 0x2100, 0, 0,
 	0, 0, 0, 0,  0, 0, 0, 0 };
 	0, 0, 0, 0,  0, 0, 0, 0 };
 
 

+ 1 - 1
drivers/net/fealnx.c

@@ -160,7 +160,7 @@ struct chip_info {
 	int flags;
 	int flags;
 };
 };
 
 
-static struct chip_info skel_netdrv_tbl[] = {
+static const struct chip_info skel_netdrv_tbl[] = {
 	{"100/10M Ethernet PCI Adapter", 136, HAS_MII_XCVR},
 	{"100/10M Ethernet PCI Adapter", 136, HAS_MII_XCVR},
 	{"100/10M Ethernet PCI Adapter", 136, HAS_CHIP_XCVR},
 	{"100/10M Ethernet PCI Adapter", 136, HAS_CHIP_XCVR},
 	{"1000/100/10M Ethernet PCI Adapter", 136, HAS_MII_XCVR},
 	{"1000/100/10M Ethernet PCI Adapter", 136, HAS_MII_XCVR},

+ 1 - 1
drivers/net/hamachi.c

@@ -427,7 +427,7 @@ that case.
 static void hamachi_timer(unsigned long data);
 static void hamachi_timer(unsigned long data);
 
 
 enum capability_flags {CanHaveMII=1, };
 enum capability_flags {CanHaveMII=1, };
-static struct chip_info {
+static const struct chip_info {
 	u16	vendor_id, device_id, device_id_mask, pad;
 	u16	vendor_id, device_id, device_id_mask, pad;
 	const char *name;
 	const char *name;
 	void (*media_timer)(unsigned long data);
 	void (*media_timer)(unsigned long data);

+ 2 - 2
drivers/net/natsemi.c

@@ -189,7 +189,7 @@ static int mtu;
 
 
 /* Maximum number of multicast addresses to filter (vs. rx-all-multicast).
 /* Maximum number of multicast addresses to filter (vs. rx-all-multicast).
    This chip uses a 512 element hash table based on the Ethernet CRC.  */
    This chip uses a 512 element hash table based on the Ethernet CRC.  */
-static int multicast_filter_limit = 100;
+static const int multicast_filter_limit = 100;
 
 
 /* Set the copy breakpoint for the copy-only-tiny-frames scheme.
 /* Set the copy breakpoint for the copy-only-tiny-frames scheme.
    Setting to > 1518 effectively disables this feature. */
    Setting to > 1518 effectively disables this feature. */
@@ -374,7 +374,7 @@ enum pcistuff {
 
 
  
  
 /* array of board data directly indexed by pci_tbl[x].driver_data */
 /* array of board data directly indexed by pci_tbl[x].driver_data */
-static struct {
+static const struct {
 	const char *name;
 	const char *name;
 	unsigned long flags;
 	unsigned long flags;
 } natsemi_pci_info[] __devinitdata = {
 } natsemi_pci_info[] __devinitdata = {

+ 1 - 1
drivers/net/ne2k-pci.c

@@ -117,7 +117,7 @@ enum ne2k_pci_chipsets {
 };
 };
 
 
 
 
-static struct {
+static const struct {
 	char *name;
 	char *name;
 	int flags;
 	int flags;
 } pci_clone_list[] __devinitdata = {
 } pci_clone_list[] __devinitdata = {

+ 1 - 1
drivers/net/ns83820.c

@@ -652,7 +652,7 @@ static void FASTCALL(phy_intr(struct net_device *ndev));
 static void fastcall phy_intr(struct net_device *ndev)
 static void fastcall phy_intr(struct net_device *ndev)
 {
 {
 	struct ns83820 *dev = PRIV(ndev);
 	struct ns83820 *dev = PRIV(ndev);
-	static char *speeds[] = { "10", "100", "1000", "1000(?)", "1000F" };
+	static const char *speeds[] = { "10", "100", "1000", "1000(?)", "1000F" };
 	u32 cfg, new_cfg;
 	u32 cfg, new_cfg;
 	u32 tbisr, tanar, tanlpar;
 	u32 tbisr, tanar, tanlpar;
 	int speed, fullduplex, newlinkstate;
 	int speed, fullduplex, newlinkstate;

+ 1 - 1
drivers/net/pcmcia/3c574_cs.c

@@ -341,7 +341,7 @@ static void tc574_detach(struct pcmcia_device *p_dev)
 #define CS_CHECK(fn, ret) \
 #define CS_CHECK(fn, ret) \
   do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
   do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
 
 
-static char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
+static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
 
 
 static void tc574_config(dev_link_t *link)
 static void tc574_config(dev_link_t *link)
 {
 {

+ 1 - 1
drivers/net/pcmcia/3c589_cs.c

@@ -116,7 +116,7 @@ struct el3_private {
     spinlock_t		lock;
     spinlock_t		lock;
 };
 };
 
 
-static char *if_names[] = { "auto", "10baseT", "10base2", "AUI" };
+static const char *if_names[] = { "auto", "10baseT", "10base2", "AUI" };
 
 
 /*====================================================================*/
 /*====================================================================*/
 
 

+ 1 - 0
drivers/net/pcmcia/axnet_cs.c

@@ -806,6 +806,7 @@ static struct pcmcia_device_id axnet_ids[] = {
 	PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309),
 	PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309),
 	PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1106),
 	PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1106),
 	PCMCIA_DEVICE_MANF_CARD(0x8a01, 0xc1ab),
 	PCMCIA_DEVICE_MANF_CARD(0x8a01, 0xc1ab),
+	PCMCIA_DEVICE_PROD_ID12("AmbiCom,Inc.", "Fast Ethernet PC Card(AMB8110)", 0x49b020a7, 0x119cc9fc),
 	PCMCIA_DEVICE_PROD_ID124("Fast Ethernet", "16-bit PC Card", "AX88190", 0xb4be14e3, 0x9a12eb6a, 0xab9be5ef),
 	PCMCIA_DEVICE_PROD_ID124("Fast Ethernet", "16-bit PC Card", "AX88190", 0xb4be14e3, 0x9a12eb6a, 0xab9be5ef),
 	PCMCIA_DEVICE_PROD_ID12("ASIX", "AX88190", 0x0959823b, 0xab9be5ef),
 	PCMCIA_DEVICE_PROD_ID12("ASIX", "AX88190", 0x0959823b, 0xab9be5ef),
 	PCMCIA_DEVICE_PROD_ID12("Billionton", "LNA-100B", 0x552ab682, 0xbc3b87e1),
 	PCMCIA_DEVICE_PROD_ID12("Billionton", "LNA-100B", 0x552ab682, 0xbc3b87e1),

+ 1 - 1
drivers/net/pcmcia/fmvj18x_cs.c

@@ -309,7 +309,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
 static int mfc_try_io_port(dev_link_t *link)
 static int mfc_try_io_port(dev_link_t *link)
 {
 {
     int i, ret;
     int i, ret;
-    static kio_addr_t serial_base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
+    static const kio_addr_t serial_base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
 
 
     for (i = 0; i < 5; i++) {
     for (i = 0; i < 5; i++) {
 	link->io.BasePort2 = serial_base[i];
 	link->io.BasePort2 = serial_base[i];

+ 1 - 1
drivers/net/pcmcia/nmclan_cs.c

@@ -388,7 +388,7 @@ static char *version =
 DRV_NAME " " DRV_VERSION " (Roger C. Pao)";
 DRV_NAME " " DRV_VERSION " (Roger C. Pao)";
 #endif
 #endif
 
 
-static char *if_names[]={
+static const char *if_names[]={
     "Auto", "10baseT", "BNC",
     "Auto", "10baseT", "BNC",
 };
 };
 
 

+ 1 - 1
drivers/net/pcmcia/pcnet_cs.c

@@ -66,7 +66,7 @@
 
 
 #define PCNET_RDC_TIMEOUT (2*HZ/100)	/* Max wait in jiffies for Tx RDC */
 #define PCNET_RDC_TIMEOUT (2*HZ/100)	/* Max wait in jiffies for Tx RDC */
 
 
-static char *if_names[] = { "auto", "10baseT", "10base2"};
+static const char *if_names[] = { "auto", "10baseT", "10base2"};
 
 
 #ifdef PCMCIA_DEBUG
 #ifdef PCMCIA_DEBUG
 static int pc_debug = PCMCIA_DEBUG;
 static int pc_debug = PCMCIA_DEBUG;

+ 2 - 2
drivers/net/pcmcia/smc91c92_cs.c

@@ -59,7 +59,7 @@
 
 
 /*====================================================================*/
 /*====================================================================*/
 
 
-static char *if_names[] = { "auto", "10baseT", "10base2"};
+static const char *if_names[] = { "auto", "10baseT", "10base2"};
 
 
 /* Module parameters */
 /* Module parameters */
 
 
@@ -777,7 +777,7 @@ free_cfg_mem:
 static int osi_config(dev_link_t *link)
 static int osi_config(dev_link_t *link)
 {
 {
     struct net_device *dev = link->priv;
     struct net_device *dev = link->priv;
-    static kio_addr_t com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
+    static const kio_addr_t com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
     int i, j;
     int i, j;
 
 
     link->conf.Attributes |= CONF_ENABLE_SPKR;
     link->conf.Attributes |= CONF_ENABLE_SPKR;

+ 1 - 1
drivers/net/pcmcia/xirc2ps_cs.c

@@ -208,7 +208,7 @@ enum xirc_cmd { 	    /* Commands */
 #define XIRCREG45_REV	 15 /* Revision Register (rd) */
 #define XIRCREG45_REV	 15 /* Revision Register (rd) */
 #define XIRCREG50_IA	8   /* Individual Address (8-13) */
 #define XIRCREG50_IA	8   /* Individual Address (8-13) */
 
 
-static char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" };
+static const char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" };
 
 
 /****************
 /****************
  * All the PCMCIA modules use PCMCIA_DEBUG to control debugging.  If
  * All the PCMCIA modules use PCMCIA_DEBUG to control debugging.  If

+ 3 - 3
drivers/net/pcnet32.c

@@ -26,7 +26,7 @@
 #define DRV_RELDATE	"01.Nov.2005"
 #define DRV_RELDATE	"01.Nov.2005"
 #define PFX		DRV_NAME ": "
 #define PFX		DRV_NAME ": "
 
 
-static const char *version =
+static const char * const version =
 DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " tsbogend@alpha.franken.de\n";
 DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " tsbogend@alpha.franken.de\n";
 
 
 #include <linux/module.h>
 #include <linux/module.h>
@@ -109,7 +109,7 @@ static int rx_copybreak = 200;
  * table to translate option values from tulip
  * table to translate option values from tulip
  * to internal options
  * to internal options
  */
  */
-static unsigned char options_mapping[] = {
+static const unsigned char options_mapping[] = {
     PCNET32_PORT_ASEL,			   /*  0 Auto-select	  */
     PCNET32_PORT_ASEL,			   /*  0 Auto-select	  */
     PCNET32_PORT_AUI,			   /*  1 BNC/AUI	  */
     PCNET32_PORT_AUI,			   /*  1 BNC/AUI	  */
     PCNET32_PORT_AUI,			   /*  2 AUI/BNC	  */
     PCNET32_PORT_AUI,			   /*  2 AUI/BNC	  */
@@ -733,7 +733,7 @@ static int pcnet32_loopback_test(struct net_device *dev, uint64_t *data1)
     int rc;				/* return code */
     int rc;				/* return code */
     int size;				/* size of packets */
     int size;				/* size of packets */
     unsigned char *packet;		/* source packet data */
     unsigned char *packet;		/* source packet data */
-    static int data_len = 60;		/* length of source packets */
+    static const int data_len = 60;		/* length of source packets */
     unsigned long flags;
     unsigned long flags;
     unsigned long ticks;
     unsigned long ticks;
 
 

+ 1 - 1
drivers/net/phy/phy.c

@@ -132,7 +132,7 @@ struct phy_setting {
 };
 };
 
 
 /* A mapping of all SUPPORTED settings to speed/duplex */
 /* A mapping of all SUPPORTED settings to speed/duplex */
-static struct phy_setting settings[] = {
+static const struct phy_setting settings[] = {
 	{
 	{
 		.speed = 10000,
 		.speed = 10000,
 		.duplex = DUPLEX_FULL,
 		.duplex = DUPLEX_FULL,

+ 2 - 2
drivers/net/plip.c

@@ -123,7 +123,7 @@ static const char version[] = "NET3 PLIP version 2.4-parport gniibe@mri.co.jp\n"
 #ifndef NET_DEBUG
 #ifndef NET_DEBUG
 #define NET_DEBUG 1
 #define NET_DEBUG 1
 #endif
 #endif
-static unsigned int net_debug = NET_DEBUG;
+static const unsigned int net_debug = NET_DEBUG;
 
 
 #define ENABLE(irq)  if (irq != -1) enable_irq(irq)
 #define ENABLE(irq)  if (irq != -1) enable_irq(irq)
 #define DISABLE(irq) if (irq != -1) disable_irq(irq)
 #define DISABLE(irq) if (irq != -1) disable_irq(irq)
@@ -351,7 +351,7 @@ static int plip_bh_timeout_error(struct net_device *dev, struct net_local *nl,
 typedef int (*plip_func)(struct net_device *dev, struct net_local *nl,
 typedef int (*plip_func)(struct net_device *dev, struct net_local *nl,
 			 struct plip_local *snd, struct plip_local *rcv);
 			 struct plip_local *snd, struct plip_local *rcv);
 
 
-static plip_func connection_state_table[] =
+static const plip_func connection_state_table[] =
 {
 {
 	plip_none,
 	plip_none,
 	plip_receive_packet,
 	plip_receive_packet,

+ 1 - 1
drivers/net/ppp_synctty.c

@@ -108,7 +108,7 @@ static void
 ppp_print_hex (register __u8 * out, const __u8 * in, int count)
 ppp_print_hex (register __u8 * out, const __u8 * in, int count)
 {
 {
 	register __u8 next_ch;
 	register __u8 next_ch;
-	static char hex[] = "0123456789ABCDEF";
+	static const char hex[] = "0123456789ABCDEF";
 
 
 	while (count-- > 0) {
 	while (count-- > 0) {
 		next_ch = *in++;
 		next_ch = *in++;

+ 2 - 2
drivers/net/r8169.c

@@ -113,11 +113,11 @@ static int media[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 };
 static int num_media = 0;
 static int num_media = 0;
 
 
 /* Maximum events (Rx packets, etc.) to handle at each interrupt. */
 /* Maximum events (Rx packets, etc.) to handle at each interrupt. */
-static int max_interrupt_work = 20;
+static const int max_interrupt_work = 20;
 
 
 /* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
 /* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
    The RTL chips use a 64 element hash table based on the Ethernet CRC. */
    The RTL chips use a 64 element hash table based on the Ethernet CRC. */
-static int multicast_filter_limit = 32;
+static const int multicast_filter_limit = 32;
 
 
 /* MAC address length */
 /* MAC address length */
 #define MAC_ADDR_LEN	6
 #define MAC_ADDR_LEN	6

+ 4 - 4
drivers/net/s2io.c

@@ -223,7 +223,7 @@ static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid)
 #define SWITCH_SIGN	0xA5A5A5A5A5A5A5A5ULL
 #define SWITCH_SIGN	0xA5A5A5A5A5A5A5A5ULL
 #define	END_SIGN	0x0
 #define	END_SIGN	0x0
 
 
-static u64 herc_act_dtx_cfg[] = {
+static const u64 herc_act_dtx_cfg[] = {
 	/* Set address */
 	/* Set address */
 	0x8000051536750000ULL, 0x80000515367500E0ULL,
 	0x8000051536750000ULL, 0x80000515367500E0ULL,
 	/* Write data */
 	/* Write data */
@@ -244,7 +244,7 @@ static u64 herc_act_dtx_cfg[] = {
 	END_SIGN
 	END_SIGN
 };
 };
 
 
-static u64 xena_mdio_cfg[] = {
+static const u64 xena_mdio_cfg[] = {
 	/* Reset PMA PLL */
 	/* Reset PMA PLL */
 	0xC001010000000000ULL, 0xC0010100000000E0ULL,
 	0xC001010000000000ULL, 0xC0010100000000E0ULL,
 	0xC0010100008000E4ULL,
 	0xC0010100008000E4ULL,
@@ -254,7 +254,7 @@ static u64 xena_mdio_cfg[] = {
 	END_SIGN
 	END_SIGN
 };
 };
 
 
-static u64 xena_dtx_cfg[] = {
+static const u64 xena_dtx_cfg[] = {
 	0x8000051500000000ULL, 0x80000515000000E0ULL,
 	0x8000051500000000ULL, 0x80000515000000E0ULL,
 	0x80000515D93500E4ULL, 0x8001051500000000ULL,
 	0x80000515D93500E4ULL, 0x8001051500000000ULL,
 	0x80010515000000E0ULL, 0x80010515001E00E4ULL,
 	0x80010515000000E0ULL, 0x80010515001E00E4ULL,
@@ -282,7 +282,7 @@ static u64 xena_dtx_cfg[] = {
  * Constants for Fixing the MacAddress problem seen mostly on
  * Constants for Fixing the MacAddress problem seen mostly on
  * Alpha machines.
  * Alpha machines.
  */
  */
-static u64 fix_mac[] = {
+static const u64 fix_mac[] = {
 	0x0060000000000000ULL, 0x0060600000000000ULL,
 	0x0060000000000000ULL, 0x0060600000000000ULL,
 	0x0040600000000000ULL, 0x0000600000000000ULL,
 	0x0040600000000000ULL, 0x0000600000000000ULL,
 	0x0020600000000000ULL, 0x0060600000000000ULL,
 	0x0020600000000000ULL, 0x0060600000000000ULL,

+ 1 - 1
drivers/net/sb1000.c

@@ -59,7 +59,7 @@ static char version[] = "sb1000.c:v1.1.2 6/01/98 (fventuri@mediaone.net)\n";
 #ifdef SB1000_DEBUG
 #ifdef SB1000_DEBUG
 static int sb1000_debug = SB1000_DEBUG;
 static int sb1000_debug = SB1000_DEBUG;
 #else
 #else
-static int sb1000_debug = 1;
+static const int sb1000_debug = 1;
 #endif
 #endif
 
 
 static const int SB1000_IO_EXTENT = 8;
 static const int SB1000_IO_EXTENT = 8;

+ 1 - 1
drivers/net/sis190.c

@@ -366,7 +366,7 @@ static const u32 sis190_intr_mask =
  * Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
  * Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
  * The chips use a 64 element hash table based on the Ethernet CRC.
  * The chips use a 64 element hash table based on the Ethernet CRC.
  */
  */
-static int multicast_filter_limit = 32;
+static const int multicast_filter_limit = 32;
 
 
 static void __mdio_cmd(void __iomem *ioaddr, u32 ctl)
 static void __mdio_cmd(void __iomem *ioaddr, u32 ctl)
 {
 {

+ 4 - 4
drivers/net/sis900.c

@@ -100,7 +100,7 @@ enum {
 	SIS_900 = 0,
 	SIS_900 = 0,
 	SIS_7016
 	SIS_7016
 };
 };
-static char * card_names[] = {
+static const char * card_names[] = {
 	"SiS 900 PCI Fast Ethernet",
 	"SiS 900 PCI Fast Ethernet",
 	"SiS 7016 PCI Fast Ethernet"
 	"SiS 7016 PCI Fast Ethernet"
 };
 };
@@ -115,7 +115,7 @@ MODULE_DEVICE_TABLE (pci, sis900_pci_tbl);
 
 
 static void sis900_read_mode(struct net_device *net_dev, int *speed, int *duplex);
 static void sis900_read_mode(struct net_device *net_dev, int *speed, int *duplex);
 
 
-static struct mii_chip_info {
+static const struct mii_chip_info {
 	const char * name;
 	const char * name;
 	u16 phy_id0;
 	u16 phy_id0;
 	u16 phy_id1;
 	u16 phy_id1;
@@ -400,7 +400,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
 	void *ring_space;
 	void *ring_space;
 	long ioaddr;
 	long ioaddr;
 	int i, ret;
 	int i, ret;
-	char *card_name = card_names[pci_id->driver_data];
+	const char *card_name = card_names[pci_id->driver_data];
 	const char *dev_name = pci_name(pci_dev);
 	const char *dev_name = pci_name(pci_dev);
 
 
 /* when built into the kernel, we only print version if device is found */
 /* when built into the kernel, we only print version if device is found */
@@ -1275,7 +1275,7 @@ static void sis900_timer(unsigned long data)
 	struct net_device *net_dev = (struct net_device *)data;
 	struct net_device *net_dev = (struct net_device *)data;
 	struct sis900_private *sis_priv = net_dev->priv;
 	struct sis900_private *sis_priv = net_dev->priv;
 	struct mii_phy *mii_phy = sis_priv->mii;
 	struct mii_phy *mii_phy = sis_priv->mii;
-	static int next_tick = 5*HZ;
+	static const int next_tick = 5*HZ;
 	u16 status;
 	u16 status;
 
 
 	if (!sis_priv->autong_complete){
 	if (!sis_priv->autong_complete){

+ 7 - 7
drivers/net/skfp/fplustm.c

@@ -89,21 +89,21 @@ static const u_short my_sagp = 0xffff ;	/* short group address (n.u.) */
 /*
 /*
  * useful interrupt bits
  * useful interrupt bits
  */
  */
-static int mac_imsk1u = FM_STXABRS | FM_STXABRA0 | FM_SXMTABT ;
-static int mac_imsk1l = FM_SQLCKS | FM_SQLCKA0 | FM_SPCEPDS | FM_SPCEPDA0|
+static const int mac_imsk1u = FM_STXABRS | FM_STXABRA0 | FM_SXMTABT ;
+static const int mac_imsk1l = FM_SQLCKS | FM_SQLCKA0 | FM_SPCEPDS | FM_SPCEPDA0|
 			FM_STBURS | FM_STBURA0 ;
 			FM_STBURS | FM_STBURA0 ;
 
 
 	/* delete FM_SRBFL after tests */
 	/* delete FM_SRBFL after tests */
-static int mac_imsk2u = FM_SERRSF | FM_SNFSLD | FM_SRCVOVR | FM_SRBFL |
+static const int mac_imsk2u = FM_SERRSF | FM_SNFSLD | FM_SRCVOVR | FM_SRBFL |
 			FM_SMYCLM ;
 			FM_SMYCLM ;
-static int mac_imsk2l = FM_STRTEXR | FM_SDUPCLM | FM_SFRMCTR |
+static const int mac_imsk2l = FM_STRTEXR | FM_SDUPCLM | FM_SFRMCTR |
 			FM_SERRCTR | FM_SLSTCTR |
 			FM_SERRCTR | FM_SLSTCTR |
 			FM_STRTEXP | FM_SMULTDA | FM_SRNGOP ;
 			FM_STRTEXP | FM_SMULTDA | FM_SRNGOP ;
 
 
-static int mac_imsk3u = FM_SRCVOVR2 | FM_SRBFL2 ;
-static int mac_imsk3l = FM_SRPERRQ2 | FM_SRPERRQ1 ;
+static const int mac_imsk3u = FM_SRCVOVR2 | FM_SRBFL2 ;
+static const int mac_imsk3l = FM_SRPERRQ2 | FM_SRPERRQ1 ;
 
 
-static int mac_beacon_imsk2u = FM_SOTRBEC | FM_SMYBEC | FM_SBEC |
+static const int mac_beacon_imsk2u = FM_SOTRBEC | FM_SMYBEC | FM_SBEC |
 			FM_SLOCLM | FM_SHICLM | FM_SMYCLM | FM_SCLM ;
 			FM_SLOCLM | FM_SHICLM | FM_SMYCLM | FM_SCLM ;
 
 
 
 

+ 2 - 2
drivers/net/skfp/pcmplc.c

@@ -186,7 +186,7 @@ static	const struct plt {
  * Do we need the EBUF error during signaling, too, to detect SUPERNET_3
  * Do we need the EBUF error during signaling, too, to detect SUPERNET_3
  * PLL bug?
  * PLL bug?
  */
  */
-static int plc_imsk_na = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK |
+static const int plc_imsk_na = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK |
 			PL_PCM_ENABLED | PL_SELF_TEST | PL_EBUF_ERR;
 			PL_PCM_ENABLED | PL_SELF_TEST | PL_EBUF_ERR;
 #else	/* SUPERNET_3 */
 #else	/* SUPERNET_3 */
 /*
 /*
@@ -195,7 +195,7 @@ static int plc_imsk_na = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK |
 static int plc_imsk_na = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK |
 static int plc_imsk_na = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK |
 			PL_PCM_ENABLED | PL_SELF_TEST ;
 			PL_PCM_ENABLED | PL_SELF_TEST ;
 #endif	/* SUPERNET_3 */
 #endif	/* SUPERNET_3 */
-static int plc_imsk_act = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK |
+static const int plc_imsk_act = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK |
 			PL_PCM_ENABLED | PL_SELF_TEST | PL_EBUF_ERR;
 			PL_PCM_ENABLED | PL_SELF_TEST | PL_EBUF_ERR;
 
 
 /* external functions */
 /* external functions */

+ 1 - 1
drivers/net/skfp/skfddi.c

@@ -67,7 +67,7 @@
 /* each new release!!! */
 /* each new release!!! */
 #define VERSION		"2.07"
 #define VERSION		"2.07"
 
 
-static const char *boot_msg = 
+static const char * const boot_msg = 
 	"SysKonnect FDDI PCI Adapter driver v" VERSION " for\n"
 	"SysKonnect FDDI PCI Adapter driver v" VERSION " for\n"
 	"  SK-55xx/SK-58xx adapters (SK-NET FDDI-FP/UP/LP)";
 	"  SK-55xx/SK-58xx adapters (SK-NET FDDI-FP/UP/LP)";
 
 

+ 2 - 2
drivers/net/starfire.c

@@ -201,7 +201,7 @@ static int max_interrupt_work = 20;
 static int mtu;
 static int mtu;
 /* Maximum number of multicast addresses to filter (vs. rx-all-multicast).
 /* Maximum number of multicast addresses to filter (vs. rx-all-multicast).
    The Starfire has a 512 element hash table based on the Ethernet CRC. */
    The Starfire has a 512 element hash table based on the Ethernet CRC. */
-static int multicast_filter_limit = 512;
+static const int multicast_filter_limit = 512;
 /* Whether to do TCP/UDP checksums in hardware */
 /* Whether to do TCP/UDP checksums in hardware */
 static int enable_hw_cksum = 1;
 static int enable_hw_cksum = 1;
 
 
@@ -463,7 +463,7 @@ static struct pci_device_id starfire_pci_tbl[] = {
 MODULE_DEVICE_TABLE(pci, starfire_pci_tbl);
 MODULE_DEVICE_TABLE(pci, starfire_pci_tbl);
 
 
 /* A chip capabilities table, matching the CH_xxx entries in xxx_pci_tbl[] above. */
 /* A chip capabilities table, matching the CH_xxx entries in xxx_pci_tbl[] above. */
-static struct chip_info {
+static const struct chip_info {
 	const char *name;
 	const char *name;
 	int drv_flags;
 	int drv_flags;
 } netdrv_tbl[] __devinitdata = {
 } netdrv_tbl[] __devinitdata = {

+ 2 - 2
drivers/net/sundance.c

@@ -106,7 +106,7 @@
 static int debug = 1;			/* 1 normal messages, 0 quiet .. 7 verbose. */
 static int debug = 1;			/* 1 normal messages, 0 quiet .. 7 verbose. */
 /* Maximum number of multicast addresses to filter (vs. rx-all-multicast).
 /* Maximum number of multicast addresses to filter (vs. rx-all-multicast).
    Typical is a 64 element hash table based on the Ethernet CRC.  */
    Typical is a 64 element hash table based on the Ethernet CRC.  */
-static int multicast_filter_limit = 32;
+static const int multicast_filter_limit = 32;
 
 
 /* Set the copy breakpoint for the copy-only-tiny-frames scheme.
 /* Set the copy breakpoint for the copy-only-tiny-frames scheme.
    Setting to > 1518 effectively disables this feature.
    Setting to > 1518 effectively disables this feature.
@@ -298,7 +298,7 @@ enum {
 struct pci_id_info {
 struct pci_id_info {
         const char *name;
         const char *name;
 };
 };
-static struct pci_id_info pci_id_tbl[] = {
+static const struct pci_id_info pci_id_tbl[] = {
 	{"D-Link DFE-550TX FAST Ethernet Adapter"},
 	{"D-Link DFE-550TX FAST Ethernet Adapter"},
 	{"D-Link DFE-550FX 100Mbps Fiber-optics Adapter"},
 	{"D-Link DFE-550FX 100Mbps Fiber-optics Adapter"},
 	{"D-Link DFE-580TX 4 port Server Adapter"},
 	{"D-Link DFE-580TX 4 port Server Adapter"},

+ 1 - 1
drivers/net/sungem_phy.c

@@ -39,7 +39,7 @@
 #include "sungem_phy.h"
 #include "sungem_phy.h"
 
 
 /* Link modes of the BCM5400 PHY */
 /* Link modes of the BCM5400 PHY */
-static int phy_BCM5400_link_table[8][3] = {
+static const int phy_BCM5400_link_table[8][3] = {
 	{ 0, 0, 0 },	/* No link */
 	{ 0, 0, 0 },	/* No link */
 	{ 0, 0, 0 },	/* 10BT Half Duplex */
 	{ 0, 0, 0 },	/* 10BT Half Duplex */
 	{ 1, 0, 0 },	/* 10BT Full Duplex */
 	{ 1, 0, 0 },	/* 10BT Full Duplex */

+ 2 - 2
drivers/net/tg3.c

@@ -7785,7 +7785,7 @@ static int tg3_test_link(struct tg3 *tp)
 }
 }
 
 
 /* Only test the commonly used registers */
 /* Only test the commonly used registers */
-static int tg3_test_registers(struct tg3 *tp)
+static const int tg3_test_registers(struct tg3 *tp)
 {
 {
 	int i, is_5705;
 	int i, is_5705;
 	u32 offset, read_mask, write_mask, val, save_val, read_val;
 	u32 offset, read_mask, write_mask, val, save_val, read_val;
@@ -7999,7 +7999,7 @@ out:
 
 
 static int tg3_do_mem_test(struct tg3 *tp, u32 offset, u32 len)
 static int tg3_do_mem_test(struct tg3 *tp, u32 offset, u32 len)
 {
 {
-	static u32 test_pattern[] = { 0x00000000, 0xffffffff, 0xaa55a55a };
+	static const u32 test_pattern[] = { 0x00000000, 0xffffffff, 0xaa55a55a };
 	int i;
 	int i;
 	u32 j;
 	u32 j;
 
 

+ 1 - 1
drivers/net/typhoon.c

@@ -178,7 +178,7 @@ enum typhoon_cards {
 };
 };
 
 
 /* directly indexed by enum typhoon_cards, above */
 /* directly indexed by enum typhoon_cards, above */
-static struct typhoon_card_info typhoon_card_info[] __devinitdata = {
+static const struct typhoon_card_info typhoon_card_info[] __devinitdata = {
 	{ "3Com Typhoon (3C990-TX)",
 	{ "3Com Typhoon (3C990-TX)",
 		TYPHOON_CRYPTO_NONE},
 		TYPHOON_CRYPTO_NONE},
 	{ "3Com Typhoon (3CR990-TX-95)",
 	{ "3Com Typhoon (3CR990-TX-95)",

+ 4 - 1
drivers/net/wireless/hostap/hostap_cs.c

@@ -877,7 +877,6 @@ static struct pcmcia_device_id hostap_cs_ids[] = {
 	PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777),
 	PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777),
 	PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000),
 	PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000),
 	PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002),
 	PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002),
-	PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002),
 	PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002),
 	PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002),
 	PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030b),
 	PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030b),
 	PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612),
 	PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612),
@@ -891,6 +890,10 @@ static struct pcmcia_device_id hostap_cs_ids[] = {
 	PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
 	PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
 	PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
 	PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
 	PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010),
 	PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010),
+	PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "INTERSIL",
+					 0x74c5e40d),
+	PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "Intersil",
+					 0x4b801a17),
 	PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus",
 	PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus",
 				    0x7a954bd9, 0x74be00c6),
 				    0x7a954bd9, 0x74be00c6),
 	PCMCIA_DEVICE_PROD_ID1234(
 	PCMCIA_DEVICE_PROD_ID1234(

+ 3 - 3
drivers/net/yellowfin.c

@@ -69,8 +69,8 @@ static int fifo_cfg = 0x0020;				/* Bypass external Tx FIFO. */
 static int dma_ctrl = 0x00CAC277;			/* Override when loading module! */
 static int dma_ctrl = 0x00CAC277;			/* Override when loading module! */
 static int fifo_cfg = 0x0028;
 static int fifo_cfg = 0x0028;
 #else
 #else
-static int dma_ctrl = 0x004A0263; 			/* Constrained by errata */
-static int fifo_cfg = 0x0020;				/* Bypass external Tx FIFO. */
+static const int dma_ctrl = 0x004A0263; 			/* Constrained by errata */
+static const int fifo_cfg = 0x0020;				/* Bypass external Tx FIFO. */
 #endif
 #endif
 
 
 /* Set the copy breakpoint for the copy-only-tiny-frames scheme.
 /* Set the copy breakpoint for the copy-only-tiny-frames scheme.
@@ -266,7 +266,7 @@ struct pci_id_info {
         int drv_flags;                          /* Driver use, intended as capability flags. */
         int drv_flags;                          /* Driver use, intended as capability flags. */
 };
 };
 
 
-static struct pci_id_info pci_id_tbl[] = {
+static const struct pci_id_info pci_id_tbl[] = {
 	{"Yellowfin G-NIC Gigabit Ethernet", { 0x07021000, 0xffffffff},
 	{"Yellowfin G-NIC Gigabit Ethernet", { 0x07021000, 0xffffffff},
 	 PCI_IOTYPE, YELLOWFIN_SIZE,
 	 PCI_IOTYPE, YELLOWFIN_SIZE,
 	 FullTxStatus | IsGigabit | HasMulticastBug | HasMACAddrBug | DontUseEeprom},
 	 FullTxStatus | IsGigabit | HasMulticastBug | HasMACAddrBug | DontUseEeprom},

+ 22 - 18
drivers/pcmcia/ds.c

@@ -352,11 +352,20 @@ static void pcmcia_release_dev(struct device *dev)
 	kfree(p_dev);
 	kfree(p_dev);
 }
 }
 
 
+static void pcmcia_add_pseudo_device(struct pcmcia_socket *s)
+{
+	if (!s->pcmcia_state.device_add_pending) {
+		s->pcmcia_state.device_add_pending = 1;
+		schedule_work(&s->device_add);
+	}
+	return;
+}
 
 
 static int pcmcia_device_probe(struct device * dev)
 static int pcmcia_device_probe(struct device * dev)
 {
 {
 	struct pcmcia_device *p_dev;
 	struct pcmcia_device *p_dev;
 	struct pcmcia_driver *p_drv;
 	struct pcmcia_driver *p_drv;
+	struct pcmcia_device_id *did;
 	struct pcmcia_socket *s;
 	struct pcmcia_socket *s;
 	int ret = 0;
 	int ret = 0;
 
 
@@ -392,6 +401,19 @@ static int pcmcia_device_probe(struct device * dev)
 	}
 	}
 
 
 	ret = p_drv->probe(p_dev);
 	ret = p_drv->probe(p_dev);
+	if (ret)
+		goto put_module;
+
+	/* handle pseudo multifunction devices:
+	 * there are at most two pseudo multifunction devices.
+	 * if we're matching against the first, schedule a
+	 * call which will then check whether there are two
+	 * pseudo devices, and if not, add the second one.
+	 */
+	did = (struct pcmcia_device_id *) p_dev->dev.driver_data;
+	if ((did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) &&
+	    (p_dev->socket->device_count == 1) && (p_dev->device_no == 0))
+		pcmcia_add_pseudo_device(p_dev->socket);
 
 
  put_module:
  put_module:
 	if (ret)
 	if (ret)
@@ -660,15 +682,6 @@ static void pcmcia_delayed_add_pseudo_device(void *data)
 	s->pcmcia_state.device_add_pending = 0;
 	s->pcmcia_state.device_add_pending = 0;
 }
 }
 
 
-static inline void pcmcia_add_pseudo_device(struct pcmcia_socket *s)
-{
-	if (!s->pcmcia_state.device_add_pending) {
-		s->pcmcia_state.device_add_pending = 1;
-		schedule_work(&s->device_add);
-	}
-	return;
-}
-
 static int pcmcia_requery(struct device *dev, void * _data)
 static int pcmcia_requery(struct device *dev, void * _data)
 {
 {
 	struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
 	struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
@@ -755,15 +768,6 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
 	}
 	}
 
 
 	if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) {
 	if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) {
-		/* handle pseudo multifunction devices:
-		 * there are at most two pseudo multifunction devices.
-		 * if we're matching against the first, schedule a
-		 * call which will then check whether there are two
-		 * pseudo devices, and if not, add the second one.
-		 */
-		if (dev->device_no == 0)
-			pcmcia_add_pseudo_device(dev->socket);
-
 		if (dev->device_no != did->device_no)
 		if (dev->device_no != did->device_no)
 			return 0;
 			return 0;
 	}
 	}

+ 52 - 33
drivers/scsi/aha152x.c

@@ -1260,16 +1260,15 @@ static void free_hard_reset_SCs(struct Scsi_Host *shpnt, Scsi_Cmnd **SCs)
  * Reset the bus
  * Reset the bus
  *
  *
  */
  */
-static int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
+static int aha152x_bus_reset_host(struct Scsi_Host *shpnt)
 {
 {
-	struct Scsi_Host *shpnt = SCpnt->device->host;
 	unsigned long flags;
 	unsigned long flags;
 
 
 	DO_LOCK(flags);
 	DO_LOCK(flags);
 
 
 #if defined(AHA152X_DEBUG)
 #if defined(AHA152X_DEBUG)
 	if(HOSTDATA(shpnt)->debug & debug_eh) {
 	if(HOSTDATA(shpnt)->debug & debug_eh) {
-		printk(DEBUG_LEAD "aha152x_bus_reset(%p)", CMDINFO(SCpnt), SCpnt);
+		printk(KERN_DEBUG "scsi%d: bus reset", shpnt->host_no);
 		show_queues(shpnt);
 		show_queues(shpnt);
 	}
 	}
 #endif
 #endif
@@ -1277,14 +1276,14 @@ static int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
 	free_hard_reset_SCs(shpnt, &ISSUE_SC);
 	free_hard_reset_SCs(shpnt, &ISSUE_SC);
 	free_hard_reset_SCs(shpnt, &DISCONNECTED_SC);
 	free_hard_reset_SCs(shpnt, &DISCONNECTED_SC);
 
 
-	DPRINTK(debug_eh, DEBUG_LEAD "resetting bus\n", CMDINFO(SCpnt));
+	DPRINTK(debug_eh, KERN_DEBUG "scsi%d: resetting bus\n", shpnt->host_no);
 
 
 	SETPORT(SCSISEQ, SCSIRSTO);
 	SETPORT(SCSISEQ, SCSIRSTO);
 	mdelay(256);
 	mdelay(256);
 	SETPORT(SCSISEQ, 0);
 	SETPORT(SCSISEQ, 0);
 	mdelay(DELAY);
 	mdelay(DELAY);
 
 
-	DPRINTK(debug_eh, DEBUG_LEAD "bus resetted\n", CMDINFO(SCpnt));
+	DPRINTK(debug_eh, KERN_DEBUG "scsi%d: bus resetted\n", shpnt->host_no);
 
 
 	setup_expected_interrupts(shpnt);
 	setup_expected_interrupts(shpnt);
 	if(HOSTDATA(shpnt)->commands==0)
 	if(HOSTDATA(shpnt)->commands==0)
@@ -1295,6 +1294,14 @@ static int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
 	return SUCCESS;
 	return SUCCESS;
 }
 }
 
 
+/*
+ * Reset the bus
+ *
+ */
+static int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
+{
+	return aha152x_bus_reset_host(SCpnt->device->host);
+}
 
 
 /*
 /*
  *  Restore default values to the AIC-6260 registers and reset the fifos
  *  Restore default values to the AIC-6260 registers and reset the fifos
@@ -1337,22 +1344,27 @@ static void reset_ports(struct Scsi_Host *shpnt)
  * Reset the host (bus and controller)
  * Reset the host (bus and controller)
  *
  *
  */
  */
-int aha152x_host_reset(Scsi_Cmnd * SCpnt)
+int aha152x_host_reset_host(struct Scsi_Host *shpnt)
 {
 {
-#if defined(AHA152X_DEBUG)
-	struct Scsi_Host *shpnt = SCpnt->device->host;
-#endif
-
-	DPRINTK(debug_eh, DEBUG_LEAD "aha152x_host_reset(%p)\n", CMDINFO(SCpnt), SCpnt);
+	DPRINTK(debug_eh, KERN_DEBUG "scsi%d: host reset\n", shpnt->host_no);
 
 
-	aha152x_bus_reset(SCpnt);
+	aha152x_bus_reset_host(shpnt);
 
 
-	DPRINTK(debug_eh, DEBUG_LEAD "resetting ports\n", CMDINFO(SCpnt));
-	reset_ports(SCpnt->device->host);
+	DPRINTK(debug_eh, KERN_DEBUG "scsi%d: resetting ports\n", shpnt->host_no);
+	reset_ports(shpnt);
 
 
 	return SUCCESS;
 	return SUCCESS;
 }
 }
 
 
+/*
+ * Reset the host (bus and controller)
+ * 
+ */
+static int aha152x_host_reset(Scsi_Cmnd *SCpnt)
+{
+	return aha152x_host_reset_host(SCpnt->device->host);
+}
+
 /*
 /*
  * Return the "logical geometry"
  * Return the "logical geometry"
  *
  *
@@ -1431,22 +1443,18 @@ static void run(void)
 {
 {
 	int i;
 	int i;
 	for (i = 0; i<ARRAY_SIZE(aha152x_host); i++) {
 	for (i = 0; i<ARRAY_SIZE(aha152x_host); i++) {
-		struct Scsi_Host *shpnt = aha152x_host[i];
-		if (shpnt && HOSTDATA(shpnt)->service) {
-			HOSTDATA(shpnt)->service=0;
-			is_complete(shpnt);
-		}
+		is_complete(aha152x_host[i]);
 	}
 	}
 }
 }
 
 
 /*
 /*
- *    Interrupts handler
+ * Interrupt handler
  *
  *
  */
  */
-
 static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs)
 static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs)
 {
 {
 	struct Scsi_Host *shpnt = lookup_irq(irqno);
 	struct Scsi_Host *shpnt = lookup_irq(irqno);
+	unsigned long flags;
 	unsigned char rev, dmacntrl0;
 	unsigned char rev, dmacntrl0;
 
 
 	if (!shpnt) {
 	if (!shpnt) {
@@ -1472,23 +1480,23 @@ static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs)
 	if ((rev == 0xFF) && (dmacntrl0 == 0xFF))
 	if ((rev == 0xFF) && (dmacntrl0 == 0xFF))
 		return IRQ_NONE;
 		return IRQ_NONE;
 
 
+	if( TESTLO(DMASTAT, INTSTAT) )
+		return IRQ_NONE;	
+
 	/* no more interrupts from the controller, while we're busy.
 	/* no more interrupts from the controller, while we're busy.
 	   INTEN is restored by the BH handler */
 	   INTEN is restored by the BH handler */
 	CLRBITS(DMACNTRL0, INTEN);
 	CLRBITS(DMACNTRL0, INTEN);
 
 
-#if 0
-	/* check if there is already something to be
-           serviced; should not happen */
-	if(HOSTDATA(shpnt)->service) {
-		printk(KERN_ERR "aha152x%d: lost interrupt (%d)\n", HOSTNO, HOSTDATA(shpnt)->service);
-	        show_queues(shpnt);
+	DO_LOCK(flags);
+	if( HOSTDATA(shpnt)->service==0 ) {
+		HOSTDATA(shpnt)->service=1;
+
+		/* Poke the BH handler */
+		INIT_WORK(&aha152x_tq, (void *) run, NULL);
+		schedule_work(&aha152x_tq);
 	}
 	}
-#endif
-	
-	/* Poke the BH handler */
-	HOSTDATA(shpnt)->service++;
-	INIT_WORK(&aha152x_tq, (void *) run, NULL);
-	schedule_work(&aha152x_tq);
+	DO_UNLOCK(flags);
+
 	return IRQ_HANDLED;
 	return IRQ_HANDLED;
 }
 }
 
 
@@ -2527,7 +2535,18 @@ static void is_complete(struct Scsi_Host *shpnt)
 	unsigned long flags;
 	unsigned long flags;
 	int pending;
 	int pending;
 
 
+	if(!shpnt)
+		return;
+
 	DO_LOCK(flags);
 	DO_LOCK(flags);
+
+	if( HOSTDATA(shpnt)->service==0 )  {
+		DO_UNLOCK(flags);
+		return;
+	}
+
+	HOSTDATA(shpnt)->service = 0;
+
 	if(HOSTDATA(shpnt)->in_intr) {
 	if(HOSTDATA(shpnt)->in_intr) {
 		DO_UNLOCK(flags);
 		DO_UNLOCK(flags);
 		/* aha152x_error never returns.. */
 		/* aha152x_error never returns.. */

+ 1 - 1
drivers/scsi/aha152x.h

@@ -332,6 +332,6 @@ struct aha152x_setup {
 
 
 struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *);
 struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *);
 void aha152x_release(struct Scsi_Host *);
 void aha152x_release(struct Scsi_Host *);
-int aha152x_host_reset(Scsi_Cmnd *);
+int aha152x_host_reset_host(struct Scsi_Host *);
 
 
 #endif /* _AHA152X_H */
 #endif /* _AHA152X_H */

+ 0 - 21
drivers/scsi/jazz_esp.c

@@ -65,27 +65,6 @@ static int jazz_esp_release(struct Scsi_Host *shost)
 	return 0;
 	return 0;
 }
 }
 
 
-static struct scsi_host_template driver_template = {
-	.proc_name		= "jazz_esp",
-	.proc_info		= &esp_proc_info,
-	.name			= "ESP 100/100a/200",
-	.detect			= jazz_esp_detect,
-	.slave_alloc		= esp_slave_alloc,
-	.slave_destroy		= esp_slave_destroy,
-	.release		= jazz_esp_release,
-	.info			= esp_info,
-	.queuecommand		= esp_queue,
-	.eh_abort_handler	= esp_abort,
-	.eh_bus_reset_handler	= esp_reset,
-	.can_queue		= 7,
-	.this_id		= 7,
-	.sg_tablesize		= SG_ALL,
-	.cmd_per_lun		= 1,
-	.use_clustering		= DISABLE_CLUSTERING,
-};
-
-#include "scsi_module.c"
-
 /***************************************************************** Detection */
 /***************************************************************** Detection */
 static int jazz_esp_detect(struct scsi_host_template *tpnt)
 static int jazz_esp_detect(struct scsi_host_template *tpnt)
 {
 {

+ 15 - 14
drivers/scsi/megaraid/megaraid_sas.c

@@ -793,6 +793,20 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *))
 	return 0;
 	return 0;
 }
 }
 
 
+static int megasas_slave_configure(struct scsi_device *sdev)
+{
+	/*
+	 * Don't export physical disk devices to the disk driver.
+	 *
+	 * FIXME: Currently we don't export them to the midlayer at all.
+	 * 	  That will be fixed once LSI engineers have audited the
+	 * 	  firmware for possible issues.
+	 */
+	if (sdev->channel < MEGASAS_MAX_PD_CHANNELS && sdev->type == TYPE_DISK)
+		return -ENXIO;
+	return 0;
+}
+
 /**
 /**
  * megasas_wait_for_outstanding -	Wait for all outstanding cmds
  * megasas_wait_for_outstanding -	Wait for all outstanding cmds
  * @instance:				Adapter soft state
  * @instance:				Adapter soft state
@@ -943,6 +957,7 @@ static struct scsi_host_template megasas_template = {
 	.module = THIS_MODULE,
 	.module = THIS_MODULE,
 	.name = "LSI Logic SAS based MegaRAID driver",
 	.name = "LSI Logic SAS based MegaRAID driver",
 	.proc_name = "megaraid_sas",
 	.proc_name = "megaraid_sas",
+	.slave_configure = megasas_slave_configure,
 	.queuecommand = megasas_queue_command,
 	.queuecommand = megasas_queue_command,
 	.eh_device_reset_handler = megasas_reset_device,
 	.eh_device_reset_handler = megasas_reset_device,
 	.eh_bus_reset_handler = megasas_reset_bus_host,
 	.eh_bus_reset_handler = megasas_reset_bus_host,
@@ -1071,20 +1086,6 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 			break;
 			break;
 		}
 		}
 
 
-		/*
-		 * Don't export physical disk devices to mid-layer.
-		 */
-		if (!MEGASAS_IS_LOGICAL(cmd->scmd) &&
-		    (hdr->cmd_status == MFI_STAT_OK) &&
-		    (cmd->scmd->cmnd[0] == INQUIRY)) {
-
-			if (((*(u8 *) cmd->scmd->request_buffer) & 0x1F) ==
-			    TYPE_DISK) {
-				cmd->scmd->result = DID_BAD_TARGET << 16;
-				exception = 1;
-			}
-		}
-
 	case MFI_CMD_LD_READ:
 	case MFI_CMD_LD_READ:
 	case MFI_CMD_LD_WRITE:
 	case MFI_CMD_LD_WRITE:
 
 

+ 1 - 3
drivers/scsi/pcmcia/aha152x_stub.c

@@ -275,10 +275,8 @@ static int aha152x_resume(struct pcmcia_device *dev)
 
 
 	link->state &= ~DEV_SUSPEND;
 	link->state &= ~DEV_SUSPEND;
 	if (link->state & DEV_CONFIG) {
 	if (link->state & DEV_CONFIG) {
-		Scsi_Cmnd tmp;
 		pcmcia_request_configuration(link->handle, &link->conf);
 		pcmcia_request_configuration(link->handle, &link->conf);
-		tmp.device->host = info->host;
-		aha152x_host_reset(&tmp);
+		aha152x_host_reset_host(info->host);
 	}
 	}
 
 
 	return 0;
 	return 0;

+ 2 - 2
drivers/scsi/scsi_error.c

@@ -1308,7 +1308,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
 	 * the request was not marked fast fail.  Note that above,
 	 * the request was not marked fast fail.  Note that above,
 	 * even if the request is marked fast fail, we still requeue
 	 * even if the request is marked fast fail, we still requeue
 	 * for queue congestion conditions (QUEUE_FULL or BUSY) */
 	 * for queue congestion conditions (QUEUE_FULL or BUSY) */
-	if ((++scmd->retries) < scmd->allowed 
+	if ((++scmd->retries) <= scmd->allowed
 	    && !blk_noretry_request(scmd->request)) {
 	    && !blk_noretry_request(scmd->request)) {
 		return NEEDS_RETRY;
 		return NEEDS_RETRY;
 	} else {
 	} else {
@@ -1433,7 +1433,7 @@ static void scsi_eh_flush_done_q(struct list_head *done_q)
 		list_del_init(&scmd->eh_entry);
 		list_del_init(&scmd->eh_entry);
 		if (scsi_device_online(scmd->device) &&
 		if (scsi_device_online(scmd->device) &&
 		    !blk_noretry_request(scmd->request) &&
 		    !blk_noretry_request(scmd->request) &&
-		    (++scmd->retries < scmd->allowed)) {
+		    (++scmd->retries <= scmd->allowed)) {
 			SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush"
 			SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush"
 							  " retry cmd: %p\n",
 							  " retry cmd: %p\n",
 							  current->comm,
 							  current->comm,

+ 1 - 1
drivers/scsi/scsi_lib.c

@@ -1498,7 +1498,7 @@ static void scsi_kill_request(struct request *req, request_queue_t *q)
 static void scsi_softirq_done(struct request *rq)
 static void scsi_softirq_done(struct request *rq)
 {
 {
 	struct scsi_cmnd *cmd = rq->completion_data;
 	struct scsi_cmnd *cmd = rq->completion_data;
-	unsigned long wait_for = cmd->allowed * cmd->timeout_per_command;
+	unsigned long wait_for = (cmd->allowed + 1) * cmd->timeout_per_command;
 	int disposition;
 	int disposition;
 
 
 	INIT_LIST_HEAD(&cmd->eh_entry);
 	INIT_LIST_HEAD(&cmd->eh_entry);

+ 14 - 2
drivers/scsi/scsi_scan.c

@@ -752,8 +752,20 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
 
 
 	transport_configure_device(&sdev->sdev_gendev);
 	transport_configure_device(&sdev->sdev_gendev);
 
 
-	if (sdev->host->hostt->slave_configure)
-		sdev->host->hostt->slave_configure(sdev);
+	if (sdev->host->hostt->slave_configure) {
+		int ret = sdev->host->hostt->slave_configure(sdev);
+		if (ret) {
+			/*
+			 * if LLDD reports slave not present, don't clutter
+			 * console with alloc failure messages
+			 */
+			if (ret != -ENXIO) {
+				sdev_printk(KERN_ERR, sdev,
+					"failed to configure device\n");
+			}
+			return SCSI_SCAN_NO_RESPONSE;
+		}
+	}
 
 
 	/*
 	/*
 	 * Ok, the device is now all set up, we can
 	 * Ok, the device is now all set up, we can

+ 1 - 2
drivers/scsi/scsi_transport_fc.c

@@ -1498,8 +1498,7 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
 	}
 	}
 
 
 	/* Search the bindings array */
 	/* Search the bindings array */
-	if (likely((ids->roles & FC_RPORT_ROLE_FCP_TARGET) &&
-		(fc_host_tgtid_bind_type(shost) != FC_TGTID_BIND_NONE))) {
+	if (fc_host_tgtid_bind_type(shost) != FC_TGTID_BIND_NONE) {
 
 
 		/* search for a matching consistent binding */
 		/* search for a matching consistent binding */
 
 

+ 1 - 1
drivers/scsi/sg.c

@@ -2162,7 +2162,7 @@ sg_link_reserve(Sg_fd * sfp, Sg_request * srp, int size)
 
 
 	srp->res_used = 1;
 	srp->res_used = 1;
 	SCSI_LOG_TIMEOUT(4, printk("sg_link_reserve: size=%d\n", size));
 	SCSI_LOG_TIMEOUT(4, printk("sg_link_reserve: size=%d\n", size));
-	rem = size = (size + 1) & (~1);	/* round to even for aha1542 */
+	rem = size;
 
 
 	for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sg) {
 	for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sg) {
 		num = sg->length;
 		num = sg->length;

+ 2 - 0
drivers/scsi/sym53c8xx_2/sym_hipd.c

@@ -919,6 +919,8 @@ static int sym_prepare_setting(struct Scsi_Host *shost, struct sym_hcb *np, stru
 
 
 		tp->usrflags |= (SYM_DISC_ENABLED | SYM_TAGS_ENABLED);
 		tp->usrflags |= (SYM_DISC_ENABLED | SYM_TAGS_ENABLED);
 		tp->usrtags = SYM_SETUP_MAX_TAG;
 		tp->usrtags = SYM_SETUP_MAX_TAG;
+		tp->usr_width = np->maxwide;
+		tp->usr_period = 9;
 
 
 		sym_nvram_setup_target(tp, i, nvram);
 		sym_nvram_setup_target(tp, i, nvram);
 
 

+ 12 - 133
fs/9p/fid.c

@@ -1,7 +1,7 @@
 /*
 /*
  * V9FS FID Management
  * V9FS FID Management
  *
  *
- *  Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com>
+ *  Copyright (C) 2005, 2006 by Eric Van Hensbergen <ericvh@gmail.com>
  *
  *
  *  This program is free software; you can redistribute it and/or modify
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@
  *
  *
  */
  */
 
 
-static int v9fs_fid_insert(struct v9fs_fid *fid, struct dentry *dentry)
+int v9fs_fid_insert(struct v9fs_fid *fid, struct dentry *dentry)
 {
 {
 	struct list_head *fid_list = (struct list_head *)dentry->d_fsdata;
 	struct list_head *fid_list = (struct list_head *)dentry->d_fsdata;
 	dprintk(DEBUG_9P, "fid %d (%p) dentry %s (%p)\n", fid->fid, fid,
 	dprintk(DEBUG_9P, "fid %d (%p) dentry %s (%p)\n", fid->fid, fid,
@@ -57,7 +57,6 @@ static int v9fs_fid_insert(struct v9fs_fid *fid, struct dentry *dentry)
 	}
 	}
 
 
 	fid->uid = current->uid;
 	fid->uid = current->uid;
-	fid->pid = current->pid;
 	list_add(&fid->list, fid_list);
 	list_add(&fid->list, fid_list);
 	return 0;
 	return 0;
 }
 }
@@ -68,14 +67,11 @@ static int v9fs_fid_insert(struct v9fs_fid *fid, struct dentry *dentry)
  *
  *
  */
  */
 
 
-struct v9fs_fid *v9fs_fid_create(struct dentry *dentry,
-	struct v9fs_session_info *v9ses, int fid, int create)
+struct v9fs_fid *v9fs_fid_create(struct v9fs_session_info *v9ses, int fid)
 {
 {
 	struct v9fs_fid *new;
 	struct v9fs_fid *new;
 
 
-	dprintk(DEBUG_9P, "fid create dentry %p, fid %d, create %d\n",
-		dentry, fid, create);
-
+	dprintk(DEBUG_9P, "fid create fid %d\n", fid);
 	new = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL);
 	new = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL);
 	if (new == NULL) {
 	if (new == NULL) {
 		dprintk(DEBUG_ERROR, "Out of Memory\n");
 		dprintk(DEBUG_ERROR, "Out of Memory\n");
@@ -85,19 +81,13 @@ struct v9fs_fid *v9fs_fid_create(struct dentry *dentry,
 	new->fid = fid;
 	new->fid = fid;
 	new->v9ses = v9ses;
 	new->v9ses = v9ses;
 	new->fidopen = 0;
 	new->fidopen = 0;
-	new->fidcreate = create;
 	new->fidclunked = 0;
 	new->fidclunked = 0;
 	new->iounit = 0;
 	new->iounit = 0;
 	new->rdir_pos = 0;
 	new->rdir_pos = 0;
 	new->rdir_fcall = NULL;
 	new->rdir_fcall = NULL;
+	INIT_LIST_HEAD(&new->list);
 
 
-	if (v9fs_fid_insert(new, dentry) == 0)
-		return new;
-	else {
-		dprintk(DEBUG_ERROR, "Problems inserting to dentry\n");
-		kfree(new);
-		return NULL;
-	}
+	return new;
 }
 }
 
 
 /**
 /**
@@ -112,141 +102,30 @@ void v9fs_fid_destroy(struct v9fs_fid *fid)
 	kfree(fid);
 	kfree(fid);
 }
 }
 
 
-/**
- * v9fs_fid_walk_up - walks from the process current directory
- * 	up to the specified dentry.
- */
-static struct v9fs_fid *v9fs_fid_walk_up(struct dentry *dentry)
-{
-	int fidnum, cfidnum, err;
-	struct v9fs_fid *cfid;
-	struct dentry *cde;
-	struct v9fs_session_info *v9ses;
-
-	v9ses = v9fs_inode2v9ses(current->fs->pwd->d_inode);
-	cfid = v9fs_fid_lookup(current->fs->pwd);
-	if (cfid == NULL) {
-		dprintk(DEBUG_ERROR, "process cwd doesn't have a fid\n");
-		return ERR_PTR(-ENOENT);
-	}
-
-	cfidnum = cfid->fid;
-	cde = current->fs->pwd;
-	/* TODO: take advantage of multiwalk */
-
-	fidnum = v9fs_get_idpool(&v9ses->fidpool);
-	if (fidnum < 0) {
-		dprintk(DEBUG_ERROR, "could not get a new fid num\n");
-		err = -ENOENT;
-		goto clunk_fid;
-	}
-
-	while (cde != dentry) {
-		if (cde == cde->d_parent) {
-			dprintk(DEBUG_ERROR, "can't find dentry\n");
-			err = -ENOENT;
-			goto clunk_fid;
-		}
-
-		err = v9fs_t_walk(v9ses, cfidnum, fidnum, "..", NULL);
-		if (err < 0) {
-			dprintk(DEBUG_ERROR, "problem walking to parent\n");
-			goto clunk_fid;
-		}
-
-		cfidnum = fidnum;
-		cde = cde->d_parent;
-	}
-
-	return v9fs_fid_create(dentry, v9ses, fidnum, 0);
-
-clunk_fid:
-	v9fs_t_clunk(v9ses, fidnum);
-	return ERR_PTR(err);
-}
-
 /**
 /**
  * v9fs_fid_lookup - retrieve the right fid from a  particular dentry
  * v9fs_fid_lookup - retrieve the right fid from a  particular dentry
  * @dentry: dentry to look for fid in
  * @dentry: dentry to look for fid in
  * @type: intent of lookup (operation or traversal)
  * @type: intent of lookup (operation or traversal)
  *
  *
- * search list of fids associated with a dentry for a fid with a matching
- * thread id or uid.  If that fails, look up the dentry's parents to see if you
- * can find a matching fid.
+ * find a fid in the dentry
+ *
+ * TODO: only match fids that have the same uid as current user
  *
  *
  */
  */
 
 
 struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry)
 struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry)
 {
 {
 	struct list_head *fid_list = (struct list_head *)dentry->d_fsdata;
 	struct list_head *fid_list = (struct list_head *)dentry->d_fsdata;
-	struct v9fs_fid *current_fid = NULL;
-	struct v9fs_fid *temp = NULL;
 	struct v9fs_fid *return_fid = NULL;
 	struct v9fs_fid *return_fid = NULL;
 
 
 	dprintk(DEBUG_9P, " dentry: %s (%p)\n", dentry->d_iname, dentry);
 	dprintk(DEBUG_9P, " dentry: %s (%p)\n", dentry->d_iname, dentry);
 
 
-	if (fid_list) {
-		list_for_each_entry_safe(current_fid, temp, fid_list, list) {
-			if (!current_fid->fidcreate) {
-				return_fid = current_fid;
-				break;
-			}
-		}
-
-		if (!return_fid)
-			return_fid = current_fid;
-	}
-
-	/* we are at the root but didn't match */
-	if ((!return_fid) && (dentry->d_parent == dentry)) {
-		/* TODO: clone attach with new uid */
-		return_fid = current_fid;
-	}
+	if (fid_list)
+		return_fid = list_entry(fid_list->next, struct v9fs_fid, list);
 
 
 	if (!return_fid) {
 	if (!return_fid) {
-		struct dentry *par = current->fs->pwd->d_parent;
-		int count = 1;
-		while (par != NULL) {
-			if (par == dentry)
-				break;
-			count++;
-			if (par == par->d_parent) {
-				dprintk(DEBUG_ERROR,
-					"got to root without finding dentry\n");
-				break;
-			}
-			par = par->d_parent;
-		}
-
-/* XXX - there may be some duplication we can get rid of */
-		if (par == dentry) {
-			return_fid = v9fs_fid_walk_up(dentry);
-			if (IS_ERR(return_fid))
-				return_fid = NULL;
-		}
+		dprintk(DEBUG_ERROR, "Couldn't find a fid in dentry\n");
 	}
 	}
 
 
 	return return_fid;
 	return return_fid;
 }
 }
-
-struct v9fs_fid *v9fs_fid_get_created(struct dentry *dentry)
-{
-	struct list_head *fid_list;
-	struct v9fs_fid *fid, *ftmp, *ret;
-
-	dprintk(DEBUG_9P, " dentry: %s (%p)\n", dentry->d_iname, dentry);
-	fid_list = (struct list_head *)dentry->d_fsdata;
-	ret = NULL;
-	if (fid_list) {
-		list_for_each_entry_safe(fid, ftmp, fid_list, list) {
-			if (fid->fidcreate && fid->pid == current->pid) {
-				list_del(&fid->list);
-				ret = fid;
-				break;
-			}
-		}
-	}
-
-	dprintk(DEBUG_9P, "return %p\n", ret);
-	return ret;
-}

+ 2 - 4
fs/9p/fid.h

@@ -33,7 +33,6 @@ struct v9fs_fid {
 
 
 	u32 fid;
 	u32 fid;
 	unsigned char fidopen;	  /* set when fid is opened */
 	unsigned char fidopen;	  /* set when fid is opened */
-	unsigned char fidcreate;  /* set when fid was just created */
 	unsigned char fidclunked; /* set when fid has already been clunked */
 	unsigned char fidclunked; /* set when fid has already been clunked */
 
 
 	struct v9fs_qid qid;
 	struct v9fs_qid qid;
@@ -45,7 +44,6 @@ struct v9fs_fid {
 	struct v9fs_fcall *rdir_fcall;
 	struct v9fs_fcall *rdir_fcall;
 
 
 	/* management stuff */
 	/* management stuff */
-	pid_t pid;		/* thread associated with this fid */
 	uid_t uid;		/* user associated with this fid */
 	uid_t uid;		/* user associated with this fid */
 
 
 	/* private data */
 	/* private data */
@@ -56,5 +54,5 @@ struct v9fs_fid {
 struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry);
 struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry);
 struct v9fs_fid *v9fs_fid_get_created(struct dentry *);
 struct v9fs_fid *v9fs_fid_get_created(struct dentry *);
 void v9fs_fid_destroy(struct v9fs_fid *fid);
 void v9fs_fid_destroy(struct v9fs_fid *fid);
-struct v9fs_fid *v9fs_fid_create(struct dentry *,
-	struct v9fs_session_info *v9ses, int fid, int create);
+struct v9fs_fid *v9fs_fid_create(struct v9fs_session_info *, int fid);
+int v9fs_fid_insert(struct v9fs_fid *fid, struct dentry *dentry);

+ 1 - 0
fs/9p/v9fs.c

@@ -397,6 +397,7 @@ v9fs_session_init(struct v9fs_session_info *v9ses,
 	}
 	}
 
 
 	if (v9ses->afid != ~0) {
 	if (v9ses->afid != ~0) {
+		dprintk(DEBUG_ERROR, "afid not equal to ~0\n");
 		if (v9fs_t_clunk(v9ses, v9ses->afid))
 		if (v9fs_t_clunk(v9ses, v9ses->afid))
 			dprintk(DEBUG_ERROR, "clunk failed\n");
 			dprintk(DEBUG_ERROR, "clunk failed\n");
 	}
 	}

+ 1 - 0
fs/9p/v9fs_vfs.h

@@ -51,3 +51,4 @@ int v9fs_dir_release(struct inode *inode, struct file *filp);
 int v9fs_file_open(struct inode *inode, struct file *file);
 int v9fs_file_open(struct inode *inode, struct file *file);
 void v9fs_inode2stat(struct inode *inode, struct v9fs_stat *stat);
 void v9fs_inode2stat(struct inode *inode, struct v9fs_stat *stat);
 void v9fs_dentry_release(struct dentry *);
 void v9fs_dentry_release(struct dentry *);
+int v9fs_uflags2omode(int uflags);

+ 8 - 37
fs/9p/vfs_dentry.c

@@ -43,47 +43,18 @@
 #include "fid.h"
 #include "fid.h"
 
 
 /**
 /**
- * v9fs_dentry_validate - VFS dcache hook to validate cache
- * @dentry:  dentry that is being validated
- * @nd: path data
+ * v9fs_dentry_delete - called when dentry refcount equals 0
+ * @dentry:  dentry in question
  *
  *
- * dcache really shouldn't be used for 9P2000 as at all due to
- * potential attached semantics to directory traversal (walk).
- *
- * FUTURE: look into how to use dcache to allow multi-stage
- * walks in Plan 9 & potential for better dcache operation which
- * would remain valid for Plan 9 semantics.  Older versions
- * had validation via stat for those interested.  However, since
- * stat has the same approximate overhead as walk there really
- * is no difference.  The only improvement would be from a
- * time-decay cache like NFS has and that undermines the
- * synchronous nature of 9P2000.
+ * By returning 1 here we should remove cacheing of unused
+ * dentry components.
  *
  *
  */
  */
 
 
-static int v9fs_dentry_validate(struct dentry *dentry, struct nameidata *nd)
+int v9fs_dentry_delete(struct dentry *dentry)
 {
 {
-	struct dentry *dc = current->fs->pwd;
-
-	dprintk(DEBUG_VFS, "dentry: %s (%p)\n", dentry->d_iname, dentry);
-	if (v9fs_fid_lookup(dentry)) {
-		dprintk(DEBUG_VFS, "VALID\n");
-		return 1;
-	}
-
-	while (dc != NULL) {
-		if (dc == dentry) {
-			dprintk(DEBUG_VFS, "VALID\n");
-			return 1;
-		}
-		if (dc == dc->d_parent)
-			break;
-
-		dc = dc->d_parent;
-	}
-
-	dprintk(DEBUG_VFS, "INVALID\n");
-	return 0;
+	dprintk(DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_iname, dentry);
+	return 1;
 }
 }
 
 
 /**
 /**
@@ -118,6 +89,6 @@ void v9fs_dentry_release(struct dentry *dentry)
 }
 }
 
 
 struct dentry_operations v9fs_dentry_operations = {
 struct dentry_operations v9fs_dentry_operations = {
-	.d_revalidate = v9fs_dentry_validate,
+	.d_delete = v9fs_dentry_delete,
 	.d_release = v9fs_dentry_release,
 	.d_release = v9fs_dentry_release,
 };
 };

+ 40 - 66
fs/9p/vfs_file.c

@@ -53,94 +53,70 @@
 int v9fs_file_open(struct inode *inode, struct file *file)
 int v9fs_file_open(struct inode *inode, struct file *file)
 {
 {
 	struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode);
 	struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode);
-	struct v9fs_fid *v9fid, *fid;
+	struct v9fs_fid *vfid;
 	struct v9fs_fcall *fcall = NULL;
 	struct v9fs_fcall *fcall = NULL;
-	int open_mode = 0;
-	unsigned int iounit = 0;
-	int newfid = -1;
-	long result = -1;
+	int omode;
+	int fid = V9FS_NOFID;
+	int err;
 
 
 	dprintk(DEBUG_VFS, "inode: %p file: %p \n", inode, file);
 	dprintk(DEBUG_VFS, "inode: %p file: %p \n", inode, file);
 
 
-	v9fid = v9fs_fid_get_created(file->f_dentry);
-	if (!v9fid)
-		v9fid = v9fs_fid_lookup(file->f_dentry);
-
-	if (!v9fid) {
+	vfid = v9fs_fid_lookup(file->f_dentry);
+	if (!vfid) {
 		dprintk(DEBUG_ERROR, "Couldn't resolve fid from dentry\n");
 		dprintk(DEBUG_ERROR, "Couldn't resolve fid from dentry\n");
 		return -EBADF;
 		return -EBADF;
 	}
 	}
 
 
-	if (!v9fid->fidcreate) {
-		fid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL);
-		if (fid == NULL) {
-			dprintk(DEBUG_ERROR, "Out of Memory\n");
-			return -ENOMEM;
-		}
-
-		fid->fidopen = 0;
-		fid->fidcreate = 0;
-		fid->fidclunked = 0;
-		fid->iounit = 0;
-		fid->v9ses = v9ses;
-
-		newfid = v9fs_get_idpool(&v9ses->fidpool);
-		if (newfid < 0) {
+	fid = v9fs_get_idpool(&v9ses->fidpool);
+	if (fid < 0) {
 			eprintk(KERN_WARNING, "newfid fails!\n");
 			eprintk(KERN_WARNING, "newfid fails!\n");
 			return -ENOSPC;
 			return -ENOSPC;
 		}
 		}
 
 
-		result =
-		    v9fs_t_walk(v9ses, v9fid->fid, newfid, NULL, NULL);
-
-		if (result < 0) {
-			v9fs_put_idpool(newfid, &v9ses->fidpool);
+	err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, NULL);
+	if (err < 0) {
 			dprintk(DEBUG_ERROR, "rewalk didn't work\n");
 			dprintk(DEBUG_ERROR, "rewalk didn't work\n");
-			return -EBADF;
+		goto put_fid;
+	}
+
+	vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL);
+	if (vfid == NULL) {
+		dprintk(DEBUG_ERROR, "out of memory\n");
+		goto clunk_fid;
 		}
 		}
 
 
-		fid->fid = newfid;
-		v9fid = fid;
 		/* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */
 		/* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */
 		/* translate open mode appropriately */
 		/* translate open mode appropriately */
-		open_mode = file->f_flags & 0x3;
+	omode = v9fs_uflags2omode(file->f_flags);
+	err = v9fs_t_open(v9ses, fid, omode, &fcall);
+	if (err < 0) {
+		PRINT_FCALL_ERROR("open failed", fcall);
+		goto destroy_vfid;
+	}
 
 
-		if (file->f_flags & O_EXCL)
-			open_mode |= V9FS_OEXCL;
+	file->private_data = vfid;
+	vfid->fid = fid;
+	vfid->fidopen = 1;
+	vfid->fidclunked = 0;
+	vfid->iounit = fcall->params.ropen.iounit;
+	vfid->rdir_pos = 0;
+	vfid->rdir_fcall = NULL;
+	vfid->filp = file;
+	kfree(fcall);
 
 
-		if (v9ses->extended) {
-			if (file->f_flags & O_TRUNC)
-				open_mode |= V9FS_OTRUNC;
+	return 0;
 
 
-			if (file->f_flags & O_APPEND)
-				open_mode |= V9FS_OAPPEND;
-		}
+destroy_vfid:
+	v9fs_fid_destroy(vfid);
 
 
-		result = v9fs_t_open(v9ses, newfid, open_mode, &fcall);
-		if (result < 0) {
-			PRINT_FCALL_ERROR("open failed", fcall);
-			kfree(fcall);
-			return result;
-		}
+clunk_fid:
+	v9fs_t_clunk(v9ses, fid);
 
 
-		iounit = fcall->params.ropen.iounit;
+put_fid:
+	v9fs_put_idpool(fid, &v9ses->fidpool);
 		kfree(fcall);
 		kfree(fcall);
-	} else {
-		/* create case */
-		newfid = v9fid->fid;
-		iounit = v9fid->iounit;
-		v9fid->fidcreate = 0;
-	}
-
-	file->private_data = v9fid;
-
-	v9fid->rdir_pos = 0;
-	v9fid->rdir_fcall = NULL;
-	v9fid->fidopen = 1;
-	v9fid->filp = file;
-	v9fid->iounit = iounit;
 
 
-	return 0;
+	return err;
 }
 }
 
 
 /**
 /**
@@ -289,9 +265,7 @@ v9fs_file_write(struct file *filp, const char __user * data,
 		total += result;
 		total += result;
 	} while (count);
 	} while (count);
 
 
-	if(inode->i_mapping->nrpages)
 		invalidate_inode_pages2(inode->i_mapping);
 		invalidate_inode_pages2(inode->i_mapping);
-
 	return total;
 	return total;
 }
 }
 
 

+ 312 - 166
fs/9p/vfs_inode.c

@@ -125,6 +125,38 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses, int mode)
 	return res;
 	return res;
 }
 }
 
 
+int v9fs_uflags2omode(int uflags)
+{
+	int ret;
+
+	ret = 0;
+	switch (uflags&3) {
+	default:
+	case O_RDONLY:
+		ret = V9FS_OREAD;
+		break;
+
+	case O_WRONLY:
+		ret = V9FS_OWRITE;
+		break;
+
+	case O_RDWR:
+		ret = V9FS_ORDWR;
+		break;
+	}
+
+	if (uflags & O_EXCL)
+		ret |= V9FS_OEXCL;
+
+	if (uflags & O_TRUNC)
+		ret |= V9FS_OTRUNC;
+
+	if (uflags & O_APPEND)
+		ret |= V9FS_OAPPEND;
+
+	return ret;
+}
+
 /**
 /**
  * v9fs_blank_wstat - helper function to setup a 9P stat structure
  * v9fs_blank_wstat - helper function to setup a 9P stat structure
  * @v9ses: 9P session info (for determining extended mode)
  * @v9ses: 9P session info (for determining extended mode)
@@ -163,7 +195,7 @@ v9fs_blank_wstat(struct v9fs_wstat *wstat)
 
 
 struct inode *v9fs_get_inode(struct super_block *sb, int mode)
 struct inode *v9fs_get_inode(struct super_block *sb, int mode)
 {
 {
-	struct inode *inode = NULL;
+	struct inode *inode;
 	struct v9fs_session_info *v9ses = sb->s_fs_info;
 	struct v9fs_session_info *v9ses = sb->s_fs_info;
 
 
 	dprintk(DEBUG_VFS, "super block: %p mode: %o\n", sb, mode);
 	dprintk(DEBUG_VFS, "super block: %p mode: %o\n", sb, mode);
@@ -222,171 +254,135 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode)
 	return inode;
 	return inode;
 }
 }
 
 
-/**
- * v9fs_create - helper function to create files and directories
- * @dir: directory inode file is being created in
- * @file_dentry: dentry file is being created in
- * @perm: permissions file is being created with
- * @open_mode: resulting open mode for file
- *
- */
-
 static int
 static int
-v9fs_create(struct inode *dir,
-	    struct dentry *file_dentry,
-	    unsigned int perm, unsigned int open_mode)
+v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name,
+	u32 perm, u8 mode, u32 *fidp, struct v9fs_qid *qid, u32 *iounit)
 {
 {
-	struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir);
-	struct super_block *sb = dir->i_sb;
-	struct v9fs_fid *dirfid =
-	    v9fs_fid_lookup(file_dentry->d_parent);
-	struct v9fs_fid *fid = NULL;
-	struct inode *file_inode = NULL;
-	struct v9fs_fcall *fcall = NULL;
-	struct v9fs_qid qid;
-	int dirfidnum = -1;
-	long newfid = -1;
-	int result = 0;
-	unsigned int iounit = 0;
-	int wfidno = -1;
+	u32 fid;
 	int err;
 	int err;
+	struct v9fs_fcall *fcall;
 
 
-	perm = unixmode2p9mode(v9ses, perm);
-
-	dprintk(DEBUG_VFS, "dir: %p dentry: %p perm: %o mode: %o\n", dir,
-		file_dentry, perm, open_mode);
-
-	if (!dirfid)
-		return -EBADF;
-
-	dirfidnum = dirfid->fid;
-	if (dirfidnum < 0) {
-		dprintk(DEBUG_ERROR, "No fid for the directory #%lu\n",
-			dir->i_ino);
-		return -EBADF;
-	}
-
-	if (file_dentry->d_inode) {
-		dprintk(DEBUG_ERROR,
-			"Odd. There is an inode for dir %lu, name :%s:\n",
-			dir->i_ino, file_dentry->d_name.name);
-		return -EEXIST;
-	}
-
-	newfid = v9fs_get_idpool(&v9ses->fidpool);
-	if (newfid < 0) {
+	fid = v9fs_get_idpool(&v9ses->fidpool);
+	if (fid < 0) {
 		eprintk(KERN_WARNING, "no free fids available\n");
 		eprintk(KERN_WARNING, "no free fids available\n");
-		return -ENOSPC;
+		err = -ENOSPC;
+		goto error;
 	}
 	}
 
 
-	result = v9fs_t_walk(v9ses, dirfidnum, newfid, NULL, &fcall);
-	if (result < 0) {
+	err = v9fs_t_walk(v9ses, pfid, fid, NULL, &fcall);
+	if (err < 0) {
 		PRINT_FCALL_ERROR("clone error", fcall);
 		PRINT_FCALL_ERROR("clone error", fcall);
-		v9fs_put_idpool(newfid, &v9ses->fidpool);
-		newfid = -1;
-		goto CleanUpFid;
+		goto error;
 	}
 	}
-
 	kfree(fcall);
 	kfree(fcall);
-	fcall = NULL;
 
 
-	result = v9fs_t_create(v9ses, newfid, (char *)file_dentry->d_name.name,
-			       perm, open_mode, &fcall);
-	if (result < 0) {
+	err = v9fs_t_create(v9ses, fid, name, perm, mode, &fcall);
+	if (err < 0) {
 		PRINT_FCALL_ERROR("create fails", fcall);
 		PRINT_FCALL_ERROR("create fails", fcall);
-		goto CleanUpFid;
+		goto error;
 	}
 	}
 
 
-	iounit = fcall->params.rcreate.iounit;
-	qid = fcall->params.rcreate.qid;
+	if (iounit)
+		*iounit = fcall->params.rcreate.iounit;
+
+	if (qid)
+		*qid = fcall->params.rcreate.qid;
+
+	if (fidp)
+		*fidp = fid;
+
 	kfree(fcall);
 	kfree(fcall);
-	fcall = NULL;
+	return 0;
 
 
-	if (!(perm&V9FS_DMDIR)) {
-		fid = v9fs_fid_create(file_dentry, v9ses, newfid, 1);
-		dprintk(DEBUG_VFS, "fid %p %d\n", fid, fid->fidcreate);
-		if (!fid) {
-			result = -ENOMEM;
-			goto CleanUpFid;
-		}
+error:
+	if (fid >= 0)
+		v9fs_put_idpool(fid, &v9ses->fidpool);
 
 
-		fid->qid = qid;
-		fid->iounit = iounit;
-	} else {
-		err = v9fs_t_clunk(v9ses, newfid);
-		newfid = -1;
-		if (err < 0)
-			dprintk(DEBUG_ERROR, "clunk for mkdir failed: %d\n", err);
-	}
+	kfree(fcall);
+	return err;
+}
+
+static struct v9fs_fid*
+v9fs_clone_walk(struct v9fs_session_info *v9ses, u32 fid, struct dentry *dentry)
+{
+	int err;
+	u32 nfid;
+	struct v9fs_fid *ret;
+	struct v9fs_fcall *fcall;
 
 
-	/* walk to the newly created file and put the fid in the dentry */
-	wfidno = v9fs_get_idpool(&v9ses->fidpool);
-	if (wfidno < 0) {
+	nfid = v9fs_get_idpool(&v9ses->fidpool);
+	if (nfid < 0) {
 		eprintk(KERN_WARNING, "no free fids available\n");
 		eprintk(KERN_WARNING, "no free fids available\n");
-		return -ENOSPC;
+		err = -ENOSPC;
+		goto error;
 	}
 	}
 
 
-	result = v9fs_t_walk(v9ses, dirfidnum, wfidno,
-		(char *) file_dentry->d_name.name, &fcall);
-	if (result < 0) {
-		PRINT_FCALL_ERROR("clone error", fcall);
-		v9fs_put_idpool(wfidno, &v9ses->fidpool);
-		wfidno = -1;
-		goto CleanUpFid;
+	err = v9fs_t_walk(v9ses, fid, nfid, (char *) dentry->d_name.name,
+		&fcall);
+
+	if (err < 0) {
+		PRINT_FCALL_ERROR("walk error", fcall);
+		v9fs_put_idpool(nfid, &v9ses->fidpool);
+		goto error;
 	}
 	}
+
 	kfree(fcall);
 	kfree(fcall);
 	fcall = NULL;
 	fcall = NULL;
+	ret = v9fs_fid_create(v9ses, nfid);
+	if (!ret) {
+		err = -ENOMEM;
+		goto clunk_fid;
+	}
 
 
-	if (!v9fs_fid_create(file_dentry, v9ses, wfidno, 0)) {
-		v9fs_put_idpool(wfidno, &v9ses->fidpool);
-
-		goto CleanUpFid;
+	err = v9fs_fid_insert(ret, dentry);
+	if (err < 0) {
+		v9fs_fid_destroy(ret);
+		goto clunk_fid;
 	}
 	}
 
 
-	if ((perm & V9FS_DMSYMLINK) || (perm & V9FS_DMLINK) ||
-	    (perm & V9FS_DMNAMEDPIPE) || (perm & V9FS_DMSOCKET) ||
-	    (perm & V9FS_DMDEVICE))
-		return 0;
+	return ret;
 
 
-	result = v9fs_t_stat(v9ses, wfidno, &fcall);
-	if (result < 0) {
-		PRINT_FCALL_ERROR("stat error", fcall);
-		goto CleanUpFid;
-	}
+clunk_fid:
+	v9fs_t_clunk(v9ses, nfid);
+
+error:
+	kfree(fcall);
+	return ERR_PTR(err);
+}
 
 
+struct inode *
+v9fs_inode_from_fid(struct v9fs_session_info *v9ses, u32 fid,
+	struct super_block *sb)
+{
+	int err, umode;
+	struct inode *ret;
+	struct v9fs_fcall *fcall;
 
 
-	file_inode = v9fs_get_inode(sb,
-		p9mode2unixmode(v9ses, fcall->params.rstat.stat.mode));
+	ret = NULL;
+	err = v9fs_t_stat(v9ses, fid, &fcall);
+	if (err) {
+		PRINT_FCALL_ERROR("stat error", fcall);
+		goto error;
+	}
 
 
-	if ((!file_inode) || IS_ERR(file_inode)) {
-		dprintk(DEBUG_ERROR, "create inode failed\n");
-		result = -EBADF;
-		goto CleanUpFid;
+	umode = p9mode2unixmode(v9ses, fcall->params.rstat.stat.mode);
+	ret = v9fs_get_inode(sb, umode);
+	if (IS_ERR(ret)) {
+		err = PTR_ERR(ret);
+		ret = NULL;
+		goto error;
 	}
 	}
 
 
-	v9fs_stat2inode(&fcall->params.rstat.stat, file_inode, sb);
+	v9fs_stat2inode(&fcall->params.rstat.stat, ret, sb);
 	kfree(fcall);
 	kfree(fcall);
-	fcall = NULL;
-	file_dentry->d_op = &v9fs_dentry_operations;
-	d_instantiate(file_dentry, file_inode);
-
-	return 0;
+	return ret;
 
 
-      CleanUpFid:
+error:
 	kfree(fcall);
 	kfree(fcall);
-	fcall = NULL;
+	if (ret)
+		iput(ret);
 
 
-	if (newfid >= 0) {
- 		err = v9fs_t_clunk(v9ses, newfid);
- 		if (err < 0)
- 			dprintk(DEBUG_ERROR, "clunk failed: %d\n", err);
-	}
-	if (wfidno >= 0) {
- 		err = v9fs_t_clunk(v9ses, wfidno);
- 		if (err < 0)
- 			dprintk(DEBUG_ERROR, "clunk failed: %d\n", err);
-	}
-	return result;
+	return ERR_PTR(err);
 }
 }
 
 
 /**
 /**
@@ -440,20 +436,97 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
 	return result;
 	return result;
 }
 }
 
 
+static int
+v9fs_open_created(struct inode *inode, struct file *file)
+{
+	return 0;
+}
+
 /**
 /**
  * v9fs_vfs_create - VFS hook to create files
  * v9fs_vfs_create - VFS hook to create files
  * @inode: directory inode that is being deleted
  * @inode: directory inode that is being deleted
  * @dentry:  dentry that is being deleted
  * @dentry:  dentry that is being deleted
- * @perm: create permissions
+ * @mode: create permissions
  * @nd: path information
  * @nd: path information
  *
  *
  */
  */
 
 
 static int
 static int
-v9fs_vfs_create(struct inode *inode, struct dentry *dentry, int perm,
+v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
 		struct nameidata *nd)
 		struct nameidata *nd)
 {
 {
-	return v9fs_create(inode, dentry, perm, O_RDWR);
+	int err;
+	u32 fid, perm, iounit;
+	int flags;
+	struct v9fs_session_info *v9ses;
+	struct v9fs_fid *dfid, *vfid, *ffid;
+	struct inode *inode;
+	struct v9fs_qid qid;
+	struct file *filp;
+
+	inode = NULL;
+	vfid = NULL;
+	v9ses = v9fs_inode2v9ses(dir);
+	dfid = v9fs_fid_lookup(dentry->d_parent);
+	perm = unixmode2p9mode(v9ses, mode);
+
+	if (nd && nd->flags & LOOKUP_OPEN)
+		flags = nd->intent.open.flags - 1;
+	else
+		flags = O_RDWR;
+
+	err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name,
+		perm, v9fs_uflags2omode(flags), &fid, &qid, &iounit);
+
+	if (err)
+		goto error;
+
+	vfid = v9fs_clone_walk(v9ses, dfid->fid, dentry);
+	if (IS_ERR(vfid)) {
+		err = PTR_ERR(vfid);
+		vfid = NULL;
+		goto error;
+	}
+
+	inode = v9fs_inode_from_fid(v9ses, vfid->fid, dir->i_sb);
+	if (IS_ERR(inode)) {
+		err = PTR_ERR(inode);
+		inode = NULL;
+		goto error;
+	}
+
+	dentry->d_op = &v9fs_dentry_operations;
+	d_instantiate(dentry, inode);
+
+	if (nd && nd->flags & LOOKUP_OPEN) {
+		ffid = v9fs_fid_create(v9ses, fid);
+		if (!ffid)
+			return -ENOMEM;
+
+		filp = lookup_instantiate_filp(nd, dentry, v9fs_open_created);
+		if (IS_ERR(filp)) {
+			v9fs_fid_destroy(ffid);
+			return PTR_ERR(filp);
+		}
+
+		ffid->rdir_pos = 0;
+		ffid->rdir_fcall = NULL;
+		ffid->fidopen = 1;
+		ffid->iounit = iounit;
+		ffid->filp = filp;
+		filp->private_data = ffid;
+	}
+
+	return 0;
+
+error:
+	if (vfid)
+		v9fs_fid_destroy(vfid);
+
+	if (inode)
+		iput(inode);
+
+	return err;
 }
 }
 
 
 /**
 /**
@@ -464,9 +537,57 @@ v9fs_vfs_create(struct inode *inode, struct dentry *dentry, int perm,
  *
  *
  */
  */
 
 
-static int v9fs_vfs_mkdir(struct inode *inode, struct dentry *dentry, int mode)
+static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 {
 {
-	return v9fs_create(inode, dentry, mode | S_IFDIR, O_RDONLY);
+	int err;
+	u32 fid, perm;
+	struct v9fs_session_info *v9ses;
+	struct v9fs_fid *dfid, *vfid;
+	struct inode *inode;
+
+	inode = NULL;
+	vfid = NULL;
+	v9ses = v9fs_inode2v9ses(dir);
+	dfid = v9fs_fid_lookup(dentry->d_parent);
+	perm = unixmode2p9mode(v9ses, mode | S_IFDIR);
+
+	err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name,
+		perm, V9FS_OREAD, &fid, NULL, NULL);
+
+	if (err) {
+		dprintk(DEBUG_ERROR, "create error %d\n", err);
+		goto error;
+	}
+
+	err = v9fs_t_clunk(v9ses, fid);
+	if (err) {
+		dprintk(DEBUG_ERROR, "clunk error %d\n", err);
+		goto error;
+	}
+
+	vfid = v9fs_clone_walk(v9ses, dfid->fid, dentry);
+	if (IS_ERR(vfid)) {
+		err = PTR_ERR(vfid);
+		vfid = NULL;
+		goto error;
+	}
+
+	inode = v9fs_inode_from_fid(v9ses, vfid->fid, dir->i_sb);
+	if (IS_ERR(inode)) {
+		err = PTR_ERR(inode);
+		inode = NULL;
+		goto error;
+	}
+
+	dentry->d_op = &v9fs_dentry_operations;
+	d_instantiate(dentry, inode);
+	return 0;
+
+error:
+	if (vfid)
+		v9fs_fid_destroy(vfid);
+
+	return err;
 }
 }
 
 
 /**
 /**
@@ -516,9 +637,8 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
 		return ERR_PTR(-ENOSPC);
 		return ERR_PTR(-ENOSPC);
 	}
 	}
 
 
-	result =
-	    v9fs_t_walk(v9ses, dirfidnum, newfid, (char *)dentry->d_name.name,
-			NULL);
+	result = v9fs_t_walk(v9ses, dirfidnum, newfid,
+		(char *)dentry->d_name.name, NULL);
 	if (result < 0) {
 	if (result < 0) {
 		v9fs_put_idpool(newfid, &v9ses->fidpool);
 		v9fs_put_idpool(newfid, &v9ses->fidpool);
 		if (result == -ENOENT) {
 		if (result == -ENOENT) {
@@ -551,13 +671,17 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
 
 
 	inode->i_ino = v9fs_qid2ino(&fcall->params.rstat.stat.qid);
 	inode->i_ino = v9fs_qid2ino(&fcall->params.rstat.stat.qid);
 
 
-	fid = v9fs_fid_create(dentry, v9ses, newfid, 0);
+	fid = v9fs_fid_create(v9ses, newfid);
 	if (fid == NULL) {
 	if (fid == NULL) {
 		dprintk(DEBUG_ERROR, "couldn't insert\n");
 		dprintk(DEBUG_ERROR, "couldn't insert\n");
 		result = -ENOMEM;
 		result = -ENOMEM;
 		goto FreeFcall;
 		goto FreeFcall;
 	}
 	}
 
 
+	result = v9fs_fid_insert(fid, dentry);
+	if (result < 0)
+		goto FreeFcall;
+
 	fid->qid = fcall->params.rstat.stat.qid;
 	fid->qid = fcall->params.rstat.stat.qid;
 
 
 	dentry->d_op = &v9fs_dentry_operations;
 	dentry->d_op = &v9fs_dentry_operations;
@@ -886,8 +1010,8 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
 	}
 	}
 
 
 	/* copy extension buffer into buffer */
 	/* copy extension buffer into buffer */
-	if (fcall->params.rstat.stat.extension.len+1 < buflen)
-		buflen = fcall->params.rstat.stat.extension.len + 1;
+	if (fcall->params.rstat.stat.extension.len < buflen)
+		buflen = fcall->params.rstat.stat.extension.len;
 
 
 	memcpy(buffer, fcall->params.rstat.stat.extension.str, buflen - 1);
 	memcpy(buffer, fcall->params.rstat.stat.extension.str, buflen - 1);
 	buffer[buflen-1] = 0;
 	buffer[buflen-1] = 0;
@@ -951,7 +1075,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
 	if (!link)
 	if (!link)
 		link = ERR_PTR(-ENOMEM);
 		link = ERR_PTR(-ENOMEM);
 	else {
 	else {
-		len = v9fs_readlink(dentry, link, PATH_MAX);
+		len = v9fs_readlink(dentry, link, strlen(link));
 
 
 		if (len < 0) {
 		if (len < 0) {
 			__putname(link);
 			__putname(link);
@@ -983,53 +1107,75 @@ static void v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void
 static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
 static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
 	int mode, const char *extension)
 	int mode, const char *extension)
 {
 {
-	int err, retval;
+	int err;
+	u32 fid, perm;
 	struct v9fs_session_info *v9ses;
 	struct v9fs_session_info *v9ses;
+	struct v9fs_fid *dfid, *vfid;
+	struct inode *inode;
 	struct v9fs_fcall *fcall;
 	struct v9fs_fcall *fcall;
-	struct v9fs_fid *fid;
 	struct v9fs_wstat wstat;
 	struct v9fs_wstat wstat;
 
 
-	v9ses = v9fs_inode2v9ses(dir);
-	retval = -EPERM;
 	fcall = NULL;
 	fcall = NULL;
+	inode = NULL;
+	vfid = NULL;
+	v9ses = v9fs_inode2v9ses(dir);
+	dfid = v9fs_fid_lookup(dentry->d_parent);
+	perm = unixmode2p9mode(v9ses, mode);
 
 
 	if (!v9ses->extended) {
 	if (!v9ses->extended) {
 		dprintk(DEBUG_ERROR, "not extended\n");
 		dprintk(DEBUG_ERROR, "not extended\n");
-		goto free_mem;
+		return -EPERM;
 	}
 	}
 
 
-	/* issue a create */
-	retval = v9fs_create(dir, dentry, mode, 0);
-	if (retval != 0)
-		goto free_mem;
+	err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name,
+		perm, V9FS_OREAD, &fid, NULL, NULL);
 
 
-	fid = v9fs_fid_get_created(dentry);
-	if (!fid) {
-		dprintk(DEBUG_ERROR, "couldn't resolve fid from dentry\n");
-		goto free_mem;
+	if (err)
+		goto error;
+
+	err = v9fs_t_clunk(v9ses, fid);
+	if (err)
+		goto error;
+
+	vfid = v9fs_clone_walk(v9ses, dfid->fid, dentry);
+	if (IS_ERR(vfid)) {
+		err = PTR_ERR(vfid);
+		vfid = NULL;
+		goto error;
+	}
+
+	inode = v9fs_inode_from_fid(v9ses, vfid->fid, dir->i_sb);
+	if (IS_ERR(inode)) {
+		err = PTR_ERR(inode);
+		inode = NULL;
+		goto error;
 	}
 	}
 
 
 	/* issue a Twstat */
 	/* issue a Twstat */
 	v9fs_blank_wstat(&wstat);
 	v9fs_blank_wstat(&wstat);
 	wstat.muid = v9ses->name;
 	wstat.muid = v9ses->name;
 	wstat.extension = (char *) extension;
 	wstat.extension = (char *) extension;
-	retval = v9fs_t_wstat(v9ses, fid->fid, &wstat, &fcall);
-	if (retval < 0) {
-		PRINT_FCALL_ERROR("wstat error", fcall);
-		goto free_mem;
-	}
-
-	err = v9fs_t_clunk(v9ses, fid->fid);
+	err = v9fs_t_wstat(v9ses, vfid->fid, &wstat, &fcall);
 	if (err < 0) {
 	if (err < 0) {
-		dprintk(DEBUG_ERROR, "clunk failed: %d\n", err);
-		goto free_mem;
+		PRINT_FCALL_ERROR("wstat error", fcall);
+		goto error;
 	}
 	}
 
 
-	d_drop(dentry);		/* FID - will this also clunk? */
+	kfree(fcall);
+	dentry->d_op = &v9fs_dentry_operations;
+	d_instantiate(dentry, inode);
+	return 0;
 
 
-free_mem:
+error:
 	kfree(fcall);
 	kfree(fcall);
-	return retval;
+	if (vfid)
+		v9fs_fid_destroy(vfid);
+
+	if (inode)
+		iput(inode);
+
+	return err;
+
 }
 }
 
 
 /**
 /**

+ 8 - 3
fs/9p/vfs_super.c

@@ -146,7 +146,6 @@ static struct super_block *v9fs_get_sb(struct file_system_type
 	inode->i_gid = gid;
 	inode->i_gid = gid;
 
 
 	root = d_alloc_root(inode);
 	root = d_alloc_root(inode);
-
 	if (!root) {
 	if (!root) {
 		retval = -ENOMEM;
 		retval = -ENOMEM;
 		goto put_back_sb;
 		goto put_back_sb;
@@ -157,16 +156,22 @@ static struct super_block *v9fs_get_sb(struct file_system_type
 	stat_result = v9fs_t_stat(v9ses, newfid, &fcall);
 	stat_result = v9fs_t_stat(v9ses, newfid, &fcall);
 	if (stat_result < 0) {
 	if (stat_result < 0) {
 		dprintk(DEBUG_ERROR, "stat error\n");
 		dprintk(DEBUG_ERROR, "stat error\n");
+		kfree(fcall);
 		v9fs_t_clunk(v9ses, newfid);
 		v9fs_t_clunk(v9ses, newfid);
-		v9fs_put_idpool(newfid, &v9ses->fidpool);
 	} else {
 	} else {
 		/* Setup the Root Inode */
 		/* Setup the Root Inode */
-		root_fid = v9fs_fid_create(root, v9ses, newfid, 0);
+		root_fid = v9fs_fid_create(v9ses, newfid);
 		if (root_fid == NULL) {
 		if (root_fid == NULL) {
 			retval = -ENOMEM;
 			retval = -ENOMEM;
 			goto put_back_sb;
 			goto put_back_sb;
 		}
 		}
 
 
+		retval = v9fs_fid_insert(root_fid, root);
+		if (retval < 0) {
+			kfree(fcall);
+			goto put_back_sb;
+		}
+
 		root_fid->qid = fcall->params.rstat.stat.qid;
 		root_fid->qid = fcall->params.rstat.stat.qid;
 		root->d_inode->i_ino =
 		root->d_inode->i_ino =
 		    v9fs_qid2ino(&fcall->params.rstat.stat.qid);
 		    v9fs_qid2ino(&fcall->params.rstat.stat.qid);

+ 1 - 0
fs/ocfs2/cluster/masklog.c

@@ -74,6 +74,7 @@ struct mlog_attribute {
 #define define_mask(_name) {			\
 #define define_mask(_name) {			\
 	.attr = {				\
 	.attr = {				\
 		.name = #_name,			\
 		.name = #_name,			\
+		.owner = THIS_MODULE,		\
 		.mode = S_IRUGO | S_IWUSR,	\
 		.mode = S_IRUGO | S_IWUSR,	\
 	},					\
 	},					\
 	.mask = ML_##_name,			\
 	.mask = ML_##_name,			\

+ 1 - 1
fs/ocfs2/cluster/masklog.h

@@ -256,7 +256,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
 	}								\
 	}								\
 } while (0)
 } while (0)
 
 
-#if (BITS_PER_LONG == 32) || defined(CONFIG_X86_64)
+#if (BITS_PER_LONG == 32) || defined(CONFIG_X86_64) || (defined(CONFIG_UML_X86) && defined(CONFIG_64BIT))
 #define MLFi64 "lld"
 #define MLFi64 "lld"
 #define MLFu64 "llu"
 #define MLFu64 "llu"
 #define MLFx64 "llx"
 #define MLFx64 "llx"

+ 3 - 1
fs/ocfs2/cluster/nodemanager.c

@@ -756,7 +756,7 @@ static int __init init_o2nm(void)
 	if (!ocfs2_table_header) {
 	if (!ocfs2_table_header) {
 		printk(KERN_ERR "nodemanager: unable to register sysctl\n");
 		printk(KERN_ERR "nodemanager: unable to register sysctl\n");
 		ret = -ENOMEM; /* or something. */
 		ret = -ENOMEM; /* or something. */
-		goto out;
+		goto out_o2net;
 	}
 	}
 
 
 	ret = o2net_register_hb_callbacks();
 	ret = o2net_register_hb_callbacks();
@@ -780,6 +780,8 @@ out_callbacks:
 	o2net_unregister_hb_callbacks();
 	o2net_unregister_hb_callbacks();
 out_sysctl:
 out_sysctl:
 	unregister_sysctl_table(ocfs2_table_header);
 	unregister_sysctl_table(ocfs2_table_header);
+out_o2net:
+	o2net_exit();
 out:
 out:
 	return ret;
 	return ret;
 }
 }

+ 12 - 2
fs/ocfs2/cluster/tcp.c

@@ -1318,7 +1318,7 @@ static void o2net_start_connect(void *arg)
 {
 {
 	struct o2net_node *nn = arg;
 	struct o2net_node *nn = arg;
 	struct o2net_sock_container *sc = NULL;
 	struct o2net_sock_container *sc = NULL;
-	struct o2nm_node *node = NULL;
+	struct o2nm_node *node = NULL, *mynode = NULL;
 	struct socket *sock = NULL;
 	struct socket *sock = NULL;
 	struct sockaddr_in myaddr = {0, }, remoteaddr = {0, };
 	struct sockaddr_in myaddr = {0, }, remoteaddr = {0, };
 	int ret = 0;
 	int ret = 0;
@@ -1334,6 +1334,12 @@ static void o2net_start_connect(void *arg)
 		goto out;
 		goto out;
 	}
 	}
 
 
+	mynode = o2nm_get_node_by_num(o2nm_this_node());
+	if (mynode == NULL) {
+		ret = 0;
+		goto out;
+	}
+
 	spin_lock(&nn->nn_lock);
 	spin_lock(&nn->nn_lock);
 	/* see if we already have one pending or have given up */
 	/* see if we already have one pending or have given up */
 	if (nn->nn_sc || nn->nn_persistent_error)
 	if (nn->nn_sc || nn->nn_persistent_error)
@@ -1361,12 +1367,14 @@ static void o2net_start_connect(void *arg)
 	sock->sk->sk_allocation = GFP_ATOMIC;
 	sock->sk->sk_allocation = GFP_ATOMIC;
 
 
 	myaddr.sin_family = AF_INET;
 	myaddr.sin_family = AF_INET;
+	myaddr.sin_addr.s_addr = (__force u32)mynode->nd_ipv4_address;
 	myaddr.sin_port = (__force u16)htons(0); /* any port */
 	myaddr.sin_port = (__force u16)htons(0); /* any port */
 
 
 	ret = sock->ops->bind(sock, (struct sockaddr *)&myaddr,
 	ret = sock->ops->bind(sock, (struct sockaddr *)&myaddr,
 			      sizeof(myaddr));
 			      sizeof(myaddr));
 	if (ret) {
 	if (ret) {
-		mlog(0, "bind failed: %d\n", ret);
+		mlog(ML_ERROR, "bind failed with %d at address %u.%u.%u.%u\n",
+		     ret, NIPQUAD(mynode->nd_ipv4_address));
 		goto out;
 		goto out;
 	}
 	}
 
 
@@ -1407,6 +1415,8 @@ out:
 		sc_put(sc);
 		sc_put(sc);
 	if (node)
 	if (node)
 		o2nm_node_put(node);
 		o2nm_node_put(node);
+	if (mynode)
+		o2nm_node_put(mynode);
 
 
 	return;
 	return;
 }
 }

+ 0 - 5
fs/ocfs2/cluster/tcp.h

@@ -85,13 +85,10 @@ enum {
 	O2NET_DRIVER_READY,
 	O2NET_DRIVER_READY,
 };
 };
 
 
-int o2net_init_tcp_sock(struct inode *inode);
 int o2net_send_message(u32 msg_type, u32 key, void *data, u32 len,
 int o2net_send_message(u32 msg_type, u32 key, void *data, u32 len,
 		       u8 target_node, int *status);
 		       u8 target_node, int *status);
 int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *vec,
 int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *vec,
 			   size_t veclen, u8 target_node, int *status);
 			   size_t veclen, u8 target_node, int *status);
-int o2net_broadcast_message(u32 msg_type, u32 key, void *data, u32 len,
-			    struct inode *group);
 
 
 int o2net_register_handler(u32 msg_type, u32 key, u32 max_len,
 int o2net_register_handler(u32 msg_type, u32 key, u32 max_len,
 			   o2net_msg_handler_func *func, void *data,
 			   o2net_msg_handler_func *func, void *data,
@@ -107,7 +104,5 @@ void o2net_disconnect_node(struct o2nm_node *node);
 
 
 int o2net_init(void);
 int o2net_init(void);
 void o2net_exit(void);
 void o2net_exit(void);
-int o2net_proc_init(struct proc_dir_entry *parent);
-void o2net_proc_exit(struct proc_dir_entry *parent);
 
 
 #endif /* O2CLUSTER_TCP_H */
 #endif /* O2CLUSTER_TCP_H */

+ 3 - 5
fs/ocfs2/dlm/dlmcommon.h

@@ -37,9 +37,7 @@
 #define DLM_THREAD_SHUFFLE_INTERVAL    5     // flush everything every 5 passes
 #define DLM_THREAD_SHUFFLE_INTERVAL    5     // flush everything every 5 passes
 #define DLM_THREAD_MS                  200   // flush at least every 200 ms
 #define DLM_THREAD_MS                  200   // flush at least every 200 ms
 
 
-#define DLM_HASH_BITS     7
-#define DLM_HASH_SIZE     (1 << DLM_HASH_BITS)
-#define DLM_HASH_MASK     (DLM_HASH_SIZE - 1)
+#define DLM_HASH_BUCKETS     (PAGE_SIZE / sizeof(struct hlist_head))
 
 
 enum dlm_ast_type {
 enum dlm_ast_type {
 	DLM_AST = 0,
 	DLM_AST = 0,
@@ -87,7 +85,7 @@ enum dlm_ctxt_state {
 struct dlm_ctxt
 struct dlm_ctxt
 {
 {
 	struct list_head list;
 	struct list_head list;
-	struct list_head *resources;
+	struct hlist_head *lockres_hash;
 	struct list_head dirty_list;
 	struct list_head dirty_list;
 	struct list_head purge_list;
 	struct list_head purge_list;
 	struct list_head pending_asts;
 	struct list_head pending_asts;
@@ -217,7 +215,7 @@ struct dlm_lock_resource
 {
 {
 	/* WARNING: Please see the comment in dlm_init_lockres before
 	/* WARNING: Please see the comment in dlm_init_lockres before
 	 * adding fields here. */
 	 * adding fields here. */
-	struct list_head list;
+	struct hlist_node hash_node;
 	struct kref      refs;
 	struct kref      refs;
 
 
 	/* please keep these next 3 in this order
 	/* please keep these next 3 in this order

+ 5 - 7
fs/ocfs2/dlm/dlmdebug.c

@@ -117,8 +117,8 @@ EXPORT_SYMBOL_GPL(dlm_print_one_lock);
 void dlm_dump_lock_resources(struct dlm_ctxt *dlm)
 void dlm_dump_lock_resources(struct dlm_ctxt *dlm)
 {
 {
 	struct dlm_lock_resource *res;
 	struct dlm_lock_resource *res;
-	struct list_head *iter;
-	struct list_head *bucket;
+	struct hlist_node *iter;
+	struct hlist_head *bucket;
 	int i;
 	int i;
 
 
 	mlog(ML_NOTICE, "struct dlm_ctxt: %s, node=%u, key=%u\n",
 	mlog(ML_NOTICE, "struct dlm_ctxt: %s, node=%u, key=%u\n",
@@ -129,12 +129,10 @@ void dlm_dump_lock_resources(struct dlm_ctxt *dlm)
 	}
 	}
 
 
 	spin_lock(&dlm->spinlock);
 	spin_lock(&dlm->spinlock);
-	for (i=0; i<DLM_HASH_SIZE; i++) {
-		bucket = &(dlm->resources[i]);
-		list_for_each(iter, bucket) {
-			res = list_entry(iter, struct dlm_lock_resource, list);
+	for (i=0; i<DLM_HASH_BUCKETS; i++) {
+		bucket = &(dlm->lockres_hash[i]);
+		hlist_for_each_entry(res, iter, bucket, hash_node)
 			dlm_print_one_lock_resource(res);
 			dlm_print_one_lock_resource(res);
-		}
 	}
 	}
 	spin_unlock(&dlm->spinlock);
 	spin_unlock(&dlm->spinlock);
 }
 }

+ 19 - 20
fs/ocfs2/dlm/dlmdomain.c

@@ -77,26 +77,26 @@ static void dlm_unregister_domain_handlers(struct dlm_ctxt *dlm);
 
 
 void __dlm_unhash_lockres(struct dlm_lock_resource *lockres)
 void __dlm_unhash_lockres(struct dlm_lock_resource *lockres)
 {
 {
-	list_del_init(&lockres->list);
+	hlist_del_init(&lockres->hash_node);
 	dlm_lockres_put(lockres);
 	dlm_lockres_put(lockres);
 }
 }
 
 
 void __dlm_insert_lockres(struct dlm_ctxt *dlm,
 void __dlm_insert_lockres(struct dlm_ctxt *dlm,
 		       struct dlm_lock_resource *res)
 		       struct dlm_lock_resource *res)
 {
 {
-	struct list_head *bucket;
+	struct hlist_head *bucket;
 	struct qstr *q;
 	struct qstr *q;
 
 
 	assert_spin_locked(&dlm->spinlock);
 	assert_spin_locked(&dlm->spinlock);
 
 
 	q = &res->lockname;
 	q = &res->lockname;
 	q->hash = full_name_hash(q->name, q->len);
 	q->hash = full_name_hash(q->name, q->len);
-	bucket = &(dlm->resources[q->hash & DLM_HASH_MASK]);
+	bucket = &(dlm->lockres_hash[q->hash % DLM_HASH_BUCKETS]);
 
 
 	/* get a reference for our hashtable */
 	/* get a reference for our hashtable */
 	dlm_lockres_get(res);
 	dlm_lockres_get(res);
 
 
-	list_add_tail(&res->list, bucket);
+	hlist_add_head(&res->hash_node, bucket);
 }
 }
 
 
 struct dlm_lock_resource * __dlm_lookup_lockres(struct dlm_ctxt *dlm,
 struct dlm_lock_resource * __dlm_lookup_lockres(struct dlm_ctxt *dlm,
@@ -104,9 +104,9 @@ struct dlm_lock_resource * __dlm_lookup_lockres(struct dlm_ctxt *dlm,
 					 unsigned int len)
 					 unsigned int len)
 {
 {
 	unsigned int hash;
 	unsigned int hash;
-	struct list_head *iter;
+	struct hlist_node *iter;
 	struct dlm_lock_resource *tmpres=NULL;
 	struct dlm_lock_resource *tmpres=NULL;
-	struct list_head *bucket;
+	struct hlist_head *bucket;
 
 
 	mlog_entry("%.*s\n", len, name);
 	mlog_entry("%.*s\n", len, name);
 
 
@@ -114,11 +114,11 @@ struct dlm_lock_resource * __dlm_lookup_lockres(struct dlm_ctxt *dlm,
 
 
 	hash = full_name_hash(name, len);
 	hash = full_name_hash(name, len);
 
 
-	bucket = &(dlm->resources[hash & DLM_HASH_MASK]);
+	bucket = &(dlm->lockres_hash[hash % DLM_HASH_BUCKETS]);
 
 
 	/* check for pre-existing lock */
 	/* check for pre-existing lock */
-	list_for_each(iter, bucket) {
-		tmpres = list_entry(iter, struct dlm_lock_resource, list);
+	hlist_for_each(iter, bucket) {
+		tmpres = hlist_entry(iter, struct dlm_lock_resource, hash_node);
 		if (tmpres->lockname.len == len &&
 		if (tmpres->lockname.len == len &&
 		    memcmp(tmpres->lockname.name, name, len) == 0) {
 		    memcmp(tmpres->lockname.name, name, len) == 0) {
 			dlm_lockres_get(tmpres);
 			dlm_lockres_get(tmpres);
@@ -193,8 +193,8 @@ static int dlm_wait_on_domain_helper(const char *domain)
 
 
 static void dlm_free_ctxt_mem(struct dlm_ctxt *dlm)
 static void dlm_free_ctxt_mem(struct dlm_ctxt *dlm)
 {
 {
-	if (dlm->resources)
-		free_page((unsigned long) dlm->resources);
+	if (dlm->lockres_hash)
+		free_page((unsigned long) dlm->lockres_hash);
 
 
 	if (dlm->name)
 	if (dlm->name)
 		kfree(dlm->name);
 		kfree(dlm->name);
@@ -303,10 +303,10 @@ static void dlm_migrate_all_locks(struct dlm_ctxt *dlm)
 	mlog(0, "Migrating locks from domain %s\n", dlm->name);
 	mlog(0, "Migrating locks from domain %s\n", dlm->name);
 restart:
 restart:
 	spin_lock(&dlm->spinlock);
 	spin_lock(&dlm->spinlock);
-	for (i=0; i<DLM_HASH_SIZE; i++) {
-		while (!list_empty(&dlm->resources[i])) {
-			res = list_entry(dlm->resources[i].next,
-				     struct dlm_lock_resource, list);
+	for (i = 0; i < DLM_HASH_BUCKETS; i++) {
+		while (!hlist_empty(&dlm->lockres_hash[i])) {
+			res = hlist_entry(dlm->lockres_hash[i].first,
+					  struct dlm_lock_resource, hash_node);
 			/* need reference when manually grabbing lockres */
 			/* need reference when manually grabbing lockres */
 			dlm_lockres_get(res);
 			dlm_lockres_get(res);
 			/* this should unhash the lockres
 			/* this should unhash the lockres
@@ -1191,18 +1191,17 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
 		goto leave;
 		goto leave;
 	}
 	}
 
 
-	dlm->resources = (struct list_head *) __get_free_page(GFP_KERNEL);
-	if (!dlm->resources) {
+	dlm->lockres_hash = (struct hlist_head *) __get_free_page(GFP_KERNEL);
+	if (!dlm->lockres_hash) {
 		mlog_errno(-ENOMEM);
 		mlog_errno(-ENOMEM);
 		kfree(dlm->name);
 		kfree(dlm->name);
 		kfree(dlm);
 		kfree(dlm);
 		dlm = NULL;
 		dlm = NULL;
 		goto leave;
 		goto leave;
 	}
 	}
-	memset(dlm->resources, 0, PAGE_SIZE);
 
 
-	for (i=0; i<DLM_HASH_SIZE; i++)
-		INIT_LIST_HEAD(&dlm->resources[i]);
+	for (i=0; i<DLM_HASH_BUCKETS; i++)
+		INIT_HLIST_HEAD(&dlm->lockres_hash[i]);
 
 
 	strcpy(dlm->name, domain);
 	strcpy(dlm->name, domain);
 	dlm->key = key;
 	dlm->key = key;

+ 2 - 2
fs/ocfs2/dlm/dlmmaster.c

@@ -564,7 +564,7 @@ static void dlm_lockres_release(struct kref *kref)
 
 
 	/* By the time we're ready to blow this guy away, we shouldn't
 	/* By the time we're ready to blow this guy away, we shouldn't
 	 * be on any lists. */
 	 * be on any lists. */
-	BUG_ON(!list_empty(&res->list));
+	BUG_ON(!hlist_unhashed(&res->hash_node));
 	BUG_ON(!list_empty(&res->granted));
 	BUG_ON(!list_empty(&res->granted));
 	BUG_ON(!list_empty(&res->converting));
 	BUG_ON(!list_empty(&res->converting));
 	BUG_ON(!list_empty(&res->blocked));
 	BUG_ON(!list_empty(&res->blocked));
@@ -605,7 +605,7 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm,
 
 
 	init_waitqueue_head(&res->wq);
 	init_waitqueue_head(&res->wq);
 	spin_lock_init(&res->spinlock);
 	spin_lock_init(&res->spinlock);
-	INIT_LIST_HEAD(&res->list);
+	INIT_HLIST_NODE(&res->hash_node);
 	INIT_LIST_HEAD(&res->granted);
 	INIT_LIST_HEAD(&res->granted);
 	INIT_LIST_HEAD(&res->converting);
 	INIT_LIST_HEAD(&res->converting);
 	INIT_LIST_HEAD(&res->blocked);
 	INIT_LIST_HEAD(&res->blocked);

+ 12 - 11
fs/ocfs2/dlm/dlmrecovery.c

@@ -1693,7 +1693,10 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm,
 					      u8 dead_node, u8 new_master)
 					      u8 dead_node, u8 new_master)
 {
 {
 	int i;
 	int i;
-	struct list_head *iter, *iter2, *bucket;
+	struct list_head *iter, *iter2;
+	struct hlist_node *hash_iter;
+	struct hlist_head *bucket;
+
 	struct dlm_lock_resource *res;
 	struct dlm_lock_resource *res;
 
 
 	mlog_entry_void();
 	mlog_entry_void();
@@ -1717,10 +1720,9 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm,
 	 * for now we need to run the whole hash, clear
 	 * for now we need to run the whole hash, clear
 	 * the RECOVERING state and set the owner
 	 * the RECOVERING state and set the owner
 	 * if necessary */
 	 * if necessary */
-	for (i=0; i<DLM_HASH_SIZE; i++) {
-		bucket = &(dlm->resources[i]);
-		list_for_each(iter, bucket) {
-			res = list_entry (iter, struct dlm_lock_resource, list);
+	for (i = 0; i < DLM_HASH_BUCKETS; i++) {
+		bucket = &(dlm->lockres_hash[i]);
+		hlist_for_each_entry(res, hash_iter, bucket, hash_node) {
 			if (res->state & DLM_LOCK_RES_RECOVERING) {
 			if (res->state & DLM_LOCK_RES_RECOVERING) {
 				if (res->owner == dead_node) {
 				if (res->owner == dead_node) {
 					mlog(0, "(this=%u) res %.*s owner=%u "
 					mlog(0, "(this=%u) res %.*s owner=%u "
@@ -1852,10 +1854,10 @@ static void dlm_free_dead_locks(struct dlm_ctxt *dlm,
 
 
 static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node)
 static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node)
 {
 {
-	struct list_head *iter;
+	struct hlist_node *iter;
 	struct dlm_lock_resource *res;
 	struct dlm_lock_resource *res;
 	int i;
 	int i;
-	struct list_head *bucket;
+	struct hlist_head *bucket;
 	struct dlm_lock *lock;
 	struct dlm_lock *lock;
 
 
 
 
@@ -1876,10 +1878,9 @@ static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node)
 	 *    can be kicked again to see if any ASTs or BASTs
 	 *    can be kicked again to see if any ASTs or BASTs
 	 *    need to be fired as a result.
 	 *    need to be fired as a result.
 	 */
 	 */
-	for (i=0; i<DLM_HASH_SIZE; i++) {
-		bucket = &(dlm->resources[i]);
-		list_for_each(iter, bucket) {
-			res = list_entry (iter, struct dlm_lock_resource, list);
+	for (i = 0; i < DLM_HASH_BUCKETS; i++) {
+		bucket = &(dlm->lockres_hash[i]);
+		hlist_for_each_entry(res, iter, bucket, hash_node) {
  			/* always prune any $RECOVERY entries for dead nodes,
  			/* always prune any $RECOVERY entries for dead nodes,
  			 * otherwise hangs can occur during later recovery */
  			 * otherwise hangs can occur during later recovery */
 			if (dlm_is_recovery_lock(res->lockname.name,
 			if (dlm_is_recovery_lock(res->lockname.name,

+ 36 - 2
fs/ocfs2/extent_map.c

@@ -181,6 +181,12 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode,
 			ret = -EBADR;
 			ret = -EBADR;
 			if (rec_end > OCFS2_I(inode)->ip_clusters) {
 			if (rec_end > OCFS2_I(inode)->ip_clusters) {
 				mlog_errno(ret);
 				mlog_errno(ret);
+				ocfs2_error(inode->i_sb,
+					    "Extent %d at e_blkno %"MLFu64" of inode %"MLFu64" goes past ip_clusters of %u\n",
+					    i,
+					    le64_to_cpu(rec->e_blkno),
+					    OCFS2_I(inode)->ip_blkno,
+					    OCFS2_I(inode)->ip_clusters);
 				goto out_free;
 				goto out_free;
 			}
 			}
 
 
@@ -226,6 +232,12 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode,
 			ret = -EBADR;
 			ret = -EBADR;
 			if (blkno) {
 			if (blkno) {
 				mlog_errno(ret);
 				mlog_errno(ret);
+				ocfs2_error(inode->i_sb,
+					    "Multiple extents for (cpos = %u, clusters = %u) on inode %"MLFu64"; e_blkno %"MLFu64" and rec %d at e_blkno %"MLFu64"\n",
+					    cpos, clusters,
+					    OCFS2_I(inode)->ip_blkno,
+					    blkno, i,
+					    le64_to_cpu(rec->e_blkno));
 				goto out_free;
 				goto out_free;
 			}
 			}
 
 
@@ -238,6 +250,10 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode,
 		 */
 		 */
 		ret = -EBADR;
 		ret = -EBADR;
 		if (!blkno) {
 		if (!blkno) {
+			ocfs2_error(inode->i_sb,
+				    "No record found for (cpos = %u, clusters = %u) on inode %"MLFu64"\n",
+				    cpos, clusters,
+				    OCFS2_I(inode)->ip_blkno);
 			mlog_errno(ret);
 			mlog_errno(ret);
 			goto out_free;
 			goto out_free;
 		}
 		}
@@ -266,6 +282,20 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode,
 
 
 	for (i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) {
 	for (i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) {
 		rec = &el->l_recs[i];
 		rec = &el->l_recs[i];
+
+		if ((le32_to_cpu(rec->e_cpos) + le32_to_cpu(rec->e_clusters)) >
+		    OCFS2_I(inode)->ip_clusters) {
+			ret = -EBADR;
+			mlog_errno(ret);
+			ocfs2_error(inode->i_sb,
+				    "Extent %d at e_blkno %"MLFu64" of inode %"MLFu64" goes past ip_clusters of %u\n",
+				    i,
+				    le64_to_cpu(rec->e_blkno),
+				    OCFS2_I(inode)->ip_blkno,
+				    OCFS2_I(inode)->ip_clusters);
+			return ret;
+		}
+
 		ret = ocfs2_extent_map_insert(inode, rec,
 		ret = ocfs2_extent_map_insert(inode, rec,
 					      le16_to_cpu(el->l_tree_depth));
 					      le16_to_cpu(el->l_tree_depth));
 		if (ret) {
 		if (ret) {
@@ -526,6 +556,10 @@ static int ocfs2_extent_map_insert(struct inode *inode,
 		    OCFS2_I(inode)->ip_map.em_clusters) {
 		    OCFS2_I(inode)->ip_map.em_clusters) {
 			ret = -EBADR;
 			ret = -EBADR;
 			mlog_errno(ret);
 			mlog_errno(ret);
+			ocfs2_error(inode->i_sb,
+				    "Zero e_clusters on non-tail extent record at e_blkno %"MLFu64" on inode %"MLFu64"\n",
+				    le64_to_cpu(rec->e_blkno),
+				    OCFS2_I(inode)->ip_blkno);
 			return ret;
 			return ret;
 		}
 		}
 
 
@@ -588,12 +622,12 @@ static int ocfs2_extent_map_insert(struct inode *inode,
  * Existing record in the extent map:
  * Existing record in the extent map:
  *
  *
  *	cpos = 10, len = 10
  *	cpos = 10, len = 10
- * 	|---------|
+ *	|---------|
  *
  *
  * New Record:
  * New Record:
  *
  *
  *	cpos = 10, len = 20
  *	cpos = 10, len = 20
- * 	|------------------|
+ *	|------------------|
  *
  *
  * The passed record is the new on-disk record.  The new_clusters value
  * The passed record is the new on-disk record.  The new_clusters value
  * is how many clusters were added to the file.  If the append is a
  * is how many clusters were added to the file.  If the append is a

+ 1 - 50
fs/ocfs2/file.c

@@ -933,9 +933,6 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
 	struct file *filp = iocb->ki_filp;
 	struct file *filp = iocb->ki_filp;
 	struct inode *inode = filp->f_dentry->d_inode;
 	struct inode *inode = filp->f_dentry->d_inode;
 	loff_t newsize, saved_pos;
 	loff_t newsize, saved_pos;
-#ifdef OCFS2_ORACORE_WORKAROUNDS
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
-#endif
 
 
 	mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", filp, buf,
 	mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", filp, buf,
 		   (unsigned int)count,
 		   (unsigned int)count,
@@ -951,14 +948,6 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
 		return -EIO;
 		return -EIO;
 	}
 	}
 
 
-#ifdef OCFS2_ORACORE_WORKAROUNDS
-	/* ugh, work around some applications which open everything O_DIRECT +
-	 * O_APPEND and really don't mean to use O_DIRECT. */
-	if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS &&
-	    (filp->f_flags & O_APPEND) && (filp->f_flags & O_DIRECT)) 
-		filp->f_flags &= ~O_DIRECT;
-#endif
-
 	mutex_lock(&inode->i_mutex);
 	mutex_lock(&inode->i_mutex);
 	/* to match setattr's i_mutex -> i_alloc_sem -> rw_lock ordering */
 	/* to match setattr's i_mutex -> i_alloc_sem -> rw_lock ordering */
 	if (filp->f_flags & O_DIRECT) {
 	if (filp->f_flags & O_DIRECT) {
@@ -1079,27 +1068,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
 	/* communicate with ocfs2_dio_end_io */
 	/* communicate with ocfs2_dio_end_io */
 	ocfs2_iocb_set_rw_locked(iocb);
 	ocfs2_iocb_set_rw_locked(iocb);
 
 
-#ifdef OCFS2_ORACORE_WORKAROUNDS
-	if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS &&
-	    filp->f_flags & O_DIRECT) {
-		unsigned int saved_flags = filp->f_flags;
-		int sector_size = 1 << osb->s_sectsize_bits;
-
-		if ((saved_pos & (sector_size - 1)) ||
-		    (count & (sector_size - 1)) ||
-		    ((unsigned long)buf & (sector_size - 1))) {
-			filp->f_flags |= O_SYNC;
-			filp->f_flags &= ~O_DIRECT;
-		}
-
-		ret = generic_file_aio_write_nolock(iocb, &local_iov, 1,
-						    &iocb->ki_pos);
-
-		filp->f_flags = saved_flags;
-	} else
-#endif
-		ret = generic_file_aio_write_nolock(iocb, &local_iov, 1,
-						    &iocb->ki_pos);
+	ret = generic_file_aio_write_nolock(iocb, &local_iov, 1, &iocb->ki_pos);
 
 
 	/* buffered aio wouldn't have proper lock coverage today */
 	/* buffered aio wouldn't have proper lock coverage today */
 	BUG_ON(ret == -EIOCBQUEUED && !(filp->f_flags & O_DIRECT));
 	BUG_ON(ret == -EIOCBQUEUED && !(filp->f_flags & O_DIRECT));
@@ -1140,9 +1109,6 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
 	int ret = 0, rw_level = -1, have_alloc_sem = 0;
 	int ret = 0, rw_level = -1, have_alloc_sem = 0;
 	struct file *filp = iocb->ki_filp;
 	struct file *filp = iocb->ki_filp;
 	struct inode *inode = filp->f_dentry->d_inode;
 	struct inode *inode = filp->f_dentry->d_inode;
-#ifdef OCFS2_ORACORE_WORKAROUNDS
-	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
-#endif
 
 
 	mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", filp, buf,
 	mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", filp, buf,
 		   (unsigned int)count,
 		   (unsigned int)count,
@@ -1155,21 +1121,6 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
 		goto bail;
 		goto bail;
 	}
 	}
 
 
-#ifdef OCFS2_ORACORE_WORKAROUNDS
-	if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS) {
-		if (filp->f_flags & O_DIRECT) {
-			int sector_size = 1 << osb->s_sectsize_bits;
-
-			if ((pos & (sector_size - 1)) ||
-			    (count & (sector_size - 1)) ||
-			    ((unsigned long)buf & (sector_size - 1)) ||
-			    (i_size_read(inode) & (sector_size -1))) {
-				filp->f_flags &= ~O_DIRECT;
-			}
-		}
-	}
-#endif
-
 	/* 
 	/* 
 	 * buffered reads protect themselves in ->readpage().  O_DIRECT reads
 	 * buffered reads protect themselves in ->readpage().  O_DIRECT reads
 	 * need locks to protect pending reads from racing with truncate.
 	 * need locks to protect pending reads from racing with truncate.

+ 1 - 0
fs/ocfs2/heartbeat.c

@@ -67,6 +67,7 @@ void ocfs2_init_node_maps(struct ocfs2_super *osb)
 	ocfs2_node_map_init(&osb->mounted_map);
 	ocfs2_node_map_init(&osb->mounted_map);
 	ocfs2_node_map_init(&osb->recovery_map);
 	ocfs2_node_map_init(&osb->recovery_map);
 	ocfs2_node_map_init(&osb->umount_map);
 	ocfs2_node_map_init(&osb->umount_map);
+	ocfs2_node_map_init(&osb->osb_recovering_orphan_dirs);
 }
 }
 
 
 static void ocfs2_do_node_down(int node_num,
 static void ocfs2_do_node_down(int node_num,

+ 45 - 1
fs/ocfs2/inode.c

@@ -41,6 +41,7 @@
 #include "dlmglue.h"
 #include "dlmglue.h"
 #include "extent_map.h"
 #include "extent_map.h"
 #include "file.h"
 #include "file.h"
+#include "heartbeat.h"
 #include "inode.h"
 #include "inode.h"
 #include "journal.h"
 #include "journal.h"
 #include "namei.h"
 #include "namei.h"
@@ -544,6 +545,42 @@ bail:
 	return status;
 	return status;
 }
 }
 
 
+/* 
+ * Serialize with orphan dir recovery. If the process doing
+ * recovery on this orphan dir does an iget() with the dir
+ * i_mutex held, we'll deadlock here. Instead we detect this
+ * and exit early - recovery will wipe this inode for us.
+ */
+static int ocfs2_check_orphan_recovery_state(struct ocfs2_super *osb,
+					     int slot)
+{
+	int ret = 0;
+
+	spin_lock(&osb->osb_lock);
+	if (ocfs2_node_map_test_bit(osb, &osb->osb_recovering_orphan_dirs, slot)) {
+		mlog(0, "Recovery is happening on orphan dir %d, will skip "
+		     "this inode\n", slot);
+		ret = -EDEADLK;
+		goto out;
+	}
+	/* This signals to the orphan recovery process that it should
+	 * wait for us to handle the wipe. */
+	osb->osb_orphan_wipes[slot]++;
+out:
+	spin_unlock(&osb->osb_lock);
+	return ret;
+}
+
+static void ocfs2_signal_wipe_completion(struct ocfs2_super *osb,
+					 int slot)
+{
+	spin_lock(&osb->osb_lock);
+	osb->osb_orphan_wipes[slot]--;
+	spin_unlock(&osb->osb_lock);
+
+	wake_up(&osb->osb_wipe_event);
+}
+
 static int ocfs2_wipe_inode(struct inode *inode,
 static int ocfs2_wipe_inode(struct inode *inode,
 			    struct buffer_head *di_bh)
 			    struct buffer_head *di_bh)
 {
 {
@@ -555,6 +592,11 @@ static int ocfs2_wipe_inode(struct inode *inode,
 	/* We've already voted on this so it should be readonly - no
 	/* We've already voted on this so it should be readonly - no
 	 * spinlock needed. */
 	 * spinlock needed. */
 	orphaned_slot = OCFS2_I(inode)->ip_orphaned_slot;
 	orphaned_slot = OCFS2_I(inode)->ip_orphaned_slot;
+
+	status = ocfs2_check_orphan_recovery_state(osb, orphaned_slot);
+	if (status)
+		return status;
+
 	orphan_dir_inode = ocfs2_get_system_file_inode(osb,
 	orphan_dir_inode = ocfs2_get_system_file_inode(osb,
 						       ORPHAN_DIR_SYSTEM_INODE,
 						       ORPHAN_DIR_SYSTEM_INODE,
 						       orphaned_slot);
 						       orphaned_slot);
@@ -597,6 +639,7 @@ bail_unlock_dir:
 	brelse(orphan_dir_bh);
 	brelse(orphan_dir_bh);
 bail:
 bail:
 	iput(orphan_dir_inode);
 	iput(orphan_dir_inode);
+	ocfs2_signal_wipe_completion(osb, orphaned_slot);
 
 
 	return status;
 	return status;
 }
 }
@@ -822,7 +865,8 @@ void ocfs2_delete_inode(struct inode *inode)
 
 
 	status = ocfs2_wipe_inode(inode, di_bh);
 	status = ocfs2_wipe_inode(inode, di_bh);
 	if (status < 0) {
 	if (status < 0) {
-		mlog_errno(status);
+		if (status != -EDEADLK)
+			mlog_errno(status);
 		goto bail_unlock_inode;
 		goto bail_unlock_inode;
 	}
 	}
 
 

+ 93 - 31
fs/ocfs2/journal.c

@@ -1408,21 +1408,17 @@ bail:
 	return status;
 	return status;
 }
 }
 
 
-static int ocfs2_recover_orphans(struct ocfs2_super *osb,
-				 int slot)
+static int ocfs2_queue_orphans(struct ocfs2_super *osb,
+			       int slot,
+			       struct inode **head)
 {
 {
-	int status = 0;
-	int have_disk_lock = 0;
-	struct inode *inode = NULL;
-	struct inode *iter;
+	int status;
 	struct inode *orphan_dir_inode = NULL;
 	struct inode *orphan_dir_inode = NULL;
+	struct inode *iter;
 	unsigned long offset, blk, local;
 	unsigned long offset, blk, local;
 	struct buffer_head *bh = NULL;
 	struct buffer_head *bh = NULL;
 	struct ocfs2_dir_entry *de;
 	struct ocfs2_dir_entry *de;
 	struct super_block *sb = osb->sb;
 	struct super_block *sb = osb->sb;
-	struct ocfs2_inode_info *oi;
-
-	mlog(0, "Recover inodes from orphan dir in slot %d\n", slot);
 
 
 	orphan_dir_inode = ocfs2_get_system_file_inode(osb,
 	orphan_dir_inode = ocfs2_get_system_file_inode(osb,
 						       ORPHAN_DIR_SYSTEM_INODE,
 						       ORPHAN_DIR_SYSTEM_INODE,
@@ -1430,17 +1426,15 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,
 	if  (!orphan_dir_inode) {
 	if  (!orphan_dir_inode) {
 		status = -ENOENT;
 		status = -ENOENT;
 		mlog_errno(status);
 		mlog_errno(status);
-		goto out;
-	}
+		return status;
+	}	
 
 
 	mutex_lock(&orphan_dir_inode->i_mutex);
 	mutex_lock(&orphan_dir_inode->i_mutex);
 	status = ocfs2_meta_lock(orphan_dir_inode, NULL, NULL, 0);
 	status = ocfs2_meta_lock(orphan_dir_inode, NULL, NULL, 0);
 	if (status < 0) {
 	if (status < 0) {
-		mutex_unlock(&orphan_dir_inode->i_mutex);
 		mlog_errno(status);
 		mlog_errno(status);
 		goto out;
 		goto out;
 	}
 	}
-	have_disk_lock = 1;
 
 
 	offset = 0;
 	offset = 0;
 	iter = NULL;
 	iter = NULL;
@@ -1451,11 +1445,10 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,
 		if (!bh)
 		if (!bh)
 			status = -EINVAL;
 			status = -EINVAL;
 		if (status < 0) {
 		if (status < 0) {
-			mutex_unlock(&orphan_dir_inode->i_mutex);
 			if (bh)
 			if (bh)
 				brelse(bh);
 				brelse(bh);
 			mlog_errno(status);
 			mlog_errno(status);
-			goto out;
+			goto out_unlock;
 		}
 		}
 
 
 		local = 0;
 		local = 0;
@@ -1465,11 +1458,10 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,
 
 
 			if (!ocfs2_check_dir_entry(orphan_dir_inode,
 			if (!ocfs2_check_dir_entry(orphan_dir_inode,
 						  de, bh, local)) {
 						  de, bh, local)) {
-				mutex_unlock(&orphan_dir_inode->i_mutex);
 				status = -EINVAL;
 				status = -EINVAL;
 				mlog_errno(status);
 				mlog_errno(status);
 				brelse(bh);
 				brelse(bh);
-				goto out;
+				goto out_unlock;
 			}
 			}
 
 
 			local += le16_to_cpu(de->rec_len);
 			local += le16_to_cpu(de->rec_len);
@@ -1504,18 +1496,95 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,
 
 
 			mlog(0, "queue orphan %"MLFu64"\n",
 			mlog(0, "queue orphan %"MLFu64"\n",
 			     OCFS2_I(iter)->ip_blkno);
 			     OCFS2_I(iter)->ip_blkno);
-			OCFS2_I(iter)->ip_next_orphan = inode;
-			inode = iter;
+			/* No locking is required for the next_orphan
+			 * queue as there is only ever a single
+			 * process doing orphan recovery. */
+			OCFS2_I(iter)->ip_next_orphan = *head;
+			*head = iter;
 		}
 		}
 		brelse(bh);
 		brelse(bh);
 	}
 	}
-	mutex_unlock(&orphan_dir_inode->i_mutex);
 
 
+out_unlock:
 	ocfs2_meta_unlock(orphan_dir_inode, 0);
 	ocfs2_meta_unlock(orphan_dir_inode, 0);
-	have_disk_lock = 0;
-
+out:
+	mutex_unlock(&orphan_dir_inode->i_mutex);
 	iput(orphan_dir_inode);
 	iput(orphan_dir_inode);
-	orphan_dir_inode = NULL;
+	return status;
+}
+
+static int ocfs2_orphan_recovery_can_continue(struct ocfs2_super *osb,
+					      int slot)
+{
+	int ret;
+
+	spin_lock(&osb->osb_lock);
+	ret = !osb->osb_orphan_wipes[slot];
+	spin_unlock(&osb->osb_lock);
+	return ret;
+}
+
+static void ocfs2_mark_recovering_orphan_dir(struct ocfs2_super *osb,
+					     int slot)
+{
+	spin_lock(&osb->osb_lock);
+	/* Mark ourselves such that new processes in delete_inode()
+	 * know to quit early. */
+	ocfs2_node_map_set_bit(osb, &osb->osb_recovering_orphan_dirs, slot);
+	while (osb->osb_orphan_wipes[slot]) {
+		/* If any processes are already in the middle of an
+		 * orphan wipe on this dir, then we need to wait for
+		 * them. */
+		spin_unlock(&osb->osb_lock);
+		wait_event_interruptible(osb->osb_wipe_event,
+					 ocfs2_orphan_recovery_can_continue(osb, slot));
+		spin_lock(&osb->osb_lock);
+	}
+	spin_unlock(&osb->osb_lock);
+}
+
+static void ocfs2_clear_recovering_orphan_dir(struct ocfs2_super *osb,
+					      int slot)
+{
+	ocfs2_node_map_clear_bit(osb, &osb->osb_recovering_orphan_dirs, slot);
+}
+
+/*
+ * Orphan recovery. Each mounted node has it's own orphan dir which we
+ * must run during recovery. Our strategy here is to build a list of
+ * the inodes in the orphan dir and iget/iput them. The VFS does
+ * (most) of the rest of the work.
+ *
+ * Orphan recovery can happen at any time, not just mount so we have a
+ * couple of extra considerations.
+ *
+ * - We grab as many inodes as we can under the orphan dir lock -
+ *   doing iget() outside the orphan dir risks getting a reference on
+ *   an invalid inode.
+ * - We must be sure not to deadlock with other processes on the
+ *   system wanting to run delete_inode(). This can happen when they go
+ *   to lock the orphan dir and the orphan recovery process attempts to
+ *   iget() inside the orphan dir lock. This can be avoided by
+ *   advertising our state to ocfs2_delete_inode().
+ */
+static int ocfs2_recover_orphans(struct ocfs2_super *osb,
+				 int slot)
+{
+	int ret = 0;
+	struct inode *inode = NULL;
+	struct inode *iter;
+	struct ocfs2_inode_info *oi;
+
+	mlog(0, "Recover inodes from orphan dir in slot %d\n", slot);
+
+	ocfs2_mark_recovering_orphan_dir(osb, slot);
+	ret = ocfs2_queue_orphans(osb, slot, &inode);
+	ocfs2_clear_recovering_orphan_dir(osb, slot);
+
+	/* Error here should be noted, but we want to continue with as
+	 * many queued inodes as we've got. */
+	if (ret)
+		mlog_errno(ret);
 
 
 	while (inode) {
 	while (inode) {
 		oi = OCFS2_I(inode);
 		oi = OCFS2_I(inode);
@@ -1541,14 +1610,7 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,
 		inode = iter;
 		inode = iter;
 	}
 	}
 
 
-out:
-	if (have_disk_lock)
-		ocfs2_meta_unlock(orphan_dir_inode, 0);
-
-	if (orphan_dir_inode)
-		iput(orphan_dir_inode);
-
-	return status;
+	return ret;
 }
 }
 
 
 static int ocfs2_wait_on_mount(struct ocfs2_super *osb)
 static int ocfs2_wait_on_mount(struct ocfs2_super *osb)

+ 4 - 3
fs/ocfs2/ocfs2.h

@@ -174,9 +174,6 @@ enum ocfs2_mount_options
 	OCFS2_MOUNT_NOINTR  = 1 << 2,   /* Don't catch signals */
 	OCFS2_MOUNT_NOINTR  = 1 << 2,   /* Don't catch signals */
 	OCFS2_MOUNT_ERRORS_PANIC = 1 << 3, /* Panic on errors */
 	OCFS2_MOUNT_ERRORS_PANIC = 1 << 3, /* Panic on errors */
 	OCFS2_MOUNT_DATA_WRITEBACK = 1 << 4, /* No data ordering */
 	OCFS2_MOUNT_DATA_WRITEBACK = 1 << 4, /* No data ordering */
-#ifdef OCFS2_ORACORE_WORKAROUNDS
-	OCFS2_MOUNT_COMPAT_OCFS = 1 << 30, /* ocfs1 compatibility mode */
-#endif
 };
 };
 
 
 #define OCFS2_OSB_SOFT_RO	0x0001
 #define OCFS2_OSB_SOFT_RO	0x0001
@@ -290,6 +287,10 @@ struct ocfs2_super
 	struct inode			*osb_tl_inode;
 	struct inode			*osb_tl_inode;
 	struct buffer_head		*osb_tl_bh;
 	struct buffer_head		*osb_tl_bh;
 	struct work_struct		osb_truncate_log_wq;
 	struct work_struct		osb_truncate_log_wq;
+
+	struct ocfs2_node_map		osb_recovering_orphan_dirs;
+	unsigned int			*osb_orphan_wipes;
+	wait_queue_head_t		osb_wipe_event;
 };
 };
 
 
 #define OCFS2_SB(sb)	    ((struct ocfs2_super *)(sb)->s_fs_info)
 #define OCFS2_SB(sb)	    ((struct ocfs2_super *)(sb)->s_fs_info)

+ 0 - 1
fs/ocfs2/ocfs2_fs.h

@@ -138,7 +138,6 @@
 
 
 /* Journal limits (in bytes) */
 /* Journal limits (in bytes) */
 #define OCFS2_MIN_JOURNAL_SIZE		(4 * 1024 * 1024)
 #define OCFS2_MIN_JOURNAL_SIZE		(4 * 1024 * 1024)
-#define OCFS2_MAX_JOURNAL_SIZE		(500 * 1024 * 1024)
 
 
 struct ocfs2_system_inode_info {
 struct ocfs2_system_inode_info {
 	char	*si_name;
 	char	*si_name;

+ 11 - 0
fs/ocfs2/super.c

@@ -1325,6 +1325,16 @@ static int ocfs2_initialize_super(struct super_block *sb,
 	}
 	}
 	mlog(ML_NOTICE, "max_slots for this device: %u\n", osb->max_slots);
 	mlog(ML_NOTICE, "max_slots for this device: %u\n", osb->max_slots);
 
 
+	init_waitqueue_head(&osb->osb_wipe_event);
+	osb->osb_orphan_wipes = kcalloc(osb->max_slots,
+					sizeof(*osb->osb_orphan_wipes),
+					GFP_KERNEL);
+	if (!osb->osb_orphan_wipes) {
+		status = -ENOMEM;
+		mlog_errno(status);
+		goto bail;
+	}
+
 	osb->s_feature_compat =
 	osb->s_feature_compat =
 		le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_compat);
 		le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_compat);
 	osb->s_feature_ro_compat =
 	osb->s_feature_ro_compat =
@@ -1638,6 +1648,7 @@ static void ocfs2_delete_osb(struct ocfs2_super *osb)
 	if (osb->slot_info)
 	if (osb->slot_info)
 		ocfs2_free_slot_info(osb->slot_info);
 		ocfs2_free_slot_info(osb->slot_info);
 
 
+	kfree(osb->osb_orphan_wipes);
 	/* FIXME
 	/* FIXME
 	 * This belongs in journal shutdown, but because we have to
 	 * This belongs in journal shutdown, but because we have to
 	 * allocate osb->journal at the start of ocfs2_initalize_osb(),
 	 * allocate osb->journal at the start of ocfs2_initalize_osb(),

+ 7 - 7
fs/reiserfs/file.c

@@ -1464,13 +1464,11 @@ static ssize_t reiserfs_file_write(struct file *file,	/* the file we are going t
 		   partially overwritten pages, if needed. And lock the pages,
 		   partially overwritten pages, if needed. And lock the pages,
 		   so that nobody else can access these until we are done.
 		   so that nobody else can access these until we are done.
 		   We get number of actual blocks needed as a result. */
 		   We get number of actual blocks needed as a result. */
-		blocks_to_allocate =
-		    reiserfs_prepare_file_region_for_write(inode, pos,
-							   num_pages,
-							   write_bytes,
-							   prepared_pages);
-		if (blocks_to_allocate < 0) {
-			res = blocks_to_allocate;
+		res = reiserfs_prepare_file_region_for_write(inode, pos,
+							     num_pages,
+							     write_bytes,
+							     prepared_pages);
+		if (res < 0) {
 			reiserfs_release_claimed_blocks(inode->i_sb,
 			reiserfs_release_claimed_blocks(inode->i_sb,
 							num_pages <<
 							num_pages <<
 							(PAGE_CACHE_SHIFT -
 							(PAGE_CACHE_SHIFT -
@@ -1478,6 +1476,8 @@ static ssize_t reiserfs_file_write(struct file *file,	/* the file we are going t
 			break;
 			break;
 		}
 		}
 
 
+		blocks_to_allocate = res;
+
 		/* First we correct our estimate of how many blocks we need */
 		/* First we correct our estimate of how many blocks we need */
 		reiserfs_release_claimed_blocks(inode->i_sb,
 		reiserfs_release_claimed_blocks(inode->i_sb,
 						(num_pages <<
 						(num_pages <<

+ 2 - 6
fs/reiserfs/inode.c

@@ -627,11 +627,6 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 	reiserfs_write_lock(inode->i_sb);
 	reiserfs_write_lock(inode->i_sb);
 	version = get_inode_item_key_version(inode);
 	version = get_inode_item_key_version(inode);
 
 
-	if (block < 0) {
-		reiserfs_write_unlock(inode->i_sb);
-		return -EIO;
-	}
-
 	if (!file_capable(inode, block)) {
 	if (!file_capable(inode, block)) {
 		reiserfs_write_unlock(inode->i_sb);
 		reiserfs_write_unlock(inode->i_sb);
 		return -EFBIG;
 		return -EFBIG;
@@ -934,12 +929,13 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
 				     //pos_in_item * inode->i_sb->s_blocksize,
 				     //pos_in_item * inode->i_sb->s_blocksize,
 				     TYPE_INDIRECT, 3);	// key type is unimportant
 				     TYPE_INDIRECT, 3);	// key type is unimportant
 
 
+			RFALSE(cpu_key_k_offset(&tmp_key) > cpu_key_k_offset(&key),
+			       "green-805: invalid offset");
 			blocks_needed =
 			blocks_needed =
 			    1 +
 			    1 +
 			    ((cpu_key_k_offset(&key) -
 			    ((cpu_key_k_offset(&key) -
 			      cpu_key_k_offset(&tmp_key)) >> inode->i_sb->
 			      cpu_key_k_offset(&tmp_key)) >> inode->i_sb->
 			     s_blocksize_bits);
 			     s_blocksize_bits);
-			RFALSE(blocks_needed < 0, "green-805: invalid offset");
 
 
 			if (blocks_needed == 1) {
 			if (blocks_needed == 1) {
 				un = &unf_single;
 				un = &unf_single;

+ 1 - 2
fs/reiserfs/journal.c

@@ -2319,8 +2319,7 @@ static int journal_read(struct super_block *p_s_sb)
 		return 1;
 		return 1;
 	}
 	}
 	jh = (struct reiserfs_journal_header *)(journal->j_header_bh->b_data);
 	jh = (struct reiserfs_journal_header *)(journal->j_header_bh->b_data);
-	if (le32_to_cpu(jh->j_first_unflushed_offset) >= 0 &&
-	    le32_to_cpu(jh->j_first_unflushed_offset) <
+	if (le32_to_cpu(jh->j_first_unflushed_offset) <
 	    SB_ONDISK_JOURNAL_SIZE(p_s_sb)
 	    SB_ONDISK_JOURNAL_SIZE(p_s_sb)
 	    && le32_to_cpu(jh->j_last_flush_trans_id) > 0) {
 	    && le32_to_cpu(jh->j_last_flush_trans_id) > 0) {
 		oldest_start =
 		oldest_start =

+ 1 - 0
include/asm-powerpc/eeh.h

@@ -61,6 +61,7 @@ void __init pci_addr_cache_build(void);
  * to finish the eeh setup for this device.
  * to finish the eeh setup for this device.
  */
  */
 void eeh_add_device_early(struct device_node *);
 void eeh_add_device_early(struct device_node *);
+void eeh_add_device_late(struct pci_dev *dev);
 void eeh_add_device_tree_early(struct device_node *);
 void eeh_add_device_tree_early(struct device_node *);
 void eeh_add_device_tree_late(struct pci_bus *);
 void eeh_add_device_tree_late(struct pci_bus *);
 
 

+ 9 - 0
include/pcmcia/device_id.h

@@ -72,6 +72,15 @@
 	.prod_id = { (v1), (v2), (v3), (v4) }, \
 	.prod_id = { (v1), (v2), (v3), (v4) }, \
 	.prod_id_hash = { (vh1), (vh2), (vh3), (vh4) }, }
 	.prod_id_hash = { (vh1), (vh2), (vh3), (vh4) }, }
 
 
+#define PCMCIA_DEVICE_MANF_CARD_PROD_ID1(manf, card, v1, vh1) { \
+	.match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
+			PCMCIA_DEV_ID_MATCH_CARD_ID| \
+			PCMCIA_DEV_ID_MATCH_PROD_ID1, \
+	.manf_id = (manf), \
+	.card_id = (card), \
+	.prod_id = { (v1), NULL, NULL, NULL }, \
+	.prod_id_hash = { (vh1), 0, 0, 0 }, }
+
 
 
 /* multi-function devices */
 /* multi-function devices */
 
 

+ 1 - 1
kernel/sysctl.c

@@ -667,7 +667,7 @@ static ctl_table kern_table[] = {
 		.data		= &acpi_video_flags,
 		.data		= &acpi_video_flags,
 		.maxlen		= sizeof (unsigned long),
 		.maxlen		= sizeof (unsigned long),
 		.mode		= 0644,
 		.mode		= 0644,
-		.proc_handler	= &proc_dointvec,
+		.proc_handler	= &proc_doulongvec_minmax,
 	},
 	},
 #endif
 #endif
 #ifdef CONFIG_IA64
 #ifdef CONFIG_IA64

+ 2 - 2
kernel/timer.c

@@ -1351,10 +1351,10 @@ static inline u64 time_interpolator_get_cycles(unsigned int src)
 			return x();
 			return x();
 
 
 		case TIME_SOURCE_MMIO64	:
 		case TIME_SOURCE_MMIO64	:
-			return readq((void __iomem *) time_interpolator->addr);
+			return readq_relaxed((void __iomem *)time_interpolator->addr);
 
 
 		case TIME_SOURCE_MMIO32	:
 		case TIME_SOURCE_MMIO32	:
-			return readl((void __iomem *) time_interpolator->addr);
+			return readl_relaxed((void __iomem *)time_interpolator->addr);
 
 
 		default: return get_cycles();
 		default: return get_cycles();
 	}
 	}

+ 2 - 1
mm/mempolicy.c

@@ -1793,7 +1793,8 @@ int show_numa_map(struct seq_file *m, void *v)
 	if (!md)
 	if (!md)
 		return 0;
 		return 0;
 
 
-	check_pgd_range(vma, vma->vm_start, vma->vm_end,
+	if (!is_vm_hugetlb_page(vma))
+		check_pgd_range(vma, vma->vm_start, vma->vm_end,
 		    &node_online_map, MPOL_MF_STATS, md);
 		    &node_online_map, MPOL_MF_STATS, md);
 
 
 	if (md->pages) {
 	if (md->pages) {

+ 2 - 1
mm/oom_kill.c

@@ -355,6 +355,7 @@ retry:
 	}
 	}
 
 
 out:
 out:
+	read_unlock(&tasklist_lock);
 	cpuset_unlock();
 	cpuset_unlock();
 	if (mm)
 	if (mm)
 		mmput(mm);
 		mmput(mm);
@@ -364,5 +365,5 @@ out:
 	 * retry to allocate memory unless "p" is current
 	 * retry to allocate memory unless "p" is current
 	 */
 	 */
 	if (!test_thread_flag(TIF_MEMDIE))
 	if (!test_thread_flag(TIF_MEMDIE))
-		schedule_timeout_interruptible(1);
+		schedule_timeout_uninterruptible(1);
 }
 }