aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-03-03 22:22:45 -0500
committerJeff Garzik <jeff@garzik.org>2006-03-03 22:22:45 -0500
commit46153552b43675dd4057cd526331b5bd10f39c7d (patch)
tree62b6055ee61e320dc10ea81903abbe2e7553bf4e
parentf90fdc3cce3d8c8ed09615dc68cb789655078803 (diff)
parentf71e130966ba429dbd24be08ddbcdf263df9a5ad (diff)
Merge branch 'net-const'
-rw-r--r--arch/mips/kernel/time.c5
-rw-r--r--drivers/char/pcmcia/cm4000_cs.c24
-rw-r--r--drivers/char/pcmcia/cm4040_cs.c23
-rw-r--r--drivers/ide/legacy/ide-cs.c1
-rw-r--r--drivers/mtd/redboot.c22
-rw-r--r--drivers/net/3c59x.c4
-rw-r--r--drivers/net/8139cp.c2
-rw-r--r--drivers/net/8139too.c4
-rw-r--r--drivers/net/bnx2.c10
-rw-r--r--drivers/net/bnx2_fw.h84
-rw-r--r--drivers/net/bonding/bond_alb.c2
-rw-r--r--drivers/net/bonding/bond_main.c2
-rw-r--r--drivers/net/chelsio/subr.c2
-rw-r--r--drivers/net/dgrs.c2
-rw-r--r--drivers/net/dgrs_firmware.c4
-rw-r--r--drivers/net/dl2k.c4
-rw-r--r--drivers/net/eepro100.c4
-rw-r--r--drivers/net/epic100.c4
-rw-r--r--drivers/net/fealnx.c2
-rw-r--r--drivers/net/hamachi.c2
-rw-r--r--drivers/net/natsemi.c4
-rw-r--r--drivers/net/ne2k-pci.c2
-rw-r--r--drivers/net/ns83820.c2
-rw-r--r--drivers/net/pcmcia/3c574_cs.c2
-rw-r--r--drivers/net/pcmcia/3c589_cs.c2
-rw-r--r--drivers/net/pcmcia/axnet_cs.c1
-rw-r--r--drivers/net/pcmcia/fmvj18x_cs.c2
-rw-r--r--drivers/net/pcmcia/nmclan_cs.c2
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c2
-rw-r--r--drivers/net/pcmcia/smc91c92_cs.c4
-rw-r--r--drivers/net/pcmcia/xirc2ps_cs.c2
-rw-r--r--drivers/net/pcnet32.c6
-rw-r--r--drivers/net/phy/phy.c2
-rw-r--r--drivers/net/plip.c4
-rw-r--r--drivers/net/ppp_synctty.c2
-rw-r--r--drivers/net/r8169.c4
-rw-r--r--drivers/net/s2io.c8
-rw-r--r--drivers/net/sb1000.c2
-rw-r--r--drivers/net/sis190.c2
-rw-r--r--drivers/net/sis900.c8
-rw-r--r--drivers/net/skfp/fplustm.c14
-rw-r--r--drivers/net/skfp/pcmplc.c4
-rw-r--r--drivers/net/skfp/skfddi.c2
-rw-r--r--drivers/net/starfire.c4
-rw-r--r--drivers/net/sundance.c4
-rw-r--r--drivers/net/sungem_phy.c2
-rw-r--r--drivers/net/tg3.c4
-rw-r--r--drivers/net/typhoon.c2
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c5
-rw-r--r--drivers/net/yellowfin.c6
-rw-r--r--drivers/pcmcia/ds.c40
-rw-r--r--drivers/scsi/aha152x.c85
-rw-r--r--drivers/scsi/aha152x.h2
-rw-r--r--drivers/scsi/jazz_esp.c21
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c29
-rw-r--r--drivers/scsi/pcmcia/aha152x_stub.c4
-rw-r--r--drivers/scsi/scsi_error.c4
-rw-r--r--drivers/scsi/scsi_lib.c2
-rw-r--r--drivers/scsi/scsi_scan.c16
-rw-r--r--drivers/scsi/scsi_transport_fc.c3
-rw-r--r--drivers/scsi/sg.c2
-rw-r--r--drivers/scsi/sym53c8xx_2/sym_hipd.c2
-rw-r--r--fs/9p/fid.c145
-rw-r--r--fs/9p/fid.h6
-rw-r--r--fs/9p/v9fs.c1
-rw-r--r--fs/9p/v9fs_vfs.h1
-rw-r--r--fs/9p/vfs_dentry.c45
-rw-r--r--fs/9p/vfs_file.c106
-rw-r--r--fs/9p/vfs_inode.c478
-rw-r--r--fs/9p/vfs_super.c11
-rw-r--r--fs/ocfs2/cluster/masklog.c1
-rw-r--r--fs/ocfs2/cluster/masklog.h2
-rw-r--r--fs/ocfs2/cluster/nodemanager.c4
-rw-r--r--fs/ocfs2/cluster/tcp.c14
-rw-r--r--fs/ocfs2/cluster/tcp.h5
-rw-r--r--fs/ocfs2/dlm/dlmcommon.h8
-rw-r--r--fs/ocfs2/dlm/dlmdebug.c12
-rw-r--r--fs/ocfs2/dlm/dlmdomain.c39
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c4
-rw-r--r--fs/ocfs2/dlm/dlmrecovery.c23
-rw-r--r--fs/ocfs2/extent_map.c38
-rw-r--r--fs/ocfs2/file.c51
-rw-r--r--fs/ocfs2/heartbeat.c1
-rw-r--r--fs/ocfs2/inode.c46
-rw-r--r--fs/ocfs2/journal.c124
-rw-r--r--fs/ocfs2/ocfs2.h7
-rw-r--r--fs/ocfs2/ocfs2_fs.h1
-rw-r--r--fs/ocfs2/super.c11
-rw-r--r--fs/reiserfs/file.c14
-rw-r--r--fs/reiserfs/inode.c8
-rw-r--r--fs/reiserfs/journal.c3
-rw-r--r--include/asm-powerpc/eeh.h1
-rw-r--r--include/pcmcia/device_id.h9
-rw-r--r--kernel/sysctl.c2
-rw-r--r--kernel/timer.c4
-rw-r--r--mm/mempolicy.c3
-rw-r--r--mm/oom_kill.c3
97 files changed, 950 insertions, 808 deletions
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 7050b4ffffc..42c94c771af 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -163,7 +163,7 @@ void do_gettimeofday(struct timeval *tv)
163 unsigned long seq; 163 unsigned long seq;
164 unsigned long lost; 164 unsigned long lost;
165 unsigned long usec, sec; 165 unsigned long usec, sec;
166 unsigned long max_ntp_tick = tick_usec - tickadj; 166 unsigned long max_ntp_tick;
167 167
168 do { 168 do {
169 seq = read_seqbegin(&xtime_lock); 169 seq = read_seqbegin(&xtime_lock);
@@ -178,12 +178,13 @@ void do_gettimeofday(struct timeval *tv)
178 * Better to lose some accuracy than have time go backwards.. 178 * Better to lose some accuracy than have time go backwards..
179 */ 179 */
180 if (unlikely(time_adjust < 0)) { 180 if (unlikely(time_adjust < 0)) {
181 max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj;
181 usec = min(usec, max_ntp_tick); 182 usec = min(usec, max_ntp_tick);
182 183
183 if (lost) 184 if (lost)
184 usec += lost * max_ntp_tick; 185 usec += lost * max_ntp_tick;
185 } else if (unlikely(lost)) 186 } else if (unlikely(lost))
186 usec += lost * tick_usec; 187 usec += lost * (USEC_PER_SEC / HZ);
187 188
188 sec = xtime.tv_sec; 189 sec = xtime.tv_sec;
189 usec += (xtime.tv_nsec / 1000); 190 usec += (xtime.tv_nsec / 1000);
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c
index 649677b5dc3..5fdf1851543 100644
--- a/drivers/char/pcmcia/cm4000_cs.c
+++ b/drivers/char/pcmcia/cm4000_cs.c
@@ -13,11 +13,12 @@
13 * 13 *
14 * (C) 2000,2001,2002,2003,2004 Omnikey AG 14 * (C) 2000,2001,2002,2003,2004 Omnikey AG
15 * 15 *
16 * (C) 2005 Harald Welte <laforge@gnumonks.org> 16 * (C) 2005-2006 Harald Welte <laforge@gnumonks.org>
17 * - Adhere to Kernel CodingStyle 17 * - Adhere to Kernel CodingStyle
18 * - Port to 2.6.13 "new" style PCMCIA 18 * - Port to 2.6.13 "new" style PCMCIA
19 * - Check for copy_{from,to}_user return values 19 * - Check for copy_{from,to}_user return values
20 * - Use nonseekable_open() 20 * - Use nonseekable_open()
21 * - add class interface for udev device creation
21 * 22 *
22 * All rights reserved. Licensed under dual BSD/GPL license. 23 * All rights reserved. Licensed under dual BSD/GPL license.
23 */ 24 */
@@ -56,7 +57,7 @@ module_param(pc_debug, int, 0600);
56#else 57#else
57#define DEBUGP(n, rdr, x, args...) 58#define DEBUGP(n, rdr, x, args...)
58#endif 59#endif
59static char *version = "cm4000_cs.c v2.4.0gm5 - All bugs added by Harald Welte"; 60static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte";
60 61
61#define T_1SEC (HZ) 62#define T_1SEC (HZ)
62#define T_10MSEC msecs_to_jiffies(10) 63#define T_10MSEC msecs_to_jiffies(10)
@@ -156,6 +157,7 @@ struct cm4000_dev {
156 /*queue*/ 4*sizeof(wait_queue_head_t)) 157 /*queue*/ 4*sizeof(wait_queue_head_t))
157 158
158static dev_link_t *dev_table[CM4000_MAX_DEV]; 159static dev_link_t *dev_table[CM4000_MAX_DEV];
160static struct class *cmm_class;
159 161
160/* This table doesn't use spaces after the comma between fields and thus 162/* This table doesn't use spaces after the comma between fields and thus
161 * violates CodingStyle. However, I don't really think wrapping it around will 163 * 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)
1937 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 1939 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
1938 cm4000_config(link, i); 1940 cm4000_config(link, i);
1939 1941
1942 class_device_create(cmm_class, NULL, MKDEV(major, i), NULL,
1943 "cmm%d", i);
1944
1940 return 0; 1945 return 0;
1941} 1946}
1942 1947
@@ -1962,6 +1967,8 @@ static void cm4000_detach(struct pcmcia_device *p_dev)
1962 dev_table[devno] = NULL; 1967 dev_table[devno] = NULL;
1963 kfree(dev); 1968 kfree(dev);
1964 1969
1970 class_device_destroy(cmm_class, MKDEV(major, devno));
1971
1965 return; 1972 return;
1966} 1973}
1967 1974
@@ -1995,8 +2002,18 @@ static struct pcmcia_driver cm4000_driver = {
1995 2002
1996static int __init cmm_init(void) 2003static int __init cmm_init(void)
1997{ 2004{
2005 int rc;
2006
1998 printk(KERN_INFO "%s\n", version); 2007 printk(KERN_INFO "%s\n", version);
1999 pcmcia_register_driver(&cm4000_driver); 2008
2009 cmm_class = class_create(THIS_MODULE, "cardman_4000");
2010 if (!cmm_class)
2011 return -1;
2012
2013 rc = pcmcia_register_driver(&cm4000_driver);
2014 if (rc < 0)
2015 return rc;
2016
2000 major = register_chrdev(0, DEVICE_NAME, &cm4000_fops); 2017 major = register_chrdev(0, DEVICE_NAME, &cm4000_fops);
2001 if (major < 0) { 2018 if (major < 0) {
2002 printk(KERN_WARNING MODULE_NAME 2019 printk(KERN_WARNING MODULE_NAME
@@ -2012,6 +2029,7 @@ static void __exit cmm_exit(void)
2012 printk(KERN_INFO MODULE_NAME ": unloading\n"); 2029 printk(KERN_INFO MODULE_NAME ": unloading\n");
2013 pcmcia_unregister_driver(&cm4000_driver); 2030 pcmcia_unregister_driver(&cm4000_driver);
2014 unregister_chrdev(major, DEVICE_NAME); 2031 unregister_chrdev(major, DEVICE_NAME);
2032 class_destroy(cmm_class);
2015}; 2033};
2016 2034
2017module_init(cmm_init); 2035module_init(cmm_init);
diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c
index 46eb371bf17..466e33bab02 100644
--- a/drivers/char/pcmcia/cm4040_cs.c
+++ b/drivers/char/pcmcia/cm4040_cs.c
@@ -3,12 +3,13 @@
3 * 3 *
4 * (c) 2000-2004 Omnikey AG (http://www.omnikey.com/) 4 * (c) 2000-2004 Omnikey AG (http://www.omnikey.com/)
5 * 5 *
6 * (C) 2005 Harald Welte <laforge@gnumonks.org> 6 * (C) 2005-2006 Harald Welte <laforge@gnumonks.org>
7 * - add support for poll() 7 * - add support for poll()
8 * - driver cleanup 8 * - driver cleanup
9 * - add waitqueues 9 * - add waitqueues
10 * - adhere to linux kernel coding style and policies 10 * - adhere to linux kernel coding style and policies
11 * - support 2.6.13 "new style" pcmcia interface 11 * - support 2.6.13 "new style" pcmcia interface
12 * - add class interface for udev device creation
12 * 13 *
13 * The device basically is a USB CCID compliant device that has been 14 * The device basically is a USB CCID compliant device that has been
14 * attached to an I/O-Mapped FIFO. 15 * attached to an I/O-Mapped FIFO.
@@ -53,7 +54,7 @@ module_param(pc_debug, int, 0600);
53#endif 54#endif
54 55
55static char *version = 56static char *version =
56"OMNIKEY CardMan 4040 v1.1.0gm4 - All bugs added by Harald Welte"; 57"OMNIKEY CardMan 4040 v1.1.0gm5 - All bugs added by Harald Welte";
57 58
58#define CCID_DRIVER_BULK_DEFAULT_TIMEOUT (150*HZ) 59#define CCID_DRIVER_BULK_DEFAULT_TIMEOUT (150*HZ)
59#define CCID_DRIVER_ASYNC_POWERUP_TIMEOUT (35*HZ) 60#define CCID_DRIVER_ASYNC_POWERUP_TIMEOUT (35*HZ)
@@ -67,6 +68,7 @@ static char *version =
67static void reader_release(dev_link_t *link); 68static void reader_release(dev_link_t *link);
68 69
69static int major; 70static int major;
71static struct class *cmx_class;
70 72
71#define BS_READABLE 0x01 73#define BS_READABLE 0x01
72#define BS_WRITABLE 0x02 74#define BS_WRITABLE 0x02
@@ -696,6 +698,9 @@ static int reader_attach(struct pcmcia_device *p_dev)
696 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; 698 link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
697 reader_config(link, i); 699 reader_config(link, i);
698 700
701 class_device_create(cmx_class, NULL, MKDEV(major, i), NULL,
702 "cmx%d", i);
703
699 return 0; 704 return 0;
700} 705}
701 706
@@ -721,6 +726,8 @@ static void reader_detach(struct pcmcia_device *p_dev)
721 dev_table[devno] = NULL; 726 dev_table[devno] = NULL;
722 kfree(dev); 727 kfree(dev);
723 728
729 class_device_destroy(cmx_class, MKDEV(major, devno));
730
724 return; 731 return;
725} 732}
726 733
@@ -755,8 +762,17 @@ static struct pcmcia_driver reader_driver = {
755 762
756static int __init cm4040_init(void) 763static int __init cm4040_init(void)
757{ 764{
765 int rc;
766
758 printk(KERN_INFO "%s\n", version); 767 printk(KERN_INFO "%s\n", version);
759 pcmcia_register_driver(&reader_driver); 768 cmx_class = class_create(THIS_MODULE, "cardman_4040");
769 if (!cmx_class)
770 return -1;
771
772 rc = pcmcia_register_driver(&reader_driver);
773 if (rc < 0)
774 return rc;
775
760 major = register_chrdev(0, DEVICE_NAME, &reader_fops); 776 major = register_chrdev(0, DEVICE_NAME, &reader_fops);
761 if (major < 0) { 777 if (major < 0) {
762 printk(KERN_WARNING MODULE_NAME 778 printk(KERN_WARNING MODULE_NAME
@@ -771,6 +787,7 @@ static void __exit cm4040_exit(void)
771 printk(KERN_INFO MODULE_NAME ": unloading\n"); 787 printk(KERN_INFO MODULE_NAME ": unloading\n");
772 pcmcia_unregister_driver(&reader_driver); 788 pcmcia_unregister_driver(&reader_driver);
773 unregister_chrdev(major, DEVICE_NAME); 789 unregister_chrdev(major, DEVICE_NAME);
790 class_destroy(cmx_class);
774} 791}
775 792
776module_init(cm4040_init); 793module_init(cm4040_init);
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c
index 4c2af902090..6213bd3caee 100644
--- a/drivers/ide/legacy/ide-cs.c
+++ b/drivers/ide/legacy/ide-cs.c
@@ -445,6 +445,7 @@ static struct pcmcia_device_id ide_ids[] = {
445 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "PnPIDE", 0x281f1c5d, 0x0c694728), 445 PCMCIA_DEVICE_PROD_ID12("PCMCIA", "PnPIDE", 0x281f1c5d, 0x0c694728),
446 PCMCIA_DEVICE_PROD_ID12("SHUTTLE TECHNOLOGY LTD.", "PCCARD-IDE/ATAPI Adapter", 0x4a3f0ba0, 0x322560e1), 446 PCMCIA_DEVICE_PROD_ID12("SHUTTLE TECHNOLOGY LTD.", "PCCARD-IDE/ATAPI Adapter", 0x4a3f0ba0, 0x322560e1),
447 PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003), 447 PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "MK2001MPL", 0xb4585a1a, 0x3489e003),
448 PCMCIA_DEVICE_PROD_ID1("TRANSCEND 512M ", 0xd0909443),
448 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852), 449 PCMCIA_DEVICE_PROD_ID12("WIT", "IDE16", 0x244e5994, 0x3e232852),
449 PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209), 450 PCMCIA_DEVICE_PROD_ID1("STI Flash", 0xe4a13209),
450 PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e), 451 PCMCIA_DEVICE_PROD_ID12("STI", "Flash 5.0", 0xbf2df18d, 0x8cb57a0e),
diff --git a/drivers/mtd/redboot.c b/drivers/mtd/redboot.c
index d01b6a9198e..8815c8dbef2 100644
--- a/drivers/mtd/redboot.c
+++ b/drivers/mtd/redboot.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: redboot.c,v 1.18 2005/11/07 11:14:21 gleixner Exp $ 2 * $Id: redboot.c,v 1.19 2005/12/01 10:03:51 dwmw2 Exp $
3 * 3 *
4 * Parse RedBoot-style Flash Image System (FIS) tables and 4 * Parse RedBoot-style Flash Image System (FIS) tables and
5 * produce a Linux partition array to match. 5 * produce a Linux partition array to match.
@@ -92,10 +92,10 @@ static int parse_redboot_partitions(struct mtd_info *master,
92 if (!memcmp(buf[i].name, "FIS directory", 14)) { 92 if (!memcmp(buf[i].name, "FIS directory", 14)) {
93 /* This is apparently the FIS directory entry for the 93 /* This is apparently the FIS directory entry for the
94 * FIS directory itself. The FIS directory size is 94 * FIS directory itself. The FIS directory size is
95 * one erase block, if the buf[i].size field is 95 * one erase block; if the buf[i].size field is
96 * swab32(erasesize) then we know we are looking at 96 * swab32(erasesize) then we know we are looking at
97 * a byte swapped FIS directory - swap all the entries! 97 * a byte swapped FIS directory - swap all the entries!
98 * (NOTE: this is 'size' not 'data_length', size is 98 * (NOTE: this is 'size' not 'data_length'; size is
99 * the full size of the entry.) 99 * the full size of the entry.)
100 */ 100 */
101 if (swab32(buf[i].size) == master->erasesize) { 101 if (swab32(buf[i].size) == master->erasesize) {
@@ -104,15 +104,13 @@ static int parse_redboot_partitions(struct mtd_info *master,
104 /* The unsigned long fields were written with the 104 /* The unsigned long fields were written with the
105 * wrong byte sex, name and pad have no byte sex. 105 * wrong byte sex, name and pad have no byte sex.
106 */ 106 */
107# define do_swab32(x) (x) = swab32(x) 107 swab32s(&buf[j].flash_base);
108 do_swab32(buf[j].flash_base); 108 swab32s(&buf[j].mem_base);
109 do_swab32(buf[j].mem_base); 109 swab32s(&buf[j].size);
110 do_swab32(buf[j].size); 110 swab32s(&buf[j].entry_point);
111 do_swab32(buf[j].entry_point); 111 swab32s(&buf[j].data_length);
112 do_swab32(buf[j].data_length); 112 swab32s(&buf[j].desc_cksum);
113 do_swab32(buf[j].desc_cksum); 113 swab32s(&buf[j].file_cksum);
114 do_swab32(buf[j].file_cksum);
115# undef do_swab32
116 } 114 }
117 } 115 }
118 break; 116 break;
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 9e8897976a6..5d11a06ecb2 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -842,7 +842,7 @@ enum xcvr_types {
842 XCVR_100baseFx, XCVR_MII=6, XCVR_NWAY=8, XCVR_ExtMII=9, XCVR_Default=10, 842 XCVR_100baseFx, XCVR_MII=6, XCVR_NWAY=8, XCVR_ExtMII=9, XCVR_Default=10,
843}; 843};
844 844
845static struct media_table { 845static const struct media_table {
846 char *name; 846 char *name;
847 unsigned int media_bits:16, /* Bits to set in Wn4_Media register. */ 847 unsigned int media_bits:16, /* Bits to set in Wn4_Media register. */
848 mask:8, /* The transceiver-present bit in Wn3_Config.*/ 848 mask:8, /* The transceiver-present bit in Wn3_Config.*/
@@ -1446,7 +1446,7 @@ static int __devinit vortex_probe1(struct device *gendev,
1446 } 1446 }
1447 1447
1448 { 1448 {
1449 static const char * ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; 1449 static const char * const ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
1450 unsigned int config; 1450 unsigned int config;
1451 EL3WINDOW(3); 1451 EL3WINDOW(3);
1452 vp->available_media = ioread16(ioaddr + Wn3_Options); 1452 vp->available_media = ioread16(ioaddr + Wn3_Options);
diff --git a/drivers/net/8139cp.c b/drivers/net/8139cp.c
index dd410496aad..ce99845d826 100644
--- a/drivers/net/8139cp.c
+++ b/drivers/net/8139cp.c
@@ -1276,7 +1276,7 @@ static int cp_change_mtu(struct net_device *dev, int new_mtu)
1276} 1276}
1277#endif /* BROKEN */ 1277#endif /* BROKEN */
1278 1278
1279static char mii_2_8139_map[8] = { 1279static const char mii_2_8139_map[8] = {
1280 BasicModeCtrl, 1280 BasicModeCtrl,
1281 BasicModeStatus, 1281 BasicModeStatus,
1282 0, 1282 0,
diff --git a/drivers/net/8139too.c b/drivers/net/8139too.c
index 2beac55b57d..e58d4c50c2e 100644
--- a/drivers/net/8139too.c
+++ b/drivers/net/8139too.c
@@ -229,7 +229,7 @@ typedef enum {
229 229
230 230
231/* indexed by board_t, above */ 231/* indexed by board_t, above */
232static struct { 232static const struct {
233 const char *name; 233 const char *name;
234 u32 hw_flags; 234 u32 hw_flags;
235} board_info[] __devinitdata = { 235} board_info[] __devinitdata = {
@@ -1192,7 +1192,7 @@ static int __devinit read_eeprom (void __iomem *ioaddr, int location, int addr_l
1192#define mdio_delay() RTL_R8(Config4) 1192#define mdio_delay() RTL_R8(Config4)
1193 1193
1194 1194
1195static char mii_2_8139_map[8] = { 1195static const char mii_2_8139_map[8] = {
1196 BasicModeCtrl, 1196 BasicModeCtrl,
1197 BasicModeStatus, 1197 BasicModeStatus,
1198 0, 1198 0,
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index a24200d0a61..b787b6582e5 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -46,7 +46,7 @@ typedef enum {
46} board_t; 46} board_t;
47 47
48/* indexed by board_t, above */ 48/* indexed by board_t, above */
49static struct { 49static const struct {
50 char *name; 50 char *name;
51} board_info[] __devinitdata = { 51} board_info[] __devinitdata = {
52 { "Broadcom NetXtreme II BCM5706 1000Base-T" }, 52 { "Broadcom NetXtreme II BCM5706 1000Base-T" },
@@ -3476,7 +3476,7 @@ bnx2_test_registers(struct bnx2 *bp)
3476{ 3476{
3477 int ret; 3477 int ret;
3478 int i; 3478 int i;
3479 static struct { 3479 static const struct {
3480 u16 offset; 3480 u16 offset;
3481 u16 flags; 3481 u16 flags;
3482 u32 rw_mask; 3482 u32 rw_mask;
@@ -3891,7 +3891,7 @@ reg_test_err:
3891static int 3891static int
3892bnx2_do_mem_test(struct bnx2 *bp, u32 start, u32 size) 3892bnx2_do_mem_test(struct bnx2 *bp, u32 start, u32 size)
3893{ 3893{
3894 static u32 test_pattern[] = { 0x00000000, 0xffffffff, 0x55555555, 3894 static const u32 test_pattern[] = { 0x00000000, 0xffffffff, 0x55555555,
3895 0xaaaaaaaa , 0xaa55aa55, 0x55aa55aa }; 3895 0xaaaaaaaa , 0xaa55aa55, 0x55aa55aa };
3896 int i; 3896 int i;
3897 3897
@@ -3916,7 +3916,7 @@ bnx2_test_memory(struct bnx2 *bp)
3916{ 3916{
3917 int ret = 0; 3917 int ret = 0;
3918 int i; 3918 int i;
3919 static struct { 3919 static const struct {
3920 u32 offset; 3920 u32 offset;
3921 u32 len; 3921 u32 len;
3922 } mem_tbl[] = { 3922 } mem_tbl[] = {
@@ -5122,7 +5122,7 @@ static struct {
5122 5122
5123#define STATS_OFFSET32(offset_name) (offsetof(struct statistics_block, offset_name) / 4) 5123#define STATS_OFFSET32(offset_name) (offsetof(struct statistics_block, offset_name) / 4)
5124 5124
5125static unsigned long bnx2_stats_offset_arr[BNX2_NUM_STATS] = { 5125static const unsigned long bnx2_stats_offset_arr[BNX2_NUM_STATS] = {
5126 STATS_OFFSET32(stat_IfHCInOctets_hi), 5126 STATS_OFFSET32(stat_IfHCInOctets_hi),
5127 STATS_OFFSET32(stat_IfHCInBadOctets_hi), 5127 STATS_OFFSET32(stat_IfHCInBadOctets_hi),
5128 STATS_OFFSET32(stat_IfHCOutOctets_hi), 5128 STATS_OFFSET32(stat_IfHCOutOctets_hi),
diff --git a/drivers/net/bnx2_fw.h b/drivers/net/bnx2_fw.h
index 0c21bd84981..8158974c35a 100644
--- a/drivers/net/bnx2_fw.h
+++ b/drivers/net/bnx2_fw.h
@@ -14,20 +14,20 @@
14 * accompanying it. 14 * accompanying it.
15 */ 15 */
16 16
17static int bnx2_COM_b06FwReleaseMajor = 0x1; 17static const int bnx2_COM_b06FwReleaseMajor = 0x1;
18static int bnx2_COM_b06FwReleaseMinor = 0x0; 18static const int bnx2_COM_b06FwReleaseMinor = 0x0;
19static int bnx2_COM_b06FwReleaseFix = 0x0; 19static const int bnx2_COM_b06FwReleaseFix = 0x0;
20static u32 bnx2_COM_b06FwStartAddr = 0x080008b4; 20static const u32 bnx2_COM_b06FwStartAddr = 0x080008b4;
21static u32 bnx2_COM_b06FwTextAddr = 0x08000000; 21static const u32 bnx2_COM_b06FwTextAddr = 0x08000000;
22static int bnx2_COM_b06FwTextLen = 0x57bc; 22static const int bnx2_COM_b06FwTextLen = 0x57bc;
23static u32 bnx2_COM_b06FwDataAddr = 0x08005840; 23static const u32 bnx2_COM_b06FwDataAddr = 0x08005840;
24static int bnx2_COM_b06FwDataLen = 0x0; 24static const int bnx2_COM_b06FwDataLen = 0x0;
25static u32 bnx2_COM_b06FwRodataAddr = 0x080057c0; 25static const u32 bnx2_COM_b06FwRodataAddr = 0x080057c0;
26static int bnx2_COM_b06FwRodataLen = 0x58; 26static const int bnx2_COM_b06FwRodataLen = 0x58;
27static u32 bnx2_COM_b06FwBssAddr = 0x08005860; 27static const u32 bnx2_COM_b06FwBssAddr = 0x08005860;
28static int bnx2_COM_b06FwBssLen = 0x88; 28static const int bnx2_COM_b06FwBssLen = 0x88;
29static u32 bnx2_COM_b06FwSbssAddr = 0x08005840; 29static const u32 bnx2_COM_b06FwSbssAddr = 0x08005840;
30static int bnx2_COM_b06FwSbssLen = 0x1c; 30static const int bnx2_COM_b06FwSbssLen = 0x1c;
31static u32 bnx2_COM_b06FwText[(0x57bc/4) + 1] = { 31static u32 bnx2_COM_b06FwText[(0x57bc/4) + 1] = {
32 0x0a00022d, 0x00000000, 0x00000000, 0x0000000d, 0x636f6d20, 0x322e352e, 32 0x0a00022d, 0x00000000, 0x00000000, 0x0000000d, 0x636f6d20, 0x322e352e,
33 0x38000000, 0x02050802, 0x00000000, 0x00000003, 0x00000014, 0x00000032, 33 0x38000000, 0x02050802, 0x00000000, 0x00000003, 0x00000014, 0x00000032,
@@ -2325,20 +2325,20 @@ static u32 bnx2_rv2p_proc2[] = {
2325 0x0000000c, 0x29520000, 0x00000018, 0x80000002, 0x0000000c, 0x29800000, 2325 0x0000000c, 0x29520000, 0x00000018, 0x80000002, 0x0000000c, 0x29800000,
2326 0x00000018, 0x00570000 }; 2326 0x00000018, 0x00570000 };
2327 2327
2328static int bnx2_TPAT_b06FwReleaseMajor = 0x1; 2328static const int bnx2_TPAT_b06FwReleaseMajor = 0x1;
2329static int bnx2_TPAT_b06FwReleaseMinor = 0x0; 2329static const int bnx2_TPAT_b06FwReleaseMinor = 0x0;
2330static int bnx2_TPAT_b06FwReleaseFix = 0x0; 2330static const int bnx2_TPAT_b06FwReleaseFix = 0x0;
2331static u32 bnx2_TPAT_b06FwStartAddr = 0x08000860; 2331static const u32 bnx2_TPAT_b06FwStartAddr = 0x08000860;
2332static u32 bnx2_TPAT_b06FwTextAddr = 0x08000800; 2332static const u32 bnx2_TPAT_b06FwTextAddr = 0x08000800;
2333static int bnx2_TPAT_b06FwTextLen = 0x122c; 2333static const int bnx2_TPAT_b06FwTextLen = 0x122c;
2334static u32 bnx2_TPAT_b06FwDataAddr = 0x08001a60; 2334static const u32 bnx2_TPAT_b06FwDataAddr = 0x08001a60;
2335static int bnx2_TPAT_b06FwDataLen = 0x0; 2335static const int bnx2_TPAT_b06FwDataLen = 0x0;
2336static u32 bnx2_TPAT_b06FwRodataAddr = 0x00000000; 2336static const u32 bnx2_TPAT_b06FwRodataAddr = 0x00000000;
2337static int bnx2_TPAT_b06FwRodataLen = 0x0; 2337static const int bnx2_TPAT_b06FwRodataLen = 0x0;
2338static u32 bnx2_TPAT_b06FwBssAddr = 0x08001aa0; 2338static const u32 bnx2_TPAT_b06FwBssAddr = 0x08001aa0;
2339static int bnx2_TPAT_b06FwBssLen = 0x250; 2339static const int bnx2_TPAT_b06FwBssLen = 0x250;
2340static u32 bnx2_TPAT_b06FwSbssAddr = 0x08001a60; 2340static const u32 bnx2_TPAT_b06FwSbssAddr = 0x08001a60;
2341static int bnx2_TPAT_b06FwSbssLen = 0x34; 2341static const int bnx2_TPAT_b06FwSbssLen = 0x34;
2342static u32 bnx2_TPAT_b06FwText[(0x122c/4) + 1] = { 2342static u32 bnx2_TPAT_b06FwText[(0x122c/4) + 1] = {
2343 0x0a000218, 0x00000000, 0x00000000, 0x0000000d, 0x74706174, 0x20322e35, 2343 0x0a000218, 0x00000000, 0x00000000, 0x0000000d, 0x74706174, 0x20322e35,
2344 0x2e313100, 0x02050b01, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 2344 0x2e313100, 0x02050b01, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -2540,20 +2540,20 @@ static u32 bnx2_TPAT_b06FwRodata[(0x0/4) + 1] = { 0x0 };
2540static u32 bnx2_TPAT_b06FwBss[(0x250/4) + 1] = { 0x0 }; 2540static u32 bnx2_TPAT_b06FwBss[(0x250/4) + 1] = { 0x0 };
2541static u32 bnx2_TPAT_b06FwSbss[(0x34/4) + 1] = { 0x0 }; 2541static u32 bnx2_TPAT_b06FwSbss[(0x34/4) + 1] = { 0x0 };
2542 2542
2543static int bnx2_TXP_b06FwReleaseMajor = 0x1; 2543static const int bnx2_TXP_b06FwReleaseMajor = 0x1;
2544static int bnx2_TXP_b06FwReleaseMinor = 0x0; 2544static const int bnx2_TXP_b06FwReleaseMinor = 0x0;
2545static int bnx2_TXP_b06FwReleaseFix = 0x0; 2545static const int bnx2_TXP_b06FwReleaseFix = 0x0;
2546static u32 bnx2_TXP_b06FwStartAddr = 0x080034b0; 2546static const u32 bnx2_TXP_b06FwStartAddr = 0x080034b0;
2547static u32 bnx2_TXP_b06FwTextAddr = 0x08000000; 2547static const u32 bnx2_TXP_b06FwTextAddr = 0x08000000;
2548static int bnx2_TXP_b06FwTextLen = 0x5748; 2548static const int bnx2_TXP_b06FwTextLen = 0x5748;
2549static u32 bnx2_TXP_b06FwDataAddr = 0x08005760; 2549static const u32 bnx2_TXP_b06FwDataAddr = 0x08005760;
2550static int bnx2_TXP_b06FwDataLen = 0x0; 2550static const int bnx2_TXP_b06FwDataLen = 0x0;
2551static u32 bnx2_TXP_b06FwRodataAddr = 0x00000000; 2551static const u32 bnx2_TXP_b06FwRodataAddr = 0x00000000;
2552static int bnx2_TXP_b06FwRodataLen = 0x0; 2552static const int bnx2_TXP_b06FwRodataLen = 0x0;
2553static u32 bnx2_TXP_b06FwBssAddr = 0x080057a0; 2553static const u32 bnx2_TXP_b06FwBssAddr = 0x080057a0;
2554static int bnx2_TXP_b06FwBssLen = 0x1c4; 2554static const int bnx2_TXP_b06FwBssLen = 0x1c4;
2555static u32 bnx2_TXP_b06FwSbssAddr = 0x08005760; 2555static const u32 bnx2_TXP_b06FwSbssAddr = 0x08005760;
2556static int bnx2_TXP_b06FwSbssLen = 0x38; 2556static const int bnx2_TXP_b06FwSbssLen = 0x38;
2557static u32 bnx2_TXP_b06FwText[(0x5748/4) + 1] = { 2557static u32 bnx2_TXP_b06FwText[(0x5748/4) + 1] = {
2558 0x0a000d2c, 0x00000000, 0x00000000, 0x0000000d, 0x74787020, 0x322e352e, 2558 0x0a000d2c, 0x00000000, 0x00000000, 0x0000000d, 0x74787020, 0x322e352e,
2559 0x38000000, 0x02050800, 0x0000000a, 0x000003e8, 0x0000ea60, 0x00000000, 2559 0x38000000, 0x02050800, 0x0000000a, 0x000003e8, 0x0000ea60, 0x00000000,
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index f2a63186ae0..e83bc825f6a 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -1261,7 +1261,7 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
1261 struct ethhdr *eth_data; 1261 struct ethhdr *eth_data;
1262 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); 1262 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
1263 struct slave *tx_slave = NULL; 1263 struct slave *tx_slave = NULL;
1264 static u32 ip_bcast = 0xffffffff; 1264 static const u32 ip_bcast = 0xffffffff;
1265 int hash_size = 0; 1265 int hash_size = 0;
1266 int do_tx_balance = 1; 1266 int do_tx_balance = 1;
1267 u32 hash_index = 0; 1267 u32 hash_index = 0;
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 623c87a8361..2d0ac169a86 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -131,7 +131,7 @@ MODULE_PARM_DESC(arp_ip_target, "arp targets in n.n.n.n form");
131 131
132/*----------------------------- Global variables ----------------------------*/ 132/*----------------------------- Global variables ----------------------------*/
133 133
134static const char *version = 134static const char * const version =
135 DRV_DESCRIPTION ": v" DRV_VERSION " (" DRV_RELDATE ")\n"; 135 DRV_DESCRIPTION ": v" DRV_VERSION " (" DRV_RELDATE ")\n";
136 136
137LIST_HEAD(bond_dev_list); 137LIST_HEAD(bond_dev_list);
diff --git a/drivers/net/chelsio/subr.c b/drivers/net/chelsio/subr.c
index 1ebb5d149ae..12e4e96dba2 100644
--- a/drivers/net/chelsio/subr.c
+++ b/drivers/net/chelsio/subr.c
@@ -686,7 +686,7 @@ int t1_init_hw_modules(adapter_t *adapter)
686 */ 686 */
687static void __devinit get_pci_mode(adapter_t *adapter, struct chelsio_pci_params *p) 687static void __devinit get_pci_mode(adapter_t *adapter, struct chelsio_pci_params *p)
688{ 688{
689 static unsigned short speed_map[] = { 33, 66, 100, 133 }; 689 static const unsigned short speed_map[] = { 33, 66, 100, 133 };
690 u32 pci_mode; 690 u32 pci_mode;
691 691
692 pci_read_config_dword(adapter->pdev, A_PCICFG_MODE, &pci_mode); 692 pci_read_config_dword(adapter->pdev, A_PCICFG_MODE, &pci_mode);
diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c
index 70b47e4c4e9..32d13166c6e 100644
--- a/drivers/net/dgrs.c
+++ b/drivers/net/dgrs.c
@@ -993,7 +993,7 @@ dgrs_download(struct net_device *dev0)
993 int is; 993 int is;
994 unsigned long i; 994 unsigned long i;
995 995
996 static int iv2is[16] = { 996 static const int iv2is[16] = {
997 0, 0, 0, ES4H_IS_INT3, 997 0, 0, 0, ES4H_IS_INT3,
998 0, ES4H_IS_INT5, 0, ES4H_IS_INT7, 998 0, ES4H_IS_INT5, 0, ES4H_IS_INT7,
999 0, 0, ES4H_IS_INT10, ES4H_IS_INT11, 999 0, 0, ES4H_IS_INT10, ES4H_IS_INT11,
diff --git a/drivers/net/dgrs_firmware.c b/drivers/net/dgrs_firmware.c
index 1e49e1e1f20..8c20d4c9993 100644
--- a/drivers/net/dgrs_firmware.c
+++ b/drivers/net/dgrs_firmware.c
@@ -1,4 +1,4 @@
1static int dgrs_firmnum = 550; 1static const int dgrs_firmnum = 550;
2static char dgrs_firmver[] = "$Version$"; 2static char dgrs_firmver[] = "$Version$";
3static char dgrs_firmdate[] = "11/16/96 03:45:15"; 3static char dgrs_firmdate[] = "11/16/96 03:45:15";
4static unsigned char dgrs_code[] __initdata = { 4static unsigned char dgrs_code[] __initdata = {
@@ -9963,4 +9963,4 @@ static unsigned char dgrs_code[] __initdata = {
9963 109,46,99,0,114,99,0,0,48,120,0,0, 9963 109,46,99,0,114,99,0,0,48,120,0,0,
9964 0,0,0,0,0,0,0,0,0,0,0,0 9964 0,0,0,0,0,0,0,0,0,0,0,0
9965 } ; 9965 } ;
9966static int dgrs_ncode = 119520 ; 9966static const int dgrs_ncode = 119520 ;
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c
index 430c628279b..6376b63d9b1 100644
--- a/drivers/net/dl2k.c
+++ b/drivers/net/dl2k.c
@@ -90,8 +90,8 @@ module_param(tx_coalesce, int, 0); /* HW xmit count each TxDMAComplete */
90#define EnableInt() \ 90#define EnableInt() \
91writew(DEFAULT_INTR, ioaddr + IntEnable) 91writew(DEFAULT_INTR, ioaddr + IntEnable)
92 92
93static int max_intrloop = 50; 93static const int max_intrloop = 50;
94static int multicast_filter_limit = 0x40; 94static const int multicast_filter_limit = 0x40;
95 95
96static int rio_open (struct net_device *dev); 96static int rio_open (struct net_device *dev);
97static void rio_timer (unsigned long data); 97static void rio_timer (unsigned long data);
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index 8c62ced2c9b..467fc861360 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -27,7 +27,7 @@
27 rx_align support: enables rx DMA without causing unaligned accesses. 27 rx_align support: enables rx DMA without causing unaligned accesses.
28*/ 28*/
29 29
30static const char *version = 30static const char * const version =
31"eepro100.c:v1.09j-t 9/29/99 Donald Becker http://www.scyld.com/network/eepro100.html\n" 31"eepro100.c:v1.09j-t 9/29/99 Donald Becker http://www.scyld.com/network/eepro100.html\n"
32"eepro100.c: $Revision: 1.36 $ 2000/11/17 Modified by Andrey V. Savochkin <saw@saw.sw.com.sg> and others\n"; 32"eepro100.c: $Revision: 1.36 $ 2000/11/17 Modified by Andrey V. Savochkin <saw@saw.sw.com.sg> and others\n";
33 33
@@ -469,7 +469,7 @@ static const char i82558_config_cmd[CONFIG_DATA_SIZE] = {
469 0x31, 0x05, }; 469 0x31, 0x05, };
470 470
471/* PHY media interface chips. */ 471/* PHY media interface chips. */
472static const char *phys[] = { 472static const char * const phys[] = {
473 "None", "i82553-A/B", "i82553-C", "i82503", 473 "None", "i82553-A/B", "i82553-C", "i82503",
474 "DP83840", "80c240", "80c24", "i82555", 474 "DP83840", "80c240", "80c24", "i82555",
475 "unknown-8", "unknown-9", "DP83840A", "unknown-11", 475 "unknown-8", "unknown-9", "DP83840A", "unknown-11",
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index f119ec4e89e..2f7b86837fe 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -225,7 +225,7 @@ struct epic_chip_info {
225 225
226 226
227/* indexed by chip_t */ 227/* indexed by chip_t */
228static struct epic_chip_info pci_id_tbl[] = { 228static const struct epic_chip_info pci_id_tbl[] = {
229 { "SMSC EPIC/100 83c170", 229 { "SMSC EPIC/100 83c170",
230 EPIC_IOTYPE, EPIC_TOTAL_SIZE, TYPE2_INTR | NO_MII | MII_PWRDWN }, 230 EPIC_IOTYPE, EPIC_TOTAL_SIZE, TYPE2_INTR | NO_MII | MII_PWRDWN },
231 { "SMSC EPIC/100 83c170", 231 { "SMSC EPIC/100 83c170",
@@ -291,7 +291,7 @@ enum CommandBits {
291 RxDone | RxStarted | RxEarlyWarn | RxOverflow | RxFull) 291 RxDone | RxStarted | RxEarlyWarn | RxOverflow | RxFull)
292#define EpicNormalEvent (0x0000ffff & ~EpicNapiEvent) 292#define EpicNormalEvent (0x0000ffff & ~EpicNapiEvent)
293 293
294static u16 media2miictl[16] = { 294static const u16 media2miictl[16] = {
295 0, 0x0C00, 0x0C00, 0x2000, 0x0100, 0x2100, 0, 0, 295 0, 0x0C00, 0x0C00, 0x2000, 0x0100, 0x2100, 0, 0,
296 0, 0, 0, 0, 0, 0, 0, 0 }; 296 0, 0, 0, 0, 0, 0, 0, 0 };
297 297
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c
index 55dbe9a3fd5..a8449265e5f 100644
--- a/drivers/net/fealnx.c
+++ b/drivers/net/fealnx.c
@@ -160,7 +160,7 @@ struct chip_info {
160 int flags; 160 int flags;
161}; 161};
162 162
163static struct chip_info skel_netdrv_tbl[] = { 163static const struct chip_info skel_netdrv_tbl[] = {
164 {"100/10M Ethernet PCI Adapter", 136, HAS_MII_XCVR}, 164 {"100/10M Ethernet PCI Adapter", 136, HAS_MII_XCVR},
165 {"100/10M Ethernet PCI Adapter", 136, HAS_CHIP_XCVR}, 165 {"100/10M Ethernet PCI Adapter", 136, HAS_CHIP_XCVR},
166 {"1000/100/10M Ethernet PCI Adapter", 136, HAS_MII_XCVR}, 166 {"1000/100/10M Ethernet PCI Adapter", 136, HAS_MII_XCVR},
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c
index bc9a3bf8d56..0ea4cb4a0d8 100644
--- a/drivers/net/hamachi.c
+++ b/drivers/net/hamachi.c
@@ -427,7 +427,7 @@ that case.
427static void hamachi_timer(unsigned long data); 427static void hamachi_timer(unsigned long data);
428 428
429enum capability_flags {CanHaveMII=1, }; 429enum capability_flags {CanHaveMII=1, };
430static struct chip_info { 430static const struct chip_info {
431 u16 vendor_id, device_id, device_id_mask, pad; 431 u16 vendor_id, device_id, device_id_mask, pad;
432 const char *name; 432 const char *name;
433 void (*media_timer)(unsigned long data); 433 void (*media_timer)(unsigned long data);
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 9d6d2548c2d..01920648fc3 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -189,7 +189,7 @@ static int mtu;
189 189
190/* Maximum number of multicast addresses to filter (vs. rx-all-multicast). 190/* Maximum number of multicast addresses to filter (vs. rx-all-multicast).
191 This chip uses a 512 element hash table based on the Ethernet CRC. */ 191 This chip uses a 512 element hash table based on the Ethernet CRC. */
192static int multicast_filter_limit = 100; 192static const int multicast_filter_limit = 100;
193 193
194/* Set the copy breakpoint for the copy-only-tiny-frames scheme. 194/* Set the copy breakpoint for the copy-only-tiny-frames scheme.
195 Setting to > 1518 effectively disables this feature. */ 195 Setting to > 1518 effectively disables this feature. */
@@ -374,7 +374,7 @@ enum pcistuff {
374 374
375 375
376/* array of board data directly indexed by pci_tbl[x].driver_data */ 376/* array of board data directly indexed by pci_tbl[x].driver_data */
377static struct { 377static const struct {
378 const char *name; 378 const char *name;
379 unsigned long flags; 379 unsigned long flags;
380} natsemi_pci_info[] __devinitdata = { 380} natsemi_pci_info[] __devinitdata = {
diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index d11821dd86e..e3ebb5803b0 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -117,7 +117,7 @@ enum ne2k_pci_chipsets {
117}; 117};
118 118
119 119
120static struct { 120static const struct {
121 char *name; 121 char *name;
122 int flags; 122 int flags;
123} pci_clone_list[] __devinitdata = { 123} pci_clone_list[] __devinitdata = {
diff --git a/drivers/net/ns83820.c b/drivers/net/ns83820.c
index 253cf018dfb..0fede50abd3 100644
--- a/drivers/net/ns83820.c
+++ b/drivers/net/ns83820.c
@@ -652,7 +652,7 @@ static void FASTCALL(phy_intr(struct net_device *ndev));
652static void fastcall phy_intr(struct net_device *ndev) 652static void fastcall phy_intr(struct net_device *ndev)
653{ 653{
654 struct ns83820 *dev = PRIV(ndev); 654 struct ns83820 *dev = PRIV(ndev);
655 static char *speeds[] = { "10", "100", "1000", "1000(?)", "1000F" }; 655 static const char *speeds[] = { "10", "100", "1000", "1000(?)", "1000F" };
656 u32 cfg, new_cfg; 656 u32 cfg, new_cfg;
657 u32 tbisr, tanar, tanlpar; 657 u32 tbisr, tanar, tanlpar;
658 int speed, fullduplex, newlinkstate; 658 int speed, fullduplex, newlinkstate;
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c
index 48774efeec7..ce90becb8bd 100644
--- a/drivers/net/pcmcia/3c574_cs.c
+++ b/drivers/net/pcmcia/3c574_cs.c
@@ -341,7 +341,7 @@ static void tc574_detach(struct pcmcia_device *p_dev)
341#define CS_CHECK(fn, ret) \ 341#define CS_CHECK(fn, ret) \
342 do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 342 do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
343 343
344static char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"}; 344static const char *ram_split[] = {"5:3", "3:1", "1:1", "3:5"};
345 345
346static void tc574_config(dev_link_t *link) 346static void tc574_config(dev_link_t *link)
347{ 347{
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c
index c4abc9365f8..3dba50849da 100644
--- a/drivers/net/pcmcia/3c589_cs.c
+++ b/drivers/net/pcmcia/3c589_cs.c
@@ -116,7 +116,7 @@ struct el3_private {
116 spinlock_t lock; 116 spinlock_t lock;
117}; 117};
118 118
119static char *if_names[] = { "auto", "10baseT", "10base2", "AUI" }; 119static const char *if_names[] = { "auto", "10baseT", "10base2", "AUI" };
120 120
121/*====================================================================*/ 121/*====================================================================*/
122 122
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 01ddfc8cce3..aa558136939 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -806,6 +806,7 @@ static struct pcmcia_device_id axnet_ids[] = {
806 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309), 806 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x0309),
807 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1106), 807 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1106),
808 PCMCIA_DEVICE_MANF_CARD(0x8a01, 0xc1ab), 808 PCMCIA_DEVICE_MANF_CARD(0x8a01, 0xc1ab),
809 PCMCIA_DEVICE_PROD_ID12("AmbiCom,Inc.", "Fast Ethernet PC Card(AMB8110)", 0x49b020a7, 0x119cc9fc),
809 PCMCIA_DEVICE_PROD_ID124("Fast Ethernet", "16-bit PC Card", "AX88190", 0xb4be14e3, 0x9a12eb6a, 0xab9be5ef), 810 PCMCIA_DEVICE_PROD_ID124("Fast Ethernet", "16-bit PC Card", "AX88190", 0xb4be14e3, 0x9a12eb6a, 0xab9be5ef),
810 PCMCIA_DEVICE_PROD_ID12("ASIX", "AX88190", 0x0959823b, 0xab9be5ef), 811 PCMCIA_DEVICE_PROD_ID12("ASIX", "AX88190", 0x0959823b, 0xab9be5ef),
811 PCMCIA_DEVICE_PROD_ID12("Billionton", "LNA-100B", 0x552ab682, 0xbc3b87e1), 812 PCMCIA_DEVICE_PROD_ID12("Billionton", "LNA-100B", 0x552ab682, 0xbc3b87e1),
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c
index 28fe2fb4d6c..b7ac14ba887 100644
--- a/drivers/net/pcmcia/fmvj18x_cs.c
+++ b/drivers/net/pcmcia/fmvj18x_cs.c
@@ -309,7 +309,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
309static int mfc_try_io_port(dev_link_t *link) 309static int mfc_try_io_port(dev_link_t *link)
310{ 310{
311 int i, ret; 311 int i, ret;
312 static kio_addr_t serial_base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 312 static const kio_addr_t serial_base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
313 313
314 for (i = 0; i < 5; i++) { 314 for (i = 0; i < 5; i++) {
315 link->io.BasePort2 = serial_base[i]; 315 link->io.BasePort2 = serial_base[i];
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c
index 4a232254a49..787176c57fd 100644
--- a/drivers/net/pcmcia/nmclan_cs.c
+++ b/drivers/net/pcmcia/nmclan_cs.c
@@ -388,7 +388,7 @@ static char *version =
388DRV_NAME " " DRV_VERSION " (Roger C. Pao)"; 388DRV_NAME " " DRV_VERSION " (Roger C. Pao)";
389#endif 389#endif
390 390
391static char *if_names[]={ 391static const char *if_names[]={
392 "Auto", "10baseT", "BNC", 392 "Auto", "10baseT", "BNC",
393}; 393};
394 394
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index 736dff5fa93..b46e5f703ef 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -66,7 +66,7 @@
66 66
67#define PCNET_RDC_TIMEOUT (2*HZ/100) /* Max wait in jiffies for Tx RDC */ 67#define PCNET_RDC_TIMEOUT (2*HZ/100) /* Max wait in jiffies for Tx RDC */
68 68
69static char *if_names[] = { "auto", "10baseT", "10base2"}; 69static const char *if_names[] = { "auto", "10baseT", "10base2"};
70 70
71#ifdef PCMCIA_DEBUG 71#ifdef PCMCIA_DEBUG
72static int pc_debug = PCMCIA_DEBUG; 72static int pc_debug = PCMCIA_DEBUG;
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c
index 0122415dfee..8839c4faafd 100644
--- a/drivers/net/pcmcia/smc91c92_cs.c
+++ b/drivers/net/pcmcia/smc91c92_cs.c
@@ -59,7 +59,7 @@
59 59
60/*====================================================================*/ 60/*====================================================================*/
61 61
62static char *if_names[] = { "auto", "10baseT", "10base2"}; 62static const char *if_names[] = { "auto", "10baseT", "10base2"};
63 63
64/* Module parameters */ 64/* Module parameters */
65 65
@@ -777,7 +777,7 @@ free_cfg_mem:
777static int osi_config(dev_link_t *link) 777static int osi_config(dev_link_t *link)
778{ 778{
779 struct net_device *dev = link->priv; 779 struct net_device *dev = link->priv;
780 static kio_addr_t com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 }; 780 static const kio_addr_t com[4] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8 };
781 int i, j; 781 int i, j;
782 782
783 link->conf.Attributes |= CONF_ENABLE_SPKR; 783 link->conf.Attributes |= CONF_ENABLE_SPKR;
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c
index 593d8adee89..eed496803fe 100644
--- a/drivers/net/pcmcia/xirc2ps_cs.c
+++ b/drivers/net/pcmcia/xirc2ps_cs.c
@@ -208,7 +208,7 @@ enum xirc_cmd { /* Commands */
208#define XIRCREG45_REV 15 /* Revision Register (rd) */ 208#define XIRCREG45_REV 15 /* Revision Register (rd) */
209#define XIRCREG50_IA 8 /* Individual Address (8-13) */ 209#define XIRCREG50_IA 8 /* Individual Address (8-13) */
210 210
211static char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" }; 211static const char *if_names[] = { "Auto", "10BaseT", "10Base2", "AUI", "100BaseT" };
212 212
213/**************** 213/****************
214 * All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If 214 * All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index 8f6cf8c896a..7e900572eaf 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -26,7 +26,7 @@
26#define DRV_RELDATE "01.Nov.2005" 26#define DRV_RELDATE "01.Nov.2005"
27#define PFX DRV_NAME ": " 27#define PFX DRV_NAME ": "
28 28
29static const char *version = 29static const char * const version =
30DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " tsbogend@alpha.franken.de\n"; 30DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " tsbogend@alpha.franken.de\n";
31 31
32#include <linux/module.h> 32#include <linux/module.h>
@@ -109,7 +109,7 @@ static int rx_copybreak = 200;
109 * table to translate option values from tulip 109 * table to translate option values from tulip
110 * to internal options 110 * to internal options
111 */ 111 */
112static unsigned char options_mapping[] = { 112static const unsigned char options_mapping[] = {
113 PCNET32_PORT_ASEL, /* 0 Auto-select */ 113 PCNET32_PORT_ASEL, /* 0 Auto-select */
114 PCNET32_PORT_AUI, /* 1 BNC/AUI */ 114 PCNET32_PORT_AUI, /* 1 BNC/AUI */
115 PCNET32_PORT_AUI, /* 2 AUI/BNC */ 115 PCNET32_PORT_AUI, /* 2 AUI/BNC */
@@ -733,7 +733,7 @@ static int pcnet32_loopback_test(struct net_device *dev, uint64_t *data1)
733 int rc; /* return code */ 733 int rc; /* return code */
734 int size; /* size of packets */ 734 int size; /* size of packets */
735 unsigned char *packet; /* source packet data */ 735 unsigned char *packet; /* source packet data */
736 static int data_len = 60; /* length of source packets */ 736 static const int data_len = 60; /* length of source packets */
737 unsigned long flags; 737 unsigned long flags;
738 unsigned long ticks; 738 unsigned long ticks;
739 739
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 1474b7c5ac0..33cec2dab94 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -132,7 +132,7 @@ struct phy_setting {
132}; 132};
133 133
134/* A mapping of all SUPPORTED settings to speed/duplex */ 134/* A mapping of all SUPPORTED settings to speed/duplex */
135static struct phy_setting settings[] = { 135static const struct phy_setting settings[] = {
136 { 136 {
137 .speed = 10000, 137 .speed = 10000,
138 .duplex = DUPLEX_FULL, 138 .duplex = DUPLEX_FULL,
diff --git a/drivers/net/plip.c b/drivers/net/plip.c
index 87ee3271b17..d4449d6d1fe 100644
--- a/drivers/net/plip.c
+++ b/drivers/net/plip.c
@@ -123,7 +123,7 @@ static const char version[] = "NET3 PLIP version 2.4-parport gniibe@mri.co.jp\n"
123#ifndef NET_DEBUG 123#ifndef NET_DEBUG
124#define NET_DEBUG 1 124#define NET_DEBUG 1
125#endif 125#endif
126static unsigned int net_debug = NET_DEBUG; 126static const unsigned int net_debug = NET_DEBUG;
127 127
128#define ENABLE(irq) if (irq != -1) enable_irq(irq) 128#define ENABLE(irq) if (irq != -1) enable_irq(irq)
129#define DISABLE(irq) if (irq != -1) disable_irq(irq) 129#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,
351typedef int (*plip_func)(struct net_device *dev, struct net_local *nl, 351typedef int (*plip_func)(struct net_device *dev, struct net_local *nl,
352 struct plip_local *snd, struct plip_local *rcv); 352 struct plip_local *snd, struct plip_local *rcv);
353 353
354static plip_func connection_state_table[] = 354static const plip_func connection_state_table[] =
355{ 355{
356 plip_none, 356 plip_none,
357 plip_receive_packet, 357 plip_receive_packet,
diff --git a/drivers/net/ppp_synctty.c b/drivers/net/ppp_synctty.c
index 33cb8254e79..33255fe8031 100644
--- a/drivers/net/ppp_synctty.c
+++ b/drivers/net/ppp_synctty.c
@@ -108,7 +108,7 @@ static void
108ppp_print_hex (register __u8 * out, const __u8 * in, int count) 108ppp_print_hex (register __u8 * out, const __u8 * in, int count)
109{ 109{
110 register __u8 next_ch; 110 register __u8 next_ch;
111 static char hex[] = "0123456789ABCDEF"; 111 static const char hex[] = "0123456789ABCDEF";
112 112
113 while (count-- > 0) { 113 while (count-- > 0) {
114 next_ch = *in++; 114 next_ch = *in++;
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 8cc0d0bbdf5..0ad3310290f 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -113,11 +113,11 @@ static int media[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 };
113static int num_media = 0; 113static int num_media = 0;
114 114
115/* Maximum events (Rx packets, etc.) to handle at each interrupt. */ 115/* Maximum events (Rx packets, etc.) to handle at each interrupt. */
116static int max_interrupt_work = 20; 116static const int max_interrupt_work = 20;
117 117
118/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast). 118/* Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
119 The RTL chips use a 64 element hash table based on the Ethernet CRC. */ 119 The RTL chips use a 64 element hash table based on the Ethernet CRC. */
120static int multicast_filter_limit = 32; 120static const int multicast_filter_limit = 32;
121 121
122/* MAC address length */ 122/* MAC address length */
123#define MAC_ADDR_LEN 6 123#define MAC_ADDR_LEN 6
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 0db218c2dbe..99ce70dfe9c 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -223,7 +223,7 @@ static void s2io_vlan_rx_kill_vid(struct net_device *dev, unsigned long vid)
223#define SWITCH_SIGN 0xA5A5A5A5A5A5A5A5ULL 223#define SWITCH_SIGN 0xA5A5A5A5A5A5A5A5ULL
224#define END_SIGN 0x0 224#define END_SIGN 0x0
225 225
226static u64 herc_act_dtx_cfg[] = { 226static const u64 herc_act_dtx_cfg[] = {
227 /* Set address */ 227 /* Set address */
228 0x8000051536750000ULL, 0x80000515367500E0ULL, 228 0x8000051536750000ULL, 0x80000515367500E0ULL,
229 /* Write data */ 229 /* Write data */
@@ -244,7 +244,7 @@ static u64 herc_act_dtx_cfg[] = {
244 END_SIGN 244 END_SIGN
245}; 245};
246 246
247static u64 xena_mdio_cfg[] = { 247static const u64 xena_mdio_cfg[] = {
248 /* Reset PMA PLL */ 248 /* Reset PMA PLL */
249 0xC001010000000000ULL, 0xC0010100000000E0ULL, 249 0xC001010000000000ULL, 0xC0010100000000E0ULL,
250 0xC0010100008000E4ULL, 250 0xC0010100008000E4ULL,
@@ -254,7 +254,7 @@ static u64 xena_mdio_cfg[] = {
254 END_SIGN 254 END_SIGN
255}; 255};
256 256
257static u64 xena_dtx_cfg[] = { 257static const u64 xena_dtx_cfg[] = {
258 0x8000051500000000ULL, 0x80000515000000E0ULL, 258 0x8000051500000000ULL, 0x80000515000000E0ULL,
259 0x80000515D93500E4ULL, 0x8001051500000000ULL, 259 0x80000515D93500E4ULL, 0x8001051500000000ULL,
260 0x80010515000000E0ULL, 0x80010515001E00E4ULL, 260 0x80010515000000E0ULL, 0x80010515001E00E4ULL,
@@ -282,7 +282,7 @@ static u64 xena_dtx_cfg[] = {
282 * Constants for Fixing the MacAddress problem seen mostly on 282 * Constants for Fixing the MacAddress problem seen mostly on
283 * Alpha machines. 283 * Alpha machines.
284 */ 284 */
285static u64 fix_mac[] = { 285static const u64 fix_mac[] = {
286 0x0060000000000000ULL, 0x0060600000000000ULL, 286 0x0060000000000000ULL, 0x0060600000000000ULL,
287 0x0040600000000000ULL, 0x0000600000000000ULL, 287 0x0040600000000000ULL, 0x0000600000000000ULL,
288 0x0020600000000000ULL, 0x0060600000000000ULL, 288 0x0020600000000000ULL, 0x0060600000000000ULL,
diff --git a/drivers/net/sb1000.c b/drivers/net/sb1000.c
index 76139478c3d..66cf226c4ee 100644
--- a/drivers/net/sb1000.c
+++ b/drivers/net/sb1000.c
@@ -59,7 +59,7 @@ static char version[] = "sb1000.c:v1.1.2 6/01/98 (fventuri@mediaone.net)\n";
59#ifdef SB1000_DEBUG 59#ifdef SB1000_DEBUG
60static int sb1000_debug = SB1000_DEBUG; 60static int sb1000_debug = SB1000_DEBUG;
61#else 61#else
62static int sb1000_debug = 1; 62static const int sb1000_debug = 1;
63#endif 63#endif
64 64
65static const int SB1000_IO_EXTENT = 8; 65static const int SB1000_IO_EXTENT = 8;
diff --git a/drivers/net/sis190.c b/drivers/net/sis190.c
index ed4bc91638d..31dd3f036fa 100644
--- a/drivers/net/sis190.c
+++ b/drivers/net/sis190.c
@@ -366,7 +366,7 @@ static const u32 sis190_intr_mask =
366 * Maximum number of multicast addresses to filter (vs. Rx-all-multicast). 366 * Maximum number of multicast addresses to filter (vs. Rx-all-multicast).
367 * The chips use a 64 element hash table based on the Ethernet CRC. 367 * The chips use a 64 element hash table based on the Ethernet CRC.
368 */ 368 */
369static int multicast_filter_limit = 32; 369static const int multicast_filter_limit = 32;
370 370
371static void __mdio_cmd(void __iomem *ioaddr, u32 ctl) 371static void __mdio_cmd(void __iomem *ioaddr, u32 ctl)
372{ 372{
diff --git a/drivers/net/sis900.c b/drivers/net/sis900.c
index 7a952fe60be..a1cb07cdb60 100644
--- a/drivers/net/sis900.c
+++ b/drivers/net/sis900.c
@@ -100,7 +100,7 @@ enum {
100 SIS_900 = 0, 100 SIS_900 = 0,
101 SIS_7016 101 SIS_7016
102}; 102};
103static char * card_names[] = { 103static const char * card_names[] = {
104 "SiS 900 PCI Fast Ethernet", 104 "SiS 900 PCI Fast Ethernet",
105 "SiS 7016 PCI Fast Ethernet" 105 "SiS 7016 PCI Fast Ethernet"
106}; 106};
@@ -115,7 +115,7 @@ MODULE_DEVICE_TABLE (pci, sis900_pci_tbl);
115 115
116static void sis900_read_mode(struct net_device *net_dev, int *speed, int *duplex); 116static void sis900_read_mode(struct net_device *net_dev, int *speed, int *duplex);
117 117
118static struct mii_chip_info { 118static const struct mii_chip_info {
119 const char * name; 119 const char * name;
120 u16 phy_id0; 120 u16 phy_id0;
121 u16 phy_id1; 121 u16 phy_id1;
@@ -400,7 +400,7 @@ static int __devinit sis900_probe(struct pci_dev *pci_dev,
400 void *ring_space; 400 void *ring_space;
401 long ioaddr; 401 long ioaddr;
402 int i, ret; 402 int i, ret;
403 char *card_name = card_names[pci_id->driver_data]; 403 const char *card_name = card_names[pci_id->driver_data];
404 const char *dev_name = pci_name(pci_dev); 404 const char *dev_name = pci_name(pci_dev);
405 405
406/* when built into the kernel, we only print version if device is found */ 406/* when built into the kernel, we only print version if device is found */
@@ -1275,7 +1275,7 @@ static void sis900_timer(unsigned long data)
1275 struct net_device *net_dev = (struct net_device *)data; 1275 struct net_device *net_dev = (struct net_device *)data;
1276 struct sis900_private *sis_priv = net_dev->priv; 1276 struct sis900_private *sis_priv = net_dev->priv;
1277 struct mii_phy *mii_phy = sis_priv->mii; 1277 struct mii_phy *mii_phy = sis_priv->mii;
1278 static int next_tick = 5*HZ; 1278 static const int next_tick = 5*HZ;
1279 u16 status; 1279 u16 status;
1280 1280
1281 if (!sis_priv->autong_complete){ 1281 if (!sis_priv->autong_complete){
diff --git a/drivers/net/skfp/fplustm.c b/drivers/net/skfp/fplustm.c
index a2ed47f1cc7..a4b2b6975d6 100644
--- a/drivers/net/skfp/fplustm.c
+++ b/drivers/net/skfp/fplustm.c
@@ -89,21 +89,21 @@ static const u_short my_sagp = 0xffff ; /* short group address (n.u.) */
89/* 89/*
90 * useful interrupt bits 90 * useful interrupt bits
91 */ 91 */
92static int mac_imsk1u = FM_STXABRS | FM_STXABRA0 | FM_SXMTABT ; 92static const int mac_imsk1u = FM_STXABRS | FM_STXABRA0 | FM_SXMTABT ;
93static int mac_imsk1l = FM_SQLCKS | FM_SQLCKA0 | FM_SPCEPDS | FM_SPCEPDA0| 93static const int mac_imsk1l = FM_SQLCKS | FM_SQLCKA0 | FM_SPCEPDS | FM_SPCEPDA0|
94 FM_STBURS | FM_STBURA0 ; 94 FM_STBURS | FM_STBURA0 ;
95 95
96 /* delete FM_SRBFL after tests */ 96 /* delete FM_SRBFL after tests */
97static int mac_imsk2u = FM_SERRSF | FM_SNFSLD | FM_SRCVOVR | FM_SRBFL | 97static const int mac_imsk2u = FM_SERRSF | FM_SNFSLD | FM_SRCVOVR | FM_SRBFL |
98 FM_SMYCLM ; 98 FM_SMYCLM ;
99static int mac_imsk2l = FM_STRTEXR | FM_SDUPCLM | FM_SFRMCTR | 99static const int mac_imsk2l = FM_STRTEXR | FM_SDUPCLM | FM_SFRMCTR |
100 FM_SERRCTR | FM_SLSTCTR | 100 FM_SERRCTR | FM_SLSTCTR |
101 FM_STRTEXP | FM_SMULTDA | FM_SRNGOP ; 101 FM_STRTEXP | FM_SMULTDA | FM_SRNGOP ;
102 102
103static int mac_imsk3u = FM_SRCVOVR2 | FM_SRBFL2 ; 103static const int mac_imsk3u = FM_SRCVOVR2 | FM_SRBFL2 ;
104static int mac_imsk3l = FM_SRPERRQ2 | FM_SRPERRQ1 ; 104static const int mac_imsk3l = FM_SRPERRQ2 | FM_SRPERRQ1 ;
105 105
106static int mac_beacon_imsk2u = FM_SOTRBEC | FM_SMYBEC | FM_SBEC | 106static const int mac_beacon_imsk2u = FM_SOTRBEC | FM_SMYBEC | FM_SBEC |
107 FM_SLOCLM | FM_SHICLM | FM_SMYCLM | FM_SCLM ; 107 FM_SLOCLM | FM_SHICLM | FM_SMYCLM | FM_SCLM ;
108 108
109 109
diff --git a/drivers/net/skfp/pcmplc.c b/drivers/net/skfp/pcmplc.c
index cd0aa4c151b..74e129f3ce9 100644
--- a/drivers/net/skfp/pcmplc.c
+++ b/drivers/net/skfp/pcmplc.c
@@ -186,7 +186,7 @@ static const struct plt {
186 * Do we need the EBUF error during signaling, too, to detect SUPERNET_3 186 * Do we need the EBUF error during signaling, too, to detect SUPERNET_3
187 * PLL bug? 187 * PLL bug?
188 */ 188 */
189static int plc_imsk_na = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK | 189static const int plc_imsk_na = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK |
190 PL_PCM_ENABLED | PL_SELF_TEST | PL_EBUF_ERR; 190 PL_PCM_ENABLED | PL_SELF_TEST | PL_EBUF_ERR;
191#else /* SUPERNET_3 */ 191#else /* SUPERNET_3 */
192/* 192/*
@@ -195,7 +195,7 @@ static int plc_imsk_na = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK |
195static int plc_imsk_na = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK | 195static int plc_imsk_na = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK |
196 PL_PCM_ENABLED | PL_SELF_TEST ; 196 PL_PCM_ENABLED | PL_SELF_TEST ;
197#endif /* SUPERNET_3 */ 197#endif /* SUPERNET_3 */
198static int plc_imsk_act = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK | 198static const int plc_imsk_act = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK |
199 PL_PCM_ENABLED | PL_SELF_TEST | PL_EBUF_ERR; 199 PL_PCM_ENABLED | PL_SELF_TEST | PL_EBUF_ERR;
200 200
201/* external functions */ 201/* external functions */
diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c
index 4b5ed2c6317..c7fb6133047 100644
--- a/drivers/net/skfp/skfddi.c
+++ b/drivers/net/skfp/skfddi.c
@@ -67,7 +67,7 @@
67/* each new release!!! */ 67/* each new release!!! */
68#define VERSION "2.07" 68#define VERSION "2.07"
69 69
70static const char *boot_msg = 70static const char * const boot_msg =
71 "SysKonnect FDDI PCI Adapter driver v" VERSION " for\n" 71 "SysKonnect FDDI PCI Adapter driver v" VERSION " for\n"
72 " SK-55xx/SK-58xx adapters (SK-NET FDDI-FP/UP/LP)"; 72 " SK-55xx/SK-58xx adapters (SK-NET FDDI-FP/UP/LP)";
73 73
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index ed5458c4544..35b18057fbd 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -201,7 +201,7 @@ static int max_interrupt_work = 20;
201static int mtu; 201static int mtu;
202/* Maximum number of multicast addresses to filter (vs. rx-all-multicast). 202/* Maximum number of multicast addresses to filter (vs. rx-all-multicast).
203 The Starfire has a 512 element hash table based on the Ethernet CRC. */ 203 The Starfire has a 512 element hash table based on the Ethernet CRC. */
204static int multicast_filter_limit = 512; 204static const int multicast_filter_limit = 512;
205/* Whether to do TCP/UDP checksums in hardware */ 205/* Whether to do TCP/UDP checksums in hardware */
206static int enable_hw_cksum = 1; 206static int enable_hw_cksum = 1;
207 207
@@ -463,7 +463,7 @@ static struct pci_device_id starfire_pci_tbl[] = {
463MODULE_DEVICE_TABLE(pci, starfire_pci_tbl); 463MODULE_DEVICE_TABLE(pci, starfire_pci_tbl);
464 464
465/* A chip capabilities table, matching the CH_xxx entries in xxx_pci_tbl[] above. */ 465/* A chip capabilities table, matching the CH_xxx entries in xxx_pci_tbl[] above. */
466static struct chip_info { 466static const struct chip_info {
467 const char *name; 467 const char *name;
468 int drv_flags; 468 int drv_flags;
469} netdrv_tbl[] __devinitdata = { 469} netdrv_tbl[] __devinitdata = {
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c
index 8cdeb5cbab5..61eec46cb11 100644
--- a/drivers/net/sundance.c
+++ b/drivers/net/sundance.c
@@ -106,7 +106,7 @@
106static int debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */ 106static int debug = 1; /* 1 normal messages, 0 quiet .. 7 verbose. */
107/* Maximum number of multicast addresses to filter (vs. rx-all-multicast). 107/* Maximum number of multicast addresses to filter (vs. rx-all-multicast).
108 Typical is a 64 element hash table based on the Ethernet CRC. */ 108 Typical is a 64 element hash table based on the Ethernet CRC. */
109static int multicast_filter_limit = 32; 109static const int multicast_filter_limit = 32;
110 110
111/* Set the copy breakpoint for the copy-only-tiny-frames scheme. 111/* Set the copy breakpoint for the copy-only-tiny-frames scheme.
112 Setting to > 1518 effectively disables this feature. 112 Setting to > 1518 effectively disables this feature.
@@ -298,7 +298,7 @@ enum {
298struct pci_id_info { 298struct pci_id_info {
299 const char *name; 299 const char *name;
300}; 300};
301static struct pci_id_info pci_id_tbl[] = { 301static const struct pci_id_info pci_id_tbl[] = {
302 {"D-Link DFE-550TX FAST Ethernet Adapter"}, 302 {"D-Link DFE-550TX FAST Ethernet Adapter"},
303 {"D-Link DFE-550FX 100Mbps Fiber-optics Adapter"}, 303 {"D-Link DFE-550FX 100Mbps Fiber-optics Adapter"},
304 {"D-Link DFE-580TX 4 port Server Adapter"}, 304 {"D-Link DFE-580TX 4 port Server Adapter"},
diff --git a/drivers/net/sungem_phy.c b/drivers/net/sungem_phy.c
index d3ddb41d6e5..cb0aba95d4e 100644
--- a/drivers/net/sungem_phy.c
+++ b/drivers/net/sungem_phy.c
@@ -39,7 +39,7 @@
39#include "sungem_phy.h" 39#include "sungem_phy.h"
40 40
41/* Link modes of the BCM5400 PHY */ 41/* Link modes of the BCM5400 PHY */
42static int phy_BCM5400_link_table[8][3] = { 42static const int phy_BCM5400_link_table[8][3] = {
43 { 0, 0, 0 }, /* No link */ 43 { 0, 0, 0 }, /* No link */
44 { 0, 0, 0 }, /* 10BT Half Duplex */ 44 { 0, 0, 0 }, /* 10BT Half Duplex */
45 { 1, 0, 0 }, /* 10BT Full Duplex */ 45 { 1, 0, 0 }, /* 10BT Full Duplex */
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index e8e92c853e8..83ff5994a8d 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -7785,7 +7785,7 @@ static int tg3_test_link(struct tg3 *tp)
7785} 7785}
7786 7786
7787/* Only test the commonly used registers */ 7787/* Only test the commonly used registers */
7788static int tg3_test_registers(struct tg3 *tp) 7788static const int tg3_test_registers(struct tg3 *tp)
7789{ 7789{
7790 int i, is_5705; 7790 int i, is_5705;
7791 u32 offset, read_mask, write_mask, val, save_val, read_val; 7791 u32 offset, read_mask, write_mask, val, save_val, read_val;
@@ -7999,7 +7999,7 @@ out:
7999 7999
8000static int tg3_do_mem_test(struct tg3 *tp, u32 offset, u32 len) 8000static int tg3_do_mem_test(struct tg3 *tp, u32 offset, u32 len)
8001{ 8001{
8002 static u32 test_pattern[] = { 0x00000000, 0xffffffff, 0xaa55a55a }; 8002 static const u32 test_pattern[] = { 0x00000000, 0xffffffff, 0xaa55a55a };
8003 int i; 8003 int i;
8004 u32 j; 8004 u32 j;
8005 8005
diff --git a/drivers/net/typhoon.c b/drivers/net/typhoon.c
index 4c76cb794bf..cde35dd8790 100644
--- a/drivers/net/typhoon.c
+++ b/drivers/net/typhoon.c
@@ -178,7 +178,7 @@ enum typhoon_cards {
178}; 178};
179 179
180/* directly indexed by enum typhoon_cards, above */ 180/* directly indexed by enum typhoon_cards, above */
181static struct typhoon_card_info typhoon_card_info[] __devinitdata = { 181static const struct typhoon_card_info typhoon_card_info[] __devinitdata = {
182 { "3Com Typhoon (3C990-TX)", 182 { "3Com Typhoon (3C990-TX)",
183 TYPHOON_CRYPTO_NONE}, 183 TYPHOON_CRYPTO_NONE},
184 { "3Com Typhoon (3CR990-TX-95)", 184 { "3Com Typhoon (3CR990-TX-95)",
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 8bc0b528548..f8f4503475f 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -877,7 +877,6 @@ static struct pcmcia_device_id hostap_cs_ids[] = {
877 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777), 877 PCMCIA_DEVICE_MANF_CARD(0x0101, 0x0777),
878 PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000), 878 PCMCIA_DEVICE_MANF_CARD(0x0126, 0x8000),
879 PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002), 879 PCMCIA_DEVICE_MANF_CARD(0x0138, 0x0002),
880 PCMCIA_DEVICE_MANF_CARD(0x0156, 0x0002),
881 PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002), 880 PCMCIA_DEVICE_MANF_CARD(0x0250, 0x0002),
882 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030b), 881 PCMCIA_DEVICE_MANF_CARD(0x026f, 0x030b),
883 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612), 882 PCMCIA_DEVICE_MANF_CARD(0x0274, 0x1612),
@@ -891,6 +890,10 @@ static struct pcmcia_device_id hostap_cs_ids[] = {
891 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002), 890 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0002),
892 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005), 891 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0005),
893 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010), 892 PCMCIA_DEVICE_MANF_CARD(0xd601, 0x0010),
893 PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "INTERSIL",
894 0x74c5e40d),
895 PCMCIA_DEVICE_MANF_CARD_PROD_ID1(0x0156, 0x0002, "Intersil",
896 0x4b801a17),
894 PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus", 897 PCMCIA_MFC_DEVICE_PROD_ID12(0, "SanDisk", "ConnectPlus",
895 0x7a954bd9, 0x74be00c6), 898 0x7a954bd9, 0x74be00c6),
896 PCMCIA_DEVICE_PROD_ID1234( 899 PCMCIA_DEVICE_PROD_ID1234(
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c
index 1c2506535f7..75d56bfef0e 100644
--- a/drivers/net/yellowfin.c
+++ b/drivers/net/yellowfin.c
@@ -69,8 +69,8 @@ static int fifo_cfg = 0x0020; /* Bypass external Tx FIFO. */
69static int dma_ctrl = 0x00CAC277; /* Override when loading module! */ 69static int dma_ctrl = 0x00CAC277; /* Override when loading module! */
70static int fifo_cfg = 0x0028; 70static int fifo_cfg = 0x0028;
71#else 71#else
72static int dma_ctrl = 0x004A0263; /* Constrained by errata */ 72static const int dma_ctrl = 0x004A0263; /* Constrained by errata */
73static int fifo_cfg = 0x0020; /* Bypass external Tx FIFO. */ 73static const int fifo_cfg = 0x0020; /* Bypass external Tx FIFO. */
74#endif 74#endif
75 75
76/* Set the copy breakpoint for the copy-only-tiny-frames scheme. 76/* Set the copy breakpoint for the copy-only-tiny-frames scheme.
@@ -266,7 +266,7 @@ struct pci_id_info {
266 int drv_flags; /* Driver use, intended as capability flags. */ 266 int drv_flags; /* Driver use, intended as capability flags. */
267}; 267};
268 268
269static struct pci_id_info pci_id_tbl[] = { 269static const struct pci_id_info pci_id_tbl[] = {
270 {"Yellowfin G-NIC Gigabit Ethernet", { 0x07021000, 0xffffffff}, 270 {"Yellowfin G-NIC Gigabit Ethernet", { 0x07021000, 0xffffffff},
271 PCI_IOTYPE, YELLOWFIN_SIZE, 271 PCI_IOTYPE, YELLOWFIN_SIZE,
272 FullTxStatus | IsGigabit | HasMulticastBug | HasMACAddrBug | DontUseEeprom}, 272 FullTxStatus | IsGigabit | HasMulticastBug | HasMACAddrBug | DontUseEeprom},
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 0a424a4e818..54ad93daca3 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -352,11 +352,20 @@ static void pcmcia_release_dev(struct device *dev)
352 kfree(p_dev); 352 kfree(p_dev);
353} 353}
354 354
355static void pcmcia_add_pseudo_device(struct pcmcia_socket *s)
356{
357 if (!s->pcmcia_state.device_add_pending) {
358 s->pcmcia_state.device_add_pending = 1;
359 schedule_work(&s->device_add);
360 }
361 return;
362}
355 363
356static int pcmcia_device_probe(struct device * dev) 364static int pcmcia_device_probe(struct device * dev)
357{ 365{
358 struct pcmcia_device *p_dev; 366 struct pcmcia_device *p_dev;
359 struct pcmcia_driver *p_drv; 367 struct pcmcia_driver *p_drv;
368 struct pcmcia_device_id *did;
360 struct pcmcia_socket *s; 369 struct pcmcia_socket *s;
361 int ret = 0; 370 int ret = 0;
362 371
@@ -392,6 +401,19 @@ static int pcmcia_device_probe(struct device * dev)
392 } 401 }
393 402
394 ret = p_drv->probe(p_dev); 403 ret = p_drv->probe(p_dev);
404 if (ret)
405 goto put_module;
406
407 /* handle pseudo multifunction devices:
408 * there are at most two pseudo multifunction devices.
409 * if we're matching against the first, schedule a
410 * call which will then check whether there are two
411 * pseudo devices, and if not, add the second one.
412 */
413 did = (struct pcmcia_device_id *) p_dev->dev.driver_data;
414 if ((did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) &&
415 (p_dev->socket->device_count == 1) && (p_dev->device_no == 0))
416 pcmcia_add_pseudo_device(p_dev->socket);
395 417
396 put_module: 418 put_module:
397 if (ret) 419 if (ret)
@@ -660,15 +682,6 @@ static void pcmcia_delayed_add_pseudo_device(void *data)
660 s->pcmcia_state.device_add_pending = 0; 682 s->pcmcia_state.device_add_pending = 0;
661} 683}
662 684
663static inline void pcmcia_add_pseudo_device(struct pcmcia_socket *s)
664{
665 if (!s->pcmcia_state.device_add_pending) {
666 s->pcmcia_state.device_add_pending = 1;
667 schedule_work(&s->device_add);
668 }
669 return;
670}
671
672static int pcmcia_requery(struct device *dev, void * _data) 685static int pcmcia_requery(struct device *dev, void * _data)
673{ 686{
674 struct pcmcia_device *p_dev = to_pcmcia_dev(dev); 687 struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
@@ -755,15 +768,6 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev,
755 } 768 }
756 769
757 if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) { 770 if (did->match_flags & PCMCIA_DEV_ID_MATCH_DEVICE_NO) {
758 /* handle pseudo multifunction devices:
759 * there are at most two pseudo multifunction devices.
760 * if we're matching against the first, schedule a
761 * call which will then check whether there are two
762 * pseudo devices, and if not, add the second one.
763 */
764 if (dev->device_no == 0)
765 pcmcia_add_pseudo_device(dev->socket);
766
767 if (dev->device_no != did->device_no) 771 if (dev->device_no != did->device_no)
768 return 0; 772 return 0;
769 } 773 }
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c
index cb2ee25f213..531a1f9ceb5 100644
--- a/drivers/scsi/aha152x.c
+++ b/drivers/scsi/aha152x.c
@@ -1260,16 +1260,15 @@ static void free_hard_reset_SCs(struct Scsi_Host *shpnt, Scsi_Cmnd **SCs)
1260 * Reset the bus 1260 * Reset the bus
1261 * 1261 *
1262 */ 1262 */
1263static int aha152x_bus_reset(Scsi_Cmnd *SCpnt) 1263static int aha152x_bus_reset_host(struct Scsi_Host *shpnt)
1264{ 1264{
1265 struct Scsi_Host *shpnt = SCpnt->device->host;
1266 unsigned long flags; 1265 unsigned long flags;
1267 1266
1268 DO_LOCK(flags); 1267 DO_LOCK(flags);
1269 1268
1270#if defined(AHA152X_DEBUG) 1269#if defined(AHA152X_DEBUG)
1271 if(HOSTDATA(shpnt)->debug & debug_eh) { 1270 if(HOSTDATA(shpnt)->debug & debug_eh) {
1272 printk(DEBUG_LEAD "aha152x_bus_reset(%p)", CMDINFO(SCpnt), SCpnt); 1271 printk(KERN_DEBUG "scsi%d: bus reset", shpnt->host_no);
1273 show_queues(shpnt); 1272 show_queues(shpnt);
1274 } 1273 }
1275#endif 1274#endif
@@ -1277,14 +1276,14 @@ static int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
1277 free_hard_reset_SCs(shpnt, &ISSUE_SC); 1276 free_hard_reset_SCs(shpnt, &ISSUE_SC);
1278 free_hard_reset_SCs(shpnt, &DISCONNECTED_SC); 1277 free_hard_reset_SCs(shpnt, &DISCONNECTED_SC);
1279 1278
1280 DPRINTK(debug_eh, DEBUG_LEAD "resetting bus\n", CMDINFO(SCpnt)); 1279 DPRINTK(debug_eh, KERN_DEBUG "scsi%d: resetting bus\n", shpnt->host_no);
1281 1280
1282 SETPORT(SCSISEQ, SCSIRSTO); 1281 SETPORT(SCSISEQ, SCSIRSTO);
1283 mdelay(256); 1282 mdelay(256);
1284 SETPORT(SCSISEQ, 0); 1283 SETPORT(SCSISEQ, 0);
1285 mdelay(DELAY); 1284 mdelay(DELAY);
1286 1285
1287 DPRINTK(debug_eh, DEBUG_LEAD "bus resetted\n", CMDINFO(SCpnt)); 1286 DPRINTK(debug_eh, KERN_DEBUG "scsi%d: bus resetted\n", shpnt->host_no);
1288 1287
1289 setup_expected_interrupts(shpnt); 1288 setup_expected_interrupts(shpnt);
1290 if(HOSTDATA(shpnt)->commands==0) 1289 if(HOSTDATA(shpnt)->commands==0)
@@ -1295,6 +1294,14 @@ static int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
1295 return SUCCESS; 1294 return SUCCESS;
1296} 1295}
1297 1296
1297/*
1298 * Reset the bus
1299 *
1300 */
1301static int aha152x_bus_reset(Scsi_Cmnd *SCpnt)
1302{
1303 return aha152x_bus_reset_host(SCpnt->device->host);
1304}
1298 1305
1299/* 1306/*
1300 * Restore default values to the AIC-6260 registers and reset the fifos 1307 * Restore default values to the AIC-6260 registers and reset the fifos
@@ -1337,23 +1344,28 @@ static void reset_ports(struct Scsi_Host *shpnt)
1337 * Reset the host (bus and controller) 1344 * Reset the host (bus and controller)
1338 * 1345 *
1339 */ 1346 */
1340int aha152x_host_reset(Scsi_Cmnd * SCpnt) 1347int aha152x_host_reset_host(struct Scsi_Host *shpnt)
1341{ 1348{
1342#if defined(AHA152X_DEBUG) 1349 DPRINTK(debug_eh, KERN_DEBUG "scsi%d: host reset\n", shpnt->host_no);
1343 struct Scsi_Host *shpnt = SCpnt->device->host;
1344#endif
1345
1346 DPRINTK(debug_eh, DEBUG_LEAD "aha152x_host_reset(%p)\n", CMDINFO(SCpnt), SCpnt);
1347 1350
1348 aha152x_bus_reset(SCpnt); 1351 aha152x_bus_reset_host(shpnt);
1349 1352
1350 DPRINTK(debug_eh, DEBUG_LEAD "resetting ports\n", CMDINFO(SCpnt)); 1353 DPRINTK(debug_eh, KERN_DEBUG "scsi%d: resetting ports\n", shpnt->host_no);
1351 reset_ports(SCpnt->device->host); 1354 reset_ports(shpnt);
1352 1355
1353 return SUCCESS; 1356 return SUCCESS;
1354} 1357}
1355 1358
1356/* 1359/*
1360 * Reset the host (bus and controller)
1361 *
1362 */
1363static int aha152x_host_reset(Scsi_Cmnd *SCpnt)
1364{
1365 return aha152x_host_reset_host(SCpnt->device->host);
1366}
1367
1368/*
1357 * Return the "logical geometry" 1369 * Return the "logical geometry"
1358 * 1370 *
1359 */ 1371 */
@@ -1431,22 +1443,18 @@ static void run(void)
1431{ 1443{
1432 int i; 1444 int i;
1433 for (i = 0; i<ARRAY_SIZE(aha152x_host); i++) { 1445 for (i = 0; i<ARRAY_SIZE(aha152x_host); i++) {
1434 struct Scsi_Host *shpnt = aha152x_host[i]; 1446 is_complete(aha152x_host[i]);
1435 if (shpnt && HOSTDATA(shpnt)->service) {
1436 HOSTDATA(shpnt)->service=0;
1437 is_complete(shpnt);
1438 }
1439 } 1447 }
1440} 1448}
1441 1449
1442/* 1450/*
1443 * Interrupts handler 1451 * Interrupt handler
1444 * 1452 *
1445 */ 1453 */
1446
1447static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs) 1454static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs)
1448{ 1455{
1449 struct Scsi_Host *shpnt = lookup_irq(irqno); 1456 struct Scsi_Host *shpnt = lookup_irq(irqno);
1457 unsigned long flags;
1450 unsigned char rev, dmacntrl0; 1458 unsigned char rev, dmacntrl0;
1451 1459
1452 if (!shpnt) { 1460 if (!shpnt) {
@@ -1472,23 +1480,23 @@ static irqreturn_t intr(int irqno, void *dev_id, struct pt_regs *regs)
1472 if ((rev == 0xFF) && (dmacntrl0 == 0xFF)) 1480 if ((rev == 0xFF) && (dmacntrl0 == 0xFF))
1473 return IRQ_NONE; 1481 return IRQ_NONE;
1474 1482
1483 if( TESTLO(DMASTAT, INTSTAT) )
1484 return IRQ_NONE;
1485
1475 /* no more interrupts from the controller, while we're busy. 1486 /* no more interrupts from the controller, while we're busy.
1476 INTEN is restored by the BH handler */ 1487 INTEN is restored by the BH handler */
1477 CLRBITS(DMACNTRL0, INTEN); 1488 CLRBITS(DMACNTRL0, INTEN);
1478 1489
1479#if 0 1490 DO_LOCK(flags);
1480 /* check if there is already something to be 1491 if( HOSTDATA(shpnt)->service==0 ) {
1481 serviced; should not happen */ 1492 HOSTDATA(shpnt)->service=1;
1482 if(HOSTDATA(shpnt)->service) { 1493
1483 printk(KERN_ERR "aha152x%d: lost interrupt (%d)\n", HOSTNO, HOSTDATA(shpnt)->service); 1494 /* Poke the BH handler */
1484 show_queues(shpnt); 1495 INIT_WORK(&aha152x_tq, (void *) run, NULL);
1496 schedule_work(&aha152x_tq);
1485 } 1497 }
1486#endif 1498 DO_UNLOCK(flags);
1487 1499
1488 /* Poke the BH handler */
1489 HOSTDATA(shpnt)->service++;
1490 INIT_WORK(&aha152x_tq, (void *) run, NULL);
1491 schedule_work(&aha152x_tq);
1492 return IRQ_HANDLED; 1500 return IRQ_HANDLED;
1493} 1501}
1494 1502
@@ -2527,7 +2535,18 @@ static void is_complete(struct Scsi_Host *shpnt)
2527 unsigned long flags; 2535 unsigned long flags;
2528 int pending; 2536 int pending;
2529 2537
2538 if(!shpnt)
2539 return;
2540
2530 DO_LOCK(flags); 2541 DO_LOCK(flags);
2542
2543 if( HOSTDATA(shpnt)->service==0 ) {
2544 DO_UNLOCK(flags);
2545 return;
2546 }
2547
2548 HOSTDATA(shpnt)->service = 0;
2549
2531 if(HOSTDATA(shpnt)->in_intr) { 2550 if(HOSTDATA(shpnt)->in_intr) {
2532 DO_UNLOCK(flags); 2551 DO_UNLOCK(flags);
2533 /* aha152x_error never returns.. */ 2552 /* aha152x_error never returns.. */
diff --git a/drivers/scsi/aha152x.h b/drivers/scsi/aha152x.h
index d277613af29..d2add24d02a 100644
--- a/drivers/scsi/aha152x.h
+++ b/drivers/scsi/aha152x.h
@@ -332,6 +332,6 @@ struct aha152x_setup {
332 332
333struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *); 333struct Scsi_Host *aha152x_probe_one(struct aha152x_setup *);
334void aha152x_release(struct Scsi_Host *); 334void aha152x_release(struct Scsi_Host *);
335int aha152x_host_reset(Scsi_Cmnd *); 335int aha152x_host_reset_host(struct Scsi_Host *);
336 336
337#endif /* _AHA152X_H */ 337#endif /* _AHA152X_H */
diff --git a/drivers/scsi/jazz_esp.c b/drivers/scsi/jazz_esp.c
index 23728d1c980..fcd304e11c2 100644
--- a/drivers/scsi/jazz_esp.c
+++ b/drivers/scsi/jazz_esp.c
@@ -65,27 +65,6 @@ static int jazz_esp_release(struct Scsi_Host *shost)
65 return 0; 65 return 0;
66} 66}
67 67
68static struct scsi_host_template driver_template = {
69 .proc_name = "jazz_esp",
70 .proc_info = &esp_proc_info,
71 .name = "ESP 100/100a/200",
72 .detect = jazz_esp_detect,
73 .slave_alloc = esp_slave_alloc,
74 .slave_destroy = esp_slave_destroy,
75 .release = jazz_esp_release,
76 .info = esp_info,
77 .queuecommand = esp_queue,
78 .eh_abort_handler = esp_abort,
79 .eh_bus_reset_handler = esp_reset,
80 .can_queue = 7,
81 .this_id = 7,
82 .sg_tablesize = SG_ALL,
83 .cmd_per_lun = 1,
84 .use_clustering = DISABLE_CLUSTERING,
85};
86
87#include "scsi_module.c"
88
89/***************************************************************** Detection */ 68/***************************************************************** Detection */
90static int jazz_esp_detect(struct scsi_host_template *tpnt) 69static int jazz_esp_detect(struct scsi_host_template *tpnt)
91{ 70{
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index 7de267e1445..4f39dd01936 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -793,6 +793,20 @@ megasas_queue_command(struct scsi_cmnd *scmd, void (*done) (struct scsi_cmnd *))
793 return 0; 793 return 0;
794} 794}
795 795
796static int megasas_slave_configure(struct scsi_device *sdev)
797{
798 /*
799 * Don't export physical disk devices to the disk driver.
800 *
801 * FIXME: Currently we don't export them to the midlayer at all.
802 * That will be fixed once LSI engineers have audited the
803 * firmware for possible issues.
804 */
805 if (sdev->channel < MEGASAS_MAX_PD_CHANNELS && sdev->type == TYPE_DISK)
806 return -ENXIO;
807 return 0;
808}
809
796/** 810/**
797 * megasas_wait_for_outstanding - Wait for all outstanding cmds 811 * megasas_wait_for_outstanding - Wait for all outstanding cmds
798 * @instance: Adapter soft state 812 * @instance: Adapter soft state
@@ -943,6 +957,7 @@ static struct scsi_host_template megasas_template = {
943 .module = THIS_MODULE, 957 .module = THIS_MODULE,
944 .name = "LSI Logic SAS based MegaRAID driver", 958 .name = "LSI Logic SAS based MegaRAID driver",
945 .proc_name = "megaraid_sas", 959 .proc_name = "megaraid_sas",
960 .slave_configure = megasas_slave_configure,
946 .queuecommand = megasas_queue_command, 961 .queuecommand = megasas_queue_command,
947 .eh_device_reset_handler = megasas_reset_device, 962 .eh_device_reset_handler = megasas_reset_device,
948 .eh_bus_reset_handler = megasas_reset_bus_host, 963 .eh_bus_reset_handler = megasas_reset_bus_host,
@@ -1071,20 +1086,6 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
1071 break; 1086 break;
1072 } 1087 }
1073 1088
1074 /*
1075 * Don't export physical disk devices to mid-layer.
1076 */
1077 if (!MEGASAS_IS_LOGICAL(cmd->scmd) &&
1078 (hdr->cmd_status == MFI_STAT_OK) &&
1079 (cmd->scmd->cmnd[0] == INQUIRY)) {
1080
1081 if (((*(u8 *) cmd->scmd->request_buffer) & 0x1F) ==
1082 TYPE_DISK) {
1083 cmd->scmd->result = DID_BAD_TARGET << 16;
1084 exception = 1;
1085 }
1086 }
1087
1088 case MFI_CMD_LD_READ: 1089 case MFI_CMD_LD_READ:
1089 case MFI_CMD_LD_WRITE: 1090 case MFI_CMD_LD_WRITE:
1090 1091
diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c
index 0c9edb7051f..5609847e254 100644
--- a/drivers/scsi/pcmcia/aha152x_stub.c
+++ b/drivers/scsi/pcmcia/aha152x_stub.c
@@ -275,10 +275,8 @@ static int aha152x_resume(struct pcmcia_device *dev)
275 275
276 link->state &= ~DEV_SUSPEND; 276 link->state &= ~DEV_SUSPEND;
277 if (link->state & DEV_CONFIG) { 277 if (link->state & DEV_CONFIG) {
278 Scsi_Cmnd tmp;
279 pcmcia_request_configuration(link->handle, &link->conf); 278 pcmcia_request_configuration(link->handle, &link->conf);
280 tmp.device->host = info->host; 279 aha152x_host_reset_host(info->host);
281 aha152x_host_reset(&tmp);
282 } 280 }
283 281
284 return 0; 282 return 0;
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index 5cc97b72166..ff82ccfbb10 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -1308,7 +1308,7 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd)
1308 * the request was not marked fast fail. Note that above, 1308 * the request was not marked fast fail. Note that above,
1309 * even if the request is marked fast fail, we still requeue 1309 * even if the request is marked fast fail, we still requeue
1310 * for queue congestion conditions (QUEUE_FULL or BUSY) */ 1310 * for queue congestion conditions (QUEUE_FULL or BUSY) */
1311 if ((++scmd->retries) < scmd->allowed 1311 if ((++scmd->retries) <= scmd->allowed
1312 && !blk_noretry_request(scmd->request)) { 1312 && !blk_noretry_request(scmd->request)) {
1313 return NEEDS_RETRY; 1313 return NEEDS_RETRY;
1314 } else { 1314 } else {
@@ -1433,7 +1433,7 @@ static void scsi_eh_flush_done_q(struct list_head *done_q)
1433 list_del_init(&scmd->eh_entry); 1433 list_del_init(&scmd->eh_entry);
1434 if (scsi_device_online(scmd->device) && 1434 if (scsi_device_online(scmd->device) &&
1435 !blk_noretry_request(scmd->request) && 1435 !blk_noretry_request(scmd->request) &&
1436 (++scmd->retries < scmd->allowed)) { 1436 (++scmd->retries <= scmd->allowed)) {
1437 SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush" 1437 SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush"
1438 " retry cmd: %p\n", 1438 " retry cmd: %p\n",
1439 current->comm, 1439 current->comm,
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 4362dcde74a..701a328f7be 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1498,7 +1498,7 @@ static void scsi_kill_request(struct request *req, request_queue_t *q)
1498static void scsi_softirq_done(struct request *rq) 1498static void scsi_softirq_done(struct request *rq)
1499{ 1499{
1500 struct scsi_cmnd *cmd = rq->completion_data; 1500 struct scsi_cmnd *cmd = rq->completion_data;
1501 unsigned long wait_for = cmd->allowed * cmd->timeout_per_command; 1501 unsigned long wait_for = (cmd->allowed + 1) * cmd->timeout_per_command;
1502 int disposition; 1502 int disposition;
1503 1503
1504 INIT_LIST_HEAD(&cmd->eh_entry); 1504 INIT_LIST_HEAD(&cmd->eh_entry);
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 5acb83ca5ae..f9ecc3dea7d 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -752,8 +752,20 @@ static int scsi_add_lun(struct scsi_device *sdev, char *inq_result, int *bflags)
752 752
753 transport_configure_device(&sdev->sdev_gendev); 753 transport_configure_device(&sdev->sdev_gendev);
754 754
755 if (sdev->host->hostt->slave_configure) 755 if (sdev->host->hostt->slave_configure) {
756 sdev->host->hostt->slave_configure(sdev); 756 int ret = sdev->host->hostt->slave_configure(sdev);
757 if (ret) {
758 /*
759 * if LLDD reports slave not present, don't clutter
760 * console with alloc failure messages
761 */
762 if (ret != -ENXIO) {
763 sdev_printk(KERN_ERR, sdev,
764 "failed to configure device\n");
765 }
766 return SCSI_SCAN_NO_RESPONSE;
767 }
768 }
757 769
758 /* 770 /*
759 * Ok, the device is now all set up, we can 771 * Ok, the device is now all set up, we can
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index f2c9acf11bd..929032e370d 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -1498,8 +1498,7 @@ fc_remote_port_add(struct Scsi_Host *shost, int channel,
1498 } 1498 }
1499 1499
1500 /* Search the bindings array */ 1500 /* Search the bindings array */
1501 if (likely((ids->roles & FC_RPORT_ROLE_FCP_TARGET) && 1501 if (fc_host_tgtid_bind_type(shost) != FC_TGTID_BIND_NONE) {
1502 (fc_host_tgtid_bind_type(shost) != FC_TGTID_BIND_NONE))) {
1503 1502
1504 /* search for a matching consistent binding */ 1503 /* search for a matching consistent binding */
1505 1504
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 2a547538d44..5a0a19322d0 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -2162,7 +2162,7 @@ sg_link_reserve(Sg_fd * sfp, Sg_request * srp, int size)
2162 2162
2163 srp->res_used = 1; 2163 srp->res_used = 1;
2164 SCSI_LOG_TIMEOUT(4, printk("sg_link_reserve: size=%d\n", size)); 2164 SCSI_LOG_TIMEOUT(4, printk("sg_link_reserve: size=%d\n", size));
2165 rem = size = (size + 1) & (~1); /* round to even for aha1542 */ 2165 rem = size;
2166 2166
2167 for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sg) { 2167 for (k = 0; k < rsv_schp->k_use_sg; ++k, ++sg) {
2168 num = sg->length; 2168 num = sg->length;
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index f4854c33f48..2627000ca65 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/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
919 919
920 tp->usrflags |= (SYM_DISC_ENABLED | SYM_TAGS_ENABLED); 920 tp->usrflags |= (SYM_DISC_ENABLED | SYM_TAGS_ENABLED);
921 tp->usrtags = SYM_SETUP_MAX_TAG; 921 tp->usrtags = SYM_SETUP_MAX_TAG;
922 tp->usr_width = np->maxwide;
923 tp->usr_period = 9;
922 924
923 sym_nvram_setup_target(tp, i, nvram); 925 sym_nvram_setup_target(tp, i, nvram);
924 926
diff --git a/fs/9p/fid.c b/fs/9p/fid.c
index eda449778fa..c4d13bf904d 100644
--- a/fs/9p/fid.c
+++ b/fs/9p/fid.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * V9FS FID Management 2 * V9FS FID Management
3 * 3 *
4 * Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com> 4 * Copyright (C) 2005, 2006 by Eric Van Hensbergen <ericvh@gmail.com>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -40,7 +40,7 @@
40 * 40 *
41 */ 41 */
42 42
43static int v9fs_fid_insert(struct v9fs_fid *fid, struct dentry *dentry) 43int v9fs_fid_insert(struct v9fs_fid *fid, struct dentry *dentry)
44{ 44{
45 struct list_head *fid_list = (struct list_head *)dentry->d_fsdata; 45 struct list_head *fid_list = (struct list_head *)dentry->d_fsdata;
46 dprintk(DEBUG_9P, "fid %d (%p) dentry %s (%p)\n", fid->fid, fid, 46 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)
57 } 57 }
58 58
59 fid->uid = current->uid; 59 fid->uid = current->uid;
60 fid->pid = current->pid;
61 list_add(&fid->list, fid_list); 60 list_add(&fid->list, fid_list);
62 return 0; 61 return 0;
63} 62}
@@ -68,14 +67,11 @@ static int v9fs_fid_insert(struct v9fs_fid *fid, struct dentry *dentry)
68 * 67 *
69 */ 68 */
70 69
71struct v9fs_fid *v9fs_fid_create(struct dentry *dentry, 70struct v9fs_fid *v9fs_fid_create(struct v9fs_session_info *v9ses, int fid)
72 struct v9fs_session_info *v9ses, int fid, int create)
73{ 71{
74 struct v9fs_fid *new; 72 struct v9fs_fid *new;
75 73
76 dprintk(DEBUG_9P, "fid create dentry %p, fid %d, create %d\n", 74 dprintk(DEBUG_9P, "fid create fid %d\n", fid);
77 dentry, fid, create);
78
79 new = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL); 75 new = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL);
80 if (new == NULL) { 76 if (new == NULL) {
81 dprintk(DEBUG_ERROR, "Out of Memory\n"); 77 dprintk(DEBUG_ERROR, "Out of Memory\n");
@@ -85,19 +81,13 @@ struct v9fs_fid *v9fs_fid_create(struct dentry *dentry,
85 new->fid = fid; 81 new->fid = fid;
86 new->v9ses = v9ses; 82 new->v9ses = v9ses;
87 new->fidopen = 0; 83 new->fidopen = 0;
88 new->fidcreate = create;
89 new->fidclunked = 0; 84 new->fidclunked = 0;
90 new->iounit = 0; 85 new->iounit = 0;
91 new->rdir_pos = 0; 86 new->rdir_pos = 0;
92 new->rdir_fcall = NULL; 87 new->rdir_fcall = NULL;
88 INIT_LIST_HEAD(&new->list);
93 89
94 if (v9fs_fid_insert(new, dentry) == 0) 90 return new;
95 return new;
96 else {
97 dprintk(DEBUG_ERROR, "Problems inserting to dentry\n");
98 kfree(new);
99 return NULL;
100 }
101} 91}
102 92
103/** 93/**
@@ -113,140 +103,29 @@ void v9fs_fid_destroy(struct v9fs_fid *fid)
113} 103}
114 104
115/** 105/**
116 * v9fs_fid_walk_up - walks from the process current directory
117 * up to the specified dentry.
118 */
119static struct v9fs_fid *v9fs_fid_walk_up(struct dentry *dentry)
120{
121 int fidnum, cfidnum, err;
122 struct v9fs_fid *cfid;
123 struct dentry *cde;
124 struct v9fs_session_info *v9ses;
125
126 v9ses = v9fs_inode2v9ses(current->fs->pwd->d_inode);
127 cfid = v9fs_fid_lookup(current->fs->pwd);
128 if (cfid == NULL) {
129 dprintk(DEBUG_ERROR, "process cwd doesn't have a fid\n");
130 return ERR_PTR(-ENOENT);
131 }
132
133 cfidnum = cfid->fid;
134 cde = current->fs->pwd;
135 /* TODO: take advantage of multiwalk */
136
137 fidnum = v9fs_get_idpool(&v9ses->fidpool);
138 if (fidnum < 0) {
139 dprintk(DEBUG_ERROR, "could not get a new fid num\n");
140 err = -ENOENT;
141 goto clunk_fid;
142 }
143
144 while (cde != dentry) {
145 if (cde == cde->d_parent) {
146 dprintk(DEBUG_ERROR, "can't find dentry\n");
147 err = -ENOENT;
148 goto clunk_fid;
149 }
150
151 err = v9fs_t_walk(v9ses, cfidnum, fidnum, "..", NULL);
152 if (err < 0) {
153 dprintk(DEBUG_ERROR, "problem walking to parent\n");
154 goto clunk_fid;
155 }
156
157 cfidnum = fidnum;
158 cde = cde->d_parent;
159 }
160
161 return v9fs_fid_create(dentry, v9ses, fidnum, 0);
162
163clunk_fid:
164 v9fs_t_clunk(v9ses, fidnum);
165 return ERR_PTR(err);
166}
167
168/**
169 * v9fs_fid_lookup - retrieve the right fid from a particular dentry 106 * v9fs_fid_lookup - retrieve the right fid from a particular dentry
170 * @dentry: dentry to look for fid in 107 * @dentry: dentry to look for fid in
171 * @type: intent of lookup (operation or traversal) 108 * @type: intent of lookup (operation or traversal)
172 * 109 *
173 * search list of fids associated with a dentry for a fid with a matching 110 * find a fid in the dentry
174 * thread id or uid. If that fails, look up the dentry's parents to see if you 111 *
175 * can find a matching fid. 112 * TODO: only match fids that have the same uid as current user
176 * 113 *
177 */ 114 */
178 115
179struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry) 116struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry)
180{ 117{
181 struct list_head *fid_list = (struct list_head *)dentry->d_fsdata; 118 struct list_head *fid_list = (struct list_head *)dentry->d_fsdata;
182 struct v9fs_fid *current_fid = NULL;
183 struct v9fs_fid *temp = NULL;
184 struct v9fs_fid *return_fid = NULL; 119 struct v9fs_fid *return_fid = NULL;
185 120
186 dprintk(DEBUG_9P, " dentry: %s (%p)\n", dentry->d_iname, dentry); 121 dprintk(DEBUG_9P, " dentry: %s (%p)\n", dentry->d_iname, dentry);
187 122
188 if (fid_list) { 123 if (fid_list)
189 list_for_each_entry_safe(current_fid, temp, fid_list, list) { 124 return_fid = list_entry(fid_list->next, struct v9fs_fid, list);
190 if (!current_fid->fidcreate) {
191 return_fid = current_fid;
192 break;
193 }
194 }
195
196 if (!return_fid)
197 return_fid = current_fid;
198 }
199
200 /* we are at the root but didn't match */
201 if ((!return_fid) && (dentry->d_parent == dentry)) {
202 /* TODO: clone attach with new uid */
203 return_fid = current_fid;
204 }
205 125
206 if (!return_fid) { 126 if (!return_fid) {
207 struct dentry *par = current->fs->pwd->d_parent; 127 dprintk(DEBUG_ERROR, "Couldn't find a fid in dentry\n");
208 int count = 1;
209 while (par != NULL) {
210 if (par == dentry)
211 break;
212 count++;
213 if (par == par->d_parent) {
214 dprintk(DEBUG_ERROR,
215 "got to root without finding dentry\n");
216 break;
217 }
218 par = par->d_parent;
219 }
220
221/* XXX - there may be some duplication we can get rid of */
222 if (par == dentry) {
223 return_fid = v9fs_fid_walk_up(dentry);
224 if (IS_ERR(return_fid))
225 return_fid = NULL;
226 }
227 } 128 }
228 129
229 return return_fid; 130 return return_fid;
230} 131}
231
232struct v9fs_fid *v9fs_fid_get_created(struct dentry *dentry)
233{
234 struct list_head *fid_list;
235 struct v9fs_fid *fid, *ftmp, *ret;
236
237 dprintk(DEBUG_9P, " dentry: %s (%p)\n", dentry->d_iname, dentry);
238 fid_list = (struct list_head *)dentry->d_fsdata;
239 ret = NULL;
240 if (fid_list) {
241 list_for_each_entry_safe(fid, ftmp, fid_list, list) {
242 if (fid->fidcreate && fid->pid == current->pid) {
243 list_del(&fid->list);
244 ret = fid;
245 break;
246 }
247 }
248 }
249
250 dprintk(DEBUG_9P, "return %p\n", ret);
251 return ret;
252}
diff --git a/fs/9p/fid.h b/fs/9p/fid.h
index 84c673a44c8..1fc2dd08d75 100644
--- a/fs/9p/fid.h
+++ b/fs/9p/fid.h
@@ -33,7 +33,6 @@ struct v9fs_fid {
33 33
34 u32 fid; 34 u32 fid;
35 unsigned char fidopen; /* set when fid is opened */ 35 unsigned char fidopen; /* set when fid is opened */
36 unsigned char fidcreate; /* set when fid was just created */
37 unsigned char fidclunked; /* set when fid has already been clunked */ 36 unsigned char fidclunked; /* set when fid has already been clunked */
38 37
39 struct v9fs_qid qid; 38 struct v9fs_qid qid;
@@ -45,7 +44,6 @@ struct v9fs_fid {
45 struct v9fs_fcall *rdir_fcall; 44 struct v9fs_fcall *rdir_fcall;
46 45
47 /* management stuff */ 46 /* management stuff */
48 pid_t pid; /* thread associated with this fid */
49 uid_t uid; /* user associated with this fid */ 47 uid_t uid; /* user associated with this fid */
50 48
51 /* private data */ 49 /* private data */
@@ -56,5 +54,5 @@ struct v9fs_fid {
56struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry); 54struct v9fs_fid *v9fs_fid_lookup(struct dentry *dentry);
57struct v9fs_fid *v9fs_fid_get_created(struct dentry *); 55struct v9fs_fid *v9fs_fid_get_created(struct dentry *);
58void v9fs_fid_destroy(struct v9fs_fid *fid); 56void v9fs_fid_destroy(struct v9fs_fid *fid);
59struct v9fs_fid *v9fs_fid_create(struct dentry *, 57struct v9fs_fid *v9fs_fid_create(struct v9fs_session_info *, int fid);
60 struct v9fs_session_info *v9ses, int fid, int create); 58int v9fs_fid_insert(struct v9fs_fid *fid, struct dentry *dentry);
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c
index ef338654914..61352491ba3 100644
--- a/fs/9p/v9fs.c
+++ b/fs/9p/v9fs.c
@@ -397,6 +397,7 @@ v9fs_session_init(struct v9fs_session_info *v9ses,
397 } 397 }
398 398
399 if (v9ses->afid != ~0) { 399 if (v9ses->afid != ~0) {
400 dprintk(DEBUG_ERROR, "afid not equal to ~0\n");
400 if (v9fs_t_clunk(v9ses, v9ses->afid)) 401 if (v9fs_t_clunk(v9ses, v9ses->afid))
401 dprintk(DEBUG_ERROR, "clunk failed\n"); 402 dprintk(DEBUG_ERROR, "clunk failed\n");
402 } 403 }
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h
index 69cf2905dc9..a759278acaa 100644
--- a/fs/9p/v9fs_vfs.h
+++ b/fs/9p/v9fs_vfs.h
@@ -51,3 +51,4 @@ int v9fs_dir_release(struct inode *inode, struct file *filp);
51int v9fs_file_open(struct inode *inode, struct file *file); 51int v9fs_file_open(struct inode *inode, struct file *file);
52void v9fs_inode2stat(struct inode *inode, struct v9fs_stat *stat); 52void v9fs_inode2stat(struct inode *inode, struct v9fs_stat *stat);
53void v9fs_dentry_release(struct dentry *); 53void v9fs_dentry_release(struct dentry *);
54int v9fs_uflags2omode(int uflags);
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c
index 2dd806dac9f..12c9cc926b7 100644
--- a/fs/9p/vfs_dentry.c
+++ b/fs/9p/vfs_dentry.c
@@ -43,47 +43,18 @@
43#include "fid.h" 43#include "fid.h"
44 44
45/** 45/**
46 * v9fs_dentry_validate - VFS dcache hook to validate cache 46 * v9fs_dentry_delete - called when dentry refcount equals 0
47 * @dentry: dentry that is being validated 47 * @dentry: dentry in question
48 * @nd: path data
49 * 48 *
50 * dcache really shouldn't be used for 9P2000 as at all due to 49 * By returning 1 here we should remove cacheing of unused
51 * potential attached semantics to directory traversal (walk). 50 * dentry components.
52 *
53 * FUTURE: look into how to use dcache to allow multi-stage
54 * walks in Plan 9 & potential for better dcache operation which
55 * would remain valid for Plan 9 semantics. Older versions
56 * had validation via stat for those interested. However, since
57 * stat has the same approximate overhead as walk there really
58 * is no difference. The only improvement would be from a
59 * time-decay cache like NFS has and that undermines the
60 * synchronous nature of 9P2000.
61 * 51 *
62 */ 52 */
63 53
64static int v9fs_dentry_validate(struct dentry *dentry, struct nameidata *nd) 54int v9fs_dentry_delete(struct dentry *dentry)
65{ 55{
66 struct dentry *dc = current->fs->pwd; 56 dprintk(DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_iname, dentry);
67 57 return 1;
68 dprintk(DEBUG_VFS, "dentry: %s (%p)\n", dentry->d_iname, dentry);
69 if (v9fs_fid_lookup(dentry)) {
70 dprintk(DEBUG_VFS, "VALID\n");
71 return 1;
72 }
73
74 while (dc != NULL) {
75 if (dc == dentry) {
76 dprintk(DEBUG_VFS, "VALID\n");
77 return 1;
78 }
79 if (dc == dc->d_parent)
80 break;
81
82 dc = dc->d_parent;
83 }
84
85 dprintk(DEBUG_VFS, "INVALID\n");
86 return 0;
87} 58}
88 59
89/** 60/**
@@ -118,6 +89,6 @@ void v9fs_dentry_release(struct dentry *dentry)
118} 89}
119 90
120struct dentry_operations v9fs_dentry_operations = { 91struct dentry_operations v9fs_dentry_operations = {
121 .d_revalidate = v9fs_dentry_validate, 92 .d_delete = v9fs_dentry_delete,
122 .d_release = v9fs_dentry_release, 93 .d_release = v9fs_dentry_release,
123}; 94};
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index c7e14d91721..de3a129698d 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -53,94 +53,70 @@
53int v9fs_file_open(struct inode *inode, struct file *file) 53int v9fs_file_open(struct inode *inode, struct file *file)
54{ 54{
55 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode); 55 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(inode);
56 struct v9fs_fid *v9fid, *fid; 56 struct v9fs_fid *vfid;
57 struct v9fs_fcall *fcall = NULL; 57 struct v9fs_fcall *fcall = NULL;
58 int open_mode = 0; 58 int omode;
59 unsigned int iounit = 0; 59 int fid = V9FS_NOFID;
60 int newfid = -1; 60 int err;
61 long result = -1;
62 61
63 dprintk(DEBUG_VFS, "inode: %p file: %p \n", inode, file); 62 dprintk(DEBUG_VFS, "inode: %p file: %p \n", inode, file);
64 63
65 v9fid = v9fs_fid_get_created(file->f_dentry); 64 vfid = v9fs_fid_lookup(file->f_dentry);
66 if (!v9fid) 65 if (!vfid) {
67 v9fid = v9fs_fid_lookup(file->f_dentry);
68
69 if (!v9fid) {
70 dprintk(DEBUG_ERROR, "Couldn't resolve fid from dentry\n"); 66 dprintk(DEBUG_ERROR, "Couldn't resolve fid from dentry\n");
71 return -EBADF; 67 return -EBADF;
72 } 68 }
73 69
74 if (!v9fid->fidcreate) { 70 fid = v9fs_get_idpool(&v9ses->fidpool);
75 fid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL); 71 if (fid < 0) {
76 if (fid == NULL) {
77 dprintk(DEBUG_ERROR, "Out of Memory\n");
78 return -ENOMEM;
79 }
80
81 fid->fidopen = 0;
82 fid->fidcreate = 0;
83 fid->fidclunked = 0;
84 fid->iounit = 0;
85 fid->v9ses = v9ses;
86
87 newfid = v9fs_get_idpool(&v9ses->fidpool);
88 if (newfid < 0) {
89 eprintk(KERN_WARNING, "newfid fails!\n"); 72 eprintk(KERN_WARNING, "newfid fails!\n");
90 return -ENOSPC; 73 return -ENOSPC;
91 } 74 }
92 75
93 result = 76 err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, NULL);
94 v9fs_t_walk(v9ses, v9fid->fid, newfid, NULL, NULL); 77 if (err < 0) {
95
96 if (result < 0) {
97 v9fs_put_idpool(newfid, &v9ses->fidpool);
98 dprintk(DEBUG_ERROR, "rewalk didn't work\n"); 78 dprintk(DEBUG_ERROR, "rewalk didn't work\n");
99 return -EBADF; 79 goto put_fid;
80 }
81
82 vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL);
83 if (vfid == NULL) {
84 dprintk(DEBUG_ERROR, "out of memory\n");
85 goto clunk_fid;
100 } 86 }
101 87
102 fid->fid = newfid;
103 v9fid = fid;
104 /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */ 88 /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */
105 /* translate open mode appropriately */ 89 /* translate open mode appropriately */
106 open_mode = file->f_flags & 0x3; 90 omode = v9fs_uflags2omode(file->f_flags);
91 err = v9fs_t_open(v9ses, fid, omode, &fcall);
92 if (err < 0) {
93 PRINT_FCALL_ERROR("open failed", fcall);
94 goto destroy_vfid;
95 }
107 96
108 if (file->f_flags & O_EXCL) 97 file->private_data = vfid;
109 open_mode |= V9FS_OEXCL; 98 vfid->fid = fid;
99 vfid->fidopen = 1;
100 vfid->fidclunked = 0;
101 vfid->iounit = fcall->params.ropen.iounit;
102 vfid->rdir_pos = 0;
103 vfid->rdir_fcall = NULL;
104 vfid->filp = file;
105 kfree(fcall);
110 106
111 if (v9ses->extended) { 107 return 0;
112 if (file->f_flags & O_TRUNC)
113 open_mode |= V9FS_OTRUNC;
114 108
115 if (file->f_flags & O_APPEND) 109destroy_vfid:
116 open_mode |= V9FS_OAPPEND; 110 v9fs_fid_destroy(vfid);
117 }
118 111
119 result = v9fs_t_open(v9ses, newfid, open_mode, &fcall); 112clunk_fid:
120 if (result < 0) { 113 v9fs_t_clunk(v9ses, fid);
121 PRINT_FCALL_ERROR("open failed", fcall);
122 kfree(fcall);
123 return result;
124 }
125 114
126 iounit = fcall->params.ropen.iounit; 115put_fid:
116 v9fs_put_idpool(fid, &v9ses->fidpool);
127 kfree(fcall); 117 kfree(fcall);
128 } else {
129 /* create case */
130 newfid = v9fid->fid;
131 iounit = v9fid->iounit;
132 v9fid->fidcreate = 0;
133 }
134
135 file->private_data = v9fid;
136
137 v9fid->rdir_pos = 0;
138 v9fid->rdir_fcall = NULL;
139 v9fid->fidopen = 1;
140 v9fid->filp = file;
141 v9fid->iounit = iounit;
142 118
143 return 0; 119 return err;
144} 120}
145 121
146/** 122/**
@@ -289,9 +265,7 @@ v9fs_file_write(struct file *filp, const char __user * data,
289 total += result; 265 total += result;
290 } while (count); 266 } while (count);
291 267
292 if(inode->i_mapping->nrpages)
293 invalidate_inode_pages2(inode->i_mapping); 268 invalidate_inode_pages2(inode->i_mapping);
294
295 return total; 269 return total;
296} 270}
297 271
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 63e5b0398e8..dce729d4286 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -125,6 +125,38 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses, int mode)
125 return res; 125 return res;
126} 126}
127 127
128int v9fs_uflags2omode(int uflags)
129{
130 int ret;
131
132 ret = 0;
133 switch (uflags&3) {
134 default:
135 case O_RDONLY:
136 ret = V9FS_OREAD;
137 break;
138
139 case O_WRONLY:
140 ret = V9FS_OWRITE;
141 break;
142
143 case O_RDWR:
144 ret = V9FS_ORDWR;
145 break;
146 }
147
148 if (uflags & O_EXCL)
149 ret |= V9FS_OEXCL;
150
151 if (uflags & O_TRUNC)
152 ret |= V9FS_OTRUNC;
153
154 if (uflags & O_APPEND)
155 ret |= V9FS_OAPPEND;
156
157 return ret;
158}
159
128/** 160/**
129 * v9fs_blank_wstat - helper function to setup a 9P stat structure 161 * v9fs_blank_wstat - helper function to setup a 9P stat structure
130 * @v9ses: 9P session info (for determining extended mode) 162 * @v9ses: 9P session info (for determining extended mode)
@@ -163,7 +195,7 @@ v9fs_blank_wstat(struct v9fs_wstat *wstat)
163 195
164struct inode *v9fs_get_inode(struct super_block *sb, int mode) 196struct inode *v9fs_get_inode(struct super_block *sb, int mode)
165{ 197{
166 struct inode *inode = NULL; 198 struct inode *inode;
167 struct v9fs_session_info *v9ses = sb->s_fs_info; 199 struct v9fs_session_info *v9ses = sb->s_fs_info;
168 200
169 dprintk(DEBUG_VFS, "super block: %p mode: %o\n", sb, mode); 201 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)
222 return inode; 254 return inode;
223} 255}
224 256
225/**
226 * v9fs_create - helper function to create files and directories
227 * @dir: directory inode file is being created in
228 * @file_dentry: dentry file is being created in
229 * @perm: permissions file is being created with
230 * @open_mode: resulting open mode for file
231 *
232 */
233
234static int 257static int
235v9fs_create(struct inode *dir, 258v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name,
236 struct dentry *file_dentry, 259 u32 perm, u8 mode, u32 *fidp, struct v9fs_qid *qid, u32 *iounit)
237 unsigned int perm, unsigned int open_mode)
238{ 260{
239 struct v9fs_session_info *v9ses = v9fs_inode2v9ses(dir); 261 u32 fid;
240 struct super_block *sb = dir->i_sb;
241 struct v9fs_fid *dirfid =
242 v9fs_fid_lookup(file_dentry->d_parent);
243 struct v9fs_fid *fid = NULL;
244 struct inode *file_inode = NULL;
245 struct v9fs_fcall *fcall = NULL;
246 struct v9fs_qid qid;
247 int dirfidnum = -1;
248 long newfid = -1;
249 int result = 0;
250 unsigned int iounit = 0;
251 int wfidno = -1;
252 int err; 262 int err;
263 struct v9fs_fcall *fcall;
253 264
254 perm = unixmode2p9mode(v9ses, perm); 265 fid = v9fs_get_idpool(&v9ses->fidpool);
255 266 if (fid < 0) {
256 dprintk(DEBUG_VFS, "dir: %p dentry: %p perm: %o mode: %o\n", dir,
257 file_dentry, perm, open_mode);
258
259 if (!dirfid)
260 return -EBADF;
261
262 dirfidnum = dirfid->fid;
263 if (dirfidnum < 0) {
264 dprintk(DEBUG_ERROR, "No fid for the directory #%lu\n",
265 dir->i_ino);
266 return -EBADF;
267 }
268
269 if (file_dentry->d_inode) {
270 dprintk(DEBUG_ERROR,
271 "Odd. There is an inode for dir %lu, name :%s:\n",
272 dir->i_ino, file_dentry->d_name.name);
273 return -EEXIST;
274 }
275
276 newfid = v9fs_get_idpool(&v9ses->fidpool);
277 if (newfid < 0) {
278 eprintk(KERN_WARNING, "no free fids available\n"); 267 eprintk(KERN_WARNING, "no free fids available\n");
279 return -ENOSPC; 268 err = -ENOSPC;
269 goto error;
280 } 270 }
281 271
282 result = v9fs_t_walk(v9ses, dirfidnum, newfid, NULL, &fcall); 272 err = v9fs_t_walk(v9ses, pfid, fid, NULL, &fcall);
283 if (result < 0) { 273 if (err < 0) {
284 PRINT_FCALL_ERROR("clone error", fcall); 274 PRINT_FCALL_ERROR("clone error", fcall);
285 v9fs_put_idpool(newfid, &v9ses->fidpool); 275 goto error;
286 newfid = -1;
287 goto CleanUpFid;
288 } 276 }
289
290 kfree(fcall); 277 kfree(fcall);
291 fcall = NULL;
292 278
293 result = v9fs_t_create(v9ses, newfid, (char *)file_dentry->d_name.name, 279 err = v9fs_t_create(v9ses, fid, name, perm, mode, &fcall);
294 perm, open_mode, &fcall); 280 if (err < 0) {
295 if (result < 0) {
296 PRINT_FCALL_ERROR("create fails", fcall); 281 PRINT_FCALL_ERROR("create fails", fcall);
297 goto CleanUpFid; 282 goto error;
298 } 283 }
299 284
300 iounit = fcall->params.rcreate.iounit; 285 if (iounit)
301 qid = fcall->params.rcreate.qid; 286 *iounit = fcall->params.rcreate.iounit;
287
288 if (qid)
289 *qid = fcall->params.rcreate.qid;
290
291 if (fidp)
292 *fidp = fid;
293
302 kfree(fcall); 294 kfree(fcall);
303 fcall = NULL; 295 return 0;
304 296
305 if (!(perm&V9FS_DMDIR)) { 297error:
306 fid = v9fs_fid_create(file_dentry, v9ses, newfid, 1); 298 if (fid >= 0)
307 dprintk(DEBUG_VFS, "fid %p %d\n", fid, fid->fidcreate); 299 v9fs_put_idpool(fid, &v9ses->fidpool);
308 if (!fid) {
309 result = -ENOMEM;
310 goto CleanUpFid;
311 }
312 300
313 fid->qid = qid; 301 kfree(fcall);
314 fid->iounit = iounit; 302 return err;
315 } else { 303}
316 err = v9fs_t_clunk(v9ses, newfid); 304
317 newfid = -1; 305static struct v9fs_fid*
318 if (err < 0) 306v9fs_clone_walk(struct v9fs_session_info *v9ses, u32 fid, struct dentry *dentry)
319 dprintk(DEBUG_ERROR, "clunk for mkdir failed: %d\n", err); 307{
320 } 308 int err;
309 u32 nfid;
310 struct v9fs_fid *ret;
311 struct v9fs_fcall *fcall;
321 312
322 /* walk to the newly created file and put the fid in the dentry */ 313 nfid = v9fs_get_idpool(&v9ses->fidpool);
323 wfidno = v9fs_get_idpool(&v9ses->fidpool); 314 if (nfid < 0) {
324 if (wfidno < 0) {
325 eprintk(KERN_WARNING, "no free fids available\n"); 315 eprintk(KERN_WARNING, "no free fids available\n");
326 return -ENOSPC; 316 err = -ENOSPC;
317 goto error;
327 } 318 }
328 319
329 result = v9fs_t_walk(v9ses, dirfidnum, wfidno, 320 err = v9fs_t_walk(v9ses, fid, nfid, (char *) dentry->d_name.name,
330 (char *) file_dentry->d_name.name, &fcall); 321 &fcall);
331 if (result < 0) { 322
332 PRINT_FCALL_ERROR("clone error", fcall); 323 if (err < 0) {
333 v9fs_put_idpool(wfidno, &v9ses->fidpool); 324 PRINT_FCALL_ERROR("walk error", fcall);
334 wfidno = -1; 325 v9fs_put_idpool(nfid, &v9ses->fidpool);
335 goto CleanUpFid; 326 goto error;
336 } 327 }
328
337 kfree(fcall); 329 kfree(fcall);
338 fcall = NULL; 330 fcall = NULL;
331 ret = v9fs_fid_create(v9ses, nfid);
332 if (!ret) {
333 err = -ENOMEM;
334 goto clunk_fid;
335 }
339 336
340 if (!v9fs_fid_create(file_dentry, v9ses, wfidno, 0)) { 337 err = v9fs_fid_insert(ret, dentry);
341 v9fs_put_idpool(wfidno, &v9ses->fidpool); 338 if (err < 0) {
342 339 v9fs_fid_destroy(ret);
343 goto CleanUpFid; 340 goto clunk_fid;
344 } 341 }
345 342
346 if ((perm & V9FS_DMSYMLINK) || (perm & V9FS_DMLINK) || 343 return ret;
347 (perm & V9FS_DMNAMEDPIPE) || (perm & V9FS_DMSOCKET) ||
348 (perm & V9FS_DMDEVICE))
349 return 0;
350 344
351 result = v9fs_t_stat(v9ses, wfidno, &fcall); 345clunk_fid:
352 if (result < 0) { 346 v9fs_t_clunk(v9ses, nfid);
353 PRINT_FCALL_ERROR("stat error", fcall); 347
354 goto CleanUpFid; 348error:
355 } 349 kfree(fcall);
350 return ERR_PTR(err);
351}
356 352
353struct inode *
354v9fs_inode_from_fid(struct v9fs_session_info *v9ses, u32 fid,
355 struct super_block *sb)
356{
357 int err, umode;
358 struct inode *ret;
359 struct v9fs_fcall *fcall;
357 360
358 file_inode = v9fs_get_inode(sb, 361 ret = NULL;
359 p9mode2unixmode(v9ses, fcall->params.rstat.stat.mode)); 362 err = v9fs_t_stat(v9ses, fid, &fcall);
363 if (err) {
364 PRINT_FCALL_ERROR("stat error", fcall);
365 goto error;
366 }
360 367
361 if ((!file_inode) || IS_ERR(file_inode)) { 368 umode = p9mode2unixmode(v9ses, fcall->params.rstat.stat.mode);
362 dprintk(DEBUG_ERROR, "create inode failed\n"); 369 ret = v9fs_get_inode(sb, umode);
363 result = -EBADF; 370 if (IS_ERR(ret)) {
364 goto CleanUpFid; 371 err = PTR_ERR(ret);
372 ret = NULL;
373 goto error;
365 } 374 }
366 375
367 v9fs_stat2inode(&fcall->params.rstat.stat, file_inode, sb); 376 v9fs_stat2inode(&fcall->params.rstat.stat, ret, sb);
368 kfree(fcall); 377 kfree(fcall);
369 fcall = NULL; 378 return ret;
370 file_dentry->d_op = &v9fs_dentry_operations;
371 d_instantiate(file_dentry, file_inode);
372
373 return 0;
374 379
375 CleanUpFid: 380error:
376 kfree(fcall); 381 kfree(fcall);
377 fcall = NULL; 382 if (ret)
383 iput(ret);
378 384
379 if (newfid >= 0) { 385 return ERR_PTR(err);
380 err = v9fs_t_clunk(v9ses, newfid);
381 if (err < 0)
382 dprintk(DEBUG_ERROR, "clunk failed: %d\n", err);
383 }
384 if (wfidno >= 0) {
385 err = v9fs_t_clunk(v9ses, wfidno);
386 if (err < 0)
387 dprintk(DEBUG_ERROR, "clunk failed: %d\n", err);
388 }
389 return result;
390} 386}
391 387
392/** 388/**
@@ -440,20 +436,97 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
440 return result; 436 return result;
441} 437}
442 438
439static int
440v9fs_open_created(struct inode *inode, struct file *file)
441{
442 return 0;
443}
444
443/** 445/**
444 * v9fs_vfs_create - VFS hook to create files 446 * v9fs_vfs_create - VFS hook to create files
445 * @inode: directory inode that is being deleted 447 * @inode: directory inode that is being deleted
446 * @dentry: dentry that is being deleted 448 * @dentry: dentry that is being deleted
447 * @perm: create permissions 449 * @mode: create permissions
448 * @nd: path information 450 * @nd: path information
449 * 451 *
450 */ 452 */
451 453
452static int 454static int
453v9fs_vfs_create(struct inode *inode, struct dentry *dentry, int perm, 455v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
454 struct nameidata *nd) 456 struct nameidata *nd)
455{ 457{
456 return v9fs_create(inode, dentry, perm, O_RDWR); 458 int err;
459 u32 fid, perm, iounit;
460 int flags;
461 struct v9fs_session_info *v9ses;
462 struct v9fs_fid *dfid, *vfid, *ffid;
463 struct inode *inode;
464 struct v9fs_qid qid;
465 struct file *filp;
466
467 inode = NULL;
468 vfid = NULL;
469 v9ses = v9fs_inode2v9ses(dir);
470 dfid = v9fs_fid_lookup(dentry->d_parent);
471 perm = unixmode2p9mode(v9ses, mode);
472
473 if (nd && nd->flags & LOOKUP_OPEN)
474 flags = nd->intent.open.flags - 1;
475 else
476 flags = O_RDWR;
477
478 err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name,
479 perm, v9fs_uflags2omode(flags), &fid, &qid, &iounit);
480
481 if (err)
482 goto error;
483
484 vfid = v9fs_clone_walk(v9ses, dfid->fid, dentry);
485 if (IS_ERR(vfid)) {
486 err = PTR_ERR(vfid);
487 vfid = NULL;
488 goto error;
489 }
490
491 inode = v9fs_inode_from_fid(v9ses, vfid->fid, dir->i_sb);
492 if (IS_ERR(inode)) {
493 err = PTR_ERR(inode);
494 inode = NULL;
495 goto error;
496 }
497
498 dentry->d_op = &v9fs_dentry_operations;
499 d_instantiate(dentry, inode);
500
501 if (nd && nd->flags & LOOKUP_OPEN) {
502 ffid = v9fs_fid_create(v9ses, fid);
503 if (!ffid)
504 return -ENOMEM;
505
506 filp = lookup_instantiate_filp(nd, dentry, v9fs_open_created);
507 if (IS_ERR(filp)) {
508 v9fs_fid_destroy(ffid);
509 return PTR_ERR(filp);
510 }
511
512 ffid->rdir_pos = 0;
513 ffid->rdir_fcall = NULL;
514 ffid->fidopen = 1;
515 ffid->iounit = iounit;
516 ffid->filp = filp;
517 filp->private_data = ffid;
518 }
519
520 return 0;
521
522error:
523 if (vfid)
524 v9fs_fid_destroy(vfid);
525
526 if (inode)
527 iput(inode);
528
529 return err;
457} 530}
458 531
459/** 532/**
@@ -464,9 +537,57 @@ v9fs_vfs_create(struct inode *inode, struct dentry *dentry, int perm,
464 * 537 *
465 */ 538 */
466 539
467static int v9fs_vfs_mkdir(struct inode *inode, struct dentry *dentry, int mode) 540static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
468{ 541{
469 return v9fs_create(inode, dentry, mode | S_IFDIR, O_RDONLY); 542 int err;
543 u32 fid, perm;
544 struct v9fs_session_info *v9ses;
545 struct v9fs_fid *dfid, *vfid;
546 struct inode *inode;
547
548 inode = NULL;
549 vfid = NULL;
550 v9ses = v9fs_inode2v9ses(dir);
551 dfid = v9fs_fid_lookup(dentry->d_parent);
552 perm = unixmode2p9mode(v9ses, mode | S_IFDIR);
553
554 err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name,
555 perm, V9FS_OREAD, &fid, NULL, NULL);
556
557 if (err) {
558 dprintk(DEBUG_ERROR, "create error %d\n", err);
559 goto error;
560 }
561
562 err = v9fs_t_clunk(v9ses, fid);
563 if (err) {
564 dprintk(DEBUG_ERROR, "clunk error %d\n", err);
565 goto error;
566 }
567
568 vfid = v9fs_clone_walk(v9ses, dfid->fid, dentry);
569 if (IS_ERR(vfid)) {
570 err = PTR_ERR(vfid);
571 vfid = NULL;
572 goto error;
573 }
574
575 inode = v9fs_inode_from_fid(v9ses, vfid->fid, dir->i_sb);
576 if (IS_ERR(inode)) {
577 err = PTR_ERR(inode);
578 inode = NULL;
579 goto error;
580 }
581
582 dentry->d_op = &v9fs_dentry_operations;
583 d_instantiate(dentry, inode);
584 return 0;
585
586error:
587 if (vfid)
588 v9fs_fid_destroy(vfid);
589
590 return err;
470} 591}
471 592
472/** 593/**
@@ -516,9 +637,8 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
516 return ERR_PTR(-ENOSPC); 637 return ERR_PTR(-ENOSPC);
517 } 638 }
518 639
519 result = 640 result = v9fs_t_walk(v9ses, dirfidnum, newfid,
520 v9fs_t_walk(v9ses, dirfidnum, newfid, (char *)dentry->d_name.name, 641 (char *)dentry->d_name.name, NULL);
521 NULL);
522 if (result < 0) { 642 if (result < 0) {
523 v9fs_put_idpool(newfid, &v9ses->fidpool); 643 v9fs_put_idpool(newfid, &v9ses->fidpool);
524 if (result == -ENOENT) { 644 if (result == -ENOENT) {
@@ -551,13 +671,17 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
551 671
552 inode->i_ino = v9fs_qid2ino(&fcall->params.rstat.stat.qid); 672 inode->i_ino = v9fs_qid2ino(&fcall->params.rstat.stat.qid);
553 673
554 fid = v9fs_fid_create(dentry, v9ses, newfid, 0); 674 fid = v9fs_fid_create(v9ses, newfid);
555 if (fid == NULL) { 675 if (fid == NULL) {
556 dprintk(DEBUG_ERROR, "couldn't insert\n"); 676 dprintk(DEBUG_ERROR, "couldn't insert\n");
557 result = -ENOMEM; 677 result = -ENOMEM;
558 goto FreeFcall; 678 goto FreeFcall;
559 } 679 }
560 680
681 result = v9fs_fid_insert(fid, dentry);
682 if (result < 0)
683 goto FreeFcall;
684
561 fid->qid = fcall->params.rstat.stat.qid; 685 fid->qid = fcall->params.rstat.stat.qid;
562 686
563 dentry->d_op = &v9fs_dentry_operations; 687 dentry->d_op = &v9fs_dentry_operations;
@@ -886,8 +1010,8 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
886 } 1010 }
887 1011
888 /* copy extension buffer into buffer */ 1012 /* copy extension buffer into buffer */
889 if (fcall->params.rstat.stat.extension.len+1 < buflen) 1013 if (fcall->params.rstat.stat.extension.len < buflen)
890 buflen = fcall->params.rstat.stat.extension.len + 1; 1014 buflen = fcall->params.rstat.stat.extension.len;
891 1015
892 memcpy(buffer, fcall->params.rstat.stat.extension.str, buflen - 1); 1016 memcpy(buffer, fcall->params.rstat.stat.extension.str, buflen - 1);
893 buffer[buflen-1] = 0; 1017 buffer[buflen-1] = 0;
@@ -951,7 +1075,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
951 if (!link) 1075 if (!link)
952 link = ERR_PTR(-ENOMEM); 1076 link = ERR_PTR(-ENOMEM);
953 else { 1077 else {
954 len = v9fs_readlink(dentry, link, PATH_MAX); 1078 len = v9fs_readlink(dentry, link, strlen(link));
955 1079
956 if (len < 0) { 1080 if (len < 0) {
957 __putname(link); 1081 __putname(link);
@@ -983,53 +1107,75 @@ static void v9fs_vfs_put_link(struct dentry *dentry, struct nameidata *nd, void
983static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, 1107static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
984 int mode, const char *extension) 1108 int mode, const char *extension)
985{ 1109{
986 int err, retval; 1110 int err;
1111 u32 fid, perm;
987 struct v9fs_session_info *v9ses; 1112 struct v9fs_session_info *v9ses;
1113 struct v9fs_fid *dfid, *vfid;
1114 struct inode *inode;
988 struct v9fs_fcall *fcall; 1115 struct v9fs_fcall *fcall;
989 struct v9fs_fid *fid;
990 struct v9fs_wstat wstat; 1116 struct v9fs_wstat wstat;
991 1117
992 v9ses = v9fs_inode2v9ses(dir);
993 retval = -EPERM;
994 fcall = NULL; 1118 fcall = NULL;
1119 inode = NULL;
1120 vfid = NULL;
1121 v9ses = v9fs_inode2v9ses(dir);
1122 dfid = v9fs_fid_lookup(dentry->d_parent);
1123 perm = unixmode2p9mode(v9ses, mode);
995 1124
996 if (!v9ses->extended) { 1125 if (!v9ses->extended) {
997 dprintk(DEBUG_ERROR, "not extended\n"); 1126 dprintk(DEBUG_ERROR, "not extended\n");
998 goto free_mem; 1127 return -EPERM;
999 } 1128 }
1000 1129
1001 /* issue a create */ 1130 err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name,
1002 retval = v9fs_create(dir, dentry, mode, 0); 1131 perm, V9FS_OREAD, &fid, NULL, NULL);
1003 if (retval != 0)
1004 goto free_mem;
1005 1132
1006 fid = v9fs_fid_get_created(dentry); 1133 if (err)
1007 if (!fid) { 1134 goto error;
1008 dprintk(DEBUG_ERROR, "couldn't resolve fid from dentry\n"); 1135
1009 goto free_mem; 1136 err = v9fs_t_clunk(v9ses, fid);
1137 if (err)
1138 goto error;
1139
1140 vfid = v9fs_clone_walk(v9ses, dfid->fid, dentry);
1141 if (IS_ERR(vfid)) {
1142 err = PTR_ERR(vfid);
1143 vfid = NULL;
1144 goto error;
1145 }
1146
1147 inode = v9fs_inode_from_fid(v9ses, vfid->fid, dir->i_sb);
1148 if (IS_ERR(inode)) {
1149 err = PTR_ERR(inode);
1150 inode = NULL;
1151 goto error;
1010 } 1152 }
1011 1153
1012 /* issue a Twstat */ 1154 /* issue a Twstat */
1013 v9fs_blank_wstat(&wstat); 1155 v9fs_blank_wstat(&wstat);
1014 wstat.muid = v9ses->name; 1156 wstat.muid = v9ses->name;
1015 wstat.extension = (char *) extension; 1157 wstat.extension = (char *) extension;
1016 retval = v9fs_t_wstat(v9ses, fid->fid, &wstat, &fcall); 1158 err = v9fs_t_wstat(v9ses, vfid->fid, &wstat, &fcall);
1017 if (retval < 0) {
1018 PRINT_FCALL_ERROR("wstat error", fcall);
1019 goto free_mem;
1020 }
1021
1022 err = v9fs_t_clunk(v9ses, fid->fid);
1023 if (err < 0) { 1159 if (err < 0) {
1024 dprintk(DEBUG_ERROR, "clunk failed: %d\n", err); 1160 PRINT_FCALL_ERROR("wstat error", fcall);
1025 goto free_mem; 1161 goto error;
1026 } 1162 }
1027 1163
1028 d_drop(dentry); /* FID - will this also clunk? */ 1164 kfree(fcall);
1165 dentry->d_op = &v9fs_dentry_operations;
1166 d_instantiate(dentry, inode);
1167 return 0;
1029 1168
1030free_mem: 1169error:
1031 kfree(fcall); 1170 kfree(fcall);
1032 return retval; 1171 if (vfid)
1172 v9fs_fid_destroy(vfid);
1173
1174 if (inode)
1175 iput(inode);
1176
1177 return err;
1178
1033} 1179}
1034 1180
1035/** 1181/**
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
index 2c4fa75be02..cdf787ee08d 100644
--- a/fs/9p/vfs_super.c
+++ b/fs/9p/vfs_super.c
@@ -146,7 +146,6 @@ static struct super_block *v9fs_get_sb(struct file_system_type
146 inode->i_gid = gid; 146 inode->i_gid = gid;
147 147
148 root = d_alloc_root(inode); 148 root = d_alloc_root(inode);
149
150 if (!root) { 149 if (!root) {
151 retval = -ENOMEM; 150 retval = -ENOMEM;
152 goto put_back_sb; 151 goto put_back_sb;
@@ -157,16 +156,22 @@ static struct super_block *v9fs_get_sb(struct file_system_type
157 stat_result = v9fs_t_stat(v9ses, newfid, &fcall); 156 stat_result = v9fs_t_stat(v9ses, newfid, &fcall);
158 if (stat_result < 0) { 157 if (stat_result < 0) {
159 dprintk(DEBUG_ERROR, "stat error\n"); 158 dprintk(DEBUG_ERROR, "stat error\n");
159 kfree(fcall);
160 v9fs_t_clunk(v9ses, newfid); 160 v9fs_t_clunk(v9ses, newfid);
161 v9fs_put_idpool(newfid, &v9ses->fidpool);
162 } else { 161 } else {
163 /* Setup the Root Inode */ 162 /* Setup the Root Inode */
164 root_fid = v9fs_fid_create(root, v9ses, newfid, 0); 163 root_fid = v9fs_fid_create(v9ses, newfid);
165 if (root_fid == NULL) { 164 if (root_fid == NULL) {
166 retval = -ENOMEM; 165 retval = -ENOMEM;
167 goto put_back_sb; 166 goto put_back_sb;
168 } 167 }
169 168
169 retval = v9fs_fid_insert(root_fid, root);
170 if (retval < 0) {
171 kfree(fcall);
172 goto put_back_sb;
173 }
174
170 root_fid->qid = fcall->params.rstat.stat.qid; 175 root_fid->qid = fcall->params.rstat.stat.qid;
171 root->d_inode->i_ino = 176 root->d_inode->i_ino =
172 v9fs_qid2ino(&fcall->params.rstat.stat.qid); 177 v9fs_qid2ino(&fcall->params.rstat.stat.qid);
diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c
index fd741cea570..636593bf4d1 100644
--- a/fs/ocfs2/cluster/masklog.c
+++ b/fs/ocfs2/cluster/masklog.c
@@ -74,6 +74,7 @@ struct mlog_attribute {
74#define define_mask(_name) { \ 74#define define_mask(_name) { \
75 .attr = { \ 75 .attr = { \
76 .name = #_name, \ 76 .name = #_name, \
77 .owner = THIS_MODULE, \
77 .mode = S_IRUGO | S_IWUSR, \ 78 .mode = S_IRUGO | S_IWUSR, \
78 }, \ 79 }, \
79 .mask = ML_##_name, \ 80 .mask = ML_##_name, \
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h
index e8c56a3d9c6..2cadc3009c8 100644
--- a/fs/ocfs2/cluster/masklog.h
+++ b/fs/ocfs2/cluster/masklog.h
@@ -256,7 +256,7 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;
256 } \ 256 } \
257} while (0) 257} while (0)
258 258
259#if (BITS_PER_LONG == 32) || defined(CONFIG_X86_64) 259#if (BITS_PER_LONG == 32) || defined(CONFIG_X86_64) || (defined(CONFIG_UML_X86) && defined(CONFIG_64BIT))
260#define MLFi64 "lld" 260#define MLFi64 "lld"
261#define MLFu64 "llu" 261#define MLFu64 "llu"
262#define MLFx64 "llx" 262#define MLFx64 "llx"
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c
index cf7828f2336..e1fceb8aa32 100644
--- a/fs/ocfs2/cluster/nodemanager.c
+++ b/fs/ocfs2/cluster/nodemanager.c
@@ -756,7 +756,7 @@ static int __init init_o2nm(void)
756 if (!ocfs2_table_header) { 756 if (!ocfs2_table_header) {
757 printk(KERN_ERR "nodemanager: unable to register sysctl\n"); 757 printk(KERN_ERR "nodemanager: unable to register sysctl\n");
758 ret = -ENOMEM; /* or something. */ 758 ret = -ENOMEM; /* or something. */
759 goto out; 759 goto out_o2net;
760 } 760 }
761 761
762 ret = o2net_register_hb_callbacks(); 762 ret = o2net_register_hb_callbacks();
@@ -780,6 +780,8 @@ out_callbacks:
780 o2net_unregister_hb_callbacks(); 780 o2net_unregister_hb_callbacks();
781out_sysctl: 781out_sysctl:
782 unregister_sysctl_table(ocfs2_table_header); 782 unregister_sysctl_table(ocfs2_table_header);
783out_o2net:
784 o2net_exit();
783out: 785out:
784 return ret; 786 return ret;
785} 787}
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index d22d4cf08db..0f60cc0d398 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -1318,7 +1318,7 @@ static void o2net_start_connect(void *arg)
1318{ 1318{
1319 struct o2net_node *nn = arg; 1319 struct o2net_node *nn = arg;
1320 struct o2net_sock_container *sc = NULL; 1320 struct o2net_sock_container *sc = NULL;
1321 struct o2nm_node *node = NULL; 1321 struct o2nm_node *node = NULL, *mynode = NULL;
1322 struct socket *sock = NULL; 1322 struct socket *sock = NULL;
1323 struct sockaddr_in myaddr = {0, }, remoteaddr = {0, }; 1323 struct sockaddr_in myaddr = {0, }, remoteaddr = {0, };
1324 int ret = 0; 1324 int ret = 0;
@@ -1334,6 +1334,12 @@ static void o2net_start_connect(void *arg)
1334 goto out; 1334 goto out;
1335 } 1335 }
1336 1336
1337 mynode = o2nm_get_node_by_num(o2nm_this_node());
1338 if (mynode == NULL) {
1339 ret = 0;
1340 goto out;
1341 }
1342
1337 spin_lock(&nn->nn_lock); 1343 spin_lock(&nn->nn_lock);
1338 /* see if we already have one pending or have given up */ 1344 /* see if we already have one pending or have given up */
1339 if (nn->nn_sc || nn->nn_persistent_error) 1345 if (nn->nn_sc || nn->nn_persistent_error)
@@ -1361,12 +1367,14 @@ static void o2net_start_connect(void *arg)
1361 sock->sk->sk_allocation = GFP_ATOMIC; 1367 sock->sk->sk_allocation = GFP_ATOMIC;
1362 1368
1363 myaddr.sin_family = AF_INET; 1369 myaddr.sin_family = AF_INET;
1370 myaddr.sin_addr.s_addr = (__force u32)mynode->nd_ipv4_address;
1364 myaddr.sin_port = (__force u16)htons(0); /* any port */ 1371 myaddr.sin_port = (__force u16)htons(0); /* any port */
1365 1372
1366 ret = sock->ops->bind(sock, (struct sockaddr *)&myaddr, 1373 ret = sock->ops->bind(sock, (struct sockaddr *)&myaddr,
1367 sizeof(myaddr)); 1374 sizeof(myaddr));
1368 if (ret) { 1375 if (ret) {
1369 mlog(0, "bind failed: %d\n", ret); 1376 mlog(ML_ERROR, "bind failed with %d at address %u.%u.%u.%u\n",
1377 ret, NIPQUAD(mynode->nd_ipv4_address));
1370 goto out; 1378 goto out;
1371 } 1379 }
1372 1380
@@ -1407,6 +1415,8 @@ out:
1407 sc_put(sc); 1415 sc_put(sc);
1408 if (node) 1416 if (node)
1409 o2nm_node_put(node); 1417 o2nm_node_put(node);
1418 if (mynode)
1419 o2nm_node_put(mynode);
1410 1420
1411 return; 1421 return;
1412} 1422}
diff --git a/fs/ocfs2/cluster/tcp.h b/fs/ocfs2/cluster/tcp.h
index a6f4585501c..616ff2b8434 100644
--- a/fs/ocfs2/cluster/tcp.h
+++ b/fs/ocfs2/cluster/tcp.h
@@ -85,13 +85,10 @@ enum {
85 O2NET_DRIVER_READY, 85 O2NET_DRIVER_READY,
86}; 86};
87 87
88int o2net_init_tcp_sock(struct inode *inode);
89int o2net_send_message(u32 msg_type, u32 key, void *data, u32 len, 88int o2net_send_message(u32 msg_type, u32 key, void *data, u32 len,
90 u8 target_node, int *status); 89 u8 target_node, int *status);
91int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *vec, 90int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *vec,
92 size_t veclen, u8 target_node, int *status); 91 size_t veclen, u8 target_node, int *status);
93int o2net_broadcast_message(u32 msg_type, u32 key, void *data, u32 len,
94 struct inode *group);
95 92
96int o2net_register_handler(u32 msg_type, u32 key, u32 max_len, 93int o2net_register_handler(u32 msg_type, u32 key, u32 max_len,
97 o2net_msg_handler_func *func, void *data, 94 o2net_msg_handler_func *func, void *data,
@@ -107,7 +104,5 @@ void o2net_disconnect_node(struct o2nm_node *node);
107 104
108int o2net_init(void); 105int o2net_init(void);
109void o2net_exit(void); 106void o2net_exit(void);
110int o2net_proc_init(struct proc_dir_entry *parent);
111void o2net_proc_exit(struct proc_dir_entry *parent);
112 107
113#endif /* O2CLUSTER_TCP_H */ 108#endif /* O2CLUSTER_TCP_H */
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
index 23ceaa7127b..9c772583744 100644
--- a/fs/ocfs2/dlm/dlmcommon.h
+++ b/fs/ocfs2/dlm/dlmcommon.h
@@ -37,9 +37,7 @@
37#define DLM_THREAD_SHUFFLE_INTERVAL 5 // flush everything every 5 passes 37#define DLM_THREAD_SHUFFLE_INTERVAL 5 // flush everything every 5 passes
38#define DLM_THREAD_MS 200 // flush at least every 200 ms 38#define DLM_THREAD_MS 200 // flush at least every 200 ms
39 39
40#define DLM_HASH_BITS 7 40#define DLM_HASH_BUCKETS (PAGE_SIZE / sizeof(struct hlist_head))
41#define DLM_HASH_SIZE (1 << DLM_HASH_BITS)
42#define DLM_HASH_MASK (DLM_HASH_SIZE - 1)
43 41
44enum dlm_ast_type { 42enum dlm_ast_type {
45 DLM_AST = 0, 43 DLM_AST = 0,
@@ -87,7 +85,7 @@ enum dlm_ctxt_state {
87struct dlm_ctxt 85struct dlm_ctxt
88{ 86{
89 struct list_head list; 87 struct list_head list;
90 struct list_head *resources; 88 struct hlist_head *lockres_hash;
91 struct list_head dirty_list; 89 struct list_head dirty_list;
92 struct list_head purge_list; 90 struct list_head purge_list;
93 struct list_head pending_asts; 91 struct list_head pending_asts;
@@ -217,7 +215,7 @@ struct dlm_lock_resource
217{ 215{
218 /* WARNING: Please see the comment in dlm_init_lockres before 216 /* WARNING: Please see the comment in dlm_init_lockres before
219 * adding fields here. */ 217 * adding fields here. */
220 struct list_head list; 218 struct hlist_node hash_node;
221 struct kref refs; 219 struct kref refs;
222 220
223 /* please keep these next 3 in this order 221 /* please keep these next 3 in this order
diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c
index f339fe27975..54f61b76ab5 100644
--- a/fs/ocfs2/dlm/dlmdebug.c
+++ b/fs/ocfs2/dlm/dlmdebug.c
@@ -117,8 +117,8 @@ EXPORT_SYMBOL_GPL(dlm_print_one_lock);
117void dlm_dump_lock_resources(struct dlm_ctxt *dlm) 117void dlm_dump_lock_resources(struct dlm_ctxt *dlm)
118{ 118{
119 struct dlm_lock_resource *res; 119 struct dlm_lock_resource *res;
120 struct list_head *iter; 120 struct hlist_node *iter;
121 struct list_head *bucket; 121 struct hlist_head *bucket;
122 int i; 122 int i;
123 123
124 mlog(ML_NOTICE, "struct dlm_ctxt: %s, node=%u, key=%u\n", 124 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)
129 } 129 }
130 130
131 spin_lock(&dlm->spinlock); 131 spin_lock(&dlm->spinlock);
132 for (i=0; i<DLM_HASH_SIZE; i++) { 132 for (i=0; i<DLM_HASH_BUCKETS; i++) {
133 bucket = &(dlm->resources[i]); 133 bucket = &(dlm->lockres_hash[i]);
134 list_for_each(iter, bucket) { 134 hlist_for_each_entry(res, iter, bucket, hash_node)
135 res = list_entry(iter, struct dlm_lock_resource, list);
136 dlm_print_one_lock_resource(res); 135 dlm_print_one_lock_resource(res);
137 }
138 } 136 }
139 spin_unlock(&dlm->spinlock); 137 spin_unlock(&dlm->spinlock);
140} 138}
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index 6ee30837389..8f3a9e3106f 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -77,26 +77,26 @@ static void dlm_unregister_domain_handlers(struct dlm_ctxt *dlm);
77 77
78void __dlm_unhash_lockres(struct dlm_lock_resource *lockres) 78void __dlm_unhash_lockres(struct dlm_lock_resource *lockres)
79{ 79{
80 list_del_init(&lockres->list); 80 hlist_del_init(&lockres->hash_node);
81 dlm_lockres_put(lockres); 81 dlm_lockres_put(lockres);
82} 82}
83 83
84void __dlm_insert_lockres(struct dlm_ctxt *dlm, 84void __dlm_insert_lockres(struct dlm_ctxt *dlm,
85 struct dlm_lock_resource *res) 85 struct dlm_lock_resource *res)
86{ 86{
87 struct list_head *bucket; 87 struct hlist_head *bucket;
88 struct qstr *q; 88 struct qstr *q;
89 89
90 assert_spin_locked(&dlm->spinlock); 90 assert_spin_locked(&dlm->spinlock);
91 91
92 q = &res->lockname; 92 q = &res->lockname;
93 q->hash = full_name_hash(q->name, q->len); 93 q->hash = full_name_hash(q->name, q->len);
94 bucket = &(dlm->resources[q->hash & DLM_HASH_MASK]); 94 bucket = &(dlm->lockres_hash[q->hash % DLM_HASH_BUCKETS]);
95 95
96 /* get a reference for our hashtable */ 96 /* get a reference for our hashtable */
97 dlm_lockres_get(res); 97 dlm_lockres_get(res);
98 98
99 list_add_tail(&res->list, bucket); 99 hlist_add_head(&res->hash_node, bucket);
100} 100}
101 101
102struct dlm_lock_resource * __dlm_lookup_lockres(struct dlm_ctxt *dlm, 102struct 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,
104 unsigned int len) 104 unsigned int len)
105{ 105{
106 unsigned int hash; 106 unsigned int hash;
107 struct list_head *iter; 107 struct hlist_node *iter;
108 struct dlm_lock_resource *tmpres=NULL; 108 struct dlm_lock_resource *tmpres=NULL;
109 struct list_head *bucket; 109 struct hlist_head *bucket;
110 110
111 mlog_entry("%.*s\n", len, name); 111 mlog_entry("%.*s\n", len, name);
112 112
@@ -114,11 +114,11 @@ struct dlm_lock_resource * __dlm_lookup_lockres(struct dlm_ctxt *dlm,
114 114
115 hash = full_name_hash(name, len); 115 hash = full_name_hash(name, len);
116 116
117 bucket = &(dlm->resources[hash & DLM_HASH_MASK]); 117 bucket = &(dlm->lockres_hash[hash % DLM_HASH_BUCKETS]);
118 118
119 /* check for pre-existing lock */ 119 /* check for pre-existing lock */
120 list_for_each(iter, bucket) { 120 hlist_for_each(iter, bucket) {
121 tmpres = list_entry(iter, struct dlm_lock_resource, list); 121 tmpres = hlist_entry(iter, struct dlm_lock_resource, hash_node);
122 if (tmpres->lockname.len == len && 122 if (tmpres->lockname.len == len &&
123 memcmp(tmpres->lockname.name, name, len) == 0) { 123 memcmp(tmpres->lockname.name, name, len) == 0) {
124 dlm_lockres_get(tmpres); 124 dlm_lockres_get(tmpres);
@@ -193,8 +193,8 @@ static int dlm_wait_on_domain_helper(const char *domain)
193 193
194static void dlm_free_ctxt_mem(struct dlm_ctxt *dlm) 194static void dlm_free_ctxt_mem(struct dlm_ctxt *dlm)
195{ 195{
196 if (dlm->resources) 196 if (dlm->lockres_hash)
197 free_page((unsigned long) dlm->resources); 197 free_page((unsigned long) dlm->lockres_hash);
198 198
199 if (dlm->name) 199 if (dlm->name)
200 kfree(dlm->name); 200 kfree(dlm->name);
@@ -303,10 +303,10 @@ static void dlm_migrate_all_locks(struct dlm_ctxt *dlm)
303 mlog(0, "Migrating locks from domain %s\n", dlm->name); 303 mlog(0, "Migrating locks from domain %s\n", dlm->name);
304restart: 304restart:
305 spin_lock(&dlm->spinlock); 305 spin_lock(&dlm->spinlock);
306 for (i=0; i<DLM_HASH_SIZE; i++) { 306 for (i = 0; i < DLM_HASH_BUCKETS; i++) {
307 while (!list_empty(&dlm->resources[i])) { 307 while (!hlist_empty(&dlm->lockres_hash[i])) {
308 res = list_entry(dlm->resources[i].next, 308 res = hlist_entry(dlm->lockres_hash[i].first,
309 struct dlm_lock_resource, list); 309 struct dlm_lock_resource, hash_node);
310 /* need reference when manually grabbing lockres */ 310 /* need reference when manually grabbing lockres */
311 dlm_lockres_get(res); 311 dlm_lockres_get(res);
312 /* this should unhash the lockres 312 /* this should unhash the lockres
@@ -1191,18 +1191,17 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
1191 goto leave; 1191 goto leave;
1192 } 1192 }
1193 1193
1194 dlm->resources = (struct list_head *) __get_free_page(GFP_KERNEL); 1194 dlm->lockres_hash = (struct hlist_head *) __get_free_page(GFP_KERNEL);
1195 if (!dlm->resources) { 1195 if (!dlm->lockres_hash) {
1196 mlog_errno(-ENOMEM); 1196 mlog_errno(-ENOMEM);
1197 kfree(dlm->name); 1197 kfree(dlm->name);
1198 kfree(dlm); 1198 kfree(dlm);
1199 dlm = NULL; 1199 dlm = NULL;
1200 goto leave; 1200 goto leave;
1201 } 1201 }
1202 memset(dlm->resources, 0, PAGE_SIZE);
1203 1202
1204 for (i=0; i<DLM_HASH_SIZE; i++) 1203 for (i=0; i<DLM_HASH_BUCKETS; i++)
1205 INIT_LIST_HEAD(&dlm->resources[i]); 1204 INIT_HLIST_HEAD(&dlm->lockres_hash[i]);
1206 1205
1207 strcpy(dlm->name, domain); 1206 strcpy(dlm->name, domain);
1208 dlm->key = key; 1207 dlm->key = key;
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 2e2e95e6949..847dd3cc4cf 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -564,7 +564,7 @@ static void dlm_lockres_release(struct kref *kref)
564 564
565 /* By the time we're ready to blow this guy away, we shouldn't 565 /* By the time we're ready to blow this guy away, we shouldn't
566 * be on any lists. */ 566 * be on any lists. */
567 BUG_ON(!list_empty(&res->list)); 567 BUG_ON(!hlist_unhashed(&res->hash_node));
568 BUG_ON(!list_empty(&res->granted)); 568 BUG_ON(!list_empty(&res->granted));
569 BUG_ON(!list_empty(&res->converting)); 569 BUG_ON(!list_empty(&res->converting));
570 BUG_ON(!list_empty(&res->blocked)); 570 BUG_ON(!list_empty(&res->blocked));
@@ -605,7 +605,7 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm,
605 605
606 init_waitqueue_head(&res->wq); 606 init_waitqueue_head(&res->wq);
607 spin_lock_init(&res->spinlock); 607 spin_lock_init(&res->spinlock);
608 INIT_LIST_HEAD(&res->list); 608 INIT_HLIST_NODE(&res->hash_node);
609 INIT_LIST_HEAD(&res->granted); 609 INIT_LIST_HEAD(&res->granted);
610 INIT_LIST_HEAD(&res->converting); 610 INIT_LIST_HEAD(&res->converting);
611 INIT_LIST_HEAD(&res->blocked); 611 INIT_LIST_HEAD(&res->blocked);
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index ed76bda1a53..1e232000f3f 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -1693,7 +1693,10 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm,
1693 u8 dead_node, u8 new_master) 1693 u8 dead_node, u8 new_master)
1694{ 1694{
1695 int i; 1695 int i;
1696 struct list_head *iter, *iter2, *bucket; 1696 struct list_head *iter, *iter2;
1697 struct hlist_node *hash_iter;
1698 struct hlist_head *bucket;
1699
1697 struct dlm_lock_resource *res; 1700 struct dlm_lock_resource *res;
1698 1701
1699 mlog_entry_void(); 1702 mlog_entry_void();
@@ -1717,10 +1720,9 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm,
1717 * for now we need to run the whole hash, clear 1720 * for now we need to run the whole hash, clear
1718 * the RECOVERING state and set the owner 1721 * the RECOVERING state and set the owner
1719 * if necessary */ 1722 * if necessary */
1720 for (i=0; i<DLM_HASH_SIZE; i++) { 1723 for (i = 0; i < DLM_HASH_BUCKETS; i++) {
1721 bucket = &(dlm->resources[i]); 1724 bucket = &(dlm->lockres_hash[i]);
1722 list_for_each(iter, bucket) { 1725 hlist_for_each_entry(res, hash_iter, bucket, hash_node) {
1723 res = list_entry (iter, struct dlm_lock_resource, list);
1724 if (res->state & DLM_LOCK_RES_RECOVERING) { 1726 if (res->state & DLM_LOCK_RES_RECOVERING) {
1725 if (res->owner == dead_node) { 1727 if (res->owner == dead_node) {
1726 mlog(0, "(this=%u) res %.*s owner=%u " 1728 mlog(0, "(this=%u) res %.*s owner=%u "
@@ -1852,10 +1854,10 @@ static void dlm_free_dead_locks(struct dlm_ctxt *dlm,
1852 1854
1853static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node) 1855static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node)
1854{ 1856{
1855 struct list_head *iter; 1857 struct hlist_node *iter;
1856 struct dlm_lock_resource *res; 1858 struct dlm_lock_resource *res;
1857 int i; 1859 int i;
1858 struct list_head *bucket; 1860 struct hlist_head *bucket;
1859 struct dlm_lock *lock; 1861 struct dlm_lock *lock;
1860 1862
1861 1863
@@ -1876,10 +1878,9 @@ static void dlm_do_local_recovery_cleanup(struct dlm_ctxt *dlm, u8 dead_node)
1876 * can be kicked again to see if any ASTs or BASTs 1878 * can be kicked again to see if any ASTs or BASTs
1877 * need to be fired as a result. 1879 * need to be fired as a result.
1878 */ 1880 */
1879 for (i=0; i<DLM_HASH_SIZE; i++) { 1881 for (i = 0; i < DLM_HASH_BUCKETS; i++) {
1880 bucket = &(dlm->resources[i]); 1882 bucket = &(dlm->lockres_hash[i]);
1881 list_for_each(iter, bucket) { 1883 hlist_for_each_entry(res, iter, bucket, hash_node) {
1882 res = list_entry (iter, struct dlm_lock_resource, list);
1883 /* always prune any $RECOVERY entries for dead nodes, 1884 /* always prune any $RECOVERY entries for dead nodes,
1884 * otherwise hangs can occur during later recovery */ 1885 * otherwise hangs can occur during later recovery */
1885 if (dlm_is_recovery_lock(res->lockname.name, 1886 if (dlm_is_recovery_lock(res->lockname.name,
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c
index b6ba292e954..e6f207eebab 100644
--- a/fs/ocfs2/extent_map.c
+++ b/fs/ocfs2/extent_map.c
@@ -181,6 +181,12 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode,
181 ret = -EBADR; 181 ret = -EBADR;
182 if (rec_end > OCFS2_I(inode)->ip_clusters) { 182 if (rec_end > OCFS2_I(inode)->ip_clusters) {
183 mlog_errno(ret); 183 mlog_errno(ret);
184 ocfs2_error(inode->i_sb,
185 "Extent %d at e_blkno %"MLFu64" of inode %"MLFu64" goes past ip_clusters of %u\n",
186 i,
187 le64_to_cpu(rec->e_blkno),
188 OCFS2_I(inode)->ip_blkno,
189 OCFS2_I(inode)->ip_clusters);
184 goto out_free; 190 goto out_free;
185 } 191 }
186 192
@@ -226,6 +232,12 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode,
226 ret = -EBADR; 232 ret = -EBADR;
227 if (blkno) { 233 if (blkno) {
228 mlog_errno(ret); 234 mlog_errno(ret);
235 ocfs2_error(inode->i_sb,
236 "Multiple extents for (cpos = %u, clusters = %u) on inode %"MLFu64"; e_blkno %"MLFu64" and rec %d at e_blkno %"MLFu64"\n",
237 cpos, clusters,
238 OCFS2_I(inode)->ip_blkno,
239 blkno, i,
240 le64_to_cpu(rec->e_blkno));
229 goto out_free; 241 goto out_free;
230 } 242 }
231 243
@@ -238,6 +250,10 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode,
238 */ 250 */
239 ret = -EBADR; 251 ret = -EBADR;
240 if (!blkno) { 252 if (!blkno) {
253 ocfs2_error(inode->i_sb,
254 "No record found for (cpos = %u, clusters = %u) on inode %"MLFu64"\n",
255 cpos, clusters,
256 OCFS2_I(inode)->ip_blkno);
241 mlog_errno(ret); 257 mlog_errno(ret);
242 goto out_free; 258 goto out_free;
243 } 259 }
@@ -266,6 +282,20 @@ static int ocfs2_extent_map_find_leaf(struct inode *inode,
266 282
267 for (i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) { 283 for (i = 0; i < le16_to_cpu(el->l_next_free_rec); i++) {
268 rec = &el->l_recs[i]; 284 rec = &el->l_recs[i];
285
286 if ((le32_to_cpu(rec->e_cpos) + le32_to_cpu(rec->e_clusters)) >
287 OCFS2_I(inode)->ip_clusters) {
288 ret = -EBADR;
289 mlog_errno(ret);
290 ocfs2_error(inode->i_sb,
291 "Extent %d at e_blkno %"MLFu64" of inode %"MLFu64" goes past ip_clusters of %u\n",
292 i,
293 le64_to_cpu(rec->e_blkno),
294 OCFS2_I(inode)->ip_blkno,
295 OCFS2_I(inode)->ip_clusters);
296 return ret;
297 }
298
269 ret = ocfs2_extent_map_insert(inode, rec, 299 ret = ocfs2_extent_map_insert(inode, rec,
270 le16_to_cpu(el->l_tree_depth)); 300 le16_to_cpu(el->l_tree_depth));
271 if (ret) { 301 if (ret) {
@@ -526,6 +556,10 @@ static int ocfs2_extent_map_insert(struct inode *inode,
526 OCFS2_I(inode)->ip_map.em_clusters) { 556 OCFS2_I(inode)->ip_map.em_clusters) {
527 ret = -EBADR; 557 ret = -EBADR;
528 mlog_errno(ret); 558 mlog_errno(ret);
559 ocfs2_error(inode->i_sb,
560 "Zero e_clusters on non-tail extent record at e_blkno %"MLFu64" on inode %"MLFu64"\n",
561 le64_to_cpu(rec->e_blkno),
562 OCFS2_I(inode)->ip_blkno);
529 return ret; 563 return ret;
530 } 564 }
531 565
@@ -588,12 +622,12 @@ static int ocfs2_extent_map_insert(struct inode *inode,
588 * Existing record in the extent map: 622 * Existing record in the extent map:
589 * 623 *
590 * cpos = 10, len = 10 624 * cpos = 10, len = 10
591 * |---------| 625 * |---------|
592 * 626 *
593 * New Record: 627 * New Record:
594 * 628 *
595 * cpos = 10, len = 20 629 * cpos = 10, len = 20
596 * |------------------| 630 * |------------------|
597 * 631 *
598 * The passed record is the new on-disk record. The new_clusters value 632 * The passed record is the new on-disk record. The new_clusters value
599 * is how many clusters were added to the file. If the append is a 633 * is how many clusters were added to the file. If the append is a
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 1715bc90e70..8a4048b55fd 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -933,9 +933,6 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
933 struct file *filp = iocb->ki_filp; 933 struct file *filp = iocb->ki_filp;
934 struct inode *inode = filp->f_dentry->d_inode; 934 struct inode *inode = filp->f_dentry->d_inode;
935 loff_t newsize, saved_pos; 935 loff_t newsize, saved_pos;
936#ifdef OCFS2_ORACORE_WORKAROUNDS
937 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
938#endif
939 936
940 mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", filp, buf, 937 mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", filp, buf,
941 (unsigned int)count, 938 (unsigned int)count,
@@ -951,14 +948,6 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
951 return -EIO; 948 return -EIO;
952 } 949 }
953 950
954#ifdef OCFS2_ORACORE_WORKAROUNDS
955 /* ugh, work around some applications which open everything O_DIRECT +
956 * O_APPEND and really don't mean to use O_DIRECT. */
957 if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS &&
958 (filp->f_flags & O_APPEND) && (filp->f_flags & O_DIRECT))
959 filp->f_flags &= ~O_DIRECT;
960#endif
961
962 mutex_lock(&inode->i_mutex); 951 mutex_lock(&inode->i_mutex);
963 /* to match setattr's i_mutex -> i_alloc_sem -> rw_lock ordering */ 952 /* to match setattr's i_mutex -> i_alloc_sem -> rw_lock ordering */
964 if (filp->f_flags & O_DIRECT) { 953 if (filp->f_flags & O_DIRECT) {
@@ -1079,27 +1068,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
1079 /* communicate with ocfs2_dio_end_io */ 1068 /* communicate with ocfs2_dio_end_io */
1080 ocfs2_iocb_set_rw_locked(iocb); 1069 ocfs2_iocb_set_rw_locked(iocb);
1081 1070
1082#ifdef OCFS2_ORACORE_WORKAROUNDS 1071 ret = generic_file_aio_write_nolock(iocb, &local_iov, 1, &iocb->ki_pos);
1083 if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS &&
1084 filp->f_flags & O_DIRECT) {
1085 unsigned int saved_flags = filp->f_flags;
1086 int sector_size = 1 << osb->s_sectsize_bits;
1087
1088 if ((saved_pos & (sector_size - 1)) ||
1089 (count & (sector_size - 1)) ||
1090 ((unsigned long)buf & (sector_size - 1))) {
1091 filp->f_flags |= O_SYNC;
1092 filp->f_flags &= ~O_DIRECT;
1093 }
1094
1095 ret = generic_file_aio_write_nolock(iocb, &local_iov, 1,
1096 &iocb->ki_pos);
1097
1098 filp->f_flags = saved_flags;
1099 } else
1100#endif
1101 ret = generic_file_aio_write_nolock(iocb, &local_iov, 1,
1102 &iocb->ki_pos);
1103 1072
1104 /* buffered aio wouldn't have proper lock coverage today */ 1073 /* buffered aio wouldn't have proper lock coverage today */
1105 BUG_ON(ret == -EIOCBQUEUED && !(filp->f_flags & O_DIRECT)); 1074 BUG_ON(ret == -EIOCBQUEUED && !(filp->f_flags & O_DIRECT));
@@ -1140,9 +1109,6 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
1140 int ret = 0, rw_level = -1, have_alloc_sem = 0; 1109 int ret = 0, rw_level = -1, have_alloc_sem = 0;
1141 struct file *filp = iocb->ki_filp; 1110 struct file *filp = iocb->ki_filp;
1142 struct inode *inode = filp->f_dentry->d_inode; 1111 struct inode *inode = filp->f_dentry->d_inode;
1143#ifdef OCFS2_ORACORE_WORKAROUNDS
1144 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1145#endif
1146 1112
1147 mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", filp, buf, 1113 mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", filp, buf,
1148 (unsigned int)count, 1114 (unsigned int)count,
@@ -1155,21 +1121,6 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb,
1155 goto bail; 1121 goto bail;
1156 } 1122 }
1157 1123
1158#ifdef OCFS2_ORACORE_WORKAROUNDS
1159 if (osb->s_mount_opt & OCFS2_MOUNT_COMPAT_OCFS) {
1160 if (filp->f_flags & O_DIRECT) {
1161 int sector_size = 1 << osb->s_sectsize_bits;
1162
1163 if ((pos & (sector_size - 1)) ||
1164 (count & (sector_size - 1)) ||
1165 ((unsigned long)buf & (sector_size - 1)) ||
1166 (i_size_read(inode) & (sector_size -1))) {
1167 filp->f_flags &= ~O_DIRECT;
1168 }
1169 }
1170 }
1171#endif
1172
1173 /* 1124 /*
1174 * buffered reads protect themselves in ->readpage(). O_DIRECT reads 1125 * buffered reads protect themselves in ->readpage(). O_DIRECT reads
1175 * need locks to protect pending reads from racing with truncate. 1126 * need locks to protect pending reads from racing with truncate.
diff --git a/fs/ocfs2/heartbeat.c b/fs/ocfs2/heartbeat.c
index 0bbd22f46c8..cbfd45a97a6 100644
--- a/fs/ocfs2/heartbeat.c
+++ b/fs/ocfs2/heartbeat.c
@@ -67,6 +67,7 @@ void ocfs2_init_node_maps(struct ocfs2_super *osb)
67 ocfs2_node_map_init(&osb->mounted_map); 67 ocfs2_node_map_init(&osb->mounted_map);
68 ocfs2_node_map_init(&osb->recovery_map); 68 ocfs2_node_map_init(&osb->recovery_map);
69 ocfs2_node_map_init(&osb->umount_map); 69 ocfs2_node_map_init(&osb->umount_map);
70 ocfs2_node_map_init(&osb->osb_recovering_orphan_dirs);
70} 71}
71 72
72static void ocfs2_do_node_down(int node_num, 73static void ocfs2_do_node_down(int node_num,
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 8122489c576..315472a5c19 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -41,6 +41,7 @@
41#include "dlmglue.h" 41#include "dlmglue.h"
42#include "extent_map.h" 42#include "extent_map.h"
43#include "file.h" 43#include "file.h"
44#include "heartbeat.h"
44#include "inode.h" 45#include "inode.h"
45#include "journal.h" 46#include "journal.h"
46#include "namei.h" 47#include "namei.h"
@@ -544,6 +545,42 @@ bail:
544 return status; 545 return status;
545} 546}
546 547
548/*
549 * Serialize with orphan dir recovery. If the process doing
550 * recovery on this orphan dir does an iget() with the dir
551 * i_mutex held, we'll deadlock here. Instead we detect this
552 * and exit early - recovery will wipe this inode for us.
553 */
554static int ocfs2_check_orphan_recovery_state(struct ocfs2_super *osb,
555 int slot)
556{
557 int ret = 0;
558
559 spin_lock(&osb->osb_lock);
560 if (ocfs2_node_map_test_bit(osb, &osb->osb_recovering_orphan_dirs, slot)) {
561 mlog(0, "Recovery is happening on orphan dir %d, will skip "
562 "this inode\n", slot);
563 ret = -EDEADLK;
564 goto out;
565 }
566 /* This signals to the orphan recovery process that it should
567 * wait for us to handle the wipe. */
568 osb->osb_orphan_wipes[slot]++;
569out:
570 spin_unlock(&osb->osb_lock);
571 return ret;
572}
573
574static void ocfs2_signal_wipe_completion(struct ocfs2_super *osb,
575 int slot)
576{
577 spin_lock(&osb->osb_lock);
578 osb->osb_orphan_wipes[slot]--;
579 spin_unlock(&osb->osb_lock);
580
581 wake_up(&osb->osb_wipe_event);
582}
583
547static int ocfs2_wipe_inode(struct inode *inode, 584static int ocfs2_wipe_inode(struct inode *inode,
548 struct buffer_head *di_bh) 585 struct buffer_head *di_bh)
549{ 586{
@@ -555,6 +592,11 @@ static int ocfs2_wipe_inode(struct inode *inode,
555 /* We've already voted on this so it should be readonly - no 592 /* We've already voted on this so it should be readonly - no
556 * spinlock needed. */ 593 * spinlock needed. */
557 orphaned_slot = OCFS2_I(inode)->ip_orphaned_slot; 594 orphaned_slot = OCFS2_I(inode)->ip_orphaned_slot;
595
596 status = ocfs2_check_orphan_recovery_state(osb, orphaned_slot);
597 if (status)
598 return status;
599
558 orphan_dir_inode = ocfs2_get_system_file_inode(osb, 600 orphan_dir_inode = ocfs2_get_system_file_inode(osb,
559 ORPHAN_DIR_SYSTEM_INODE, 601 ORPHAN_DIR_SYSTEM_INODE,
560 orphaned_slot); 602 orphaned_slot);
@@ -597,6 +639,7 @@ bail_unlock_dir:
597 brelse(orphan_dir_bh); 639 brelse(orphan_dir_bh);
598bail: 640bail:
599 iput(orphan_dir_inode); 641 iput(orphan_dir_inode);
642 ocfs2_signal_wipe_completion(osb, orphaned_slot);
600 643
601 return status; 644 return status;
602} 645}
@@ -822,7 +865,8 @@ void ocfs2_delete_inode(struct inode *inode)
822 865
823 status = ocfs2_wipe_inode(inode, di_bh); 866 status = ocfs2_wipe_inode(inode, di_bh);
824 if (status < 0) { 867 if (status < 0) {
825 mlog_errno(status); 868 if (status != -EDEADLK)
869 mlog_errno(status);
826 goto bail_unlock_inode; 870 goto bail_unlock_inode;
827 } 871 }
828 872
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index d329c9df90a..4be801f4559 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -1408,21 +1408,17 @@ bail:
1408 return status; 1408 return status;
1409} 1409}
1410 1410
1411static int ocfs2_recover_orphans(struct ocfs2_super *osb, 1411static int ocfs2_queue_orphans(struct ocfs2_super *osb,
1412 int slot) 1412 int slot,
1413 struct inode **head)
1413{ 1414{
1414 int status = 0; 1415 int status;
1415 int have_disk_lock = 0;
1416 struct inode *inode = NULL;
1417 struct inode *iter;
1418 struct inode *orphan_dir_inode = NULL; 1416 struct inode *orphan_dir_inode = NULL;
1417 struct inode *iter;
1419 unsigned long offset, blk, local; 1418 unsigned long offset, blk, local;
1420 struct buffer_head *bh = NULL; 1419 struct buffer_head *bh = NULL;
1421 struct ocfs2_dir_entry *de; 1420 struct ocfs2_dir_entry *de;
1422 struct super_block *sb = osb->sb; 1421 struct super_block *sb = osb->sb;
1423 struct ocfs2_inode_info *oi;
1424
1425 mlog(0, "Recover inodes from orphan dir in slot %d\n", slot);
1426 1422
1427 orphan_dir_inode = ocfs2_get_system_file_inode(osb, 1423 orphan_dir_inode = ocfs2_get_system_file_inode(osb,
1428 ORPHAN_DIR_SYSTEM_INODE, 1424 ORPHAN_DIR_SYSTEM_INODE,
@@ -1430,17 +1426,15 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,
1430 if (!orphan_dir_inode) { 1426 if (!orphan_dir_inode) {
1431 status = -ENOENT; 1427 status = -ENOENT;
1432 mlog_errno(status); 1428 mlog_errno(status);
1433 goto out; 1429 return status;
1434 } 1430 }
1435 1431
1436 mutex_lock(&orphan_dir_inode->i_mutex); 1432 mutex_lock(&orphan_dir_inode->i_mutex);
1437 status = ocfs2_meta_lock(orphan_dir_inode, NULL, NULL, 0); 1433 status = ocfs2_meta_lock(orphan_dir_inode, NULL, NULL, 0);
1438 if (status < 0) { 1434 if (status < 0) {
1439 mutex_unlock(&orphan_dir_inode->i_mutex);
1440 mlog_errno(status); 1435 mlog_errno(status);
1441 goto out; 1436 goto out;
1442 } 1437 }
1443 have_disk_lock = 1;
1444 1438
1445 offset = 0; 1439 offset = 0;
1446 iter = NULL; 1440 iter = NULL;
@@ -1451,11 +1445,10 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,
1451 if (!bh) 1445 if (!bh)
1452 status = -EINVAL; 1446 status = -EINVAL;
1453 if (status < 0) { 1447 if (status < 0) {
1454 mutex_unlock(&orphan_dir_inode->i_mutex);
1455 if (bh) 1448 if (bh)
1456 brelse(bh); 1449 brelse(bh);
1457 mlog_errno(status); 1450 mlog_errno(status);
1458 goto out; 1451 goto out_unlock;
1459 } 1452 }
1460 1453
1461 local = 0; 1454 local = 0;
@@ -1465,11 +1458,10 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,
1465 1458
1466 if (!ocfs2_check_dir_entry(orphan_dir_inode, 1459 if (!ocfs2_check_dir_entry(orphan_dir_inode,
1467 de, bh, local)) { 1460 de, bh, local)) {
1468 mutex_unlock(&orphan_dir_inode->i_mutex);
1469 status = -EINVAL; 1461 status = -EINVAL;
1470 mlog_errno(status); 1462 mlog_errno(status);
1471 brelse(bh); 1463 brelse(bh);
1472 goto out; 1464 goto out_unlock;
1473 } 1465 }
1474 1466
1475 local += le16_to_cpu(de->rec_len); 1467 local += le16_to_cpu(de->rec_len);
@@ -1504,18 +1496,95 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,
1504 1496
1505 mlog(0, "queue orphan %"MLFu64"\n", 1497 mlog(0, "queue orphan %"MLFu64"\n",
1506 OCFS2_I(iter)->ip_blkno); 1498 OCFS2_I(iter)->ip_blkno);
1507 OCFS2_I(iter)->ip_next_orphan = inode; 1499 /* No locking is required for the next_orphan
1508 inode = iter; 1500 * queue as there is only ever a single
1501 * process doing orphan recovery. */
1502 OCFS2_I(iter)->ip_next_orphan = *head;
1503 *head = iter;
1509 } 1504 }
1510 brelse(bh); 1505 brelse(bh);
1511 } 1506 }
1512 mutex_unlock(&orphan_dir_inode->i_mutex);
1513 1507
1508out_unlock:
1514 ocfs2_meta_unlock(orphan_dir_inode, 0); 1509 ocfs2_meta_unlock(orphan_dir_inode, 0);
1515 have_disk_lock = 0; 1510out:
1516 1511 mutex_unlock(&orphan_dir_inode->i_mutex);
1517 iput(orphan_dir_inode); 1512 iput(orphan_dir_inode);
1518 orphan_dir_inode = NULL; 1513 return status;
1514}
1515
1516static int ocfs2_orphan_recovery_can_continue(struct ocfs2_super *osb,
1517 int slot)
1518{
1519 int ret;
1520
1521 spin_lock(&osb->osb_lock);
1522 ret = !osb->osb_orphan_wipes[slot];
1523 spin_unlock(&osb->osb_lock);
1524 return ret;
1525}
1526
1527static void ocfs2_mark_recovering_orphan_dir(struct ocfs2_super *osb,
1528 int slot)
1529{
1530 spin_lock(&osb->osb_lock);
1531 /* Mark ourselves such that new processes in delete_inode()
1532 * know to quit early. */
1533 ocfs2_node_map_set_bit(osb, &osb->osb_recovering_orphan_dirs, slot);
1534 while (osb->osb_orphan_wipes[slot]) {
1535 /* If any processes are already in the middle of an
1536 * orphan wipe on this dir, then we need to wait for
1537 * them. */
1538 spin_unlock(&osb->osb_lock);
1539 wait_event_interruptible(osb->osb_wipe_event,
1540 ocfs2_orphan_recovery_can_continue(osb, slot));
1541 spin_lock(&osb->osb_lock);
1542 }
1543 spin_unlock(&osb->osb_lock);
1544}
1545
1546static void ocfs2_clear_recovering_orphan_dir(struct ocfs2_super *osb,
1547 int slot)
1548{
1549 ocfs2_node_map_clear_bit(osb, &osb->osb_recovering_orphan_dirs, slot);
1550}
1551
1552/*
1553 * Orphan recovery. Each mounted node has it's own orphan dir which we
1554 * must run during recovery. Our strategy here is to build a list of
1555 * the inodes in the orphan dir and iget/iput them. The VFS does
1556 * (most) of the rest of the work.
1557 *
1558 * Orphan recovery can happen at any time, not just mount so we have a
1559 * couple of extra considerations.
1560 *
1561 * - We grab as many inodes as we can under the orphan dir lock -
1562 * doing iget() outside the orphan dir risks getting a reference on
1563 * an invalid inode.
1564 * - We must be sure not to deadlock with other processes on the
1565 * system wanting to run delete_inode(). This can happen when they go
1566 * to lock the orphan dir and the orphan recovery process attempts to
1567 * iget() inside the orphan dir lock. This can be avoided by
1568 * advertising our state to ocfs2_delete_inode().
1569 */
1570static int ocfs2_recover_orphans(struct ocfs2_super *osb,
1571 int slot)
1572{
1573 int ret = 0;
1574 struct inode *inode = NULL;
1575 struct inode *iter;
1576 struct ocfs2_inode_info *oi;
1577
1578 mlog(0, "Recover inodes from orphan dir in slot %d\n", slot);
1579
1580 ocfs2_mark_recovering_orphan_dir(osb, slot);
1581 ret = ocfs2_queue_orphans(osb, slot, &inode);
1582 ocfs2_clear_recovering_orphan_dir(osb, slot);
1583
1584 /* Error here should be noted, but we want to continue with as
1585 * many queued inodes as we've got. */
1586 if (ret)
1587 mlog_errno(ret);
1519 1588
1520 while (inode) { 1589 while (inode) {
1521 oi = OCFS2_I(inode); 1590 oi = OCFS2_I(inode);
@@ -1541,14 +1610,7 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,
1541 inode = iter; 1610 inode = iter;
1542 } 1611 }
1543 1612
1544out: 1613 return ret;
1545 if (have_disk_lock)
1546 ocfs2_meta_unlock(orphan_dir_inode, 0);
1547
1548 if (orphan_dir_inode)
1549 iput(orphan_dir_inode);
1550
1551 return status;
1552} 1614}
1553 1615
1554static int ocfs2_wait_on_mount(struct ocfs2_super *osb) 1616static int ocfs2_wait_on_mount(struct ocfs2_super *osb)
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 8d8e4779df9..e89de9b6e49 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -174,9 +174,6 @@ enum ocfs2_mount_options
174 OCFS2_MOUNT_NOINTR = 1 << 2, /* Don't catch signals */ 174 OCFS2_MOUNT_NOINTR = 1 << 2, /* Don't catch signals */
175 OCFS2_MOUNT_ERRORS_PANIC = 1 << 3, /* Panic on errors */ 175 OCFS2_MOUNT_ERRORS_PANIC = 1 << 3, /* Panic on errors */
176 OCFS2_MOUNT_DATA_WRITEBACK = 1 << 4, /* No data ordering */ 176 OCFS2_MOUNT_DATA_WRITEBACK = 1 << 4, /* No data ordering */
177#ifdef OCFS2_ORACORE_WORKAROUNDS
178 OCFS2_MOUNT_COMPAT_OCFS = 1 << 30, /* ocfs1 compatibility mode */
179#endif
180}; 177};
181 178
182#define OCFS2_OSB_SOFT_RO 0x0001 179#define OCFS2_OSB_SOFT_RO 0x0001
@@ -290,6 +287,10 @@ struct ocfs2_super
290 struct inode *osb_tl_inode; 287 struct inode *osb_tl_inode;
291 struct buffer_head *osb_tl_bh; 288 struct buffer_head *osb_tl_bh;
292 struct work_struct osb_truncate_log_wq; 289 struct work_struct osb_truncate_log_wq;
290
291 struct ocfs2_node_map osb_recovering_orphan_dirs;
292 unsigned int *osb_orphan_wipes;
293 wait_queue_head_t osb_wipe_event;
293}; 294};
294 295
295#define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info) 296#define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info)
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index dfb8a5bedfc..c5b1ac547c1 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -138,7 +138,6 @@
138 138
139/* Journal limits (in bytes) */ 139/* Journal limits (in bytes) */
140#define OCFS2_MIN_JOURNAL_SIZE (4 * 1024 * 1024) 140#define OCFS2_MIN_JOURNAL_SIZE (4 * 1024 * 1024)
141#define OCFS2_MAX_JOURNAL_SIZE (500 * 1024 * 1024)
142 141
143struct ocfs2_system_inode_info { 142struct ocfs2_system_inode_info {
144 char *si_name; 143 char *si_name;
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 046824b6b62..8dd3aafec49 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1325,6 +1325,16 @@ static int ocfs2_initialize_super(struct super_block *sb,
1325 } 1325 }
1326 mlog(ML_NOTICE, "max_slots for this device: %u\n", osb->max_slots); 1326 mlog(ML_NOTICE, "max_slots for this device: %u\n", osb->max_slots);
1327 1327
1328 init_waitqueue_head(&osb->osb_wipe_event);
1329 osb->osb_orphan_wipes = kcalloc(osb->max_slots,
1330 sizeof(*osb->osb_orphan_wipes),
1331 GFP_KERNEL);
1332 if (!osb->osb_orphan_wipes) {
1333 status = -ENOMEM;
1334 mlog_errno(status);
1335 goto bail;
1336 }
1337
1328 osb->s_feature_compat = 1338 osb->s_feature_compat =
1329 le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_compat); 1339 le32_to_cpu(OCFS2_RAW_SB(di)->s_feature_compat);
1330 osb->s_feature_ro_compat = 1340 osb->s_feature_ro_compat =
@@ -1638,6 +1648,7 @@ static void ocfs2_delete_osb(struct ocfs2_super *osb)
1638 if (osb->slot_info) 1648 if (osb->slot_info)
1639 ocfs2_free_slot_info(osb->slot_info); 1649 ocfs2_free_slot_info(osb->slot_info);
1640 1650
1651 kfree(osb->osb_orphan_wipes);
1641 /* FIXME 1652 /* FIXME
1642 * This belongs in journal shutdown, but because we have to 1653 * This belongs in journal shutdown, but because we have to
1643 * allocate osb->journal at the start of ocfs2_initalize_osb(), 1654 * allocate osb->journal at the start of ocfs2_initalize_osb(),
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c
index f3473176c83..be12879bb17 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -1464,13 +1464,11 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t
1464 partially overwritten pages, if needed. And lock the pages, 1464 partially overwritten pages, if needed. And lock the pages,
1465 so that nobody else can access these until we are done. 1465 so that nobody else can access these until we are done.
1466 We get number of actual blocks needed as a result. */ 1466 We get number of actual blocks needed as a result. */
1467 blocks_to_allocate = 1467 res = reiserfs_prepare_file_region_for_write(inode, pos,
1468 reiserfs_prepare_file_region_for_write(inode, pos, 1468 num_pages,
1469 num_pages, 1469 write_bytes,
1470 write_bytes, 1470 prepared_pages);
1471 prepared_pages); 1471 if (res < 0) {
1472 if (blocks_to_allocate < 0) {
1473 res = blocks_to_allocate;
1474 reiserfs_release_claimed_blocks(inode->i_sb, 1472 reiserfs_release_claimed_blocks(inode->i_sb,
1475 num_pages << 1473 num_pages <<
1476 (PAGE_CACHE_SHIFT - 1474 (PAGE_CACHE_SHIFT -
@@ -1478,6 +1476,8 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t
1478 break; 1476 break;
1479 } 1477 }
1480 1478
1479 blocks_to_allocate = res;
1480
1481 /* First we correct our estimate of how many blocks we need */ 1481 /* First we correct our estimate of how many blocks we need */
1482 reiserfs_release_claimed_blocks(inode->i_sb, 1482 reiserfs_release_claimed_blocks(inode->i_sb,
1483 (num_pages << 1483 (num_pages <<
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index b33d67bba2f..d60f6238c66 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -627,11 +627,6 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
627 reiserfs_write_lock(inode->i_sb); 627 reiserfs_write_lock(inode->i_sb);
628 version = get_inode_item_key_version(inode); 628 version = get_inode_item_key_version(inode);
629 629
630 if (block < 0) {
631 reiserfs_write_unlock(inode->i_sb);
632 return -EIO;
633 }
634
635 if (!file_capable(inode, block)) { 630 if (!file_capable(inode, block)) {
636 reiserfs_write_unlock(inode->i_sb); 631 reiserfs_write_unlock(inode->i_sb);
637 return -EFBIG; 632 return -EFBIG;
@@ -934,12 +929,13 @@ int reiserfs_get_block(struct inode *inode, sector_t block,
934 //pos_in_item * inode->i_sb->s_blocksize, 929 //pos_in_item * inode->i_sb->s_blocksize,
935 TYPE_INDIRECT, 3); // key type is unimportant 930 TYPE_INDIRECT, 3); // key type is unimportant
936 931
932 RFALSE(cpu_key_k_offset(&tmp_key) > cpu_key_k_offset(&key),
933 "green-805: invalid offset");
937 blocks_needed = 934 blocks_needed =
938 1 + 935 1 +
939 ((cpu_key_k_offset(&key) - 936 ((cpu_key_k_offset(&key) -
940 cpu_key_k_offset(&tmp_key)) >> inode->i_sb-> 937 cpu_key_k_offset(&tmp_key)) >> inode->i_sb->
941 s_blocksize_bits); 938 s_blocksize_bits);
942 RFALSE(blocks_needed < 0, "green-805: invalid offset");
943 939
944 if (blocks_needed == 1) { 940 if (blocks_needed == 1) {
945 un = &unf_single; 941 un = &unf_single;
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index b7a179560ab..5a9d2722fa0 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -2319,8 +2319,7 @@ static int journal_read(struct super_block *p_s_sb)
2319 return 1; 2319 return 1;
2320 } 2320 }
2321 jh = (struct reiserfs_journal_header *)(journal->j_header_bh->b_data); 2321 jh = (struct reiserfs_journal_header *)(journal->j_header_bh->b_data);
2322 if (le32_to_cpu(jh->j_first_unflushed_offset) >= 0 && 2322 if (le32_to_cpu(jh->j_first_unflushed_offset) <
2323 le32_to_cpu(jh->j_first_unflushed_offset) <
2324 SB_ONDISK_JOURNAL_SIZE(p_s_sb) 2323 SB_ONDISK_JOURNAL_SIZE(p_s_sb)
2325 && le32_to_cpu(jh->j_last_flush_trans_id) > 0) { 2324 && le32_to_cpu(jh->j_last_flush_trans_id) > 0) {
2326 oldest_start = 2325 oldest_start =
diff --git a/include/asm-powerpc/eeh.h b/include/asm-powerpc/eeh.h
index 7dfb408fe2c..eb392032e19 100644
--- a/include/asm-powerpc/eeh.h
+++ b/include/asm-powerpc/eeh.h
@@ -61,6 +61,7 @@ void __init pci_addr_cache_build(void);
61 * to finish the eeh setup for this device. 61 * to finish the eeh setup for this device.
62 */ 62 */
63void eeh_add_device_early(struct device_node *); 63void eeh_add_device_early(struct device_node *);
64void eeh_add_device_late(struct pci_dev *dev);
64void eeh_add_device_tree_early(struct device_node *); 65void eeh_add_device_tree_early(struct device_node *);
65void eeh_add_device_tree_late(struct pci_bus *); 66void eeh_add_device_tree_late(struct pci_bus *);
66 67
diff --git a/include/pcmcia/device_id.h b/include/pcmcia/device_id.h
index 346d81ece28..e04e0b0d9a2 100644
--- a/include/pcmcia/device_id.h
+++ b/include/pcmcia/device_id.h
@@ -72,6 +72,15 @@
72 .prod_id = { (v1), (v2), (v3), (v4) }, \ 72 .prod_id = { (v1), (v2), (v3), (v4) }, \
73 .prod_id_hash = { (vh1), (vh2), (vh3), (vh4) }, } 73 .prod_id_hash = { (vh1), (vh2), (vh3), (vh4) }, }
74 74
75#define PCMCIA_DEVICE_MANF_CARD_PROD_ID1(manf, card, v1, vh1) { \
76 .match_flags = PCMCIA_DEV_ID_MATCH_MANF_ID| \
77 PCMCIA_DEV_ID_MATCH_CARD_ID| \
78 PCMCIA_DEV_ID_MATCH_PROD_ID1, \
79 .manf_id = (manf), \
80 .card_id = (card), \
81 .prod_id = { (v1), NULL, NULL, NULL }, \
82 .prod_id_hash = { (vh1), 0, 0, 0 }, }
83
75 84
76/* multi-function devices */ 85/* multi-function devices */
77 86
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index acf6c1550f2..de2d9109194 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -667,7 +667,7 @@ static ctl_table kern_table[] = {
667 .data = &acpi_video_flags, 667 .data = &acpi_video_flags,
668 .maxlen = sizeof (unsigned long), 668 .maxlen = sizeof (unsigned long),
669 .mode = 0644, 669 .mode = 0644,
670 .proc_handler = &proc_dointvec, 670 .proc_handler = &proc_doulongvec_minmax,
671 }, 671 },
672#endif 672#endif
673#ifdef CONFIG_IA64 673#ifdef CONFIG_IA64
diff --git a/kernel/timer.c b/kernel/timer.c
index fe3a9a9f832..fc6646fd5aa 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1351,10 +1351,10 @@ static inline u64 time_interpolator_get_cycles(unsigned int src)
1351 return x(); 1351 return x();
1352 1352
1353 case TIME_SOURCE_MMIO64 : 1353 case TIME_SOURCE_MMIO64 :
1354 return readq((void __iomem *) time_interpolator->addr); 1354 return readq_relaxed((void __iomem *)time_interpolator->addr);
1355 1355
1356 case TIME_SOURCE_MMIO32 : 1356 case TIME_SOURCE_MMIO32 :
1357 return readl((void __iomem *) time_interpolator->addr); 1357 return readl_relaxed((void __iomem *)time_interpolator->addr);
1358 1358
1359 default: return get_cycles(); 1359 default: return get_cycles();
1360 } 1360 }
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 5643cfed6b0..1a210088ad8 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1793,7 +1793,8 @@ int show_numa_map(struct seq_file *m, void *v)
1793 if (!md) 1793 if (!md)
1794 return 0; 1794 return 0;
1795 1795
1796 check_pgd_range(vma, vma->vm_start, vma->vm_end, 1796 if (!is_vm_hugetlb_page(vma))
1797 check_pgd_range(vma, vma->vm_start, vma->vm_end,
1797 &node_online_map, MPOL_MF_STATS, md); 1798 &node_online_map, MPOL_MF_STATS, md);
1798 1799
1799 if (md->pages) { 1800 if (md->pages) {
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index c86c737d243..78747afad6b 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -355,6 +355,7 @@ retry:
355 } 355 }
356 356
357out: 357out:
358 read_unlock(&tasklist_lock);
358 cpuset_unlock(); 359 cpuset_unlock();
359 if (mm) 360 if (mm)
360 mmput(mm); 361 mmput(mm);
@@ -364,5 +365,5 @@ out:
364 * retry to allocate memory unless "p" is current 365 * retry to allocate memory unless "p" is current
365 */ 366 */
366 if (!test_thread_flag(TIF_MEMDIE)) 367 if (!test_thread_flag(TIF_MEMDIE))
367 schedule_timeout_interruptible(1); 368 schedule_timeout_uninterruptible(1);
368} 369}