diff options
712 files changed, 11917 insertions, 6503 deletions
diff --git a/.gitignore b/.gitignore index 8faa6c02b39e..5d56a3fd0de6 100644 --- a/.gitignore +++ b/.gitignore | |||
@@ -28,6 +28,7 @@ modules.builtin | |||
28 | *.gz | 28 | *.gz |
29 | *.bz2 | 29 | *.bz2 |
30 | *.lzma | 30 | *.lzma |
31 | *.xz | ||
31 | *.lzo | 32 | *.lzo |
32 | *.patch | 33 | *.patch |
33 | *.gcno | 34 | *.gcno |
diff --git a/Documentation/DocBook/filesystems.tmpl b/Documentation/DocBook/filesystems.tmpl index 5e87ad58c0b5..f51f28531b8d 100644 --- a/Documentation/DocBook/filesystems.tmpl +++ b/Documentation/DocBook/filesystems.tmpl | |||
@@ -82,6 +82,11 @@ | |||
82 | </sect1> | 82 | </sect1> |
83 | </chapter> | 83 | </chapter> |
84 | 84 | ||
85 | <chapter id="fs_events"> | ||
86 | <title>Events based on file descriptors</title> | ||
87 | !Efs/eventfd.c | ||
88 | </chapter> | ||
89 | |||
85 | <chapter id="sysfs"> | 90 | <chapter id="sysfs"> |
86 | <title>The Filesystem for Exporting Kernel Objects</title> | 91 | <title>The Filesystem for Exporting Kernel Objects</title> |
87 | !Efs/sysfs/file.c | 92 | !Efs/sysfs/file.c |
diff --git a/Documentation/hwmon/jc42 b/Documentation/hwmon/jc42 index 0e76ef12e4c6..a22ecf48f255 100644 --- a/Documentation/hwmon/jc42 +++ b/Documentation/hwmon/jc42 | |||
@@ -51,7 +51,8 @@ Supported chips: | |||
51 | * JEDEC JC 42.4 compliant temperature sensor chips | 51 | * JEDEC JC 42.4 compliant temperature sensor chips |
52 | Prefix: 'jc42' | 52 | Prefix: 'jc42' |
53 | Addresses scanned: I2C 0x18 - 0x1f | 53 | Addresses scanned: I2C 0x18 - 0x1f |
54 | Datasheet: - | 54 | Datasheet: |
55 | http://www.jedec.org/sites/default/files/docs/4_01_04R19.pdf | ||
55 | 56 | ||
56 | Author: | 57 | Author: |
57 | Guenter Roeck <guenter.roeck@ericsson.com> | 58 | Guenter Roeck <guenter.roeck@ericsson.com> |
@@ -60,7 +61,11 @@ Author: | |||
60 | Description | 61 | Description |
61 | ----------- | 62 | ----------- |
62 | 63 | ||
63 | This driver implements support for JEDEC JC 42.4 compliant temperature sensors. | 64 | This driver implements support for JEDEC JC 42.4 compliant temperature sensors, |
65 | which are used on many DDR3 memory modules for mobile devices and servers. Some | ||
66 | systems use the sensor to prevent memory overheating by automatically throttling | ||
67 | the memory controller. | ||
68 | |||
64 | The driver auto-detects the chips listed above, but can be manually instantiated | 69 | The driver auto-detects the chips listed above, but can be manually instantiated |
65 | to support other JC 42.4 compliant chips. | 70 | to support other JC 42.4 compliant chips. |
66 | 71 | ||
@@ -81,15 +86,19 @@ limits. The chip supports only a single register to configure the hysteresis, | |||
81 | which applies to all limits. This register can be written by writing into | 86 | which applies to all limits. This register can be written by writing into |
82 | temp1_crit_hyst. Other hysteresis attributes are read-only. | 87 | temp1_crit_hyst. Other hysteresis attributes are read-only. |
83 | 88 | ||
89 | If the BIOS has configured the sensor for automatic temperature management, it | ||
90 | is likely that it has locked the registers, i.e., that the temperature limits | ||
91 | cannot be changed. | ||
92 | |||
84 | Sysfs entries | 93 | Sysfs entries |
85 | ------------- | 94 | ------------- |
86 | 95 | ||
87 | temp1_input Temperature (RO) | 96 | temp1_input Temperature (RO) |
88 | temp1_min Minimum temperature (RW) | 97 | temp1_min Minimum temperature (RO or RW) |
89 | temp1_max Maximum temperature (RW) | 98 | temp1_max Maximum temperature (RO or RW) |
90 | temp1_crit Critical high temperature (RW) | 99 | temp1_crit Critical high temperature (RO or RW) |
91 | 100 | ||
92 | temp1_crit_hyst Critical hysteresis temperature (RW) | 101 | temp1_crit_hyst Critical hysteresis temperature (RO or RW) |
93 | temp1_max_hyst Maximum hysteresis temperature (RO) | 102 | temp1_max_hyst Maximum hysteresis temperature (RO) |
94 | 103 | ||
95 | temp1_min_alarm Temperature low alarm | 104 | temp1_min_alarm Temperature low alarm |
diff --git a/Documentation/hwmon/k10temp b/Documentation/hwmon/k10temp index 6526eee525a6..d2b56a4fd1f5 100644 --- a/Documentation/hwmon/k10temp +++ b/Documentation/hwmon/k10temp | |||
@@ -9,6 +9,8 @@ Supported chips: | |||
9 | Socket S1G3: Athlon II, Sempron, Turion II | 9 | Socket S1G3: Athlon II, Sempron, Turion II |
10 | * AMD Family 11h processors: | 10 | * AMD Family 11h processors: |
11 | Socket S1G2: Athlon (X2), Sempron (X2), Turion X2 (Ultra) | 11 | Socket S1G2: Athlon (X2), Sempron (X2), Turion X2 (Ultra) |
12 | * AMD Family 12h processors: "Llano" | ||
13 | * AMD Family 14h processors: "Brazos" (C/E/G-Series) | ||
12 | 14 | ||
13 | Prefix: 'k10temp' | 15 | Prefix: 'k10temp' |
14 | Addresses scanned: PCI space | 16 | Addresses scanned: PCI space |
@@ -17,10 +19,14 @@ Supported chips: | |||
17 | http://support.amd.com/us/Processor_TechDocs/31116.pdf | 19 | http://support.amd.com/us/Processor_TechDocs/31116.pdf |
18 | BIOS and Kernel Developer's Guide (BKDG) for AMD Family 11h Processors: | 20 | BIOS and Kernel Developer's Guide (BKDG) for AMD Family 11h Processors: |
19 | http://support.amd.com/us/Processor_TechDocs/41256.pdf | 21 | http://support.amd.com/us/Processor_TechDocs/41256.pdf |
22 | BIOS and Kernel Developer's Guide (BKDG) for AMD Family 14h Models 00h-0Fh Processors: | ||
23 | http://support.amd.com/us/Processor_TechDocs/43170.pdf | ||
20 | Revision Guide for AMD Family 10h Processors: | 24 | Revision Guide for AMD Family 10h Processors: |
21 | http://support.amd.com/us/Processor_TechDocs/41322.pdf | 25 | http://support.amd.com/us/Processor_TechDocs/41322.pdf |
22 | Revision Guide for AMD Family 11h Processors: | 26 | Revision Guide for AMD Family 11h Processors: |
23 | http://support.amd.com/us/Processor_TechDocs/41788.pdf | 27 | http://support.amd.com/us/Processor_TechDocs/41788.pdf |
28 | Revision Guide for AMD Family 14h Models 00h-0Fh Processors: | ||
29 | http://support.amd.com/us/Processor_TechDocs/47534.pdf | ||
24 | AMD Family 11h Processor Power and Thermal Data Sheet for Notebooks: | 30 | AMD Family 11h Processor Power and Thermal Data Sheet for Notebooks: |
25 | http://support.amd.com/us/Processor_TechDocs/43373.pdf | 31 | http://support.amd.com/us/Processor_TechDocs/43373.pdf |
26 | AMD Family 10h Server and Workstation Processor Power and Thermal Data Sheet: | 32 | AMD Family 10h Server and Workstation Processor Power and Thermal Data Sheet: |
@@ -34,7 +40,7 @@ Description | |||
34 | ----------- | 40 | ----------- |
35 | 41 | ||
36 | This driver permits reading of the internal temperature sensor of AMD | 42 | This driver permits reading of the internal temperature sensor of AMD |
37 | Family 10h and 11h processors. | 43 | Family 10h/11h/12h/14h processors. |
38 | 44 | ||
39 | All these processors have a sensor, but on those for Socket F or AM2+, | 45 | All these processors have a sensor, but on those for Socket F or AM2+, |
40 | the sensor may return inconsistent values (erratum 319). The driver | 46 | the sensor may return inconsistent values (erratum 319). The driver |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 89835a4766a6..f4a04c0c7edc 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -144,6 +144,11 @@ a fixed number of characters. This limit depends on the architecture | |||
144 | and is between 256 and 4096 characters. It is defined in the file | 144 | and is between 256 and 4096 characters. It is defined in the file |
145 | ./include/asm/setup.h as COMMAND_LINE_SIZE. | 145 | ./include/asm/setup.h as COMMAND_LINE_SIZE. |
146 | 146 | ||
147 | Finally, the [KMG] suffix is commonly described after a number of kernel | ||
148 | parameter values. These 'K', 'M', and 'G' letters represent the _binary_ | ||
149 | multipliers 'Kilo', 'Mega', and 'Giga', equalling 2^10, 2^20, and 2^30 | ||
150 | bytes respectively. Such letter suffixes can also be entirely omitted. | ||
151 | |||
147 | 152 | ||
148 | acpi= [HW,ACPI,X86] | 153 | acpi= [HW,ACPI,X86] |
149 | Advanced Configuration and Power Interface | 154 | Advanced Configuration and Power Interface |
@@ -545,16 +550,20 @@ and is between 256 and 4096 characters. It is defined in the file | |||
545 | Format: | 550 | Format: |
546 | <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>] | 551 | <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>] |
547 | 552 | ||
548 | crashkernel=nn[KMG]@ss[KMG] | 553 | crashkernel=size[KMG][@offset[KMG]] |
549 | [KNL] Reserve a chunk of physical memory to | 554 | [KNL] Using kexec, Linux can switch to a 'crash kernel' |
550 | hold a kernel to switch to with kexec on panic. | 555 | upon panic. This parameter reserves the physical |
556 | memory region [offset, offset + size] for that kernel | ||
557 | image. If '@offset' is omitted, then a suitable offset | ||
558 | is selected automatically. Check | ||
559 | Documentation/kdump/kdump.txt for further details. | ||
551 | 560 | ||
552 | crashkernel=range1:size1[,range2:size2,...][@offset] | 561 | crashkernel=range1:size1[,range2:size2,...][@offset] |
553 | [KNL] Same as above, but depends on the memory | 562 | [KNL] Same as above, but depends on the memory |
554 | in the running system. The syntax of range is | 563 | in the running system. The syntax of range is |
555 | start-[end] where start and end are both | 564 | start-[end] where start and end are both |
556 | a memory unit (amount[KMG]). See also | 565 | a memory unit (amount[KMG]). See also |
557 | Documentation/kdump/kdump.txt for a example. | 566 | Documentation/kdump/kdump.txt for an example. |
558 | 567 | ||
559 | cs89x0_dma= [HW,NET] | 568 | cs89x0_dma= [HW,NET] |
560 | Format: <dma> | 569 | Format: <dma> |
@@ -1262,10 +1271,9 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1262 | 6 (KERN_INFO) informational | 1271 | 6 (KERN_INFO) informational |
1263 | 7 (KERN_DEBUG) debug-level messages | 1272 | 7 (KERN_DEBUG) debug-level messages |
1264 | 1273 | ||
1265 | log_buf_len=n Sets the size of the printk ring buffer, in bytes. | 1274 | log_buf_len=n[KMG] Sets the size of the printk ring buffer, |
1266 | Format: { n | nk | nM } | 1275 | in bytes. n must be a power of two. The default |
1267 | n must be a power of two. The default size | 1276 | size is set in the kernel config file. |
1268 | is set in the kernel config file. | ||
1269 | 1277 | ||
1270 | logo.nologo [FB] Disables display of the built-in Linux logo. | 1278 | logo.nologo [FB] Disables display of the built-in Linux logo. |
1271 | This may be used to provide more screen space for | 1279 | This may be used to provide more screen space for |
diff --git a/Documentation/networking/00-INDEX b/Documentation/networking/00-INDEX index fe5c099b8fc8..4edd78dfb362 100644 --- a/Documentation/networking/00-INDEX +++ b/Documentation/networking/00-INDEX | |||
@@ -40,8 +40,6 @@ decnet.txt | |||
40 | - info on using the DECnet networking layer in Linux. | 40 | - info on using the DECnet networking layer in Linux. |
41 | depca.txt | 41 | depca.txt |
42 | - the Digital DEPCA/EtherWORKS DE1?? and DE2?? LANCE Ethernet driver | 42 | - the Digital DEPCA/EtherWORKS DE1?? and DE2?? LANCE Ethernet driver |
43 | dgrs.txt | ||
44 | - the Digi International RightSwitch SE-X Ethernet driver | ||
45 | dmfe.txt | 43 | dmfe.txt |
46 | - info on the Davicom DM9102(A)/DM9132/DM9801 fast ethernet driver. | 44 | - info on the Davicom DM9102(A)/DM9132/DM9801 fast ethernet driver. |
47 | e100.txt | 45 | e100.txt |
@@ -50,8 +48,6 @@ e1000.txt | |||
50 | - info on Intel's E1000 line of gigabit ethernet boards | 48 | - info on Intel's E1000 line of gigabit ethernet boards |
51 | eql.txt | 49 | eql.txt |
52 | - serial IP load balancing | 50 | - serial IP load balancing |
53 | ethertap.txt | ||
54 | - the Ethertap user space packet reception and transmission driver | ||
55 | ewrk3.txt | 51 | ewrk3.txt |
56 | - the Digital EtherWORKS 3 DE203/4/5 Ethernet driver | 52 | - the Digital EtherWORKS 3 DE203/4/5 Ethernet driver |
57 | filter.txt | 53 | filter.txt |
@@ -104,8 +100,6 @@ tuntap.txt | |||
104 | - TUN/TAP device driver, allowing user space Rx/Tx of packets. | 100 | - TUN/TAP device driver, allowing user space Rx/Tx of packets. |
105 | vortex.txt | 101 | vortex.txt |
106 | - info on using 3Com Vortex (3c590, 3c592, 3c595, 3c597) Ethernet cards. | 102 | - info on using 3Com Vortex (3c590, 3c592, 3c595, 3c597) Ethernet cards. |
107 | wavelan.txt | ||
108 | - AT&T GIS (nee NCR) WaveLAN card: An Ethernet-like radio transceiver | ||
109 | x25.txt | 103 | x25.txt |
110 | - general info on X.25 development. | 104 | - general info on X.25 development. |
111 | x25-iface.txt | 105 | x25-iface.txt |
diff --git a/Documentation/networking/dns_resolver.txt b/Documentation/networking/dns_resolver.txt index aefd1e681804..04ca06325b08 100644 --- a/Documentation/networking/dns_resolver.txt +++ b/Documentation/networking/dns_resolver.txt | |||
@@ -61,7 +61,6 @@ before the more general line given above as the first match is the one taken. | |||
61 | create dns_resolver foo:* * /usr/sbin/dns.foo %k | 61 | create dns_resolver foo:* * /usr/sbin/dns.foo %k |
62 | 62 | ||
63 | 63 | ||
64 | |||
65 | ===== | 64 | ===== |
66 | USAGE | 65 | USAGE |
67 | ===== | 66 | ===== |
@@ -104,6 +103,14 @@ implemented in the module can be called after doing: | |||
104 | returned also. | 103 | returned also. |
105 | 104 | ||
106 | 105 | ||
106 | =============================== | ||
107 | READING DNS KEYS FROM USERSPACE | ||
108 | =============================== | ||
109 | |||
110 | Keys of dns_resolver type can be read from userspace using keyctl_read() or | ||
111 | "keyctl read/print/pipe". | ||
112 | |||
113 | |||
107 | ========= | 114 | ========= |
108 | MECHANISM | 115 | MECHANISM |
109 | ========= | 116 | ========= |
diff --git a/MAINTAINERS b/MAINTAINERS index 5dd6c751e6a6..f1bc3dc6b369 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -885,7 +885,7 @@ S: Supported | |||
885 | 885 | ||
886 | ARM/QUALCOMM MSM MACHINE SUPPORT | 886 | ARM/QUALCOMM MSM MACHINE SUPPORT |
887 | M: David Brown <davidb@codeaurora.org> | 887 | M: David Brown <davidb@codeaurora.org> |
888 | M: Daniel Walker <dwalker@codeaurora.org> | 888 | M: Daniel Walker <dwalker@fifo99.com> |
889 | M: Bryan Huntsman <bryanh@codeaurora.org> | 889 | M: Bryan Huntsman <bryanh@codeaurora.org> |
890 | L: linux-arm-msm@vger.kernel.org | 890 | L: linux-arm-msm@vger.kernel.org |
891 | F: arch/arm/mach-msm/ | 891 | F: arch/arm/mach-msm/ |
@@ -1010,6 +1010,15 @@ L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) | |||
1010 | S: Maintained | 1010 | S: Maintained |
1011 | F: arch/arm/mach-s5p*/ | 1011 | F: arch/arm/mach-s5p*/ |
1012 | 1012 | ||
1013 | ARM/SAMSUNG MOBILE MACHINE SUPPORT | ||
1014 | M: Kyungmin Park <kyungmin.park@samsung.com> | ||
1015 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | ||
1016 | S: Maintained | ||
1017 | F: arch/arm/mach-s5pv210/mach-aquila.c | ||
1018 | F: arch/arm/mach-s5pv210/mach-goni.c | ||
1019 | F: arch/arm/mach-exynos4/mach-universal_c210.c | ||
1020 | F: arch/arm/mach-exynos4/mach-nuri.c | ||
1021 | |||
1013 | ARM/SAMSUNG S5P SERIES FIMC SUPPORT | 1022 | ARM/SAMSUNG S5P SERIES FIMC SUPPORT |
1014 | M: Kyungmin Park <kyungmin.park@samsung.com> | 1023 | M: Kyungmin Park <kyungmin.park@samsung.com> |
1015 | M: Sylwester Nawrocki <s.nawrocki@samsung.com> | 1024 | M: Sylwester Nawrocki <s.nawrocki@samsung.com> |
@@ -1467,6 +1476,7 @@ F: include/net/bluetooth/ | |||
1467 | 1476 | ||
1468 | BONDING DRIVER | 1477 | BONDING DRIVER |
1469 | M: Jay Vosburgh <fubar@us.ibm.com> | 1478 | M: Jay Vosburgh <fubar@us.ibm.com> |
1479 | M: Andy Gospodarek <andy@greyhouse.net> | ||
1470 | L: netdev@vger.kernel.org | 1480 | L: netdev@vger.kernel.org |
1471 | W: http://sourceforge.net/projects/bonding/ | 1481 | W: http://sourceforge.net/projects/bonding/ |
1472 | S: Supported | 1482 | S: Supported |
@@ -1692,6 +1702,13 @@ M: Andy Whitcroft <apw@canonical.com> | |||
1692 | S: Supported | 1702 | S: Supported |
1693 | F: scripts/checkpatch.pl | 1703 | F: scripts/checkpatch.pl |
1694 | 1704 | ||
1705 | CHINESE DOCUMENTATION | ||
1706 | M: Harry Wei <harryxiyou@gmail.com> | ||
1707 | L: xiyoulinuxkernelgroup@googlegroups.com | ||
1708 | L: linux-kernel@zh-kernel.org (moderated for non-subscribers) | ||
1709 | S: Maintained | ||
1710 | F: Documentation/zh_CN/ | ||
1711 | |||
1695 | CISCO VIC ETHERNET NIC DRIVER | 1712 | CISCO VIC ETHERNET NIC DRIVER |
1696 | M: Vasanthy Kolluri <vkolluri@cisco.com> | 1713 | M: Vasanthy Kolluri <vkolluri@cisco.com> |
1697 | M: Roopa Prabhu <roprabhu@cisco.com> | 1714 | M: Roopa Prabhu <roprabhu@cisco.com> |
@@ -2026,7 +2043,7 @@ F: Documentation/scsi/dc395x.txt | |||
2026 | F: drivers/scsi/dc395x.* | 2043 | F: drivers/scsi/dc395x.* |
2027 | 2044 | ||
2028 | DCCP PROTOCOL | 2045 | DCCP PROTOCOL |
2029 | M: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> | 2046 | M: Gerrit Renker <gerrit@erg.abdn.ac.uk> |
2030 | L: dccp@vger.kernel.org | 2047 | L: dccp@vger.kernel.org |
2031 | W: http://www.linuxfoundation.org/collaborate/workgroups/networking/dccp | 2048 | W: http://www.linuxfoundation.org/collaborate/workgroups/networking/dccp |
2032 | S: Maintained | 2049 | S: Maintained |
@@ -2873,7 +2890,6 @@ M: Guenter Roeck <guenter.roeck@ericsson.com> | |||
2873 | L: lm-sensors@lm-sensors.org | 2890 | L: lm-sensors@lm-sensors.org |
2874 | W: http://www.lm-sensors.org/ | 2891 | W: http://www.lm-sensors.org/ |
2875 | T: quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-hwmon/ | 2892 | T: quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-hwmon/ |
2876 | T: quilt kernel.org/pub/linux/kernel/people/groeck/linux-staging/ | ||
2877 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git | 2893 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git |
2878 | S: Maintained | 2894 | S: Maintained |
2879 | F: Documentation/hwmon/ | 2895 | F: Documentation/hwmon/ |
@@ -3513,7 +3529,7 @@ F: drivers/hwmon/jc42.c | |||
3513 | F: Documentation/hwmon/jc42 | 3529 | F: Documentation/hwmon/jc42 |
3514 | 3530 | ||
3515 | JFS FILESYSTEM | 3531 | JFS FILESYSTEM |
3516 | M: Dave Kleikamp <shaggy@linux.vnet.ibm.com> | 3532 | M: Dave Kleikamp <shaggy@kernel.org> |
3517 | L: jfs-discussion@lists.sourceforge.net | 3533 | L: jfs-discussion@lists.sourceforge.net |
3518 | W: http://jfs.sourceforge.net/ | 3534 | W: http://jfs.sourceforge.net/ |
3519 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/shaggy/jfs-2.6.git | 3535 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/shaggy/jfs-2.6.git |
@@ -4276,10 +4292,7 @@ S: Maintained | |||
4276 | F: net/sched/sch_netem.c | 4292 | F: net/sched/sch_netem.c |
4277 | 4293 | ||
4278 | NETERION 10GbE DRIVERS (s2io/vxge) | 4294 | NETERION 10GbE DRIVERS (s2io/vxge) |
4279 | M: Ramkrishna Vepa <ramkrishna.vepa@exar.com> | 4295 | M: Jon Mason <jdmason@kudzu.us> |
4280 | M: Sivakumar Subramani <sivakumar.subramani@exar.com> | ||
4281 | M: Sreenivasa Honnur <sreenivasa.honnur@exar.com> | ||
4282 | M: Jon Mason <jon.mason@exar.com> | ||
4283 | L: netdev@vger.kernel.org | 4296 | L: netdev@vger.kernel.org |
4284 | W: http://trac.neterion.com/cgi-bin/trac.cgi/wiki/Linux?Anonymous | 4297 | W: http://trac.neterion.com/cgi-bin/trac.cgi/wiki/Linux?Anonymous |
4285 | W: http://trac.neterion.com/cgi-bin/trac.cgi/wiki/X3100Linux?Anonymous | 4298 | W: http://trac.neterion.com/cgi-bin/trac.cgi/wiki/X3100Linux?Anonymous |
@@ -5165,6 +5178,7 @@ F: drivers/char/random.c | |||
5165 | 5178 | ||
5166 | RAPIDIO SUBSYSTEM | 5179 | RAPIDIO SUBSYSTEM |
5167 | M: Matt Porter <mporter@kernel.crashing.org> | 5180 | M: Matt Porter <mporter@kernel.crashing.org> |
5181 | M: Alexandre Bounine <alexandre.bounine@idt.com> | ||
5168 | S: Maintained | 5182 | S: Maintained |
5169 | F: drivers/rapidio/ | 5183 | F: drivers/rapidio/ |
5170 | 5184 | ||
@@ -5267,7 +5281,7 @@ S: Maintained | |||
5267 | F: drivers/net/wireless/rtl818x/rtl8180/ | 5281 | F: drivers/net/wireless/rtl818x/rtl8180/ |
5268 | 5282 | ||
5269 | RTL8187 WIRELESS DRIVER | 5283 | RTL8187 WIRELESS DRIVER |
5270 | M: Herton Ronaldo Krzesinski <herton@mandriva.com.br> | 5284 | M: Herton Ronaldo Krzesinski <herton@canonical.com> |
5271 | M: Hin-Tak Leung <htl10@users.sourceforge.net> | 5285 | M: Hin-Tak Leung <htl10@users.sourceforge.net> |
5272 | M: Larry Finger <Larry.Finger@lwfinger.net> | 5286 | M: Larry Finger <Larry.Finger@lwfinger.net> |
5273 | L: linux-wireless@vger.kernel.org | 5287 | L: linux-wireless@vger.kernel.org |
@@ -6105,7 +6119,7 @@ S: Maintained | |||
6105 | F: security/tomoyo/ | 6119 | F: security/tomoyo/ |
6106 | 6120 | ||
6107 | TOPSTAR LAPTOP EXTRAS DRIVER | 6121 | TOPSTAR LAPTOP EXTRAS DRIVER |
6108 | M: Herton Ronaldo Krzesinski <herton@mandriva.com.br> | 6122 | M: Herton Ronaldo Krzesinski <herton@canonical.com> |
6109 | L: platform-driver-x86@vger.kernel.org | 6123 | L: platform-driver-x86@vger.kernel.org |
6110 | S: Maintained | 6124 | S: Maintained |
6111 | F: drivers/platform/x86/topstar-laptop.c | 6125 | F: drivers/platform/x86/topstar-laptop.c |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 38 | 3 | SUBLEVEL = 38 |
4 | EXTRAVERSION = -rc5 | 4 | EXTRAVERSION = |
5 | NAME = Flesh-Eating Bats with Fangs | 5 | NAME = Flesh-Eating Bats with Fangs |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 47f63d480141..cc31bec2e316 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
@@ -11,6 +11,7 @@ config ALPHA | |||
11 | select HAVE_GENERIC_HARDIRQS | 11 | select HAVE_GENERIC_HARDIRQS |
12 | select GENERIC_IRQ_PROBE | 12 | select GENERIC_IRQ_PROBE |
13 | select AUTO_IRQ_AFFINITY if SMP | 13 | select AUTO_IRQ_AFFINITY if SMP |
14 | select GENERIC_HARDIRQS_NO_DEPRECATED | ||
14 | help | 15 | help |
15 | The Alpha is a 64-bit general-purpose processor designed and | 16 | The Alpha is a 64-bit general-purpose processor designed and |
16 | marketed by the Digital Equipment Corporation of blessed memory, | 17 | marketed by the Digital Equipment Corporation of blessed memory, |
diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c index 9ab234f48dd8..a19d60082299 100644 --- a/arch/alpha/kernel/irq.c +++ b/arch/alpha/kernel/irq.c | |||
@@ -44,11 +44,16 @@ static char irq_user_affinity[NR_IRQS]; | |||
44 | 44 | ||
45 | int irq_select_affinity(unsigned int irq) | 45 | int irq_select_affinity(unsigned int irq) |
46 | { | 46 | { |
47 | struct irq_desc *desc = irq_to_desc[irq]; | 47 | struct irq_data *data = irq_get_irq_data(irq); |
48 | struct irq_chip *chip; | ||
48 | static int last_cpu; | 49 | static int last_cpu; |
49 | int cpu = last_cpu + 1; | 50 | int cpu = last_cpu + 1; |
50 | 51 | ||
51 | if (!desc || !get_irq_desc_chip(desc)->set_affinity || irq_user_affinity[irq]) | 52 | if (!data) |
53 | return 1; | ||
54 | chip = irq_data_get_irq_chip(data); | ||
55 | |||
56 | if (!chip->irq_set_affinity || irq_user_affinity[irq]) | ||
52 | return 1; | 57 | return 1; |
53 | 58 | ||
54 | while (!cpu_possible(cpu) || | 59 | while (!cpu_possible(cpu) || |
@@ -56,8 +61,8 @@ int irq_select_affinity(unsigned int irq) | |||
56 | cpu = (cpu < (NR_CPUS-1) ? cpu + 1 : 0); | 61 | cpu = (cpu < (NR_CPUS-1) ? cpu + 1 : 0); |
57 | last_cpu = cpu; | 62 | last_cpu = cpu; |
58 | 63 | ||
59 | cpumask_copy(desc->affinity, cpumask_of(cpu)); | 64 | cpumask_copy(data->affinity, cpumask_of(cpu)); |
60 | get_irq_desc_chip(desc)->set_affinity(irq, cpumask_of(cpu)); | 65 | chip->irq_set_affinity(data, cpumask_of(cpu), false); |
61 | return 0; | 66 | return 0; |
62 | } | 67 | } |
63 | #endif /* CONFIG_SMP */ | 68 | #endif /* CONFIG_SMP */ |
diff --git a/arch/alpha/kernel/irq_alpha.c b/arch/alpha/kernel/irq_alpha.c index 2d0679b60939..411ca11d0a18 100644 --- a/arch/alpha/kernel/irq_alpha.c +++ b/arch/alpha/kernel/irq_alpha.c | |||
@@ -228,14 +228,9 @@ struct irqaction timer_irqaction = { | |||
228 | void __init | 228 | void __init |
229 | init_rtc_irq(void) | 229 | init_rtc_irq(void) |
230 | { | 230 | { |
231 | struct irq_desc *desc = irq_to_desc(RTC_IRQ); | 231 | set_irq_chip_and_handler_name(RTC_IRQ, &no_irq_chip, |
232 | 232 | handle_simple_irq, "RTC"); | |
233 | if (desc) { | 233 | setup_irq(RTC_IRQ, &timer_irqaction); |
234 | desc->status |= IRQ_DISABLED; | ||
235 | set_irq_chip_and_handler_name(RTC_IRQ, &no_irq_chip, | ||
236 | handle_simple_irq, "RTC"); | ||
237 | setup_irq(RTC_IRQ, &timer_irqaction); | ||
238 | } | ||
239 | } | 234 | } |
240 | 235 | ||
241 | /* Dummy irqactions. */ | 236 | /* Dummy irqactions. */ |
diff --git a/arch/alpha/kernel/irq_i8259.c b/arch/alpha/kernel/irq_i8259.c index 956ea0ed1694..c7cc9813e45f 100644 --- a/arch/alpha/kernel/irq_i8259.c +++ b/arch/alpha/kernel/irq_i8259.c | |||
@@ -33,10 +33,10 @@ i8259_update_irq_hw(unsigned int irq, unsigned long mask) | |||
33 | } | 33 | } |
34 | 34 | ||
35 | inline void | 35 | inline void |
36 | i8259a_enable_irq(unsigned int irq) | 36 | i8259a_enable_irq(struct irq_data *d) |
37 | { | 37 | { |
38 | spin_lock(&i8259_irq_lock); | 38 | spin_lock(&i8259_irq_lock); |
39 | i8259_update_irq_hw(irq, cached_irq_mask &= ~(1 << irq)); | 39 | i8259_update_irq_hw(d->irq, cached_irq_mask &= ~(1 << d->irq)); |
40 | spin_unlock(&i8259_irq_lock); | 40 | spin_unlock(&i8259_irq_lock); |
41 | } | 41 | } |
42 | 42 | ||
@@ -47,16 +47,18 @@ __i8259a_disable_irq(unsigned int irq) | |||
47 | } | 47 | } |
48 | 48 | ||
49 | void | 49 | void |
50 | i8259a_disable_irq(unsigned int irq) | 50 | i8259a_disable_irq(struct irq_data *d) |
51 | { | 51 | { |
52 | spin_lock(&i8259_irq_lock); | 52 | spin_lock(&i8259_irq_lock); |
53 | __i8259a_disable_irq(irq); | 53 | __i8259a_disable_irq(d->irq); |
54 | spin_unlock(&i8259_irq_lock); | 54 | spin_unlock(&i8259_irq_lock); |
55 | } | 55 | } |
56 | 56 | ||
57 | void | 57 | void |
58 | i8259a_mask_and_ack_irq(unsigned int irq) | 58 | i8259a_mask_and_ack_irq(struct irq_data *d) |
59 | { | 59 | { |
60 | unsigned int irq = d->irq; | ||
61 | |||
60 | spin_lock(&i8259_irq_lock); | 62 | spin_lock(&i8259_irq_lock); |
61 | __i8259a_disable_irq(irq); | 63 | __i8259a_disable_irq(irq); |
62 | 64 | ||
@@ -71,9 +73,9 @@ i8259a_mask_and_ack_irq(unsigned int irq) | |||
71 | 73 | ||
72 | struct irq_chip i8259a_irq_type = { | 74 | struct irq_chip i8259a_irq_type = { |
73 | .name = "XT-PIC", | 75 | .name = "XT-PIC", |
74 | .unmask = i8259a_enable_irq, | 76 | .irq_unmask = i8259a_enable_irq, |
75 | .mask = i8259a_disable_irq, | 77 | .irq_mask = i8259a_disable_irq, |
76 | .mask_ack = i8259a_mask_and_ack_irq, | 78 | .irq_mask_ack = i8259a_mask_and_ack_irq, |
77 | }; | 79 | }; |
78 | 80 | ||
79 | void __init | 81 | void __init |
diff --git a/arch/alpha/kernel/irq_impl.h b/arch/alpha/kernel/irq_impl.h index b63ccd7386f1..d507a234b05d 100644 --- a/arch/alpha/kernel/irq_impl.h +++ b/arch/alpha/kernel/irq_impl.h | |||
@@ -31,11 +31,9 @@ extern void init_rtc_irq(void); | |||
31 | 31 | ||
32 | extern void common_init_isa_dma(void); | 32 | extern void common_init_isa_dma(void); |
33 | 33 | ||
34 | extern void i8259a_enable_irq(unsigned int); | 34 | extern void i8259a_enable_irq(struct irq_data *d); |
35 | extern void i8259a_disable_irq(unsigned int); | 35 | extern void i8259a_disable_irq(struct irq_data *d); |
36 | extern void i8259a_mask_and_ack_irq(unsigned int); | 36 | extern void i8259a_mask_and_ack_irq(struct irq_data *d); |
37 | extern unsigned int i8259a_startup_irq(unsigned int); | ||
38 | extern void i8259a_end_irq(unsigned int); | ||
39 | extern struct irq_chip i8259a_irq_type; | 37 | extern struct irq_chip i8259a_irq_type; |
40 | extern void init_i8259a_irqs(void); | 38 | extern void init_i8259a_irqs(void); |
41 | 39 | ||
diff --git a/arch/alpha/kernel/irq_pyxis.c b/arch/alpha/kernel/irq_pyxis.c index 2863458c853e..b30227fa7f5f 100644 --- a/arch/alpha/kernel/irq_pyxis.c +++ b/arch/alpha/kernel/irq_pyxis.c | |||
@@ -29,21 +29,21 @@ pyxis_update_irq_hw(unsigned long mask) | |||
29 | } | 29 | } |
30 | 30 | ||
31 | static inline void | 31 | static inline void |
32 | pyxis_enable_irq(unsigned int irq) | 32 | pyxis_enable_irq(struct irq_data *d) |
33 | { | 33 | { |
34 | pyxis_update_irq_hw(cached_irq_mask |= 1UL << (irq - 16)); | 34 | pyxis_update_irq_hw(cached_irq_mask |= 1UL << (d->irq - 16)); |
35 | } | 35 | } |
36 | 36 | ||
37 | static void | 37 | static void |
38 | pyxis_disable_irq(unsigned int irq) | 38 | pyxis_disable_irq(struct irq_data *d) |
39 | { | 39 | { |
40 | pyxis_update_irq_hw(cached_irq_mask &= ~(1UL << (irq - 16))); | 40 | pyxis_update_irq_hw(cached_irq_mask &= ~(1UL << (d->irq - 16))); |
41 | } | 41 | } |
42 | 42 | ||
43 | static void | 43 | static void |
44 | pyxis_mask_and_ack_irq(unsigned int irq) | 44 | pyxis_mask_and_ack_irq(struct irq_data *d) |
45 | { | 45 | { |
46 | unsigned long bit = 1UL << (irq - 16); | 46 | unsigned long bit = 1UL << (d->irq - 16); |
47 | unsigned long mask = cached_irq_mask &= ~bit; | 47 | unsigned long mask = cached_irq_mask &= ~bit; |
48 | 48 | ||
49 | /* Disable the interrupt. */ | 49 | /* Disable the interrupt. */ |
@@ -58,9 +58,9 @@ pyxis_mask_and_ack_irq(unsigned int irq) | |||
58 | 58 | ||
59 | static struct irq_chip pyxis_irq_type = { | 59 | static struct irq_chip pyxis_irq_type = { |
60 | .name = "PYXIS", | 60 | .name = "PYXIS", |
61 | .mask_ack = pyxis_mask_and_ack_irq, | 61 | .irq_mask_ack = pyxis_mask_and_ack_irq, |
62 | .mask = pyxis_disable_irq, | 62 | .irq_mask = pyxis_disable_irq, |
63 | .unmask = pyxis_enable_irq, | 63 | .irq_unmask = pyxis_enable_irq, |
64 | }; | 64 | }; |
65 | 65 | ||
66 | void | 66 | void |
@@ -103,7 +103,7 @@ init_pyxis_irqs(unsigned long ignore_mask) | |||
103 | if ((ignore_mask >> i) & 1) | 103 | if ((ignore_mask >> i) & 1) |
104 | continue; | 104 | continue; |
105 | set_irq_chip_and_handler(i, &pyxis_irq_type, handle_level_irq); | 105 | set_irq_chip_and_handler(i, &pyxis_irq_type, handle_level_irq); |
106 | irq_to_desc(i)->status |= IRQ_LEVEL; | 106 | irq_set_status_flags(i, IRQ_LEVEL); |
107 | } | 107 | } |
108 | 108 | ||
109 | setup_irq(16+7, &isa_cascade_irqaction); | 109 | setup_irq(16+7, &isa_cascade_irqaction); |
diff --git a/arch/alpha/kernel/irq_srm.c b/arch/alpha/kernel/irq_srm.c index 0e57e828b413..82a47bba41c4 100644 --- a/arch/alpha/kernel/irq_srm.c +++ b/arch/alpha/kernel/irq_srm.c | |||
@@ -18,27 +18,27 @@ | |||
18 | DEFINE_SPINLOCK(srm_irq_lock); | 18 | DEFINE_SPINLOCK(srm_irq_lock); |
19 | 19 | ||
20 | static inline void | 20 | static inline void |
21 | srm_enable_irq(unsigned int irq) | 21 | srm_enable_irq(struct irq_data *d) |
22 | { | 22 | { |
23 | spin_lock(&srm_irq_lock); | 23 | spin_lock(&srm_irq_lock); |
24 | cserve_ena(irq - 16); | 24 | cserve_ena(d->irq - 16); |
25 | spin_unlock(&srm_irq_lock); | 25 | spin_unlock(&srm_irq_lock); |
26 | } | 26 | } |
27 | 27 | ||
28 | static void | 28 | static void |
29 | srm_disable_irq(unsigned int irq) | 29 | srm_disable_irq(struct irq_data *d) |
30 | { | 30 | { |
31 | spin_lock(&srm_irq_lock); | 31 | spin_lock(&srm_irq_lock); |
32 | cserve_dis(irq - 16); | 32 | cserve_dis(d->irq - 16); |
33 | spin_unlock(&srm_irq_lock); | 33 | spin_unlock(&srm_irq_lock); |
34 | } | 34 | } |
35 | 35 | ||
36 | /* Handle interrupts from the SRM, assuming no additional weirdness. */ | 36 | /* Handle interrupts from the SRM, assuming no additional weirdness. */ |
37 | static struct irq_chip srm_irq_type = { | 37 | static struct irq_chip srm_irq_type = { |
38 | .name = "SRM", | 38 | .name = "SRM", |
39 | .unmask = srm_enable_irq, | 39 | .irq_unmask = srm_enable_irq, |
40 | .mask = srm_disable_irq, | 40 | .irq_mask = srm_disable_irq, |
41 | .mask_ack = srm_disable_irq, | 41 | .irq_mask_ack = srm_disable_irq, |
42 | }; | 42 | }; |
43 | 43 | ||
44 | void __init | 44 | void __init |
@@ -52,7 +52,7 @@ init_srm_irqs(long max, unsigned long ignore_mask) | |||
52 | if (i < 64 && ((ignore_mask >> i) & 1)) | 52 | if (i < 64 && ((ignore_mask >> i) & 1)) |
53 | continue; | 53 | continue; |
54 | set_irq_chip_and_handler(i, &srm_irq_type, handle_level_irq); | 54 | set_irq_chip_and_handler(i, &srm_irq_type, handle_level_irq); |
55 | irq_to_desc(i)->status |= IRQ_LEVEL; | 55 | irq_set_status_flags(i, IRQ_LEVEL); |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index fe698b5045e9..376f22130791 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c | |||
@@ -230,44 +230,24 @@ linux_to_osf_statfs(struct kstatfs *linux_stat, struct osf_statfs __user *osf_st | |||
230 | return copy_to_user(osf_stat, &tmp_stat, bufsiz) ? -EFAULT : 0; | 230 | return copy_to_user(osf_stat, &tmp_stat, bufsiz) ? -EFAULT : 0; |
231 | } | 231 | } |
232 | 232 | ||
233 | static int | 233 | SYSCALL_DEFINE3(osf_statfs, const char __user *, pathname, |
234 | do_osf_statfs(struct path *path, struct osf_statfs __user *buffer, | 234 | struct osf_statfs __user *, buffer, unsigned long, bufsiz) |
235 | unsigned long bufsiz) | ||
236 | { | 235 | { |
237 | struct kstatfs linux_stat; | 236 | struct kstatfs linux_stat; |
238 | int error = vfs_statfs(path, &linux_stat); | 237 | int error = user_statfs(pathname, &linux_stat); |
239 | if (!error) | 238 | if (!error) |
240 | error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz); | 239 | error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz); |
241 | return error; | 240 | return error; |
242 | } | 241 | } |
243 | 242 | ||
244 | SYSCALL_DEFINE3(osf_statfs, const char __user *, pathname, | ||
245 | struct osf_statfs __user *, buffer, unsigned long, bufsiz) | ||
246 | { | ||
247 | struct path path; | ||
248 | int retval; | ||
249 | |||
250 | retval = user_path(pathname, &path); | ||
251 | if (!retval) { | ||
252 | retval = do_osf_statfs(&path, buffer, bufsiz); | ||
253 | path_put(&path); | ||
254 | } | ||
255 | return retval; | ||
256 | } | ||
257 | |||
258 | SYSCALL_DEFINE3(osf_fstatfs, unsigned long, fd, | 243 | SYSCALL_DEFINE3(osf_fstatfs, unsigned long, fd, |
259 | struct osf_statfs __user *, buffer, unsigned long, bufsiz) | 244 | struct osf_statfs __user *, buffer, unsigned long, bufsiz) |
260 | { | 245 | { |
261 | struct file *file; | 246 | struct kstatfs linux_stat; |
262 | int retval; | 247 | int error = fd_statfs(fd, &linux_stat); |
263 | 248 | if (!error) | |
264 | retval = -EBADF; | 249 | error = linux_to_osf_statfs(&linux_stat, buffer, bufsiz); |
265 | file = fget(fd); | 250 | return error; |
266 | if (file) { | ||
267 | retval = do_osf_statfs(&file->f_path, buffer, bufsiz); | ||
268 | fput(file); | ||
269 | } | ||
270 | return retval; | ||
271 | } | 251 | } |
272 | 252 | ||
273 | /* | 253 | /* |
diff --git a/arch/alpha/kernel/sys_alcor.c b/arch/alpha/kernel/sys_alcor.c index 7bef61768236..88d95e872f55 100644 --- a/arch/alpha/kernel/sys_alcor.c +++ b/arch/alpha/kernel/sys_alcor.c | |||
@@ -44,31 +44,31 @@ alcor_update_irq_hw(unsigned long mask) | |||
44 | } | 44 | } |
45 | 45 | ||
46 | static inline void | 46 | static inline void |
47 | alcor_enable_irq(unsigned int irq) | 47 | alcor_enable_irq(struct irq_data *d) |
48 | { | 48 | { |
49 | alcor_update_irq_hw(cached_irq_mask |= 1UL << (irq - 16)); | 49 | alcor_update_irq_hw(cached_irq_mask |= 1UL << (d->irq - 16)); |
50 | } | 50 | } |
51 | 51 | ||
52 | static void | 52 | static void |
53 | alcor_disable_irq(unsigned int irq) | 53 | alcor_disable_irq(struct irq_data *d) |
54 | { | 54 | { |
55 | alcor_update_irq_hw(cached_irq_mask &= ~(1UL << (irq - 16))); | 55 | alcor_update_irq_hw(cached_irq_mask &= ~(1UL << (d->irq - 16))); |
56 | } | 56 | } |
57 | 57 | ||
58 | static void | 58 | static void |
59 | alcor_mask_and_ack_irq(unsigned int irq) | 59 | alcor_mask_and_ack_irq(struct irq_data *d) |
60 | { | 60 | { |
61 | alcor_disable_irq(irq); | 61 | alcor_disable_irq(d); |
62 | 62 | ||
63 | /* On ALCOR/XLT, need to dismiss interrupt via GRU. */ | 63 | /* On ALCOR/XLT, need to dismiss interrupt via GRU. */ |
64 | *(vuip)GRU_INT_CLEAR = 1 << (irq - 16); mb(); | 64 | *(vuip)GRU_INT_CLEAR = 1 << (d->irq - 16); mb(); |
65 | *(vuip)GRU_INT_CLEAR = 0; mb(); | 65 | *(vuip)GRU_INT_CLEAR = 0; mb(); |
66 | } | 66 | } |
67 | 67 | ||
68 | static void | 68 | static void |
69 | alcor_isa_mask_and_ack_irq(unsigned int irq) | 69 | alcor_isa_mask_and_ack_irq(struct irq_data *d) |
70 | { | 70 | { |
71 | i8259a_mask_and_ack_irq(irq); | 71 | i8259a_mask_and_ack_irq(d); |
72 | 72 | ||
73 | /* On ALCOR/XLT, need to dismiss interrupt via GRU. */ | 73 | /* On ALCOR/XLT, need to dismiss interrupt via GRU. */ |
74 | *(vuip)GRU_INT_CLEAR = 0x80000000; mb(); | 74 | *(vuip)GRU_INT_CLEAR = 0x80000000; mb(); |
@@ -77,9 +77,9 @@ alcor_isa_mask_and_ack_irq(unsigned int irq) | |||
77 | 77 | ||
78 | static struct irq_chip alcor_irq_type = { | 78 | static struct irq_chip alcor_irq_type = { |
79 | .name = "ALCOR", | 79 | .name = "ALCOR", |
80 | .unmask = alcor_enable_irq, | 80 | .irq_unmask = alcor_enable_irq, |
81 | .mask = alcor_disable_irq, | 81 | .irq_mask = alcor_disable_irq, |
82 | .mask_ack = alcor_mask_and_ack_irq, | 82 | .irq_mask_ack = alcor_mask_and_ack_irq, |
83 | }; | 83 | }; |
84 | 84 | ||
85 | static void | 85 | static void |
@@ -126,9 +126,9 @@ alcor_init_irq(void) | |||
126 | if (i >= 16+20 && i <= 16+30) | 126 | if (i >= 16+20 && i <= 16+30) |
127 | continue; | 127 | continue; |
128 | set_irq_chip_and_handler(i, &alcor_irq_type, handle_level_irq); | 128 | set_irq_chip_and_handler(i, &alcor_irq_type, handle_level_irq); |
129 | irq_to_desc(i)->status |= IRQ_LEVEL; | 129 | irq_set_status_flags(i, IRQ_LEVEL); |
130 | } | 130 | } |
131 | i8259a_irq_type.ack = alcor_isa_mask_and_ack_irq; | 131 | i8259a_irq_type.irq_ack = alcor_isa_mask_and_ack_irq; |
132 | 132 | ||
133 | init_i8259a_irqs(); | 133 | init_i8259a_irqs(); |
134 | common_init_isa_dma(); | 134 | common_init_isa_dma(); |
diff --git a/arch/alpha/kernel/sys_cabriolet.c b/arch/alpha/kernel/sys_cabriolet.c index b0c916493aea..57eb6307bc27 100644 --- a/arch/alpha/kernel/sys_cabriolet.c +++ b/arch/alpha/kernel/sys_cabriolet.c | |||
@@ -46,22 +46,22 @@ cabriolet_update_irq_hw(unsigned int irq, unsigned long mask) | |||
46 | } | 46 | } |
47 | 47 | ||
48 | static inline void | 48 | static inline void |
49 | cabriolet_enable_irq(unsigned int irq) | 49 | cabriolet_enable_irq(struct irq_data *d) |
50 | { | 50 | { |
51 | cabriolet_update_irq_hw(irq, cached_irq_mask &= ~(1UL << irq)); | 51 | cabriolet_update_irq_hw(d->irq, cached_irq_mask &= ~(1UL << d->irq)); |
52 | } | 52 | } |
53 | 53 | ||
54 | static void | 54 | static void |
55 | cabriolet_disable_irq(unsigned int irq) | 55 | cabriolet_disable_irq(struct irq_data *d) |
56 | { | 56 | { |
57 | cabriolet_update_irq_hw(irq, cached_irq_mask |= 1UL << irq); | 57 | cabriolet_update_irq_hw(d->irq, cached_irq_mask |= 1UL << d->irq); |
58 | } | 58 | } |
59 | 59 | ||
60 | static struct irq_chip cabriolet_irq_type = { | 60 | static struct irq_chip cabriolet_irq_type = { |
61 | .name = "CABRIOLET", | 61 | .name = "CABRIOLET", |
62 | .unmask = cabriolet_enable_irq, | 62 | .irq_unmask = cabriolet_enable_irq, |
63 | .mask = cabriolet_disable_irq, | 63 | .irq_mask = cabriolet_disable_irq, |
64 | .mask_ack = cabriolet_disable_irq, | 64 | .irq_mask_ack = cabriolet_disable_irq, |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static void | 67 | static void |
@@ -107,7 +107,7 @@ common_init_irq(void (*srm_dev_int)(unsigned long v)) | |||
107 | for (i = 16; i < 35; ++i) { | 107 | for (i = 16; i < 35; ++i) { |
108 | set_irq_chip_and_handler(i, &cabriolet_irq_type, | 108 | set_irq_chip_and_handler(i, &cabriolet_irq_type, |
109 | handle_level_irq); | 109 | handle_level_irq); |
110 | irq_to_desc(i)->status |= IRQ_LEVEL; | 110 | irq_set_status_flags(i, IRQ_LEVEL); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c index edad5f759ccd..481df4ecb651 100644 --- a/arch/alpha/kernel/sys_dp264.c +++ b/arch/alpha/kernel/sys_dp264.c | |||
@@ -98,37 +98,37 @@ tsunami_update_irq_hw(unsigned long mask) | |||
98 | } | 98 | } |
99 | 99 | ||
100 | static void | 100 | static void |
101 | dp264_enable_irq(unsigned int irq) | 101 | dp264_enable_irq(struct irq_data *d) |
102 | { | 102 | { |
103 | spin_lock(&dp264_irq_lock); | 103 | spin_lock(&dp264_irq_lock); |
104 | cached_irq_mask |= 1UL << irq; | 104 | cached_irq_mask |= 1UL << d->irq; |
105 | tsunami_update_irq_hw(cached_irq_mask); | 105 | tsunami_update_irq_hw(cached_irq_mask); |
106 | spin_unlock(&dp264_irq_lock); | 106 | spin_unlock(&dp264_irq_lock); |
107 | } | 107 | } |
108 | 108 | ||
109 | static void | 109 | static void |
110 | dp264_disable_irq(unsigned int irq) | 110 | dp264_disable_irq(struct irq_data *d) |
111 | { | 111 | { |
112 | spin_lock(&dp264_irq_lock); | 112 | spin_lock(&dp264_irq_lock); |
113 | cached_irq_mask &= ~(1UL << irq); | 113 | cached_irq_mask &= ~(1UL << d->irq); |
114 | tsunami_update_irq_hw(cached_irq_mask); | 114 | tsunami_update_irq_hw(cached_irq_mask); |
115 | spin_unlock(&dp264_irq_lock); | 115 | spin_unlock(&dp264_irq_lock); |
116 | } | 116 | } |
117 | 117 | ||
118 | static void | 118 | static void |
119 | clipper_enable_irq(unsigned int irq) | 119 | clipper_enable_irq(struct irq_data *d) |
120 | { | 120 | { |
121 | spin_lock(&dp264_irq_lock); | 121 | spin_lock(&dp264_irq_lock); |
122 | cached_irq_mask |= 1UL << (irq - 16); | 122 | cached_irq_mask |= 1UL << (d->irq - 16); |
123 | tsunami_update_irq_hw(cached_irq_mask); | 123 | tsunami_update_irq_hw(cached_irq_mask); |
124 | spin_unlock(&dp264_irq_lock); | 124 | spin_unlock(&dp264_irq_lock); |
125 | } | 125 | } |
126 | 126 | ||
127 | static void | 127 | static void |
128 | clipper_disable_irq(unsigned int irq) | 128 | clipper_disable_irq(struct irq_data *d) |
129 | { | 129 | { |
130 | spin_lock(&dp264_irq_lock); | 130 | spin_lock(&dp264_irq_lock); |
131 | cached_irq_mask &= ~(1UL << (irq - 16)); | 131 | cached_irq_mask &= ~(1UL << (d->irq - 16)); |
132 | tsunami_update_irq_hw(cached_irq_mask); | 132 | tsunami_update_irq_hw(cached_irq_mask); |
133 | spin_unlock(&dp264_irq_lock); | 133 | spin_unlock(&dp264_irq_lock); |
134 | } | 134 | } |
@@ -149,10 +149,11 @@ cpu_set_irq_affinity(unsigned int irq, cpumask_t affinity) | |||
149 | } | 149 | } |
150 | 150 | ||
151 | static int | 151 | static int |
152 | dp264_set_affinity(unsigned int irq, const struct cpumask *affinity) | 152 | dp264_set_affinity(struct irq_data *d, const struct cpumask *affinity, |
153 | { | 153 | bool force) |
154 | { | ||
154 | spin_lock(&dp264_irq_lock); | 155 | spin_lock(&dp264_irq_lock); |
155 | cpu_set_irq_affinity(irq, *affinity); | 156 | cpu_set_irq_affinity(d->irq, *affinity); |
156 | tsunami_update_irq_hw(cached_irq_mask); | 157 | tsunami_update_irq_hw(cached_irq_mask); |
157 | spin_unlock(&dp264_irq_lock); | 158 | spin_unlock(&dp264_irq_lock); |
158 | 159 | ||
@@ -160,10 +161,11 @@ dp264_set_affinity(unsigned int irq, const struct cpumask *affinity) | |||
160 | } | 161 | } |
161 | 162 | ||
162 | static int | 163 | static int |
163 | clipper_set_affinity(unsigned int irq, const struct cpumask *affinity) | 164 | clipper_set_affinity(struct irq_data *d, const struct cpumask *affinity, |
164 | { | 165 | bool force) |
166 | { | ||
165 | spin_lock(&dp264_irq_lock); | 167 | spin_lock(&dp264_irq_lock); |
166 | cpu_set_irq_affinity(irq - 16, *affinity); | 168 | cpu_set_irq_affinity(d->irq - 16, *affinity); |
167 | tsunami_update_irq_hw(cached_irq_mask); | 169 | tsunami_update_irq_hw(cached_irq_mask); |
168 | spin_unlock(&dp264_irq_lock); | 170 | spin_unlock(&dp264_irq_lock); |
169 | 171 | ||
@@ -171,19 +173,19 @@ clipper_set_affinity(unsigned int irq, const struct cpumask *affinity) | |||
171 | } | 173 | } |
172 | 174 | ||
173 | static struct irq_chip dp264_irq_type = { | 175 | static struct irq_chip dp264_irq_type = { |
174 | .name = "DP264", | 176 | .name = "DP264", |
175 | .unmask = dp264_enable_irq, | 177 | .irq_unmask = dp264_enable_irq, |
176 | .mask = dp264_disable_irq, | 178 | .irq_mask = dp264_disable_irq, |
177 | .mask_ack = dp264_disable_irq, | 179 | .irq_mask_ack = dp264_disable_irq, |
178 | .set_affinity = dp264_set_affinity, | 180 | .irq_set_affinity = dp264_set_affinity, |
179 | }; | 181 | }; |
180 | 182 | ||
181 | static struct irq_chip clipper_irq_type = { | 183 | static struct irq_chip clipper_irq_type = { |
182 | .name = "CLIPPER", | 184 | .name = "CLIPPER", |
183 | .unmask = clipper_enable_irq, | 185 | .irq_unmask = clipper_enable_irq, |
184 | .mask = clipper_disable_irq, | 186 | .irq_mask = clipper_disable_irq, |
185 | .mask_ack = clipper_disable_irq, | 187 | .irq_mask_ack = clipper_disable_irq, |
186 | .set_affinity = clipper_set_affinity, | 188 | .irq_set_affinity = clipper_set_affinity, |
187 | }; | 189 | }; |
188 | 190 | ||
189 | static void | 191 | static void |
@@ -268,8 +270,8 @@ init_tsunami_irqs(struct irq_chip * ops, int imin, int imax) | |||
268 | { | 270 | { |
269 | long i; | 271 | long i; |
270 | for (i = imin; i <= imax; ++i) { | 272 | for (i = imin; i <= imax; ++i) { |
271 | irq_to_desc(i)->status |= IRQ_LEVEL; | ||
272 | set_irq_chip_and_handler(i, ops, handle_level_irq); | 273 | set_irq_chip_and_handler(i, ops, handle_level_irq); |
274 | irq_set_status_flags(i, IRQ_LEVEL); | ||
273 | } | 275 | } |
274 | } | 276 | } |
275 | 277 | ||
diff --git a/arch/alpha/kernel/sys_eb64p.c b/arch/alpha/kernel/sys_eb64p.c index ae5f29d127b0..402e908ffb3e 100644 --- a/arch/alpha/kernel/sys_eb64p.c +++ b/arch/alpha/kernel/sys_eb64p.c | |||
@@ -44,22 +44,22 @@ eb64p_update_irq_hw(unsigned int irq, unsigned long mask) | |||
44 | } | 44 | } |
45 | 45 | ||
46 | static inline void | 46 | static inline void |
47 | eb64p_enable_irq(unsigned int irq) | 47 | eb64p_enable_irq(struct irq_data *d) |
48 | { | 48 | { |
49 | eb64p_update_irq_hw(irq, cached_irq_mask &= ~(1 << irq)); | 49 | eb64p_update_irq_hw(d->irq, cached_irq_mask &= ~(1 << d->irq)); |
50 | } | 50 | } |
51 | 51 | ||
52 | static void | 52 | static void |
53 | eb64p_disable_irq(unsigned int irq) | 53 | eb64p_disable_irq(struct irq_data *d) |
54 | { | 54 | { |
55 | eb64p_update_irq_hw(irq, cached_irq_mask |= 1 << irq); | 55 | eb64p_update_irq_hw(d->irq, cached_irq_mask |= 1 << d->irq); |
56 | } | 56 | } |
57 | 57 | ||
58 | static struct irq_chip eb64p_irq_type = { | 58 | static struct irq_chip eb64p_irq_type = { |
59 | .name = "EB64P", | 59 | .name = "EB64P", |
60 | .unmask = eb64p_enable_irq, | 60 | .irq_unmask = eb64p_enable_irq, |
61 | .mask = eb64p_disable_irq, | 61 | .irq_mask = eb64p_disable_irq, |
62 | .mask_ack = eb64p_disable_irq, | 62 | .irq_mask_ack = eb64p_disable_irq, |
63 | }; | 63 | }; |
64 | 64 | ||
65 | static void | 65 | static void |
@@ -118,9 +118,9 @@ eb64p_init_irq(void) | |||
118 | init_i8259a_irqs(); | 118 | init_i8259a_irqs(); |
119 | 119 | ||
120 | for (i = 16; i < 32; ++i) { | 120 | for (i = 16; i < 32; ++i) { |
121 | irq_to_desc(i)->status |= IRQ_LEVEL; | ||
122 | set_irq_chip_and_handler(i, &eb64p_irq_type, handle_level_irq); | 121 | set_irq_chip_and_handler(i, &eb64p_irq_type, handle_level_irq); |
123 | } | 122 | irq_set_status_flags(i, IRQ_LEVEL); |
123 | } | ||
124 | 124 | ||
125 | common_init_isa_dma(); | 125 | common_init_isa_dma(); |
126 | setup_irq(16+5, &isa_cascade_irqaction); | 126 | setup_irq(16+5, &isa_cascade_irqaction); |
diff --git a/arch/alpha/kernel/sys_eiger.c b/arch/alpha/kernel/sys_eiger.c index 1121bc5c6c6c..0b44a54c1522 100644 --- a/arch/alpha/kernel/sys_eiger.c +++ b/arch/alpha/kernel/sys_eiger.c | |||
@@ -51,16 +51,18 @@ eiger_update_irq_hw(unsigned long irq, unsigned long mask) | |||
51 | } | 51 | } |
52 | 52 | ||
53 | static inline void | 53 | static inline void |
54 | eiger_enable_irq(unsigned int irq) | 54 | eiger_enable_irq(struct irq_data *d) |
55 | { | 55 | { |
56 | unsigned int irq = d->irq; | ||
56 | unsigned long mask; | 57 | unsigned long mask; |
57 | mask = (cached_irq_mask[irq >= 64] &= ~(1UL << (irq & 63))); | 58 | mask = (cached_irq_mask[irq >= 64] &= ~(1UL << (irq & 63))); |
58 | eiger_update_irq_hw(irq, mask); | 59 | eiger_update_irq_hw(irq, mask); |
59 | } | 60 | } |
60 | 61 | ||
61 | static void | 62 | static void |
62 | eiger_disable_irq(unsigned int irq) | 63 | eiger_disable_irq(struct irq_data *d) |
63 | { | 64 | { |
65 | unsigned int irq = d->irq; | ||
64 | unsigned long mask; | 66 | unsigned long mask; |
65 | mask = (cached_irq_mask[irq >= 64] |= 1UL << (irq & 63)); | 67 | mask = (cached_irq_mask[irq >= 64] |= 1UL << (irq & 63)); |
66 | eiger_update_irq_hw(irq, mask); | 68 | eiger_update_irq_hw(irq, mask); |
@@ -68,9 +70,9 @@ eiger_disable_irq(unsigned int irq) | |||
68 | 70 | ||
69 | static struct irq_chip eiger_irq_type = { | 71 | static struct irq_chip eiger_irq_type = { |
70 | .name = "EIGER", | 72 | .name = "EIGER", |
71 | .unmask = eiger_enable_irq, | 73 | .irq_unmask = eiger_enable_irq, |
72 | .mask = eiger_disable_irq, | 74 | .irq_mask = eiger_disable_irq, |
73 | .mask_ack = eiger_disable_irq, | 75 | .irq_mask_ack = eiger_disable_irq, |
74 | }; | 76 | }; |
75 | 77 | ||
76 | static void | 78 | static void |
@@ -136,8 +138,8 @@ eiger_init_irq(void) | |||
136 | init_i8259a_irqs(); | 138 | init_i8259a_irqs(); |
137 | 139 | ||
138 | for (i = 16; i < 128; ++i) { | 140 | for (i = 16; i < 128; ++i) { |
139 | irq_to_desc(i)->status |= IRQ_LEVEL; | ||
140 | set_irq_chip_and_handler(i, &eiger_irq_type, handle_level_irq); | 141 | set_irq_chip_and_handler(i, &eiger_irq_type, handle_level_irq); |
142 | irq_set_status_flags(i, IRQ_LEVEL); | ||
141 | } | 143 | } |
142 | } | 144 | } |
143 | 145 | ||
diff --git a/arch/alpha/kernel/sys_jensen.c b/arch/alpha/kernel/sys_jensen.c index 34f55e03d331..00341b75c8b2 100644 --- a/arch/alpha/kernel/sys_jensen.c +++ b/arch/alpha/kernel/sys_jensen.c | |||
@@ -63,34 +63,34 @@ | |||
63 | */ | 63 | */ |
64 | 64 | ||
65 | static void | 65 | static void |
66 | jensen_local_enable(unsigned int irq) | 66 | jensen_local_enable(struct irq_data *d) |
67 | { | 67 | { |
68 | /* the parport is really hw IRQ 1, silly Jensen. */ | 68 | /* the parport is really hw IRQ 1, silly Jensen. */ |
69 | if (irq == 7) | 69 | if (d->irq == 7) |
70 | i8259a_enable_irq(1); | 70 | i8259a_enable_irq(d); |
71 | } | 71 | } |
72 | 72 | ||
73 | static void | 73 | static void |
74 | jensen_local_disable(unsigned int irq) | 74 | jensen_local_disable(struct irq_data *d) |
75 | { | 75 | { |
76 | /* the parport is really hw IRQ 1, silly Jensen. */ | 76 | /* the parport is really hw IRQ 1, silly Jensen. */ |
77 | if (irq == 7) | 77 | if (d->irq == 7) |
78 | i8259a_disable_irq(1); | 78 | i8259a_disable_irq(d); |
79 | } | 79 | } |
80 | 80 | ||
81 | static void | 81 | static void |
82 | jensen_local_mask_ack(unsigned int irq) | 82 | jensen_local_mask_ack(struct irq_data *d) |
83 | { | 83 | { |
84 | /* the parport is really hw IRQ 1, silly Jensen. */ | 84 | /* the parport is really hw IRQ 1, silly Jensen. */ |
85 | if (irq == 7) | 85 | if (d->irq == 7) |
86 | i8259a_mask_and_ack_irq(1); | 86 | i8259a_mask_and_ack_irq(d); |
87 | } | 87 | } |
88 | 88 | ||
89 | static struct irq_chip jensen_local_irq_type = { | 89 | static struct irq_chip jensen_local_irq_type = { |
90 | .name = "LOCAL", | 90 | .name = "LOCAL", |
91 | .unmask = jensen_local_enable, | 91 | .irq_unmask = jensen_local_enable, |
92 | .mask = jensen_local_disable, | 92 | .irq_mask = jensen_local_disable, |
93 | .mask_ack = jensen_local_mask_ack, | 93 | .irq_mask_ack = jensen_local_mask_ack, |
94 | }; | 94 | }; |
95 | 95 | ||
96 | static void | 96 | static void |
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c index 2bfc9f1b1ddc..e61910734e41 100644 --- a/arch/alpha/kernel/sys_marvel.c +++ b/arch/alpha/kernel/sys_marvel.c | |||
@@ -104,9 +104,10 @@ io7_get_irq_ctl(unsigned int irq, struct io7 **pio7) | |||
104 | } | 104 | } |
105 | 105 | ||
106 | static void | 106 | static void |
107 | io7_enable_irq(unsigned int irq) | 107 | io7_enable_irq(struct irq_data *d) |
108 | { | 108 | { |
109 | volatile unsigned long *ctl; | 109 | volatile unsigned long *ctl; |
110 | unsigned int irq = d->irq; | ||
110 | struct io7 *io7; | 111 | struct io7 *io7; |
111 | 112 | ||
112 | ctl = io7_get_irq_ctl(irq, &io7); | 113 | ctl = io7_get_irq_ctl(irq, &io7); |
@@ -115,7 +116,7 @@ io7_enable_irq(unsigned int irq) | |||
115 | __func__, irq); | 116 | __func__, irq); |
116 | return; | 117 | return; |
117 | } | 118 | } |
118 | 119 | ||
119 | spin_lock(&io7->irq_lock); | 120 | spin_lock(&io7->irq_lock); |
120 | *ctl |= 1UL << 24; | 121 | *ctl |= 1UL << 24; |
121 | mb(); | 122 | mb(); |
@@ -124,9 +125,10 @@ io7_enable_irq(unsigned int irq) | |||
124 | } | 125 | } |
125 | 126 | ||
126 | static void | 127 | static void |
127 | io7_disable_irq(unsigned int irq) | 128 | io7_disable_irq(struct irq_data *d) |
128 | { | 129 | { |
129 | volatile unsigned long *ctl; | 130 | volatile unsigned long *ctl; |
131 | unsigned int irq = d->irq; | ||
130 | struct io7 *io7; | 132 | struct io7 *io7; |
131 | 133 | ||
132 | ctl = io7_get_irq_ctl(irq, &io7); | 134 | ctl = io7_get_irq_ctl(irq, &io7); |
@@ -135,7 +137,7 @@ io7_disable_irq(unsigned int irq) | |||
135 | __func__, irq); | 137 | __func__, irq); |
136 | return; | 138 | return; |
137 | } | 139 | } |
138 | 140 | ||
139 | spin_lock(&io7->irq_lock); | 141 | spin_lock(&io7->irq_lock); |
140 | *ctl &= ~(1UL << 24); | 142 | *ctl &= ~(1UL << 24); |
141 | mb(); | 143 | mb(); |
@@ -144,35 +146,29 @@ io7_disable_irq(unsigned int irq) | |||
144 | } | 146 | } |
145 | 147 | ||
146 | static void | 148 | static void |
147 | marvel_irq_noop(unsigned int irq) | 149 | marvel_irq_noop(struct irq_data *d) |
148 | { | 150 | { |
149 | return; | 151 | return; |
150 | } | ||
151 | |||
152 | static unsigned int | ||
153 | marvel_irq_noop_return(unsigned int irq) | ||
154 | { | ||
155 | return 0; | ||
156 | } | 152 | } |
157 | 153 | ||
158 | static struct irq_chip marvel_legacy_irq_type = { | 154 | static struct irq_chip marvel_legacy_irq_type = { |
159 | .name = "LEGACY", | 155 | .name = "LEGACY", |
160 | .mask = marvel_irq_noop, | 156 | .irq_mask = marvel_irq_noop, |
161 | .unmask = marvel_irq_noop, | 157 | .irq_unmask = marvel_irq_noop, |
162 | }; | 158 | }; |
163 | 159 | ||
164 | static struct irq_chip io7_lsi_irq_type = { | 160 | static struct irq_chip io7_lsi_irq_type = { |
165 | .name = "LSI", | 161 | .name = "LSI", |
166 | .unmask = io7_enable_irq, | 162 | .irq_unmask = io7_enable_irq, |
167 | .mask = io7_disable_irq, | 163 | .irq_mask = io7_disable_irq, |
168 | .mask_ack = io7_disable_irq, | 164 | .irq_mask_ack = io7_disable_irq, |
169 | }; | 165 | }; |
170 | 166 | ||
171 | static struct irq_chip io7_msi_irq_type = { | 167 | static struct irq_chip io7_msi_irq_type = { |
172 | .name = "MSI", | 168 | .name = "MSI", |
173 | .unmask = io7_enable_irq, | 169 | .irq_unmask = io7_enable_irq, |
174 | .mask = io7_disable_irq, | 170 | .irq_mask = io7_disable_irq, |
175 | .ack = marvel_irq_noop, | 171 | .irq_ack = marvel_irq_noop, |
176 | }; | 172 | }; |
177 | 173 | ||
178 | static void | 174 | static void |
@@ -280,8 +276,8 @@ init_io7_irqs(struct io7 *io7, | |||
280 | 276 | ||
281 | /* Set up the lsi irqs. */ | 277 | /* Set up the lsi irqs. */ |
282 | for (i = 0; i < 128; ++i) { | 278 | for (i = 0; i < 128; ++i) { |
283 | irq_to_desc(base + i)->status |= IRQ_LEVEL; | ||
284 | set_irq_chip_and_handler(base + i, lsi_ops, handle_level_irq); | 279 | set_irq_chip_and_handler(base + i, lsi_ops, handle_level_irq); |
280 | irq_set_status_flags(i, IRQ_LEVEL); | ||
285 | } | 281 | } |
286 | 282 | ||
287 | /* Disable the implemented irqs in hardware. */ | 283 | /* Disable the implemented irqs in hardware. */ |
@@ -294,8 +290,8 @@ init_io7_irqs(struct io7 *io7, | |||
294 | 290 | ||
295 | /* Set up the msi irqs. */ | 291 | /* Set up the msi irqs. */ |
296 | for (i = 128; i < (128 + 512); ++i) { | 292 | for (i = 128; i < (128 + 512); ++i) { |
297 | irq_to_desc(base + i)->status |= IRQ_LEVEL; | ||
298 | set_irq_chip_and_handler(base + i, msi_ops, handle_level_irq); | 293 | set_irq_chip_and_handler(base + i, msi_ops, handle_level_irq); |
294 | irq_set_status_flags(i, IRQ_LEVEL); | ||
299 | } | 295 | } |
300 | 296 | ||
301 | for (i = 0; i < 16; ++i) | 297 | for (i = 0; i < 16; ++i) |
diff --git a/arch/alpha/kernel/sys_mikasa.c b/arch/alpha/kernel/sys_mikasa.c index bcc1639e8efb..cf7f43dd3147 100644 --- a/arch/alpha/kernel/sys_mikasa.c +++ b/arch/alpha/kernel/sys_mikasa.c | |||
@@ -43,22 +43,22 @@ mikasa_update_irq_hw(int mask) | |||
43 | } | 43 | } |
44 | 44 | ||
45 | static inline void | 45 | static inline void |
46 | mikasa_enable_irq(unsigned int irq) | 46 | mikasa_enable_irq(struct irq_data *d) |
47 | { | 47 | { |
48 | mikasa_update_irq_hw(cached_irq_mask |= 1 << (irq - 16)); | 48 | mikasa_update_irq_hw(cached_irq_mask |= 1 << (d->irq - 16)); |
49 | } | 49 | } |
50 | 50 | ||
51 | static void | 51 | static void |
52 | mikasa_disable_irq(unsigned int irq) | 52 | mikasa_disable_irq(struct irq_data *d) |
53 | { | 53 | { |
54 | mikasa_update_irq_hw(cached_irq_mask &= ~(1 << (irq - 16))); | 54 | mikasa_update_irq_hw(cached_irq_mask &= ~(1 << (d->irq - 16))); |
55 | } | 55 | } |
56 | 56 | ||
57 | static struct irq_chip mikasa_irq_type = { | 57 | static struct irq_chip mikasa_irq_type = { |
58 | .name = "MIKASA", | 58 | .name = "MIKASA", |
59 | .unmask = mikasa_enable_irq, | 59 | .irq_unmask = mikasa_enable_irq, |
60 | .mask = mikasa_disable_irq, | 60 | .irq_mask = mikasa_disable_irq, |
61 | .mask_ack = mikasa_disable_irq, | 61 | .irq_mask_ack = mikasa_disable_irq, |
62 | }; | 62 | }; |
63 | 63 | ||
64 | static void | 64 | static void |
@@ -98,8 +98,8 @@ mikasa_init_irq(void) | |||
98 | mikasa_update_irq_hw(0); | 98 | mikasa_update_irq_hw(0); |
99 | 99 | ||
100 | for (i = 16; i < 32; ++i) { | 100 | for (i = 16; i < 32; ++i) { |
101 | irq_to_desc(i)->status |= IRQ_LEVEL; | ||
102 | set_irq_chip_and_handler(i, &mikasa_irq_type, handle_level_irq); | 101 | set_irq_chip_and_handler(i, &mikasa_irq_type, handle_level_irq); |
102 | irq_set_status_flags(i, IRQ_LEVEL); | ||
103 | } | 103 | } |
104 | 104 | ||
105 | init_i8259a_irqs(); | 105 | init_i8259a_irqs(); |
diff --git a/arch/alpha/kernel/sys_noritake.c b/arch/alpha/kernel/sys_noritake.c index e88f4ae1260e..92bc188e94a9 100644 --- a/arch/alpha/kernel/sys_noritake.c +++ b/arch/alpha/kernel/sys_noritake.c | |||
@@ -48,22 +48,22 @@ noritake_update_irq_hw(int irq, int mask) | |||
48 | } | 48 | } |
49 | 49 | ||
50 | static void | 50 | static void |
51 | noritake_enable_irq(unsigned int irq) | 51 | noritake_enable_irq(struct irq_data *d) |
52 | { | 52 | { |
53 | noritake_update_irq_hw(irq, cached_irq_mask |= 1 << (irq - 16)); | 53 | noritake_update_irq_hw(d->irq, cached_irq_mask |= 1 << (d->irq - 16)); |
54 | } | 54 | } |
55 | 55 | ||
56 | static void | 56 | static void |
57 | noritake_disable_irq(unsigned int irq) | 57 | noritake_disable_irq(struct irq_data *d) |
58 | { | 58 | { |
59 | noritake_update_irq_hw(irq, cached_irq_mask &= ~(1 << (irq - 16))); | 59 | noritake_update_irq_hw(d->irq, cached_irq_mask &= ~(1 << (d->irq - 16))); |
60 | } | 60 | } |
61 | 61 | ||
62 | static struct irq_chip noritake_irq_type = { | 62 | static struct irq_chip noritake_irq_type = { |
63 | .name = "NORITAKE", | 63 | .name = "NORITAKE", |
64 | .unmask = noritake_enable_irq, | 64 | .irq_unmask = noritake_enable_irq, |
65 | .mask = noritake_disable_irq, | 65 | .irq_mask = noritake_disable_irq, |
66 | .mask_ack = noritake_disable_irq, | 66 | .irq_mask_ack = noritake_disable_irq, |
67 | }; | 67 | }; |
68 | 68 | ||
69 | static void | 69 | static void |
@@ -127,8 +127,8 @@ noritake_init_irq(void) | |||
127 | outw(0, 0x54c); | 127 | outw(0, 0x54c); |
128 | 128 | ||
129 | for (i = 16; i < 48; ++i) { | 129 | for (i = 16; i < 48; ++i) { |
130 | irq_to_desc(i)->status |= IRQ_LEVEL; | ||
131 | set_irq_chip_and_handler(i, &noritake_irq_type, handle_level_irq); | 130 | set_irq_chip_and_handler(i, &noritake_irq_type, handle_level_irq); |
131 | irq_set_status_flags(i, IRQ_LEVEL); | ||
132 | } | 132 | } |
133 | 133 | ||
134 | init_i8259a_irqs(); | 134 | init_i8259a_irqs(); |
diff --git a/arch/alpha/kernel/sys_rawhide.c b/arch/alpha/kernel/sys_rawhide.c index 6a51364dd1cc..936d4140ed5f 100644 --- a/arch/alpha/kernel/sys_rawhide.c +++ b/arch/alpha/kernel/sys_rawhide.c | |||
@@ -56,9 +56,10 @@ rawhide_update_irq_hw(int hose, int mask) | |||
56 | (((h) < MCPCIA_MAX_HOSES) && (cached_irq_masks[(h)] != 0)) | 56 | (((h) < MCPCIA_MAX_HOSES) && (cached_irq_masks[(h)] != 0)) |
57 | 57 | ||
58 | static inline void | 58 | static inline void |
59 | rawhide_enable_irq(unsigned int irq) | 59 | rawhide_enable_irq(struct irq_data *d) |
60 | { | 60 | { |
61 | unsigned int mask, hose; | 61 | unsigned int mask, hose; |
62 | unsigned int irq = d->irq; | ||
62 | 63 | ||
63 | irq -= 16; | 64 | irq -= 16; |
64 | hose = irq / 24; | 65 | hose = irq / 24; |
@@ -76,9 +77,10 @@ rawhide_enable_irq(unsigned int irq) | |||
76 | } | 77 | } |
77 | 78 | ||
78 | static void | 79 | static void |
79 | rawhide_disable_irq(unsigned int irq) | 80 | rawhide_disable_irq(struct irq_data *d) |
80 | { | 81 | { |
81 | unsigned int mask, hose; | 82 | unsigned int mask, hose; |
83 | unsigned int irq = d->irq; | ||
82 | 84 | ||
83 | irq -= 16; | 85 | irq -= 16; |
84 | hose = irq / 24; | 86 | hose = irq / 24; |
@@ -96,9 +98,10 @@ rawhide_disable_irq(unsigned int irq) | |||
96 | } | 98 | } |
97 | 99 | ||
98 | static void | 100 | static void |
99 | rawhide_mask_and_ack_irq(unsigned int irq) | 101 | rawhide_mask_and_ack_irq(struct irq_data *d) |
100 | { | 102 | { |
101 | unsigned int mask, mask1, hose; | 103 | unsigned int mask, mask1, hose; |
104 | unsigned int irq = d->irq; | ||
102 | 105 | ||
103 | irq -= 16; | 106 | irq -= 16; |
104 | hose = irq / 24; | 107 | hose = irq / 24; |
@@ -123,9 +126,9 @@ rawhide_mask_and_ack_irq(unsigned int irq) | |||
123 | 126 | ||
124 | static struct irq_chip rawhide_irq_type = { | 127 | static struct irq_chip rawhide_irq_type = { |
125 | .name = "RAWHIDE", | 128 | .name = "RAWHIDE", |
126 | .unmask = rawhide_enable_irq, | 129 | .irq_unmask = rawhide_enable_irq, |
127 | .mask = rawhide_disable_irq, | 130 | .irq_mask = rawhide_disable_irq, |
128 | .mask_ack = rawhide_mask_and_ack_irq, | 131 | .irq_mask_ack = rawhide_mask_and_ack_irq, |
129 | }; | 132 | }; |
130 | 133 | ||
131 | static void | 134 | static void |
@@ -177,8 +180,8 @@ rawhide_init_irq(void) | |||
177 | } | 180 | } |
178 | 181 | ||
179 | for (i = 16; i < 128; ++i) { | 182 | for (i = 16; i < 128; ++i) { |
180 | irq_to_desc(i)->status |= IRQ_LEVEL; | ||
181 | set_irq_chip_and_handler(i, &rawhide_irq_type, handle_level_irq); | 183 | set_irq_chip_and_handler(i, &rawhide_irq_type, handle_level_irq); |
184 | irq_set_status_flags(i, IRQ_LEVEL); | ||
182 | } | 185 | } |
183 | 186 | ||
184 | init_i8259a_irqs(); | 187 | init_i8259a_irqs(); |
diff --git a/arch/alpha/kernel/sys_rx164.c b/arch/alpha/kernel/sys_rx164.c index 89e7e37ec84c..cea22a62913b 100644 --- a/arch/alpha/kernel/sys_rx164.c +++ b/arch/alpha/kernel/sys_rx164.c | |||
@@ -47,22 +47,22 @@ rx164_update_irq_hw(unsigned long mask) | |||
47 | } | 47 | } |
48 | 48 | ||
49 | static inline void | 49 | static inline void |
50 | rx164_enable_irq(unsigned int irq) | 50 | rx164_enable_irq(struct irq_data *d) |
51 | { | 51 | { |
52 | rx164_update_irq_hw(cached_irq_mask |= 1UL << (irq - 16)); | 52 | rx164_update_irq_hw(cached_irq_mask |= 1UL << (d->irq - 16)); |
53 | } | 53 | } |
54 | 54 | ||
55 | static void | 55 | static void |
56 | rx164_disable_irq(unsigned int irq) | 56 | rx164_disable_irq(struct irq_data *d) |
57 | { | 57 | { |
58 | rx164_update_irq_hw(cached_irq_mask &= ~(1UL << (irq - 16))); | 58 | rx164_update_irq_hw(cached_irq_mask &= ~(1UL << (d->irq - 16))); |
59 | } | 59 | } |
60 | 60 | ||
61 | static struct irq_chip rx164_irq_type = { | 61 | static struct irq_chip rx164_irq_type = { |
62 | .name = "RX164", | 62 | .name = "RX164", |
63 | .unmask = rx164_enable_irq, | 63 | .irq_unmask = rx164_enable_irq, |
64 | .mask = rx164_disable_irq, | 64 | .irq_mask = rx164_disable_irq, |
65 | .mask_ack = rx164_disable_irq, | 65 | .irq_mask_ack = rx164_disable_irq, |
66 | }; | 66 | }; |
67 | 67 | ||
68 | static void | 68 | static void |
@@ -99,8 +99,8 @@ rx164_init_irq(void) | |||
99 | 99 | ||
100 | rx164_update_irq_hw(0); | 100 | rx164_update_irq_hw(0); |
101 | for (i = 16; i < 40; ++i) { | 101 | for (i = 16; i < 40; ++i) { |
102 | irq_to_desc(i)->status |= IRQ_LEVEL; | ||
103 | set_irq_chip_and_handler(i, &rx164_irq_type, handle_level_irq); | 102 | set_irq_chip_and_handler(i, &rx164_irq_type, handle_level_irq); |
103 | irq_set_status_flags(i, IRQ_LEVEL); | ||
104 | } | 104 | } |
105 | 105 | ||
106 | init_i8259a_irqs(); | 106 | init_i8259a_irqs(); |
diff --git a/arch/alpha/kernel/sys_sable.c b/arch/alpha/kernel/sys_sable.c index 5c4423d1b06c..a349538aabc9 100644 --- a/arch/alpha/kernel/sys_sable.c +++ b/arch/alpha/kernel/sys_sable.c | |||
@@ -443,11 +443,11 @@ lynx_swizzle(struct pci_dev *dev, u8 *pinp) | |||
443 | /* GENERIC irq routines */ | 443 | /* GENERIC irq routines */ |
444 | 444 | ||
445 | static inline void | 445 | static inline void |
446 | sable_lynx_enable_irq(unsigned int irq) | 446 | sable_lynx_enable_irq(struct irq_data *d) |
447 | { | 447 | { |
448 | unsigned long bit, mask; | 448 | unsigned long bit, mask; |
449 | 449 | ||
450 | bit = sable_lynx_irq_swizzle->irq_to_mask[irq]; | 450 | bit = sable_lynx_irq_swizzle->irq_to_mask[d->irq]; |
451 | spin_lock(&sable_lynx_irq_lock); | 451 | spin_lock(&sable_lynx_irq_lock); |
452 | mask = sable_lynx_irq_swizzle->shadow_mask &= ~(1UL << bit); | 452 | mask = sable_lynx_irq_swizzle->shadow_mask &= ~(1UL << bit); |
453 | sable_lynx_irq_swizzle->update_irq_hw(bit, mask); | 453 | sable_lynx_irq_swizzle->update_irq_hw(bit, mask); |
@@ -459,11 +459,11 @@ sable_lynx_enable_irq(unsigned int irq) | |||
459 | } | 459 | } |
460 | 460 | ||
461 | static void | 461 | static void |
462 | sable_lynx_disable_irq(unsigned int irq) | 462 | sable_lynx_disable_irq(struct irq_data *d) |
463 | { | 463 | { |
464 | unsigned long bit, mask; | 464 | unsigned long bit, mask; |
465 | 465 | ||
466 | bit = sable_lynx_irq_swizzle->irq_to_mask[irq]; | 466 | bit = sable_lynx_irq_swizzle->irq_to_mask[d->irq]; |
467 | spin_lock(&sable_lynx_irq_lock); | 467 | spin_lock(&sable_lynx_irq_lock); |
468 | mask = sable_lynx_irq_swizzle->shadow_mask |= 1UL << bit; | 468 | mask = sable_lynx_irq_swizzle->shadow_mask |= 1UL << bit; |
469 | sable_lynx_irq_swizzle->update_irq_hw(bit, mask); | 469 | sable_lynx_irq_swizzle->update_irq_hw(bit, mask); |
@@ -475,11 +475,11 @@ sable_lynx_disable_irq(unsigned int irq) | |||
475 | } | 475 | } |
476 | 476 | ||
477 | static void | 477 | static void |
478 | sable_lynx_mask_and_ack_irq(unsigned int irq) | 478 | sable_lynx_mask_and_ack_irq(struct irq_data *d) |
479 | { | 479 | { |
480 | unsigned long bit, mask; | 480 | unsigned long bit, mask; |
481 | 481 | ||
482 | bit = sable_lynx_irq_swizzle->irq_to_mask[irq]; | 482 | bit = sable_lynx_irq_swizzle->irq_to_mask[d->irq]; |
483 | spin_lock(&sable_lynx_irq_lock); | 483 | spin_lock(&sable_lynx_irq_lock); |
484 | mask = sable_lynx_irq_swizzle->shadow_mask |= 1UL << bit; | 484 | mask = sable_lynx_irq_swizzle->shadow_mask |= 1UL << bit; |
485 | sable_lynx_irq_swizzle->update_irq_hw(bit, mask); | 485 | sable_lynx_irq_swizzle->update_irq_hw(bit, mask); |
@@ -489,9 +489,9 @@ sable_lynx_mask_and_ack_irq(unsigned int irq) | |||
489 | 489 | ||
490 | static struct irq_chip sable_lynx_irq_type = { | 490 | static struct irq_chip sable_lynx_irq_type = { |
491 | .name = "SABLE/LYNX", | 491 | .name = "SABLE/LYNX", |
492 | .unmask = sable_lynx_enable_irq, | 492 | .irq_unmask = sable_lynx_enable_irq, |
493 | .mask = sable_lynx_disable_irq, | 493 | .irq_mask = sable_lynx_disable_irq, |
494 | .mask_ack = sable_lynx_mask_and_ack_irq, | 494 | .irq_mask_ack = sable_lynx_mask_and_ack_irq, |
495 | }; | 495 | }; |
496 | 496 | ||
497 | static void | 497 | static void |
@@ -518,9 +518,9 @@ sable_lynx_init_irq(int nr_of_irqs) | |||
518 | long i; | 518 | long i; |
519 | 519 | ||
520 | for (i = 0; i < nr_of_irqs; ++i) { | 520 | for (i = 0; i < nr_of_irqs; ++i) { |
521 | irq_to_desc(i)->status |= IRQ_LEVEL; | ||
522 | set_irq_chip_and_handler(i, &sable_lynx_irq_type, | 521 | set_irq_chip_and_handler(i, &sable_lynx_irq_type, |
523 | handle_level_irq); | 522 | handle_level_irq); |
523 | irq_set_status_flags(i, IRQ_LEVEL); | ||
524 | } | 524 | } |
525 | 525 | ||
526 | common_init_isa_dma(); | 526 | common_init_isa_dma(); |
diff --git a/arch/alpha/kernel/sys_takara.c b/arch/alpha/kernel/sys_takara.c index f8a1e8a862fb..42a5331f13c4 100644 --- a/arch/alpha/kernel/sys_takara.c +++ b/arch/alpha/kernel/sys_takara.c | |||
@@ -45,16 +45,18 @@ takara_update_irq_hw(unsigned long irq, unsigned long mask) | |||
45 | } | 45 | } |
46 | 46 | ||
47 | static inline void | 47 | static inline void |
48 | takara_enable_irq(unsigned int irq) | 48 | takara_enable_irq(struct irq_data *d) |
49 | { | 49 | { |
50 | unsigned int irq = d->irq; | ||
50 | unsigned long mask; | 51 | unsigned long mask; |
51 | mask = (cached_irq_mask[irq >= 64] &= ~(1UL << (irq & 63))); | 52 | mask = (cached_irq_mask[irq >= 64] &= ~(1UL << (irq & 63))); |
52 | takara_update_irq_hw(irq, mask); | 53 | takara_update_irq_hw(irq, mask); |
53 | } | 54 | } |
54 | 55 | ||
55 | static void | 56 | static void |
56 | takara_disable_irq(unsigned int irq) | 57 | takara_disable_irq(struct irq_data *d) |
57 | { | 58 | { |
59 | unsigned int irq = d->irq; | ||
58 | unsigned long mask; | 60 | unsigned long mask; |
59 | mask = (cached_irq_mask[irq >= 64] |= 1UL << (irq & 63)); | 61 | mask = (cached_irq_mask[irq >= 64] |= 1UL << (irq & 63)); |
60 | takara_update_irq_hw(irq, mask); | 62 | takara_update_irq_hw(irq, mask); |
@@ -62,9 +64,9 @@ takara_disable_irq(unsigned int irq) | |||
62 | 64 | ||
63 | static struct irq_chip takara_irq_type = { | 65 | static struct irq_chip takara_irq_type = { |
64 | .name = "TAKARA", | 66 | .name = "TAKARA", |
65 | .unmask = takara_enable_irq, | 67 | .irq_unmask = takara_enable_irq, |
66 | .mask = takara_disable_irq, | 68 | .irq_mask = takara_disable_irq, |
67 | .mask_ack = takara_disable_irq, | 69 | .irq_mask_ack = takara_disable_irq, |
68 | }; | 70 | }; |
69 | 71 | ||
70 | static void | 72 | static void |
@@ -136,8 +138,8 @@ takara_init_irq(void) | |||
136 | takara_update_irq_hw(i, -1); | 138 | takara_update_irq_hw(i, -1); |
137 | 139 | ||
138 | for (i = 16; i < 128; ++i) { | 140 | for (i = 16; i < 128; ++i) { |
139 | irq_to_desc(i)->status |= IRQ_LEVEL; | ||
140 | set_irq_chip_and_handler(i, &takara_irq_type, handle_level_irq); | 141 | set_irq_chip_and_handler(i, &takara_irq_type, handle_level_irq); |
142 | irq_set_status_flags(i, IRQ_LEVEL); | ||
141 | } | 143 | } |
142 | 144 | ||
143 | common_init_isa_dma(); | 145 | common_init_isa_dma(); |
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c index e02494bf5ef3..8c13a0c77830 100644 --- a/arch/alpha/kernel/sys_titan.c +++ b/arch/alpha/kernel/sys_titan.c | |||
@@ -112,8 +112,9 @@ titan_update_irq_hw(unsigned long mask) | |||
112 | } | 112 | } |
113 | 113 | ||
114 | static inline void | 114 | static inline void |
115 | titan_enable_irq(unsigned int irq) | 115 | titan_enable_irq(struct irq_data *d) |
116 | { | 116 | { |
117 | unsigned int irq = d->irq; | ||
117 | spin_lock(&titan_irq_lock); | 118 | spin_lock(&titan_irq_lock); |
118 | titan_cached_irq_mask |= 1UL << (irq - 16); | 119 | titan_cached_irq_mask |= 1UL << (irq - 16); |
119 | titan_update_irq_hw(titan_cached_irq_mask); | 120 | titan_update_irq_hw(titan_cached_irq_mask); |
@@ -121,8 +122,9 @@ titan_enable_irq(unsigned int irq) | |||
121 | } | 122 | } |
122 | 123 | ||
123 | static inline void | 124 | static inline void |
124 | titan_disable_irq(unsigned int irq) | 125 | titan_disable_irq(struct irq_data *d) |
125 | { | 126 | { |
127 | unsigned int irq = d->irq; | ||
126 | spin_lock(&titan_irq_lock); | 128 | spin_lock(&titan_irq_lock); |
127 | titan_cached_irq_mask &= ~(1UL << (irq - 16)); | 129 | titan_cached_irq_mask &= ~(1UL << (irq - 16)); |
128 | titan_update_irq_hw(titan_cached_irq_mask); | 130 | titan_update_irq_hw(titan_cached_irq_mask); |
@@ -144,8 +146,10 @@ titan_cpu_set_irq_affinity(unsigned int irq, cpumask_t affinity) | |||
144 | } | 146 | } |
145 | 147 | ||
146 | static int | 148 | static int |
147 | titan_set_irq_affinity(unsigned int irq, const struct cpumask *affinity) | 149 | titan_set_irq_affinity(struct irq_data *d, const struct cpumask *affinity, |
150 | bool force) | ||
148 | { | 151 | { |
152 | unsigned int irq = d->irq; | ||
149 | spin_lock(&titan_irq_lock); | 153 | spin_lock(&titan_irq_lock); |
150 | titan_cpu_set_irq_affinity(irq - 16, *affinity); | 154 | titan_cpu_set_irq_affinity(irq - 16, *affinity); |
151 | titan_update_irq_hw(titan_cached_irq_mask); | 155 | titan_update_irq_hw(titan_cached_irq_mask); |
@@ -175,17 +179,17 @@ init_titan_irqs(struct irq_chip * ops, int imin, int imax) | |||
175 | { | 179 | { |
176 | long i; | 180 | long i; |
177 | for (i = imin; i <= imax; ++i) { | 181 | for (i = imin; i <= imax; ++i) { |
178 | irq_to_desc(i)->status |= IRQ_LEVEL; | ||
179 | set_irq_chip_and_handler(i, ops, handle_level_irq); | 182 | set_irq_chip_and_handler(i, ops, handle_level_irq); |
183 | irq_set_status_flags(i, IRQ_LEVEL); | ||
180 | } | 184 | } |
181 | } | 185 | } |
182 | 186 | ||
183 | static struct irq_chip titan_irq_type = { | 187 | static struct irq_chip titan_irq_type = { |
184 | .name = "TITAN", | 188 | .name = "TITAN", |
185 | .unmask = titan_enable_irq, | 189 | .irq_unmask = titan_enable_irq, |
186 | .mask = titan_disable_irq, | 190 | .irq_mask = titan_disable_irq, |
187 | .mask_ack = titan_disable_irq, | 191 | .irq_mask_ack = titan_disable_irq, |
188 | .set_affinity = titan_set_irq_affinity, | 192 | .irq_set_affinity = titan_set_irq_affinity, |
189 | }; | 193 | }; |
190 | 194 | ||
191 | static irqreturn_t | 195 | static irqreturn_t |
diff --git a/arch/alpha/kernel/sys_wildfire.c b/arch/alpha/kernel/sys_wildfire.c index eec52594d410..ca60a387ef0a 100644 --- a/arch/alpha/kernel/sys_wildfire.c +++ b/arch/alpha/kernel/sys_wildfire.c | |||
@@ -104,10 +104,12 @@ wildfire_init_irq_hw(void) | |||
104 | } | 104 | } |
105 | 105 | ||
106 | static void | 106 | static void |
107 | wildfire_enable_irq(unsigned int irq) | 107 | wildfire_enable_irq(struct irq_data *d) |
108 | { | 108 | { |
109 | unsigned int irq = d->irq; | ||
110 | |||
109 | if (irq < 16) | 111 | if (irq < 16) |
110 | i8259a_enable_irq(irq); | 112 | i8259a_enable_irq(d); |
111 | 113 | ||
112 | spin_lock(&wildfire_irq_lock); | 114 | spin_lock(&wildfire_irq_lock); |
113 | set_bit(irq, &cached_irq_mask); | 115 | set_bit(irq, &cached_irq_mask); |
@@ -116,10 +118,12 @@ wildfire_enable_irq(unsigned int irq) | |||
116 | } | 118 | } |
117 | 119 | ||
118 | static void | 120 | static void |
119 | wildfire_disable_irq(unsigned int irq) | 121 | wildfire_disable_irq(struct irq_data *d) |
120 | { | 122 | { |
123 | unsigned int irq = d->irq; | ||
124 | |||
121 | if (irq < 16) | 125 | if (irq < 16) |
122 | i8259a_disable_irq(irq); | 126 | i8259a_disable_irq(d); |
123 | 127 | ||
124 | spin_lock(&wildfire_irq_lock); | 128 | spin_lock(&wildfire_irq_lock); |
125 | clear_bit(irq, &cached_irq_mask); | 129 | clear_bit(irq, &cached_irq_mask); |
@@ -128,10 +132,12 @@ wildfire_disable_irq(unsigned int irq) | |||
128 | } | 132 | } |
129 | 133 | ||
130 | static void | 134 | static void |
131 | wildfire_mask_and_ack_irq(unsigned int irq) | 135 | wildfire_mask_and_ack_irq(struct irq_data *d) |
132 | { | 136 | { |
137 | unsigned int irq = d->irq; | ||
138 | |||
133 | if (irq < 16) | 139 | if (irq < 16) |
134 | i8259a_mask_and_ack_irq(irq); | 140 | i8259a_mask_and_ack_irq(d); |
135 | 141 | ||
136 | spin_lock(&wildfire_irq_lock); | 142 | spin_lock(&wildfire_irq_lock); |
137 | clear_bit(irq, &cached_irq_mask); | 143 | clear_bit(irq, &cached_irq_mask); |
@@ -141,9 +147,9 @@ wildfire_mask_and_ack_irq(unsigned int irq) | |||
141 | 147 | ||
142 | static struct irq_chip wildfire_irq_type = { | 148 | static struct irq_chip wildfire_irq_type = { |
143 | .name = "WILDFIRE", | 149 | .name = "WILDFIRE", |
144 | .unmask = wildfire_enable_irq, | 150 | .irq_unmask = wildfire_enable_irq, |
145 | .mask = wildfire_disable_irq, | 151 | .irq_mask = wildfire_disable_irq, |
146 | .mask_ack = wildfire_mask_and_ack_irq, | 152 | .irq_mask_ack = wildfire_mask_and_ack_irq, |
147 | }; | 153 | }; |
148 | 154 | ||
149 | static void __init | 155 | static void __init |
@@ -177,21 +183,21 @@ wildfire_init_irq_per_pca(int qbbno, int pcano) | |||
177 | for (i = 0; i < 16; ++i) { | 183 | for (i = 0; i < 16; ++i) { |
178 | if (i == 2) | 184 | if (i == 2) |
179 | continue; | 185 | continue; |
180 | irq_to_desc(i+irq_bias)->status |= IRQ_LEVEL; | ||
181 | set_irq_chip_and_handler(i+irq_bias, &wildfire_irq_type, | 186 | set_irq_chip_and_handler(i+irq_bias, &wildfire_irq_type, |
182 | handle_level_irq); | 187 | handle_level_irq); |
188 | irq_set_status_flags(i + irq_bias, IRQ_LEVEL); | ||
183 | } | 189 | } |
184 | 190 | ||
185 | irq_to_desc(36+irq_bias)->status |= IRQ_LEVEL; | ||
186 | set_irq_chip_and_handler(36+irq_bias, &wildfire_irq_type, | 191 | set_irq_chip_and_handler(36+irq_bias, &wildfire_irq_type, |
187 | handle_level_irq); | 192 | handle_level_irq); |
193 | irq_set_status_flags(36 + irq_bias, IRQ_LEVEL); | ||
188 | for (i = 40; i < 64; ++i) { | 194 | for (i = 40; i < 64; ++i) { |
189 | irq_to_desc(i+irq_bias)->status |= IRQ_LEVEL; | ||
190 | set_irq_chip_and_handler(i+irq_bias, &wildfire_irq_type, | 195 | set_irq_chip_and_handler(i+irq_bias, &wildfire_irq_type, |
191 | handle_level_irq); | 196 | handle_level_irq); |
197 | irq_set_status_flags(i + irq_bias, IRQ_LEVEL); | ||
192 | } | 198 | } |
193 | 199 | ||
194 | setup_irq(32+irq_bias, &isa_enable); | 200 | setup_irq(32+irq_bias, &isa_enable); |
195 | } | 201 | } |
196 | 202 | ||
197 | static void __init | 203 | static void __init |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 26d45e5b636b..166efa2a19cd 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -1177,6 +1177,31 @@ config ARM_ERRATA_743622 | |||
1177 | visible impact on the overall performance or power consumption of the | 1177 | visible impact on the overall performance or power consumption of the |
1178 | processor. | 1178 | processor. |
1179 | 1179 | ||
1180 | config ARM_ERRATA_751472 | ||
1181 | bool "ARM errata: Interrupted ICIALLUIS may prevent completion of broadcasted operation" | ||
1182 | depends on CPU_V7 && SMP | ||
1183 | help | ||
1184 | This option enables the workaround for the 751472 Cortex-A9 (prior | ||
1185 | to r3p0) erratum. An interrupted ICIALLUIS operation may prevent the | ||
1186 | completion of a following broadcasted operation if the second | ||
1187 | operation is received by a CPU before the ICIALLUIS has completed, | ||
1188 | potentially leading to corrupted entries in the cache or TLB. | ||
1189 | |||
1190 | config ARM_ERRATA_753970 | ||
1191 | bool "ARM errata: cache sync operation may be faulty" | ||
1192 | depends on CACHE_PL310 | ||
1193 | help | ||
1194 | This option enables the workaround for the 753970 PL310 (r3p0) erratum. | ||
1195 | |||
1196 | Under some condition the effect of cache sync operation on | ||
1197 | the store buffer still remains when the operation completes. | ||
1198 | This means that the store buffer is always asked to drain and | ||
1199 | this prevents it from merging any further writes. The workaround | ||
1200 | is to replace the normal offset of cache sync operation (0x730) | ||
1201 | by another offset targeting an unmapped PL310 register 0x740. | ||
1202 | This has the same effect as the cache sync operation: store buffer | ||
1203 | drain and waiting for all buffers empty. | ||
1204 | |||
1180 | endmenu | 1205 | endmenu |
1181 | 1206 | ||
1182 | source "arch/arm/common/Kconfig" | 1207 | source "arch/arm/common/Kconfig" |
diff --git a/arch/arm/Makefile b/arch/arm/Makefile index c22c1adfedd6..6f7b29294c80 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile | |||
@@ -15,7 +15,7 @@ ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) | |||
15 | LDFLAGS_vmlinux += --be8 | 15 | LDFLAGS_vmlinux += --be8 |
16 | endif | 16 | endif |
17 | 17 | ||
18 | OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment -S | 18 | OBJCOPYFLAGS :=-O binary -R .comment -S |
19 | GZFLAGS :=-9 | 19 | GZFLAGS :=-9 |
20 | #KBUILD_CFLAGS +=-pipe | 20 | #KBUILD_CFLAGS +=-pipe |
21 | # Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb: | 21 | # Explicitly specifiy 32-bit ARM ISA since toolchain default can be -mthumb: |
diff --git a/arch/arm/boot/compressed/.gitignore b/arch/arm/boot/compressed/.gitignore index ab204db594d3..c6028967d336 100644 --- a/arch/arm/boot/compressed/.gitignore +++ b/arch/arm/boot/compressed/.gitignore | |||
@@ -1,3 +1,7 @@ | |||
1 | font.c | 1 | font.c |
2 | piggy.gz | 2 | lib1funcs.S |
3 | piggy.gzip | ||
4 | piggy.lzo | ||
5 | piggy.lzma | ||
6 | vmlinux | ||
3 | vmlinux.lds | 7 | vmlinux.lds |
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig index 778655f0257a..ea5ee4d067f3 100644 --- a/arch/arm/common/Kconfig +++ b/arch/arm/common/Kconfig | |||
@@ -6,6 +6,8 @@ config ARM_VIC | |||
6 | 6 | ||
7 | config ARM_VIC_NR | 7 | config ARM_VIC_NR |
8 | int | 8 | int |
9 | default 4 if ARCH_S5PV210 | ||
10 | default 3 if ARCH_S5P6442 || ARCH_S5PC100 | ||
9 | default 2 | 11 | default 2 |
10 | depends on ARM_VIC | 12 | depends on ARM_VIC |
11 | help | 13 | help |
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h index 5aeec1e1735c..16bd48031583 100644 --- a/arch/arm/include/asm/hardware/cache-l2x0.h +++ b/arch/arm/include/asm/hardware/cache-l2x0.h | |||
@@ -36,6 +36,7 @@ | |||
36 | #define L2X0_RAW_INTR_STAT 0x21C | 36 | #define L2X0_RAW_INTR_STAT 0x21C |
37 | #define L2X0_INTR_CLEAR 0x220 | 37 | #define L2X0_INTR_CLEAR 0x220 |
38 | #define L2X0_CACHE_SYNC 0x730 | 38 | #define L2X0_CACHE_SYNC 0x730 |
39 | #define L2X0_DUMMY_REG 0x740 | ||
39 | #define L2X0_INV_LINE_PA 0x770 | 40 | #define L2X0_INV_LINE_PA 0x770 |
40 | #define L2X0_INV_WAY 0x77C | 41 | #define L2X0_INV_WAY 0x77C |
41 | #define L2X0_CLEAN_LINE_PA 0x7B0 | 42 | #define L2X0_CLEAN_LINE_PA 0x7B0 |
diff --git a/arch/arm/include/asm/hardware/sp810.h b/arch/arm/include/asm/hardware/sp810.h index 721847dc68ab..e0d1c0cfa548 100644 --- a/arch/arm/include/asm/hardware/sp810.h +++ b/arch/arm/include/asm/hardware/sp810.h | |||
@@ -58,6 +58,9 @@ | |||
58 | 58 | ||
59 | static inline void sysctl_soft_reset(void __iomem *base) | 59 | static inline void sysctl_soft_reset(void __iomem *base) |
60 | { | 60 | { |
61 | /* switch to slow mode */ | ||
62 | writel(0x2, base + SCCTRL); | ||
63 | |||
61 | /* writing any value to SCSYSSTAT reg will reset system */ | 64 | /* writing any value to SCSYSSTAT reg will reset system */ |
62 | writel(0, base + SCSYSSTAT); | 65 | writel(0, base + SCSYSSTAT); |
63 | } | 66 | } |
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index 3a0893a76a3b..bf13b814c1b8 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h | |||
@@ -15,10 +15,6 @@ struct meminfo; | |||
15 | struct sys_timer; | 15 | struct sys_timer; |
16 | 16 | ||
17 | struct machine_desc { | 17 | struct machine_desc { |
18 | /* | ||
19 | * Note! The first two elements are used | ||
20 | * by assembler code in head.S, head-common.S | ||
21 | */ | ||
22 | unsigned int nr; /* architecture number */ | 18 | unsigned int nr; /* architecture number */ |
23 | const char *name; /* architecture name */ | 19 | const char *name; /* architecture name */ |
24 | unsigned long boot_params; /* tagged list */ | 20 | unsigned long boot_params; /* tagged list */ |
diff --git a/arch/arm/include/asm/pgalloc.h b/arch/arm/include/asm/pgalloc.h index 9763be04f77e..22de005f159c 100644 --- a/arch/arm/include/asm/pgalloc.h +++ b/arch/arm/include/asm/pgalloc.h | |||
@@ -10,6 +10,8 @@ | |||
10 | #ifndef _ASMARM_PGALLOC_H | 10 | #ifndef _ASMARM_PGALLOC_H |
11 | #define _ASMARM_PGALLOC_H | 11 | #define _ASMARM_PGALLOC_H |
12 | 12 | ||
13 | #include <linux/pagemap.h> | ||
14 | |||
13 | #include <asm/domain.h> | 15 | #include <asm/domain.h> |
14 | #include <asm/pgtable-hwdef.h> | 16 | #include <asm/pgtable-hwdef.h> |
15 | #include <asm/processor.h> | 17 | #include <asm/processor.h> |
diff --git a/arch/arm/include/asm/tlb.h b/arch/arm/include/asm/tlb.h index f41a6f57cd12..82dfe5d0c41e 100644 --- a/arch/arm/include/asm/tlb.h +++ b/arch/arm/include/asm/tlb.h | |||
@@ -18,16 +18,34 @@ | |||
18 | #define __ASMARM_TLB_H | 18 | #define __ASMARM_TLB_H |
19 | 19 | ||
20 | #include <asm/cacheflush.h> | 20 | #include <asm/cacheflush.h> |
21 | #include <asm/tlbflush.h> | ||
22 | 21 | ||
23 | #ifndef CONFIG_MMU | 22 | #ifndef CONFIG_MMU |
24 | 23 | ||
25 | #include <linux/pagemap.h> | 24 | #include <linux/pagemap.h> |
25 | |||
26 | #define tlb_flush(tlb) ((void) tlb) | ||
27 | |||
26 | #include <asm-generic/tlb.h> | 28 | #include <asm-generic/tlb.h> |
27 | 29 | ||
28 | #else /* !CONFIG_MMU */ | 30 | #else /* !CONFIG_MMU */ |
29 | 31 | ||
32 | #include <linux/swap.h> | ||
30 | #include <asm/pgalloc.h> | 33 | #include <asm/pgalloc.h> |
34 | #include <asm/tlbflush.h> | ||
35 | |||
36 | /* | ||
37 | * We need to delay page freeing for SMP as other CPUs can access pages | ||
38 | * which have been removed but not yet had their TLB entries invalidated. | ||
39 | * Also, as ARMv7 speculative prefetch can drag new entries into the TLB, | ||
40 | * we need to apply this same delaying tactic to ensure correct operation. | ||
41 | */ | ||
42 | #if defined(CONFIG_SMP) || defined(CONFIG_CPU_32v7) | ||
43 | #define tlb_fast_mode(tlb) 0 | ||
44 | #define FREE_PTE_NR 500 | ||
45 | #else | ||
46 | #define tlb_fast_mode(tlb) 1 | ||
47 | #define FREE_PTE_NR 0 | ||
48 | #endif | ||
31 | 49 | ||
32 | /* | 50 | /* |
33 | * TLB handling. This allows us to remove pages from the page | 51 | * TLB handling. This allows us to remove pages from the page |
@@ -36,12 +54,58 @@ | |||
36 | struct mmu_gather { | 54 | struct mmu_gather { |
37 | struct mm_struct *mm; | 55 | struct mm_struct *mm; |
38 | unsigned int fullmm; | 56 | unsigned int fullmm; |
57 | struct vm_area_struct *vma; | ||
39 | unsigned long range_start; | 58 | unsigned long range_start; |
40 | unsigned long range_end; | 59 | unsigned long range_end; |
60 | unsigned int nr; | ||
61 | struct page *pages[FREE_PTE_NR]; | ||
41 | }; | 62 | }; |
42 | 63 | ||
43 | DECLARE_PER_CPU(struct mmu_gather, mmu_gathers); | 64 | DECLARE_PER_CPU(struct mmu_gather, mmu_gathers); |
44 | 65 | ||
66 | /* | ||
67 | * This is unnecessarily complex. There's three ways the TLB shootdown | ||
68 | * code is used: | ||
69 | * 1. Unmapping a range of vmas. See zap_page_range(), unmap_region(). | ||
70 | * tlb->fullmm = 0, and tlb_start_vma/tlb_end_vma will be called. | ||
71 | * tlb->vma will be non-NULL. | ||
72 | * 2. Unmapping all vmas. See exit_mmap(). | ||
73 | * tlb->fullmm = 1, and tlb_start_vma/tlb_end_vma will be called. | ||
74 | * tlb->vma will be non-NULL. Additionally, page tables will be freed. | ||
75 | * 3. Unmapping argument pages. See shift_arg_pages(). | ||
76 | * tlb->fullmm = 0, but tlb_start_vma/tlb_end_vma will not be called. | ||
77 | * tlb->vma will be NULL. | ||
78 | */ | ||
79 | static inline void tlb_flush(struct mmu_gather *tlb) | ||
80 | { | ||
81 | if (tlb->fullmm || !tlb->vma) | ||
82 | flush_tlb_mm(tlb->mm); | ||
83 | else if (tlb->range_end > 0) { | ||
84 | flush_tlb_range(tlb->vma, tlb->range_start, tlb->range_end); | ||
85 | tlb->range_start = TASK_SIZE; | ||
86 | tlb->range_end = 0; | ||
87 | } | ||
88 | } | ||
89 | |||
90 | static inline void tlb_add_flush(struct mmu_gather *tlb, unsigned long addr) | ||
91 | { | ||
92 | if (!tlb->fullmm) { | ||
93 | if (addr < tlb->range_start) | ||
94 | tlb->range_start = addr; | ||
95 | if (addr + PAGE_SIZE > tlb->range_end) | ||
96 | tlb->range_end = addr + PAGE_SIZE; | ||
97 | } | ||
98 | } | ||
99 | |||
100 | static inline void tlb_flush_mmu(struct mmu_gather *tlb) | ||
101 | { | ||
102 | tlb_flush(tlb); | ||
103 | if (!tlb_fast_mode(tlb)) { | ||
104 | free_pages_and_swap_cache(tlb->pages, tlb->nr); | ||
105 | tlb->nr = 0; | ||
106 | } | ||
107 | } | ||
108 | |||
45 | static inline struct mmu_gather * | 109 | static inline struct mmu_gather * |
46 | tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush) | 110 | tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush) |
47 | { | 111 | { |
@@ -49,6 +113,8 @@ tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush) | |||
49 | 113 | ||
50 | tlb->mm = mm; | 114 | tlb->mm = mm; |
51 | tlb->fullmm = full_mm_flush; | 115 | tlb->fullmm = full_mm_flush; |
116 | tlb->vma = NULL; | ||
117 | tlb->nr = 0; | ||
52 | 118 | ||
53 | return tlb; | 119 | return tlb; |
54 | } | 120 | } |
@@ -56,8 +122,7 @@ tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush) | |||
56 | static inline void | 122 | static inline void |
57 | tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) | 123 | tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) |
58 | { | 124 | { |
59 | if (tlb->fullmm) | 125 | tlb_flush_mmu(tlb); |
60 | flush_tlb_mm(tlb->mm); | ||
61 | 126 | ||
62 | /* keep the page table cache within bounds */ | 127 | /* keep the page table cache within bounds */ |
63 | check_pgt_cache(); | 128 | check_pgt_cache(); |
@@ -71,12 +136,7 @@ tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end) | |||
71 | static inline void | 136 | static inline void |
72 | tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep, unsigned long addr) | 137 | tlb_remove_tlb_entry(struct mmu_gather *tlb, pte_t *ptep, unsigned long addr) |
73 | { | 138 | { |
74 | if (!tlb->fullmm) { | 139 | tlb_add_flush(tlb, addr); |
75 | if (addr < tlb->range_start) | ||
76 | tlb->range_start = addr; | ||
77 | if (addr + PAGE_SIZE > tlb->range_end) | ||
78 | tlb->range_end = addr + PAGE_SIZE; | ||
79 | } | ||
80 | } | 140 | } |
81 | 141 | ||
82 | /* | 142 | /* |
@@ -89,6 +149,7 @@ tlb_start_vma(struct mmu_gather *tlb, struct vm_area_struct *vma) | |||
89 | { | 149 | { |
90 | if (!tlb->fullmm) { | 150 | if (!tlb->fullmm) { |
91 | flush_cache_range(vma, vma->vm_start, vma->vm_end); | 151 | flush_cache_range(vma, vma->vm_start, vma->vm_end); |
152 | tlb->vma = vma; | ||
92 | tlb->range_start = TASK_SIZE; | 153 | tlb->range_start = TASK_SIZE; |
93 | tlb->range_end = 0; | 154 | tlb->range_end = 0; |
94 | } | 155 | } |
@@ -97,12 +158,30 @@ tlb_start_vma(struct mmu_gather *tlb, struct vm_area_struct *vma) | |||
97 | static inline void | 158 | static inline void |
98 | tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma) | 159 | tlb_end_vma(struct mmu_gather *tlb, struct vm_area_struct *vma) |
99 | { | 160 | { |
100 | if (!tlb->fullmm && tlb->range_end > 0) | 161 | if (!tlb->fullmm) |
101 | flush_tlb_range(vma, tlb->range_start, tlb->range_end); | 162 | tlb_flush(tlb); |
163 | } | ||
164 | |||
165 | static inline void tlb_remove_page(struct mmu_gather *tlb, struct page *page) | ||
166 | { | ||
167 | if (tlb_fast_mode(tlb)) { | ||
168 | free_page_and_swap_cache(page); | ||
169 | } else { | ||
170 | tlb->pages[tlb->nr++] = page; | ||
171 | if (tlb->nr >= FREE_PTE_NR) | ||
172 | tlb_flush_mmu(tlb); | ||
173 | } | ||
174 | } | ||
175 | |||
176 | static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, | ||
177 | unsigned long addr) | ||
178 | { | ||
179 | pgtable_page_dtor(pte); | ||
180 | tlb_add_flush(tlb, addr); | ||
181 | tlb_remove_page(tlb, pte); | ||
102 | } | 182 | } |
103 | 183 | ||
104 | #define tlb_remove_page(tlb,page) free_page_and_swap_cache(page) | 184 | #define pte_free_tlb(tlb, ptep, addr) __pte_free_tlb(tlb, ptep, addr) |
105 | #define pte_free_tlb(tlb, ptep, addr) pte_free((tlb)->mm, ptep) | ||
106 | #define pmd_free_tlb(tlb, pmdp, addr) pmd_free((tlb)->mm, pmdp) | 185 | #define pmd_free_tlb(tlb, pmdp, addr) pmd_free((tlb)->mm, pmdp) |
107 | 186 | ||
108 | #define tlb_migrate_finish(mm) do { } while (0) | 187 | #define tlb_migrate_finish(mm) do { } while (0) |
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h index ce7378ea15a2..d2005de383b8 100644 --- a/arch/arm/include/asm/tlbflush.h +++ b/arch/arm/include/asm/tlbflush.h | |||
@@ -10,12 +10,7 @@ | |||
10 | #ifndef _ASMARM_TLBFLUSH_H | 10 | #ifndef _ASMARM_TLBFLUSH_H |
11 | #define _ASMARM_TLBFLUSH_H | 11 | #define _ASMARM_TLBFLUSH_H |
12 | 12 | ||
13 | 13 | #ifdef CONFIG_MMU | |
14 | #ifndef CONFIG_MMU | ||
15 | |||
16 | #define tlb_flush(tlb) ((void) tlb) | ||
17 | |||
18 | #else /* CONFIG_MMU */ | ||
19 | 14 | ||
20 | #include <asm/glue.h> | 15 | #include <asm/glue.h> |
21 | 16 | ||
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c index d600bd350704..44b84fe6e1b0 100644 --- a/arch/arm/kernel/hw_breakpoint.c +++ b/arch/arm/kernel/hw_breakpoint.c | |||
@@ -836,9 +836,11 @@ static int hw_breakpoint_pending(unsigned long addr, unsigned int fsr, | |||
836 | /* | 836 | /* |
837 | * One-time initialisation. | 837 | * One-time initialisation. |
838 | */ | 838 | */ |
839 | static void reset_ctrl_regs(void *unused) | 839 | static void reset_ctrl_regs(void *info) |
840 | { | 840 | { |
841 | int i; | 841 | int i, cpu = smp_processor_id(); |
842 | u32 dbg_power; | ||
843 | cpumask_t *cpumask = info; | ||
842 | 844 | ||
843 | /* | 845 | /* |
844 | * v7 debug contains save and restore registers so that debug state | 846 | * v7 debug contains save and restore registers so that debug state |
@@ -850,6 +852,17 @@ static void reset_ctrl_regs(void *unused) | |||
850 | */ | 852 | */ |
851 | if (debug_arch >= ARM_DEBUG_ARCH_V7_ECP14) { | 853 | if (debug_arch >= ARM_DEBUG_ARCH_V7_ECP14) { |
852 | /* | 854 | /* |
855 | * Ensure sticky power-down is clear (i.e. debug logic is | ||
856 | * powered up). | ||
857 | */ | ||
858 | asm volatile("mrc p14, 0, %0, c1, c5, 4" : "=r" (dbg_power)); | ||
859 | if ((dbg_power & 0x1) == 0) { | ||
860 | pr_warning("CPU %d debug is powered down!\n", cpu); | ||
861 | cpumask_or(cpumask, cpumask, cpumask_of(cpu)); | ||
862 | return; | ||
863 | } | ||
864 | |||
865 | /* | ||
853 | * Unconditionally clear the lock by writing a value | 866 | * Unconditionally clear the lock by writing a value |
854 | * other than 0xC5ACCE55 to the access register. | 867 | * other than 0xC5ACCE55 to the access register. |
855 | */ | 868 | */ |
@@ -887,6 +900,7 @@ static struct notifier_block __cpuinitdata dbg_reset_nb = { | |||
887 | static int __init arch_hw_breakpoint_init(void) | 900 | static int __init arch_hw_breakpoint_init(void) |
888 | { | 901 | { |
889 | u32 dscr; | 902 | u32 dscr; |
903 | cpumask_t cpumask = { CPU_BITS_NONE }; | ||
890 | 904 | ||
891 | debug_arch = get_debug_arch(); | 905 | debug_arch = get_debug_arch(); |
892 | 906 | ||
@@ -911,7 +925,13 @@ static int __init arch_hw_breakpoint_init(void) | |||
911 | * Reset the breakpoint resources. We assume that a halting | 925 | * Reset the breakpoint resources. We assume that a halting |
912 | * debugger will leave the world in a nice state for us. | 926 | * debugger will leave the world in a nice state for us. |
913 | */ | 927 | */ |
914 | on_each_cpu(reset_ctrl_regs, NULL, 1); | 928 | on_each_cpu(reset_ctrl_regs, &cpumask, 1); |
929 | if (!cpumask_empty(&cpumask)) { | ||
930 | core_num_brps = 0; | ||
931 | core_num_reserved_brps = 0; | ||
932 | core_num_wrps = 0; | ||
933 | return 0; | ||
934 | } | ||
915 | 935 | ||
916 | ARM_DBG_READ(c1, 0, dscr); | 936 | ARM_DBG_READ(c1, 0, dscr); |
917 | if (dscr & ARM_DSCR_HDBGEN) { | 937 | if (dscr & ARM_DSCR_HDBGEN) { |
diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c index 2c1f0050c9c4..8f6ed43861f1 100644 --- a/arch/arm/kernel/kprobes-decode.c +++ b/arch/arm/kernel/kprobes-decode.c | |||
@@ -1437,7 +1437,7 @@ arm_kprobe_decode_insn(kprobe_opcode_t insn, struct arch_specific_insn *asi) | |||
1437 | 1437 | ||
1438 | return space_cccc_1100_010x(insn, asi); | 1438 | return space_cccc_1100_010x(insn, asi); |
1439 | 1439 | ||
1440 | } else if ((insn & 0x0e000000) == 0x0c400000) { | 1440 | } else if ((insn & 0x0e000000) == 0x0c000000) { |
1441 | 1441 | ||
1442 | return space_cccc_110x(insn, asi); | 1442 | return space_cccc_110x(insn, asi); |
1443 | 1443 | ||
diff --git a/arch/arm/kernel/pmu.c b/arch/arm/kernel/pmu.c index b8af96ea62e6..2c79eec19262 100644 --- a/arch/arm/kernel/pmu.c +++ b/arch/arm/kernel/pmu.c | |||
@@ -97,28 +97,34 @@ set_irq_affinity(int irq, | |||
97 | irq, cpu); | 97 | irq, cpu); |
98 | return err; | 98 | return err; |
99 | #else | 99 | #else |
100 | return 0; | 100 | return -EINVAL; |
101 | #endif | 101 | #endif |
102 | } | 102 | } |
103 | 103 | ||
104 | static int | 104 | static int |
105 | init_cpu_pmu(void) | 105 | init_cpu_pmu(void) |
106 | { | 106 | { |
107 | int i, err = 0; | 107 | int i, irqs, err = 0; |
108 | struct platform_device *pdev = pmu_devices[ARM_PMU_DEVICE_CPU]; | 108 | struct platform_device *pdev = pmu_devices[ARM_PMU_DEVICE_CPU]; |
109 | 109 | ||
110 | if (!pdev) { | 110 | if (!pdev) |
111 | err = -ENODEV; | 111 | return -ENODEV; |
112 | goto out; | 112 | |
113 | } | 113 | irqs = pdev->num_resources; |
114 | |||
115 | /* | ||
116 | * If we have a single PMU interrupt that we can't shift, assume that | ||
117 | * we're running on a uniprocessor machine and continue. | ||
118 | */ | ||
119 | if (irqs == 1 && !irq_can_set_affinity(platform_get_irq(pdev, 0))) | ||
120 | return 0; | ||
114 | 121 | ||
115 | for (i = 0; i < pdev->num_resources; ++i) { | 122 | for (i = 0; i < irqs; ++i) { |
116 | err = set_irq_affinity(platform_get_irq(pdev, i), i); | 123 | err = set_irq_affinity(platform_get_irq(pdev, i), i); |
117 | if (err) | 124 | if (err) |
118 | break; | 125 | break; |
119 | } | 126 | } |
120 | 127 | ||
121 | out: | ||
122 | return err; | 128 | return err; |
123 | } | 129 | } |
124 | 130 | ||
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index 19c6816db61e..b13e70f63d71 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
@@ -996,10 +996,10 @@ static int ptrace_gethbpregs(struct task_struct *tsk, long num, | |||
996 | while (!(arch_ctrl.len & 0x1)) | 996 | while (!(arch_ctrl.len & 0x1)) |
997 | arch_ctrl.len >>= 1; | 997 | arch_ctrl.len >>= 1; |
998 | 998 | ||
999 | if (idx & 0x1) | 999 | if (num & 0x1) |
1000 | reg = encode_ctrl_reg(arch_ctrl); | ||
1001 | else | ||
1002 | reg = bp->attr.bp_addr; | 1000 | reg = bp->attr.bp_addr; |
1001 | else | ||
1002 | reg = encode_ctrl_reg(arch_ctrl); | ||
1003 | } | 1003 | } |
1004 | 1004 | ||
1005 | put: | 1005 | put: |
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 420b8d6485d6..5ea4fb718b97 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c | |||
@@ -226,8 +226,8 @@ int cpu_architecture(void) | |||
226 | * Register 0 and check for VMSAv7 or PMSAv7 */ | 226 | * Register 0 and check for VMSAv7 or PMSAv7 */ |
227 | asm("mrc p15, 0, %0, c0, c1, 4" | 227 | asm("mrc p15, 0, %0, c0, c1, 4" |
228 | : "=r" (mmfr0)); | 228 | : "=r" (mmfr0)); |
229 | if ((mmfr0 & 0x0000000f) == 0x00000003 || | 229 | if ((mmfr0 & 0x0000000f) >= 0x00000003 || |
230 | (mmfr0 & 0x000000f0) == 0x00000030) | 230 | (mmfr0 & 0x000000f0) >= 0x00000030) |
231 | cpu_arch = CPU_ARCH_ARMv7; | 231 | cpu_arch = CPU_ARCH_ARMv7; |
232 | else if ((mmfr0 & 0x0000000f) == 0x00000002 || | 232 | else if ((mmfr0 & 0x0000000f) == 0x00000002 || |
233 | (mmfr0 & 0x000000f0) == 0x00000020) | 233 | (mmfr0 & 0x000000f0) == 0x00000020) |
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c index 907d5a620bca..abaf8445ce25 100644 --- a/arch/arm/kernel/signal.c +++ b/arch/arm/kernel/signal.c | |||
@@ -474,7 +474,9 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka, | |||
474 | unsigned long handler = (unsigned long)ka->sa.sa_handler; | 474 | unsigned long handler = (unsigned long)ka->sa.sa_handler; |
475 | unsigned long retcode; | 475 | unsigned long retcode; |
476 | int thumb = 0; | 476 | int thumb = 0; |
477 | unsigned long cpsr = regs->ARM_cpsr & ~PSR_f; | 477 | unsigned long cpsr = regs->ARM_cpsr & ~(PSR_f | PSR_E_BIT); |
478 | |||
479 | cpsr |= PSR_ENDSTATE; | ||
478 | 480 | ||
479 | /* | 481 | /* |
480 | * Maybe we need to deliver a 32-bit signal to a 26-bit task. | 482 | * Maybe we need to deliver a 32-bit signal to a 26-bit task. |
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index 86b66f3f2031..61462790757f 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S | |||
@@ -21,6 +21,12 @@ | |||
21 | #define ARM_CPU_KEEP(x) | 21 | #define ARM_CPU_KEEP(x) |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #if defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK) | ||
25 | #define ARM_EXIT_KEEP(x) x | ||
26 | #else | ||
27 | #define ARM_EXIT_KEEP(x) | ||
28 | #endif | ||
29 | |||
24 | OUTPUT_ARCH(arm) | 30 | OUTPUT_ARCH(arm) |
25 | ENTRY(stext) | 31 | ENTRY(stext) |
26 | 32 | ||
@@ -43,6 +49,7 @@ SECTIONS | |||
43 | _sinittext = .; | 49 | _sinittext = .; |
44 | HEAD_TEXT | 50 | HEAD_TEXT |
45 | INIT_TEXT | 51 | INIT_TEXT |
52 | ARM_EXIT_KEEP(EXIT_TEXT) | ||
46 | _einittext = .; | 53 | _einittext = .; |
47 | ARM_CPU_DISCARD(PROC_INFO) | 54 | ARM_CPU_DISCARD(PROC_INFO) |
48 | __arch_info_begin = .; | 55 | __arch_info_begin = .; |
@@ -67,6 +74,7 @@ SECTIONS | |||
67 | #ifndef CONFIG_XIP_KERNEL | 74 | #ifndef CONFIG_XIP_KERNEL |
68 | __init_begin = _stext; | 75 | __init_begin = _stext; |
69 | INIT_DATA | 76 | INIT_DATA |
77 | ARM_EXIT_KEEP(EXIT_DATA) | ||
70 | #endif | 78 | #endif |
71 | } | 79 | } |
72 | 80 | ||
@@ -162,6 +170,7 @@ SECTIONS | |||
162 | . = ALIGN(PAGE_SIZE); | 170 | . = ALIGN(PAGE_SIZE); |
163 | __init_begin = .; | 171 | __init_begin = .; |
164 | INIT_DATA | 172 | INIT_DATA |
173 | ARM_EXIT_KEEP(EXIT_DATA) | ||
165 | . = ALIGN(PAGE_SIZE); | 174 | . = ALIGN(PAGE_SIZE); |
166 | __init_end = .; | 175 | __init_end = .; |
167 | #endif | 176 | #endif |
@@ -247,6 +256,8 @@ SECTIONS | |||
247 | } | 256 | } |
248 | #endif | 257 | #endif |
249 | 258 | ||
259 | NOTES | ||
260 | |||
250 | BSS_SECTION(0, 0, 0) | 261 | BSS_SECTION(0, 0, 0) |
251 | _end = .; | 262 | _end = .; |
252 | 263 | ||
diff --git a/arch/arm/mach-davinci/cpufreq.c b/arch/arm/mach-davinci/cpufreq.c index 343de73161fa..4a68c2b1ec11 100644 --- a/arch/arm/mach-davinci/cpufreq.c +++ b/arch/arm/mach-davinci/cpufreq.c | |||
@@ -132,7 +132,7 @@ out: | |||
132 | return ret; | 132 | return ret; |
133 | } | 133 | } |
134 | 134 | ||
135 | static int __init davinci_cpu_init(struct cpufreq_policy *policy) | 135 | static int davinci_cpu_init(struct cpufreq_policy *policy) |
136 | { | 136 | { |
137 | int result = 0; | 137 | int result = 0; |
138 | struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data; | 138 | struct davinci_cpufreq_config *pdata = cpufreq.dev->platform_data; |
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index 9eec63070e0c..beda8a4133a0 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c | |||
@@ -480,8 +480,15 @@ static struct platform_device da850_mcasp_device = { | |||
480 | .resource = da850_mcasp_resources, | 480 | .resource = da850_mcasp_resources, |
481 | }; | 481 | }; |
482 | 482 | ||
483 | struct platform_device davinci_pcm_device = { | ||
484 | .name = "davinci-pcm-audio", | ||
485 | .id = -1, | ||
486 | }; | ||
487 | |||
483 | void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata) | 488 | void __init da8xx_register_mcasp(int id, struct snd_platform_data *pdata) |
484 | { | 489 | { |
490 | platform_device_register(&davinci_pcm_device); | ||
491 | |||
485 | /* DA830/OMAP-L137 has 3 instances of McASP */ | 492 | /* DA830/OMAP-L137 has 3 instances of McASP */ |
486 | if (cpu_is_davinci_da830() && id == 1) { | 493 | if (cpu_is_davinci_da830() && id == 1) { |
487 | da830_mcasp1_device.dev.platform_data = pdata; | 494 | da830_mcasp1_device.dev.platform_data = pdata; |
diff --git a/arch/arm/mach-davinci/gpio-tnetv107x.c b/arch/arm/mach-davinci/gpio-tnetv107x.c index d10298620e2c..3fa3e2867e19 100644 --- a/arch/arm/mach-davinci/gpio-tnetv107x.c +++ b/arch/arm/mach-davinci/gpio-tnetv107x.c | |||
@@ -58,7 +58,7 @@ static int tnetv107x_gpio_request(struct gpio_chip *chip, unsigned offset) | |||
58 | 58 | ||
59 | spin_lock_irqsave(&ctlr->lock, flags); | 59 | spin_lock_irqsave(&ctlr->lock, flags); |
60 | 60 | ||
61 | gpio_reg_set_bit(®s->enable, gpio); | 61 | gpio_reg_set_bit(regs->enable, gpio); |
62 | 62 | ||
63 | spin_unlock_irqrestore(&ctlr->lock, flags); | 63 | spin_unlock_irqrestore(&ctlr->lock, flags); |
64 | 64 | ||
@@ -74,7 +74,7 @@ static void tnetv107x_gpio_free(struct gpio_chip *chip, unsigned offset) | |||
74 | 74 | ||
75 | spin_lock_irqsave(&ctlr->lock, flags); | 75 | spin_lock_irqsave(&ctlr->lock, flags); |
76 | 76 | ||
77 | gpio_reg_clear_bit(®s->enable, gpio); | 77 | gpio_reg_clear_bit(regs->enable, gpio); |
78 | 78 | ||
79 | spin_unlock_irqrestore(&ctlr->lock, flags); | 79 | spin_unlock_irqrestore(&ctlr->lock, flags); |
80 | } | 80 | } |
@@ -88,7 +88,7 @@ static int tnetv107x_gpio_dir_in(struct gpio_chip *chip, unsigned offset) | |||
88 | 88 | ||
89 | spin_lock_irqsave(&ctlr->lock, flags); | 89 | spin_lock_irqsave(&ctlr->lock, flags); |
90 | 90 | ||
91 | gpio_reg_set_bit(®s->direction, gpio); | 91 | gpio_reg_set_bit(regs->direction, gpio); |
92 | 92 | ||
93 | spin_unlock_irqrestore(&ctlr->lock, flags); | 93 | spin_unlock_irqrestore(&ctlr->lock, flags); |
94 | 94 | ||
@@ -106,11 +106,11 @@ static int tnetv107x_gpio_dir_out(struct gpio_chip *chip, | |||
106 | spin_lock_irqsave(&ctlr->lock, flags); | 106 | spin_lock_irqsave(&ctlr->lock, flags); |
107 | 107 | ||
108 | if (value) | 108 | if (value) |
109 | gpio_reg_set_bit(®s->data_out, gpio); | 109 | gpio_reg_set_bit(regs->data_out, gpio); |
110 | else | 110 | else |
111 | gpio_reg_clear_bit(®s->data_out, gpio); | 111 | gpio_reg_clear_bit(regs->data_out, gpio); |
112 | 112 | ||
113 | gpio_reg_clear_bit(®s->direction, gpio); | 113 | gpio_reg_clear_bit(regs->direction, gpio); |
114 | 114 | ||
115 | spin_unlock_irqrestore(&ctlr->lock, flags); | 115 | spin_unlock_irqrestore(&ctlr->lock, flags); |
116 | 116 | ||
@@ -124,7 +124,7 @@ static int tnetv107x_gpio_get(struct gpio_chip *chip, unsigned offset) | |||
124 | unsigned gpio = chip->base + offset; | 124 | unsigned gpio = chip->base + offset; |
125 | int ret; | 125 | int ret; |
126 | 126 | ||
127 | ret = gpio_reg_get_bit(®s->data_in, gpio); | 127 | ret = gpio_reg_get_bit(regs->data_in, gpio); |
128 | 128 | ||
129 | return ret ? 1 : 0; | 129 | return ret ? 1 : 0; |
130 | } | 130 | } |
@@ -140,9 +140,9 @@ static void tnetv107x_gpio_set(struct gpio_chip *chip, | |||
140 | spin_lock_irqsave(&ctlr->lock, flags); | 140 | spin_lock_irqsave(&ctlr->lock, flags); |
141 | 141 | ||
142 | if (value) | 142 | if (value) |
143 | gpio_reg_set_bit(®s->data_out, gpio); | 143 | gpio_reg_set_bit(regs->data_out, gpio); |
144 | else | 144 | else |
145 | gpio_reg_clear_bit(®s->data_out, gpio); | 145 | gpio_reg_clear_bit(regs->data_out, gpio); |
146 | 146 | ||
147 | spin_unlock_irqrestore(&ctlr->lock, flags); | 147 | spin_unlock_irqrestore(&ctlr->lock, flags); |
148 | } | 148 | } |
diff --git a/arch/arm/mach-davinci/include/mach/clkdev.h b/arch/arm/mach-davinci/include/mach/clkdev.h index 730c49d1ebd8..14a504887189 100644 --- a/arch/arm/mach-davinci/include/mach/clkdev.h +++ b/arch/arm/mach-davinci/include/mach/clkdev.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __MACH_CLKDEV_H | 1 | #ifndef __MACH_CLKDEV_H |
2 | #define __MACH_CLKDEV_H | 2 | #define __MACH_CLKDEV_H |
3 | 3 | ||
4 | struct clk; | ||
5 | |||
4 | static inline int __clk_get(struct clk *clk) | 6 | static inline int __clk_get(struct clk *clk) |
5 | { | 7 | { |
6 | return 1; | 8 | return 1; |
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c index 337392c3f549..acb7ae5b0a25 100644 --- a/arch/arm/mach-omap2/clkt_dpll.c +++ b/arch/arm/mach-omap2/clkt_dpll.c | |||
@@ -77,7 +77,7 @@ static int _dpll_test_fint(struct clk *clk, u8 n) | |||
77 | dd = clk->dpll_data; | 77 | dd = clk->dpll_data; |
78 | 78 | ||
79 | /* DPLL divider must result in a valid jitter correction val */ | 79 | /* DPLL divider must result in a valid jitter correction val */ |
80 | fint = clk->parent->rate / (n + 1); | 80 | fint = clk->parent->rate / n; |
81 | if (fint < DPLL_FINT_BAND1_MIN) { | 81 | if (fint < DPLL_FINT_BAND1_MIN) { |
82 | 82 | ||
83 | pr_debug("rejecting n=%d due to Fint failure, " | 83 | pr_debug("rejecting n=%d due to Fint failure, " |
diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c index 394413dc7deb..24b88504df0f 100644 --- a/arch/arm/mach-omap2/mailbox.c +++ b/arch/arm/mach-omap2/mailbox.c | |||
@@ -193,10 +193,12 @@ static void omap2_mbox_disable_irq(struct omap_mbox *mbox, | |||
193 | omap_mbox_type_t irq) | 193 | omap_mbox_type_t irq) |
194 | { | 194 | { |
195 | struct omap_mbox2_priv *p = mbox->priv; | 195 | struct omap_mbox2_priv *p = mbox->priv; |
196 | u32 l, bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit; | 196 | u32 bit = (irq == IRQ_TX) ? p->notfull_bit : p->newmsg_bit; |
197 | l = mbox_read_reg(p->irqdisable); | 197 | |
198 | l &= ~bit; | 198 | if (!cpu_is_omap44xx()) |
199 | mbox_write_reg(l, p->irqdisable); | 199 | bit = mbox_read_reg(p->irqdisable) & ~bit; |
200 | |||
201 | mbox_write_reg(bit, p->irqdisable); | ||
200 | } | 202 | } |
201 | 203 | ||
202 | static void omap2_mbox_ack_irq(struct omap_mbox *mbox, | 204 | static void omap2_mbox_ack_irq(struct omap_mbox *mbox, |
@@ -334,7 +336,7 @@ static struct omap_mbox mbox_iva_info = { | |||
334 | .priv = &omap2_mbox_iva_priv, | 336 | .priv = &omap2_mbox_iva_priv, |
335 | }; | 337 | }; |
336 | 338 | ||
337 | struct omap_mbox *omap2_mboxes[] = { &mbox_iva_info, &mbox_dsp_info, NULL }; | 339 | struct omap_mbox *omap2_mboxes[] = { &mbox_dsp_info, &mbox_iva_info, NULL }; |
338 | #endif | 340 | #endif |
339 | 341 | ||
340 | #if defined(CONFIG_ARCH_OMAP4) | 342 | #if defined(CONFIG_ARCH_OMAP4) |
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 98148b6c36e9..6c84659cf846 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
@@ -605,7 +605,7 @@ static void __init omap_mux_dbg_create_entry( | |||
605 | list_for_each_entry(e, &partition->muxmodes, node) { | 605 | list_for_each_entry(e, &partition->muxmodes, node) { |
606 | struct omap_mux *m = &e->mux; | 606 | struct omap_mux *m = &e->mux; |
607 | 607 | ||
608 | (void)debugfs_create_file(m->muxnames[0], S_IWUGO, mux_dbg_dir, | 608 | (void)debugfs_create_file(m->muxnames[0], S_IWUSR, mux_dbg_dir, |
609 | m, &omap_mux_dbg_signal_fops); | 609 | m, &omap_mux_dbg_signal_fops); |
610 | } | 610 | } |
611 | } | 611 | } |
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 125f56591fb5..a5a83b358ddd 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c | |||
@@ -637,14 +637,14 @@ static int __init pm_dbg_init(void) | |||
637 | 637 | ||
638 | } | 638 | } |
639 | 639 | ||
640 | (void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUGO, d, | 640 | (void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUSR, d, |
641 | &enable_off_mode, &pm_dbg_option_fops); | 641 | &enable_off_mode, &pm_dbg_option_fops); |
642 | (void) debugfs_create_file("sleep_while_idle", S_IRUGO | S_IWUGO, d, | 642 | (void) debugfs_create_file("sleep_while_idle", S_IRUGO | S_IWUSR, d, |
643 | &sleep_while_idle, &pm_dbg_option_fops); | 643 | &sleep_while_idle, &pm_dbg_option_fops); |
644 | (void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUGO, d, | 644 | (void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUSR, d, |
645 | &wakeup_timer_seconds, &pm_dbg_option_fops); | 645 | &wakeup_timer_seconds, &pm_dbg_option_fops); |
646 | (void) debugfs_create_file("wakeup_timer_milliseconds", | 646 | (void) debugfs_create_file("wakeup_timer_milliseconds", |
647 | S_IRUGO | S_IWUGO, d, &wakeup_timer_milliseconds, | 647 | S_IRUGO | S_IWUSR, d, &wakeup_timer_milliseconds, |
648 | &pm_dbg_option_fops); | 648 | &pm_dbg_option_fops); |
649 | pm_dbg_init_done = 1; | 649 | pm_dbg_init_done = 1; |
650 | 650 | ||
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.h b/arch/arm/mach-omap2/prcm_mpu44xx.h index 729a644ce852..3300ff6e3cfe 100644 --- a/arch/arm/mach-omap2/prcm_mpu44xx.h +++ b/arch/arm/mach-omap2/prcm_mpu44xx.h | |||
@@ -38,8 +38,8 @@ | |||
38 | #define OMAP4430_PRCM_MPU_CPU1_INST 0x0800 | 38 | #define OMAP4430_PRCM_MPU_CPU1_INST 0x0800 |
39 | 39 | ||
40 | /* PRCM_MPU clockdomain register offsets (from instance start) */ | 40 | /* PRCM_MPU clockdomain register offsets (from instance start) */ |
41 | #define OMAP4430_PRCM_MPU_CPU0_MPU_CDOFFS 0x0000 | 41 | #define OMAP4430_PRCM_MPU_CPU0_MPU_CDOFFS 0x0018 |
42 | #define OMAP4430_PRCM_MPU_CPU1_MPU_CDOFFS 0x0000 | 42 | #define OMAP4430_PRCM_MPU_CPU1_MPU_CDOFFS 0x0018 |
43 | 43 | ||
44 | 44 | ||
45 | /* | 45 | /* |
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index c37e823266d3..1a777e34d0c2 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c | |||
@@ -282,6 +282,7 @@ error: | |||
282 | dev_err(&sr_info->pdev->dev, "%s: ERROR in registering" | 282 | dev_err(&sr_info->pdev->dev, "%s: ERROR in registering" |
283 | "interrupt handler. Smartreflex will" | 283 | "interrupt handler. Smartreflex will" |
284 | "not function as desired\n", __func__); | 284 | "not function as desired\n", __func__); |
285 | kfree(name); | ||
285 | kfree(sr_info); | 286 | kfree(sr_info); |
286 | return ret; | 287 | return ret; |
287 | } | 288 | } |
@@ -879,7 +880,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
879 | ret = sr_late_init(sr_info); | 880 | ret = sr_late_init(sr_info); |
880 | if (ret) { | 881 | if (ret) { |
881 | pr_warning("%s: Error in SR late init\n", __func__); | 882 | pr_warning("%s: Error in SR late init\n", __func__); |
882 | return ret; | 883 | goto err_release_region; |
883 | } | 884 | } |
884 | } | 885 | } |
885 | 886 | ||
@@ -890,17 +891,20 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
890 | * not try to create rest of the debugfs entries. | 891 | * not try to create rest of the debugfs entries. |
891 | */ | 892 | */ |
892 | vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm); | 893 | vdd_dbg_dir = omap_voltage_get_dbgdir(sr_info->voltdm); |
893 | if (!vdd_dbg_dir) | 894 | if (!vdd_dbg_dir) { |
894 | return -EINVAL; | 895 | ret = -EINVAL; |
896 | goto err_release_region; | ||
897 | } | ||
895 | 898 | ||
896 | dbg_dir = debugfs_create_dir("smartreflex", vdd_dbg_dir); | 899 | dbg_dir = debugfs_create_dir("smartreflex", vdd_dbg_dir); |
897 | if (IS_ERR(dbg_dir)) { | 900 | if (IS_ERR(dbg_dir)) { |
898 | dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", | 901 | dev_err(&pdev->dev, "%s: Unable to create debugfs directory\n", |
899 | __func__); | 902 | __func__); |
900 | return PTR_ERR(dbg_dir); | 903 | ret = PTR_ERR(dbg_dir); |
904 | goto err_release_region; | ||
901 | } | 905 | } |
902 | 906 | ||
903 | (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUGO, dbg_dir, | 907 | (void) debugfs_create_file("autocomp", S_IRUGO | S_IWUSR, dbg_dir, |
904 | (void *)sr_info, &pm_sr_fops); | 908 | (void *)sr_info, &pm_sr_fops); |
905 | (void) debugfs_create_x32("errweight", S_IRUGO, dbg_dir, | 909 | (void) debugfs_create_x32("errweight", S_IRUGO, dbg_dir, |
906 | &sr_info->err_weight); | 910 | &sr_info->err_weight); |
@@ -913,7 +917,8 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
913 | if (IS_ERR(nvalue_dir)) { | 917 | if (IS_ERR(nvalue_dir)) { |
914 | dev_err(&pdev->dev, "%s: Unable to create debugfs directory" | 918 | dev_err(&pdev->dev, "%s: Unable to create debugfs directory" |
915 | "for n-values\n", __func__); | 919 | "for n-values\n", __func__); |
916 | return PTR_ERR(nvalue_dir); | 920 | ret = PTR_ERR(nvalue_dir); |
921 | goto err_release_region; | ||
917 | } | 922 | } |
918 | 923 | ||
919 | omap_voltage_get_volttable(sr_info->voltdm, &volt_data); | 924 | omap_voltage_get_volttable(sr_info->voltdm, &volt_data); |
@@ -922,24 +927,16 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
922 | " corresponding vdd vdd_%s. Cannot create debugfs" | 927 | " corresponding vdd vdd_%s. Cannot create debugfs" |
923 | "entries for n-values\n", | 928 | "entries for n-values\n", |
924 | __func__, sr_info->voltdm->name); | 929 | __func__, sr_info->voltdm->name); |
925 | return -ENODATA; | 930 | ret = -ENODATA; |
931 | goto err_release_region; | ||
926 | } | 932 | } |
927 | 933 | ||
928 | for (i = 0; i < sr_info->nvalue_count; i++) { | 934 | for (i = 0; i < sr_info->nvalue_count; i++) { |
929 | char *name; | 935 | char name[NVALUE_NAME_LEN + 1]; |
930 | char volt_name[32]; | ||
931 | |||
932 | name = kzalloc(NVALUE_NAME_LEN + 1, GFP_KERNEL); | ||
933 | if (!name) { | ||
934 | dev_err(&pdev->dev, "%s: Unable to allocate memory" | ||
935 | " for n-value directory name\n", __func__); | ||
936 | return -ENOMEM; | ||
937 | } | ||
938 | 936 | ||
939 | strcpy(name, "volt_"); | 937 | snprintf(name, sizeof(name), "volt_%d", |
940 | sprintf(volt_name, "%d", volt_data[i].volt_nominal); | 938 | volt_data[i].volt_nominal); |
941 | strcat(name, volt_name); | 939 | (void) debugfs_create_x32(name, S_IRUGO | S_IWUSR, nvalue_dir, |
942 | (void) debugfs_create_x32(name, S_IRUGO | S_IWUGO, nvalue_dir, | ||
943 | &(sr_info->nvalue_table[i].nvalue)); | 940 | &(sr_info->nvalue_table[i].nvalue)); |
944 | } | 941 | } |
945 | 942 | ||
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c index 7b7c2683ae7b..0fc550e7e482 100644 --- a/arch/arm/mach-omap2/timer-gp.c +++ b/arch/arm/mach-omap2/timer-gp.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <asm/mach/time.h> | 39 | #include <asm/mach/time.h> |
40 | #include <plat/dmtimer.h> | 40 | #include <plat/dmtimer.h> |
41 | #include <asm/localtimer.h> | 41 | #include <asm/localtimer.h> |
42 | #include <asm/sched_clock.h> | ||
42 | 43 | ||
43 | #include "timer-gp.h" | 44 | #include "timer-gp.h" |
44 | 45 | ||
@@ -190,6 +191,7 @@ static void __init omap2_gp_clocksource_init(void) | |||
190 | /* | 191 | /* |
191 | * clocksource | 192 | * clocksource |
192 | */ | 193 | */ |
194 | static DEFINE_CLOCK_DATA(cd); | ||
193 | static struct omap_dm_timer *gpt_clocksource; | 195 | static struct omap_dm_timer *gpt_clocksource; |
194 | static cycle_t clocksource_read_cycles(struct clocksource *cs) | 196 | static cycle_t clocksource_read_cycles(struct clocksource *cs) |
195 | { | 197 | { |
@@ -204,6 +206,15 @@ static struct clocksource clocksource_gpt = { | |||
204 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 206 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
205 | }; | 207 | }; |
206 | 208 | ||
209 | static void notrace dmtimer_update_sched_clock(void) | ||
210 | { | ||
211 | u32 cyc; | ||
212 | |||
213 | cyc = omap_dm_timer_read_counter(gpt_clocksource); | ||
214 | |||
215 | update_sched_clock(&cd, cyc, (u32)~0); | ||
216 | } | ||
217 | |||
207 | /* Setup free-running counter for clocksource */ | 218 | /* Setup free-running counter for clocksource */ |
208 | static void __init omap2_gp_clocksource_init(void) | 219 | static void __init omap2_gp_clocksource_init(void) |
209 | { | 220 | { |
@@ -224,6 +235,8 @@ static void __init omap2_gp_clocksource_init(void) | |||
224 | 235 | ||
225 | omap_dm_timer_set_load_start(gpt, 1, 0); | 236 | omap_dm_timer_set_load_start(gpt, 1, 0); |
226 | 237 | ||
238 | init_sched_clock(&cd, dmtimer_update_sched_clock, 32, tick_rate); | ||
239 | |||
227 | if (clocksource_register_hz(&clocksource_gpt, tick_rate)) | 240 | if (clocksource_register_hz(&clocksource_gpt, tick_rate)) |
228 | printk(err2, clocksource_gpt.name); | 241 | printk(err2, clocksource_gpt.name); |
229 | } | 242 | } |
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c index fbc5b775f895..b166b1d845d7 100644 --- a/arch/arm/mach-pxa/pxa25x.c +++ b/arch/arm/mach-pxa/pxa25x.c | |||
@@ -347,6 +347,7 @@ static struct platform_device *pxa25x_devices[] __initdata = { | |||
347 | &pxa25x_device_assp, | 347 | &pxa25x_device_assp, |
348 | &pxa25x_device_pwm0, | 348 | &pxa25x_device_pwm0, |
349 | &pxa25x_device_pwm1, | 349 | &pxa25x_device_pwm1, |
350 | &pxa_device_asoc_platform, | ||
350 | }; | 351 | }; |
351 | 352 | ||
352 | static struct sys_device pxa25x_sysdev[] = { | 353 | static struct sys_device pxa25x_sysdev[] = { |
diff --git a/arch/arm/mach-pxa/tosa-bt.c b/arch/arm/mach-pxa/tosa-bt.c index c31e601eb49c..b9b1e5c2b290 100644 --- a/arch/arm/mach-pxa/tosa-bt.c +++ b/arch/arm/mach-pxa/tosa-bt.c | |||
@@ -81,8 +81,6 @@ static int tosa_bt_probe(struct platform_device *dev) | |||
81 | goto err_rfk_alloc; | 81 | goto err_rfk_alloc; |
82 | } | 82 | } |
83 | 83 | ||
84 | rfkill_set_led_trigger_name(rfk, "tosa-bt"); | ||
85 | |||
86 | rc = rfkill_register(rfk); | 84 | rc = rfkill_register(rfk); |
87 | if (rc) | 85 | if (rc) |
88 | goto err_rfkill; | 86 | goto err_rfkill; |
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index af152e70cfcf..f2582ec300d9 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -875,6 +875,11 @@ static struct platform_device sharpsl_rom_device = { | |||
875 | .dev.platform_data = &sharpsl_rom_data, | 875 | .dev.platform_data = &sharpsl_rom_data, |
876 | }; | 876 | }; |
877 | 877 | ||
878 | static struct platform_device wm9712_device = { | ||
879 | .name = "wm9712-codec", | ||
880 | .id = -1, | ||
881 | }; | ||
882 | |||
878 | static struct platform_device *devices[] __initdata = { | 883 | static struct platform_device *devices[] __initdata = { |
879 | &tosascoop_device, | 884 | &tosascoop_device, |
880 | &tosascoop_jc_device, | 885 | &tosascoop_jc_device, |
@@ -885,6 +890,7 @@ static struct platform_device *devices[] __initdata = { | |||
885 | &tosaled_device, | 890 | &tosaled_device, |
886 | &tosa_bt_device, | 891 | &tosa_bt_device, |
887 | &sharpsl_rom_device, | 892 | &sharpsl_rom_device, |
893 | &wm9712_device, | ||
888 | }; | 894 | }; |
889 | 895 | ||
890 | static void tosa_poweroff(void) | 896 | static void tosa_poweroff(void) |
diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig index a0cb2581894f..50825a3f91cc 100644 --- a/arch/arm/mach-s3c2440/Kconfig +++ b/arch/arm/mach-s3c2440/Kconfig | |||
@@ -99,6 +99,7 @@ config MACH_NEO1973_GTA02 | |||
99 | select POWER_SUPPLY | 99 | select POWER_SUPPLY |
100 | select MACH_NEO1973 | 100 | select MACH_NEO1973 |
101 | select S3C2410_PWM | 101 | select S3C2410_PWM |
102 | select S3C_DEV_USB_HOST | ||
102 | help | 103 | help |
103 | Say Y here if you are using the Openmoko GTA02 / Freerunner GSM Phone | 104 | Say Y here if you are using the Openmoko GTA02 / Freerunner GSM Phone |
104 | 105 | ||
diff --git a/arch/arm/mach-s3c2440/include/mach/gta02.h b/arch/arm/mach-s3c2440/include/mach/gta02.h index 953331d8d56a..3a56a229cac6 100644 --- a/arch/arm/mach-s3c2440/include/mach/gta02.h +++ b/arch/arm/mach-s3c2440/include/mach/gta02.h | |||
@@ -44,19 +44,19 @@ | |||
44 | #define GTA02v3_GPIO_nUSB_FLT S3C2410_GPG(10) /* v3 + v4 only */ | 44 | #define GTA02v3_GPIO_nUSB_FLT S3C2410_GPG(10) /* v3 + v4 only */ |
45 | #define GTA02v3_GPIO_nGSM_OC S3C2410_GPG(11) /* v3 + v4 only */ | 45 | #define GTA02v3_GPIO_nGSM_OC S3C2410_GPG(11) /* v3 + v4 only */ |
46 | 46 | ||
47 | #define GTA02_GPIO_AMP_SHUT S3C2440_GPJ1 /* v2 + v3 + v4 only */ | 47 | #define GTA02_GPIO_AMP_SHUT S3C2410_GPJ(1) /* v2 + v3 + v4 only */ |
48 | #define GTA02v1_GPIO_WLAN_GPIO10 S3C2440_GPJ2 | 48 | #define GTA02v1_GPIO_WLAN_GPIO10 S3C2410_GPJ(2) |
49 | #define GTA02_GPIO_HP_IN S3C2440_GPJ2 /* v2 + v3 + v4 only */ | 49 | #define GTA02_GPIO_HP_IN S3C2410_GPJ(2) /* v2 + v3 + v4 only */ |
50 | #define GTA02_GPIO_INT0 S3C2440_GPJ3 /* v2 + v3 + v4 only */ | 50 | #define GTA02_GPIO_INT0 S3C2410_GPJ(3) /* v2 + v3 + v4 only */ |
51 | #define GTA02_GPIO_nGSM_EN S3C2440_GPJ4 | 51 | #define GTA02_GPIO_nGSM_EN S3C2410_GPJ(4) |
52 | #define GTA02_GPIO_3D_RESET S3C2440_GPJ5 | 52 | #define GTA02_GPIO_3D_RESET S3C2410_GPJ(5) |
53 | #define GTA02_GPIO_nDL_GSM S3C2440_GPJ6 /* v4 + v5 only */ | 53 | #define GTA02_GPIO_nDL_GSM S3C2410_GPJ(6) /* v4 + v5 only */ |
54 | #define GTA02_GPIO_WLAN_GPIO0 S3C2440_GPJ7 | 54 | #define GTA02_GPIO_WLAN_GPIO0 S3C2410_GPJ(7) |
55 | #define GTA02v1_GPIO_BAT_ID S3C2440_GPJ8 | 55 | #define GTA02v1_GPIO_BAT_ID S3C2410_GPJ(8) |
56 | #define GTA02_GPIO_KEEPACT S3C2440_GPJ8 | 56 | #define GTA02_GPIO_KEEPACT S3C2410_GPJ(8) |
57 | #define GTA02v1_GPIO_HP_IN S3C2440_GPJ10 | 57 | #define GTA02v1_GPIO_HP_IN S3C2410_GPJ(10) |
58 | #define GTA02_CHIP_PWD S3C2440_GPJ11 /* v2 + v3 + v4 only */ | 58 | #define GTA02_CHIP_PWD S3C2410_GPJ(11) /* v2 + v3 + v4 only */ |
59 | #define GTA02_GPIO_nWLAN_RESET S3C2440_GPJ12 /* v2 + v3 + v4 only */ | 59 | #define GTA02_GPIO_nWLAN_RESET S3C2410_GPJ(12) /* v2 + v3 + v4 only */ |
60 | 60 | ||
61 | #define GTA02_IRQ_GSENSOR_1 IRQ_EINT0 | 61 | #define GTA02_IRQ_GSENSOR_1 IRQ_EINT0 |
62 | #define GTA02_IRQ_MODEM IRQ_EINT1 | 62 | #define GTA02_IRQ_MODEM IRQ_EINT1 |
diff --git a/arch/arm/mach-s3c64xx/clock.c b/arch/arm/mach-s3c64xx/clock.c index dd3782064508..fdfc4d5e37a1 100644 --- a/arch/arm/mach-s3c64xx/clock.c +++ b/arch/arm/mach-s3c64xx/clock.c | |||
@@ -151,6 +151,12 @@ static struct clk init_clocks_off[] = { | |||
151 | .enable = s3c64xx_pclk_ctrl, | 151 | .enable = s3c64xx_pclk_ctrl, |
152 | .ctrlbit = S3C_CLKCON_PCLK_IIC, | 152 | .ctrlbit = S3C_CLKCON_PCLK_IIC, |
153 | }, { | 153 | }, { |
154 | .name = "i2c", | ||
155 | .id = 1, | ||
156 | .parent = &clk_p, | ||
157 | .enable = s3c64xx_pclk_ctrl, | ||
158 | .ctrlbit = S3C6410_CLKCON_PCLK_I2C1, | ||
159 | }, { | ||
154 | .name = "iis", | 160 | .name = "iis", |
155 | .id = 0, | 161 | .id = 0, |
156 | .parent = &clk_p, | 162 | .parent = &clk_p, |
diff --git a/arch/arm/mach-s3c64xx/dma.c b/arch/arm/mach-s3c64xx/dma.c index 135db1b41252..c35585cf8c4f 100644 --- a/arch/arm/mach-s3c64xx/dma.c +++ b/arch/arm/mach-s3c64xx/dma.c | |||
@@ -690,12 +690,12 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase, | |||
690 | 690 | ||
691 | regptr = regs + PL080_Cx_BASE(0); | 691 | regptr = regs + PL080_Cx_BASE(0); |
692 | 692 | ||
693 | for (ch = 0; ch < 8; ch++, chno++, chptr++) { | 693 | for (ch = 0; ch < 8; ch++, chptr++) { |
694 | printk(KERN_INFO "%s: registering DMA %d (%p)\n", | 694 | pr_debug("%s: registering DMA %d (%p)\n", |
695 | __func__, chno, regptr); | 695 | __func__, chno + ch, regptr); |
696 | 696 | ||
697 | chptr->bit = 1 << ch; | 697 | chptr->bit = 1 << ch; |
698 | chptr->number = chno; | 698 | chptr->number = chno + ch; |
699 | chptr->dmac = dmac; | 699 | chptr->dmac = dmac; |
700 | chptr->regs = regptr; | 700 | chptr->regs = regptr; |
701 | regptr += PL080_Cx_STRIDE; | 701 | regptr += PL080_Cx_STRIDE; |
@@ -704,7 +704,8 @@ static int s3c64xx_dma_init1(int chno, enum dma_ch chbase, | |||
704 | /* for the moment, permanently enable the controller */ | 704 | /* for the moment, permanently enable the controller */ |
705 | writel(PL080_CONFIG_ENABLE, regs + PL080_CONFIG); | 705 | writel(PL080_CONFIG_ENABLE, regs + PL080_CONFIG); |
706 | 706 | ||
707 | printk(KERN_INFO "PL080: IRQ %d, at %p\n", irq, regs); | 707 | printk(KERN_INFO "PL080: IRQ %d, at %p, channels %d..%d\n", |
708 | irq, regs, chno, chno+8); | ||
708 | 709 | ||
709 | return 0; | 710 | return 0; |
710 | 711 | ||
diff --git a/arch/arm/mach-s3c64xx/gpiolib.c b/arch/arm/mach-s3c64xx/gpiolib.c index fd99a82e82c4..92b09085caaa 100644 --- a/arch/arm/mach-s3c64xx/gpiolib.c +++ b/arch/arm/mach-s3c64xx/gpiolib.c | |||
@@ -72,7 +72,7 @@ static struct s3c_gpio_cfg gpio_4bit_cfg_eint0011 = { | |||
72 | .get_pull = s3c_gpio_getpull_updown, | 72 | .get_pull = s3c_gpio_getpull_updown, |
73 | }; | 73 | }; |
74 | 74 | ||
75 | int s3c64xx_gpio2int_gpm(struct gpio_chip *chip, unsigned pin) | 75 | static int s3c64xx_gpio2int_gpm(struct gpio_chip *chip, unsigned pin) |
76 | { | 76 | { |
77 | return pin < 5 ? IRQ_EINT(23) + pin : -ENXIO; | 77 | return pin < 5 ? IRQ_EINT(23) + pin : -ENXIO; |
78 | } | 78 | } |
@@ -138,7 +138,7 @@ static struct s3c_gpio_chip gpio_4bit[] = { | |||
138 | }, | 138 | }, |
139 | }; | 139 | }; |
140 | 140 | ||
141 | int s3c64xx_gpio2int_gpl(struct gpio_chip *chip, unsigned pin) | 141 | static int s3c64xx_gpio2int_gpl(struct gpio_chip *chip, unsigned pin) |
142 | { | 142 | { |
143 | return pin >= 8 ? IRQ_EINT(16) + pin - 8 : -ENXIO; | 143 | return pin >= 8 ? IRQ_EINT(16) + pin - 8 : -ENXIO; |
144 | } | 144 | } |
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c index e85192a86fbe..a80a3163dd30 100644 --- a/arch/arm/mach-s3c64xx/mach-smdk6410.c +++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/smsc911x.h> | 29 | #include <linux/smsc911x.h> |
30 | #include <linux/regulator/fixed.h> | 30 | #include <linux/regulator/fixed.h> |
31 | #include <linux/regulator/machine.h> | ||
31 | 32 | ||
32 | #ifdef CONFIG_SMDK6410_WM1190_EV1 | 33 | #ifdef CONFIG_SMDK6410_WM1190_EV1 |
33 | #include <linux/mfd/wm8350/core.h> | 34 | #include <linux/mfd/wm8350/core.h> |
@@ -351,7 +352,7 @@ static struct regulator_init_data smdk6410_vddpll = { | |||
351 | /* VDD_UH_MMC, LDO5 on J5 */ | 352 | /* VDD_UH_MMC, LDO5 on J5 */ |
352 | static struct regulator_init_data smdk6410_vdduh_mmc = { | 353 | static struct regulator_init_data smdk6410_vdduh_mmc = { |
353 | .constraints = { | 354 | .constraints = { |
354 | .name = "PVDD_UH/PVDD_MMC", | 355 | .name = "PVDD_UH+PVDD_MMC", |
355 | .always_on = 1, | 356 | .always_on = 1, |
356 | }, | 357 | }, |
357 | }; | 358 | }; |
@@ -417,7 +418,7 @@ static struct regulator_init_data smdk6410_vddaudio = { | |||
417 | /* S3C64xx internal logic & PLL */ | 418 | /* S3C64xx internal logic & PLL */ |
418 | static struct regulator_init_data wm8350_dcdc1_data = { | 419 | static struct regulator_init_data wm8350_dcdc1_data = { |
419 | .constraints = { | 420 | .constraints = { |
420 | .name = "PVDD_INT/PVDD_PLL", | 421 | .name = "PVDD_INT+PVDD_PLL", |
421 | .min_uV = 1200000, | 422 | .min_uV = 1200000, |
422 | .max_uV = 1200000, | 423 | .max_uV = 1200000, |
423 | .always_on = 1, | 424 | .always_on = 1, |
@@ -452,7 +453,7 @@ static struct regulator_consumer_supply wm8350_dcdc4_consumers[] = { | |||
452 | 453 | ||
453 | static struct regulator_init_data wm8350_dcdc4_data = { | 454 | static struct regulator_init_data wm8350_dcdc4_data = { |
454 | .constraints = { | 455 | .constraints = { |
455 | .name = "PVDD_HI/PVDD_EXT/PVDD_SYS/PVCCM2MTV", | 456 | .name = "PVDD_HI+PVDD_EXT+PVDD_SYS+PVCCM2MTV", |
456 | .min_uV = 3000000, | 457 | .min_uV = 3000000, |
457 | .max_uV = 3000000, | 458 | .max_uV = 3000000, |
458 | .always_on = 1, | 459 | .always_on = 1, |
@@ -464,7 +465,7 @@ static struct regulator_init_data wm8350_dcdc4_data = { | |||
464 | /* OTGi/1190-EV1 HPVDD & AVDD */ | 465 | /* OTGi/1190-EV1 HPVDD & AVDD */ |
465 | static struct regulator_init_data wm8350_ldo4_data = { | 466 | static struct regulator_init_data wm8350_ldo4_data = { |
466 | .constraints = { | 467 | .constraints = { |
467 | .name = "PVDD_OTGI/HPVDD/AVDD", | 468 | .name = "PVDD_OTGI+HPVDD+AVDD", |
468 | .min_uV = 1200000, | 469 | .min_uV = 1200000, |
469 | .max_uV = 1200000, | 470 | .max_uV = 1200000, |
470 | .apply_uV = 1, | 471 | .apply_uV = 1, |
@@ -552,7 +553,7 @@ static struct wm831x_backlight_pdata wm1192_backlight_pdata = { | |||
552 | 553 | ||
553 | static struct regulator_init_data wm1192_dcdc3 = { | 554 | static struct regulator_init_data wm1192_dcdc3 = { |
554 | .constraints = { | 555 | .constraints = { |
555 | .name = "PVDD_MEM/PVDD_GPS", | 556 | .name = "PVDD_MEM+PVDD_GPS", |
556 | .always_on = 1, | 557 | .always_on = 1, |
557 | }, | 558 | }, |
558 | }; | 559 | }; |
@@ -563,7 +564,7 @@ static struct regulator_consumer_supply wm1192_ldo1_consumers[] = { | |||
563 | 564 | ||
564 | static struct regulator_init_data wm1192_ldo1 = { | 565 | static struct regulator_init_data wm1192_ldo1 = { |
565 | .constraints = { | 566 | .constraints = { |
566 | .name = "PVDD_LCD/PVDD_EXT", | 567 | .name = "PVDD_LCD+PVDD_EXT", |
567 | .always_on = 1, | 568 | .always_on = 1, |
568 | }, | 569 | }, |
569 | .consumer_supplies = wm1192_ldo1_consumers, | 570 | .consumer_supplies = wm1192_ldo1_consumers, |
diff --git a/arch/arm/mach-s3c64xx/setup-keypad.c b/arch/arm/mach-s3c64xx/setup-keypad.c index f8ed0d22db70..1d4d0ee9e870 100644 --- a/arch/arm/mach-s3c64xx/setup-keypad.c +++ b/arch/arm/mach-s3c64xx/setup-keypad.c | |||
@@ -17,7 +17,7 @@ | |||
17 | void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols) | 17 | void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols) |
18 | { | 18 | { |
19 | /* Set all the necessary GPK pins to special-function 3: KP_ROW[x] */ | 19 | /* Set all the necessary GPK pins to special-function 3: KP_ROW[x] */ |
20 | s3c_gpio_cfgrange_nopull(S3C64XX_GPK(8), 8 + rows, S3C_GPIO_SFN(3)); | 20 | s3c_gpio_cfgrange_nopull(S3C64XX_GPK(8), rows, S3C_GPIO_SFN(3)); |
21 | 21 | ||
22 | /* Set all the necessary GPL pins to special-function 3: KP_COL[x] */ | 22 | /* Set all the necessary GPL pins to special-function 3: KP_COL[x] */ |
23 | s3c_gpio_cfgrange_nopull(S3C64XX_GPL(0), cols, S3C_GPIO_SFN(3)); | 23 | s3c_gpio_cfgrange_nopull(S3C64XX_GPL(0), cols, S3C_GPIO_SFN(3)); |
diff --git a/arch/arm/mach-s3c64xx/setup-sdhci.c b/arch/arm/mach-s3c64xx/setup-sdhci.c index 1a942037c4ef..f344a222bc84 100644 --- a/arch/arm/mach-s3c64xx/setup-sdhci.c +++ b/arch/arm/mach-s3c64xx/setup-sdhci.c | |||
@@ -56,7 +56,7 @@ void s3c6400_setup_sdhci_cfg_card(struct platform_device *dev, | |||
56 | else | 56 | else |
57 | ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0); | 57 | ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0); |
58 | 58 | ||
59 | printk(KERN_INFO "%s: CTRL 2=%08x, 3=%08x\n", __func__, ctrl2, ctrl3); | 59 | pr_debug("%s: CTRL 2=%08x, 3=%08x\n", __func__, ctrl2, ctrl3); |
60 | writel(ctrl2, r + S3C_SDHCI_CONTROL2); | 60 | writel(ctrl2, r + S3C_SDHCI_CONTROL2); |
61 | writel(ctrl3, r + S3C_SDHCI_CONTROL3); | 61 | writel(ctrl3, r + S3C_SDHCI_CONTROL3); |
62 | } | 62 | } |
diff --git a/arch/arm/mach-s5p6442/include/mach/map.h b/arch/arm/mach-s5p6442/include/mach/map.h index 203dd5a18bd5..058dab4482a1 100644 --- a/arch/arm/mach-s5p6442/include/mach/map.h +++ b/arch/arm/mach-s5p6442/include/mach/map.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* linux/arch/arm/mach-s5p6442/include/mach/map.h | 1 | /* linux/arch/arm/mach-s5p6442/include/mach/map.h |
2 | * | 2 | * |
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | 3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. |
4 | * http://www.samsung.com/ | 4 | * http://www.samsung.com/ |
5 | * | 5 | * |
6 | * S5P6442 - Memory map definitions | 6 | * S5P6442 - Memory map definitions |
@@ -16,56 +16,61 @@ | |||
16 | #include <plat/map-base.h> | 16 | #include <plat/map-base.h> |
17 | #include <plat/map-s5p.h> | 17 | #include <plat/map-s5p.h> |
18 | 18 | ||
19 | #define S5P6442_PA_CHIPID (0xE0000000) | 19 | #define S5P6442_PA_SDRAM 0x20000000 |
20 | #define S5P_PA_CHIPID S5P6442_PA_CHIPID | ||
21 | 20 | ||
22 | #define S5P6442_PA_SYSCON (0xE0100000) | 21 | #define S5P6442_PA_I2S0 0xC0B00000 |
23 | #define S5P_PA_SYSCON S5P6442_PA_SYSCON | 22 | #define S5P6442_PA_I2S1 0xF2200000 |
24 | 23 | ||
25 | #define S5P6442_PA_GPIO (0xE0200000) | 24 | #define S5P6442_PA_CHIPID 0xE0000000 |
26 | 25 | ||
27 | #define S5P6442_PA_VIC0 (0xE4000000) | 26 | #define S5P6442_PA_SYSCON 0xE0100000 |
28 | #define S5P6442_PA_VIC1 (0xE4100000) | ||
29 | #define S5P6442_PA_VIC2 (0xE4200000) | ||
30 | 27 | ||
31 | #define S5P6442_PA_SROMC (0xE7000000) | 28 | #define S5P6442_PA_GPIO 0xE0200000 |
32 | #define S5P_PA_SROMC S5P6442_PA_SROMC | ||
33 | 29 | ||
34 | #define S5P6442_PA_MDMA 0xE8000000 | 30 | #define S5P6442_PA_VIC0 0xE4000000 |
35 | #define S5P6442_PA_PDMA 0xE9000000 | 31 | #define S5P6442_PA_VIC1 0xE4100000 |
32 | #define S5P6442_PA_VIC2 0xE4200000 | ||
36 | 33 | ||
37 | #define S5P6442_PA_TIMER (0xEA000000) | 34 | #define S5P6442_PA_SROMC 0xE7000000 |
38 | #define S5P_PA_TIMER S5P6442_PA_TIMER | ||
39 | 35 | ||
40 | #define S5P6442_PA_SYSTIMER (0xEA100000) | 36 | #define S5P6442_PA_MDMA 0xE8000000 |
37 | #define S5P6442_PA_PDMA 0xE9000000 | ||
41 | 38 | ||
42 | #define S5P6442_PA_WATCHDOG (0xEA200000) | 39 | #define S5P6442_PA_TIMER 0xEA000000 |
43 | 40 | ||
44 | #define S5P6442_PA_UART (0xEC000000) | 41 | #define S5P6442_PA_SYSTIMER 0xEA100000 |
45 | 42 | ||
46 | #define S5P_PA_UART0 (S5P6442_PA_UART + 0x0) | 43 | #define S5P6442_PA_WATCHDOG 0xEA200000 |
47 | #define S5P_PA_UART1 (S5P6442_PA_UART + 0x400) | ||
48 | #define S5P_PA_UART2 (S5P6442_PA_UART + 0x800) | ||
49 | #define S5P_SZ_UART SZ_256 | ||
50 | 44 | ||
51 | #define S5P6442_PA_IIC0 (0xEC100000) | 45 | #define S5P6442_PA_UART 0xEC000000 |
52 | 46 | ||
53 | #define S5P6442_PA_SDRAM (0x20000000) | 47 | #define S5P6442_PA_IIC0 0xEC100000 |
54 | #define S5P_PA_SDRAM S5P6442_PA_SDRAM | ||
55 | 48 | ||
56 | #define S5P6442_PA_SPI 0xEC300000 | 49 | #define S5P6442_PA_SPI 0xEC300000 |
57 | 50 | ||
58 | /* I2S */ | ||
59 | #define S5P6442_PA_I2S0 0xC0B00000 | ||
60 | #define S5P6442_PA_I2S1 0xF2200000 | ||
61 | |||
62 | /* PCM */ | ||
63 | #define S5P6442_PA_PCM0 0xF2400000 | 51 | #define S5P6442_PA_PCM0 0xF2400000 |
64 | #define S5P6442_PA_PCM1 0xF2500000 | 52 | #define S5P6442_PA_PCM1 0xF2500000 |
65 | 53 | ||
66 | /* compatibiltiy defines. */ | 54 | /* Compatibiltiy Defines */ |
55 | |||
56 | #define S3C_PA_IIC S5P6442_PA_IIC0 | ||
67 | #define S3C_PA_WDT S5P6442_PA_WATCHDOG | 57 | #define S3C_PA_WDT S5P6442_PA_WATCHDOG |
58 | |||
59 | #define S5P_PA_CHIPID S5P6442_PA_CHIPID | ||
60 | #define S5P_PA_SDRAM S5P6442_PA_SDRAM | ||
61 | #define S5P_PA_SROMC S5P6442_PA_SROMC | ||
62 | #define S5P_PA_SYSCON S5P6442_PA_SYSCON | ||
63 | #define S5P_PA_TIMER S5P6442_PA_TIMER | ||
64 | |||
65 | /* UART */ | ||
66 | |||
68 | #define S3C_PA_UART S5P6442_PA_UART | 67 | #define S3C_PA_UART S5P6442_PA_UART |
69 | #define S3C_PA_IIC S5P6442_PA_IIC0 | 68 | |
69 | #define S5P_PA_UART(x) (S3C_PA_UART + ((x) * S3C_UART_OFFSET)) | ||
70 | #define S5P_PA_UART0 S5P_PA_UART(0) | ||
71 | #define S5P_PA_UART1 S5P_PA_UART(1) | ||
72 | #define S5P_PA_UART2 S5P_PA_UART(2) | ||
73 | |||
74 | #define S5P_SZ_UART SZ_256 | ||
70 | 75 | ||
71 | #endif /* __ASM_ARCH_MAP_H */ | 76 | #endif /* __ASM_ARCH_MAP_H */ |
diff --git a/arch/arm/mach-s5p64x0/include/mach/gpio.h b/arch/arm/mach-s5p64x0/include/mach/gpio.h index 5486c8f01f1d..adb5f298ead8 100644 --- a/arch/arm/mach-s5p64x0/include/mach/gpio.h +++ b/arch/arm/mach-s5p64x0/include/mach/gpio.h | |||
@@ -23,7 +23,7 @@ | |||
23 | #define S5P6440_GPIO_A_NR (6) | 23 | #define S5P6440_GPIO_A_NR (6) |
24 | #define S5P6440_GPIO_B_NR (7) | 24 | #define S5P6440_GPIO_B_NR (7) |
25 | #define S5P6440_GPIO_C_NR (8) | 25 | #define S5P6440_GPIO_C_NR (8) |
26 | #define S5P6440_GPIO_F_NR (2) | 26 | #define S5P6440_GPIO_F_NR (16) |
27 | #define S5P6440_GPIO_G_NR (7) | 27 | #define S5P6440_GPIO_G_NR (7) |
28 | #define S5P6440_GPIO_H_NR (10) | 28 | #define S5P6440_GPIO_H_NR (10) |
29 | #define S5P6440_GPIO_I_NR (16) | 29 | #define S5P6440_GPIO_I_NR (16) |
@@ -36,7 +36,7 @@ | |||
36 | #define S5P6450_GPIO_B_NR (7) | 36 | #define S5P6450_GPIO_B_NR (7) |
37 | #define S5P6450_GPIO_C_NR (8) | 37 | #define S5P6450_GPIO_C_NR (8) |
38 | #define S5P6450_GPIO_D_NR (8) | 38 | #define S5P6450_GPIO_D_NR (8) |
39 | #define S5P6450_GPIO_F_NR (2) | 39 | #define S5P6450_GPIO_F_NR (16) |
40 | #define S5P6450_GPIO_G_NR (14) | 40 | #define S5P6450_GPIO_G_NR (14) |
41 | #define S5P6450_GPIO_H_NR (10) | 41 | #define S5P6450_GPIO_H_NR (10) |
42 | #define S5P6450_GPIO_I_NR (16) | 42 | #define S5P6450_GPIO_I_NR (16) |
diff --git a/arch/arm/mach-s5p64x0/include/mach/map.h b/arch/arm/mach-s5p64x0/include/mach/map.h index a9365e5ba614..95c91257c7ca 100644 --- a/arch/arm/mach-s5p64x0/include/mach/map.h +++ b/arch/arm/mach-s5p64x0/include/mach/map.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* linux/arch/arm/mach-s5p64x0/include/mach/map.h | 1 | /* linux/arch/arm/mach-s5p64x0/include/mach/map.h |
2 | * | 2 | * |
3 | * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd. | 3 | * Copyright (c) 2009-2011 Samsung Electronics Co., Ltd. |
4 | * http://www.samsung.com | 4 | * http://www.samsung.com |
5 | * | 5 | * |
6 | * S5P64X0 - Memory map definitions | 6 | * S5P64X0 - Memory map definitions |
@@ -16,64 +16,46 @@ | |||
16 | #include <plat/map-base.h> | 16 | #include <plat/map-base.h> |
17 | #include <plat/map-s5p.h> | 17 | #include <plat/map-s5p.h> |
18 | 18 | ||
19 | #define S5P64X0_PA_SDRAM (0x20000000) | 19 | #define S5P64X0_PA_SDRAM 0x20000000 |
20 | 20 | ||
21 | #define S5P64X0_PA_CHIPID (0xE0000000) | 21 | #define S5P64X0_PA_CHIPID 0xE0000000 |
22 | #define S5P_PA_CHIPID S5P64X0_PA_CHIPID | ||
23 | |||
24 | #define S5P64X0_PA_SYSCON (0xE0100000) | ||
25 | #define S5P_PA_SYSCON S5P64X0_PA_SYSCON | ||
26 | |||
27 | #define S5P64X0_PA_GPIO (0xE0308000) | ||
28 | |||
29 | #define S5P64X0_PA_VIC0 (0xE4000000) | ||
30 | #define S5P64X0_PA_VIC1 (0xE4100000) | ||
31 | 22 | ||
32 | #define S5P64X0_PA_SROMC (0xE7000000) | 23 | #define S5P64X0_PA_SYSCON 0xE0100000 |
33 | #define S5P_PA_SROMC S5P64X0_PA_SROMC | ||
34 | |||
35 | #define S5P64X0_PA_PDMA (0xE9000000) | ||
36 | |||
37 | #define S5P64X0_PA_TIMER (0xEA000000) | ||
38 | #define S5P_PA_TIMER S5P64X0_PA_TIMER | ||
39 | 24 | ||
40 | #define S5P64X0_PA_RTC (0xEA100000) | 25 | #define S5P64X0_PA_GPIO 0xE0308000 |
41 | 26 | ||
42 | #define S5P64X0_PA_WDT (0xEA200000) | 27 | #define S5P64X0_PA_VIC0 0xE4000000 |
28 | #define S5P64X0_PA_VIC1 0xE4100000 | ||
43 | 29 | ||
44 | #define S5P6440_PA_UART(x) (0xEC000000 + ((x) * S3C_UART_OFFSET)) | 30 | #define S5P64X0_PA_SROMC 0xE7000000 |
45 | #define S5P6450_PA_UART(x) ((x < 5) ? (0xEC800000 + ((x) * S3C_UART_OFFSET)) : (0xEC000000)) | ||
46 | 31 | ||
47 | #define S5P_PA_UART0 S5P6450_PA_UART(0) | 32 | #define S5P64X0_PA_PDMA 0xE9000000 |
48 | #define S5P_PA_UART1 S5P6450_PA_UART(1) | ||
49 | #define S5P_PA_UART2 S5P6450_PA_UART(2) | ||
50 | #define S5P_PA_UART3 S5P6450_PA_UART(3) | ||
51 | #define S5P_PA_UART4 S5P6450_PA_UART(4) | ||
52 | #define S5P_PA_UART5 S5P6450_PA_UART(5) | ||
53 | 33 | ||
54 | #define S5P_SZ_UART SZ_256 | 34 | #define S5P64X0_PA_TIMER 0xEA000000 |
35 | #define S5P64X0_PA_RTC 0xEA100000 | ||
36 | #define S5P64X0_PA_WDT 0xEA200000 | ||
55 | 37 | ||
56 | #define S5P6440_PA_IIC0 (0xEC104000) | 38 | #define S5P6440_PA_IIC0 0xEC104000 |
57 | #define S5P6440_PA_IIC1 (0xEC20F000) | 39 | #define S5P6440_PA_IIC1 0xEC20F000 |
58 | #define S5P6450_PA_IIC0 (0xEC100000) | 40 | #define S5P6450_PA_IIC0 0xEC100000 |
59 | #define S5P6450_PA_IIC1 (0xEC200000) | 41 | #define S5P6450_PA_IIC1 0xEC200000 |
60 | 42 | ||
61 | #define S5P64X0_PA_SPI0 (0xEC400000) | 43 | #define S5P64X0_PA_SPI0 0xEC400000 |
62 | #define S5P64X0_PA_SPI1 (0xEC500000) | 44 | #define S5P64X0_PA_SPI1 0xEC500000 |
63 | 45 | ||
64 | #define S5P64X0_PA_HSOTG (0xED100000) | 46 | #define S5P64X0_PA_HSOTG 0xED100000 |
65 | 47 | ||
66 | #define S5P64X0_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000)) | 48 | #define S5P64X0_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000)) |
67 | 49 | ||
68 | #define S5P64X0_PA_I2S (0xF2000000) | 50 | #define S5P64X0_PA_I2S 0xF2000000 |
69 | #define S5P6450_PA_I2S1 0xF2800000 | 51 | #define S5P6450_PA_I2S1 0xF2800000 |
70 | #define S5P6450_PA_I2S2 0xF2900000 | 52 | #define S5P6450_PA_I2S2 0xF2900000 |
71 | 53 | ||
72 | #define S5P64X0_PA_PCM (0xF2100000) | 54 | #define S5P64X0_PA_PCM 0xF2100000 |
73 | 55 | ||
74 | #define S5P64X0_PA_ADC (0xF3000000) | 56 | #define S5P64X0_PA_ADC 0xF3000000 |
75 | 57 | ||
76 | /* compatibiltiy defines. */ | 58 | /* Compatibiltiy Defines */ |
77 | 59 | ||
78 | #define S3C_PA_HSMMC0 S5P64X0_PA_HSMMC(0) | 60 | #define S3C_PA_HSMMC0 S5P64X0_PA_HSMMC(0) |
79 | #define S3C_PA_HSMMC1 S5P64X0_PA_HSMMC(1) | 61 | #define S3C_PA_HSMMC1 S5P64X0_PA_HSMMC(1) |
@@ -83,6 +65,25 @@ | |||
83 | #define S3C_PA_RTC S5P64X0_PA_RTC | 65 | #define S3C_PA_RTC S5P64X0_PA_RTC |
84 | #define S3C_PA_WDT S5P64X0_PA_WDT | 66 | #define S3C_PA_WDT S5P64X0_PA_WDT |
85 | 67 | ||
68 | #define S5P_PA_CHIPID S5P64X0_PA_CHIPID | ||
69 | #define S5P_PA_SROMC S5P64X0_PA_SROMC | ||
70 | #define S5P_PA_SYSCON S5P64X0_PA_SYSCON | ||
71 | #define S5P_PA_TIMER S5P64X0_PA_TIMER | ||
72 | |||
86 | #define SAMSUNG_PA_ADC S5P64X0_PA_ADC | 73 | #define SAMSUNG_PA_ADC S5P64X0_PA_ADC |
87 | 74 | ||
75 | /* UART */ | ||
76 | |||
77 | #define S5P6440_PA_UART(x) (0xEC000000 + ((x) * S3C_UART_OFFSET)) | ||
78 | #define S5P6450_PA_UART(x) ((x < 5) ? (0xEC800000 + ((x) * S3C_UART_OFFSET)) : (0xEC000000)) | ||
79 | |||
80 | #define S5P_PA_UART0 S5P6450_PA_UART(0) | ||
81 | #define S5P_PA_UART1 S5P6450_PA_UART(1) | ||
82 | #define S5P_PA_UART2 S5P6450_PA_UART(2) | ||
83 | #define S5P_PA_UART3 S5P6450_PA_UART(3) | ||
84 | #define S5P_PA_UART4 S5P6450_PA_UART(4) | ||
85 | #define S5P_PA_UART5 S5P6450_PA_UART(5) | ||
86 | |||
87 | #define S5P_SZ_UART SZ_256 | ||
88 | |||
88 | #endif /* __ASM_ARCH_MAP_H */ | 89 | #endif /* __ASM_ARCH_MAP_H */ |
diff --git a/arch/arm/mach-s5pc100/include/mach/map.h b/arch/arm/mach-s5pc100/include/mach/map.h index 328467b346aa..ccbe6b767f7d 100644 --- a/arch/arm/mach-s5pc100/include/mach/map.h +++ b/arch/arm/mach-s5pc100/include/mach/map.h | |||
@@ -1,5 +1,8 @@ | |||
1 | /* linux/arch/arm/mach-s5pc100/include/mach/map.h | 1 | /* linux/arch/arm/mach-s5pc100/include/mach/map.h |
2 | * | 2 | * |
3 | * Copyright (c) 2011 Samsung Electronics Co., Ltd. | ||
4 | * http://www.samsung.com/ | ||
5 | * | ||
3 | * Copyright 2009 Samsung Electronics Co. | 6 | * Copyright 2009 Samsung Electronics Co. |
4 | * Byungho Min <bhmin@samsung.com> | 7 | * Byungho Min <bhmin@samsung.com> |
5 | * | 8 | * |
@@ -16,145 +19,115 @@ | |||
16 | #include <plat/map-base.h> | 19 | #include <plat/map-base.h> |
17 | #include <plat/map-s5p.h> | 20 | #include <plat/map-s5p.h> |
18 | 21 | ||
19 | /* | 22 | #define S5PC100_PA_SDRAM 0x20000000 |
20 | * map-base.h has already defined virtual memory address | 23 | |
21 | * S3C_VA_IRQ S3C_ADDR(0x00000000) irq controller(s) | 24 | #define S5PC100_PA_ONENAND 0xE7100000 |
22 | * S3C_VA_SYS S3C_ADDR(0x00100000) system control | 25 | #define S5PC100_PA_ONENAND_BUF 0xB0000000 |
23 | * S3C_VA_MEM S3C_ADDR(0x00200000) system control (not used) | 26 | |
24 | * S3C_VA_TIMER S3C_ADDR(0x00300000) timer block | 27 | #define S5PC100_PA_CHIPID 0xE0000000 |
25 | * S3C_VA_WATCHDOG S3C_ADDR(0x00400000) watchdog | ||
26 | * S3C_VA_UART S3C_ADDR(0x01000000) UART | ||
27 | * | ||
28 | * S5PC100 specific virtual memory address can be defined here | ||
29 | * S5PC1XX_VA_GPIO S3C_ADDR(0x00500000) GPIO | ||
30 | * | ||
31 | */ | ||
32 | 28 | ||
33 | #define S5PC100_PA_ONENAND_BUF (0xB0000000) | 29 | #define S5PC100_PA_SYSCON 0xE0100000 |
34 | #define S5PC100_SZ_ONENAND_BUF (SZ_256M - SZ_32M) | ||
35 | 30 | ||
36 | /* Chip ID */ | 31 | #define S5PC100_PA_OTHERS 0xE0200000 |
37 | 32 | ||
38 | #define S5PC100_PA_CHIPID (0xE0000000) | 33 | #define S5PC100_PA_GPIO 0xE0300000 |
39 | #define S5P_PA_CHIPID S5PC100_PA_CHIPID | ||
40 | 34 | ||
41 | #define S5PC100_PA_SYSCON (0xE0100000) | 35 | #define S5PC100_PA_VIC0 0xE4000000 |
42 | #define S5P_PA_SYSCON S5PC100_PA_SYSCON | 36 | #define S5PC100_PA_VIC1 0xE4100000 |
37 | #define S5PC100_PA_VIC2 0xE4200000 | ||
43 | 38 | ||
44 | #define S5PC100_PA_OTHERS (0xE0200000) | 39 | #define S5PC100_PA_SROMC 0xE7000000 |
45 | #define S5PC100_VA_OTHERS (S3C_VA_SYS + 0x10000) | ||
46 | 40 | ||
47 | #define S5PC100_PA_GPIO (0xE0300000) | 41 | #define S5PC100_PA_CFCON 0xE7800000 |
48 | #define S5PC1XX_VA_GPIO S3C_ADDR(0x00500000) | ||
49 | 42 | ||
50 | /* Interrupt */ | 43 | #define S5PC100_PA_MDMA 0xE8100000 |
51 | #define S5PC100_PA_VIC0 (0xE4000000) | 44 | #define S5PC100_PA_PDMA0 0xE9000000 |
52 | #define S5PC100_PA_VIC1 (0xE4100000) | 45 | #define S5PC100_PA_PDMA1 0xE9200000 |
53 | #define S5PC100_PA_VIC2 (0xE4200000) | ||
54 | #define S5PC100_VA_VIC S3C_VA_IRQ | ||
55 | #define S5PC100_VA_VIC_OFFSET 0x10000 | ||
56 | #define S5PC1XX_VA_VIC(x) (S5PC100_VA_VIC + ((x) * S5PC100_VA_VIC_OFFSET)) | ||
57 | 46 | ||
58 | #define S5PC100_PA_SROMC (0xE7000000) | 47 | #define S5PC100_PA_TIMER 0xEA000000 |
59 | #define S5P_PA_SROMC S5PC100_PA_SROMC | 48 | #define S5PC100_PA_SYSTIMER 0xEA100000 |
49 | #define S5PC100_PA_WATCHDOG 0xEA200000 | ||
50 | #define S5PC100_PA_RTC 0xEA300000 | ||
60 | 51 | ||
61 | #define S5PC100_PA_ONENAND (0xE7100000) | 52 | #define S5PC100_PA_UART 0xEC000000 |
62 | 53 | ||
63 | #define S5PC100_PA_CFCON (0xE7800000) | 54 | #define S5PC100_PA_IIC0 0xEC100000 |
55 | #define S5PC100_PA_IIC1 0xEC200000 | ||
64 | 56 | ||
65 | /* DMA */ | 57 | #define S5PC100_PA_SPI0 0xEC300000 |
66 | #define S5PC100_PA_MDMA (0xE8100000) | 58 | #define S5PC100_PA_SPI1 0xEC400000 |
67 | #define S5PC100_PA_PDMA0 (0xE9000000) | 59 | #define S5PC100_PA_SPI2 0xEC500000 |
68 | #define S5PC100_PA_PDMA1 (0xE9200000) | ||
69 | 60 | ||
70 | /* Timer */ | 61 | #define S5PC100_PA_USB_HSOTG 0xED200000 |
71 | #define S5PC100_PA_TIMER (0xEA000000) | 62 | #define S5PC100_PA_USB_HSPHY 0xED300000 |
72 | #define S5P_PA_TIMER S5PC100_PA_TIMER | ||
73 | 63 | ||
74 | #define S5PC100_PA_SYSTIMER (0xEA100000) | 64 | #define S5PC100_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000)) |
75 | 65 | ||
76 | #define S5PC100_PA_WATCHDOG (0xEA200000) | 66 | #define S5PC100_PA_FB 0xEE000000 |
77 | #define S5PC100_PA_RTC (0xEA300000) | ||
78 | 67 | ||
79 | #define S5PC100_PA_UART (0xEC000000) | 68 | #define S5PC100_PA_FIMC0 0xEE200000 |
69 | #define S5PC100_PA_FIMC1 0xEE300000 | ||
70 | #define S5PC100_PA_FIMC2 0xEE400000 | ||
80 | 71 | ||
81 | #define S5P_PA_UART0 (S5PC100_PA_UART + 0x0) | 72 | #define S5PC100_PA_I2S0 0xF2000000 |
82 | #define S5P_PA_UART1 (S5PC100_PA_UART + 0x400) | 73 | #define S5PC100_PA_I2S1 0xF2100000 |
83 | #define S5P_PA_UART2 (S5PC100_PA_UART + 0x800) | 74 | #define S5PC100_PA_I2S2 0xF2200000 |
84 | #define S5P_PA_UART3 (S5PC100_PA_UART + 0xC00) | ||
85 | #define S5P_SZ_UART SZ_256 | ||
86 | 75 | ||
87 | #define S5PC100_PA_IIC0 (0xEC100000) | 76 | #define S5PC100_PA_AC97 0xF2300000 |
88 | #define S5PC100_PA_IIC1 (0xEC200000) | ||
89 | 77 | ||
90 | /* SPI */ | 78 | #define S5PC100_PA_PCM0 0xF2400000 |
91 | #define S5PC100_PA_SPI0 0xEC300000 | 79 | #define S5PC100_PA_PCM1 0xF2500000 |
92 | #define S5PC100_PA_SPI1 0xEC400000 | ||
93 | #define S5PC100_PA_SPI2 0xEC500000 | ||
94 | 80 | ||
95 | /* USB HS OTG */ | 81 | #define S5PC100_PA_SPDIF 0xF2600000 |
96 | #define S5PC100_PA_USB_HSOTG (0xED200000) | ||
97 | #define S5PC100_PA_USB_HSPHY (0xED300000) | ||
98 | 82 | ||
99 | #define S5PC100_PA_FB (0xEE000000) | 83 | #define S5PC100_PA_TSADC 0xF3000000 |
100 | 84 | ||
101 | #define S5PC100_PA_FIMC0 (0xEE200000) | 85 | #define S5PC100_PA_KEYPAD 0xF3100000 |
102 | #define S5PC100_PA_FIMC1 (0xEE300000) | ||
103 | #define S5PC100_PA_FIMC2 (0xEE400000) | ||
104 | 86 | ||
105 | #define S5PC100_PA_I2S0 (0xF2000000) | 87 | /* Compatibiltiy Defines */ |
106 | #define S5PC100_PA_I2S1 (0xF2100000) | ||
107 | #define S5PC100_PA_I2S2 (0xF2200000) | ||
108 | 88 | ||
109 | #define S5PC100_PA_AC97 0xF2300000 | 89 | #define S3C_PA_FB S5PC100_PA_FB |
90 | #define S3C_PA_HSMMC0 S5PC100_PA_HSMMC(0) | ||
91 | #define S3C_PA_HSMMC1 S5PC100_PA_HSMMC(1) | ||
92 | #define S3C_PA_HSMMC2 S5PC100_PA_HSMMC(2) | ||
93 | #define S3C_PA_IIC S5PC100_PA_IIC0 | ||
94 | #define S3C_PA_IIC1 S5PC100_PA_IIC1 | ||
95 | #define S3C_PA_KEYPAD S5PC100_PA_KEYPAD | ||
96 | #define S3C_PA_ONENAND S5PC100_PA_ONENAND | ||
97 | #define S3C_PA_ONENAND_BUF S5PC100_PA_ONENAND_BUF | ||
98 | #define S3C_PA_RTC S5PC100_PA_RTC | ||
99 | #define S3C_PA_TSADC S5PC100_PA_TSADC | ||
100 | #define S3C_PA_USB_HSOTG S5PC100_PA_USB_HSOTG | ||
101 | #define S3C_PA_USB_HSPHY S5PC100_PA_USB_HSPHY | ||
102 | #define S3C_PA_WDT S5PC100_PA_WATCHDOG | ||
110 | 103 | ||
111 | /* PCM */ | 104 | #define S5P_PA_CHIPID S5PC100_PA_CHIPID |
112 | #define S5PC100_PA_PCM0 0xF2400000 | 105 | #define S5P_PA_FIMC0 S5PC100_PA_FIMC0 |
113 | #define S5PC100_PA_PCM1 0xF2500000 | 106 | #define S5P_PA_FIMC1 S5PC100_PA_FIMC1 |
107 | #define S5P_PA_FIMC2 S5PC100_PA_FIMC2 | ||
108 | #define S5P_PA_SDRAM S5PC100_PA_SDRAM | ||
109 | #define S5P_PA_SROMC S5PC100_PA_SROMC | ||
110 | #define S5P_PA_SYSCON S5PC100_PA_SYSCON | ||
111 | #define S5P_PA_TIMER S5PC100_PA_TIMER | ||
114 | 112 | ||
115 | #define S5PC100_PA_SPDIF 0xF2600000 | 113 | #define SAMSUNG_PA_ADC S5PC100_PA_TSADC |
114 | #define SAMSUNG_PA_CFCON S5PC100_PA_CFCON | ||
115 | #define SAMSUNG_PA_KEYPAD S5PC100_PA_KEYPAD | ||
116 | 116 | ||
117 | #define S5PC100_PA_TSADC (0xF3000000) | 117 | #define S5PC100_VA_OTHERS (S3C_VA_SYS + 0x10000) |
118 | 118 | ||
119 | /* KEYPAD */ | 119 | #define S3C_SZ_ONENAND_BUF (SZ_256M - SZ_32M) |
120 | #define S5PC100_PA_KEYPAD (0xF3100000) | ||
121 | 120 | ||
122 | #define S5PC100_PA_HSMMC(x) (0xED800000 + ((x) * 0x100000)) | 121 | /* UART */ |
123 | 122 | ||
124 | #define S5PC100_PA_SDRAM (0x20000000) | 123 | #define S3C_PA_UART S5PC100_PA_UART |
125 | #define S5P_PA_SDRAM S5PC100_PA_SDRAM | ||
126 | 124 | ||
127 | /* compatibiltiy defines. */ | 125 | #define S5P_PA_UART(x) (S3C_PA_UART + ((x) * S3C_UART_OFFSET)) |
128 | #define S3C_PA_UART S5PC100_PA_UART | 126 | #define S5P_PA_UART0 S5P_PA_UART(0) |
129 | #define S3C_PA_IIC S5PC100_PA_IIC0 | 127 | #define S5P_PA_UART1 S5P_PA_UART(1) |
130 | #define S3C_PA_IIC1 S5PC100_PA_IIC1 | 128 | #define S5P_PA_UART2 S5P_PA_UART(2) |
131 | #define S3C_PA_FB S5PC100_PA_FB | 129 | #define S5P_PA_UART3 S5P_PA_UART(3) |
132 | #define S3C_PA_G2D S5PC100_PA_G2D | ||
133 | #define S3C_PA_G3D S5PC100_PA_G3D | ||
134 | #define S3C_PA_JPEG S5PC100_PA_JPEG | ||
135 | #define S3C_PA_ROTATOR S5PC100_PA_ROTATOR | ||
136 | #define S5P_VA_VIC0 S5PC1XX_VA_VIC(0) | ||
137 | #define S5P_VA_VIC1 S5PC1XX_VA_VIC(1) | ||
138 | #define S5P_VA_VIC2 S5PC1XX_VA_VIC(2) | ||
139 | #define S3C_PA_USB_HSOTG S5PC100_PA_USB_HSOTG | ||
140 | #define S3C_PA_USB_HSPHY S5PC100_PA_USB_HSPHY | ||
141 | #define S3C_PA_HSMMC0 S5PC100_PA_HSMMC(0) | ||
142 | #define S3C_PA_HSMMC1 S5PC100_PA_HSMMC(1) | ||
143 | #define S3C_PA_HSMMC2 S5PC100_PA_HSMMC(2) | ||
144 | #define S3C_PA_KEYPAD S5PC100_PA_KEYPAD | ||
145 | #define S3C_PA_WDT S5PC100_PA_WATCHDOG | ||
146 | #define S3C_PA_TSADC S5PC100_PA_TSADC | ||
147 | #define S3C_PA_ONENAND S5PC100_PA_ONENAND | ||
148 | #define S3C_PA_ONENAND_BUF S5PC100_PA_ONENAND_BUF | ||
149 | #define S3C_SZ_ONENAND_BUF S5PC100_SZ_ONENAND_BUF | ||
150 | #define S3C_PA_RTC S5PC100_PA_RTC | ||
151 | |||
152 | #define SAMSUNG_PA_ADC S5PC100_PA_TSADC | ||
153 | #define SAMSUNG_PA_CFCON S5PC100_PA_CFCON | ||
154 | #define SAMSUNG_PA_KEYPAD S5PC100_PA_KEYPAD | ||
155 | 130 | ||
156 | #define S5P_PA_FIMC0 S5PC100_PA_FIMC0 | 131 | #define S5P_SZ_UART SZ_256 |
157 | #define S5P_PA_FIMC1 S5PC100_PA_FIMC1 | ||
158 | #define S5P_PA_FIMC2 S5PC100_PA_FIMC2 | ||
159 | 132 | ||
160 | #endif /* __ASM_ARCH_C100_MAP_H */ | 133 | #endif /* __ASM_ARCH_MAP_H */ |
diff --git a/arch/arm/mach-s5pv210/include/mach/map.h b/arch/arm/mach-s5pv210/include/mach/map.h index 3611492ad681..1dd58836fd4f 100644 --- a/arch/arm/mach-s5pv210/include/mach/map.h +++ b/arch/arm/mach-s5pv210/include/mach/map.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* linux/arch/arm/mach-s5pv210/include/mach/map.h | 1 | /* linux/arch/arm/mach-s5pv210/include/mach/map.h |
2 | * | 2 | * |
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | 3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. |
4 | * http://www.samsung.com/ | 4 | * http://www.samsung.com/ |
5 | * | 5 | * |
6 | * S5PV210 - Memory map definitions | 6 | * S5PV210 - Memory map definitions |
@@ -16,122 +16,120 @@ | |||
16 | #include <plat/map-base.h> | 16 | #include <plat/map-base.h> |
17 | #include <plat/map-s5p.h> | 17 | #include <plat/map-s5p.h> |
18 | 18 | ||
19 | #define S5PV210_PA_SROM_BANK5 (0xA8000000) | 19 | #define S5PV210_PA_SDRAM 0x20000000 |
20 | 20 | ||
21 | #define S5PC110_PA_ONENAND (0xB0000000) | 21 | #define S5PV210_PA_SROM_BANK5 0xA8000000 |
22 | #define S5P_PA_ONENAND S5PC110_PA_ONENAND | ||
23 | 22 | ||
24 | #define S5PC110_PA_ONENAND_DMA (0xB0600000) | 23 | #define S5PC110_PA_ONENAND 0xB0000000 |
25 | #define S5P_PA_ONENAND_DMA S5PC110_PA_ONENAND_DMA | 24 | #define S5PC110_PA_ONENAND_DMA 0xB0600000 |
26 | 25 | ||
27 | #define S5PV210_PA_CHIPID (0xE0000000) | 26 | #define S5PV210_PA_CHIPID 0xE0000000 |
28 | #define S5P_PA_CHIPID S5PV210_PA_CHIPID | ||
29 | 27 | ||
30 | #define S5PV210_PA_SYSCON (0xE0100000) | 28 | #define S5PV210_PA_SYSCON 0xE0100000 |
31 | #define S5P_PA_SYSCON S5PV210_PA_SYSCON | ||
32 | 29 | ||
33 | #define S5PV210_PA_GPIO (0xE0200000) | 30 | #define S5PV210_PA_GPIO 0xE0200000 |
34 | 31 | ||
35 | /* SPI */ | 32 | #define S5PV210_PA_SPDIF 0xE1100000 |
36 | #define S5PV210_PA_SPI0 0xE1300000 | ||
37 | #define S5PV210_PA_SPI1 0xE1400000 | ||
38 | 33 | ||
39 | #define S5PV210_PA_KEYPAD (0xE1600000) | 34 | #define S5PV210_PA_SPI0 0xE1300000 |
35 | #define S5PV210_PA_SPI1 0xE1400000 | ||
40 | 36 | ||
41 | #define S5PV210_PA_IIC0 (0xE1800000) | 37 | #define S5PV210_PA_KEYPAD 0xE1600000 |
42 | #define S5PV210_PA_IIC1 (0xFAB00000) | ||
43 | #define S5PV210_PA_IIC2 (0xE1A00000) | ||
44 | 38 | ||
45 | #define S5PV210_PA_TIMER (0xE2500000) | 39 | #define S5PV210_PA_ADC 0xE1700000 |
46 | #define S5P_PA_TIMER S5PV210_PA_TIMER | ||
47 | 40 | ||
48 | #define S5PV210_PA_SYSTIMER (0xE2600000) | 41 | #define S5PV210_PA_IIC0 0xE1800000 |
42 | #define S5PV210_PA_IIC1 0xFAB00000 | ||
43 | #define S5PV210_PA_IIC2 0xE1A00000 | ||
49 | 44 | ||
50 | #define S5PV210_PA_WATCHDOG (0xE2700000) | 45 | #define S5PV210_PA_AC97 0xE2200000 |
51 | 46 | ||
52 | #define S5PV210_PA_RTC (0xE2800000) | 47 | #define S5PV210_PA_PCM0 0xE2300000 |
53 | #define S5PV210_PA_UART (0xE2900000) | 48 | #define S5PV210_PA_PCM1 0xE1200000 |
49 | #define S5PV210_PA_PCM2 0xE2B00000 | ||
54 | 50 | ||
55 | #define S5P_PA_UART0 (S5PV210_PA_UART + 0x0) | 51 | #define S5PV210_PA_TIMER 0xE2500000 |
56 | #define S5P_PA_UART1 (S5PV210_PA_UART + 0x400) | 52 | #define S5PV210_PA_SYSTIMER 0xE2600000 |
57 | #define S5P_PA_UART2 (S5PV210_PA_UART + 0x800) | 53 | #define S5PV210_PA_WATCHDOG 0xE2700000 |
58 | #define S5P_PA_UART3 (S5PV210_PA_UART + 0xC00) | 54 | #define S5PV210_PA_RTC 0xE2800000 |
59 | 55 | ||
60 | #define S5P_SZ_UART SZ_256 | 56 | #define S5PV210_PA_UART 0xE2900000 |
61 | 57 | ||
62 | #define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET)) | 58 | #define S5PV210_PA_SROMC 0xE8000000 |
63 | 59 | ||
64 | #define S5PV210_PA_SROMC (0xE8000000) | 60 | #define S5PV210_PA_CFCON 0xE8200000 |
65 | #define S5P_PA_SROMC S5PV210_PA_SROMC | ||
66 | 61 | ||
67 | #define S5PV210_PA_CFCON (0xE8200000) | 62 | #define S5PV210_PA_HSMMC(x) (0xEB000000 + ((x) * 0x100000)) |
68 | 63 | ||
69 | #define S5PV210_PA_MDMA 0xFA200000 | 64 | #define S5PV210_PA_HSOTG 0xEC000000 |
70 | #define S5PV210_PA_PDMA0 0xE0900000 | 65 | #define S5PV210_PA_HSPHY 0xEC100000 |
71 | #define S5PV210_PA_PDMA1 0xE0A00000 | ||
72 | 66 | ||
73 | #define S5PV210_PA_FB (0xF8000000) | 67 | #define S5PV210_PA_IIS0 0xEEE30000 |
68 | #define S5PV210_PA_IIS1 0xE2100000 | ||
69 | #define S5PV210_PA_IIS2 0xE2A00000 | ||
74 | 70 | ||
75 | #define S5PV210_PA_FIMC0 (0xFB200000) | 71 | #define S5PV210_PA_DMC0 0xF0000000 |
76 | #define S5PV210_PA_FIMC1 (0xFB300000) | 72 | #define S5PV210_PA_DMC1 0xF1400000 |
77 | #define S5PV210_PA_FIMC2 (0xFB400000) | ||
78 | 73 | ||
79 | #define S5PV210_PA_HSMMC(x) (0xEB000000 + ((x) * 0x100000)) | 74 | #define S5PV210_PA_VIC0 0xF2000000 |
75 | #define S5PV210_PA_VIC1 0xF2100000 | ||
76 | #define S5PV210_PA_VIC2 0xF2200000 | ||
77 | #define S5PV210_PA_VIC3 0xF2300000 | ||
80 | 78 | ||
81 | #define S5PV210_PA_HSOTG (0xEC000000) | 79 | #define S5PV210_PA_FB 0xF8000000 |
82 | #define S5PV210_PA_HSPHY (0xEC100000) | ||
83 | 80 | ||
84 | #define S5PV210_PA_VIC0 (0xF2000000) | 81 | #define S5PV210_PA_MDMA 0xFA200000 |
85 | #define S5PV210_PA_VIC1 (0xF2100000) | 82 | #define S5PV210_PA_PDMA0 0xE0900000 |
86 | #define S5PV210_PA_VIC2 (0xF2200000) | 83 | #define S5PV210_PA_PDMA1 0xE0A00000 |
87 | #define S5PV210_PA_VIC3 (0xF2300000) | ||
88 | 84 | ||
89 | #define S5PV210_PA_SDRAM (0x20000000) | 85 | #define S5PV210_PA_MIPI_CSIS 0xFA600000 |
90 | #define S5P_PA_SDRAM S5PV210_PA_SDRAM | ||
91 | 86 | ||
92 | /* S/PDIF */ | 87 | #define S5PV210_PA_FIMC0 0xFB200000 |
93 | #define S5PV210_PA_SPDIF 0xE1100000 | 88 | #define S5PV210_PA_FIMC1 0xFB300000 |
89 | #define S5PV210_PA_FIMC2 0xFB400000 | ||
94 | 90 | ||
95 | /* I2S */ | 91 | /* Compatibiltiy Defines */ |
96 | #define S5PV210_PA_IIS0 0xEEE30000 | ||
97 | #define S5PV210_PA_IIS1 0xE2100000 | ||
98 | #define S5PV210_PA_IIS2 0xE2A00000 | ||
99 | 92 | ||
100 | /* PCM */ | 93 | #define S3C_PA_FB S5PV210_PA_FB |
101 | #define S5PV210_PA_PCM0 0xE2300000 | 94 | #define S3C_PA_HSMMC0 S5PV210_PA_HSMMC(0) |
102 | #define S5PV210_PA_PCM1 0xE1200000 | 95 | #define S3C_PA_HSMMC1 S5PV210_PA_HSMMC(1) |
103 | #define S5PV210_PA_PCM2 0xE2B00000 | 96 | #define S3C_PA_HSMMC2 S5PV210_PA_HSMMC(2) |
97 | #define S3C_PA_HSMMC3 S5PV210_PA_HSMMC(3) | ||
98 | #define S3C_PA_IIC S5PV210_PA_IIC0 | ||
99 | #define S3C_PA_IIC1 S5PV210_PA_IIC1 | ||
100 | #define S3C_PA_IIC2 S5PV210_PA_IIC2 | ||
101 | #define S3C_PA_RTC S5PV210_PA_RTC | ||
102 | #define S3C_PA_USB_HSOTG S5PV210_PA_HSOTG | ||
103 | #define S3C_PA_WDT S5PV210_PA_WATCHDOG | ||
104 | 104 | ||
105 | /* AC97 */ | 105 | #define S5P_PA_CHIPID S5PV210_PA_CHIPID |
106 | #define S5PV210_PA_AC97 0xE2200000 | 106 | #define S5P_PA_FIMC0 S5PV210_PA_FIMC0 |
107 | #define S5P_PA_FIMC1 S5PV210_PA_FIMC1 | ||
108 | #define S5P_PA_FIMC2 S5PV210_PA_FIMC2 | ||
109 | #define S5P_PA_MIPI_CSIS0 S5PV210_PA_MIPI_CSIS | ||
110 | #define S5P_PA_ONENAND S5PC110_PA_ONENAND | ||
111 | #define S5P_PA_ONENAND_DMA S5PC110_PA_ONENAND_DMA | ||
112 | #define S5P_PA_SDRAM S5PV210_PA_SDRAM | ||
113 | #define S5P_PA_SROMC S5PV210_PA_SROMC | ||
114 | #define S5P_PA_SYSCON S5PV210_PA_SYSCON | ||
115 | #define S5P_PA_TIMER S5PV210_PA_TIMER | ||
107 | 116 | ||
108 | #define S5PV210_PA_ADC (0xE1700000) | 117 | #define SAMSUNG_PA_ADC S5PV210_PA_ADC |
118 | #define SAMSUNG_PA_CFCON S5PV210_PA_CFCON | ||
119 | #define SAMSUNG_PA_KEYPAD S5PV210_PA_KEYPAD | ||
109 | 120 | ||
110 | #define S5PV210_PA_DMC0 (0xF0000000) | 121 | /* UART */ |
111 | #define S5PV210_PA_DMC1 (0xF1400000) | ||
112 | 122 | ||
113 | #define S5PV210_PA_MIPI_CSIS 0xFA600000 | 123 | #define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET)) |
114 | 124 | ||
115 | /* compatibiltiy defines. */ | 125 | #define S3C_PA_UART S5PV210_PA_UART |
116 | #define S3C_PA_UART S5PV210_PA_UART | ||
117 | #define S3C_PA_HSMMC0 S5PV210_PA_HSMMC(0) | ||
118 | #define S3C_PA_HSMMC1 S5PV210_PA_HSMMC(1) | ||
119 | #define S3C_PA_HSMMC2 S5PV210_PA_HSMMC(2) | ||
120 | #define S3C_PA_HSMMC3 S5PV210_PA_HSMMC(3) | ||
121 | #define S3C_PA_IIC S5PV210_PA_IIC0 | ||
122 | #define S3C_PA_IIC1 S5PV210_PA_IIC1 | ||
123 | #define S3C_PA_IIC2 S5PV210_PA_IIC2 | ||
124 | #define S3C_PA_FB S5PV210_PA_FB | ||
125 | #define S3C_PA_RTC S5PV210_PA_RTC | ||
126 | #define S3C_PA_WDT S5PV210_PA_WATCHDOG | ||
127 | #define S3C_PA_USB_HSOTG S5PV210_PA_HSOTG | ||
128 | #define S5P_PA_FIMC0 S5PV210_PA_FIMC0 | ||
129 | #define S5P_PA_FIMC1 S5PV210_PA_FIMC1 | ||
130 | #define S5P_PA_FIMC2 S5PV210_PA_FIMC2 | ||
131 | #define S5P_PA_MIPI_CSIS0 S5PV210_PA_MIPI_CSIS | ||
132 | 126 | ||
133 | #define SAMSUNG_PA_ADC S5PV210_PA_ADC | 127 | #define S5P_PA_UART(x) (S3C_PA_UART + ((x) * S3C_UART_OFFSET)) |
134 | #define SAMSUNG_PA_CFCON S5PV210_PA_CFCON | 128 | #define S5P_PA_UART0 S5P_PA_UART(0) |
135 | #define SAMSUNG_PA_KEYPAD S5PV210_PA_KEYPAD | 129 | #define S5P_PA_UART1 S5P_PA_UART(1) |
130 | #define S5P_PA_UART2 S5P_PA_UART(2) | ||
131 | #define S5P_PA_UART3 S5P_PA_UART(3) | ||
132 | |||
133 | #define S5P_SZ_UART SZ_256 | ||
136 | 134 | ||
137 | #endif /* __ASM_ARCH_MAP_H */ | 135 | #endif /* __ASM_ARCH_MAP_H */ |
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c index 461aa035afc0..557add4fc56c 100644 --- a/arch/arm/mach-s5pv210/mach-aquila.c +++ b/arch/arm/mach-s5pv210/mach-aquila.c | |||
@@ -149,7 +149,7 @@ static struct regulator_init_data aquila_ldo2_data = { | |||
149 | 149 | ||
150 | static struct regulator_init_data aquila_ldo3_data = { | 150 | static struct regulator_init_data aquila_ldo3_data = { |
151 | .constraints = { | 151 | .constraints = { |
152 | .name = "VUSB/MIPI_1.1V", | 152 | .name = "VUSB+MIPI_1.1V", |
153 | .min_uV = 1100000, | 153 | .min_uV = 1100000, |
154 | .max_uV = 1100000, | 154 | .max_uV = 1100000, |
155 | .apply_uV = 1, | 155 | .apply_uV = 1, |
@@ -197,7 +197,7 @@ static struct regulator_init_data aquila_ldo7_data = { | |||
197 | 197 | ||
198 | static struct regulator_init_data aquila_ldo8_data = { | 198 | static struct regulator_init_data aquila_ldo8_data = { |
199 | .constraints = { | 199 | .constraints = { |
200 | .name = "VUSB/VADC_3.3V", | 200 | .name = "VUSB+VADC_3.3V", |
201 | .min_uV = 3300000, | 201 | .min_uV = 3300000, |
202 | .max_uV = 3300000, | 202 | .max_uV = 3300000, |
203 | .apply_uV = 1, | 203 | .apply_uV = 1, |
@@ -207,7 +207,7 @@ static struct regulator_init_data aquila_ldo8_data = { | |||
207 | 207 | ||
208 | static struct regulator_init_data aquila_ldo9_data = { | 208 | static struct regulator_init_data aquila_ldo9_data = { |
209 | .constraints = { | 209 | .constraints = { |
210 | .name = "VCC/VCAM_2.8V", | 210 | .name = "VCC+VCAM_2.8V", |
211 | .min_uV = 2800000, | 211 | .min_uV = 2800000, |
212 | .max_uV = 2800000, | 212 | .max_uV = 2800000, |
213 | .apply_uV = 1, | 213 | .apply_uV = 1, |
@@ -381,9 +381,12 @@ static struct max8998_platform_data aquila_max8998_pdata = { | |||
381 | .buck1_set1 = S5PV210_GPH0(3), | 381 | .buck1_set1 = S5PV210_GPH0(3), |
382 | .buck1_set2 = S5PV210_GPH0(4), | 382 | .buck1_set2 = S5PV210_GPH0(4), |
383 | .buck2_set3 = S5PV210_GPH0(5), | 383 | .buck2_set3 = S5PV210_GPH0(5), |
384 | .buck1_max_voltage1 = 1200000, | 384 | .buck1_voltage1 = 1200000, |
385 | .buck1_max_voltage2 = 1200000, | 385 | .buck1_voltage2 = 1200000, |
386 | .buck2_max_voltage = 1200000, | 386 | .buck1_voltage3 = 1200000, |
387 | .buck1_voltage4 = 1200000, | ||
388 | .buck2_voltage1 = 1200000, | ||
389 | .buck2_voltage2 = 1200000, | ||
387 | }; | 390 | }; |
388 | #endif | 391 | #endif |
389 | 392 | ||
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c index e22d5112fd44..056f5c769b0a 100644 --- a/arch/arm/mach-s5pv210/mach-goni.c +++ b/arch/arm/mach-s5pv210/mach-goni.c | |||
@@ -288,7 +288,7 @@ static struct regulator_init_data goni_ldo2_data = { | |||
288 | 288 | ||
289 | static struct regulator_init_data goni_ldo3_data = { | 289 | static struct regulator_init_data goni_ldo3_data = { |
290 | .constraints = { | 290 | .constraints = { |
291 | .name = "VUSB/MIPI_1.1V", | 291 | .name = "VUSB+MIPI_1.1V", |
292 | .min_uV = 1100000, | 292 | .min_uV = 1100000, |
293 | .max_uV = 1100000, | 293 | .max_uV = 1100000, |
294 | .apply_uV = 1, | 294 | .apply_uV = 1, |
@@ -337,7 +337,7 @@ static struct regulator_init_data goni_ldo7_data = { | |||
337 | 337 | ||
338 | static struct regulator_init_data goni_ldo8_data = { | 338 | static struct regulator_init_data goni_ldo8_data = { |
339 | .constraints = { | 339 | .constraints = { |
340 | .name = "VUSB/VADC_3.3V", | 340 | .name = "VUSB+VADC_3.3V", |
341 | .min_uV = 3300000, | 341 | .min_uV = 3300000, |
342 | .max_uV = 3300000, | 342 | .max_uV = 3300000, |
343 | .apply_uV = 1, | 343 | .apply_uV = 1, |
@@ -347,7 +347,7 @@ static struct regulator_init_data goni_ldo8_data = { | |||
347 | 347 | ||
348 | static struct regulator_init_data goni_ldo9_data = { | 348 | static struct regulator_init_data goni_ldo9_data = { |
349 | .constraints = { | 349 | .constraints = { |
350 | .name = "VCC/VCAM_2.8V", | 350 | .name = "VCC+VCAM_2.8V", |
351 | .min_uV = 2800000, | 351 | .min_uV = 2800000, |
352 | .max_uV = 2800000, | 352 | .max_uV = 2800000, |
353 | .apply_uV = 1, | 353 | .apply_uV = 1, |
@@ -521,9 +521,12 @@ static struct max8998_platform_data goni_max8998_pdata = { | |||
521 | .buck1_set1 = S5PV210_GPH0(3), | 521 | .buck1_set1 = S5PV210_GPH0(3), |
522 | .buck1_set2 = S5PV210_GPH0(4), | 522 | .buck1_set2 = S5PV210_GPH0(4), |
523 | .buck2_set3 = S5PV210_GPH0(5), | 523 | .buck2_set3 = S5PV210_GPH0(5), |
524 | .buck1_max_voltage1 = 1200000, | 524 | .buck1_voltage1 = 1200000, |
525 | .buck1_max_voltage2 = 1200000, | 525 | .buck1_voltage2 = 1200000, |
526 | .buck2_max_voltage = 1200000, | 526 | .buck1_voltage3 = 1200000, |
527 | .buck1_voltage4 = 1200000, | ||
528 | .buck2_voltage1 = 1200000, | ||
529 | .buck2_voltage2 = 1200000, | ||
527 | }; | 530 | }; |
528 | #endif | 531 | #endif |
529 | 532 | ||
diff --git a/arch/arm/mach-s5pv310/include/mach/map.h b/arch/arm/mach-s5pv310/include/mach/map.h index 3060f78e12ab..901657fa7a12 100644 --- a/arch/arm/mach-s5pv310/include/mach/map.h +++ b/arch/arm/mach-s5pv310/include/mach/map.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* linux/arch/arm/mach-s5pv310/include/mach/map.h | 1 | /* linux/arch/arm/mach-s5pv310/include/mach/map.h |
2 | * | 2 | * |
3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. | 3 | * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. |
4 | * http://www.samsung.com/ | 4 | * http://www.samsung.com/ |
5 | * | 5 | * |
6 | * S5PV310 - Memory map definitions | 6 | * S5PV310 - Memory map definitions |
@@ -23,90 +23,43 @@ | |||
23 | 23 | ||
24 | #include <plat/map-s5p.h> | 24 | #include <plat/map-s5p.h> |
25 | 25 | ||
26 | #define S5PV310_PA_SYSRAM (0x02025000) | 26 | #define S5PV310_PA_SYSRAM 0x02025000 |
27 | 27 | ||
28 | #define S5PV310_PA_SROM_BANK(x) (0x04000000 + ((x) * 0x01000000)) | 28 | #define S5PV310_PA_I2S0 0x03830000 |
29 | 29 | #define S5PV310_PA_I2S1 0xE3100000 | |
30 | #define S5PC210_PA_ONENAND (0x0C000000) | 30 | #define S5PV310_PA_I2S2 0xE2A00000 |
31 | #define S5P_PA_ONENAND S5PC210_PA_ONENAND | ||
32 | |||
33 | #define S5PC210_PA_ONENAND_DMA (0x0C600000) | ||
34 | #define S5P_PA_ONENAND_DMA S5PC210_PA_ONENAND_DMA | ||
35 | |||
36 | #define S5PV310_PA_CHIPID (0x10000000) | ||
37 | #define S5P_PA_CHIPID S5PV310_PA_CHIPID | ||
38 | |||
39 | #define S5PV310_PA_SYSCON (0x10010000) | ||
40 | #define S5P_PA_SYSCON S5PV310_PA_SYSCON | ||
41 | 31 | ||
42 | #define S5PV310_PA_PMU (0x10020000) | 32 | #define S5PV310_PA_PCM0 0x03840000 |
33 | #define S5PV310_PA_PCM1 0x13980000 | ||
34 | #define S5PV310_PA_PCM2 0x13990000 | ||
43 | 35 | ||
44 | #define S5PV310_PA_CMU (0x10030000) | 36 | #define S5PV310_PA_SROM_BANK(x) (0x04000000 + ((x) * 0x01000000)) |
45 | |||
46 | #define S5PV310_PA_WATCHDOG (0x10060000) | ||
47 | #define S5PV310_PA_RTC (0x10070000) | ||
48 | |||
49 | #define S5PV310_PA_DMC0 (0x10400000) | ||
50 | |||
51 | #define S5PV310_PA_COMBINER (0x10448000) | ||
52 | |||
53 | #define S5PV310_PA_COREPERI (0x10500000) | ||
54 | #define S5PV310_PA_GIC_CPU (0x10500100) | ||
55 | #define S5PV310_PA_TWD (0x10500600) | ||
56 | #define S5PV310_PA_GIC_DIST (0x10501000) | ||
57 | #define S5PV310_PA_L2CC (0x10502000) | ||
58 | |||
59 | /* DMA */ | ||
60 | #define S5PV310_PA_MDMA 0x10810000 | ||
61 | #define S5PV310_PA_PDMA0 0x12680000 | ||
62 | #define S5PV310_PA_PDMA1 0x12690000 | ||
63 | |||
64 | #define S5PV310_PA_GPIO1 (0x11400000) | ||
65 | #define S5PV310_PA_GPIO2 (0x11000000) | ||
66 | #define S5PV310_PA_GPIO3 (0x03860000) | ||
67 | |||
68 | #define S5PV310_PA_MIPI_CSIS0 0x11880000 | ||
69 | #define S5PV310_PA_MIPI_CSIS1 0x11890000 | ||
70 | 37 | ||
71 | #define S5PV310_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000)) | 38 | #define S5PC210_PA_ONENAND 0x0C000000 |
39 | #define S5PC210_PA_ONENAND_DMA 0x0C600000 | ||
72 | 40 | ||
73 | #define S5PV310_PA_SROMC (0x12570000) | 41 | #define S5PV310_PA_CHIPID 0x10000000 |
74 | #define S5P_PA_SROMC S5PV310_PA_SROMC | ||
75 | 42 | ||
76 | /* S/PDIF */ | 43 | #define S5PV310_PA_SYSCON 0x10010000 |
77 | #define S5PV310_PA_SPDIF 0xE1100000 | 44 | #define S5PV310_PA_PMU 0x10020000 |
45 | #define S5PV310_PA_CMU 0x10030000 | ||
78 | 46 | ||
79 | /* I2S */ | 47 | #define S5PV310_PA_WATCHDOG 0x10060000 |
80 | #define S5PV310_PA_I2S0 0x03830000 | 48 | #define S5PV310_PA_RTC 0x10070000 |
81 | #define S5PV310_PA_I2S1 0xE3100000 | ||
82 | #define S5PV310_PA_I2S2 0xE2A00000 | ||
83 | 49 | ||
84 | /* PCM */ | 50 | #define S5PV310_PA_DMC0 0x10400000 |
85 | #define S5PV310_PA_PCM0 0x03840000 | ||
86 | #define S5PV310_PA_PCM1 0x13980000 | ||
87 | #define S5PV310_PA_PCM2 0x13990000 | ||
88 | 51 | ||
89 | /* AC97 */ | 52 | #define S5PV310_PA_COMBINER 0x10448000 |
90 | #define S5PV310_PA_AC97 0x139A0000 | ||
91 | 53 | ||
92 | #define S5PV310_PA_UART (0x13800000) | 54 | #define S5PV310_PA_COREPERI 0x10500000 |
55 | #define S5PV310_PA_GIC_CPU 0x10500100 | ||
56 | #define S5PV310_PA_TWD 0x10500600 | ||
57 | #define S5PV310_PA_GIC_DIST 0x10501000 | ||
58 | #define S5PV310_PA_L2CC 0x10502000 | ||
93 | 59 | ||
94 | #define S5P_PA_UART(x) (S5PV310_PA_UART + ((x) * S3C_UART_OFFSET)) | 60 | #define S5PV310_PA_MDMA 0x10810000 |
95 | #define S5P_PA_UART0 S5P_PA_UART(0) | 61 | #define S5PV310_PA_PDMA0 0x12680000 |
96 | #define S5P_PA_UART1 S5P_PA_UART(1) | 62 | #define S5PV310_PA_PDMA1 0x12690000 |
97 | #define S5P_PA_UART2 S5P_PA_UART(2) | ||
98 | #define S5P_PA_UART3 S5P_PA_UART(3) | ||
99 | #define S5P_PA_UART4 S5P_PA_UART(4) | ||
100 | |||
101 | #define S5P_SZ_UART SZ_256 | ||
102 | |||
103 | #define S5PV310_PA_IIC(x) (0x13860000 + ((x) * 0x10000)) | ||
104 | |||
105 | #define S5PV310_PA_TIMER (0x139D0000) | ||
106 | #define S5P_PA_TIMER S5PV310_PA_TIMER | ||
107 | |||
108 | #define S5PV310_PA_SDRAM (0x40000000) | ||
109 | #define S5P_PA_SDRAM S5PV310_PA_SDRAM | ||
110 | 63 | ||
111 | #define S5PV310_PA_SYSMMU_MDMA 0x10A40000 | 64 | #define S5PV310_PA_SYSMMU_MDMA 0x10A40000 |
112 | #define S5PV310_PA_SYSMMU_SSS 0x10A50000 | 65 | #define S5PV310_PA_SYSMMU_SSS 0x10A50000 |
@@ -125,8 +78,31 @@ | |||
125 | #define S5PV310_PA_SYSMMU_MFC_L 0x13620000 | 78 | #define S5PV310_PA_SYSMMU_MFC_L 0x13620000 |
126 | #define S5PV310_PA_SYSMMU_MFC_R 0x13630000 | 79 | #define S5PV310_PA_SYSMMU_MFC_R 0x13630000 |
127 | 80 | ||
128 | /* compatibiltiy defines. */ | 81 | #define S5PV310_PA_GPIO1 0x11400000 |
129 | #define S3C_PA_UART S5PV310_PA_UART | 82 | #define S5PV310_PA_GPIO2 0x11000000 |
83 | #define S5PV310_PA_GPIO3 0x03860000 | ||
84 | |||
85 | #define S5PV310_PA_MIPI_CSIS0 0x11880000 | ||
86 | #define S5PV310_PA_MIPI_CSIS1 0x11890000 | ||
87 | |||
88 | #define S5PV310_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000)) | ||
89 | |||
90 | #define S5PV310_PA_SROMC 0x12570000 | ||
91 | |||
92 | #define S5PV310_PA_UART 0x13800000 | ||
93 | |||
94 | #define S5PV310_PA_IIC(x) (0x13860000 + ((x) * 0x10000)) | ||
95 | |||
96 | #define S5PV310_PA_AC97 0x139A0000 | ||
97 | |||
98 | #define S5PV310_PA_TIMER 0x139D0000 | ||
99 | |||
100 | #define S5PV310_PA_SDRAM 0x40000000 | ||
101 | |||
102 | #define S5PV310_PA_SPDIF 0xE1100000 | ||
103 | |||
104 | /* Compatibiltiy Defines */ | ||
105 | |||
130 | #define S3C_PA_HSMMC0 S5PV310_PA_HSMMC(0) | 106 | #define S3C_PA_HSMMC0 S5PV310_PA_HSMMC(0) |
131 | #define S3C_PA_HSMMC1 S5PV310_PA_HSMMC(1) | 107 | #define S3C_PA_HSMMC1 S5PV310_PA_HSMMC(1) |
132 | #define S3C_PA_HSMMC2 S5PV310_PA_HSMMC(2) | 108 | #define S3C_PA_HSMMC2 S5PV310_PA_HSMMC(2) |
@@ -141,7 +117,28 @@ | |||
141 | #define S3C_PA_IIC7 S5PV310_PA_IIC(7) | 117 | #define S3C_PA_IIC7 S5PV310_PA_IIC(7) |
142 | #define S3C_PA_RTC S5PV310_PA_RTC | 118 | #define S3C_PA_RTC S5PV310_PA_RTC |
143 | #define S3C_PA_WDT S5PV310_PA_WATCHDOG | 119 | #define S3C_PA_WDT S5PV310_PA_WATCHDOG |
120 | |||
121 | #define S5P_PA_CHIPID S5PV310_PA_CHIPID | ||
144 | #define S5P_PA_MIPI_CSIS0 S5PV310_PA_MIPI_CSIS0 | 122 | #define S5P_PA_MIPI_CSIS0 S5PV310_PA_MIPI_CSIS0 |
145 | #define S5P_PA_MIPI_CSIS1 S5PV310_PA_MIPI_CSIS1 | 123 | #define S5P_PA_MIPI_CSIS1 S5PV310_PA_MIPI_CSIS1 |
124 | #define S5P_PA_ONENAND S5PC210_PA_ONENAND | ||
125 | #define S5P_PA_ONENAND_DMA S5PC210_PA_ONENAND_DMA | ||
126 | #define S5P_PA_SDRAM S5PV310_PA_SDRAM | ||
127 | #define S5P_PA_SROMC S5PV310_PA_SROMC | ||
128 | #define S5P_PA_SYSCON S5PV310_PA_SYSCON | ||
129 | #define S5P_PA_TIMER S5PV310_PA_TIMER | ||
130 | |||
131 | /* UART */ | ||
132 | |||
133 | #define S3C_PA_UART S5PV310_PA_UART | ||
134 | |||
135 | #define S5P_PA_UART(x) (S3C_PA_UART + ((x) * S3C_UART_OFFSET)) | ||
136 | #define S5P_PA_UART0 S5P_PA_UART(0) | ||
137 | #define S5P_PA_UART1 S5P_PA_UART(1) | ||
138 | #define S5P_PA_UART2 S5P_PA_UART(2) | ||
139 | #define S5P_PA_UART3 S5P_PA_UART(3) | ||
140 | #define S5P_PA_UART4 S5P_PA_UART(4) | ||
141 | |||
142 | #define S5P_SZ_UART SZ_256 | ||
146 | 143 | ||
147 | #endif /* __ASM_ARCH_MAP_H */ | 144 | #endif /* __ASM_ARCH_MAP_H */ |
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c index 2123b96b5638..4303a86e6e38 100644 --- a/arch/arm/mach-shmobile/board-ag5evm.c +++ b/arch/arm/mach-shmobile/board-ag5evm.c | |||
@@ -454,6 +454,7 @@ static void __init ag5evm_init(void) | |||
454 | gpio_direction_output(GPIO_PORT217, 0); | 454 | gpio_direction_output(GPIO_PORT217, 0); |
455 | mdelay(1); | 455 | mdelay(1); |
456 | gpio_set_value(GPIO_PORT217, 1); | 456 | gpio_set_value(GPIO_PORT217, 1); |
457 | mdelay(100); | ||
457 | 458 | ||
458 | /* LCD backlight controller */ | 459 | /* LCD backlight controller */ |
459 | gpio_request(GPIO_PORT235, NULL); /* RESET */ | 460 | gpio_request(GPIO_PORT235, NULL); /* RESET */ |
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 3cf0951caa2d..81d6536552a9 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c | |||
@@ -1303,7 +1303,7 @@ static void __init ap4evb_init(void) | |||
1303 | 1303 | ||
1304 | lcdc_info.clock_source = LCDC_CLK_BUS; | 1304 | lcdc_info.clock_source = LCDC_CLK_BUS; |
1305 | lcdc_info.ch[0].interface_type = RGB18; | 1305 | lcdc_info.ch[0].interface_type = RGB18; |
1306 | lcdc_info.ch[0].clock_divider = 2; | 1306 | lcdc_info.ch[0].clock_divider = 3; |
1307 | lcdc_info.ch[0].flags = 0; | 1307 | lcdc_info.ch[0].flags = 0; |
1308 | lcdc_info.ch[0].lcd_size_cfg.width = 152; | 1308 | lcdc_info.ch[0].lcd_size_cfg.width = 152; |
1309 | lcdc_info.ch[0].lcd_size_cfg.height = 91; | 1309 | lcdc_info.ch[0].lcd_size_cfg.height = 91; |
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index fb4213a4e15a..1657eac5dde2 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
@@ -303,7 +303,7 @@ static struct sh_mobile_lcdc_info lcdc_info = { | |||
303 | .lcd_cfg = mackerel_lcdc_modes, | 303 | .lcd_cfg = mackerel_lcdc_modes, |
304 | .num_cfg = ARRAY_SIZE(mackerel_lcdc_modes), | 304 | .num_cfg = ARRAY_SIZE(mackerel_lcdc_modes), |
305 | .interface_type = RGB24, | 305 | .interface_type = RGB24, |
306 | .clock_divider = 2, | 306 | .clock_divider = 3, |
307 | .flags = 0, | 307 | .flags = 0, |
308 | .lcd_size_cfg.width = 152, | 308 | .lcd_size_cfg.width = 152, |
309 | .lcd_size_cfg.height = 91, | 309 | .lcd_size_cfg.height = 91, |
diff --git a/arch/arm/mach-shmobile/clock-sh73a0.c b/arch/arm/mach-shmobile/clock-sh73a0.c index ddd4a1b775f0..7e58904c1c8c 100644 --- a/arch/arm/mach-shmobile/clock-sh73a0.c +++ b/arch/arm/mach-shmobile/clock-sh73a0.c | |||
@@ -263,7 +263,7 @@ static struct clk div6_clks[DIV6_NR] = { | |||
263 | }; | 263 | }; |
264 | 264 | ||
265 | enum { MSTP001, | 265 | enum { MSTP001, |
266 | MSTP125, MSTP118, MSTP116, MSTP100, | 266 | MSTP129, MSTP128, MSTP127, MSTP126, MSTP125, MSTP118, MSTP116, MSTP100, |
267 | MSTP219, | 267 | MSTP219, |
268 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, | 268 | MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP201, MSTP200, |
269 | MSTP331, MSTP329, MSTP325, MSTP323, MSTP312, | 269 | MSTP331, MSTP329, MSTP325, MSTP323, MSTP312, |
@@ -275,6 +275,10 @@ enum { MSTP001, | |||
275 | 275 | ||
276 | static struct clk mstp_clks[MSTP_NR] = { | 276 | static struct clk mstp_clks[MSTP_NR] = { |
277 | [MSTP001] = MSTP(&div4_clks[DIV4_HP], SMSTPCR0, 1, 0), /* IIC2 */ | 277 | [MSTP001] = MSTP(&div4_clks[DIV4_HP], SMSTPCR0, 1, 0), /* IIC2 */ |
278 | [MSTP129] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 29, 0), /* CEU1 */ | ||
279 | [MSTP128] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 28, 0), /* CSI2-RX1 */ | ||
280 | [MSTP127] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 27, 0), /* CEU0 */ | ||
281 | [MSTP126] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 26, 0), /* CSI2-RX0 */ | ||
278 | [MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */ | 282 | [MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */ |
279 | [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX0 */ | 283 | [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX0 */ |
280 | [MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */ | 284 | [MSTP116] = MSTP(&div4_clks[DIV4_HP], SMSTPCR1, 16, 0), /* IIC0 */ |
@@ -306,6 +310,9 @@ static struct clk_lookup lookups[] = { | |||
306 | CLKDEV_CON_ID("r_clk", &r_clk), | 310 | CLKDEV_CON_ID("r_clk", &r_clk), |
307 | 311 | ||
308 | /* DIV6 clocks */ | 312 | /* DIV6 clocks */ |
313 | CLKDEV_CON_ID("vck1_clk", &div6_clks[DIV6_VCK1]), | ||
314 | CLKDEV_CON_ID("vck2_clk", &div6_clks[DIV6_VCK2]), | ||
315 | CLKDEV_CON_ID("vck3_clk", &div6_clks[DIV6_VCK3]), | ||
309 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), | 316 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]), |
310 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), | 317 | CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]), |
311 | CLKDEV_ICK_ID("dsi0p_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), | 318 | CLKDEV_ICK_ID("dsi0p_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]), |
@@ -313,11 +320,15 @@ static struct clk_lookup lookups[] = { | |||
313 | 320 | ||
314 | /* MSTP32 clocks */ | 321 | /* MSTP32 clocks */ |
315 | CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */ | 322 | CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */ |
316 | CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ | 323 | CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP129]), /* CEU1 */ |
324 | CLKDEV_DEV_ID("sh-mobile-csi2.1", &mstp_clks[MSTP128]), /* CSI2-RX1 */ | ||
325 | CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]), /* CEU0 */ | ||
326 | CLKDEV_DEV_ID("sh-mobile-csi2.0", &mstp_clks[MSTP126]), /* CSI2-RX0 */ | ||
317 | CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]), /* TMU00 */ | 327 | CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]), /* TMU00 */ |
318 | CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), /* TMU01 */ | 328 | CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), /* TMU01 */ |
319 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */ | ||
320 | CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */ | 329 | CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */ |
330 | CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */ | ||
331 | CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */ | ||
321 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */ | 332 | CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */ |
322 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ | 333 | CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP207]), /* SCIFA5 */ |
323 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ | 334 | CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP206]), /* SCIFB */ |
diff --git a/arch/arm/mach-shmobile/include/mach/head-ap4evb.txt b/arch/arm/mach-shmobile/include/mach/head-ap4evb.txt index efd3687ba190..3029aba38688 100644 --- a/arch/arm/mach-shmobile/include/mach/head-ap4evb.txt +++ b/arch/arm/mach-shmobile/include/mach/head-ap4evb.txt | |||
@@ -6,13 +6,10 @@ LIST "RWT Setting" | |||
6 | EW 0xE6020004, 0xA500 | 6 | EW 0xE6020004, 0xA500 |
7 | EW 0xE6030004, 0xA500 | 7 | EW 0xE6030004, 0xA500 |
8 | 8 | ||
9 | DD 0x01001000, 0x01001000 | ||
10 | |||
11 | LIST "GPIO Setting" | 9 | LIST "GPIO Setting" |
12 | EB 0xE6051013, 0xA2 | 10 | EB 0xE6051013, 0xA2 |
13 | 11 | ||
14 | LIST "CPG" | 12 | LIST "CPG" |
15 | ED 0xE6150080, 0x00000180 | ||
16 | ED 0xE61500C0, 0x00000002 | 13 | ED 0xE61500C0, 0x00000002 |
17 | 14 | ||
18 | WAIT 1, 0xFE40009C | 15 | WAIT 1, 0xFE40009C |
@@ -37,6 +34,9 @@ ED 0xE615002C, 0x93000040 | |||
37 | 34 | ||
38 | WAIT 1, 0xFE40009C | 35 | WAIT 1, 0xFE40009C |
39 | 36 | ||
37 | LIST "SUB/USBClk" | ||
38 | ED 0xE6150080, 0x00000180 | ||
39 | |||
40 | LIST "BSC" | 40 | LIST "BSC" |
41 | ED 0xFEC10000, 0x00E0001B | 41 | ED 0xFEC10000, 0x00E0001B |
42 | 42 | ||
@@ -53,7 +53,7 @@ ED 0xFE400048, 0x20C18505 | |||
53 | ED 0xFE40004C, 0x00110209 | 53 | ED 0xFE40004C, 0x00110209 |
54 | ED 0xFE400010, 0x00000087 | 54 | ED 0xFE400010, 0x00000087 |
55 | 55 | ||
56 | WAIT 10, 0xFE40009C | 56 | WAIT 30, 0xFE40009C |
57 | 57 | ||
58 | ED 0xFE400084, 0x0000003F | 58 | ED 0xFE400084, 0x0000003F |
59 | EB 0xFE500000, 0x00 | 59 | EB 0xFE500000, 0x00 |
@@ -84,7 +84,7 @@ ED 0xE6150004, 0x80331050 | |||
84 | 84 | ||
85 | WAIT 1, 0xFE40009C | 85 | WAIT 1, 0xFE40009C |
86 | 86 | ||
87 | ED 0xE6150354, 0x00000002 | 87 | ED 0xFE400354, 0x01AD8002 |
88 | 88 | ||
89 | LIST "SCIF0 - Serial port for earlyprintk" | 89 | LIST "SCIF0 - Serial port for earlyprintk" |
90 | EB 0xE6053098, 0x11 | 90 | EB 0xE6053098, 0x11 |
diff --git a/arch/arm/mach-shmobile/include/mach/head-mackerel.txt b/arch/arm/mach-shmobile/include/mach/head-mackerel.txt index efd3687ba190..3029aba38688 100644 --- a/arch/arm/mach-shmobile/include/mach/head-mackerel.txt +++ b/arch/arm/mach-shmobile/include/mach/head-mackerel.txt | |||
@@ -6,13 +6,10 @@ LIST "RWT Setting" | |||
6 | EW 0xE6020004, 0xA500 | 6 | EW 0xE6020004, 0xA500 |
7 | EW 0xE6030004, 0xA500 | 7 | EW 0xE6030004, 0xA500 |
8 | 8 | ||
9 | DD 0x01001000, 0x01001000 | ||
10 | |||
11 | LIST "GPIO Setting" | 9 | LIST "GPIO Setting" |
12 | EB 0xE6051013, 0xA2 | 10 | EB 0xE6051013, 0xA2 |
13 | 11 | ||
14 | LIST "CPG" | 12 | LIST "CPG" |
15 | ED 0xE6150080, 0x00000180 | ||
16 | ED 0xE61500C0, 0x00000002 | 13 | ED 0xE61500C0, 0x00000002 |
17 | 14 | ||
18 | WAIT 1, 0xFE40009C | 15 | WAIT 1, 0xFE40009C |
@@ -37,6 +34,9 @@ ED 0xE615002C, 0x93000040 | |||
37 | 34 | ||
38 | WAIT 1, 0xFE40009C | 35 | WAIT 1, 0xFE40009C |
39 | 36 | ||
37 | LIST "SUB/USBClk" | ||
38 | ED 0xE6150080, 0x00000180 | ||
39 | |||
40 | LIST "BSC" | 40 | LIST "BSC" |
41 | ED 0xFEC10000, 0x00E0001B | 41 | ED 0xFEC10000, 0x00E0001B |
42 | 42 | ||
@@ -53,7 +53,7 @@ ED 0xFE400048, 0x20C18505 | |||
53 | ED 0xFE40004C, 0x00110209 | 53 | ED 0xFE40004C, 0x00110209 |
54 | ED 0xFE400010, 0x00000087 | 54 | ED 0xFE400010, 0x00000087 |
55 | 55 | ||
56 | WAIT 10, 0xFE40009C | 56 | WAIT 30, 0xFE40009C |
57 | 57 | ||
58 | ED 0xFE400084, 0x0000003F | 58 | ED 0xFE400084, 0x0000003F |
59 | EB 0xFE500000, 0x00 | 59 | EB 0xFE500000, 0x00 |
@@ -84,7 +84,7 @@ ED 0xE6150004, 0x80331050 | |||
84 | 84 | ||
85 | WAIT 1, 0xFE40009C | 85 | WAIT 1, 0xFE40009C |
86 | 86 | ||
87 | ED 0xE6150354, 0x00000002 | 87 | ED 0xFE400354, 0x01AD8002 |
88 | 88 | ||
89 | LIST "SCIF0 - Serial port for earlyprintk" | 89 | LIST "SCIF0 - Serial port for earlyprintk" |
90 | EB 0xE6053098, 0x11 | 90 | EB 0xE6053098, 0x11 |
diff --git a/arch/arm/mach-spear3xx/include/mach/spear320.h b/arch/arm/mach-spear3xx/include/mach/spear320.h index cacf17a958cd..53677e464d4b 100644 --- a/arch/arm/mach-spear3xx/include/mach/spear320.h +++ b/arch/arm/mach-spear3xx/include/mach/spear320.h | |||
@@ -62,7 +62,7 @@ | |||
62 | #define SPEAR320_SMII1_BASE 0xAB000000 | 62 | #define SPEAR320_SMII1_BASE 0xAB000000 |
63 | #define SPEAR320_SMII1_SIZE 0x01000000 | 63 | #define SPEAR320_SMII1_SIZE 0x01000000 |
64 | 64 | ||
65 | #define SPEAR320_SOC_CONFIG_BASE 0xB4000000 | 65 | #define SPEAR320_SOC_CONFIG_BASE 0xB3000000 |
66 | #define SPEAR320_SOC_CONFIG_SIZE 0x00000070 | 66 | #define SPEAR320_SOC_CONFIG_SIZE 0x00000070 |
67 | /* Interrupt registers offsets and masks */ | 67 | /* Interrupt registers offsets and masks */ |
68 | #define INT_STS_MASK_REG 0x04 | 68 | #define INT_STS_MASK_REG 0x04 |
diff --git a/arch/arm/mach-tegra/include/mach/kbc.h b/arch/arm/mach-tegra/include/mach/kbc.h index 66ad2760c621..04c779832c78 100644 --- a/arch/arm/mach-tegra/include/mach/kbc.h +++ b/arch/arm/mach-tegra/include/mach/kbc.h | |||
@@ -57,5 +57,6 @@ struct tegra_kbc_platform_data { | |||
57 | const struct matrix_keymap_data *keymap_data; | 57 | const struct matrix_keymap_data *keymap_data; |
58 | 58 | ||
59 | bool wakeup; | 59 | bool wakeup; |
60 | bool use_fn_map; | ||
60 | }; | 61 | }; |
61 | #endif | 62 | #endif |
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index 170c9bb95866..f2ce38e085d2 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c | |||
@@ -49,7 +49,13 @@ static inline void cache_wait(void __iomem *reg, unsigned long mask) | |||
49 | static inline void cache_sync(void) | 49 | static inline void cache_sync(void) |
50 | { | 50 | { |
51 | void __iomem *base = l2x0_base; | 51 | void __iomem *base = l2x0_base; |
52 | |||
53 | #ifdef CONFIG_ARM_ERRATA_753970 | ||
54 | /* write to an unmmapped register */ | ||
55 | writel_relaxed(0, base + L2X0_DUMMY_REG); | ||
56 | #else | ||
52 | writel_relaxed(0, base + L2X0_CACHE_SYNC); | 57 | writel_relaxed(0, base + L2X0_CACHE_SYNC); |
58 | #endif | ||
53 | cache_wait(base + L2X0_CACHE_SYNC, 1); | 59 | cache_wait(base + L2X0_CACHE_SYNC, 1); |
54 | } | 60 | } |
55 | 61 | ||
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index 0c1172b56b4e..8e3356239136 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S | |||
@@ -264,6 +264,12 @@ __v7_setup: | |||
264 | orreq r10, r10, #1 << 6 @ set bit #6 | 264 | orreq r10, r10, #1 << 6 @ set bit #6 |
265 | mcreq p15, 0, r10, c15, c0, 1 @ write diagnostic register | 265 | mcreq p15, 0, r10, c15, c0, 1 @ write diagnostic register |
266 | #endif | 266 | #endif |
267 | #ifdef CONFIG_ARM_ERRATA_751472 | ||
268 | cmp r6, #0x30 @ present prior to r3p0 | ||
269 | mrclt p15, 0, r10, c15, c0, 1 @ read diagnostic register | ||
270 | orrlt r10, r10, #1 << 11 @ set bit #11 | ||
271 | mcrlt p15, 0, r10, c15, c0, 1 @ write diagnostic register | ||
272 | #endif | ||
267 | 273 | ||
268 | 3: mov r10, #0 | 274 | 3: mov r10, #0 |
269 | #ifdef HARVARD_CACHE | 275 | #ifdef HARVARD_CACHE |
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index 459b319a9fad..49d3208793e5 100644 --- a/arch/arm/plat-omap/mailbox.c +++ b/arch/arm/plat-omap/mailbox.c | |||
@@ -322,15 +322,18 @@ static void omap_mbox_fini(struct omap_mbox *mbox) | |||
322 | 322 | ||
323 | struct omap_mbox *omap_mbox_get(const char *name, struct notifier_block *nb) | 323 | struct omap_mbox *omap_mbox_get(const char *name, struct notifier_block *nb) |
324 | { | 324 | { |
325 | struct omap_mbox *mbox; | 325 | struct omap_mbox *_mbox, *mbox = NULL; |
326 | int ret; | 326 | int i, ret; |
327 | 327 | ||
328 | if (!mboxes) | 328 | if (!mboxes) |
329 | return ERR_PTR(-EINVAL); | 329 | return ERR_PTR(-EINVAL); |
330 | 330 | ||
331 | for (mbox = *mboxes; mbox; mbox++) | 331 | for (i = 0; (_mbox = mboxes[i]); i++) { |
332 | if (!strcmp(mbox->name, name)) | 332 | if (!strcmp(_mbox->name, name)) { |
333 | mbox = _mbox; | ||
333 | break; | 334 | break; |
335 | } | ||
336 | } | ||
334 | 337 | ||
335 | if (!mbox) | 338 | if (!mbox) |
336 | return ERR_PTR(-ENOENT); | 339 | return ERR_PTR(-ENOENT); |
diff --git a/arch/arm/plat-s5p/dev-uart.c b/arch/arm/plat-s5p/dev-uart.c index 6a7342886171..afaf87fdb93e 100644 --- a/arch/arm/plat-s5p/dev-uart.c +++ b/arch/arm/plat-s5p/dev-uart.c | |||
@@ -28,7 +28,7 @@ | |||
28 | static struct resource s5p_uart0_resource[] = { | 28 | static struct resource s5p_uart0_resource[] = { |
29 | [0] = { | 29 | [0] = { |
30 | .start = S5P_PA_UART0, | 30 | .start = S5P_PA_UART0, |
31 | .end = S5P_PA_UART0 + S5P_SZ_UART, | 31 | .end = S5P_PA_UART0 + S5P_SZ_UART - 1, |
32 | .flags = IORESOURCE_MEM, | 32 | .flags = IORESOURCE_MEM, |
33 | }, | 33 | }, |
34 | [1] = { | 34 | [1] = { |
@@ -51,7 +51,7 @@ static struct resource s5p_uart0_resource[] = { | |||
51 | static struct resource s5p_uart1_resource[] = { | 51 | static struct resource s5p_uart1_resource[] = { |
52 | [0] = { | 52 | [0] = { |
53 | .start = S5P_PA_UART1, | 53 | .start = S5P_PA_UART1, |
54 | .end = S5P_PA_UART1 + S5P_SZ_UART, | 54 | .end = S5P_PA_UART1 + S5P_SZ_UART - 1, |
55 | .flags = IORESOURCE_MEM, | 55 | .flags = IORESOURCE_MEM, |
56 | }, | 56 | }, |
57 | [1] = { | 57 | [1] = { |
@@ -74,7 +74,7 @@ static struct resource s5p_uart1_resource[] = { | |||
74 | static struct resource s5p_uart2_resource[] = { | 74 | static struct resource s5p_uart2_resource[] = { |
75 | [0] = { | 75 | [0] = { |
76 | .start = S5P_PA_UART2, | 76 | .start = S5P_PA_UART2, |
77 | .end = S5P_PA_UART2 + S5P_SZ_UART, | 77 | .end = S5P_PA_UART2 + S5P_SZ_UART - 1, |
78 | .flags = IORESOURCE_MEM, | 78 | .flags = IORESOURCE_MEM, |
79 | }, | 79 | }, |
80 | [1] = { | 80 | [1] = { |
@@ -98,7 +98,7 @@ static struct resource s5p_uart3_resource[] = { | |||
98 | #if CONFIG_SERIAL_SAMSUNG_UARTS > 3 | 98 | #if CONFIG_SERIAL_SAMSUNG_UARTS > 3 |
99 | [0] = { | 99 | [0] = { |
100 | .start = S5P_PA_UART3, | 100 | .start = S5P_PA_UART3, |
101 | .end = S5P_PA_UART3 + S5P_SZ_UART, | 101 | .end = S5P_PA_UART3 + S5P_SZ_UART - 1, |
102 | .flags = IORESOURCE_MEM, | 102 | .flags = IORESOURCE_MEM, |
103 | }, | 103 | }, |
104 | [1] = { | 104 | [1] = { |
@@ -123,7 +123,7 @@ static struct resource s5p_uart4_resource[] = { | |||
123 | #if CONFIG_SERIAL_SAMSUNG_UARTS > 4 | 123 | #if CONFIG_SERIAL_SAMSUNG_UARTS > 4 |
124 | [0] = { | 124 | [0] = { |
125 | .start = S5P_PA_UART4, | 125 | .start = S5P_PA_UART4, |
126 | .end = S5P_PA_UART4 + S5P_SZ_UART, | 126 | .end = S5P_PA_UART4 + S5P_SZ_UART - 1, |
127 | .flags = IORESOURCE_MEM, | 127 | .flags = IORESOURCE_MEM, |
128 | }, | 128 | }, |
129 | [1] = { | 129 | [1] = { |
@@ -148,7 +148,7 @@ static struct resource s5p_uart5_resource[] = { | |||
148 | #if CONFIG_SERIAL_SAMSUNG_UARTS > 5 | 148 | #if CONFIG_SERIAL_SAMSUNG_UARTS > 5 |
149 | [0] = { | 149 | [0] = { |
150 | .start = S5P_PA_UART5, | 150 | .start = S5P_PA_UART5, |
151 | .end = S5P_PA_UART5 + S5P_SZ_UART, | 151 | .end = S5P_PA_UART5 + S5P_SZ_UART - 1, |
152 | .flags = IORESOURCE_MEM, | 152 | .flags = IORESOURCE_MEM, |
153 | }, | 153 | }, |
154 | [1] = { | 154 | [1] = { |
diff --git a/arch/arm/plat-samsung/dev-ts.c b/arch/arm/plat-samsung/dev-ts.c index 236ef8427d7d..3e4bd8147bf4 100644 --- a/arch/arm/plat-samsung/dev-ts.c +++ b/arch/arm/plat-samsung/dev-ts.c | |||
@@ -58,4 +58,3 @@ void __init s3c24xx_ts_set_platdata(struct s3c2410_ts_mach_info *pd) | |||
58 | 58 | ||
59 | s3c_device_ts.dev.platform_data = npd; | 59 | s3c_device_ts.dev.platform_data = npd; |
60 | } | 60 | } |
61 | EXPORT_SYMBOL(s3c24xx_ts_set_platdata); | ||
diff --git a/arch/arm/plat-samsung/dev-uart.c b/arch/arm/plat-samsung/dev-uart.c index 3776cd952450..5928105490fa 100644 --- a/arch/arm/plat-samsung/dev-uart.c +++ b/arch/arm/plat-samsung/dev-uart.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | 17 | ||
18 | #include <plat/devs.h> | ||
19 | |||
18 | /* uart devices */ | 20 | /* uart devices */ |
19 | 21 | ||
20 | static struct platform_device s3c24xx_uart_device0 = { | 22 | static struct platform_device s3c24xx_uart_device0 = { |
diff --git a/arch/arm/plat-spear/include/plat/uncompress.h b/arch/arm/plat-spear/include/plat/uncompress.h index 99ba6789cc97..6dd455bafdfd 100644 --- a/arch/arm/plat-spear/include/plat/uncompress.h +++ b/arch/arm/plat-spear/include/plat/uncompress.h | |||
@@ -24,10 +24,10 @@ static inline void putc(int c) | |||
24 | { | 24 | { |
25 | void __iomem *base = (void __iomem *)SPEAR_DBG_UART_BASE; | 25 | void __iomem *base = (void __iomem *)SPEAR_DBG_UART_BASE; |
26 | 26 | ||
27 | while (readl(base + UART01x_FR) & UART01x_FR_TXFF) | 27 | while (readl_relaxed(base + UART01x_FR) & UART01x_FR_TXFF) |
28 | barrier(); | 28 | barrier(); |
29 | 29 | ||
30 | writel(c, base + UART01x_DR); | 30 | writel_relaxed(c, base + UART01x_DR); |
31 | } | 31 | } |
32 | 32 | ||
33 | static inline void flush(void) | 33 | static inline void flush(void) |
diff --git a/arch/arm/plat-spear/include/plat/vmalloc.h b/arch/arm/plat-spear/include/plat/vmalloc.h index 09e9372aea21..8c8b24d07046 100644 --- a/arch/arm/plat-spear/include/plat/vmalloc.h +++ b/arch/arm/plat-spear/include/plat/vmalloc.h | |||
@@ -14,6 +14,6 @@ | |||
14 | #ifndef __PLAT_VMALLOC_H | 14 | #ifndef __PLAT_VMALLOC_H |
15 | #define __PLAT_VMALLOC_H | 15 | #define __PLAT_VMALLOC_H |
16 | 16 | ||
17 | #define VMALLOC_END 0xF0000000 | 17 | #define VMALLOC_END 0xF0000000UL |
18 | 18 | ||
19 | #endif /* __PLAT_VMALLOC_H */ | 19 | #endif /* __PLAT_VMALLOC_H */ |
diff --git a/arch/blackfin/lib/outs.S b/arch/blackfin/lib/outs.S index 250f4d4b9436..06a5e674401f 100644 --- a/arch/blackfin/lib/outs.S +++ b/arch/blackfin/lib/outs.S | |||
@@ -13,6 +13,8 @@ | |||
13 | .align 2 | 13 | .align 2 |
14 | 14 | ||
15 | ENTRY(_outsl) | 15 | ENTRY(_outsl) |
16 | CC = R2 == 0; | ||
17 | IF CC JUMP 1f; | ||
16 | P0 = R0; /* P0 = port */ | 18 | P0 = R0; /* P0 = port */ |
17 | P1 = R1; /* P1 = address */ | 19 | P1 = R1; /* P1 = address */ |
18 | P2 = R2; /* P2 = count */ | 20 | P2 = R2; /* P2 = count */ |
@@ -20,10 +22,12 @@ ENTRY(_outsl) | |||
20 | LSETUP( .Llong_loop_s, .Llong_loop_e) LC0 = P2; | 22 | LSETUP( .Llong_loop_s, .Llong_loop_e) LC0 = P2; |
21 | .Llong_loop_s: R0 = [P1++]; | 23 | .Llong_loop_s: R0 = [P1++]; |
22 | .Llong_loop_e: [P0] = R0; | 24 | .Llong_loop_e: [P0] = R0; |
23 | RTS; | 25 | 1: RTS; |
24 | ENDPROC(_outsl) | 26 | ENDPROC(_outsl) |
25 | 27 | ||
26 | ENTRY(_outsw) | 28 | ENTRY(_outsw) |
29 | CC = R2 == 0; | ||
30 | IF CC JUMP 1f; | ||
27 | P0 = R0; /* P0 = port */ | 31 | P0 = R0; /* P0 = port */ |
28 | P1 = R1; /* P1 = address */ | 32 | P1 = R1; /* P1 = address */ |
29 | P2 = R2; /* P2 = count */ | 33 | P2 = R2; /* P2 = count */ |
@@ -31,10 +35,12 @@ ENTRY(_outsw) | |||
31 | LSETUP( .Lword_loop_s, .Lword_loop_e) LC0 = P2; | 35 | LSETUP( .Lword_loop_s, .Lword_loop_e) LC0 = P2; |
32 | .Lword_loop_s: R0 = W[P1++]; | 36 | .Lword_loop_s: R0 = W[P1++]; |
33 | .Lword_loop_e: W[P0] = R0; | 37 | .Lword_loop_e: W[P0] = R0; |
34 | RTS; | 38 | 1: RTS; |
35 | ENDPROC(_outsw) | 39 | ENDPROC(_outsw) |
36 | 40 | ||
37 | ENTRY(_outsb) | 41 | ENTRY(_outsb) |
42 | CC = R2 == 0; | ||
43 | IF CC JUMP 1f; | ||
38 | P0 = R0; /* P0 = port */ | 44 | P0 = R0; /* P0 = port */ |
39 | P1 = R1; /* P1 = address */ | 45 | P1 = R1; /* P1 = address */ |
40 | P2 = R2; /* P2 = count */ | 46 | P2 = R2; /* P2 = count */ |
@@ -42,10 +48,12 @@ ENTRY(_outsb) | |||
42 | LSETUP( .Lbyte_loop_s, .Lbyte_loop_e) LC0 = P2; | 48 | LSETUP( .Lbyte_loop_s, .Lbyte_loop_e) LC0 = P2; |
43 | .Lbyte_loop_s: R0 = B[P1++]; | 49 | .Lbyte_loop_s: R0 = B[P1++]; |
44 | .Lbyte_loop_e: B[P0] = R0; | 50 | .Lbyte_loop_e: B[P0] = R0; |
45 | RTS; | 51 | 1: RTS; |
46 | ENDPROC(_outsb) | 52 | ENDPROC(_outsb) |
47 | 53 | ||
48 | ENTRY(_outsw_8) | 54 | ENTRY(_outsw_8) |
55 | CC = R2 == 0; | ||
56 | IF CC JUMP 1f; | ||
49 | P0 = R0; /* P0 = port */ | 57 | P0 = R0; /* P0 = port */ |
50 | P1 = R1; /* P1 = address */ | 58 | P1 = R1; /* P1 = address */ |
51 | P2 = R2; /* P2 = count */ | 59 | P2 = R2; /* P2 = count */ |
@@ -56,5 +64,5 @@ ENTRY(_outsw_8) | |||
56 | R0 = R0 << 8; | 64 | R0 = R0 << 8; |
57 | R0 = R0 + R1; | 65 | R0 = R0 + R1; |
58 | .Lword8_loop_e: W[P0] = R0; | 66 | .Lword8_loop_e: W[P0] = R0; |
59 | RTS; | 67 | 1: RTS; |
60 | ENDPROC(_outsw_8) | 68 | ENDPROC(_outsw_8) |
diff --git a/arch/blackfin/mach-common/cache.S b/arch/blackfin/mach-common/cache.S index 790c767ca95a..ab4a925a443e 100644 --- a/arch/blackfin/mach-common/cache.S +++ b/arch/blackfin/mach-common/cache.S | |||
@@ -58,6 +58,8 @@ | |||
58 | 1: | 58 | 1: |
59 | .ifeqs "\flushins", BROK_FLUSH_INST | 59 | .ifeqs "\flushins", BROK_FLUSH_INST |
60 | \flushins [P0++]; | 60 | \flushins [P0++]; |
61 | nop; | ||
62 | nop; | ||
61 | 2: nop; | 63 | 2: nop; |
62 | .else | 64 | .else |
63 | 2: \flushins [P0++]; | 65 | 2: \flushins [P0++]; |
diff --git a/arch/cris/kernel/vmlinux.lds.S b/arch/cris/kernel/vmlinux.lds.S index 442218980db0..c49be845f96a 100644 --- a/arch/cris/kernel/vmlinux.lds.S +++ b/arch/cris/kernel/vmlinux.lds.S | |||
@@ -72,11 +72,6 @@ SECTIONS | |||
72 | INIT_TEXT_SECTION(PAGE_SIZE) | 72 | INIT_TEXT_SECTION(PAGE_SIZE) |
73 | .init.data : { INIT_DATA } | 73 | .init.data : { INIT_DATA } |
74 | .init.setup : { INIT_SETUP(16) } | 74 | .init.setup : { INIT_SETUP(16) } |
75 | #ifdef CONFIG_ETRAX_ARCH_V32 | ||
76 | __start___param = .; | ||
77 | __param : { *(__param) } | ||
78 | __stop___param = .; | ||
79 | #endif | ||
80 | .initcall.init : { | 75 | .initcall.init : { |
81 | INIT_CALLS | 76 | INIT_CALLS |
82 | } | 77 | } |
diff --git a/arch/ia64/include/asm/xen/hypercall.h b/arch/ia64/include/asm/xen/hypercall.h index 96fc62366aa4..ed28bcd5bb85 100644 --- a/arch/ia64/include/asm/xen/hypercall.h +++ b/arch/ia64/include/asm/xen/hypercall.h | |||
@@ -107,7 +107,7 @@ extern unsigned long __hypercall(unsigned long a1, unsigned long a2, | |||
107 | static inline int | 107 | static inline int |
108 | xencomm_arch_hypercall_sched_op(int cmd, struct xencomm_handle *arg) | 108 | xencomm_arch_hypercall_sched_op(int cmd, struct xencomm_handle *arg) |
109 | { | 109 | { |
110 | return _hypercall2(int, sched_op_new, cmd, arg); | 110 | return _hypercall2(int, sched_op, cmd, arg); |
111 | } | 111 | } |
112 | 112 | ||
113 | static inline long | 113 | static inline long |
diff --git a/arch/ia64/xen/suspend.c b/arch/ia64/xen/suspend.c index fd66b048c6fa..419c8620945a 100644 --- a/arch/ia64/xen/suspend.c +++ b/arch/ia64/xen/suspend.c | |||
@@ -37,19 +37,14 @@ xen_mm_unpin_all(void) | |||
37 | /* nothing */ | 37 | /* nothing */ |
38 | } | 38 | } |
39 | 39 | ||
40 | void xen_pre_device_suspend(void) | ||
41 | { | ||
42 | /* nothing */ | ||
43 | } | ||
44 | |||
45 | void | 40 | void |
46 | xen_pre_suspend() | 41 | xen_arch_pre_suspend() |
47 | { | 42 | { |
48 | /* nothing */ | 43 | /* nothing */ |
49 | } | 44 | } |
50 | 45 | ||
51 | void | 46 | void |
52 | xen_post_suspend(int suspend_cancelled) | 47 | xen_arch_post_suspend(int suspend_cancelled) |
53 | { | 48 | { |
54 | if (suspend_cancelled) | 49 | if (suspend_cancelled) |
55 | return; | 50 | return; |
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index f5ecc0566bc2..d88983516e26 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig | |||
@@ -4,6 +4,7 @@ config MIPS | |||
4 | select HAVE_GENERIC_DMA_COHERENT | 4 | select HAVE_GENERIC_DMA_COHERENT |
5 | select HAVE_IDE | 5 | select HAVE_IDE |
6 | select HAVE_OPROFILE | 6 | select HAVE_OPROFILE |
7 | select HAVE_IRQ_WORK | ||
7 | select HAVE_PERF_EVENTS | 8 | select HAVE_PERF_EVENTS |
8 | select PERF_USE_VMALLOC | 9 | select PERF_USE_VMALLOC |
9 | select HAVE_ARCH_KGDB | 10 | select HAVE_ARCH_KGDB |
@@ -208,6 +209,7 @@ config MACH_JZ4740 | |||
208 | select ARCH_REQUIRE_GPIOLIB | 209 | select ARCH_REQUIRE_GPIOLIB |
209 | select SYS_HAS_EARLY_PRINTK | 210 | select SYS_HAS_EARLY_PRINTK |
210 | select HAVE_PWM | 211 | select HAVE_PWM |
212 | select HAVE_CLK | ||
211 | 213 | ||
212 | config LASAT | 214 | config LASAT |
213 | bool "LASAT Networks platforms" | 215 | bool "LASAT Networks platforms" |
@@ -333,6 +335,8 @@ config PNX8550_STB810 | |||
333 | config PMC_MSP | 335 | config PMC_MSP |
334 | bool "PMC-Sierra MSP chipsets" | 336 | bool "PMC-Sierra MSP chipsets" |
335 | depends on EXPERIMENTAL | 337 | depends on EXPERIMENTAL |
338 | select CEVT_R4K | ||
339 | select CSRC_R4K | ||
336 | select DMA_NONCOHERENT | 340 | select DMA_NONCOHERENT |
337 | select SWAP_IO_SPACE | 341 | select SWAP_IO_SPACE |
338 | select NO_EXCEPT_FILL | 342 | select NO_EXCEPT_FILL |
diff --git a/arch/mips/alchemy/mtx-1/board_setup.c b/arch/mips/alchemy/mtx-1/board_setup.c index 6398fa95905c..40b84b991191 100644 --- a/arch/mips/alchemy/mtx-1/board_setup.c +++ b/arch/mips/alchemy/mtx-1/board_setup.c | |||
@@ -54,8 +54,8 @@ int mtx1_pci_idsel(unsigned int devsel, int assert); | |||
54 | 54 | ||
55 | static void mtx1_reset(char *c) | 55 | static void mtx1_reset(char *c) |
56 | { | 56 | { |
57 | /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ | 57 | /* Jump to the reset vector */ |
58 | au_writel(0x00000000, 0xAE00001C); | 58 | __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000)); |
59 | } | 59 | } |
60 | 60 | ||
61 | static void mtx1_power_off(void) | 61 | static void mtx1_power_off(void) |
diff --git a/arch/mips/alchemy/mtx-1/platform.c b/arch/mips/alchemy/mtx-1/platform.c index e30e42add697..956f946218c5 100644 --- a/arch/mips/alchemy/mtx-1/platform.c +++ b/arch/mips/alchemy/mtx-1/platform.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include <linux/mtd/physmap.h> | 28 | #include <linux/mtd/physmap.h> |
29 | #include <mtd/mtd-abi.h> | 29 | #include <mtd/mtd-abi.h> |
30 | 30 | ||
31 | #include <asm/mach-au1x00/au1xxx_eth.h> | ||
32 | |||
31 | static struct gpio_keys_button mtx1_gpio_button[] = { | 33 | static struct gpio_keys_button mtx1_gpio_button[] = { |
32 | { | 34 | { |
33 | .gpio = 207, | 35 | .gpio = 207, |
@@ -140,10 +142,17 @@ static struct __initdata platform_device * mtx1_devs[] = { | |||
140 | &mtx1_mtd, | 142 | &mtx1_mtd, |
141 | }; | 143 | }; |
142 | 144 | ||
145 | static struct au1000_eth_platform_data mtx1_au1000_eth0_pdata = { | ||
146 | .phy_search_highest_addr = 1, | ||
147 | .phy1_search_mac0 = 1, | ||
148 | }; | ||
149 | |||
143 | static int __init mtx1_register_devices(void) | 150 | static int __init mtx1_register_devices(void) |
144 | { | 151 | { |
145 | int rc; | 152 | int rc; |
146 | 153 | ||
154 | au1xxx_override_eth_cfg(0, &mtx1_au1000_eth0_pdata); | ||
155 | |||
147 | rc = gpio_request(mtx1_gpio_button[0].gpio, | 156 | rc = gpio_request(mtx1_gpio_button[0].gpio, |
148 | mtx1_gpio_button[0].desc); | 157 | mtx1_gpio_button[0].desc); |
149 | if (rc < 0) { | 158 | if (rc < 0) { |
diff --git a/arch/mips/alchemy/xxs1500/board_setup.c b/arch/mips/alchemy/xxs1500/board_setup.c index b43c918925d3..80c521e5290d 100644 --- a/arch/mips/alchemy/xxs1500/board_setup.c +++ b/arch/mips/alchemy/xxs1500/board_setup.c | |||
@@ -36,8 +36,8 @@ | |||
36 | 36 | ||
37 | static void xxs1500_reset(char *c) | 37 | static void xxs1500_reset(char *c) |
38 | { | 38 | { |
39 | /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ | 39 | /* Jump to the reset vector */ |
40 | au_writel(0x00000000, 0xAE00001C); | 40 | __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000)); |
41 | } | 41 | } |
42 | 42 | ||
43 | static void xxs1500_power_off(void) | 43 | static void xxs1500_power_off(void) |
diff --git a/arch/mips/include/asm/perf_event.h b/arch/mips/include/asm/perf_event.h index e00007cf8162..d0c77496c728 100644 --- a/arch/mips/include/asm/perf_event.h +++ b/arch/mips/include/asm/perf_event.h | |||
@@ -11,15 +11,5 @@ | |||
11 | 11 | ||
12 | #ifndef __MIPS_PERF_EVENT_H__ | 12 | #ifndef __MIPS_PERF_EVENT_H__ |
13 | #define __MIPS_PERF_EVENT_H__ | 13 | #define __MIPS_PERF_EVENT_H__ |
14 | 14 | /* Leave it empty here. The file is required by linux/perf_event.h */ | |
15 | /* | ||
16 | * MIPS performance counters do not raise NMI upon overflow, a regular | ||
17 | * interrupt will be signaled. Hence we can do the pending perf event | ||
18 | * work at the tail of the irq handler. | ||
19 | */ | ||
20 | static inline void | ||
21 | set_perf_event_pending(void) | ||
22 | { | ||
23 | } | ||
24 | |||
25 | #endif /* __MIPS_PERF_EVENT_H__ */ | 15 | #endif /* __MIPS_PERF_EVENT_H__ */ |
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c index 5a84a1f11231..94ca2b018af7 100644 --- a/arch/mips/kernel/ftrace.c +++ b/arch/mips/kernel/ftrace.c | |||
@@ -17,29 +17,13 @@ | |||
17 | #include <asm/cacheflush.h> | 17 | #include <asm/cacheflush.h> |
18 | #include <asm/uasm.h> | 18 | #include <asm/uasm.h> |
19 | 19 | ||
20 | /* | 20 | #include <asm-generic/sections.h> |
21 | * If the Instruction Pointer is in module space (0xc0000000), return true; | ||
22 | * otherwise, it is in kernel space (0x80000000), return false. | ||
23 | * | ||
24 | * FIXME: This will not work when the kernel space and module space are the | ||
25 | * same. If they are the same, we need to modify scripts/recordmcount.pl, | ||
26 | * ftrace_make_nop/call() and the other related parts to ensure the | ||
27 | * enabling/disabling of the calling site to _mcount is right for both kernel | ||
28 | * and module. | ||
29 | */ | ||
30 | |||
31 | static inline int in_module(unsigned long ip) | ||
32 | { | ||
33 | return ip & 0x40000000; | ||
34 | } | ||
35 | 21 | ||
36 | #ifdef CONFIG_DYNAMIC_FTRACE | 22 | #ifdef CONFIG_DYNAMIC_FTRACE |
37 | 23 | ||
38 | #define JAL 0x0c000000 /* jump & link: ip --> ra, jump to target */ | 24 | #define JAL 0x0c000000 /* jump & link: ip --> ra, jump to target */ |
39 | #define ADDR_MASK 0x03ffffff /* op_code|addr : 31...26|25 ....0 */ | 25 | #define ADDR_MASK 0x03ffffff /* op_code|addr : 31...26|25 ....0 */ |
40 | 26 | ||
41 | #define INSN_B_1F_4 0x10000004 /* b 1f; offset = 4 */ | ||
42 | #define INSN_B_1F_5 0x10000005 /* b 1f; offset = 5 */ | ||
43 | #define INSN_NOP 0x00000000 /* nop */ | 27 | #define INSN_NOP 0x00000000 /* nop */ |
44 | #define INSN_JAL(addr) \ | 28 | #define INSN_JAL(addr) \ |
45 | ((unsigned int)(JAL | (((addr) >> 2) & ADDR_MASK))) | 29 | ((unsigned int)(JAL | (((addr) >> 2) & ADDR_MASK))) |
@@ -69,6 +53,20 @@ static inline void ftrace_dyn_arch_init_insns(void) | |||
69 | #endif | 53 | #endif |
70 | } | 54 | } |
71 | 55 | ||
56 | /* | ||
57 | * Check if the address is in kernel space | ||
58 | * | ||
59 | * Clone core_kernel_text() from kernel/extable.c, but doesn't call | ||
60 | * init_kernel_text() for Ftrace doesn't trace functions in init sections. | ||
61 | */ | ||
62 | static inline int in_kernel_space(unsigned long ip) | ||
63 | { | ||
64 | if (ip >= (unsigned long)_stext && | ||
65 | ip <= (unsigned long)_etext) | ||
66 | return 1; | ||
67 | return 0; | ||
68 | } | ||
69 | |||
72 | static int ftrace_modify_code(unsigned long ip, unsigned int new_code) | 70 | static int ftrace_modify_code(unsigned long ip, unsigned int new_code) |
73 | { | 71 | { |
74 | int faulted; | 72 | int faulted; |
@@ -84,6 +82,42 @@ static int ftrace_modify_code(unsigned long ip, unsigned int new_code) | |||
84 | return 0; | 82 | return 0; |
85 | } | 83 | } |
86 | 84 | ||
85 | /* | ||
86 | * The details about the calling site of mcount on MIPS | ||
87 | * | ||
88 | * 1. For kernel: | ||
89 | * | ||
90 | * move at, ra | ||
91 | * jal _mcount --> nop | ||
92 | * | ||
93 | * 2. For modules: | ||
94 | * | ||
95 | * 2.1 For KBUILD_MCOUNT_RA_ADDRESS and CONFIG_32BIT | ||
96 | * | ||
97 | * lui v1, hi_16bit_of_mcount --> b 1f (0x10000005) | ||
98 | * addiu v1, v1, low_16bit_of_mcount | ||
99 | * move at, ra | ||
100 | * move $12, ra_address | ||
101 | * jalr v1 | ||
102 | * sub sp, sp, 8 | ||
103 | * 1: offset = 5 instructions | ||
104 | * 2.2 For the Other situations | ||
105 | * | ||
106 | * lui v1, hi_16bit_of_mcount --> b 1f (0x10000004) | ||
107 | * addiu v1, v1, low_16bit_of_mcount | ||
108 | * move at, ra | ||
109 | * jalr v1 | ||
110 | * nop | move $12, ra_address | sub sp, sp, 8 | ||
111 | * 1: offset = 4 instructions | ||
112 | */ | ||
113 | |||
114 | #if defined(KBUILD_MCOUNT_RA_ADDRESS) && defined(CONFIG_32BIT) | ||
115 | #define MCOUNT_OFFSET_INSNS 5 | ||
116 | #else | ||
117 | #define MCOUNT_OFFSET_INSNS 4 | ||
118 | #endif | ||
119 | #define INSN_B_1F (0x10000000 | MCOUNT_OFFSET_INSNS) | ||
120 | |||
87 | int ftrace_make_nop(struct module *mod, | 121 | int ftrace_make_nop(struct module *mod, |
88 | struct dyn_ftrace *rec, unsigned long addr) | 122 | struct dyn_ftrace *rec, unsigned long addr) |
89 | { | 123 | { |
@@ -91,39 +125,11 @@ int ftrace_make_nop(struct module *mod, | |||
91 | unsigned long ip = rec->ip; | 125 | unsigned long ip = rec->ip; |
92 | 126 | ||
93 | /* | 127 | /* |
94 | * We have compiled module with -mlong-calls, but compiled the kernel | 128 | * If ip is in kernel space, no long call, otherwise, long call is |
95 | * without it, we need to cope with them respectively. | 129 | * needed. |
96 | */ | 130 | */ |
97 | if (in_module(ip)) { | 131 | new = in_kernel_space(ip) ? INSN_NOP : INSN_B_1F; |
98 | #if defined(KBUILD_MCOUNT_RA_ADDRESS) && defined(CONFIG_32BIT) | 132 | |
99 | /* | ||
100 | * lui v1, hi_16bit_of_mcount --> b 1f (0x10000005) | ||
101 | * addiu v1, v1, low_16bit_of_mcount | ||
102 | * move at, ra | ||
103 | * move $12, ra_address | ||
104 | * jalr v1 | ||
105 | * sub sp, sp, 8 | ||
106 | * 1: offset = 5 instructions | ||
107 | */ | ||
108 | new = INSN_B_1F_5; | ||
109 | #else | ||
110 | /* | ||
111 | * lui v1, hi_16bit_of_mcount --> b 1f (0x10000004) | ||
112 | * addiu v1, v1, low_16bit_of_mcount | ||
113 | * move at, ra | ||
114 | * jalr v1 | ||
115 | * nop | move $12, ra_address | sub sp, sp, 8 | ||
116 | * 1: offset = 4 instructions | ||
117 | */ | ||
118 | new = INSN_B_1F_4; | ||
119 | #endif | ||
120 | } else { | ||
121 | /* | ||
122 | * move at, ra | ||
123 | * jal _mcount --> nop | ||
124 | */ | ||
125 | new = INSN_NOP; | ||
126 | } | ||
127 | return ftrace_modify_code(ip, new); | 133 | return ftrace_modify_code(ip, new); |
128 | } | 134 | } |
129 | 135 | ||
@@ -132,8 +138,8 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | |||
132 | unsigned int new; | 138 | unsigned int new; |
133 | unsigned long ip = rec->ip; | 139 | unsigned long ip = rec->ip; |
134 | 140 | ||
135 | /* ip, module: 0xc0000000, kernel: 0x80000000 */ | 141 | new = in_kernel_space(ip) ? insn_jal_ftrace_caller : |
136 | new = in_module(ip) ? insn_lui_v1_hi16_mcount : insn_jal_ftrace_caller; | 142 | insn_lui_v1_hi16_mcount; |
137 | 143 | ||
138 | return ftrace_modify_code(ip, new); | 144 | return ftrace_modify_code(ip, new); |
139 | } | 145 | } |
@@ -190,29 +196,25 @@ int ftrace_disable_ftrace_graph_caller(void) | |||
190 | #define S_R_SP (0xafb0 << 16) /* s{d,w} R, offset(sp) */ | 196 | #define S_R_SP (0xafb0 << 16) /* s{d,w} R, offset(sp) */ |
191 | #define OFFSET_MASK 0xffff /* stack offset range: 0 ~ PT_SIZE */ | 197 | #define OFFSET_MASK 0xffff /* stack offset range: 0 ~ PT_SIZE */ |
192 | 198 | ||
193 | unsigned long ftrace_get_parent_addr(unsigned long self_addr, | 199 | unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long |
194 | unsigned long parent, | 200 | old_parent_ra, unsigned long parent_ra_addr, unsigned long fp) |
195 | unsigned long parent_addr, | ||
196 | unsigned long fp) | ||
197 | { | 201 | { |
198 | unsigned long sp, ip, ra; | 202 | unsigned long sp, ip, tmp; |
199 | unsigned int code; | 203 | unsigned int code; |
200 | int faulted; | 204 | int faulted; |
201 | 205 | ||
202 | /* | 206 | /* |
203 | * For module, move the ip from calling site of mcount to the | 207 | * For module, move the ip from the return address after the |
204 | * instruction "lui v1, hi_16bit_of_mcount"(offset is 20), but for | 208 | * instruction "lui v1, hi_16bit_of_mcount"(offset is 24), but for |
205 | * kernel, move to the instruction "move ra, at"(offset is 12) | 209 | * kernel, move after the instruction "move ra, at"(offset is 16) |
206 | */ | 210 | */ |
207 | ip = self_addr - (in_module(self_addr) ? 20 : 12); | 211 | ip = self_ra - (in_kernel_space(self_ra) ? 16 : 24); |
208 | 212 | ||
209 | /* | 213 | /* |
210 | * search the text until finding the non-store instruction or "s{d,w} | 214 | * search the text until finding the non-store instruction or "s{d,w} |
211 | * ra, offset(sp)" instruction | 215 | * ra, offset(sp)" instruction |
212 | */ | 216 | */ |
213 | do { | 217 | do { |
214 | ip -= 4; | ||
215 | |||
216 | /* get the code at "ip": code = *(unsigned int *)ip; */ | 218 | /* get the code at "ip": code = *(unsigned int *)ip; */ |
217 | safe_load_code(code, ip, faulted); | 219 | safe_load_code(code, ip, faulted); |
218 | 220 | ||
@@ -224,18 +226,20 @@ unsigned long ftrace_get_parent_addr(unsigned long self_addr, | |||
224 | * store the ra on the stack | 226 | * store the ra on the stack |
225 | */ | 227 | */ |
226 | if ((code & S_R_SP) != S_R_SP) | 228 | if ((code & S_R_SP) != S_R_SP) |
227 | return parent_addr; | 229 | return parent_ra_addr; |
228 | 230 | ||
229 | } while (((code & S_RA_SP) != S_RA_SP)); | 231 | /* Move to the next instruction */ |
232 | ip -= 4; | ||
233 | } while ((code & S_RA_SP) != S_RA_SP); | ||
230 | 234 | ||
231 | sp = fp + (code & OFFSET_MASK); | 235 | sp = fp + (code & OFFSET_MASK); |
232 | 236 | ||
233 | /* ra = *(unsigned long *)sp; */ | 237 | /* tmp = *(unsigned long *)sp; */ |
234 | safe_load_stack(ra, sp, faulted); | 238 | safe_load_stack(tmp, sp, faulted); |
235 | if (unlikely(faulted)) | 239 | if (unlikely(faulted)) |
236 | return 0; | 240 | return 0; |
237 | 241 | ||
238 | if (ra == parent) | 242 | if (tmp == old_parent_ra) |
239 | return sp; | 243 | return sp; |
240 | return 0; | 244 | return 0; |
241 | } | 245 | } |
@@ -246,21 +250,21 @@ unsigned long ftrace_get_parent_addr(unsigned long self_addr, | |||
246 | * Hook the return address and push it in the stack of return addrs | 250 | * Hook the return address and push it in the stack of return addrs |
247 | * in current thread info. | 251 | * in current thread info. |
248 | */ | 252 | */ |
249 | void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, | 253 | void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra, |
250 | unsigned long fp) | 254 | unsigned long fp) |
251 | { | 255 | { |
252 | unsigned long old; | 256 | unsigned long old_parent_ra; |
253 | struct ftrace_graph_ent trace; | 257 | struct ftrace_graph_ent trace; |
254 | unsigned long return_hooker = (unsigned long) | 258 | unsigned long return_hooker = (unsigned long) |
255 | &return_to_handler; | 259 | &return_to_handler; |
256 | int faulted; | 260 | int faulted, insns; |
257 | 261 | ||
258 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) | 262 | if (unlikely(atomic_read(¤t->tracing_graph_pause))) |
259 | return; | 263 | return; |
260 | 264 | ||
261 | /* | 265 | /* |
262 | * "parent" is the stack address saved the return address of the caller | 266 | * "parent_ra_addr" is the stack address saved the return address of |
263 | * of _mcount. | 267 | * the caller of _mcount. |
264 | * | 268 | * |
265 | * if the gcc < 4.5, a leaf function does not save the return address | 269 | * if the gcc < 4.5, a leaf function does not save the return address |
266 | * in the stack address, so, we "emulate" one in _mcount's stack space, | 270 | * in the stack address, so, we "emulate" one in _mcount's stack space, |
@@ -275,37 +279,44 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, | |||
275 | * do it in ftrace_graph_caller of mcount.S. | 279 | * do it in ftrace_graph_caller of mcount.S. |
276 | */ | 280 | */ |
277 | 281 | ||
278 | /* old = *parent; */ | 282 | /* old_parent_ra = *parent_ra_addr; */ |
279 | safe_load_stack(old, parent, faulted); | 283 | safe_load_stack(old_parent_ra, parent_ra_addr, faulted); |
280 | if (unlikely(faulted)) | 284 | if (unlikely(faulted)) |
281 | goto out; | 285 | goto out; |
282 | #ifndef KBUILD_MCOUNT_RA_ADDRESS | 286 | #ifndef KBUILD_MCOUNT_RA_ADDRESS |
283 | parent = (unsigned long *)ftrace_get_parent_addr(self_addr, old, | 287 | parent_ra_addr = (unsigned long *)ftrace_get_parent_ra_addr(self_ra, |
284 | (unsigned long)parent, fp); | 288 | old_parent_ra, (unsigned long)parent_ra_addr, fp); |
285 | /* | 289 | /* |
286 | * If fails when getting the stack address of the non-leaf function's | 290 | * If fails when getting the stack address of the non-leaf function's |
287 | * ra, stop function graph tracer and return | 291 | * ra, stop function graph tracer and return |
288 | */ | 292 | */ |
289 | if (parent == 0) | 293 | if (parent_ra_addr == 0) |
290 | goto out; | 294 | goto out; |
291 | #endif | 295 | #endif |
292 | /* *parent = return_hooker; */ | 296 | /* *parent_ra_addr = return_hooker; */ |
293 | safe_store_stack(return_hooker, parent, faulted); | 297 | safe_store_stack(return_hooker, parent_ra_addr, faulted); |
294 | if (unlikely(faulted)) | 298 | if (unlikely(faulted)) |
295 | goto out; | 299 | goto out; |
296 | 300 | ||
297 | if (ftrace_push_return_trace(old, self_addr, &trace.depth, fp) == | 301 | if (ftrace_push_return_trace(old_parent_ra, self_ra, &trace.depth, fp) |
298 | -EBUSY) { | 302 | == -EBUSY) { |
299 | *parent = old; | 303 | *parent_ra_addr = old_parent_ra; |
300 | return; | 304 | return; |
301 | } | 305 | } |
302 | 306 | ||
303 | trace.func = self_addr; | 307 | /* |
308 | * Get the recorded ip of the current mcount calling site in the | ||
309 | * __mcount_loc section, which will be used to filter the function | ||
310 | * entries configured through the tracing/set_graph_function interface. | ||
311 | */ | ||
312 | |||
313 | insns = in_kernel_space(self_ra) ? 2 : MCOUNT_OFFSET_INSNS + 1; | ||
314 | trace.func = self_ra - (MCOUNT_INSN_SIZE * insns); | ||
304 | 315 | ||
305 | /* Only trace if the calling function expects to */ | 316 | /* Only trace if the calling function expects to */ |
306 | if (!ftrace_graph_entry(&trace)) { | 317 | if (!ftrace_graph_entry(&trace)) { |
307 | current->curr_ret_stack--; | 318 | current->curr_ret_stack--; |
308 | *parent = old; | 319 | *parent_ra_addr = old_parent_ra; |
309 | } | 320 | } |
310 | return; | 321 | return; |
311 | out: | 322 | out: |
diff --git a/arch/mips/kernel/perf_event.c b/arch/mips/kernel/perf_event.c index 2b7f3f703b83..a8244854d3dc 100644 --- a/arch/mips/kernel/perf_event.c +++ b/arch/mips/kernel/perf_event.c | |||
@@ -161,41 +161,6 @@ mipspmu_event_set_period(struct perf_event *event, | |||
161 | return ret; | 161 | return ret; |
162 | } | 162 | } |
163 | 163 | ||
164 | static int mipspmu_enable(struct perf_event *event) | ||
165 | { | ||
166 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | ||
167 | struct hw_perf_event *hwc = &event->hw; | ||
168 | int idx; | ||
169 | int err = 0; | ||
170 | |||
171 | /* To look for a free counter for this event. */ | ||
172 | idx = mipspmu->alloc_counter(cpuc, hwc); | ||
173 | if (idx < 0) { | ||
174 | err = idx; | ||
175 | goto out; | ||
176 | } | ||
177 | |||
178 | /* | ||
179 | * If there is an event in the counter we are going to use then | ||
180 | * make sure it is disabled. | ||
181 | */ | ||
182 | event->hw.idx = idx; | ||
183 | mipspmu->disable_event(idx); | ||
184 | cpuc->events[idx] = event; | ||
185 | |||
186 | /* Set the period for the event. */ | ||
187 | mipspmu_event_set_period(event, hwc, idx); | ||
188 | |||
189 | /* Enable the event. */ | ||
190 | mipspmu->enable_event(hwc, idx); | ||
191 | |||
192 | /* Propagate our changes to the userspace mapping. */ | ||
193 | perf_event_update_userpage(event); | ||
194 | |||
195 | out: | ||
196 | return err; | ||
197 | } | ||
198 | |||
199 | static void mipspmu_event_update(struct perf_event *event, | 164 | static void mipspmu_event_update(struct perf_event *event, |
200 | struct hw_perf_event *hwc, | 165 | struct hw_perf_event *hwc, |
201 | int idx) | 166 | int idx) |
@@ -204,7 +169,7 @@ static void mipspmu_event_update(struct perf_event *event, | |||
204 | unsigned long flags; | 169 | unsigned long flags; |
205 | int shift = 64 - TOTAL_BITS; | 170 | int shift = 64 - TOTAL_BITS; |
206 | s64 prev_raw_count, new_raw_count; | 171 | s64 prev_raw_count, new_raw_count; |
207 | s64 delta; | 172 | u64 delta; |
208 | 173 | ||
209 | again: | 174 | again: |
210 | prev_raw_count = local64_read(&hwc->prev_count); | 175 | prev_raw_count = local64_read(&hwc->prev_count); |
@@ -231,32 +196,90 @@ again: | |||
231 | return; | 196 | return; |
232 | } | 197 | } |
233 | 198 | ||
234 | static void mipspmu_disable(struct perf_event *event) | 199 | static void mipspmu_start(struct perf_event *event, int flags) |
200 | { | ||
201 | struct hw_perf_event *hwc = &event->hw; | ||
202 | |||
203 | if (!mipspmu) | ||
204 | return; | ||
205 | |||
206 | if (flags & PERF_EF_RELOAD) | ||
207 | WARN_ON_ONCE(!(hwc->state & PERF_HES_UPTODATE)); | ||
208 | |||
209 | hwc->state = 0; | ||
210 | |||
211 | /* Set the period for the event. */ | ||
212 | mipspmu_event_set_period(event, hwc, hwc->idx); | ||
213 | |||
214 | /* Enable the event. */ | ||
215 | mipspmu->enable_event(hwc, hwc->idx); | ||
216 | } | ||
217 | |||
218 | static void mipspmu_stop(struct perf_event *event, int flags) | ||
219 | { | ||
220 | struct hw_perf_event *hwc = &event->hw; | ||
221 | |||
222 | if (!mipspmu) | ||
223 | return; | ||
224 | |||
225 | if (!(hwc->state & PERF_HES_STOPPED)) { | ||
226 | /* We are working on a local event. */ | ||
227 | mipspmu->disable_event(hwc->idx); | ||
228 | barrier(); | ||
229 | mipspmu_event_update(event, hwc, hwc->idx); | ||
230 | hwc->state |= PERF_HES_STOPPED | PERF_HES_UPTODATE; | ||
231 | } | ||
232 | } | ||
233 | |||
234 | static int mipspmu_add(struct perf_event *event, int flags) | ||
235 | { | 235 | { |
236 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | 236 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); |
237 | struct hw_perf_event *hwc = &event->hw; | 237 | struct hw_perf_event *hwc = &event->hw; |
238 | int idx = hwc->idx; | 238 | int idx; |
239 | int err = 0; | ||
239 | 240 | ||
241 | perf_pmu_disable(event->pmu); | ||
240 | 242 | ||
241 | WARN_ON(idx < 0 || idx >= mipspmu->num_counters); | 243 | /* To look for a free counter for this event. */ |
244 | idx = mipspmu->alloc_counter(cpuc, hwc); | ||
245 | if (idx < 0) { | ||
246 | err = idx; | ||
247 | goto out; | ||
248 | } | ||
242 | 249 | ||
243 | /* We are working on a local event. */ | 250 | /* |
251 | * If there is an event in the counter we are going to use then | ||
252 | * make sure it is disabled. | ||
253 | */ | ||
254 | event->hw.idx = idx; | ||
244 | mipspmu->disable_event(idx); | 255 | mipspmu->disable_event(idx); |
256 | cpuc->events[idx] = event; | ||
245 | 257 | ||
246 | barrier(); | 258 | hwc->state = PERF_HES_STOPPED | PERF_HES_UPTODATE; |
247 | 259 | if (flags & PERF_EF_START) | |
248 | mipspmu_event_update(event, hwc, idx); | 260 | mipspmu_start(event, PERF_EF_RELOAD); |
249 | cpuc->events[idx] = NULL; | ||
250 | clear_bit(idx, cpuc->used_mask); | ||
251 | 261 | ||
262 | /* Propagate our changes to the userspace mapping. */ | ||
252 | perf_event_update_userpage(event); | 263 | perf_event_update_userpage(event); |
264 | |||
265 | out: | ||
266 | perf_pmu_enable(event->pmu); | ||
267 | return err; | ||
253 | } | 268 | } |
254 | 269 | ||
255 | static void mipspmu_unthrottle(struct perf_event *event) | 270 | static void mipspmu_del(struct perf_event *event, int flags) |
256 | { | 271 | { |
272 | struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); | ||
257 | struct hw_perf_event *hwc = &event->hw; | 273 | struct hw_perf_event *hwc = &event->hw; |
274 | int idx = hwc->idx; | ||
258 | 275 | ||
259 | mipspmu->enable_event(hwc, hwc->idx); | 276 | WARN_ON(idx < 0 || idx >= mipspmu->num_counters); |
277 | |||
278 | mipspmu_stop(event, PERF_EF_UPDATE); | ||
279 | cpuc->events[idx] = NULL; | ||
280 | clear_bit(idx, cpuc->used_mask); | ||
281 | |||
282 | perf_event_update_userpage(event); | ||
260 | } | 283 | } |
261 | 284 | ||
262 | static void mipspmu_read(struct perf_event *event) | 285 | static void mipspmu_read(struct perf_event *event) |
@@ -270,12 +293,17 @@ static void mipspmu_read(struct perf_event *event) | |||
270 | mipspmu_event_update(event, hwc, hwc->idx); | 293 | mipspmu_event_update(event, hwc, hwc->idx); |
271 | } | 294 | } |
272 | 295 | ||
273 | static struct pmu pmu = { | 296 | static void mipspmu_enable(struct pmu *pmu) |
274 | .enable = mipspmu_enable, | 297 | { |
275 | .disable = mipspmu_disable, | 298 | if (mipspmu) |
276 | .unthrottle = mipspmu_unthrottle, | 299 | mipspmu->start(); |
277 | .read = mipspmu_read, | 300 | } |
278 | }; | 301 | |
302 | static void mipspmu_disable(struct pmu *pmu) | ||
303 | { | ||
304 | if (mipspmu) | ||
305 | mipspmu->stop(); | ||
306 | } | ||
279 | 307 | ||
280 | static atomic_t active_events = ATOMIC_INIT(0); | 308 | static atomic_t active_events = ATOMIC_INIT(0); |
281 | static DEFINE_MUTEX(pmu_reserve_mutex); | 309 | static DEFINE_MUTEX(pmu_reserve_mutex); |
@@ -318,6 +346,82 @@ static void mipspmu_free_irq(void) | |||
318 | perf_irq = save_perf_irq; | 346 | perf_irq = save_perf_irq; |
319 | } | 347 | } |
320 | 348 | ||
349 | /* | ||
350 | * mipsxx/rm9000/loongson2 have different performance counters, they have | ||
351 | * specific low-level init routines. | ||
352 | */ | ||
353 | static void reset_counters(void *arg); | ||
354 | static int __hw_perf_event_init(struct perf_event *event); | ||
355 | |||
356 | static void hw_perf_event_destroy(struct perf_event *event) | ||
357 | { | ||
358 | if (atomic_dec_and_mutex_lock(&active_events, | ||
359 | &pmu_reserve_mutex)) { | ||
360 | /* | ||
361 | * We must not call the destroy function with interrupts | ||
362 | * disabled. | ||
363 | */ | ||
364 | on_each_cpu(reset_counters, | ||
365 | (void *)(long)mipspmu->num_counters, 1); | ||
366 | mipspmu_free_irq(); | ||
367 | mutex_unlock(&pmu_reserve_mutex); | ||
368 | } | ||
369 | } | ||
370 | |||
371 | static int mipspmu_event_init(struct perf_event *event) | ||
372 | { | ||
373 | int err = 0; | ||
374 | |||
375 | switch (event->attr.type) { | ||
376 | case PERF_TYPE_RAW: | ||
377 | case PERF_TYPE_HARDWARE: | ||
378 | case PERF_TYPE_HW_CACHE: | ||
379 | break; | ||
380 | |||
381 | default: | ||
382 | return -ENOENT; | ||
383 | } | ||
384 | |||
385 | if (!mipspmu || event->cpu >= nr_cpumask_bits || | ||
386 | (event->cpu >= 0 && !cpu_online(event->cpu))) | ||
387 | return -ENODEV; | ||
388 | |||
389 | if (!atomic_inc_not_zero(&active_events)) { | ||
390 | if (atomic_read(&active_events) > MIPS_MAX_HWEVENTS) { | ||
391 | atomic_dec(&active_events); | ||
392 | return -ENOSPC; | ||
393 | } | ||
394 | |||
395 | mutex_lock(&pmu_reserve_mutex); | ||
396 | if (atomic_read(&active_events) == 0) | ||
397 | err = mipspmu_get_irq(); | ||
398 | |||
399 | if (!err) | ||
400 | atomic_inc(&active_events); | ||
401 | mutex_unlock(&pmu_reserve_mutex); | ||
402 | } | ||
403 | |||
404 | if (err) | ||
405 | return err; | ||
406 | |||
407 | err = __hw_perf_event_init(event); | ||
408 | if (err) | ||
409 | hw_perf_event_destroy(event); | ||
410 | |||
411 | return err; | ||
412 | } | ||
413 | |||
414 | static struct pmu pmu = { | ||
415 | .pmu_enable = mipspmu_enable, | ||
416 | .pmu_disable = mipspmu_disable, | ||
417 | .event_init = mipspmu_event_init, | ||
418 | .add = mipspmu_add, | ||
419 | .del = mipspmu_del, | ||
420 | .start = mipspmu_start, | ||
421 | .stop = mipspmu_stop, | ||
422 | .read = mipspmu_read, | ||
423 | }; | ||
424 | |||
321 | static inline unsigned int | 425 | static inline unsigned int |
322 | mipspmu_perf_event_encode(const struct mips_perf_event *pev) | 426 | mipspmu_perf_event_encode(const struct mips_perf_event *pev) |
323 | { | 427 | { |
@@ -382,8 +486,9 @@ static int validate_event(struct cpu_hw_events *cpuc, | |||
382 | { | 486 | { |
383 | struct hw_perf_event fake_hwc = event->hw; | 487 | struct hw_perf_event fake_hwc = event->hw; |
384 | 488 | ||
385 | if (event->pmu && event->pmu != &pmu) | 489 | /* Allow mixed event group. So return 1 to pass validation. */ |
386 | return 0; | 490 | if (event->pmu != &pmu || event->state <= PERF_EVENT_STATE_OFF) |
491 | return 1; | ||
387 | 492 | ||
388 | return mipspmu->alloc_counter(cpuc, &fake_hwc) >= 0; | 493 | return mipspmu->alloc_counter(cpuc, &fake_hwc) >= 0; |
389 | } | 494 | } |
@@ -409,73 +514,6 @@ static int validate_group(struct perf_event *event) | |||
409 | return 0; | 514 | return 0; |
410 | } | 515 | } |
411 | 516 | ||
412 | /* | ||
413 | * mipsxx/rm9000/loongson2 have different performance counters, they have | ||
414 | * specific low-level init routines. | ||
415 | */ | ||
416 | static void reset_counters(void *arg); | ||
417 | static int __hw_perf_event_init(struct perf_event *event); | ||
418 | |||
419 | static void hw_perf_event_destroy(struct perf_event *event) | ||
420 | { | ||
421 | if (atomic_dec_and_mutex_lock(&active_events, | ||
422 | &pmu_reserve_mutex)) { | ||
423 | /* | ||
424 | * We must not call the destroy function with interrupts | ||
425 | * disabled. | ||
426 | */ | ||
427 | on_each_cpu(reset_counters, | ||
428 | (void *)(long)mipspmu->num_counters, 1); | ||
429 | mipspmu_free_irq(); | ||
430 | mutex_unlock(&pmu_reserve_mutex); | ||
431 | } | ||
432 | } | ||
433 | |||
434 | const struct pmu *hw_perf_event_init(struct perf_event *event) | ||
435 | { | ||
436 | int err = 0; | ||
437 | |||
438 | if (!mipspmu || event->cpu >= nr_cpumask_bits || | ||
439 | (event->cpu >= 0 && !cpu_online(event->cpu))) | ||
440 | return ERR_PTR(-ENODEV); | ||
441 | |||
442 | if (!atomic_inc_not_zero(&active_events)) { | ||
443 | if (atomic_read(&active_events) > MIPS_MAX_HWEVENTS) { | ||
444 | atomic_dec(&active_events); | ||
445 | return ERR_PTR(-ENOSPC); | ||
446 | } | ||
447 | |||
448 | mutex_lock(&pmu_reserve_mutex); | ||
449 | if (atomic_read(&active_events) == 0) | ||
450 | err = mipspmu_get_irq(); | ||
451 | |||
452 | if (!err) | ||
453 | atomic_inc(&active_events); | ||
454 | mutex_unlock(&pmu_reserve_mutex); | ||
455 | } | ||
456 | |||
457 | if (err) | ||
458 | return ERR_PTR(err); | ||
459 | |||
460 | err = __hw_perf_event_init(event); | ||
461 | if (err) | ||
462 | hw_perf_event_destroy(event); | ||
463 | |||
464 | return err ? ERR_PTR(err) : &pmu; | ||
465 | } | ||
466 | |||
467 | void hw_perf_enable(void) | ||
468 | { | ||
469 | if (mipspmu) | ||
470 | mipspmu->start(); | ||
471 | } | ||
472 | |||
473 | void hw_perf_disable(void) | ||
474 | { | ||
475 | if (mipspmu) | ||
476 | mipspmu->stop(); | ||
477 | } | ||
478 | |||
479 | /* This is needed by specific irq handlers in perf_event_*.c */ | 517 | /* This is needed by specific irq handlers in perf_event_*.c */ |
480 | static void | 518 | static void |
481 | handle_associated_event(struct cpu_hw_events *cpuc, | 519 | handle_associated_event(struct cpu_hw_events *cpuc, |
@@ -496,21 +534,13 @@ handle_associated_event(struct cpu_hw_events *cpuc, | |||
496 | #include "perf_event_mipsxx.c" | 534 | #include "perf_event_mipsxx.c" |
497 | 535 | ||
498 | /* Callchain handling code. */ | 536 | /* Callchain handling code. */ |
499 | static inline void | ||
500 | callchain_store(struct perf_callchain_entry *entry, | ||
501 | u64 ip) | ||
502 | { | ||
503 | if (entry->nr < PERF_MAX_STACK_DEPTH) | ||
504 | entry->ip[entry->nr++] = ip; | ||
505 | } | ||
506 | 537 | ||
507 | /* | 538 | /* |
508 | * Leave userspace callchain empty for now. When we find a way to trace | 539 | * Leave userspace callchain empty for now. When we find a way to trace |
509 | * the user stack callchains, we add here. | 540 | * the user stack callchains, we add here. |
510 | */ | 541 | */ |
511 | static void | 542 | void perf_callchain_user(struct perf_callchain_entry *entry, |
512 | perf_callchain_user(struct pt_regs *regs, | 543 | struct pt_regs *regs) |
513 | struct perf_callchain_entry *entry) | ||
514 | { | 544 | { |
515 | } | 545 | } |
516 | 546 | ||
@@ -523,23 +553,21 @@ static void save_raw_perf_callchain(struct perf_callchain_entry *entry, | |||
523 | while (!kstack_end(sp)) { | 553 | while (!kstack_end(sp)) { |
524 | addr = *sp++; | 554 | addr = *sp++; |
525 | if (__kernel_text_address(addr)) { | 555 | if (__kernel_text_address(addr)) { |
526 | callchain_store(entry, addr); | 556 | perf_callchain_store(entry, addr); |
527 | if (entry->nr >= PERF_MAX_STACK_DEPTH) | 557 | if (entry->nr >= PERF_MAX_STACK_DEPTH) |
528 | break; | 558 | break; |
529 | } | 559 | } |
530 | } | 560 | } |
531 | } | 561 | } |
532 | 562 | ||
533 | static void | 563 | void perf_callchain_kernel(struct perf_callchain_entry *entry, |
534 | perf_callchain_kernel(struct pt_regs *regs, | 564 | struct pt_regs *regs) |
535 | struct perf_callchain_entry *entry) | ||
536 | { | 565 | { |
537 | unsigned long sp = regs->regs[29]; | 566 | unsigned long sp = regs->regs[29]; |
538 | #ifdef CONFIG_KALLSYMS | 567 | #ifdef CONFIG_KALLSYMS |
539 | unsigned long ra = regs->regs[31]; | 568 | unsigned long ra = regs->regs[31]; |
540 | unsigned long pc = regs->cp0_epc; | 569 | unsigned long pc = regs->cp0_epc; |
541 | 570 | ||
542 | callchain_store(entry, PERF_CONTEXT_KERNEL); | ||
543 | if (raw_show_trace || !__kernel_text_address(pc)) { | 571 | if (raw_show_trace || !__kernel_text_address(pc)) { |
544 | unsigned long stack_page = | 572 | unsigned long stack_page = |
545 | (unsigned long)task_stack_page(current); | 573 | (unsigned long)task_stack_page(current); |
@@ -549,53 +577,12 @@ perf_callchain_kernel(struct pt_regs *regs, | |||
549 | return; | 577 | return; |
550 | } | 578 | } |
551 | do { | 579 | do { |
552 | callchain_store(entry, pc); | 580 | perf_callchain_store(entry, pc); |
553 | if (entry->nr >= PERF_MAX_STACK_DEPTH) | 581 | if (entry->nr >= PERF_MAX_STACK_DEPTH) |
554 | break; | 582 | break; |
555 | pc = unwind_stack(current, &sp, pc, &ra); | 583 | pc = unwind_stack(current, &sp, pc, &ra); |
556 | } while (pc); | 584 | } while (pc); |
557 | #else | 585 | #else |
558 | callchain_store(entry, PERF_CONTEXT_KERNEL); | ||
559 | save_raw_perf_callchain(entry, sp); | 586 | save_raw_perf_callchain(entry, sp); |
560 | #endif | 587 | #endif |
561 | } | 588 | } |
562 | |||
563 | static void | ||
564 | perf_do_callchain(struct pt_regs *regs, | ||
565 | struct perf_callchain_entry *entry) | ||
566 | { | ||
567 | int is_user; | ||
568 | |||
569 | if (!regs) | ||
570 | return; | ||
571 | |||
572 | is_user = user_mode(regs); | ||
573 | |||
574 | if (!current || !current->pid) | ||
575 | return; | ||
576 | |||
577 | if (is_user && current->state != TASK_RUNNING) | ||
578 | return; | ||
579 | |||
580 | if (!is_user) { | ||
581 | perf_callchain_kernel(regs, entry); | ||
582 | if (current->mm) | ||
583 | regs = task_pt_regs(current); | ||
584 | else | ||
585 | regs = NULL; | ||
586 | } | ||
587 | if (regs) | ||
588 | perf_callchain_user(regs, entry); | ||
589 | } | ||
590 | |||
591 | static DEFINE_PER_CPU(struct perf_callchain_entry, pmc_irq_entry); | ||
592 | |||
593 | struct perf_callchain_entry * | ||
594 | perf_callchain(struct pt_regs *regs) | ||
595 | { | ||
596 | struct perf_callchain_entry *entry = &__get_cpu_var(pmc_irq_entry); | ||
597 | |||
598 | entry->nr = 0; | ||
599 | perf_do_callchain(regs, entry); | ||
600 | return entry; | ||
601 | } | ||
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c index 183e0d226669..d9a7db78ed62 100644 --- a/arch/mips/kernel/perf_event_mipsxx.c +++ b/arch/mips/kernel/perf_event_mipsxx.c | |||
@@ -696,7 +696,7 @@ static int mipsxx_pmu_handle_shared_irq(void) | |||
696 | * interrupt, not NMI. | 696 | * interrupt, not NMI. |
697 | */ | 697 | */ |
698 | if (handled == IRQ_HANDLED) | 698 | if (handled == IRQ_HANDLED) |
699 | perf_event_do_pending(); | 699 | irq_work_run(); |
700 | 700 | ||
701 | #ifdef CONFIG_MIPS_MT_SMP | 701 | #ifdef CONFIG_MIPS_MT_SMP |
702 | read_unlock(&pmuint_rwlock); | 702 | read_unlock(&pmuint_rwlock); |
@@ -1045,6 +1045,8 @@ init_hw_perf_events(void) | |||
1045 | "CPU, irq %d%s\n", mipspmu->name, counters, irq, | 1045 | "CPU, irq %d%s\n", mipspmu->name, counters, irq, |
1046 | irq < 0 ? " (share with timer interrupt)" : ""); | 1046 | irq < 0 ? " (share with timer interrupt)" : ""); |
1047 | 1047 | ||
1048 | perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW); | ||
1049 | |||
1048 | return 0; | 1050 | return 0; |
1049 | } | 1051 | } |
1050 | early_initcall(init_hw_perf_events); | 1052 | early_initcall(init_hw_perf_events); |
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c index 5922342bca39..dbbe0ce48d89 100644 --- a/arch/mips/kernel/signal.c +++ b/arch/mips/kernel/signal.c | |||
@@ -84,7 +84,7 @@ static int protected_save_fp_context(struct sigcontext __user *sc) | |||
84 | 84 | ||
85 | static int protected_restore_fp_context(struct sigcontext __user *sc) | 85 | static int protected_restore_fp_context(struct sigcontext __user *sc) |
86 | { | 86 | { |
87 | int err, tmp; | 87 | int err, tmp __maybe_unused; |
88 | while (1) { | 88 | while (1) { |
89 | lock_fpu_owner(); | 89 | lock_fpu_owner(); |
90 | own_fpu_inatomic(0); | 90 | own_fpu_inatomic(0); |
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c index a0ed0e052b2e..aae986613795 100644 --- a/arch/mips/kernel/signal32.c +++ b/arch/mips/kernel/signal32.c | |||
@@ -115,7 +115,7 @@ static int protected_save_fp_context32(struct sigcontext32 __user *sc) | |||
115 | 115 | ||
116 | static int protected_restore_fp_context32(struct sigcontext32 __user *sc) | 116 | static int protected_restore_fp_context32(struct sigcontext32 __user *sc) |
117 | { | 117 | { |
118 | int err, tmp; | 118 | int err, tmp __maybe_unused; |
119 | while (1) { | 119 | while (1) { |
120 | lock_fpu_owner(); | 120 | lock_fpu_owner(); |
121 | own_fpu_inatomic(0); | 121 | own_fpu_inatomic(0); |
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 383aeb95cb49..32a256101082 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -193,6 +193,22 @@ void __devinit smp_prepare_boot_cpu(void) | |||
193 | */ | 193 | */ |
194 | static struct task_struct *cpu_idle_thread[NR_CPUS]; | 194 | static struct task_struct *cpu_idle_thread[NR_CPUS]; |
195 | 195 | ||
196 | struct create_idle { | ||
197 | struct work_struct work; | ||
198 | struct task_struct *idle; | ||
199 | struct completion done; | ||
200 | int cpu; | ||
201 | }; | ||
202 | |||
203 | static void __cpuinit do_fork_idle(struct work_struct *work) | ||
204 | { | ||
205 | struct create_idle *c_idle = | ||
206 | container_of(work, struct create_idle, work); | ||
207 | |||
208 | c_idle->idle = fork_idle(c_idle->cpu); | ||
209 | complete(&c_idle->done); | ||
210 | } | ||
211 | |||
196 | int __cpuinit __cpu_up(unsigned int cpu) | 212 | int __cpuinit __cpu_up(unsigned int cpu) |
197 | { | 213 | { |
198 | struct task_struct *idle; | 214 | struct task_struct *idle; |
@@ -203,8 +219,19 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
203 | * Linux can schedule processes on this slave. | 219 | * Linux can schedule processes on this slave. |
204 | */ | 220 | */ |
205 | if (!cpu_idle_thread[cpu]) { | 221 | if (!cpu_idle_thread[cpu]) { |
206 | idle = fork_idle(cpu); | 222 | /* |
207 | cpu_idle_thread[cpu] = idle; | 223 | * Schedule work item to avoid forking user task |
224 | * Ported from arch/x86/kernel/smpboot.c | ||
225 | */ | ||
226 | struct create_idle c_idle = { | ||
227 | .cpu = cpu, | ||
228 | .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done), | ||
229 | }; | ||
230 | |||
231 | INIT_WORK_ONSTACK(&c_idle.work, do_fork_idle); | ||
232 | schedule_work(&c_idle.work); | ||
233 | wait_for_completion(&c_idle.done); | ||
234 | idle = cpu_idle_thread[cpu] = c_idle.idle; | ||
208 | 235 | ||
209 | if (IS_ERR(idle)) | 236 | if (IS_ERR(idle)) |
210 | panic(KERN_ERR "Fork failed for CPU %d", cpu); | 237 | panic(KERN_ERR "Fork failed for CPU %d", cpu); |
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index 1dc6edff45e0..58beabf50b3c 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c | |||
@@ -383,12 +383,11 @@ save_static_function(sys_sysmips); | |||
383 | static int __used noinline | 383 | static int __used noinline |
384 | _sys_sysmips(nabi_no_regargs struct pt_regs regs) | 384 | _sys_sysmips(nabi_no_regargs struct pt_regs regs) |
385 | { | 385 | { |
386 | long cmd, arg1, arg2, arg3; | 386 | long cmd, arg1, arg2; |
387 | 387 | ||
388 | cmd = regs.regs[4]; | 388 | cmd = regs.regs[4]; |
389 | arg1 = regs.regs[5]; | 389 | arg1 = regs.regs[5]; |
390 | arg2 = regs.regs[6]; | 390 | arg2 = regs.regs[6]; |
391 | arg3 = regs.regs[7]; | ||
392 | 391 | ||
393 | switch (cmd) { | 392 | switch (cmd) { |
394 | case MIPS_ATOMIC_SET: | 393 | case MIPS_ATOMIC_SET: |
@@ -405,7 +404,7 @@ _sys_sysmips(nabi_no_regargs struct pt_regs regs) | |||
405 | if (arg1 & 2) | 404 | if (arg1 & 2) |
406 | set_thread_flag(TIF_LOGADE); | 405 | set_thread_flag(TIF_LOGADE); |
407 | else | 406 | else |
408 | clear_thread_flag(TIF_FIXADE); | 407 | clear_thread_flag(TIF_LOGADE); |
409 | 408 | ||
410 | return 0; | 409 | return 0; |
411 | 410 | ||
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c index 6a1fdfef8fde..ab52b7cf3b6b 100644 --- a/arch/mips/kernel/vpe.c +++ b/arch/mips/kernel/vpe.c | |||
@@ -148,9 +148,9 @@ struct { | |||
148 | spinlock_t tc_list_lock; | 148 | spinlock_t tc_list_lock; |
149 | struct list_head tc_list; /* Thread contexts */ | 149 | struct list_head tc_list; /* Thread contexts */ |
150 | } vpecontrol = { | 150 | } vpecontrol = { |
151 | .vpe_list_lock = SPIN_LOCK_UNLOCKED, | 151 | .vpe_list_lock = __SPIN_LOCK_UNLOCKED(vpe_list_lock), |
152 | .vpe_list = LIST_HEAD_INIT(vpecontrol.vpe_list), | 152 | .vpe_list = LIST_HEAD_INIT(vpecontrol.vpe_list), |
153 | .tc_list_lock = SPIN_LOCK_UNLOCKED, | 153 | .tc_list_lock = __SPIN_LOCK_UNLOCKED(tc_list_lock), |
154 | .tc_list = LIST_HEAD_INIT(vpecontrol.tc_list) | 154 | .tc_list = LIST_HEAD_INIT(vpecontrol.tc_list) |
155 | }; | 155 | }; |
156 | 156 | ||
diff --git a/arch/mips/loongson/Kconfig b/arch/mips/loongson/Kconfig index 6e1b77fec7ea..aca93eed8779 100644 --- a/arch/mips/loongson/Kconfig +++ b/arch/mips/loongson/Kconfig | |||
@@ -1,6 +1,7 @@ | |||
1 | if MACH_LOONGSON | ||
2 | |||
1 | choice | 3 | choice |
2 | prompt "Machine Type" | 4 | prompt "Machine Type" |
3 | depends on MACH_LOONGSON | ||
4 | 5 | ||
5 | config LEMOTE_FULOONG2E | 6 | config LEMOTE_FULOONG2E |
6 | bool "Lemote Fuloong(2e) mini-PC" | 7 | bool "Lemote Fuloong(2e) mini-PC" |
@@ -87,3 +88,5 @@ config LOONGSON_UART_BASE | |||
87 | config LOONGSON_MC146818 | 88 | config LOONGSON_MC146818 |
88 | bool | 89 | bool |
89 | default n | 90 | default n |
91 | |||
92 | endif # MACH_LOONGSON | ||
diff --git a/arch/mips/loongson/common/cmdline.c b/arch/mips/loongson/common/cmdline.c index 1a06defc4f7f..353e1d2e41a5 100644 --- a/arch/mips/loongson/common/cmdline.c +++ b/arch/mips/loongson/common/cmdline.c | |||
@@ -44,10 +44,5 @@ void __init prom_init_cmdline(void) | |||
44 | strcat(arcs_cmdline, " "); | 44 | strcat(arcs_cmdline, " "); |
45 | } | 45 | } |
46 | 46 | ||
47 | if ((strstr(arcs_cmdline, "console=")) == NULL) | ||
48 | strcat(arcs_cmdline, " console=ttyS0,115200"); | ||
49 | if ((strstr(arcs_cmdline, "root=")) == NULL) | ||
50 | strcat(arcs_cmdline, " root=/dev/hda1"); | ||
51 | |||
52 | prom_init_machtype(); | 47 | prom_init_machtype(); |
53 | } | 48 | } |
diff --git a/arch/mips/loongson/common/machtype.c b/arch/mips/loongson/common/machtype.c index 81fbe6b73f91..2efd5d9dee27 100644 --- a/arch/mips/loongson/common/machtype.c +++ b/arch/mips/loongson/common/machtype.c | |||
@@ -41,7 +41,7 @@ void __weak __init mach_prom_init_machtype(void) | |||
41 | 41 | ||
42 | void __init prom_init_machtype(void) | 42 | void __init prom_init_machtype(void) |
43 | { | 43 | { |
44 | char *p, str[MACHTYPE_LEN]; | 44 | char *p, str[MACHTYPE_LEN + 1]; |
45 | int machtype = MACH_LEMOTE_FL2E; | 45 | int machtype = MACH_LEMOTE_FL2E; |
46 | 46 | ||
47 | mips_machtype = LOONGSON_MACHTYPE; | 47 | mips_machtype = LOONGSON_MACHTYPE; |
@@ -53,6 +53,7 @@ void __init prom_init_machtype(void) | |||
53 | } | 53 | } |
54 | p += strlen("machtype="); | 54 | p += strlen("machtype="); |
55 | strncpy(str, p, MACHTYPE_LEN); | 55 | strncpy(str, p, MACHTYPE_LEN); |
56 | str[MACHTYPE_LEN] = '\0'; | ||
56 | p = strstr(str, " "); | 57 | p = strstr(str, " "); |
57 | if (p) | 58 | if (p) |
58 | *p = '\0'; | 59 | *p = '\0'; |
diff --git a/arch/mips/math-emu/ieee754int.h b/arch/mips/math-emu/ieee754int.h index 2701d9500959..2a7d43f4f161 100644 --- a/arch/mips/math-emu/ieee754int.h +++ b/arch/mips/math-emu/ieee754int.h | |||
@@ -70,7 +70,7 @@ | |||
70 | 70 | ||
71 | 71 | ||
72 | #define COMPXSP \ | 72 | #define COMPXSP \ |
73 | unsigned xm; int xe; int xs; int xc | 73 | unsigned xm; int xe; int xs __maybe_unused; int xc |
74 | 74 | ||
75 | #define COMPYSP \ | 75 | #define COMPYSP \ |
76 | unsigned ym; int ye; int ys; int yc | 76 | unsigned ym; int ye; int ys; int yc |
@@ -104,7 +104,7 @@ | |||
104 | 104 | ||
105 | 105 | ||
106 | #define COMPXDP \ | 106 | #define COMPXDP \ |
107 | u64 xm; int xe; int xs; int xc | 107 | u64 xm; int xe; int xs __maybe_unused; int xc |
108 | 108 | ||
109 | #define COMPYDP \ | 109 | #define COMPYDP \ |
110 | u64 ym; int ye; int ys; int yc | 110 | u64 ym; int ye; int ys; int yc |
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index 2efcbd24c82f..279599e9a779 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c | |||
@@ -324,7 +324,7 @@ int page_is_ram(unsigned long pagenr) | |||
324 | void __init paging_init(void) | 324 | void __init paging_init(void) |
325 | { | 325 | { |
326 | unsigned long max_zone_pfns[MAX_NR_ZONES]; | 326 | unsigned long max_zone_pfns[MAX_NR_ZONES]; |
327 | unsigned long lastpfn; | 327 | unsigned long lastpfn __maybe_unused; |
328 | 328 | ||
329 | pagetable_init(); | 329 | pagetable_init(); |
330 | 330 | ||
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c index 083d3412d0bc..04f9e17db9d0 100644 --- a/arch/mips/mm/tlbex.c +++ b/arch/mips/mm/tlbex.c | |||
@@ -109,6 +109,8 @@ static bool scratchpad_available(void) | |||
109 | static int scratchpad_offset(int i) | 109 | static int scratchpad_offset(int i) |
110 | { | 110 | { |
111 | BUG(); | 111 | BUG(); |
112 | /* Really unreachable, but evidently some GCC want this. */ | ||
113 | return 0; | ||
112 | } | 114 | } |
113 | #endif | 115 | #endif |
114 | /* | 116 | /* |
diff --git a/arch/mips/pci/ops-pmcmsp.c b/arch/mips/pci/ops-pmcmsp.c index b7c03d80c88c..68798f869c0f 100644 --- a/arch/mips/pci/ops-pmcmsp.c +++ b/arch/mips/pci/ops-pmcmsp.c | |||
@@ -308,7 +308,7 @@ static struct resource pci_mem_resource = { | |||
308 | * RETURNS: PCIBIOS_SUCCESSFUL - success | 308 | * RETURNS: PCIBIOS_SUCCESSFUL - success |
309 | * | 309 | * |
310 | ****************************************************************************/ | 310 | ****************************************************************************/ |
311 | static int bpci_interrupt(int irq, void *dev_id) | 311 | static irqreturn_t bpci_interrupt(int irq, void *dev_id) |
312 | { | 312 | { |
313 | struct msp_pci_regs *preg = (void *)PCI_BASE_REG; | 313 | struct msp_pci_regs *preg = (void *)PCI_BASE_REG; |
314 | unsigned int stat = preg->if_status; | 314 | unsigned int stat = preg->if_status; |
@@ -326,7 +326,7 @@ static int bpci_interrupt(int irq, void *dev_id) | |||
326 | /* write to clear all asserted interrupts */ | 326 | /* write to clear all asserted interrupts */ |
327 | preg->if_status = stat; | 327 | preg->if_status = stat; |
328 | 328 | ||
329 | return PCIBIOS_SUCCESSFUL; | 329 | return IRQ_HANDLED; |
330 | } | 330 | } |
331 | 331 | ||
332 | /***************************************************************************** | 332 | /***************************************************************************** |
diff --git a/arch/mips/pmc-sierra/Kconfig b/arch/mips/pmc-sierra/Kconfig index c139988bb85d..8d798497c614 100644 --- a/arch/mips/pmc-sierra/Kconfig +++ b/arch/mips/pmc-sierra/Kconfig | |||
@@ -4,15 +4,11 @@ choice | |||
4 | 4 | ||
5 | config PMC_MSP4200_EVAL | 5 | config PMC_MSP4200_EVAL |
6 | bool "PMC-Sierra MSP4200 Eval Board" | 6 | bool "PMC-Sierra MSP4200 Eval Board" |
7 | select CEVT_R4K | ||
8 | select CSRC_R4K | ||
9 | select IRQ_MSP_SLP | 7 | select IRQ_MSP_SLP |
10 | select HW_HAS_PCI | 8 | select HW_HAS_PCI |
11 | 9 | ||
12 | config PMC_MSP4200_GW | 10 | config PMC_MSP4200_GW |
13 | bool "PMC-Sierra MSP4200 VoIP Gateway" | 11 | bool "PMC-Sierra MSP4200 VoIP Gateway" |
14 | select CEVT_R4K | ||
15 | select CSRC_R4K | ||
16 | select IRQ_MSP_SLP | 12 | select IRQ_MSP_SLP |
17 | select HW_HAS_PCI | 13 | select HW_HAS_PCI |
18 | 14 | ||
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_time.c b/arch/mips/pmc-sierra/msp71xx/msp_time.c index cca64e15f57f..01df84ce31e2 100644 --- a/arch/mips/pmc-sierra/msp71xx/msp_time.c +++ b/arch/mips/pmc-sierra/msp71xx/msp_time.c | |||
@@ -81,7 +81,7 @@ void __init plat_time_init(void) | |||
81 | mips_hpt_frequency = cpu_rate/2; | 81 | mips_hpt_frequency = cpu_rate/2; |
82 | } | 82 | } |
83 | 83 | ||
84 | unsigned int __init get_c0_compare_int(void) | 84 | unsigned int __cpuinit get_c0_compare_int(void) |
85 | { | 85 | { |
86 | return MSP_INT_VPE0_TIMER; | 86 | return MSP_INT_VPE0_TIMER; |
87 | } | 87 | } |
diff --git a/arch/mn10300/include/asm/atomic.h b/arch/mn10300/include/asm/atomic.h index 92d2f9298e38..9d773a639513 100644 --- a/arch/mn10300/include/asm/atomic.h +++ b/arch/mn10300/include/asm/atomic.h | |||
@@ -139,7 +139,7 @@ static inline unsigned long __cmpxchg(volatile unsigned long *m, | |||
139 | * Atomically reads the value of @v. Note that the guaranteed | 139 | * Atomically reads the value of @v. Note that the guaranteed |
140 | * useful range of an atomic_t is only 24 bits. | 140 | * useful range of an atomic_t is only 24 bits. |
141 | */ | 141 | */ |
142 | #define atomic_read(v) ((v)->counter) | 142 | #define atomic_read(v) (ACCESS_ONCE((v)->counter)) |
143 | 143 | ||
144 | /** | 144 | /** |
145 | * atomic_set - set atomic variable | 145 | * atomic_set - set atomic variable |
diff --git a/arch/mn10300/include/asm/uaccess.h b/arch/mn10300/include/asm/uaccess.h index 679dee0bbd08..3d6e60dad9d9 100644 --- a/arch/mn10300/include/asm/uaccess.h +++ b/arch/mn10300/include/asm/uaccess.h | |||
@@ -160,9 +160,10 @@ struct __large_struct { unsigned long buf[100]; }; | |||
160 | 160 | ||
161 | #define __get_user_check(x, ptr, size) \ | 161 | #define __get_user_check(x, ptr, size) \ |
162 | ({ \ | 162 | ({ \ |
163 | const __typeof__(ptr) __guc_ptr = (ptr); \ | ||
163 | int _e; \ | 164 | int _e; \ |
164 | if (likely(__access_ok((unsigned long) (ptr), (size)))) \ | 165 | if (likely(__access_ok((unsigned long) __guc_ptr, (size)))) \ |
165 | _e = __get_user_nocheck((x), (ptr), (size)); \ | 166 | _e = __get_user_nocheck((x), __guc_ptr, (size)); \ |
166 | else { \ | 167 | else { \ |
167 | _e = -EFAULT; \ | 168 | _e = -EFAULT; \ |
168 | (x) = (__typeof__(x))0; \ | 169 | (x) = (__typeof__(x))0; \ |
diff --git a/arch/mn10300/mm/cache-inv-icache.c b/arch/mn10300/mm/cache-inv-icache.c index a8933a60b2d4..a6b63dde603d 100644 --- a/arch/mn10300/mm/cache-inv-icache.c +++ b/arch/mn10300/mm/cache-inv-icache.c | |||
@@ -69,7 +69,7 @@ static void flush_icache_page_range(unsigned long start, unsigned long end) | |||
69 | 69 | ||
70 | /* invalidate the icache coverage on that region */ | 70 | /* invalidate the icache coverage on that region */ |
71 | mn10300_local_icache_inv_range2(addr + off, size); | 71 | mn10300_local_icache_inv_range2(addr + off, size); |
72 | smp_cache_call(SMP_ICACHE_INV_FLUSH_RANGE, start, end); | 72 | smp_cache_call(SMP_ICACHE_INV_RANGE, start, end); |
73 | } | 73 | } |
74 | 74 | ||
75 | /** | 75 | /** |
@@ -101,7 +101,7 @@ void flush_icache_range(unsigned long start, unsigned long end) | |||
101 | * directly */ | 101 | * directly */ |
102 | start_page = (start >= 0x80000000UL) ? start : 0x80000000UL; | 102 | start_page = (start >= 0x80000000UL) ? start : 0x80000000UL; |
103 | mn10300_icache_inv_range(start_page, end); | 103 | mn10300_icache_inv_range(start_page, end); |
104 | smp_cache_call(SMP_ICACHE_INV_FLUSH_RANGE, start, end); | 104 | smp_cache_call(SMP_ICACHE_INV_RANGE, start, end); |
105 | if (start_page == start) | 105 | if (start_page == start) |
106 | goto done; | 106 | goto done; |
107 | end = start_page; | 107 | end = start_page; |
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c index 30394081d9b6..6ab9580b0b00 100644 --- a/arch/parisc/hpux/sys_hpux.c +++ b/arch/parisc/hpux/sys_hpux.c | |||
@@ -185,26 +185,21 @@ struct hpux_statfs { | |||
185 | int16_t f_pad; | 185 | int16_t f_pad; |
186 | }; | 186 | }; |
187 | 187 | ||
188 | static int do_statfs_hpux(struct path *path, struct hpux_statfs *buf) | 188 | static int do_statfs_hpux(struct kstatfs *st, struct hpux_statfs __user *p) |
189 | { | 189 | { |
190 | struct kstatfs st; | 190 | struct hpux_statfs buf; |
191 | int retval; | 191 | memset(&buf, 0, sizeof(buf)); |
192 | 192 | buf.f_type = st->f_type; | |
193 | retval = vfs_statfs(path, &st); | 193 | buf.f_bsize = st->f_bsize; |
194 | if (retval) | 194 | buf.f_blocks = st->f_blocks; |
195 | return retval; | 195 | buf.f_bfree = st->f_bfree; |
196 | 196 | buf.f_bavail = st->f_bavail; | |
197 | memset(buf, 0, sizeof(*buf)); | 197 | buf.f_files = st->f_files; |
198 | buf->f_type = st.f_type; | 198 | buf.f_ffree = st->f_ffree; |
199 | buf->f_bsize = st.f_bsize; | 199 | buf.f_fsid[0] = st->f_fsid.val[0]; |
200 | buf->f_blocks = st.f_blocks; | 200 | buf.f_fsid[1] = st->f_fsid.val[1]; |
201 | buf->f_bfree = st.f_bfree; | 201 | if (copy_to_user(p, &buf, sizeof(buf))) |
202 | buf->f_bavail = st.f_bavail; | 202 | return -EFAULT; |
203 | buf->f_files = st.f_files; | ||
204 | buf->f_ffree = st.f_ffree; | ||
205 | buf->f_fsid[0] = st.f_fsid.val[0]; | ||
206 | buf->f_fsid[1] = st.f_fsid.val[1]; | ||
207 | |||
208 | return 0; | 203 | return 0; |
209 | } | 204 | } |
210 | 205 | ||
@@ -212,35 +207,19 @@ static int do_statfs_hpux(struct path *path, struct hpux_statfs *buf) | |||
212 | asmlinkage long hpux_statfs(const char __user *pathname, | 207 | asmlinkage long hpux_statfs(const char __user *pathname, |
213 | struct hpux_statfs __user *buf) | 208 | struct hpux_statfs __user *buf) |
214 | { | 209 | { |
215 | struct path path; | 210 | struct kstatfs st; |
216 | int error; | 211 | int error = user_statfs(pathname, &st); |
217 | 212 | if (!error) | |
218 | error = user_path(pathname, &path); | 213 | error = do_statfs_hpux(&st, buf); |
219 | if (!error) { | ||
220 | struct hpux_statfs tmp; | ||
221 | error = do_statfs_hpux(&path, &tmp); | ||
222 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | ||
223 | error = -EFAULT; | ||
224 | path_put(&path); | ||
225 | } | ||
226 | return error; | 214 | return error; |
227 | } | 215 | } |
228 | 216 | ||
229 | asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf) | 217 | asmlinkage long hpux_fstatfs(unsigned int fd, struct hpux_statfs __user * buf) |
230 | { | 218 | { |
231 | struct file *file; | 219 | struct kstatfs st; |
232 | struct hpux_statfs tmp; | 220 | int error = fd_statfs(fd, &st); |
233 | int error; | 221 | if (!error) |
234 | 222 | error = do_statfs_hpux(&st, buf); | |
235 | error = -EBADF; | ||
236 | file = fget(fd); | ||
237 | if (!file) | ||
238 | goto out; | ||
239 | error = do_statfs_hpux(&file->f_path, &tmp); | ||
240 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | ||
241 | error = -EFAULT; | ||
242 | fput(file); | ||
243 | out: | ||
244 | return error; | 223 | return error; |
245 | } | 224 | } |
246 | 225 | ||
diff --git a/arch/powerpc/include/asm/lppaca.h b/arch/powerpc/include/asm/lppaca.h index 380d48bacd16..26b8c807f8f1 100644 --- a/arch/powerpc/include/asm/lppaca.h +++ b/arch/powerpc/include/asm/lppaca.h | |||
@@ -33,9 +33,25 @@ | |||
33 | // | 33 | // |
34 | //---------------------------------------------------------------------------- | 34 | //---------------------------------------------------------------------------- |
35 | #include <linux/cache.h> | 35 | #include <linux/cache.h> |
36 | #include <linux/threads.h> | ||
36 | #include <asm/types.h> | 37 | #include <asm/types.h> |
37 | #include <asm/mmu.h> | 38 | #include <asm/mmu.h> |
38 | 39 | ||
40 | /* | ||
41 | * We only have to have statically allocated lppaca structs on | ||
42 | * legacy iSeries, which supports at most 64 cpus. | ||
43 | */ | ||
44 | #ifdef CONFIG_PPC_ISERIES | ||
45 | #if NR_CPUS < 64 | ||
46 | #define NR_LPPACAS NR_CPUS | ||
47 | #else | ||
48 | #define NR_LPPACAS 64 | ||
49 | #endif | ||
50 | #else /* not iSeries */ | ||
51 | #define NR_LPPACAS 1 | ||
52 | #endif | ||
53 | |||
54 | |||
39 | /* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k | 55 | /* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k |
40 | * alignment is sufficient to prevent this */ | 56 | * alignment is sufficient to prevent this */ |
41 | struct lppaca { | 57 | struct lppaca { |
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h index 991d5998d6be..fe56a23e1ff0 100644 --- a/arch/powerpc/include/asm/machdep.h +++ b/arch/powerpc/include/asm/machdep.h | |||
@@ -240,6 +240,12 @@ struct machdep_calls { | |||
240 | * claims to support kexec. | 240 | * claims to support kexec. |
241 | */ | 241 | */ |
242 | int (*machine_kexec_prepare)(struct kimage *image); | 242 | int (*machine_kexec_prepare)(struct kimage *image); |
243 | |||
244 | /* Called to perform the _real_ kexec. | ||
245 | * Do NOT allocate memory or fail here. We are past the point of | ||
246 | * no return. | ||
247 | */ | ||
248 | void (*machine_kexec)(struct kimage *image); | ||
243 | #endif /* CONFIG_KEXEC */ | 249 | #endif /* CONFIG_KEXEC */ |
244 | 250 | ||
245 | #ifdef CONFIG_SUSPEND | 251 | #ifdef CONFIG_SUSPEND |
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c index 49a170af8145..a5f8672eeff3 100644 --- a/arch/powerpc/kernel/machine_kexec.c +++ b/arch/powerpc/kernel/machine_kexec.c | |||
@@ -87,7 +87,10 @@ void machine_kexec(struct kimage *image) | |||
87 | 87 | ||
88 | save_ftrace_enabled = __ftrace_enabled_save(); | 88 | save_ftrace_enabled = __ftrace_enabled_save(); |
89 | 89 | ||
90 | default_machine_kexec(image); | 90 | if (ppc_md.machine_kexec) |
91 | ppc_md.machine_kexec(image); | ||
92 | else | ||
93 | default_machine_kexec(image); | ||
91 | 94 | ||
92 | __ftrace_enabled_restore(save_ftrace_enabled); | 95 | __ftrace_enabled_restore(save_ftrace_enabled); |
93 | 96 | ||
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c index ebf9846f3c3b..f4adf89d7614 100644 --- a/arch/powerpc/kernel/paca.c +++ b/arch/powerpc/kernel/paca.c | |||
@@ -27,20 +27,6 @@ extern unsigned long __toc_start; | |||
27 | #ifdef CONFIG_PPC_BOOK3S | 27 | #ifdef CONFIG_PPC_BOOK3S |
28 | 28 | ||
29 | /* | 29 | /* |
30 | * We only have to have statically allocated lppaca structs on | ||
31 | * legacy iSeries, which supports at most 64 cpus. | ||
32 | */ | ||
33 | #ifdef CONFIG_PPC_ISERIES | ||
34 | #if NR_CPUS < 64 | ||
35 | #define NR_LPPACAS NR_CPUS | ||
36 | #else | ||
37 | #define NR_LPPACAS 64 | ||
38 | #endif | ||
39 | #else /* not iSeries */ | ||
40 | #define NR_LPPACAS 1 | ||
41 | #endif | ||
42 | |||
43 | /* | ||
44 | * The structure which the hypervisor knows about - this structure | 30 | * The structure which the hypervisor knows about - this structure |
45 | * should not cross a page boundary. The vpa_init/register_vpa call | 31 | * should not cross a page boundary. The vpa_init/register_vpa call |
46 | * is now known to fail if the lppaca structure crosses a page | 32 | * is now known to fail if the lppaca structure crosses a page |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 7a1d5cb76932..8303a6c65ef7 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -353,6 +353,7 @@ static void switch_booke_debug_regs(struct thread_struct *new_thread) | |||
353 | prime_debug_regs(new_thread); | 353 | prime_debug_regs(new_thread); |
354 | } | 354 | } |
355 | #else /* !CONFIG_PPC_ADV_DEBUG_REGS */ | 355 | #else /* !CONFIG_PPC_ADV_DEBUG_REGS */ |
356 | #ifndef CONFIG_HAVE_HW_BREAKPOINT | ||
356 | static void set_debug_reg_defaults(struct thread_struct *thread) | 357 | static void set_debug_reg_defaults(struct thread_struct *thread) |
357 | { | 358 | { |
358 | if (thread->dabr) { | 359 | if (thread->dabr) { |
@@ -360,6 +361,7 @@ static void set_debug_reg_defaults(struct thread_struct *thread) | |||
360 | set_dabr(0); | 361 | set_dabr(0); |
361 | } | 362 | } |
362 | } | 363 | } |
364 | #endif /* !CONFIG_HAVE_HW_BREAKPOINT */ | ||
363 | #endif /* CONFIG_PPC_ADV_DEBUG_REGS */ | 365 | #endif /* CONFIG_PPC_ADV_DEBUG_REGS */ |
364 | 366 | ||
365 | int set_dabr(unsigned long dabr) | 367 | int set_dabr(unsigned long dabr) |
@@ -670,11 +672,11 @@ void flush_thread(void) | |||
670 | { | 672 | { |
671 | discard_lazy_cpu_state(); | 673 | discard_lazy_cpu_state(); |
672 | 674 | ||
673 | #ifdef CONFIG_HAVE_HW_BREAKPOINTS | 675 | #ifdef CONFIG_HAVE_HW_BREAKPOINT |
674 | flush_ptrace_hw_breakpoint(current); | 676 | flush_ptrace_hw_breakpoint(current); |
675 | #else /* CONFIG_HAVE_HW_BREAKPOINTS */ | 677 | #else /* CONFIG_HAVE_HW_BREAKPOINT */ |
676 | set_debug_reg_defaults(¤t->thread); | 678 | set_debug_reg_defaults(¤t->thread); |
677 | #endif /* CONFIG_HAVE_HW_BREAKPOINTS */ | 679 | #endif /* CONFIG_HAVE_HW_BREAKPOINT */ |
678 | } | 680 | } |
679 | 681 | ||
680 | void | 682 | void |
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c index fd4812329570..0dc95c0aa3be 100644 --- a/arch/powerpc/mm/numa.c +++ b/arch/powerpc/mm/numa.c | |||
@@ -1516,7 +1516,8 @@ int start_topology_update(void) | |||
1516 | { | 1516 | { |
1517 | int rc = 0; | 1517 | int rc = 0; |
1518 | 1518 | ||
1519 | if (firmware_has_feature(FW_FEATURE_VPHN) && | 1519 | /* Disabled until races with load balancing are fixed */ |
1520 | if (0 && firmware_has_feature(FW_FEATURE_VPHN) && | ||
1520 | get_lppaca()->shared_proc) { | 1521 | get_lppaca()->shared_proc) { |
1521 | vphn_enabled = 1; | 1522 | vphn_enabled = 1; |
1522 | setup_cpu_associativity_change_counters(); | 1523 | setup_cpu_associativity_change_counters(); |
diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c index 1ec06576f619..c14d09f614f3 100644 --- a/arch/powerpc/mm/tlb_hash64.c +++ b/arch/powerpc/mm/tlb_hash64.c | |||
@@ -38,13 +38,11 @@ DEFINE_PER_CPU(struct ppc64_tlb_batch, ppc64_tlb_batch); | |||
38 | * neesd to be flushed. This function will either perform the flush | 38 | * neesd to be flushed. This function will either perform the flush |
39 | * immediately or will batch it up if the current CPU has an active | 39 | * immediately or will batch it up if the current CPU has an active |
40 | * batch on it. | 40 | * batch on it. |
41 | * | ||
42 | * Must be called from within some kind of spinlock/non-preempt region... | ||
43 | */ | 41 | */ |
44 | void hpte_need_flush(struct mm_struct *mm, unsigned long addr, | 42 | void hpte_need_flush(struct mm_struct *mm, unsigned long addr, |
45 | pte_t *ptep, unsigned long pte, int huge) | 43 | pte_t *ptep, unsigned long pte, int huge) |
46 | { | 44 | { |
47 | struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); | 45 | struct ppc64_tlb_batch *batch = &get_cpu_var(ppc64_tlb_batch); |
48 | unsigned long vsid, vaddr; | 46 | unsigned long vsid, vaddr; |
49 | unsigned int psize; | 47 | unsigned int psize; |
50 | int ssize; | 48 | int ssize; |
@@ -99,6 +97,7 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr, | |||
99 | */ | 97 | */ |
100 | if (!batch->active) { | 98 | if (!batch->active) { |
101 | flush_hash_page(vaddr, rpte, psize, ssize, 0); | 99 | flush_hash_page(vaddr, rpte, psize, ssize, 0); |
100 | put_cpu_var(ppc64_tlb_batch); | ||
102 | return; | 101 | return; |
103 | } | 102 | } |
104 | 103 | ||
@@ -127,6 +126,7 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr, | |||
127 | batch->index = ++i; | 126 | batch->index = ++i; |
128 | if (i >= PPC64_TLB_BATCH_NR) | 127 | if (i >= PPC64_TLB_BATCH_NR) |
129 | __flush_tlb_pending(batch); | 128 | __flush_tlb_pending(batch); |
129 | put_cpu_var(ppc64_tlb_batch); | ||
130 | } | 130 | } |
131 | 131 | ||
132 | /* | 132 | /* |
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c index 187a7d32f86a..a3d2ce54ea2e 100644 --- a/arch/powerpc/platforms/cell/spufs/syscalls.c +++ b/arch/powerpc/platforms/cell/spufs/syscalls.c | |||
@@ -70,7 +70,7 @@ static long do_spu_create(const char __user *pathname, unsigned int flags, | |||
70 | if (!IS_ERR(tmp)) { | 70 | if (!IS_ERR(tmp)) { |
71 | struct nameidata nd; | 71 | struct nameidata nd; |
72 | 72 | ||
73 | ret = path_lookup(tmp, LOOKUP_PARENT, &nd); | 73 | ret = kern_path_parent(tmp, &nd); |
74 | if (!ret) { | 74 | if (!ret) { |
75 | nd.flags |= LOOKUP_OPEN | LOOKUP_CREATE; | 75 | nd.flags |= LOOKUP_OPEN | LOOKUP_CREATE; |
76 | ret = spufs_create(&nd, flags, mode, neighbor); | 76 | ret = spufs_create(&nd, flags, mode, neighbor); |
diff --git a/arch/powerpc/platforms/iseries/dt.c b/arch/powerpc/platforms/iseries/dt.c index fdb7384c0c4f..f0491cc28900 100644 --- a/arch/powerpc/platforms/iseries/dt.c +++ b/arch/powerpc/platforms/iseries/dt.c | |||
@@ -242,8 +242,8 @@ static void __init dt_cpus(struct iseries_flat_dt *dt) | |||
242 | pft_size[0] = 0; /* NUMA CEC cookie, 0 for non NUMA */ | 242 | pft_size[0] = 0; /* NUMA CEC cookie, 0 for non NUMA */ |
243 | pft_size[1] = __ilog2(HvCallHpt_getHptPages() * HW_PAGE_SIZE); | 243 | pft_size[1] = __ilog2(HvCallHpt_getHptPages() * HW_PAGE_SIZE); |
244 | 244 | ||
245 | for (i = 0; i < NR_CPUS; i++) { | 245 | for (i = 0; i < NR_LPPACAS; i++) { |
246 | if (lppaca_of(i).dyn_proc_status >= 2) | 246 | if (lppaca[i].dyn_proc_status >= 2) |
247 | continue; | 247 | continue; |
248 | 248 | ||
249 | snprintf(p, 32 - (p - buf), "@%d", i); | 249 | snprintf(p, 32 - (p - buf), "@%d", i); |
@@ -251,7 +251,7 @@ static void __init dt_cpus(struct iseries_flat_dt *dt) | |||
251 | 251 | ||
252 | dt_prop_str(dt, "device_type", device_type_cpu); | 252 | dt_prop_str(dt, "device_type", device_type_cpu); |
253 | 253 | ||
254 | index = lppaca_of(i).dyn_hv_phys_proc_index; | 254 | index = lppaca[i].dyn_hv_phys_proc_index; |
255 | d = &xIoHriProcessorVpd[index]; | 255 | d = &xIoHriProcessorVpd[index]; |
256 | 256 | ||
257 | dt_prop_u32(dt, "i-cache-size", d->xInstCacheSize * 1024); | 257 | dt_prop_u32(dt, "i-cache-size", d->xInstCacheSize * 1024); |
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c index b0863410517f..2946ae10fbfd 100644 --- a/arch/powerpc/platforms/iseries/setup.c +++ b/arch/powerpc/platforms/iseries/setup.c | |||
@@ -680,6 +680,7 @@ void * __init iSeries_early_setup(void) | |||
680 | * on but calling this function multiple times is fine. | 680 | * on but calling this function multiple times is fine. |
681 | */ | 681 | */ |
682 | identify_cpu(0, mfspr(SPRN_PVR)); | 682 | identify_cpu(0, mfspr(SPRN_PVR)); |
683 | initialise_paca(&boot_paca, 0); | ||
683 | 684 | ||
684 | powerpc_firmware_features |= FW_FEATURE_ISERIES; | 685 | powerpc_firmware_features |= FW_FEATURE_ISERIES; |
685 | powerpc_firmware_features |= FW_FEATURE_LPAR; | 686 | powerpc_firmware_features |= FW_FEATURE_LPAR; |
diff --git a/arch/s390/boot/compressed/misc.c b/arch/s390/boot/compressed/misc.c index 0851eb1e919e..2751b3a8a66f 100644 --- a/arch/s390/boot/compressed/misc.c +++ b/arch/s390/boot/compressed/misc.c | |||
@@ -133,11 +133,12 @@ unsigned long decompress_kernel(void) | |||
133 | unsigned long output_addr; | 133 | unsigned long output_addr; |
134 | unsigned char *output; | 134 | unsigned char *output; |
135 | 135 | ||
136 | check_ipl_parmblock((void *) 0, (unsigned long) output + SZ__bss_start); | 136 | output_addr = ((unsigned long) &_end + HEAP_SIZE + 4095UL) & -4096UL; |
137 | check_ipl_parmblock((void *) 0, output_addr + SZ__bss_start); | ||
137 | memset(&_bss, 0, &_ebss - &_bss); | 138 | memset(&_bss, 0, &_ebss - &_bss); |
138 | free_mem_ptr = (unsigned long)&_end; | 139 | free_mem_ptr = (unsigned long)&_end; |
139 | free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; | 140 | free_mem_end_ptr = free_mem_ptr + HEAP_SIZE; |
140 | output = (unsigned char *) ((free_mem_end_ptr + 4095UL) & -4096UL); | 141 | output = (unsigned char *) output_addr; |
141 | 142 | ||
142 | #ifdef CONFIG_BLK_DEV_INITRD | 143 | #ifdef CONFIG_BLK_DEV_INITRD |
143 | /* | 144 | /* |
diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h index 76daea117181..5c5ba10384c2 100644 --- a/arch/s390/include/asm/atomic.h +++ b/arch/s390/include/asm/atomic.h | |||
@@ -36,14 +36,19 @@ | |||
36 | 36 | ||
37 | static inline int atomic_read(const atomic_t *v) | 37 | static inline int atomic_read(const atomic_t *v) |
38 | { | 38 | { |
39 | barrier(); | 39 | int c; |
40 | return v->counter; | 40 | |
41 | asm volatile( | ||
42 | " l %0,%1\n" | ||
43 | : "=d" (c) : "Q" (v->counter)); | ||
44 | return c; | ||
41 | } | 45 | } |
42 | 46 | ||
43 | static inline void atomic_set(atomic_t *v, int i) | 47 | static inline void atomic_set(atomic_t *v, int i) |
44 | { | 48 | { |
45 | v->counter = i; | 49 | asm volatile( |
46 | barrier(); | 50 | " st %1,%0\n" |
51 | : "=Q" (v->counter) : "d" (i)); | ||
47 | } | 52 | } |
48 | 53 | ||
49 | static inline int atomic_add_return(int i, atomic_t *v) | 54 | static inline int atomic_add_return(int i, atomic_t *v) |
@@ -128,14 +133,19 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u) | |||
128 | 133 | ||
129 | static inline long long atomic64_read(const atomic64_t *v) | 134 | static inline long long atomic64_read(const atomic64_t *v) |
130 | { | 135 | { |
131 | barrier(); | 136 | long long c; |
132 | return v->counter; | 137 | |
138 | asm volatile( | ||
139 | " lg %0,%1\n" | ||
140 | : "=d" (c) : "Q" (v->counter)); | ||
141 | return c; | ||
133 | } | 142 | } |
134 | 143 | ||
135 | static inline void atomic64_set(atomic64_t *v, long long i) | 144 | static inline void atomic64_set(atomic64_t *v, long long i) |
136 | { | 145 | { |
137 | v->counter = i; | 146 | asm volatile( |
138 | barrier(); | 147 | " stg %1,%0\n" |
148 | : "=Q" (v->counter) : "d" (i)); | ||
139 | } | 149 | } |
140 | 150 | ||
141 | static inline long long atomic64_add_return(long long i, atomic64_t *v) | 151 | static inline long long atomic64_add_return(long long i, atomic64_t *v) |
diff --git a/arch/s390/include/asm/cache.h b/arch/s390/include/asm/cache.h index 24aafa68b643..2a30d5ac0667 100644 --- a/arch/s390/include/asm/cache.h +++ b/arch/s390/include/asm/cache.h | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #define L1_CACHE_BYTES 256 | 14 | #define L1_CACHE_BYTES 256 |
15 | #define L1_CACHE_SHIFT 8 | 15 | #define L1_CACHE_SHIFT 8 |
16 | #define NET_SKB_PAD 32 | ||
16 | 17 | ||
17 | #define __read_mostly __attribute__((__section__(".data..read_mostly"))) | 18 | #define __read_mostly __attribute__((__section__(".data..read_mostly"))) |
18 | 19 | ||
diff --git a/arch/sh/include/asm/sections.h b/arch/sh/include/asm/sections.h index a78701da775b..4a5350037c8f 100644 --- a/arch/sh/include/asm/sections.h +++ b/arch/sh/include/asm/sections.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <asm-generic/sections.h> | 4 | #include <asm-generic/sections.h> |
5 | 5 | ||
6 | extern void __nosave_begin, __nosave_end; | 6 | extern long __nosave_begin, __nosave_end; |
7 | extern long __machvec_start, __machvec_end; | 7 | extern long __machvec_start, __machvec_end; |
8 | extern char __uncached_start, __uncached_end; | 8 | extern char __uncached_start, __uncached_end; |
9 | extern char _ebss[]; | 9 | extern char _ebss[]; |
diff --git a/arch/sh/kernel/cpu/sh4/setup-sh7750.c b/arch/sh/kernel/cpu/sh4/setup-sh7750.c index 672944f5b19c..e53b4b38bd11 100644 --- a/arch/sh/kernel/cpu/sh4/setup-sh7750.c +++ b/arch/sh/kernel/cpu/sh4/setup-sh7750.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <linux/sh_timer.h> | 15 | #include <linux/sh_timer.h> |
16 | #include <linux/serial_sci.h> | 16 | #include <linux/serial_sci.h> |
17 | #include <asm/machtypes.h> | 17 | #include <generated/machtypes.h> |
18 | 18 | ||
19 | static struct resource rtc_resources[] = { | 19 | static struct resource rtc_resources[] = { |
20 | [0] = { | 20 | [0] = { |
@@ -255,12 +255,17 @@ static struct platform_device *sh7750_early_devices[] __initdata = { | |||
255 | 255 | ||
256 | void __init plat_early_device_setup(void) | 256 | void __init plat_early_device_setup(void) |
257 | { | 257 | { |
258 | struct platform_device *dev[1]; | ||
259 | |||
258 | if (mach_is_rts7751r2d()) { | 260 | if (mach_is_rts7751r2d()) { |
259 | scif_platform_data.scscr |= SCSCR_CKE1; | 261 | scif_platform_data.scscr |= SCSCR_CKE1; |
260 | early_platform_add_devices(&scif_device, 1); | 262 | dev[0] = &scif_device; |
263 | early_platform_add_devices(dev, 1); | ||
261 | } else { | 264 | } else { |
262 | early_platform_add_devices(&sci_device, 1); | 265 | dev[0] = &sci_device; |
263 | early_platform_add_devices(&scif_device, 1); | 266 | early_platform_add_devices(dev, 1); |
267 | dev[0] = &scif_device; | ||
268 | early_platform_add_devices(dev, 1); | ||
264 | } | 269 | } |
265 | 270 | ||
266 | early_platform_add_devices(sh7750_early_devices, | 271 | early_platform_add_devices(sh7750_early_devices, |
diff --git a/arch/sh/lib/delay.c b/arch/sh/lib/delay.c index faa8f86c0db4..0901b2f14e15 100644 --- a/arch/sh/lib/delay.c +++ b/arch/sh/lib/delay.c | |||
@@ -10,6 +10,16 @@ | |||
10 | void __delay(unsigned long loops) | 10 | void __delay(unsigned long loops) |
11 | { | 11 | { |
12 | __asm__ __volatile__( | 12 | __asm__ __volatile__( |
13 | /* | ||
14 | * ST40-300 appears to have an issue with this code, | ||
15 | * normally taking two cycles each loop, as with all | ||
16 | * other SH variants. If however the branch and the | ||
17 | * delay slot straddle an 8 byte boundary, this increases | ||
18 | * to 3 cycles. | ||
19 | * This align directive ensures this doesn't occur. | ||
20 | */ | ||
21 | ".balign 8\n\t" | ||
22 | |||
13 | "tst %0, %0\n\t" | 23 | "tst %0, %0\n\t" |
14 | "1:\t" | 24 | "1:\t" |
15 | "bf/s 1b\n\t" | 25 | "bf/s 1b\n\t" |
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c index 88d3dc3d30d5..5a580ea04429 100644 --- a/arch/sh/mm/cache.c +++ b/arch/sh/mm/cache.c | |||
@@ -108,7 +108,8 @@ void copy_user_highpage(struct page *to, struct page *from, | |||
108 | kunmap_atomic(vfrom, KM_USER0); | 108 | kunmap_atomic(vfrom, KM_USER0); |
109 | } | 109 | } |
110 | 110 | ||
111 | if (pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK)) | 111 | if (pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK) || |
112 | (vma->vm_flags & VM_EXEC)) | ||
112 | __flush_purge_region(vto, PAGE_SIZE); | 113 | __flush_purge_region(vto, PAGE_SIZE); |
113 | 114 | ||
114 | kunmap_atomic(vto, KM_USER1); | 115 | kunmap_atomic(vto, KM_USER1); |
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c index 975613b23dcf..c70e047eed72 100644 --- a/arch/um/drivers/mconsole_kern.c +++ b/arch/um/drivers/mconsole_kern.c | |||
@@ -124,35 +124,18 @@ void mconsole_log(struct mc_request *req) | |||
124 | #if 0 | 124 | #if 0 |
125 | void mconsole_proc(struct mc_request *req) | 125 | void mconsole_proc(struct mc_request *req) |
126 | { | 126 | { |
127 | struct nameidata nd; | ||
128 | struct vfsmount *mnt = current->nsproxy->pid_ns->proc_mnt; | 127 | struct vfsmount *mnt = current->nsproxy->pid_ns->proc_mnt; |
129 | struct file *file; | 128 | struct file *file; |
130 | int n, err; | 129 | int n; |
131 | char *ptr = req->request.data, *buf; | 130 | char *ptr = req->request.data, *buf; |
132 | mm_segment_t old_fs = get_fs(); | 131 | mm_segment_t old_fs = get_fs(); |
133 | 132 | ||
134 | ptr += strlen("proc"); | 133 | ptr += strlen("proc"); |
135 | ptr = skip_spaces(ptr); | 134 | ptr = skip_spaces(ptr); |
136 | 135 | ||
137 | err = vfs_path_lookup(mnt->mnt_root, mnt, ptr, LOOKUP_FOLLOW, &nd); | 136 | file = file_open_root(mnt->mnt_root, mnt, ptr, O_RDONLY); |
138 | if (err) { | ||
139 | mconsole_reply(req, "Failed to look up file", 1, 0); | ||
140 | goto out; | ||
141 | } | ||
142 | |||
143 | err = may_open(&nd.path, MAY_READ, O_RDONLY); | ||
144 | if (result) { | ||
145 | mconsole_reply(req, "Failed to open file", 1, 0); | ||
146 | path_put(&nd.path); | ||
147 | goto out; | ||
148 | } | ||
149 | |||
150 | file = dentry_open(nd.path.dentry, nd.path.mnt, O_RDONLY, | ||
151 | current_cred()); | ||
152 | err = PTR_ERR(file); | ||
153 | if (IS_ERR(file)) { | 137 | if (IS_ERR(file)) { |
154 | mconsole_reply(req, "Failed to open file", 1, 0); | 138 | mconsole_reply(req, "Failed to open file", 1, 0); |
155 | path_put(&nd.path); | ||
156 | goto out; | 139 | goto out; |
157 | } | 140 | } |
158 | 141 | ||
diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c index 646aa78ba5fd..46a823882437 100644 --- a/arch/x86/boot/compressed/mkpiggy.c +++ b/arch/x86/boot/compressed/mkpiggy.c | |||
@@ -62,7 +62,12 @@ int main(int argc, char *argv[]) | |||
62 | if (fseek(f, -4L, SEEK_END)) { | 62 | if (fseek(f, -4L, SEEK_END)) { |
63 | perror(argv[1]); | 63 | perror(argv[1]); |
64 | } | 64 | } |
65 | fread(&olen, sizeof olen, 1, f); | 65 | |
66 | if (fread(&olen, sizeof(olen), 1, f) != 1) { | ||
67 | perror(argv[1]); | ||
68 | return 1; | ||
69 | } | ||
70 | |||
66 | ilen = ftell(f); | 71 | ilen = ftell(f); |
67 | olen = getle32(&olen); | 72 | olen = getle32(&olen); |
68 | fclose(f); | 73 | fclose(f); |
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index 518bb99c3394..98d353edfff3 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
@@ -851,4 +851,6 @@ ia32_sys_call_table: | |||
851 | .quad sys_fanotify_init | 851 | .quad sys_fanotify_init |
852 | .quad sys32_fanotify_mark | 852 | .quad sys32_fanotify_mark |
853 | .quad sys_prlimit64 /* 340 */ | 853 | .quad sys_prlimit64 /* 340 */ |
854 | .quad sys_name_to_handle_at | ||
855 | .quad compat_sys_open_by_handle_at | ||
854 | ia32_syscall_end: | 856 | ia32_syscall_end: |
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h index 211ca3f7fd16..4ea15ca89b2b 100644 --- a/arch/x86/include/asm/acpi.h +++ b/arch/x86/include/asm/acpi.h | |||
@@ -88,6 +88,7 @@ extern int acpi_disabled; | |||
88 | extern int acpi_pci_disabled; | 88 | extern int acpi_pci_disabled; |
89 | extern int acpi_skip_timer_override; | 89 | extern int acpi_skip_timer_override; |
90 | extern int acpi_use_timer_override; | 90 | extern int acpi_use_timer_override; |
91 | extern int acpi_fix_pin2_polarity; | ||
91 | 92 | ||
92 | extern u8 acpi_sci_flags; | 93 | extern u8 acpi_sci_flags; |
93 | extern int acpi_sci_override_gsi; | 94 | extern int acpi_sci_override_gsi; |
diff --git a/arch/x86/include/asm/ce4100.h b/arch/x86/include/asm/ce4100.h new file mode 100644 index 000000000000..e656ad8c0a2e --- /dev/null +++ b/arch/x86/include/asm/ce4100.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _ASM_CE4100_H_ | ||
2 | #define _ASM_CE4100_H_ | ||
3 | |||
4 | int ce4100_pci_init(void); | ||
5 | |||
6 | #endif | ||
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 4d0dfa0d998e..43a18c77676d 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h | |||
@@ -36,6 +36,11 @@ | |||
36 | #define MSR_IA32_PERFCTR1 0x000000c2 | 36 | #define MSR_IA32_PERFCTR1 0x000000c2 |
37 | #define MSR_FSB_FREQ 0x000000cd | 37 | #define MSR_FSB_FREQ 0x000000cd |
38 | 38 | ||
39 | #define MSR_NHM_SNB_PKG_CST_CFG_CTL 0x000000e2 | ||
40 | #define NHM_C3_AUTO_DEMOTE (1UL << 25) | ||
41 | #define NHM_C1_AUTO_DEMOTE (1UL << 26) | ||
42 | #define ATM_LNC_C6_AUTO_DEMOTE (1UL << 25) | ||
43 | |||
39 | #define MSR_MTRRcap 0x000000fe | 44 | #define MSR_MTRRcap 0x000000fe |
40 | #define MSR_IA32_BBL_CR_CTL 0x00000119 | 45 | #define MSR_IA32_BBL_CR_CTL 0x00000119 |
41 | 46 | ||
diff --git a/arch/x86/include/asm/perf_event_p4.h b/arch/x86/include/asm/perf_event_p4.h index e2f6a99f14ab..cc29086e30cd 100644 --- a/arch/x86/include/asm/perf_event_p4.h +++ b/arch/x86/include/asm/perf_event_p4.h | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #define ARCH_P4_CNTRVAL_BITS (40) | 23 | #define ARCH_P4_CNTRVAL_BITS (40) |
24 | #define ARCH_P4_CNTRVAL_MASK ((1ULL << ARCH_P4_CNTRVAL_BITS) - 1) | 24 | #define ARCH_P4_CNTRVAL_MASK ((1ULL << ARCH_P4_CNTRVAL_BITS) - 1) |
25 | #define ARCH_P4_UNFLAGGED_BIT ((1ULL) << (ARCH_P4_CNTRVAL_BITS - 1)) | ||
25 | 26 | ||
26 | #define P4_ESCR_EVENT_MASK 0x7e000000U | 27 | #define P4_ESCR_EVENT_MASK 0x7e000000U |
27 | #define P4_ESCR_EVENT_SHIFT 25 | 28 | #define P4_ESCR_EVENT_SHIFT 25 |
diff --git a/arch/x86/include/asm/smpboot_hooks.h b/arch/x86/include/asm/smpboot_hooks.h index 6c22bf353f26..725b77831993 100644 --- a/arch/x86/include/asm/smpboot_hooks.h +++ b/arch/x86/include/asm/smpboot_hooks.h | |||
@@ -34,7 +34,7 @@ static inline void smpboot_restore_warm_reset_vector(void) | |||
34 | */ | 34 | */ |
35 | CMOS_WRITE(0, 0xf); | 35 | CMOS_WRITE(0, 0xf); |
36 | 36 | ||
37 | *((volatile long *)phys_to_virt(apic->trampoline_phys_low)) = 0; | 37 | *((volatile u32 *)phys_to_virt(apic->trampoline_phys_low)) = 0; |
38 | } | 38 | } |
39 | 39 | ||
40 | static inline void __init smpboot_setup_io_apic(void) | 40 | static inline void __init smpboot_setup_io_apic(void) |
diff --git a/arch/x86/include/asm/unistd_32.h b/arch/x86/include/asm/unistd_32.h index b766a5e8ba0e..f4c4973fc2ac 100644 --- a/arch/x86/include/asm/unistd_32.h +++ b/arch/x86/include/asm/unistd_32.h | |||
@@ -346,10 +346,12 @@ | |||
346 | #define __NR_fanotify_init 338 | 346 | #define __NR_fanotify_init 338 |
347 | #define __NR_fanotify_mark 339 | 347 | #define __NR_fanotify_mark 339 |
348 | #define __NR_prlimit64 340 | 348 | #define __NR_prlimit64 340 |
349 | #define __NR_name_to_handle_at 341 | ||
350 | #define __NR_open_by_handle_at 342 | ||
349 | 351 | ||
350 | #ifdef __KERNEL__ | 352 | #ifdef __KERNEL__ |
351 | 353 | ||
352 | #define NR_syscalls 341 | 354 | #define NR_syscalls 343 |
353 | 355 | ||
354 | #define __ARCH_WANT_IPC_PARSE_VERSION | 356 | #define __ARCH_WANT_IPC_PARSE_VERSION |
355 | #define __ARCH_WANT_OLD_READDIR | 357 | #define __ARCH_WANT_OLD_READDIR |
diff --git a/arch/x86/include/asm/unistd_64.h b/arch/x86/include/asm/unistd_64.h index 363e9b8a715b..81a3d5b70235 100644 --- a/arch/x86/include/asm/unistd_64.h +++ b/arch/x86/include/asm/unistd_64.h | |||
@@ -669,6 +669,10 @@ __SYSCALL(__NR_fanotify_init, sys_fanotify_init) | |||
669 | __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) | 669 | __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) |
670 | #define __NR_prlimit64 302 | 670 | #define __NR_prlimit64 302 |
671 | __SYSCALL(__NR_prlimit64, sys_prlimit64) | 671 | __SYSCALL(__NR_prlimit64, sys_prlimit64) |
672 | #define __NR_name_to_handle_at 303 | ||
673 | __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) | ||
674 | #define __NR_open_by_handle_at 304 | ||
675 | __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) | ||
672 | 676 | ||
673 | #ifndef __NO_STUBS | 677 | #ifndef __NO_STUBS |
674 | #define __ARCH_WANT_OLD_READDIR | 678 | #define __ARCH_WANT_OLD_READDIR |
diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h index ce1d54c8a433..3e094af443c3 100644 --- a/arch/x86/include/asm/uv/uv_bau.h +++ b/arch/x86/include/asm/uv/uv_bau.h | |||
@@ -176,7 +176,7 @@ struct bau_msg_payload { | |||
176 | struct bau_msg_header { | 176 | struct bau_msg_header { |
177 | unsigned int dest_subnodeid:6; /* must be 0x10, for the LB */ | 177 | unsigned int dest_subnodeid:6; /* must be 0x10, for the LB */ |
178 | /* bits 5:0 */ | 178 | /* bits 5:0 */ |
179 | unsigned int base_dest_nodeid:15; /* nasid (pnode<<1) of */ | 179 | unsigned int base_dest_nodeid:15; /* nasid of the */ |
180 | /* bits 20:6 */ /* first bit in uvhub map */ | 180 | /* bits 20:6 */ /* first bit in uvhub map */ |
181 | unsigned int command:8; /* message type */ | 181 | unsigned int command:8; /* message type */ |
182 | /* bits 28:21 */ | 182 | /* bits 28:21 */ |
diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h index a3c28ae4025b..8508bfe52296 100644 --- a/arch/x86/include/asm/xen/hypercall.h +++ b/arch/x86/include/asm/xen/hypercall.h | |||
@@ -287,7 +287,7 @@ HYPERVISOR_fpu_taskswitch(int set) | |||
287 | static inline int | 287 | static inline int |
288 | HYPERVISOR_sched_op(int cmd, void *arg) | 288 | HYPERVISOR_sched_op(int cmd, void *arg) |
289 | { | 289 | { |
290 | return _hypercall2(int, sched_op_new, cmd, arg); | 290 | return _hypercall2(int, sched_op, cmd, arg); |
291 | } | 291 | } |
292 | 292 | ||
293 | static inline long | 293 | static inline long |
@@ -422,10 +422,17 @@ HYPERVISOR_set_segment_base(int reg, unsigned long value) | |||
422 | #endif | 422 | #endif |
423 | 423 | ||
424 | static inline int | 424 | static inline int |
425 | HYPERVISOR_suspend(unsigned long srec) | 425 | HYPERVISOR_suspend(unsigned long start_info_mfn) |
426 | { | 426 | { |
427 | return _hypercall3(int, sched_op, SCHEDOP_shutdown, | 427 | struct sched_shutdown r = { .reason = SHUTDOWN_suspend }; |
428 | SHUTDOWN_suspend, srec); | 428 | |
429 | /* | ||
430 | * For a PV guest the tools require that the start_info mfn be | ||
431 | * present in rdx/edx when the hypercall is made. Per the | ||
432 | * hypercall calling convention this is the third hypercall | ||
433 | * argument, which is start_info_mfn here. | ||
434 | */ | ||
435 | return _hypercall3(int, sched_op, SCHEDOP_shutdown, &r, start_info_mfn); | ||
429 | } | 436 | } |
430 | 437 | ||
431 | static inline int | 438 | static inline int |
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h index f25bdf238a33..c61934fbf22a 100644 --- a/arch/x86/include/asm/xen/page.h +++ b/arch/x86/include/asm/xen/page.h | |||
@@ -29,8 +29,10 @@ typedef struct xpaddr { | |||
29 | 29 | ||
30 | /**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/ | 30 | /**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/ |
31 | #define INVALID_P2M_ENTRY (~0UL) | 31 | #define INVALID_P2M_ENTRY (~0UL) |
32 | #define FOREIGN_FRAME_BIT (1UL<<31) | 32 | #define FOREIGN_FRAME_BIT (1UL<<(BITS_PER_LONG-1)) |
33 | #define IDENTITY_FRAME_BIT (1UL<<(BITS_PER_LONG-2)) | ||
33 | #define FOREIGN_FRAME(m) ((m) | FOREIGN_FRAME_BIT) | 34 | #define FOREIGN_FRAME(m) ((m) | FOREIGN_FRAME_BIT) |
35 | #define IDENTITY_FRAME(m) ((m) | IDENTITY_FRAME_BIT) | ||
34 | 36 | ||
35 | /* Maximum amount of memory we can handle in a domain in pages */ | 37 | /* Maximum amount of memory we can handle in a domain in pages */ |
36 | #define MAX_DOMAIN_PAGES \ | 38 | #define MAX_DOMAIN_PAGES \ |
@@ -41,12 +43,18 @@ extern unsigned int machine_to_phys_order; | |||
41 | 43 | ||
42 | extern unsigned long get_phys_to_machine(unsigned long pfn); | 44 | extern unsigned long get_phys_to_machine(unsigned long pfn); |
43 | extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn); | 45 | extern bool set_phys_to_machine(unsigned long pfn, unsigned long mfn); |
46 | extern bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn); | ||
47 | extern unsigned long set_phys_range_identity(unsigned long pfn_s, | ||
48 | unsigned long pfn_e); | ||
44 | 49 | ||
45 | extern int m2p_add_override(unsigned long mfn, struct page *page); | 50 | extern int m2p_add_override(unsigned long mfn, struct page *page); |
46 | extern int m2p_remove_override(struct page *page); | 51 | extern int m2p_remove_override(struct page *page); |
47 | extern struct page *m2p_find_override(unsigned long mfn); | 52 | extern struct page *m2p_find_override(unsigned long mfn); |
48 | extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn); | 53 | extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn); |
49 | 54 | ||
55 | #ifdef CONFIG_XEN_DEBUG_FS | ||
56 | extern int p2m_dump_show(struct seq_file *m, void *v); | ||
57 | #endif | ||
50 | static inline unsigned long pfn_to_mfn(unsigned long pfn) | 58 | static inline unsigned long pfn_to_mfn(unsigned long pfn) |
51 | { | 59 | { |
52 | unsigned long mfn; | 60 | unsigned long mfn; |
@@ -57,7 +65,7 @@ static inline unsigned long pfn_to_mfn(unsigned long pfn) | |||
57 | mfn = get_phys_to_machine(pfn); | 65 | mfn = get_phys_to_machine(pfn); |
58 | 66 | ||
59 | if (mfn != INVALID_P2M_ENTRY) | 67 | if (mfn != INVALID_P2M_ENTRY) |
60 | mfn &= ~FOREIGN_FRAME_BIT; | 68 | mfn &= ~(FOREIGN_FRAME_BIT | IDENTITY_FRAME_BIT); |
61 | 69 | ||
62 | return mfn; | 70 | return mfn; |
63 | } | 71 | } |
@@ -73,25 +81,44 @@ static inline int phys_to_machine_mapping_valid(unsigned long pfn) | |||
73 | static inline unsigned long mfn_to_pfn(unsigned long mfn) | 81 | static inline unsigned long mfn_to_pfn(unsigned long mfn) |
74 | { | 82 | { |
75 | unsigned long pfn; | 83 | unsigned long pfn; |
84 | int ret = 0; | ||
76 | 85 | ||
77 | if (xen_feature(XENFEAT_auto_translated_physmap)) | 86 | if (xen_feature(XENFEAT_auto_translated_physmap)) |
78 | return mfn; | 87 | return mfn; |
79 | 88 | ||
89 | if (unlikely((mfn >> machine_to_phys_order) != 0)) { | ||
90 | pfn = ~0; | ||
91 | goto try_override; | ||
92 | } | ||
80 | pfn = 0; | 93 | pfn = 0; |
81 | /* | 94 | /* |
82 | * The array access can fail (e.g., device space beyond end of RAM). | 95 | * The array access can fail (e.g., device space beyond end of RAM). |
83 | * In such cases it doesn't matter what we return (we return garbage), | 96 | * In such cases it doesn't matter what we return (we return garbage), |
84 | * but we must handle the fault without crashing! | 97 | * but we must handle the fault without crashing! |
85 | */ | 98 | */ |
86 | __get_user(pfn, &machine_to_phys_mapping[mfn]); | 99 | ret = __get_user(pfn, &machine_to_phys_mapping[mfn]); |
87 | 100 | try_override: | |
88 | /* | 101 | /* ret might be < 0 if there are no entries in the m2p for mfn */ |
89 | * If this appears to be a foreign mfn (because the pfn | 102 | if (ret < 0) |
90 | * doesn't map back to the mfn), then check the local override | 103 | pfn = ~0; |
91 | * table to see if there's a better pfn to use. | 104 | else if (get_phys_to_machine(pfn) != mfn) |
105 | /* | ||
106 | * If this appears to be a foreign mfn (because the pfn | ||
107 | * doesn't map back to the mfn), then check the local override | ||
108 | * table to see if there's a better pfn to use. | ||
109 | * | ||
110 | * m2p_find_override_pfn returns ~0 if it doesn't find anything. | ||
111 | */ | ||
112 | pfn = m2p_find_override_pfn(mfn, ~0); | ||
113 | |||
114 | /* | ||
115 | * pfn is ~0 if there are no entries in the m2p for mfn or if the | ||
116 | * entry doesn't map back to the mfn and m2p_override doesn't have a | ||
117 | * valid entry for it. | ||
92 | */ | 118 | */ |
93 | if (get_phys_to_machine(pfn) != mfn) | 119 | if (pfn == ~0 && |
94 | pfn = m2p_find_override_pfn(mfn, pfn); | 120 | get_phys_to_machine(mfn) == IDENTITY_FRAME(mfn)) |
121 | pfn = mfn; | ||
95 | 122 | ||
96 | return pfn; | 123 | return pfn; |
97 | } | 124 | } |
diff --git a/arch/x86/include/asm/xen/pci.h b/arch/x86/include/asm/xen/pci.h index 2329b3eaf8d3..aa8620989162 100644 --- a/arch/x86/include/asm/xen/pci.h +++ b/arch/x86/include/asm/xen/pci.h | |||
@@ -27,16 +27,16 @@ static inline void __init xen_setup_pirqs(void) | |||
27 | * its own functions. | 27 | * its own functions. |
28 | */ | 28 | */ |
29 | struct xen_pci_frontend_ops { | 29 | struct xen_pci_frontend_ops { |
30 | int (*enable_msi)(struct pci_dev *dev, int **vectors); | 30 | int (*enable_msi)(struct pci_dev *dev, int vectors[]); |
31 | void (*disable_msi)(struct pci_dev *dev); | 31 | void (*disable_msi)(struct pci_dev *dev); |
32 | int (*enable_msix)(struct pci_dev *dev, int **vectors, int nvec); | 32 | int (*enable_msix)(struct pci_dev *dev, int vectors[], int nvec); |
33 | void (*disable_msix)(struct pci_dev *dev); | 33 | void (*disable_msix)(struct pci_dev *dev); |
34 | }; | 34 | }; |
35 | 35 | ||
36 | extern struct xen_pci_frontend_ops *xen_pci_frontend; | 36 | extern struct xen_pci_frontend_ops *xen_pci_frontend; |
37 | 37 | ||
38 | static inline int xen_pci_frontend_enable_msi(struct pci_dev *dev, | 38 | static inline int xen_pci_frontend_enable_msi(struct pci_dev *dev, |
39 | int **vectors) | 39 | int vectors[]) |
40 | { | 40 | { |
41 | if (xen_pci_frontend && xen_pci_frontend->enable_msi) | 41 | if (xen_pci_frontend && xen_pci_frontend->enable_msi) |
42 | return xen_pci_frontend->enable_msi(dev, vectors); | 42 | return xen_pci_frontend->enable_msi(dev, vectors); |
@@ -48,7 +48,7 @@ static inline void xen_pci_frontend_disable_msi(struct pci_dev *dev) | |||
48 | xen_pci_frontend->disable_msi(dev); | 48 | xen_pci_frontend->disable_msi(dev); |
49 | } | 49 | } |
50 | static inline int xen_pci_frontend_enable_msix(struct pci_dev *dev, | 50 | static inline int xen_pci_frontend_enable_msix(struct pci_dev *dev, |
51 | int **vectors, int nvec) | 51 | int vectors[], int nvec) |
52 | { | 52 | { |
53 | if (xen_pci_frontend && xen_pci_frontend->enable_msix) | 53 | if (xen_pci_frontend && xen_pci_frontend->enable_msix) |
54 | return xen_pci_frontend->enable_msix(dev, vectors, nvec); | 54 | return xen_pci_frontend->enable_msix(dev, vectors, nvec); |
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c index b3a71137983a..3e6e2d68f761 100644 --- a/arch/x86/kernel/acpi/boot.c +++ b/arch/x86/kernel/acpi/boot.c | |||
@@ -72,6 +72,7 @@ u8 acpi_sci_flags __initdata; | |||
72 | int acpi_sci_override_gsi __initdata; | 72 | int acpi_sci_override_gsi __initdata; |
73 | int acpi_skip_timer_override __initdata; | 73 | int acpi_skip_timer_override __initdata; |
74 | int acpi_use_timer_override __initdata; | 74 | int acpi_use_timer_override __initdata; |
75 | int acpi_fix_pin2_polarity __initdata; | ||
75 | 76 | ||
76 | #ifdef CONFIG_X86_LOCAL_APIC | 77 | #ifdef CONFIG_X86_LOCAL_APIC |
77 | static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; | 78 | static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; |
@@ -415,10 +416,15 @@ acpi_parse_int_src_ovr(struct acpi_subtable_header * header, | |||
415 | return 0; | 416 | return 0; |
416 | } | 417 | } |
417 | 418 | ||
418 | if (acpi_skip_timer_override && | 419 | if (intsrc->source_irq == 0 && intsrc->global_irq == 2) { |
419 | intsrc->source_irq == 0 && intsrc->global_irq == 2) { | 420 | if (acpi_skip_timer_override) { |
420 | printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); | 421 | printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); |
421 | return 0; | 422 | return 0; |
423 | } | ||
424 | if (acpi_fix_pin2_polarity && (intsrc->inti_flags & ACPI_MADT_POLARITY_MASK)) { | ||
425 | intsrc->inti_flags &= ~ACPI_MADT_POLARITY_MASK; | ||
426 | printk(PREFIX "BIOS IRQ0 pin2 override: forcing polarity to high active.\n"); | ||
427 | } | ||
422 | } | 428 | } |
423 | 429 | ||
424 | mp_override_legacy_irq(intsrc->source_irq, | 430 | mp_override_legacy_irq(intsrc->source_irq, |
diff --git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c index 51ef31a89be9..51d4e1663066 100644 --- a/arch/x86/kernel/apb_timer.c +++ b/arch/x86/kernel/apb_timer.c | |||
@@ -284,7 +284,7 @@ static int __init apbt_clockevent_register(void) | |||
284 | memcpy(&adev->evt, &apbt_clockevent, sizeof(struct clock_event_device)); | 284 | memcpy(&adev->evt, &apbt_clockevent, sizeof(struct clock_event_device)); |
285 | 285 | ||
286 | if (mrst_timer_options == MRST_TIMER_LAPIC_APBT) { | 286 | if (mrst_timer_options == MRST_TIMER_LAPIC_APBT) { |
287 | apbt_clockevent.rating = APBT_CLOCKEVENT_RATING - 100; | 287 | adev->evt.rating = APBT_CLOCKEVENT_RATING - 100; |
288 | global_clock_event = &adev->evt; | 288 | global_clock_event = &adev->evt; |
289 | printk(KERN_DEBUG "%s clockevent registered as global\n", | 289 | printk(KERN_DEBUG "%s clockevent registered as global\n", |
290 | global_clock_event->name); | 290 | global_clock_event->name); |
diff --git a/arch/x86/kernel/check.c b/arch/x86/kernel/check.c index 13a389179514..452932d34730 100644 --- a/arch/x86/kernel/check.c +++ b/arch/x86/kernel/check.c | |||
@@ -106,8 +106,8 @@ void __init setup_bios_corruption_check(void) | |||
106 | addr += size; | 106 | addr += size; |
107 | } | 107 | } |
108 | 108 | ||
109 | printk(KERN_INFO "Scanning %d areas for low memory corruption\n", | 109 | if (num_scan_areas) |
110 | num_scan_areas); | 110 | printk(KERN_INFO "Scanning %d areas for low memory corruption\n", num_scan_areas); |
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
@@ -143,12 +143,12 @@ static void check_corruption(struct work_struct *dummy) | |||
143 | { | 143 | { |
144 | check_for_bios_corruption(); | 144 | check_for_bios_corruption(); |
145 | schedule_delayed_work(&bios_check_work, | 145 | schedule_delayed_work(&bios_check_work, |
146 | round_jiffies_relative(corruption_check_period*HZ)); | 146 | round_jiffies_relative(corruption_check_period*HZ)); |
147 | } | 147 | } |
148 | 148 | ||
149 | static int start_periodic_check_for_corruption(void) | 149 | static int start_periodic_check_for_corruption(void) |
150 | { | 150 | { |
151 | if (!memory_corruption_check || corruption_check_period == 0) | 151 | if (!num_scan_areas || !memory_corruption_check || corruption_check_period == 0) |
152 | return 0; | 152 | return 0; |
153 | 153 | ||
154 | printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n", | 154 | printk(KERN_INFO "Scanning for low memory corruption every %d seconds\n", |
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c index bd1cac747f67..52c93648e492 100644 --- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c +++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c | |||
@@ -158,9 +158,9 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c) | |||
158 | { | 158 | { |
159 | if (c->x86 == 0x06) { | 159 | if (c->x86 == 0x06) { |
160 | if (cpu_has(c, X86_FEATURE_EST)) | 160 | if (cpu_has(c, X86_FEATURE_EST)) |
161 | printk(KERN_WARNING PFX "Warning: EST-capable CPU " | 161 | printk_once(KERN_WARNING PFX "Warning: EST-capable " |
162 | "detected. The acpi-cpufreq module offers " | 162 | "CPU detected. The acpi-cpufreq module offers " |
163 | "voltage scaling in addition of frequency " | 163 | "voltage scaling in addition to frequency " |
164 | "scaling. You should use that instead of " | 164 | "scaling. You should use that instead of " |
165 | "p4-clockmod, if possible.\n"); | 165 | "p4-clockmod, if possible.\n"); |
166 | switch (c->x86_model) { | 166 | switch (c->x86_model) { |
diff --git a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c index 4f6f679f2799..4a5a42b842ad 100644 --- a/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c +++ b/arch/x86/kernel/cpu/cpufreq/pcc-cpufreq.c | |||
@@ -195,7 +195,7 @@ static unsigned int pcc_get_freq(unsigned int cpu) | |||
195 | cmd_incomplete: | 195 | cmd_incomplete: |
196 | iowrite16(0, &pcch_hdr->status); | 196 | iowrite16(0, &pcch_hdr->status); |
197 | spin_unlock(&pcc_lock); | 197 | spin_unlock(&pcc_lock); |
198 | return -EINVAL; | 198 | return 0; |
199 | } | 199 | } |
200 | 200 | ||
201 | static int pcc_cpufreq_target(struct cpufreq_policy *policy, | 201 | static int pcc_cpufreq_target(struct cpufreq_policy *policy, |
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c index 35c7e65e59be..c567dec854f6 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -1537,6 +1537,7 @@ static struct notifier_block cpb_nb = { | |||
1537 | static int __cpuinit powernowk8_init(void) | 1537 | static int __cpuinit powernowk8_init(void) |
1538 | { | 1538 | { |
1539 | unsigned int i, supported_cpus = 0, cpu; | 1539 | unsigned int i, supported_cpus = 0, cpu; |
1540 | int rv; | ||
1540 | 1541 | ||
1541 | for_each_online_cpu(i) { | 1542 | for_each_online_cpu(i) { |
1542 | int rc; | 1543 | int rc; |
@@ -1555,14 +1556,14 @@ static int __cpuinit powernowk8_init(void) | |||
1555 | 1556 | ||
1556 | cpb_capable = true; | 1557 | cpb_capable = true; |
1557 | 1558 | ||
1558 | register_cpu_notifier(&cpb_nb); | ||
1559 | |||
1560 | msrs = msrs_alloc(); | 1559 | msrs = msrs_alloc(); |
1561 | if (!msrs) { | 1560 | if (!msrs) { |
1562 | printk(KERN_ERR "%s: Error allocating msrs!\n", __func__); | 1561 | printk(KERN_ERR "%s: Error allocating msrs!\n", __func__); |
1563 | return -ENOMEM; | 1562 | return -ENOMEM; |
1564 | } | 1563 | } |
1565 | 1564 | ||
1565 | register_cpu_notifier(&cpb_nb); | ||
1566 | |||
1566 | rdmsr_on_cpus(cpu_online_mask, MSR_K7_HWCR, msrs); | 1567 | rdmsr_on_cpus(cpu_online_mask, MSR_K7_HWCR, msrs); |
1567 | 1568 | ||
1568 | for_each_cpu(cpu, cpu_online_mask) { | 1569 | for_each_cpu(cpu, cpu_online_mask) { |
@@ -1574,7 +1575,13 @@ static int __cpuinit powernowk8_init(void) | |||
1574 | (cpb_enabled ? "on" : "off")); | 1575 | (cpb_enabled ? "on" : "off")); |
1575 | } | 1576 | } |
1576 | 1577 | ||
1577 | return cpufreq_register_driver(&cpufreq_amd64_driver); | 1578 | rv = cpufreq_register_driver(&cpufreq_amd64_driver); |
1579 | if (rv < 0 && boot_cpu_has(X86_FEATURE_CPB)) { | ||
1580 | unregister_cpu_notifier(&cpb_nb); | ||
1581 | msrs_free(msrs); | ||
1582 | msrs = NULL; | ||
1583 | } | ||
1584 | return rv; | ||
1578 | } | 1585 | } |
1579 | 1586 | ||
1580 | /* driver entry point for term */ | 1587 | /* driver entry point for term */ |
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c index f7a0993c1e7c..ff751a9f182b 100644 --- a/arch/x86/kernel/cpu/perf_event_p4.c +++ b/arch/x86/kernel/cpu/perf_event_p4.c | |||
@@ -770,9 +770,14 @@ static inline int p4_pmu_clear_cccr_ovf(struct hw_perf_event *hwc) | |||
770 | return 1; | 770 | return 1; |
771 | } | 771 | } |
772 | 772 | ||
773 | /* it might be unflagged overflow */ | 773 | /* |
774 | rdmsrl(hwc->event_base + hwc->idx, v); | 774 | * In some circumstances the overflow might issue an NMI but did |
775 | if (!(v & ARCH_P4_CNTRVAL_MASK)) | 775 | * not set P4_CCCR_OVF bit. Because a counter holds a negative value |
776 | * we simply check for high bit being set, if it's cleared it means | ||
777 | * the counter has reached zero value and continued counting before | ||
778 | * real NMI signal was received: | ||
779 | */ | ||
780 | if (!(v & ARCH_P4_UNFLAGGED_BIT)) | ||
776 | return 1; | 781 | return 1; |
777 | 782 | ||
778 | return 0; | 783 | return 0; |
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 76b8cd953dee..9efbdcc56425 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c | |||
@@ -143,15 +143,10 @@ static void __init ati_bugs(int num, int slot, int func) | |||
143 | 143 | ||
144 | static u32 __init ati_sbx00_rev(int num, int slot, int func) | 144 | static u32 __init ati_sbx00_rev(int num, int slot, int func) |
145 | { | 145 | { |
146 | u32 old, d; | 146 | u32 d; |
147 | 147 | ||
148 | d = read_pci_config(num, slot, func, 0x70); | ||
149 | old = d; | ||
150 | d &= ~(1<<8); | ||
151 | write_pci_config(num, slot, func, 0x70, d); | ||
152 | d = read_pci_config(num, slot, func, 0x8); | 148 | d = read_pci_config(num, slot, func, 0x8); |
153 | d &= 0xff; | 149 | d &= 0xff; |
154 | write_pci_config(num, slot, func, 0x70, old); | ||
155 | 150 | ||
156 | return d; | 151 | return d; |
157 | } | 152 | } |
@@ -160,13 +155,16 @@ static void __init ati_bugs_contd(int num, int slot, int func) | |||
160 | { | 155 | { |
161 | u32 d, rev; | 156 | u32 d, rev; |
162 | 157 | ||
163 | if (acpi_use_timer_override) | ||
164 | return; | ||
165 | |||
166 | rev = ati_sbx00_rev(num, slot, func); | 158 | rev = ati_sbx00_rev(num, slot, func); |
159 | if (rev >= 0x40) | ||
160 | acpi_fix_pin2_polarity = 1; | ||
161 | |||
167 | if (rev > 0x13) | 162 | if (rev > 0x13) |
168 | return; | 163 | return; |
169 | 164 | ||
165 | if (acpi_use_timer_override) | ||
166 | return; | ||
167 | |||
170 | /* check for IRQ0 interrupt swap */ | 168 | /* check for IRQ0 interrupt swap */ |
171 | d = read_pci_config(num, slot, func, 0x64); | 169 | d = read_pci_config(num, slot, func, 0x64); |
172 | if (!(d & (1<<14))) | 170 | if (!(d & (1<<14))) |
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c index fc7aae1e2bc7..715037caeb43 100644 --- a/arch/x86/kernel/reboot.c +++ b/arch/x86/kernel/reboot.c | |||
@@ -285,6 +285,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = { | |||
285 | DMI_MATCH(DMI_BOARD_NAME, "P4S800"), | 285 | DMI_MATCH(DMI_BOARD_NAME, "P4S800"), |
286 | }, | 286 | }, |
287 | }, | 287 | }, |
288 | { /* Handle problems with rebooting on VersaLogic Menlow boards */ | ||
289 | .callback = set_bios_reboot, | ||
290 | .ident = "VersaLogic Menlow based board", | ||
291 | .matches = { | ||
292 | DMI_MATCH(DMI_BOARD_VENDOR, "VersaLogic Corporation"), | ||
293 | DMI_MATCH(DMI_BOARD_NAME, "VersaLogic Menlow board"), | ||
294 | }, | ||
295 | }, | ||
288 | { } | 296 | { } |
289 | }; | 297 | }; |
290 | 298 | ||
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S index b35786dc9b8f..c314b2199efd 100644 --- a/arch/x86/kernel/syscall_table_32.S +++ b/arch/x86/kernel/syscall_table_32.S | |||
@@ -340,3 +340,5 @@ ENTRY(sys_call_table) | |||
340 | .long sys_fanotify_init | 340 | .long sys_fanotify_init |
341 | .long sys_fanotify_mark | 341 | .long sys_fanotify_mark |
342 | .long sys_prlimit64 /* 340 */ | 342 | .long sys_prlimit64 /* 340 */ |
343 | .long sys_name_to_handle_at | ||
344 | .long sys_open_by_handle_at | ||
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 54ce246a383e..63fec1531e89 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c | |||
@@ -2777,6 +2777,8 @@ static int dr_interception(struct vcpu_svm *svm) | |||
2777 | kvm_register_write(&svm->vcpu, reg, val); | 2777 | kvm_register_write(&svm->vcpu, reg, val); |
2778 | } | 2778 | } |
2779 | 2779 | ||
2780 | skip_emulated_instruction(&svm->vcpu); | ||
2781 | |||
2780 | return 1; | 2782 | return 1; |
2781 | } | 2783 | } |
2782 | 2784 | ||
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 7d90ceb882a4..20e3f8702d1e 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -229,15 +229,14 @@ void vmalloc_sync_all(void) | |||
229 | for (address = VMALLOC_START & PMD_MASK; | 229 | for (address = VMALLOC_START & PMD_MASK; |
230 | address >= TASK_SIZE && address < FIXADDR_TOP; | 230 | address >= TASK_SIZE && address < FIXADDR_TOP; |
231 | address += PMD_SIZE) { | 231 | address += PMD_SIZE) { |
232 | |||
233 | unsigned long flags; | ||
234 | struct page *page; | 232 | struct page *page; |
235 | 233 | ||
236 | spin_lock_irqsave(&pgd_lock, flags); | 234 | spin_lock(&pgd_lock); |
237 | list_for_each_entry(page, &pgd_list, lru) { | 235 | list_for_each_entry(page, &pgd_list, lru) { |
238 | spinlock_t *pgt_lock; | 236 | spinlock_t *pgt_lock; |
239 | pmd_t *ret; | 237 | pmd_t *ret; |
240 | 238 | ||
239 | /* the pgt_lock only for Xen */ | ||
241 | pgt_lock = &pgd_page_get_mm(page)->page_table_lock; | 240 | pgt_lock = &pgd_page_get_mm(page)->page_table_lock; |
242 | 241 | ||
243 | spin_lock(pgt_lock); | 242 | spin_lock(pgt_lock); |
@@ -247,7 +246,7 @@ void vmalloc_sync_all(void) | |||
247 | if (!ret) | 246 | if (!ret) |
248 | break; | 247 | break; |
249 | } | 248 | } |
250 | spin_unlock_irqrestore(&pgd_lock, flags); | 249 | spin_unlock(&pgd_lock); |
251 | } | 250 | } |
252 | } | 251 | } |
253 | 252 | ||
@@ -828,6 +827,13 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code, | |||
828 | unsigned long address, unsigned int fault) | 827 | unsigned long address, unsigned int fault) |
829 | { | 828 | { |
830 | if (fault & VM_FAULT_OOM) { | 829 | if (fault & VM_FAULT_OOM) { |
830 | /* Kernel mode? Handle exceptions or die: */ | ||
831 | if (!(error_code & PF_USER)) { | ||
832 | up_read(¤t->mm->mmap_sem); | ||
833 | no_context(regs, error_code, address); | ||
834 | return; | ||
835 | } | ||
836 | |||
831 | out_of_memory(regs, error_code, address); | 837 | out_of_memory(regs, error_code, address); |
832 | } else { | 838 | } else { |
833 | if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON| | 839 | if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON| |
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 71a59296af80..c14a5422e152 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -105,18 +105,18 @@ void sync_global_pgds(unsigned long start, unsigned long end) | |||
105 | 105 | ||
106 | for (address = start; address <= end; address += PGDIR_SIZE) { | 106 | for (address = start; address <= end; address += PGDIR_SIZE) { |
107 | const pgd_t *pgd_ref = pgd_offset_k(address); | 107 | const pgd_t *pgd_ref = pgd_offset_k(address); |
108 | unsigned long flags; | ||
109 | struct page *page; | 108 | struct page *page; |
110 | 109 | ||
111 | if (pgd_none(*pgd_ref)) | 110 | if (pgd_none(*pgd_ref)) |
112 | continue; | 111 | continue; |
113 | 112 | ||
114 | spin_lock_irqsave(&pgd_lock, flags); | 113 | spin_lock(&pgd_lock); |
115 | list_for_each_entry(page, &pgd_list, lru) { | 114 | list_for_each_entry(page, &pgd_list, lru) { |
116 | pgd_t *pgd; | 115 | pgd_t *pgd; |
117 | spinlock_t *pgt_lock; | 116 | spinlock_t *pgt_lock; |
118 | 117 | ||
119 | pgd = (pgd_t *)page_address(page) + pgd_index(address); | 118 | pgd = (pgd_t *)page_address(page) + pgd_index(address); |
119 | /* the pgt_lock only for Xen */ | ||
120 | pgt_lock = &pgd_page_get_mm(page)->page_table_lock; | 120 | pgt_lock = &pgd_page_get_mm(page)->page_table_lock; |
121 | spin_lock(pgt_lock); | 121 | spin_lock(pgt_lock); |
122 | 122 | ||
@@ -128,7 +128,7 @@ void sync_global_pgds(unsigned long start, unsigned long end) | |||
128 | 128 | ||
129 | spin_unlock(pgt_lock); | 129 | spin_unlock(pgt_lock); |
130 | } | 130 | } |
131 | spin_unlock_irqrestore(&pgd_lock, flags); | 131 | spin_unlock(&pgd_lock); |
132 | } | 132 | } |
133 | } | 133 | } |
134 | 134 | ||
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c index 95ea1551eebc..1337c51b07d7 100644 --- a/arch/x86/mm/numa_64.c +++ b/arch/x86/mm/numa_64.c | |||
@@ -780,11 +780,7 @@ void __cpuinit numa_add_cpu(int cpu) | |||
780 | int physnid; | 780 | int physnid; |
781 | int nid = NUMA_NO_NODE; | 781 | int nid = NUMA_NO_NODE; |
782 | 782 | ||
783 | apicid = early_per_cpu(x86_cpu_to_apicid, cpu); | 783 | nid = early_cpu_to_node(cpu); |
784 | if (apicid != BAD_APICID) | ||
785 | nid = apicid_to_node[apicid]; | ||
786 | if (nid == NUMA_NO_NODE) | ||
787 | nid = early_cpu_to_node(cpu); | ||
788 | BUG_ON(nid == NUMA_NO_NODE || !node_online(nid)); | 784 | BUG_ON(nid == NUMA_NO_NODE || !node_online(nid)); |
789 | 785 | ||
790 | /* | 786 | /* |
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index d343b3c81f3c..90825f2eb0f4 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c | |||
@@ -57,12 +57,10 @@ static unsigned long direct_pages_count[PG_LEVEL_NUM]; | |||
57 | 57 | ||
58 | void update_page_count(int level, unsigned long pages) | 58 | void update_page_count(int level, unsigned long pages) |
59 | { | 59 | { |
60 | unsigned long flags; | ||
61 | |||
62 | /* Protect against CPA */ | 60 | /* Protect against CPA */ |
63 | spin_lock_irqsave(&pgd_lock, flags); | 61 | spin_lock(&pgd_lock); |
64 | direct_pages_count[level] += pages; | 62 | direct_pages_count[level] += pages; |
65 | spin_unlock_irqrestore(&pgd_lock, flags); | 63 | spin_unlock(&pgd_lock); |
66 | } | 64 | } |
67 | 65 | ||
68 | static void split_page_count(int level) | 66 | static void split_page_count(int level) |
@@ -394,7 +392,7 @@ static int | |||
394 | try_preserve_large_page(pte_t *kpte, unsigned long address, | 392 | try_preserve_large_page(pte_t *kpte, unsigned long address, |
395 | struct cpa_data *cpa) | 393 | struct cpa_data *cpa) |
396 | { | 394 | { |
397 | unsigned long nextpage_addr, numpages, pmask, psize, flags, addr, pfn; | 395 | unsigned long nextpage_addr, numpages, pmask, psize, addr, pfn; |
398 | pte_t new_pte, old_pte, *tmp; | 396 | pte_t new_pte, old_pte, *tmp; |
399 | pgprot_t old_prot, new_prot, req_prot; | 397 | pgprot_t old_prot, new_prot, req_prot; |
400 | int i, do_split = 1; | 398 | int i, do_split = 1; |
@@ -403,7 +401,7 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, | |||
403 | if (cpa->force_split) | 401 | if (cpa->force_split) |
404 | return 1; | 402 | return 1; |
405 | 403 | ||
406 | spin_lock_irqsave(&pgd_lock, flags); | 404 | spin_lock(&pgd_lock); |
407 | /* | 405 | /* |
408 | * Check for races, another CPU might have split this page | 406 | * Check for races, another CPU might have split this page |
409 | * up already: | 407 | * up already: |
@@ -498,14 +496,14 @@ try_preserve_large_page(pte_t *kpte, unsigned long address, | |||
498 | } | 496 | } |
499 | 497 | ||
500 | out_unlock: | 498 | out_unlock: |
501 | spin_unlock_irqrestore(&pgd_lock, flags); | 499 | spin_unlock(&pgd_lock); |
502 | 500 | ||
503 | return do_split; | 501 | return do_split; |
504 | } | 502 | } |
505 | 503 | ||
506 | static int split_large_page(pte_t *kpte, unsigned long address) | 504 | static int split_large_page(pte_t *kpte, unsigned long address) |
507 | { | 505 | { |
508 | unsigned long flags, pfn, pfninc = 1; | 506 | unsigned long pfn, pfninc = 1; |
509 | unsigned int i, level; | 507 | unsigned int i, level; |
510 | pte_t *pbase, *tmp; | 508 | pte_t *pbase, *tmp; |
511 | pgprot_t ref_prot; | 509 | pgprot_t ref_prot; |
@@ -519,7 +517,7 @@ static int split_large_page(pte_t *kpte, unsigned long address) | |||
519 | if (!base) | 517 | if (!base) |
520 | return -ENOMEM; | 518 | return -ENOMEM; |
521 | 519 | ||
522 | spin_lock_irqsave(&pgd_lock, flags); | 520 | spin_lock(&pgd_lock); |
523 | /* | 521 | /* |
524 | * Check for races, another CPU might have split this page | 522 | * Check for races, another CPU might have split this page |
525 | * up for us already: | 523 | * up for us already: |
@@ -591,7 +589,7 @@ out_unlock: | |||
591 | */ | 589 | */ |
592 | if (base) | 590 | if (base) |
593 | __free_page(base); | 591 | __free_page(base); |
594 | spin_unlock_irqrestore(&pgd_lock, flags); | 592 | spin_unlock(&pgd_lock); |
595 | 593 | ||
596 | return 0; | 594 | return 0; |
597 | } | 595 | } |
diff --git a/arch/x86/mm/pgtable.c b/arch/x86/mm/pgtable.c index 500242d3c96d..0113d19c8aa6 100644 --- a/arch/x86/mm/pgtable.c +++ b/arch/x86/mm/pgtable.c | |||
@@ -121,14 +121,12 @@ static void pgd_ctor(struct mm_struct *mm, pgd_t *pgd) | |||
121 | 121 | ||
122 | static void pgd_dtor(pgd_t *pgd) | 122 | static void pgd_dtor(pgd_t *pgd) |
123 | { | 123 | { |
124 | unsigned long flags; /* can be called from interrupt context */ | ||
125 | |||
126 | if (SHARED_KERNEL_PMD) | 124 | if (SHARED_KERNEL_PMD) |
127 | return; | 125 | return; |
128 | 126 | ||
129 | spin_lock_irqsave(&pgd_lock, flags); | 127 | spin_lock(&pgd_lock); |
130 | pgd_list_del(pgd); | 128 | pgd_list_del(pgd); |
131 | spin_unlock_irqrestore(&pgd_lock, flags); | 129 | spin_unlock(&pgd_lock); |
132 | } | 130 | } |
133 | 131 | ||
134 | /* | 132 | /* |
@@ -260,7 +258,6 @@ pgd_t *pgd_alloc(struct mm_struct *mm) | |||
260 | { | 258 | { |
261 | pgd_t *pgd; | 259 | pgd_t *pgd; |
262 | pmd_t *pmds[PREALLOCATED_PMDS]; | 260 | pmd_t *pmds[PREALLOCATED_PMDS]; |
263 | unsigned long flags; | ||
264 | 261 | ||
265 | pgd = (pgd_t *)__get_free_page(PGALLOC_GFP); | 262 | pgd = (pgd_t *)__get_free_page(PGALLOC_GFP); |
266 | 263 | ||
@@ -280,12 +277,12 @@ pgd_t *pgd_alloc(struct mm_struct *mm) | |||
280 | * respect to anything walking the pgd_list, so that they | 277 | * respect to anything walking the pgd_list, so that they |
281 | * never see a partially populated pgd. | 278 | * never see a partially populated pgd. |
282 | */ | 279 | */ |
283 | spin_lock_irqsave(&pgd_lock, flags); | 280 | spin_lock(&pgd_lock); |
284 | 281 | ||
285 | pgd_ctor(mm, pgd); | 282 | pgd_ctor(mm, pgd); |
286 | pgd_prepopulate_pmd(mm, pgd, pmds); | 283 | pgd_prepopulate_pmd(mm, pgd, pmds); |
287 | 284 | ||
288 | spin_unlock_irqrestore(&pgd_lock, flags); | 285 | spin_unlock(&pgd_lock); |
289 | 286 | ||
290 | return pgd; | 287 | return pgd; |
291 | 288 | ||
diff --git a/arch/x86/pci/ce4100.c b/arch/x86/pci/ce4100.c index 85b68ef5e809..9260b3eb18d4 100644 --- a/arch/x86/pci/ce4100.c +++ b/arch/x86/pci/ce4100.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | 36 | ||
37 | #include <asm/ce4100.h> | ||
37 | #include <asm/pci_x86.h> | 38 | #include <asm/pci_x86.h> |
38 | 39 | ||
39 | struct sim_reg { | 40 | struct sim_reg { |
@@ -306,10 +307,10 @@ struct pci_raw_ops ce4100_pci_conf = { | |||
306 | .write = ce4100_conf_write, | 307 | .write = ce4100_conf_write, |
307 | }; | 308 | }; |
308 | 309 | ||
309 | static int __init ce4100_pci_init(void) | 310 | int __init ce4100_pci_init(void) |
310 | { | 311 | { |
311 | init_sim_regs(); | 312 | init_sim_regs(); |
312 | raw_pci_ops = &ce4100_pci_conf; | 313 | raw_pci_ops = &ce4100_pci_conf; |
313 | return 0; | 314 | /* Indicate caller that it should invoke pci_legacy_init() */ |
315 | return 1; | ||
314 | } | 316 | } |
315 | subsys_initcall(ce4100_pci_init); | ||
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c index 25cd4a07d09f..8c4085a95ef1 100644 --- a/arch/x86/pci/xen.c +++ b/arch/x86/pci/xen.c | |||
@@ -20,7 +20,8 @@ | |||
20 | #include <asm/xen/pci.h> | 20 | #include <asm/xen/pci.h> |
21 | 21 | ||
22 | #ifdef CONFIG_ACPI | 22 | #ifdef CONFIG_ACPI |
23 | static int xen_hvm_register_pirq(u32 gsi, int triggering) | 23 | static int acpi_register_gsi_xen_hvm(struct device *dev, u32 gsi, |
24 | int trigger, int polarity) | ||
24 | { | 25 | { |
25 | int rc, irq; | 26 | int rc, irq; |
26 | struct physdev_map_pirq map_irq; | 27 | struct physdev_map_pirq map_irq; |
@@ -41,7 +42,7 @@ static int xen_hvm_register_pirq(u32 gsi, int triggering) | |||
41 | return -1; | 42 | return -1; |
42 | } | 43 | } |
43 | 44 | ||
44 | if (triggering == ACPI_EDGE_SENSITIVE) { | 45 | if (trigger == ACPI_EDGE_SENSITIVE) { |
45 | shareable = 0; | 46 | shareable = 0; |
46 | name = "ioapic-edge"; | 47 | name = "ioapic-edge"; |
47 | } else { | 48 | } else { |
@@ -55,12 +56,6 @@ static int xen_hvm_register_pirq(u32 gsi, int triggering) | |||
55 | 56 | ||
56 | return irq; | 57 | return irq; |
57 | } | 58 | } |
58 | |||
59 | static int acpi_register_gsi_xen_hvm(struct device *dev, u32 gsi, | ||
60 | int trigger, int polarity) | ||
61 | { | ||
62 | return xen_hvm_register_pirq(gsi, trigger); | ||
63 | } | ||
64 | #endif | 59 | #endif |
65 | 60 | ||
66 | #if defined(CONFIG_PCI_MSI) | 61 | #if defined(CONFIG_PCI_MSI) |
@@ -91,7 +86,7 @@ static void xen_msi_compose_msg(struct pci_dev *pdev, unsigned int pirq, | |||
91 | 86 | ||
92 | static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | 87 | static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) |
93 | { | 88 | { |
94 | int irq, pirq, ret = 0; | 89 | int irq, pirq; |
95 | struct msi_desc *msidesc; | 90 | struct msi_desc *msidesc; |
96 | struct msi_msg msg; | 91 | struct msi_msg msg; |
97 | 92 | ||
@@ -99,39 +94,32 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | |||
99 | __read_msi_msg(msidesc, &msg); | 94 | __read_msi_msg(msidesc, &msg); |
100 | pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) | | 95 | pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) | |
101 | ((msg.address_lo >> MSI_ADDR_DEST_ID_SHIFT) & 0xff); | 96 | ((msg.address_lo >> MSI_ADDR_DEST_ID_SHIFT) & 0xff); |
102 | if (xen_irq_from_pirq(pirq) >= 0 && msg.data == XEN_PIRQ_MSI_DATA) { | 97 | if (msg.data != XEN_PIRQ_MSI_DATA || |
103 | xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ? | 98 | xen_irq_from_pirq(pirq) < 0) { |
104 | "msi-x" : "msi", &irq, &pirq, XEN_ALLOC_IRQ); | 99 | pirq = xen_allocate_pirq_msi(dev, msidesc); |
105 | if (irq < 0) | 100 | if (pirq < 0) |
106 | goto error; | 101 | goto error; |
107 | ret = set_irq_msi(irq, msidesc); | 102 | xen_msi_compose_msg(dev, pirq, &msg); |
108 | if (ret < 0) | 103 | __write_msi_msg(msidesc, &msg); |
109 | goto error_while; | 104 | dev_dbg(&dev->dev, "xen: msi bound to pirq=%d\n", pirq); |
110 | printk(KERN_DEBUG "xen: msi already setup: msi --> irq=%d" | 105 | } else { |
111 | " pirq=%d\n", irq, pirq); | 106 | dev_dbg(&dev->dev, |
112 | return 0; | 107 | "xen: msi already bound to pirq=%d\n", pirq); |
113 | } | 108 | } |
114 | xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ? | 109 | irq = xen_bind_pirq_msi_to_irq(dev, msidesc, pirq, 0, |
115 | "msi-x" : "msi", &irq, &pirq, (XEN_ALLOC_IRQ | XEN_ALLOC_PIRQ)); | 110 | (type == PCI_CAP_ID_MSIX) ? |
116 | if (irq < 0 || pirq < 0) | 111 | "msi-x" : "msi"); |
112 | if (irq < 0) | ||
117 | goto error; | 113 | goto error; |
118 | printk(KERN_DEBUG "xen: msi --> irq=%d, pirq=%d\n", irq, pirq); | 114 | dev_dbg(&dev->dev, |
119 | xen_msi_compose_msg(dev, pirq, &msg); | 115 | "xen: msi --> pirq=%d --> irq=%d\n", pirq, irq); |
120 | ret = set_irq_msi(irq, msidesc); | ||
121 | if (ret < 0) | ||
122 | goto error_while; | ||
123 | write_msi_msg(irq, &msg); | ||
124 | } | 116 | } |
125 | return 0; | 117 | return 0; |
126 | 118 | ||
127 | error_while: | ||
128 | unbind_from_irqhandler(irq, NULL); | ||
129 | error: | 119 | error: |
130 | if (ret == -ENODEV) | 120 | dev_err(&dev->dev, |
131 | dev_err(&dev->dev, "Xen PCI frontend has not registered" \ | 121 | "Xen PCI frontend has not registered MSI/MSI-X support!\n"); |
132 | " MSI/MSI-X support!\n"); | 122 | return -ENODEV; |
133 | |||
134 | return ret; | ||
135 | } | 123 | } |
136 | 124 | ||
137 | /* | 125 | /* |
@@ -150,35 +138,26 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | |||
150 | return -ENOMEM; | 138 | return -ENOMEM; |
151 | 139 | ||
152 | if (type == PCI_CAP_ID_MSIX) | 140 | if (type == PCI_CAP_ID_MSIX) |
153 | ret = xen_pci_frontend_enable_msix(dev, &v, nvec); | 141 | ret = xen_pci_frontend_enable_msix(dev, v, nvec); |
154 | else | 142 | else |
155 | ret = xen_pci_frontend_enable_msi(dev, &v); | 143 | ret = xen_pci_frontend_enable_msi(dev, v); |
156 | if (ret) | 144 | if (ret) |
157 | goto error; | 145 | goto error; |
158 | i = 0; | 146 | i = 0; |
159 | list_for_each_entry(msidesc, &dev->msi_list, list) { | 147 | list_for_each_entry(msidesc, &dev->msi_list, list) { |
160 | irq = xen_allocate_pirq(v[i], 0, /* not sharable */ | 148 | irq = xen_bind_pirq_msi_to_irq(dev, msidesc, v[i], 0, |
161 | (type == PCI_CAP_ID_MSIX) ? | 149 | (type == PCI_CAP_ID_MSIX) ? |
162 | "pcifront-msi-x" : "pcifront-msi"); | 150 | "pcifront-msi-x" : |
163 | if (irq < 0) { | 151 | "pcifront-msi"); |
164 | ret = -1; | 152 | if (irq < 0) |
165 | goto free; | 153 | goto free; |
166 | } | ||
167 | |||
168 | ret = set_irq_msi(irq, msidesc); | ||
169 | if (ret) | ||
170 | goto error_while; | ||
171 | i++; | 154 | i++; |
172 | } | 155 | } |
173 | kfree(v); | 156 | kfree(v); |
174 | return 0; | 157 | return 0; |
175 | 158 | ||
176 | error_while: | ||
177 | unbind_from_irqhandler(irq, NULL); | ||
178 | error: | 159 | error: |
179 | if (ret == -ENODEV) | 160 | dev_err(&dev->dev, "Xen PCI frontend has not registered MSI/MSI-X support!\n"); |
180 | dev_err(&dev->dev, "Xen PCI frontend has not registered" \ | ||
181 | " MSI/MSI-X support!\n"); | ||
182 | free: | 161 | free: |
183 | kfree(v); | 162 | kfree(v); |
184 | return ret; | 163 | return ret; |
@@ -193,6 +172,9 @@ static void xen_teardown_msi_irqs(struct pci_dev *dev) | |||
193 | xen_pci_frontend_disable_msix(dev); | 172 | xen_pci_frontend_disable_msix(dev); |
194 | else | 173 | else |
195 | xen_pci_frontend_disable_msi(dev); | 174 | xen_pci_frontend_disable_msi(dev); |
175 | |||
176 | /* Free the IRQ's and the msidesc using the generic code. */ | ||
177 | default_teardown_msi_irqs(dev); | ||
196 | } | 178 | } |
197 | 179 | ||
198 | static void xen_teardown_msi_irq(unsigned int irq) | 180 | static void xen_teardown_msi_irq(unsigned int irq) |
@@ -200,47 +182,82 @@ static void xen_teardown_msi_irq(unsigned int irq) | |||
200 | xen_destroy_irq(irq); | 182 | xen_destroy_irq(irq); |
201 | } | 183 | } |
202 | 184 | ||
185 | #ifdef CONFIG_XEN_DOM0 | ||
203 | static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) | 186 | static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) |
204 | { | 187 | { |
205 | int irq, ret; | 188 | int ret = 0; |
206 | struct msi_desc *msidesc; | 189 | struct msi_desc *msidesc; |
207 | 190 | ||
208 | list_for_each_entry(msidesc, &dev->msi_list, list) { | 191 | list_for_each_entry(msidesc, &dev->msi_list, list) { |
209 | irq = xen_create_msi_irq(dev, msidesc, type); | 192 | struct physdev_map_pirq map_irq; |
210 | if (irq < 0) | ||
211 | return -1; | ||
212 | 193 | ||
213 | ret = set_irq_msi(irq, msidesc); | 194 | memset(&map_irq, 0, sizeof(map_irq)); |
214 | if (ret) | 195 | map_irq.domid = DOMID_SELF; |
215 | goto error; | 196 | map_irq.type = MAP_PIRQ_TYPE_MSI; |
216 | } | 197 | map_irq.index = -1; |
217 | return 0; | 198 | map_irq.pirq = -1; |
199 | map_irq.bus = dev->bus->number; | ||
200 | map_irq.devfn = dev->devfn; | ||
218 | 201 | ||
219 | error: | 202 | if (type == PCI_CAP_ID_MSIX) { |
220 | xen_destroy_irq(irq); | 203 | int pos; |
204 | u32 table_offset, bir; | ||
205 | |||
206 | pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); | ||
207 | |||
208 | pci_read_config_dword(dev, pos + PCI_MSIX_TABLE, | ||
209 | &table_offset); | ||
210 | bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK); | ||
211 | |||
212 | map_irq.table_base = pci_resource_start(dev, bir); | ||
213 | map_irq.entry_nr = msidesc->msi_attrib.entry_nr; | ||
214 | } | ||
215 | |||
216 | ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq); | ||
217 | if (ret) { | ||
218 | dev_warn(&dev->dev, "xen map irq failed %d\n", ret); | ||
219 | goto out; | ||
220 | } | ||
221 | |||
222 | ret = xen_bind_pirq_msi_to_irq(dev, msidesc, | ||
223 | map_irq.pirq, map_irq.index, | ||
224 | (type == PCI_CAP_ID_MSIX) ? | ||
225 | "msi-x" : "msi"); | ||
226 | if (ret < 0) | ||
227 | goto out; | ||
228 | } | ||
229 | ret = 0; | ||
230 | out: | ||
221 | return ret; | 231 | return ret; |
222 | } | 232 | } |
223 | #endif | 233 | #endif |
234 | #endif | ||
224 | 235 | ||
225 | static int xen_pcifront_enable_irq(struct pci_dev *dev) | 236 | static int xen_pcifront_enable_irq(struct pci_dev *dev) |
226 | { | 237 | { |
227 | int rc; | 238 | int rc; |
228 | int share = 1; | 239 | int share = 1; |
240 | u8 gsi; | ||
229 | 241 | ||
230 | dev_info(&dev->dev, "Xen PCI enabling IRQ: %d\n", dev->irq); | 242 | rc = pci_read_config_byte(dev, PCI_INTERRUPT_LINE, &gsi); |
231 | 243 | if (rc < 0) { | |
232 | if (dev->irq < 0) | 244 | dev_warn(&dev->dev, "Xen PCI: failed to read interrupt line: %d\n", |
233 | return -EINVAL; | 245 | rc); |
246 | return rc; | ||
247 | } | ||
234 | 248 | ||
235 | if (dev->irq < NR_IRQS_LEGACY) | 249 | if (gsi < NR_IRQS_LEGACY) |
236 | share = 0; | 250 | share = 0; |
237 | 251 | ||
238 | rc = xen_allocate_pirq(dev->irq, share, "pcifront"); | 252 | rc = xen_allocate_pirq(gsi, share, "pcifront"); |
239 | if (rc < 0) { | 253 | if (rc < 0) { |
240 | dev_warn(&dev->dev, "Xen PCI IRQ: %d, failed to register:%d\n", | 254 | dev_warn(&dev->dev, "Xen PCI: failed to register GSI%d: %d\n", |
241 | dev->irq, rc); | 255 | gsi, rc); |
242 | return rc; | 256 | return rc; |
243 | } | 257 | } |
258 | |||
259 | dev->irq = rc; | ||
260 | dev_info(&dev->dev, "Xen PCI mapped GSI%d to IRQ%d\n", gsi, dev->irq); | ||
244 | return 0; | 261 | return 0; |
245 | } | 262 | } |
246 | 263 | ||
diff --git a/arch/x86/platform/ce4100/ce4100.c b/arch/x86/platform/ce4100/ce4100.c index d2c0d51a7178..cd6f184c3b3f 100644 --- a/arch/x86/platform/ce4100/ce4100.c +++ b/arch/x86/platform/ce4100/ce4100.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/serial_reg.h> | 15 | #include <linux/serial_reg.h> |
16 | #include <linux/serial_8250.h> | 16 | #include <linux/serial_8250.h> |
17 | 17 | ||
18 | #include <asm/ce4100.h> | ||
18 | #include <asm/setup.h> | 19 | #include <asm/setup.h> |
19 | #include <asm/io.h> | 20 | #include <asm/io.h> |
20 | 21 | ||
@@ -129,4 +130,5 @@ void __init x86_ce4100_early_setup(void) | |||
129 | x86_init.resources.probe_roms = x86_init_noop; | 130 | x86_init.resources.probe_roms = x86_init_noop; |
130 | x86_init.mpparse.get_smp_config = x86_init_uint_noop; | 131 | x86_init.mpparse.get_smp_config = x86_init_uint_noop; |
131 | x86_init.mpparse.find_smp_config = sdv_find_smp_config; | 132 | x86_init.mpparse.find_smp_config = sdv_find_smp_config; |
133 | x86_init.pci.init = ce4100_pci_init; | ||
132 | } | 134 | } |
diff --git a/arch/x86/platform/olpc/olpc_dt.c b/arch/x86/platform/olpc/olpc_dt.c index dab874647530..044bda5b3174 100644 --- a/arch/x86/platform/olpc/olpc_dt.c +++ b/arch/x86/platform/olpc/olpc_dt.c | |||
@@ -140,8 +140,7 @@ void * __init prom_early_alloc(unsigned long size) | |||
140 | * wasted bootmem) and hand off chunks of it to callers. | 140 | * wasted bootmem) and hand off chunks of it to callers. |
141 | */ | 141 | */ |
142 | res = alloc_bootmem(chunk_size); | 142 | res = alloc_bootmem(chunk_size); |
143 | if (!res) | 143 | BUG_ON(!res); |
144 | return NULL; | ||
145 | prom_early_allocated += chunk_size; | 144 | prom_early_allocated += chunk_size; |
146 | memset(res, 0, chunk_size); | 145 | memset(res, 0, chunk_size); |
147 | free_mem = chunk_size; | 146 | free_mem = chunk_size; |
diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c index df58e9cad96a..a7b38d35c29a 100644 --- a/arch/x86/platform/uv/tlb_uv.c +++ b/arch/x86/platform/uv/tlb_uv.c | |||
@@ -1364,11 +1364,11 @@ uv_activation_descriptor_init(int node, int pnode) | |||
1364 | memset(bd2, 0, sizeof(struct bau_desc)); | 1364 | memset(bd2, 0, sizeof(struct bau_desc)); |
1365 | bd2->header.sw_ack_flag = 1; | 1365 | bd2->header.sw_ack_flag = 1; |
1366 | /* | 1366 | /* |
1367 | * base_dest_nodeid is the nasid (pnode<<1) of the first uvhub | 1367 | * base_dest_nodeid is the nasid of the first uvhub |
1368 | * in the partition. The bit map will indicate uvhub numbers, | 1368 | * in the partition. The bit map will indicate uvhub numbers, |
1369 | * which are 0-N in a partition. Pnodes are unique system-wide. | 1369 | * which are 0-N in a partition. Pnodes are unique system-wide. |
1370 | */ | 1370 | */ |
1371 | bd2->header.base_dest_nodeid = uv_partition_base_pnode << 1; | 1371 | bd2->header.base_dest_nodeid = UV_PNODE_TO_NASID(uv_partition_base_pnode); |
1372 | bd2->header.dest_subnodeid = 0x10; /* the LB */ | 1372 | bd2->header.dest_subnodeid = 0x10; /* the LB */ |
1373 | bd2->header.command = UV_NET_ENDPOINT_INTD; | 1373 | bd2->header.command = UV_NET_ENDPOINT_INTD; |
1374 | bd2->header.int_both = 1; | 1374 | bd2->header.int_both = 1; |
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig index 5b54892e4bc3..e4343fe488ed 100644 --- a/arch/x86/xen/Kconfig +++ b/arch/x86/xen/Kconfig | |||
@@ -48,3 +48,11 @@ config XEN_DEBUG_FS | |||
48 | help | 48 | help |
49 | Enable statistics output and various tuning options in debugfs. | 49 | Enable statistics output and various tuning options in debugfs. |
50 | Enabling this option may incur a significant performance overhead. | 50 | Enabling this option may incur a significant performance overhead. |
51 | |||
52 | config XEN_DEBUG | ||
53 | bool "Enable Xen debug checks" | ||
54 | depends on XEN | ||
55 | default n | ||
56 | help | ||
57 | Enable various WARN_ON checks in the Xen MMU code. | ||
58 | Enabling this option WILL incur a significant performance overhead. | ||
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 50542efe45fb..49dbd78ec3cb 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c | |||
@@ -1284,15 +1284,14 @@ static int init_hvm_pv_info(int *major, int *minor) | |||
1284 | 1284 | ||
1285 | xen_setup_features(); | 1285 | xen_setup_features(); |
1286 | 1286 | ||
1287 | pv_info = xen_info; | 1287 | pv_info.name = "Xen HVM"; |
1288 | pv_info.kernel_rpl = 0; | ||
1289 | 1288 | ||
1290 | xen_domain_type = XEN_HVM_DOMAIN; | 1289 | xen_domain_type = XEN_HVM_DOMAIN; |
1291 | 1290 | ||
1292 | return 0; | 1291 | return 0; |
1293 | } | 1292 | } |
1294 | 1293 | ||
1295 | void xen_hvm_init_shared_info(void) | 1294 | void __ref xen_hvm_init_shared_info(void) |
1296 | { | 1295 | { |
1297 | int cpu; | 1296 | int cpu; |
1298 | struct xen_add_to_physmap xatp; | 1297 | struct xen_add_to_physmap xatp; |
@@ -1331,6 +1330,8 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self, | |||
1331 | switch (action) { | 1330 | switch (action) { |
1332 | case CPU_UP_PREPARE: | 1331 | case CPU_UP_PREPARE: |
1333 | per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; | 1332 | per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; |
1333 | if (xen_have_vector_callback) | ||
1334 | xen_init_lock_cpu(cpu); | ||
1334 | break; | 1335 | break; |
1335 | default: | 1336 | default: |
1336 | break; | 1337 | break; |
@@ -1355,6 +1356,7 @@ static void __init xen_hvm_guest_init(void) | |||
1355 | 1356 | ||
1356 | if (xen_feature(XENFEAT_hvm_callback_vector)) | 1357 | if (xen_feature(XENFEAT_hvm_callback_vector)) |
1357 | xen_have_vector_callback = 1; | 1358 | xen_have_vector_callback = 1; |
1359 | xen_hvm_smp_init(); | ||
1358 | register_cpu_notifier(&xen_hvm_cpu_notifier); | 1360 | register_cpu_notifier(&xen_hvm_cpu_notifier); |
1359 | xen_unplug_emulated_devices(); | 1361 | xen_unplug_emulated_devices(); |
1360 | have_vcpu_info_placement = 0; | 1362 | have_vcpu_info_placement = 0; |
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index 5e92b61ad574..832765c0fb8c 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <linux/module.h> | 46 | #include <linux/module.h> |
47 | #include <linux/gfp.h> | 47 | #include <linux/gfp.h> |
48 | #include <linux/memblock.h> | 48 | #include <linux/memblock.h> |
49 | #include <linux/seq_file.h> | ||
49 | 50 | ||
50 | #include <asm/pgtable.h> | 51 | #include <asm/pgtable.h> |
51 | #include <asm/tlbflush.h> | 52 | #include <asm/tlbflush.h> |
@@ -416,8 +417,12 @@ static pteval_t pte_pfn_to_mfn(pteval_t val) | |||
416 | if (val & _PAGE_PRESENT) { | 417 | if (val & _PAGE_PRESENT) { |
417 | unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; | 418 | unsigned long pfn = (val & PTE_PFN_MASK) >> PAGE_SHIFT; |
418 | pteval_t flags = val & PTE_FLAGS_MASK; | 419 | pteval_t flags = val & PTE_FLAGS_MASK; |
419 | unsigned long mfn = pfn_to_mfn(pfn); | 420 | unsigned long mfn; |
420 | 421 | ||
422 | if (!xen_feature(XENFEAT_auto_translated_physmap)) | ||
423 | mfn = get_phys_to_machine(pfn); | ||
424 | else | ||
425 | mfn = pfn; | ||
421 | /* | 426 | /* |
422 | * If there's no mfn for the pfn, then just create an | 427 | * If there's no mfn for the pfn, then just create an |
423 | * empty non-present pte. Unfortunately this loses | 428 | * empty non-present pte. Unfortunately this loses |
@@ -427,8 +432,18 @@ static pteval_t pte_pfn_to_mfn(pteval_t val) | |||
427 | if (unlikely(mfn == INVALID_P2M_ENTRY)) { | 432 | if (unlikely(mfn == INVALID_P2M_ENTRY)) { |
428 | mfn = 0; | 433 | mfn = 0; |
429 | flags = 0; | 434 | flags = 0; |
435 | } else { | ||
436 | /* | ||
437 | * Paramount to do this test _after_ the | ||
438 | * INVALID_P2M_ENTRY as INVALID_P2M_ENTRY & | ||
439 | * IDENTITY_FRAME_BIT resolves to true. | ||
440 | */ | ||
441 | mfn &= ~FOREIGN_FRAME_BIT; | ||
442 | if (mfn & IDENTITY_FRAME_BIT) { | ||
443 | mfn &= ~IDENTITY_FRAME_BIT; | ||
444 | flags |= _PAGE_IOMAP; | ||
445 | } | ||
430 | } | 446 | } |
431 | |||
432 | val = ((pteval_t)mfn << PAGE_SHIFT) | flags; | 447 | val = ((pteval_t)mfn << PAGE_SHIFT) | flags; |
433 | } | 448 | } |
434 | 449 | ||
@@ -532,6 +547,41 @@ pte_t xen_make_pte(pteval_t pte) | |||
532 | } | 547 | } |
533 | PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte); | 548 | PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte); |
534 | 549 | ||
550 | #ifdef CONFIG_XEN_DEBUG | ||
551 | pte_t xen_make_pte_debug(pteval_t pte) | ||
552 | { | ||
553 | phys_addr_t addr = (pte & PTE_PFN_MASK); | ||
554 | phys_addr_t other_addr; | ||
555 | bool io_page = false; | ||
556 | pte_t _pte; | ||
557 | |||
558 | if (pte & _PAGE_IOMAP) | ||
559 | io_page = true; | ||
560 | |||
561 | _pte = xen_make_pte(pte); | ||
562 | |||
563 | if (!addr) | ||
564 | return _pte; | ||
565 | |||
566 | if (io_page && | ||
567 | (xen_initial_domain() || addr >= ISA_END_ADDRESS)) { | ||
568 | other_addr = pfn_to_mfn(addr >> PAGE_SHIFT) << PAGE_SHIFT; | ||
569 | WARN(addr != other_addr, | ||
570 | "0x%lx is using VM_IO, but it is 0x%lx!\n", | ||
571 | (unsigned long)addr, (unsigned long)other_addr); | ||
572 | } else { | ||
573 | pteval_t iomap_set = (_pte.pte & PTE_FLAGS_MASK) & _PAGE_IOMAP; | ||
574 | other_addr = (_pte.pte & PTE_PFN_MASK); | ||
575 | WARN((addr == other_addr) && (!io_page) && (!iomap_set), | ||
576 | "0x%lx is missing VM_IO (and wasn't fixed)!\n", | ||
577 | (unsigned long)addr); | ||
578 | } | ||
579 | |||
580 | return _pte; | ||
581 | } | ||
582 | PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte_debug); | ||
583 | #endif | ||
584 | |||
535 | pgd_t xen_make_pgd(pgdval_t pgd) | 585 | pgd_t xen_make_pgd(pgdval_t pgd) |
536 | { | 586 | { |
537 | pgd = pte_pfn_to_mfn(pgd); | 587 | pgd = pte_pfn_to_mfn(pgd); |
@@ -986,10 +1036,9 @@ static void xen_pgd_pin(struct mm_struct *mm) | |||
986 | */ | 1036 | */ |
987 | void xen_mm_pin_all(void) | 1037 | void xen_mm_pin_all(void) |
988 | { | 1038 | { |
989 | unsigned long flags; | ||
990 | struct page *page; | 1039 | struct page *page; |
991 | 1040 | ||
992 | spin_lock_irqsave(&pgd_lock, flags); | 1041 | spin_lock(&pgd_lock); |
993 | 1042 | ||
994 | list_for_each_entry(page, &pgd_list, lru) { | 1043 | list_for_each_entry(page, &pgd_list, lru) { |
995 | if (!PagePinned(page)) { | 1044 | if (!PagePinned(page)) { |
@@ -998,7 +1047,7 @@ void xen_mm_pin_all(void) | |||
998 | } | 1047 | } |
999 | } | 1048 | } |
1000 | 1049 | ||
1001 | spin_unlock_irqrestore(&pgd_lock, flags); | 1050 | spin_unlock(&pgd_lock); |
1002 | } | 1051 | } |
1003 | 1052 | ||
1004 | /* | 1053 | /* |
@@ -1099,10 +1148,9 @@ static void xen_pgd_unpin(struct mm_struct *mm) | |||
1099 | */ | 1148 | */ |
1100 | void xen_mm_unpin_all(void) | 1149 | void xen_mm_unpin_all(void) |
1101 | { | 1150 | { |
1102 | unsigned long flags; | ||
1103 | struct page *page; | 1151 | struct page *page; |
1104 | 1152 | ||
1105 | spin_lock_irqsave(&pgd_lock, flags); | 1153 | spin_lock(&pgd_lock); |
1106 | 1154 | ||
1107 | list_for_each_entry(page, &pgd_list, lru) { | 1155 | list_for_each_entry(page, &pgd_list, lru) { |
1108 | if (PageSavePinned(page)) { | 1156 | if (PageSavePinned(page)) { |
@@ -1112,7 +1160,7 @@ void xen_mm_unpin_all(void) | |||
1112 | } | 1160 | } |
1113 | } | 1161 | } |
1114 | 1162 | ||
1115 | spin_unlock_irqrestore(&pgd_lock, flags); | 1163 | spin_unlock(&pgd_lock); |
1116 | } | 1164 | } |
1117 | 1165 | ||
1118 | void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next) | 1166 | void xen_activate_mm(struct mm_struct *prev, struct mm_struct *next) |
@@ -1942,6 +1990,9 @@ __init void xen_ident_map_ISA(void) | |||
1942 | 1990 | ||
1943 | static __init void xen_post_allocator_init(void) | 1991 | static __init void xen_post_allocator_init(void) |
1944 | { | 1992 | { |
1993 | #ifdef CONFIG_XEN_DEBUG | ||
1994 | pv_mmu_ops.make_pte = PV_CALLEE_SAVE(xen_make_pte_debug); | ||
1995 | #endif | ||
1945 | pv_mmu_ops.set_pte = xen_set_pte; | 1996 | pv_mmu_ops.set_pte = xen_set_pte; |
1946 | pv_mmu_ops.set_pmd = xen_set_pmd; | 1997 | pv_mmu_ops.set_pmd = xen_set_pmd; |
1947 | pv_mmu_ops.set_pud = xen_set_pud; | 1998 | pv_mmu_ops.set_pud = xen_set_pud; |
@@ -2074,7 +2125,7 @@ static void xen_zap_pfn_range(unsigned long vaddr, unsigned int order, | |||
2074 | in_frames[i] = virt_to_mfn(vaddr); | 2125 | in_frames[i] = virt_to_mfn(vaddr); |
2075 | 2126 | ||
2076 | MULTI_update_va_mapping(mcs.mc, vaddr, VOID_PTE, 0); | 2127 | MULTI_update_va_mapping(mcs.mc, vaddr, VOID_PTE, 0); |
2077 | set_phys_to_machine(virt_to_pfn(vaddr), INVALID_P2M_ENTRY); | 2128 | __set_phys_to_machine(virt_to_pfn(vaddr), INVALID_P2M_ENTRY); |
2078 | 2129 | ||
2079 | if (out_frames) | 2130 | if (out_frames) |
2080 | out_frames[i] = virt_to_pfn(vaddr); | 2131 | out_frames[i] = virt_to_pfn(vaddr); |
@@ -2353,6 +2404,18 @@ EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range); | |||
2353 | 2404 | ||
2354 | #ifdef CONFIG_XEN_DEBUG_FS | 2405 | #ifdef CONFIG_XEN_DEBUG_FS |
2355 | 2406 | ||
2407 | static int p2m_dump_open(struct inode *inode, struct file *filp) | ||
2408 | { | ||
2409 | return single_open(filp, p2m_dump_show, NULL); | ||
2410 | } | ||
2411 | |||
2412 | static const struct file_operations p2m_dump_fops = { | ||
2413 | .open = p2m_dump_open, | ||
2414 | .read = seq_read, | ||
2415 | .llseek = seq_lseek, | ||
2416 | .release = single_release, | ||
2417 | }; | ||
2418 | |||
2356 | static struct dentry *d_mmu_debug; | 2419 | static struct dentry *d_mmu_debug; |
2357 | 2420 | ||
2358 | static int __init xen_mmu_debugfs(void) | 2421 | static int __init xen_mmu_debugfs(void) |
@@ -2408,6 +2471,7 @@ static int __init xen_mmu_debugfs(void) | |||
2408 | debugfs_create_u32("prot_commit_batched", 0444, d_mmu_debug, | 2471 | debugfs_create_u32("prot_commit_batched", 0444, d_mmu_debug, |
2409 | &mmu_stats.prot_commit_batched); | 2472 | &mmu_stats.prot_commit_batched); |
2410 | 2473 | ||
2474 | debugfs_create_file("p2m", 0600, d_mmu_debug, NULL, &p2m_dump_fops); | ||
2411 | return 0; | 2475 | return 0; |
2412 | } | 2476 | } |
2413 | fs_initcall(xen_mmu_debugfs); | 2477 | fs_initcall(xen_mmu_debugfs); |
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index fd12d7ce7ff9..215a3ce61068 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c | |||
@@ -23,6 +23,129 @@ | |||
23 | * P2M_PER_PAGE depends on the architecture, as a mfn is always | 23 | * P2M_PER_PAGE depends on the architecture, as a mfn is always |
24 | * unsigned long (8 bytes on 64-bit, 4 bytes on 32), leading to | 24 | * unsigned long (8 bytes on 64-bit, 4 bytes on 32), leading to |
25 | * 512 and 1024 entries respectively. | 25 | * 512 and 1024 entries respectively. |
26 | * | ||
27 | * In short, these structures contain the Machine Frame Number (MFN) of the PFN. | ||
28 | * | ||
29 | * However not all entries are filled with MFNs. Specifically for all other | ||
30 | * leaf entries, or for the top root, or middle one, for which there is a void | ||
31 | * entry, we assume it is "missing". So (for example) | ||
32 | * pfn_to_mfn(0x90909090)=INVALID_P2M_ENTRY. | ||
33 | * | ||
34 | * We also have the possibility of setting 1-1 mappings on certain regions, so | ||
35 | * that: | ||
36 | * pfn_to_mfn(0xc0000)=0xc0000 | ||
37 | * | ||
38 | * The benefit of this is, that we can assume for non-RAM regions (think | ||
39 | * PCI BARs, or ACPI spaces), we can create mappings easily b/c we | ||
40 | * get the PFN value to match the MFN. | ||
41 | * | ||
42 | * For this to work efficiently we have one new page p2m_identity and | ||
43 | * allocate (via reserved_brk) any other pages we need to cover the sides | ||
44 | * (1GB or 4MB boundary violations). All entries in p2m_identity are set to | ||
45 | * INVALID_P2M_ENTRY type (Xen toolstack only recognizes that and MFNs, | ||
46 | * no other fancy value). | ||
47 | * | ||
48 | * On lookup we spot that the entry points to p2m_identity and return the | ||
49 | * identity value instead of dereferencing and returning INVALID_P2M_ENTRY. | ||
50 | * If the entry points to an allocated page, we just proceed as before and | ||
51 | * return the PFN. If the PFN has IDENTITY_FRAME_BIT set we unmask that in | ||
52 | * appropriate functions (pfn_to_mfn). | ||
53 | * | ||
54 | * The reason for having the IDENTITY_FRAME_BIT instead of just returning the | ||
55 | * PFN is that we could find ourselves where pfn_to_mfn(pfn)==pfn for a | ||
56 | * non-identity pfn. To protect ourselves against we elect to set (and get) the | ||
57 | * IDENTITY_FRAME_BIT on all identity mapped PFNs. | ||
58 | * | ||
59 | * This simplistic diagram is used to explain the more subtle piece of code. | ||
60 | * There is also a digram of the P2M at the end that can help. | ||
61 | * Imagine your E820 looking as so: | ||
62 | * | ||
63 | * 1GB 2GB | ||
64 | * /-------------------+---------\/----\ /----------\ /---+-----\ | ||
65 | * | System RAM | Sys RAM ||ACPI| | reserved | | Sys RAM | | ||
66 | * \-------------------+---------/\----/ \----------/ \---+-----/ | ||
67 | * ^- 1029MB ^- 2001MB | ||
68 | * | ||
69 | * [1029MB = 263424 (0x40500), 2001MB = 512256 (0x7D100), | ||
70 | * 2048MB = 524288 (0x80000)] | ||
71 | * | ||
72 | * And dom0_mem=max:3GB,1GB is passed in to the guest, meaning memory past 1GB | ||
73 | * is actually not present (would have to kick the balloon driver to put it in). | ||
74 | * | ||
75 | * When we are told to set the PFNs for identity mapping (see patch: "xen/setup: | ||
76 | * Set identity mapping for non-RAM E820 and E820 gaps.") we pass in the start | ||
77 | * of the PFN and the end PFN (263424 and 512256 respectively). The first step | ||
78 | * is to reserve_brk a top leaf page if the p2m[1] is missing. The top leaf page | ||
79 | * covers 512^2 of page estate (1GB) and in case the start or end PFN is not | ||
80 | * aligned on 512^2*PAGE_SIZE (1GB) we loop on aligned 1GB PFNs from start pfn | ||
81 | * to end pfn. We reserve_brk top leaf pages if they are missing (means they | ||
82 | * point to p2m_mid_missing). | ||
83 | * | ||
84 | * With the E820 example above, 263424 is not 1GB aligned so we allocate a | ||
85 | * reserve_brk page which will cover the PFNs estate from 0x40000 to 0x80000. | ||
86 | * Each entry in the allocate page is "missing" (points to p2m_missing). | ||
87 | * | ||
88 | * Next stage is to determine if we need to do a more granular boundary check | ||
89 | * on the 4MB (or 2MB depending on architecture) off the start and end pfn's. | ||
90 | * We check if the start pfn and end pfn violate that boundary check, and if | ||
91 | * so reserve_brk a middle (p2m[x][y]) leaf page. This way we have a much finer | ||
92 | * granularity of setting which PFNs are missing and which ones are identity. | ||
93 | * In our example 263424 and 512256 both fail the check so we reserve_brk two | ||
94 | * pages. Populate them with INVALID_P2M_ENTRY (so they both have "missing" | ||
95 | * values) and assign them to p2m[1][2] and p2m[1][488] respectively. | ||
96 | * | ||
97 | * At this point we would at minimum reserve_brk one page, but could be up to | ||
98 | * three. Each call to set_phys_range_identity has at maximum a three page | ||
99 | * cost. If we were to query the P2M at this stage, all those entries from | ||
100 | * start PFN through end PFN (so 1029MB -> 2001MB) would return | ||
101 | * INVALID_P2M_ENTRY ("missing"). | ||
102 | * | ||
103 | * The next step is to walk from the start pfn to the end pfn setting | ||
104 | * the IDENTITY_FRAME_BIT on each PFN. This is done in set_phys_range_identity. | ||
105 | * If we find that the middle leaf is pointing to p2m_missing we can swap it | ||
106 | * over to p2m_identity - this way covering 4MB (or 2MB) PFN space. At this | ||
107 | * point we do not need to worry about boundary aligment (so no need to | ||
108 | * reserve_brk a middle page, figure out which PFNs are "missing" and which | ||
109 | * ones are identity), as that has been done earlier. If we find that the | ||
110 | * middle leaf is not occupied by p2m_identity or p2m_missing, we dereference | ||
111 | * that page (which covers 512 PFNs) and set the appropriate PFN with | ||
112 | * IDENTITY_FRAME_BIT. In our example 263424 and 512256 end up there, and we | ||
113 | * set from p2m[1][2][256->511] and p2m[1][488][0->256] with | ||
114 | * IDENTITY_FRAME_BIT set. | ||
115 | * | ||
116 | * All other regions that are void (or not filled) either point to p2m_missing | ||
117 | * (considered missing) or have the default value of INVALID_P2M_ENTRY (also | ||
118 | * considered missing). In our case, p2m[1][2][0->255] and p2m[1][488][257->511] | ||
119 | * contain the INVALID_P2M_ENTRY value and are considered "missing." | ||
120 | * | ||
121 | * This is what the p2m ends up looking (for the E820 above) with this | ||
122 | * fabulous drawing: | ||
123 | * | ||
124 | * p2m /--------------\ | ||
125 | * /-----\ | &mfn_list[0],| /-----------------\ | ||
126 | * | 0 |------>| &mfn_list[1],| /---------------\ | ~0, ~0, .. | | ||
127 | * |-----| | ..., ~0, ~0 | | ~0, ~0, [x]---+----->| IDENTITY [@256] | | ||
128 | * | 1 |---\ \--------------/ | [p2m_identity]+\ | IDENTITY [@257] | | ||
129 | * |-----| \ | [p2m_identity]+\\ | .... | | ||
130 | * | 2 |--\ \-------------------->| ... | \\ \----------------/ | ||
131 | * |-----| \ \---------------/ \\ | ||
132 | * | 3 |\ \ \\ p2m_identity | ||
133 | * |-----| \ \-------------------->/---------------\ /-----------------\ | ||
134 | * | .. +->+ | [p2m_identity]+-->| ~0, ~0, ~0, ... | | ||
135 | * \-----/ / | [p2m_identity]+-->| ..., ~0 | | ||
136 | * / /---------------\ | .... | \-----------------/ | ||
137 | * / | IDENTITY[@0] | /-+-[x], ~0, ~0.. | | ||
138 | * / | IDENTITY[@256]|<----/ \---------------/ | ||
139 | * / | ~0, ~0, .... | | ||
140 | * | \---------------/ | ||
141 | * | | ||
142 | * p2m_missing p2m_missing | ||
143 | * /------------------\ /------------\ | ||
144 | * | [p2m_mid_missing]+---->| ~0, ~0, ~0 | | ||
145 | * | [p2m_mid_missing]+---->| ..., ~0 | | ||
146 | * \------------------/ \------------/ | ||
147 | * | ||
148 | * where ~0 is INVALID_P2M_ENTRY. IDENTITY is (PFN | IDENTITY_BIT) | ||
26 | */ | 149 | */ |
27 | 150 | ||
28 | #include <linux/init.h> | 151 | #include <linux/init.h> |
@@ -30,6 +153,7 @@ | |||
30 | #include <linux/list.h> | 153 | #include <linux/list.h> |
31 | #include <linux/hash.h> | 154 | #include <linux/hash.h> |
32 | #include <linux/sched.h> | 155 | #include <linux/sched.h> |
156 | #include <linux/seq_file.h> | ||
33 | 157 | ||
34 | #include <asm/cache.h> | 158 | #include <asm/cache.h> |
35 | #include <asm/setup.h> | 159 | #include <asm/setup.h> |
@@ -59,9 +183,15 @@ static RESERVE_BRK_ARRAY(unsigned long **, p2m_top, P2M_TOP_PER_PAGE); | |||
59 | static RESERVE_BRK_ARRAY(unsigned long, p2m_top_mfn, P2M_TOP_PER_PAGE); | 183 | static RESERVE_BRK_ARRAY(unsigned long, p2m_top_mfn, P2M_TOP_PER_PAGE); |
60 | static RESERVE_BRK_ARRAY(unsigned long *, p2m_top_mfn_p, P2M_TOP_PER_PAGE); | 184 | static RESERVE_BRK_ARRAY(unsigned long *, p2m_top_mfn_p, P2M_TOP_PER_PAGE); |
61 | 185 | ||
186 | static RESERVE_BRK_ARRAY(unsigned long, p2m_identity, P2M_PER_PAGE); | ||
187 | |||
62 | RESERVE_BRK(p2m_mid, PAGE_SIZE * (MAX_DOMAIN_PAGES / (P2M_PER_PAGE * P2M_MID_PER_PAGE))); | 188 | RESERVE_BRK(p2m_mid, PAGE_SIZE * (MAX_DOMAIN_PAGES / (P2M_PER_PAGE * P2M_MID_PER_PAGE))); |
63 | RESERVE_BRK(p2m_mid_mfn, PAGE_SIZE * (MAX_DOMAIN_PAGES / (P2M_PER_PAGE * P2M_MID_PER_PAGE))); | 189 | RESERVE_BRK(p2m_mid_mfn, PAGE_SIZE * (MAX_DOMAIN_PAGES / (P2M_PER_PAGE * P2M_MID_PER_PAGE))); |
64 | 190 | ||
191 | /* We might hit two boundary violations at the start and end, at max each | ||
192 | * boundary violation will require three middle nodes. */ | ||
193 | RESERVE_BRK(p2m_mid_identity, PAGE_SIZE * 2 * 3); | ||
194 | |||
65 | static inline unsigned p2m_top_index(unsigned long pfn) | 195 | static inline unsigned p2m_top_index(unsigned long pfn) |
66 | { | 196 | { |
67 | BUG_ON(pfn >= MAX_P2M_PFN); | 197 | BUG_ON(pfn >= MAX_P2M_PFN); |
@@ -136,7 +266,7 @@ static void p2m_init(unsigned long *p2m) | |||
136 | * - After resume we're called from within stop_machine, but the mfn | 266 | * - After resume we're called from within stop_machine, but the mfn |
137 | * tree should alreay be completely allocated. | 267 | * tree should alreay be completely allocated. |
138 | */ | 268 | */ |
139 | void xen_build_mfn_list_list(void) | 269 | void __ref xen_build_mfn_list_list(void) |
140 | { | 270 | { |
141 | unsigned long pfn; | 271 | unsigned long pfn; |
142 | 272 | ||
@@ -221,6 +351,9 @@ void __init xen_build_dynamic_phys_to_machine(void) | |||
221 | p2m_top = extend_brk(PAGE_SIZE, PAGE_SIZE); | 351 | p2m_top = extend_brk(PAGE_SIZE, PAGE_SIZE); |
222 | p2m_top_init(p2m_top); | 352 | p2m_top_init(p2m_top); |
223 | 353 | ||
354 | p2m_identity = extend_brk(PAGE_SIZE, PAGE_SIZE); | ||
355 | p2m_init(p2m_identity); | ||
356 | |||
224 | /* | 357 | /* |
225 | * The domain builder gives us a pre-constructed p2m array in | 358 | * The domain builder gives us a pre-constructed p2m array in |
226 | * mfn_list for all the pages initially given to us, so we just | 359 | * mfn_list for all the pages initially given to us, so we just |
@@ -266,6 +399,14 @@ unsigned long get_phys_to_machine(unsigned long pfn) | |||
266 | mididx = p2m_mid_index(pfn); | 399 | mididx = p2m_mid_index(pfn); |
267 | idx = p2m_index(pfn); | 400 | idx = p2m_index(pfn); |
268 | 401 | ||
402 | /* | ||
403 | * The INVALID_P2M_ENTRY is filled in both p2m_*identity | ||
404 | * and in p2m_*missing, so returning the INVALID_P2M_ENTRY | ||
405 | * would be wrong. | ||
406 | */ | ||
407 | if (p2m_top[topidx][mididx] == p2m_identity) | ||
408 | return IDENTITY_FRAME(pfn); | ||
409 | |||
269 | return p2m_top[topidx][mididx][idx]; | 410 | return p2m_top[topidx][mididx][idx]; |
270 | } | 411 | } |
271 | EXPORT_SYMBOL_GPL(get_phys_to_machine); | 412 | EXPORT_SYMBOL_GPL(get_phys_to_machine); |
@@ -335,9 +476,11 @@ static bool alloc_p2m(unsigned long pfn) | |||
335 | p2m_top_mfn_p[topidx] = mid_mfn; | 476 | p2m_top_mfn_p[topidx] = mid_mfn; |
336 | } | 477 | } |
337 | 478 | ||
338 | if (p2m_top[topidx][mididx] == p2m_missing) { | 479 | if (p2m_top[topidx][mididx] == p2m_identity || |
480 | p2m_top[topidx][mididx] == p2m_missing) { | ||
339 | /* p2m leaf page is missing */ | 481 | /* p2m leaf page is missing */ |
340 | unsigned long *p2m; | 482 | unsigned long *p2m; |
483 | unsigned long *p2m_orig = p2m_top[topidx][mididx]; | ||
341 | 484 | ||
342 | p2m = alloc_p2m_page(); | 485 | p2m = alloc_p2m_page(); |
343 | if (!p2m) | 486 | if (!p2m) |
@@ -345,7 +488,7 @@ static bool alloc_p2m(unsigned long pfn) | |||
345 | 488 | ||
346 | p2m_init(p2m); | 489 | p2m_init(p2m); |
347 | 490 | ||
348 | if (cmpxchg(&mid[mididx], p2m_missing, p2m) != p2m_missing) | 491 | if (cmpxchg(&mid[mididx], p2m_orig, p2m) != p2m_orig) |
349 | free_p2m_page(p2m); | 492 | free_p2m_page(p2m); |
350 | else | 493 | else |
351 | mid_mfn[mididx] = virt_to_mfn(p2m); | 494 | mid_mfn[mididx] = virt_to_mfn(p2m); |
@@ -354,11 +497,91 @@ static bool alloc_p2m(unsigned long pfn) | |||
354 | return true; | 497 | return true; |
355 | } | 498 | } |
356 | 499 | ||
500 | bool __early_alloc_p2m(unsigned long pfn) | ||
501 | { | ||
502 | unsigned topidx, mididx, idx; | ||
503 | |||
504 | topidx = p2m_top_index(pfn); | ||
505 | mididx = p2m_mid_index(pfn); | ||
506 | idx = p2m_index(pfn); | ||
507 | |||
508 | /* Pfff.. No boundary cross-over, lets get out. */ | ||
509 | if (!idx) | ||
510 | return false; | ||
511 | |||
512 | WARN(p2m_top[topidx][mididx] == p2m_identity, | ||
513 | "P2M[%d][%d] == IDENTITY, should be MISSING (or alloced)!\n", | ||
514 | topidx, mididx); | ||
515 | |||
516 | /* | ||
517 | * Could be done by xen_build_dynamic_phys_to_machine.. | ||
518 | */ | ||
519 | if (p2m_top[topidx][mididx] != p2m_missing) | ||
520 | return false; | ||
521 | |||
522 | /* Boundary cross-over for the edges: */ | ||
523 | if (idx) { | ||
524 | unsigned long *p2m = extend_brk(PAGE_SIZE, PAGE_SIZE); | ||
525 | |||
526 | p2m_init(p2m); | ||
527 | |||
528 | p2m_top[topidx][mididx] = p2m; | ||
529 | |||
530 | } | ||
531 | return idx != 0; | ||
532 | } | ||
533 | unsigned long set_phys_range_identity(unsigned long pfn_s, | ||
534 | unsigned long pfn_e) | ||
535 | { | ||
536 | unsigned long pfn; | ||
537 | |||
538 | if (unlikely(pfn_s >= MAX_P2M_PFN || pfn_e >= MAX_P2M_PFN)) | ||
539 | return 0; | ||
540 | |||
541 | if (unlikely(xen_feature(XENFEAT_auto_translated_physmap))) | ||
542 | return pfn_e - pfn_s; | ||
543 | |||
544 | if (pfn_s > pfn_e) | ||
545 | return 0; | ||
546 | |||
547 | for (pfn = (pfn_s & ~(P2M_MID_PER_PAGE * P2M_PER_PAGE - 1)); | ||
548 | pfn < ALIGN(pfn_e, (P2M_MID_PER_PAGE * P2M_PER_PAGE)); | ||
549 | pfn += P2M_MID_PER_PAGE * P2M_PER_PAGE) | ||
550 | { | ||
551 | unsigned topidx = p2m_top_index(pfn); | ||
552 | if (p2m_top[topidx] == p2m_mid_missing) { | ||
553 | unsigned long **mid = extend_brk(PAGE_SIZE, PAGE_SIZE); | ||
554 | |||
555 | p2m_mid_init(mid); | ||
556 | |||
557 | p2m_top[topidx] = mid; | ||
558 | } | ||
559 | } | ||
560 | |||
561 | __early_alloc_p2m(pfn_s); | ||
562 | __early_alloc_p2m(pfn_e); | ||
563 | |||
564 | for (pfn = pfn_s; pfn < pfn_e; pfn++) | ||
565 | if (!__set_phys_to_machine(pfn, IDENTITY_FRAME(pfn))) | ||
566 | break; | ||
567 | |||
568 | if (!WARN((pfn - pfn_s) != (pfn_e - pfn_s), | ||
569 | "Identity mapping failed. We are %ld short of 1-1 mappings!\n", | ||
570 | (pfn_e - pfn_s) - (pfn - pfn_s))) | ||
571 | printk(KERN_DEBUG "1-1 mapping on %lx->%lx\n", pfn_s, pfn); | ||
572 | |||
573 | return pfn - pfn_s; | ||
574 | } | ||
575 | |||
357 | /* Try to install p2m mapping; fail if intermediate bits missing */ | 576 | /* Try to install p2m mapping; fail if intermediate bits missing */ |
358 | bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn) | 577 | bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn) |
359 | { | 578 | { |
360 | unsigned topidx, mididx, idx; | 579 | unsigned topidx, mididx, idx; |
361 | 580 | ||
581 | if (unlikely(xen_feature(XENFEAT_auto_translated_physmap))) { | ||
582 | BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY); | ||
583 | return true; | ||
584 | } | ||
362 | if (unlikely(pfn >= MAX_P2M_PFN)) { | 585 | if (unlikely(pfn >= MAX_P2M_PFN)) { |
363 | BUG_ON(mfn != INVALID_P2M_ENTRY); | 586 | BUG_ON(mfn != INVALID_P2M_ENTRY); |
364 | return true; | 587 | return true; |
@@ -368,6 +591,21 @@ bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn) | |||
368 | mididx = p2m_mid_index(pfn); | 591 | mididx = p2m_mid_index(pfn); |
369 | idx = p2m_index(pfn); | 592 | idx = p2m_index(pfn); |
370 | 593 | ||
594 | /* For sparse holes were the p2m leaf has real PFN along with | ||
595 | * PCI holes, stick in the PFN as the MFN value. | ||
596 | */ | ||
597 | if (mfn != INVALID_P2M_ENTRY && (mfn & IDENTITY_FRAME_BIT)) { | ||
598 | if (p2m_top[topidx][mididx] == p2m_identity) | ||
599 | return true; | ||
600 | |||
601 | /* Swap over from MISSING to IDENTITY if needed. */ | ||
602 | if (p2m_top[topidx][mididx] == p2m_missing) { | ||
603 | WARN_ON(cmpxchg(&p2m_top[topidx][mididx], p2m_missing, | ||
604 | p2m_identity) != p2m_missing); | ||
605 | return true; | ||
606 | } | ||
607 | } | ||
608 | |||
371 | if (p2m_top[topidx][mididx] == p2m_missing) | 609 | if (p2m_top[topidx][mididx] == p2m_missing) |
372 | return mfn == INVALID_P2M_ENTRY; | 610 | return mfn == INVALID_P2M_ENTRY; |
373 | 611 | ||
@@ -378,11 +616,6 @@ bool __set_phys_to_machine(unsigned long pfn, unsigned long mfn) | |||
378 | 616 | ||
379 | bool set_phys_to_machine(unsigned long pfn, unsigned long mfn) | 617 | bool set_phys_to_machine(unsigned long pfn, unsigned long mfn) |
380 | { | 618 | { |
381 | if (unlikely(xen_feature(XENFEAT_auto_translated_physmap))) { | ||
382 | BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY); | ||
383 | return true; | ||
384 | } | ||
385 | |||
386 | if (unlikely(!__set_phys_to_machine(pfn, mfn))) { | 619 | if (unlikely(!__set_phys_to_machine(pfn, mfn))) { |
387 | if (!alloc_p2m(pfn)) | 620 | if (!alloc_p2m(pfn)) |
388 | return false; | 621 | return false; |
@@ -421,7 +654,7 @@ int m2p_add_override(unsigned long mfn, struct page *page) | |||
421 | { | 654 | { |
422 | unsigned long flags; | 655 | unsigned long flags; |
423 | unsigned long pfn; | 656 | unsigned long pfn; |
424 | unsigned long address; | 657 | unsigned long uninitialized_var(address); |
425 | unsigned level; | 658 | unsigned level; |
426 | pte_t *ptep = NULL; | 659 | pte_t *ptep = NULL; |
427 | 660 | ||
@@ -455,7 +688,7 @@ int m2p_remove_override(struct page *page) | |||
455 | unsigned long flags; | 688 | unsigned long flags; |
456 | unsigned long mfn; | 689 | unsigned long mfn; |
457 | unsigned long pfn; | 690 | unsigned long pfn; |
458 | unsigned long address; | 691 | unsigned long uninitialized_var(address); |
459 | unsigned level; | 692 | unsigned level; |
460 | pte_t *ptep = NULL; | 693 | pte_t *ptep = NULL; |
461 | 694 | ||
@@ -520,3 +753,80 @@ unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn) | |||
520 | return ret; | 753 | return ret; |
521 | } | 754 | } |
522 | EXPORT_SYMBOL_GPL(m2p_find_override_pfn); | 755 | EXPORT_SYMBOL_GPL(m2p_find_override_pfn); |
756 | |||
757 | #ifdef CONFIG_XEN_DEBUG_FS | ||
758 | |||
759 | int p2m_dump_show(struct seq_file *m, void *v) | ||
760 | { | ||
761 | static const char * const level_name[] = { "top", "middle", | ||
762 | "entry", "abnormal" }; | ||
763 | static const char * const type_name[] = { "identity", "missing", | ||
764 | "pfn", "abnormal"}; | ||
765 | #define TYPE_IDENTITY 0 | ||
766 | #define TYPE_MISSING 1 | ||
767 | #define TYPE_PFN 2 | ||
768 | #define TYPE_UNKNOWN 3 | ||
769 | unsigned long pfn, prev_pfn_type = 0, prev_pfn_level = 0; | ||
770 | unsigned int uninitialized_var(prev_level); | ||
771 | unsigned int uninitialized_var(prev_type); | ||
772 | |||
773 | if (!p2m_top) | ||
774 | return 0; | ||
775 | |||
776 | for (pfn = 0; pfn < MAX_DOMAIN_PAGES; pfn++) { | ||
777 | unsigned topidx = p2m_top_index(pfn); | ||
778 | unsigned mididx = p2m_mid_index(pfn); | ||
779 | unsigned idx = p2m_index(pfn); | ||
780 | unsigned lvl, type; | ||
781 | |||
782 | lvl = 4; | ||
783 | type = TYPE_UNKNOWN; | ||
784 | if (p2m_top[topidx] == p2m_mid_missing) { | ||
785 | lvl = 0; type = TYPE_MISSING; | ||
786 | } else if (p2m_top[topidx] == NULL) { | ||
787 | lvl = 0; type = TYPE_UNKNOWN; | ||
788 | } else if (p2m_top[topidx][mididx] == NULL) { | ||
789 | lvl = 1; type = TYPE_UNKNOWN; | ||
790 | } else if (p2m_top[topidx][mididx] == p2m_identity) { | ||
791 | lvl = 1; type = TYPE_IDENTITY; | ||
792 | } else if (p2m_top[topidx][mididx] == p2m_missing) { | ||
793 | lvl = 1; type = TYPE_MISSING; | ||
794 | } else if (p2m_top[topidx][mididx][idx] == 0) { | ||
795 | lvl = 2; type = TYPE_UNKNOWN; | ||
796 | } else if (p2m_top[topidx][mididx][idx] == IDENTITY_FRAME(pfn)) { | ||
797 | lvl = 2; type = TYPE_IDENTITY; | ||
798 | } else if (p2m_top[topidx][mididx][idx] == INVALID_P2M_ENTRY) { | ||
799 | lvl = 2; type = TYPE_MISSING; | ||
800 | } else if (p2m_top[topidx][mididx][idx] == pfn) { | ||
801 | lvl = 2; type = TYPE_PFN; | ||
802 | } else if (p2m_top[topidx][mididx][idx] != pfn) { | ||
803 | lvl = 2; type = TYPE_PFN; | ||
804 | } | ||
805 | if (pfn == 0) { | ||
806 | prev_level = lvl; | ||
807 | prev_type = type; | ||
808 | } | ||
809 | if (pfn == MAX_DOMAIN_PAGES-1) { | ||
810 | lvl = 3; | ||
811 | type = TYPE_UNKNOWN; | ||
812 | } | ||
813 | if (prev_type != type) { | ||
814 | seq_printf(m, " [0x%lx->0x%lx] %s\n", | ||
815 | prev_pfn_type, pfn, type_name[prev_type]); | ||
816 | prev_pfn_type = pfn; | ||
817 | prev_type = type; | ||
818 | } | ||
819 | if (prev_level != lvl) { | ||
820 | seq_printf(m, " [0x%lx->0x%lx] level %s\n", | ||
821 | prev_pfn_level, pfn, level_name[prev_level]); | ||
822 | prev_pfn_level = pfn; | ||
823 | prev_level = lvl; | ||
824 | } | ||
825 | } | ||
826 | return 0; | ||
827 | #undef TYPE_IDENTITY | ||
828 | #undef TYPE_MISSING | ||
829 | #undef TYPE_PFN | ||
830 | #undef TYPE_UNKNOWN | ||
831 | } | ||
832 | #endif | ||
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index a8a66a50d446..fa0269a99377 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -52,6 +52,8 @@ phys_addr_t xen_extra_mem_start, xen_extra_mem_size; | |||
52 | 52 | ||
53 | static __init void xen_add_extra_mem(unsigned long pages) | 53 | static __init void xen_add_extra_mem(unsigned long pages) |
54 | { | 54 | { |
55 | unsigned long pfn; | ||
56 | |||
55 | u64 size = (u64)pages * PAGE_SIZE; | 57 | u64 size = (u64)pages * PAGE_SIZE; |
56 | u64 extra_start = xen_extra_mem_start + xen_extra_mem_size; | 58 | u64 extra_start = xen_extra_mem_start + xen_extra_mem_size; |
57 | 59 | ||
@@ -66,6 +68,9 @@ static __init void xen_add_extra_mem(unsigned long pages) | |||
66 | xen_extra_mem_size += size; | 68 | xen_extra_mem_size += size; |
67 | 69 | ||
68 | xen_max_p2m_pfn = PFN_DOWN(extra_start + size); | 70 | xen_max_p2m_pfn = PFN_DOWN(extra_start + size); |
71 | |||
72 | for (pfn = PFN_DOWN(extra_start); pfn <= xen_max_p2m_pfn; pfn++) | ||
73 | __set_phys_to_machine(pfn, INVALID_P2M_ENTRY); | ||
69 | } | 74 | } |
70 | 75 | ||
71 | static unsigned long __init xen_release_chunk(phys_addr_t start_addr, | 76 | static unsigned long __init xen_release_chunk(phys_addr_t start_addr, |
@@ -104,7 +109,7 @@ static unsigned long __init xen_release_chunk(phys_addr_t start_addr, | |||
104 | WARN(ret != 1, "Failed to release memory %lx-%lx err=%d\n", | 109 | WARN(ret != 1, "Failed to release memory %lx-%lx err=%d\n", |
105 | start, end, ret); | 110 | start, end, ret); |
106 | if (ret == 1) { | 111 | if (ret == 1) { |
107 | set_phys_to_machine(pfn, INVALID_P2M_ENTRY); | 112 | __set_phys_to_machine(pfn, INVALID_P2M_ENTRY); |
108 | len++; | 113 | len++; |
109 | } | 114 | } |
110 | } | 115 | } |
@@ -138,12 +143,55 @@ static unsigned long __init xen_return_unused_memory(unsigned long max_pfn, | |||
138 | return released; | 143 | return released; |
139 | } | 144 | } |
140 | 145 | ||
146 | static unsigned long __init xen_set_identity(const struct e820entry *list, | ||
147 | ssize_t map_size) | ||
148 | { | ||
149 | phys_addr_t last = xen_initial_domain() ? 0 : ISA_END_ADDRESS; | ||
150 | phys_addr_t start_pci = last; | ||
151 | const struct e820entry *entry; | ||
152 | unsigned long identity = 0; | ||
153 | int i; | ||
154 | |||
155 | for (i = 0, entry = list; i < map_size; i++, entry++) { | ||
156 | phys_addr_t start = entry->addr; | ||
157 | phys_addr_t end = start + entry->size; | ||
158 | |||
159 | if (start < last) | ||
160 | start = last; | ||
161 | |||
162 | if (end <= start) | ||
163 | continue; | ||
164 | |||
165 | /* Skip over the 1MB region. */ | ||
166 | if (last > end) | ||
167 | continue; | ||
168 | |||
169 | if (entry->type == E820_RAM) { | ||
170 | if (start > start_pci) | ||
171 | identity += set_phys_range_identity( | ||
172 | PFN_UP(start_pci), PFN_DOWN(start)); | ||
173 | |||
174 | /* Without saving 'last' we would gooble RAM too | ||
175 | * at the end of the loop. */ | ||
176 | last = end; | ||
177 | start_pci = end; | ||
178 | continue; | ||
179 | } | ||
180 | start_pci = min(start, start_pci); | ||
181 | last = end; | ||
182 | } | ||
183 | if (last > start_pci) | ||
184 | identity += set_phys_range_identity( | ||
185 | PFN_UP(start_pci), PFN_DOWN(last)); | ||
186 | return identity; | ||
187 | } | ||
141 | /** | 188 | /** |
142 | * machine_specific_memory_setup - Hook for machine specific memory setup. | 189 | * machine_specific_memory_setup - Hook for machine specific memory setup. |
143 | **/ | 190 | **/ |
144 | char * __init xen_memory_setup(void) | 191 | char * __init xen_memory_setup(void) |
145 | { | 192 | { |
146 | static struct e820entry map[E820MAX] __initdata; | 193 | static struct e820entry map[E820MAX] __initdata; |
194 | static struct e820entry map_raw[E820MAX] __initdata; | ||
147 | 195 | ||
148 | unsigned long max_pfn = xen_start_info->nr_pages; | 196 | unsigned long max_pfn = xen_start_info->nr_pages; |
149 | unsigned long long mem_end; | 197 | unsigned long long mem_end; |
@@ -151,6 +199,7 @@ char * __init xen_memory_setup(void) | |||
151 | struct xen_memory_map memmap; | 199 | struct xen_memory_map memmap; |
152 | unsigned long extra_pages = 0; | 200 | unsigned long extra_pages = 0; |
153 | unsigned long extra_limit; | 201 | unsigned long extra_limit; |
202 | unsigned long identity_pages = 0; | ||
154 | int i; | 203 | int i; |
155 | int op; | 204 | int op; |
156 | 205 | ||
@@ -176,6 +225,7 @@ char * __init xen_memory_setup(void) | |||
176 | } | 225 | } |
177 | BUG_ON(rc); | 226 | BUG_ON(rc); |
178 | 227 | ||
228 | memcpy(map_raw, map, sizeof(map)); | ||
179 | e820.nr_map = 0; | 229 | e820.nr_map = 0; |
180 | xen_extra_mem_start = mem_end; | 230 | xen_extra_mem_start = mem_end; |
181 | for (i = 0; i < memmap.nr_entries; i++) { | 231 | for (i = 0; i < memmap.nr_entries; i++) { |
@@ -194,6 +244,15 @@ char * __init xen_memory_setup(void) | |||
194 | end -= delta; | 244 | end -= delta; |
195 | 245 | ||
196 | extra_pages += PFN_DOWN(delta); | 246 | extra_pages += PFN_DOWN(delta); |
247 | /* | ||
248 | * Set RAM below 4GB that is not for us to be unusable. | ||
249 | * This prevents "System RAM" address space from being | ||
250 | * used as potential resource for I/O address (happens | ||
251 | * when 'allocate_resource' is called). | ||
252 | */ | ||
253 | if (delta && | ||
254 | (xen_initial_domain() && end < 0x100000000ULL)) | ||
255 | e820_add_region(end, delta, E820_UNUSABLE); | ||
197 | } | 256 | } |
198 | 257 | ||
199 | if (map[i].size > 0 && end > xen_extra_mem_start) | 258 | if (map[i].size > 0 && end > xen_extra_mem_start) |
@@ -251,6 +310,13 @@ char * __init xen_memory_setup(void) | |||
251 | 310 | ||
252 | xen_add_extra_mem(extra_pages); | 311 | xen_add_extra_mem(extra_pages); |
253 | 312 | ||
313 | /* | ||
314 | * Set P2M for all non-RAM pages and E820 gaps to be identity | ||
315 | * type PFNs. We supply it with the non-sanitized version | ||
316 | * of the E820. | ||
317 | */ | ||
318 | identity_pages = xen_set_identity(map_raw, memmap.nr_entries); | ||
319 | printk(KERN_INFO "Set %ld page(s) to 1-1 mapping.\n", identity_pages); | ||
254 | return "Xen"; | 320 | return "Xen"; |
255 | } | 321 | } |
256 | 322 | ||
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index 72a4c7959045..30612441ed99 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c | |||
@@ -509,3 +509,41 @@ void __init xen_smp_init(void) | |||
509 | xen_fill_possible_map(); | 509 | xen_fill_possible_map(); |
510 | xen_init_spinlocks(); | 510 | xen_init_spinlocks(); |
511 | } | 511 | } |
512 | |||
513 | static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus) | ||
514 | { | ||
515 | native_smp_prepare_cpus(max_cpus); | ||
516 | WARN_ON(xen_smp_intr_init(0)); | ||
517 | |||
518 | if (!xen_have_vector_callback) | ||
519 | return; | ||
520 | xen_init_lock_cpu(0); | ||
521 | xen_init_spinlocks(); | ||
522 | } | ||
523 | |||
524 | static int __cpuinit xen_hvm_cpu_up(unsigned int cpu) | ||
525 | { | ||
526 | int rc; | ||
527 | rc = native_cpu_up(cpu); | ||
528 | WARN_ON (xen_smp_intr_init(cpu)); | ||
529 | return rc; | ||
530 | } | ||
531 | |||
532 | static void xen_hvm_cpu_die(unsigned int cpu) | ||
533 | { | ||
534 | unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL); | ||
535 | unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL); | ||
536 | unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL); | ||
537 | unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), NULL); | ||
538 | native_cpu_die(cpu); | ||
539 | } | ||
540 | |||
541 | void __init xen_hvm_smp_init(void) | ||
542 | { | ||
543 | smp_ops.smp_prepare_cpus = xen_hvm_smp_prepare_cpus; | ||
544 | smp_ops.smp_send_reschedule = xen_smp_send_reschedule; | ||
545 | smp_ops.cpu_up = xen_hvm_cpu_up; | ||
546 | smp_ops.cpu_die = xen_hvm_cpu_die; | ||
547 | smp_ops.send_call_func_ipi = xen_smp_send_call_function_ipi; | ||
548 | smp_ops.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi; | ||
549 | } | ||
diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c index 9bbd63a129b5..45329c8c226e 100644 --- a/arch/x86/xen/suspend.c +++ b/arch/x86/xen/suspend.c | |||
@@ -12,7 +12,7 @@ | |||
12 | #include "xen-ops.h" | 12 | #include "xen-ops.h" |
13 | #include "mmu.h" | 13 | #include "mmu.h" |
14 | 14 | ||
15 | void xen_pre_suspend(void) | 15 | void xen_arch_pre_suspend(void) |
16 | { | 16 | { |
17 | xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn); | 17 | xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn); |
18 | xen_start_info->console.domU.mfn = | 18 | xen_start_info->console.domU.mfn = |
@@ -26,8 +26,9 @@ void xen_pre_suspend(void) | |||
26 | BUG(); | 26 | BUG(); |
27 | } | 27 | } |
28 | 28 | ||
29 | void xen_hvm_post_suspend(int suspend_cancelled) | 29 | void xen_arch_hvm_post_suspend(int suspend_cancelled) |
30 | { | 30 | { |
31 | #ifdef CONFIG_XEN_PVHVM | ||
31 | int cpu; | 32 | int cpu; |
32 | xen_hvm_init_shared_info(); | 33 | xen_hvm_init_shared_info(); |
33 | xen_callback_vector(); | 34 | xen_callback_vector(); |
@@ -37,9 +38,10 @@ void xen_hvm_post_suspend(int suspend_cancelled) | |||
37 | xen_setup_runstate_info(cpu); | 38 | xen_setup_runstate_info(cpu); |
38 | } | 39 | } |
39 | } | 40 | } |
41 | #endif | ||
40 | } | 42 | } |
41 | 43 | ||
42 | void xen_post_suspend(int suspend_cancelled) | 44 | void xen_arch_post_suspend(int suspend_cancelled) |
43 | { | 45 | { |
44 | xen_build_mfn_list_list(); | 46 | xen_build_mfn_list_list(); |
45 | 47 | ||
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index 067759e3d6a5..2e2d370a47b1 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c | |||
@@ -397,7 +397,9 @@ void xen_setup_timer(int cpu) | |||
397 | name = "<timer kasprintf failed>"; | 397 | name = "<timer kasprintf failed>"; |
398 | 398 | ||
399 | irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt, | 399 | irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt, |
400 | IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER, | 400 | IRQF_DISABLED|IRQF_PERCPU| |
401 | IRQF_NOBALANCING|IRQF_TIMER| | ||
402 | IRQF_FORCE_RESUME, | ||
401 | name, NULL); | 403 | name, NULL); |
402 | 404 | ||
403 | evt = &per_cpu(xen_clock_events, cpu); | 405 | evt = &per_cpu(xen_clock_events, cpu); |
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h index 9d41bf985757..3112f55638c4 100644 --- a/arch/x86/xen/xen-ops.h +++ b/arch/x86/xen/xen-ops.h | |||
@@ -64,10 +64,12 @@ void xen_setup_vcpu_info_placement(void); | |||
64 | 64 | ||
65 | #ifdef CONFIG_SMP | 65 | #ifdef CONFIG_SMP |
66 | void xen_smp_init(void); | 66 | void xen_smp_init(void); |
67 | void __init xen_hvm_smp_init(void); | ||
67 | 68 | ||
68 | extern cpumask_var_t xen_cpu_initialized_map; | 69 | extern cpumask_var_t xen_cpu_initialized_map; |
69 | #else | 70 | #else |
70 | static inline void xen_smp_init(void) {} | 71 | static inline void xen_smp_init(void) {} |
72 | static inline void xen_hvm_smp_init(void) {} | ||
71 | #endif | 73 | #endif |
72 | 74 | ||
73 | #ifdef CONFIG_PARAVIRT_SPINLOCKS | 75 | #ifdef CONFIG_PARAVIRT_SPINLOCKS |
diff --git a/block/blk-core.c b/block/blk-core.c index 2f4002f79a24..518dd423a5fe 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -352,7 +352,7 @@ void blk_start_queue(struct request_queue *q) | |||
352 | WARN_ON(!irqs_disabled()); | 352 | WARN_ON(!irqs_disabled()); |
353 | 353 | ||
354 | queue_flag_clear(QUEUE_FLAG_STOPPED, q); | 354 | queue_flag_clear(QUEUE_FLAG_STOPPED, q); |
355 | __blk_run_queue(q); | 355 | __blk_run_queue(q, false); |
356 | } | 356 | } |
357 | EXPORT_SYMBOL(blk_start_queue); | 357 | EXPORT_SYMBOL(blk_start_queue); |
358 | 358 | ||
@@ -403,13 +403,14 @@ EXPORT_SYMBOL(blk_sync_queue); | |||
403 | /** | 403 | /** |
404 | * __blk_run_queue - run a single device queue | 404 | * __blk_run_queue - run a single device queue |
405 | * @q: The queue to run | 405 | * @q: The queue to run |
406 | * @force_kblockd: Don't run @q->request_fn directly. Use kblockd. | ||
406 | * | 407 | * |
407 | * Description: | 408 | * Description: |
408 | * See @blk_run_queue. This variant must be called with the queue lock | 409 | * See @blk_run_queue. This variant must be called with the queue lock |
409 | * held and interrupts disabled. | 410 | * held and interrupts disabled. |
410 | * | 411 | * |
411 | */ | 412 | */ |
412 | void __blk_run_queue(struct request_queue *q) | 413 | void __blk_run_queue(struct request_queue *q, bool force_kblockd) |
413 | { | 414 | { |
414 | blk_remove_plug(q); | 415 | blk_remove_plug(q); |
415 | 416 | ||
@@ -423,7 +424,7 @@ void __blk_run_queue(struct request_queue *q) | |||
423 | * Only recurse once to avoid overrunning the stack, let the unplug | 424 | * Only recurse once to avoid overrunning the stack, let the unplug |
424 | * handling reinvoke the handler shortly if we already got there. | 425 | * handling reinvoke the handler shortly if we already got there. |
425 | */ | 426 | */ |
426 | if (!queue_flag_test_and_set(QUEUE_FLAG_REENTER, q)) { | 427 | if (!force_kblockd && !queue_flag_test_and_set(QUEUE_FLAG_REENTER, q)) { |
427 | q->request_fn(q); | 428 | q->request_fn(q); |
428 | queue_flag_clear(QUEUE_FLAG_REENTER, q); | 429 | queue_flag_clear(QUEUE_FLAG_REENTER, q); |
429 | } else { | 430 | } else { |
@@ -446,7 +447,7 @@ void blk_run_queue(struct request_queue *q) | |||
446 | unsigned long flags; | 447 | unsigned long flags; |
447 | 448 | ||
448 | spin_lock_irqsave(q->queue_lock, flags); | 449 | spin_lock_irqsave(q->queue_lock, flags); |
449 | __blk_run_queue(q); | 450 | __blk_run_queue(q, false); |
450 | spin_unlock_irqrestore(q->queue_lock, flags); | 451 | spin_unlock_irqrestore(q->queue_lock, flags); |
451 | } | 452 | } |
452 | EXPORT_SYMBOL(blk_run_queue); | 453 | EXPORT_SYMBOL(blk_run_queue); |
@@ -1053,7 +1054,7 @@ void blk_insert_request(struct request_queue *q, struct request *rq, | |||
1053 | 1054 | ||
1054 | drive_stat_acct(rq, 1); | 1055 | drive_stat_acct(rq, 1); |
1055 | __elv_add_request(q, rq, where, 0); | 1056 | __elv_add_request(q, rq, where, 0); |
1056 | __blk_run_queue(q); | 1057 | __blk_run_queue(q, false); |
1057 | spin_unlock_irqrestore(q->queue_lock, flags); | 1058 | spin_unlock_irqrestore(q->queue_lock, flags); |
1058 | } | 1059 | } |
1059 | EXPORT_SYMBOL(blk_insert_request); | 1060 | EXPORT_SYMBOL(blk_insert_request); |
@@ -2610,13 +2611,6 @@ int kblockd_schedule_work(struct request_queue *q, struct work_struct *work) | |||
2610 | } | 2611 | } |
2611 | EXPORT_SYMBOL(kblockd_schedule_work); | 2612 | EXPORT_SYMBOL(kblockd_schedule_work); |
2612 | 2613 | ||
2613 | int kblockd_schedule_delayed_work(struct request_queue *q, | ||
2614 | struct delayed_work *dwork, unsigned long delay) | ||
2615 | { | ||
2616 | return queue_delayed_work(kblockd_workqueue, dwork, delay); | ||
2617 | } | ||
2618 | EXPORT_SYMBOL(kblockd_schedule_delayed_work); | ||
2619 | |||
2620 | int __init blk_dev_init(void) | 2614 | int __init blk_dev_init(void) |
2621 | { | 2615 | { |
2622 | BUILD_BUG_ON(__REQ_NR_BITS > 8 * | 2616 | BUILD_BUG_ON(__REQ_NR_BITS > 8 * |
diff --git a/block/blk-flush.c b/block/blk-flush.c index 54b123d6563e..b27d0208611b 100644 --- a/block/blk-flush.c +++ b/block/blk-flush.c | |||
@@ -66,10 +66,12 @@ static void blk_flush_complete_seq_end_io(struct request_queue *q, | |||
66 | 66 | ||
67 | /* | 67 | /* |
68 | * Moving a request silently to empty queue_head may stall the | 68 | * Moving a request silently to empty queue_head may stall the |
69 | * queue. Kick the queue in those cases. | 69 | * queue. Kick the queue in those cases. This function is called |
70 | * from request completion path and calling directly into | ||
71 | * request_fn may confuse the driver. Always use kblockd. | ||
70 | */ | 72 | */ |
71 | if (was_empty && next_rq) | 73 | if (was_empty && next_rq) |
72 | __blk_run_queue(q); | 74 | __blk_run_queue(q, true); |
73 | } | 75 | } |
74 | 76 | ||
75 | static void pre_flush_end_io(struct request *rq, int error) | 77 | static void pre_flush_end_io(struct request *rq, int error) |
@@ -130,7 +132,7 @@ static struct request *queue_next_fseq(struct request_queue *q) | |||
130 | BUG(); | 132 | BUG(); |
131 | } | 133 | } |
132 | 134 | ||
133 | elv_insert(q, rq, ELEVATOR_INSERT_FRONT); | 135 | elv_insert(q, rq, ELEVATOR_INSERT_REQUEUE); |
134 | return rq; | 136 | return rq; |
135 | } | 137 | } |
136 | 138 | ||
diff --git a/block/blk-lib.c b/block/blk-lib.c index 1a320d2406b0..bd3e8df4d5e2 100644 --- a/block/blk-lib.c +++ b/block/blk-lib.c | |||
@@ -109,7 +109,6 @@ struct bio_batch | |||
109 | atomic_t done; | 109 | atomic_t done; |
110 | unsigned long flags; | 110 | unsigned long flags; |
111 | struct completion *wait; | 111 | struct completion *wait; |
112 | bio_end_io_t *end_io; | ||
113 | }; | 112 | }; |
114 | 113 | ||
115 | static void bio_batch_end_io(struct bio *bio, int err) | 114 | static void bio_batch_end_io(struct bio *bio, int err) |
@@ -122,17 +121,14 @@ static void bio_batch_end_io(struct bio *bio, int err) | |||
122 | else | 121 | else |
123 | clear_bit(BIO_UPTODATE, &bb->flags); | 122 | clear_bit(BIO_UPTODATE, &bb->flags); |
124 | } | 123 | } |
125 | if (bb) { | 124 | if (bb) |
126 | if (bb->end_io) | 125 | if (atomic_dec_and_test(&bb->done)) |
127 | bb->end_io(bio, err); | 126 | complete(bb->wait); |
128 | atomic_inc(&bb->done); | ||
129 | complete(bb->wait); | ||
130 | } | ||
131 | bio_put(bio); | 127 | bio_put(bio); |
132 | } | 128 | } |
133 | 129 | ||
134 | /** | 130 | /** |
135 | * blkdev_issue_zeroout generate number of zero filed write bios | 131 | * blkdev_issue_zeroout - generate number of zero filed write bios |
136 | * @bdev: blockdev to issue | 132 | * @bdev: blockdev to issue |
137 | * @sector: start sector | 133 | * @sector: start sector |
138 | * @nr_sects: number of sectors to write | 134 | * @nr_sects: number of sectors to write |
@@ -150,13 +146,12 @@ int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector, | |||
150 | int ret; | 146 | int ret; |
151 | struct bio *bio; | 147 | struct bio *bio; |
152 | struct bio_batch bb; | 148 | struct bio_batch bb; |
153 | unsigned int sz, issued = 0; | 149 | unsigned int sz; |
154 | DECLARE_COMPLETION_ONSTACK(wait); | 150 | DECLARE_COMPLETION_ONSTACK(wait); |
155 | 151 | ||
156 | atomic_set(&bb.done, 0); | 152 | atomic_set(&bb.done, 1); |
157 | bb.flags = 1 << BIO_UPTODATE; | 153 | bb.flags = 1 << BIO_UPTODATE; |
158 | bb.wait = &wait; | 154 | bb.wait = &wait; |
159 | bb.end_io = NULL; | ||
160 | 155 | ||
161 | submit: | 156 | submit: |
162 | ret = 0; | 157 | ret = 0; |
@@ -185,12 +180,12 @@ submit: | |||
185 | break; | 180 | break; |
186 | } | 181 | } |
187 | ret = 0; | 182 | ret = 0; |
188 | issued++; | 183 | atomic_inc(&bb.done); |
189 | submit_bio(WRITE, bio); | 184 | submit_bio(WRITE, bio); |
190 | } | 185 | } |
191 | 186 | ||
192 | /* Wait for bios in-flight */ | 187 | /* Wait for bios in-flight */ |
193 | while (issued != atomic_read(&bb.done)) | 188 | if (!atomic_dec_and_test(&bb.done)) |
194 | wait_for_completion(&wait); | 189 | wait_for_completion(&wait); |
195 | 190 | ||
196 | if (!test_bit(BIO_UPTODATE, &bb.flags)) | 191 | if (!test_bit(BIO_UPTODATE, &bb.flags)) |
diff --git a/block/blk-throttle.c b/block/blk-throttle.c index a89043a3caa4..e36cc10a346c 100644 --- a/block/blk-throttle.c +++ b/block/blk-throttle.c | |||
@@ -20,6 +20,11 @@ static int throtl_quantum = 32; | |||
20 | /* Throttling is performed over 100ms slice and after that slice is renewed */ | 20 | /* Throttling is performed over 100ms slice and after that slice is renewed */ |
21 | static unsigned long throtl_slice = HZ/10; /* 100 ms */ | 21 | static unsigned long throtl_slice = HZ/10; /* 100 ms */ |
22 | 22 | ||
23 | /* A workqueue to queue throttle related work */ | ||
24 | static struct workqueue_struct *kthrotld_workqueue; | ||
25 | static void throtl_schedule_delayed_work(struct throtl_data *td, | ||
26 | unsigned long delay); | ||
27 | |||
23 | struct throtl_rb_root { | 28 | struct throtl_rb_root { |
24 | struct rb_root rb; | 29 | struct rb_root rb; |
25 | struct rb_node *left; | 30 | struct rb_node *left; |
@@ -345,10 +350,9 @@ static void throtl_schedule_next_dispatch(struct throtl_data *td) | |||
345 | update_min_dispatch_time(st); | 350 | update_min_dispatch_time(st); |
346 | 351 | ||
347 | if (time_before_eq(st->min_disptime, jiffies)) | 352 | if (time_before_eq(st->min_disptime, jiffies)) |
348 | throtl_schedule_delayed_work(td->queue, 0); | 353 | throtl_schedule_delayed_work(td, 0); |
349 | else | 354 | else |
350 | throtl_schedule_delayed_work(td->queue, | 355 | throtl_schedule_delayed_work(td, (st->min_disptime - jiffies)); |
351 | (st->min_disptime - jiffies)); | ||
352 | } | 356 | } |
353 | 357 | ||
354 | static inline void | 358 | static inline void |
@@ -815,10 +819,10 @@ void blk_throtl_work(struct work_struct *work) | |||
815 | } | 819 | } |
816 | 820 | ||
817 | /* Call with queue lock held */ | 821 | /* Call with queue lock held */ |
818 | void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay) | 822 | static void |
823 | throtl_schedule_delayed_work(struct throtl_data *td, unsigned long delay) | ||
819 | { | 824 | { |
820 | 825 | ||
821 | struct throtl_data *td = q->td; | ||
822 | struct delayed_work *dwork = &td->throtl_work; | 826 | struct delayed_work *dwork = &td->throtl_work; |
823 | 827 | ||
824 | if (total_nr_queued(td) > 0) { | 828 | if (total_nr_queued(td) > 0) { |
@@ -827,12 +831,11 @@ void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay) | |||
827 | * Cancel that and schedule a new one. | 831 | * Cancel that and schedule a new one. |
828 | */ | 832 | */ |
829 | __cancel_delayed_work(dwork); | 833 | __cancel_delayed_work(dwork); |
830 | kblockd_schedule_delayed_work(q, dwork, delay); | 834 | queue_delayed_work(kthrotld_workqueue, dwork, delay); |
831 | throtl_log(td, "schedule work. delay=%lu jiffies=%lu", | 835 | throtl_log(td, "schedule work. delay=%lu jiffies=%lu", |
832 | delay, jiffies); | 836 | delay, jiffies); |
833 | } | 837 | } |
834 | } | 838 | } |
835 | EXPORT_SYMBOL(throtl_schedule_delayed_work); | ||
836 | 839 | ||
837 | static void | 840 | static void |
838 | throtl_destroy_tg(struct throtl_data *td, struct throtl_grp *tg) | 841 | throtl_destroy_tg(struct throtl_data *td, struct throtl_grp *tg) |
@@ -920,7 +923,7 @@ static void throtl_update_blkio_group_read_bps(void *key, | |||
920 | smp_mb__after_atomic_inc(); | 923 | smp_mb__after_atomic_inc(); |
921 | 924 | ||
922 | /* Schedule a work now to process the limit change */ | 925 | /* Schedule a work now to process the limit change */ |
923 | throtl_schedule_delayed_work(td->queue, 0); | 926 | throtl_schedule_delayed_work(td, 0); |
924 | } | 927 | } |
925 | 928 | ||
926 | static void throtl_update_blkio_group_write_bps(void *key, | 929 | static void throtl_update_blkio_group_write_bps(void *key, |
@@ -934,7 +937,7 @@ static void throtl_update_blkio_group_write_bps(void *key, | |||
934 | smp_mb__before_atomic_inc(); | 937 | smp_mb__before_atomic_inc(); |
935 | atomic_inc(&td->limits_changed); | 938 | atomic_inc(&td->limits_changed); |
936 | smp_mb__after_atomic_inc(); | 939 | smp_mb__after_atomic_inc(); |
937 | throtl_schedule_delayed_work(td->queue, 0); | 940 | throtl_schedule_delayed_work(td, 0); |
938 | } | 941 | } |
939 | 942 | ||
940 | static void throtl_update_blkio_group_read_iops(void *key, | 943 | static void throtl_update_blkio_group_read_iops(void *key, |
@@ -948,7 +951,7 @@ static void throtl_update_blkio_group_read_iops(void *key, | |||
948 | smp_mb__before_atomic_inc(); | 951 | smp_mb__before_atomic_inc(); |
949 | atomic_inc(&td->limits_changed); | 952 | atomic_inc(&td->limits_changed); |
950 | smp_mb__after_atomic_inc(); | 953 | smp_mb__after_atomic_inc(); |
951 | throtl_schedule_delayed_work(td->queue, 0); | 954 | throtl_schedule_delayed_work(td, 0); |
952 | } | 955 | } |
953 | 956 | ||
954 | static void throtl_update_blkio_group_write_iops(void *key, | 957 | static void throtl_update_blkio_group_write_iops(void *key, |
@@ -962,7 +965,7 @@ static void throtl_update_blkio_group_write_iops(void *key, | |||
962 | smp_mb__before_atomic_inc(); | 965 | smp_mb__before_atomic_inc(); |
963 | atomic_inc(&td->limits_changed); | 966 | atomic_inc(&td->limits_changed); |
964 | smp_mb__after_atomic_inc(); | 967 | smp_mb__after_atomic_inc(); |
965 | throtl_schedule_delayed_work(td->queue, 0); | 968 | throtl_schedule_delayed_work(td, 0); |
966 | } | 969 | } |
967 | 970 | ||
968 | void throtl_shutdown_timer_wq(struct request_queue *q) | 971 | void throtl_shutdown_timer_wq(struct request_queue *q) |
@@ -1135,6 +1138,10 @@ void blk_throtl_exit(struct request_queue *q) | |||
1135 | 1138 | ||
1136 | static int __init throtl_init(void) | 1139 | static int __init throtl_init(void) |
1137 | { | 1140 | { |
1141 | kthrotld_workqueue = alloc_workqueue("kthrotld", WQ_MEM_RECLAIM, 0); | ||
1142 | if (!kthrotld_workqueue) | ||
1143 | panic("Failed to create kthrotld\n"); | ||
1144 | |||
1138 | blkio_policy_register(&blkio_policy_throtl); | 1145 | blkio_policy_register(&blkio_policy_throtl); |
1139 | return 0; | 1146 | return 0; |
1140 | } | 1147 | } |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 7be4c7959625..ea83a4f0c27d 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -3355,7 +3355,7 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
3355 | cfqd->busy_queues > 1) { | 3355 | cfqd->busy_queues > 1) { |
3356 | cfq_del_timer(cfqd, cfqq); | 3356 | cfq_del_timer(cfqd, cfqq); |
3357 | cfq_clear_cfqq_wait_request(cfqq); | 3357 | cfq_clear_cfqq_wait_request(cfqq); |
3358 | __blk_run_queue(cfqd->queue); | 3358 | __blk_run_queue(cfqd->queue, false); |
3359 | } else { | 3359 | } else { |
3360 | cfq_blkiocg_update_idle_time_stats( | 3360 | cfq_blkiocg_update_idle_time_stats( |
3361 | &cfqq->cfqg->blkg); | 3361 | &cfqq->cfqg->blkg); |
@@ -3370,7 +3370,7 @@ cfq_rq_enqueued(struct cfq_data *cfqd, struct cfq_queue *cfqq, | |||
3370 | * this new queue is RT and the current one is BE | 3370 | * this new queue is RT and the current one is BE |
3371 | */ | 3371 | */ |
3372 | cfq_preempt_queue(cfqd, cfqq); | 3372 | cfq_preempt_queue(cfqd, cfqq); |
3373 | __blk_run_queue(cfqd->queue); | 3373 | __blk_run_queue(cfqd->queue, false); |
3374 | } | 3374 | } |
3375 | } | 3375 | } |
3376 | 3376 | ||
@@ -3731,7 +3731,7 @@ static void cfq_kick_queue(struct work_struct *work) | |||
3731 | struct request_queue *q = cfqd->queue; | 3731 | struct request_queue *q = cfqd->queue; |
3732 | 3732 | ||
3733 | spin_lock_irq(q->queue_lock); | 3733 | spin_lock_irq(q->queue_lock); |
3734 | __blk_run_queue(cfqd->queue); | 3734 | __blk_run_queue(cfqd->queue, false); |
3735 | spin_unlock_irq(q->queue_lock); | 3735 | spin_unlock_irq(q->queue_lock); |
3736 | } | 3736 | } |
3737 | 3737 | ||
diff --git a/block/elevator.c b/block/elevator.c index 2569512830d3..236e93c1f46c 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -602,7 +602,7 @@ void elv_quiesce_start(struct request_queue *q) | |||
602 | */ | 602 | */ |
603 | elv_drain_elevator(q); | 603 | elv_drain_elevator(q); |
604 | while (q->rq.elvpriv) { | 604 | while (q->rq.elvpriv) { |
605 | __blk_run_queue(q); | 605 | __blk_run_queue(q, false); |
606 | spin_unlock_irq(q->queue_lock); | 606 | spin_unlock_irq(q->queue_lock); |
607 | msleep(10); | 607 | msleep(10); |
608 | spin_lock_irq(q->queue_lock); | 608 | spin_lock_irq(q->queue_lock); |
@@ -651,7 +651,7 @@ void elv_insert(struct request_queue *q, struct request *rq, int where) | |||
651 | * with anything. There's no point in delaying queue | 651 | * with anything. There's no point in delaying queue |
652 | * processing. | 652 | * processing. |
653 | */ | 653 | */ |
654 | __blk_run_queue(q); | 654 | __blk_run_queue(q, false); |
655 | break; | 655 | break; |
656 | 656 | ||
657 | case ELEVATOR_INSERT_SORT: | 657 | case ELEVATOR_INSERT_SORT: |
diff --git a/block/genhd.c b/block/genhd.c index 6a5b772aa201..cbf1112a885c 100644 --- a/block/genhd.c +++ b/block/genhd.c | |||
@@ -1355,7 +1355,7 @@ int invalidate_partition(struct gendisk *disk, int partno) | |||
1355 | struct block_device *bdev = bdget_disk(disk, partno); | 1355 | struct block_device *bdev = bdget_disk(disk, partno); |
1356 | if (bdev) { | 1356 | if (bdev) { |
1357 | fsync_bdev(bdev); | 1357 | fsync_bdev(bdev); |
1358 | res = __invalidate_device(bdev); | 1358 | res = __invalidate_device(bdev, true); |
1359 | bdput(bdev); | 1359 | bdput(bdev); |
1360 | } | 1360 | } |
1361 | return res; | 1361 | return res; |
diff --git a/block/ioctl.c b/block/ioctl.c index 9049d460fa89..1124cd297263 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
@@ -294,9 +294,11 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd, | |||
294 | return -EINVAL; | 294 | return -EINVAL; |
295 | if (get_user(n, (int __user *) arg)) | 295 | if (get_user(n, (int __user *) arg)) |
296 | return -EFAULT; | 296 | return -EFAULT; |
297 | if (!(mode & FMODE_EXCL) && | 297 | if (!(mode & FMODE_EXCL)) { |
298 | blkdev_get(bdev, mode | FMODE_EXCL, &bdev) < 0) | 298 | bdgrab(bdev); |
299 | return -EBUSY; | 299 | if (blkdev_get(bdev, mode | FMODE_EXCL, &bdev) < 0) |
300 | return -EBUSY; | ||
301 | } | ||
300 | ret = set_blocksize(bdev, n); | 302 | ret = set_blocksize(bdev, n); |
301 | if (!(mode & FMODE_EXCL)) | 303 | if (!(mode & FMODE_EXCL)) |
302 | blkdev_put(bdev, mode | FMODE_EXCL); | 304 | blkdev_put(bdev, mode | FMODE_EXCL); |
diff --git a/drivers/acpi/acpica/aclocal.h b/drivers/acpi/acpica/aclocal.h index 54784bb42cec..edc25867ad9d 100644 --- a/drivers/acpi/acpica/aclocal.h +++ b/drivers/acpi/acpica/aclocal.h | |||
@@ -416,10 +416,15 @@ struct acpi_gpe_handler_info { | |||
416 | u8 originally_enabled; /* True if GPE was originally enabled */ | 416 | u8 originally_enabled; /* True if GPE was originally enabled */ |
417 | }; | 417 | }; |
418 | 418 | ||
419 | struct acpi_gpe_notify_object { | ||
420 | struct acpi_namespace_node *node; | ||
421 | struct acpi_gpe_notify_object *next; | ||
422 | }; | ||
423 | |||
419 | union acpi_gpe_dispatch_info { | 424 | union acpi_gpe_dispatch_info { |
420 | struct acpi_namespace_node *method_node; /* Method node for this GPE level */ | 425 | struct acpi_namespace_node *method_node; /* Method node for this GPE level */ |
421 | struct acpi_gpe_handler_info *handler; /* Installed GPE handler */ | 426 | struct acpi_gpe_handler_info *handler; /* Installed GPE handler */ |
422 | struct acpi_namespace_node *device_node; /* Parent _PRW device for implicit notify */ | 427 | struct acpi_gpe_notify_object device; /* List of _PRW devices for implicit notify */ |
423 | }; | 428 | }; |
424 | 429 | ||
425 | /* | 430 | /* |
diff --git a/drivers/acpi/acpica/evgpe.c b/drivers/acpi/acpica/evgpe.c index 14988a86066f..f4725212eb48 100644 --- a/drivers/acpi/acpica/evgpe.c +++ b/drivers/acpi/acpica/evgpe.c | |||
@@ -457,6 +457,7 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | |||
457 | acpi_status status; | 457 | acpi_status status; |
458 | struct acpi_gpe_event_info *local_gpe_event_info; | 458 | struct acpi_gpe_event_info *local_gpe_event_info; |
459 | struct acpi_evaluate_info *info; | 459 | struct acpi_evaluate_info *info; |
460 | struct acpi_gpe_notify_object *notify_object; | ||
460 | 461 | ||
461 | ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method); | 462 | ACPI_FUNCTION_TRACE(ev_asynch_execute_gpe_method); |
462 | 463 | ||
@@ -508,10 +509,18 @@ static void ACPI_SYSTEM_XFACE acpi_ev_asynch_execute_gpe_method(void *context) | |||
508 | * from this thread -- because handlers may in turn run other | 509 | * from this thread -- because handlers may in turn run other |
509 | * control methods. | 510 | * control methods. |
510 | */ | 511 | */ |
511 | status = | 512 | status = acpi_ev_queue_notify_request( |
512 | acpi_ev_queue_notify_request(local_gpe_event_info->dispatch. | 513 | local_gpe_event_info->dispatch.device.node, |
513 | device_node, | 514 | ACPI_NOTIFY_DEVICE_WAKE); |
514 | ACPI_NOTIFY_DEVICE_WAKE); | 515 | |
516 | notify_object = local_gpe_event_info->dispatch.device.next; | ||
517 | while (ACPI_SUCCESS(status) && notify_object) { | ||
518 | status = acpi_ev_queue_notify_request( | ||
519 | notify_object->node, | ||
520 | ACPI_NOTIFY_DEVICE_WAKE); | ||
521 | notify_object = notify_object->next; | ||
522 | } | ||
523 | |||
515 | break; | 524 | break; |
516 | 525 | ||
517 | case ACPI_GPE_DISPATCH_METHOD: | 526 | case ACPI_GPE_DISPATCH_METHOD: |
diff --git a/drivers/acpi/acpica/evxfgpe.c b/drivers/acpi/acpica/evxfgpe.c index 3b20a3401b64..52aaff3df562 100644 --- a/drivers/acpi/acpica/evxfgpe.c +++ b/drivers/acpi/acpica/evxfgpe.c | |||
@@ -198,7 +198,9 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device, | |||
198 | acpi_status status = AE_BAD_PARAMETER; | 198 | acpi_status status = AE_BAD_PARAMETER; |
199 | struct acpi_gpe_event_info *gpe_event_info; | 199 | struct acpi_gpe_event_info *gpe_event_info; |
200 | struct acpi_namespace_node *device_node; | 200 | struct acpi_namespace_node *device_node; |
201 | struct acpi_gpe_notify_object *notify_object; | ||
201 | acpi_cpu_flags flags; | 202 | acpi_cpu_flags flags; |
203 | u8 gpe_dispatch_mask; | ||
202 | 204 | ||
203 | ACPI_FUNCTION_TRACE(acpi_setup_gpe_for_wake); | 205 | ACPI_FUNCTION_TRACE(acpi_setup_gpe_for_wake); |
204 | 206 | ||
@@ -221,27 +223,49 @@ acpi_setup_gpe_for_wake(acpi_handle wake_device, | |||
221 | goto unlock_and_exit; | 223 | goto unlock_and_exit; |
222 | } | 224 | } |
223 | 225 | ||
226 | if (wake_device == ACPI_ROOT_OBJECT) { | ||
227 | goto out; | ||
228 | } | ||
229 | |||
224 | /* | 230 | /* |
225 | * If there is no method or handler for this GPE, then the | 231 | * If there is no method or handler for this GPE, then the |
226 | * wake_device will be notified whenever this GPE fires (aka | 232 | * wake_device will be notified whenever this GPE fires (aka |
227 | * "implicit notify") Note: The GPE is assumed to be | 233 | * "implicit notify") Note: The GPE is assumed to be |
228 | * level-triggered (for windows compatibility). | 234 | * level-triggered (for windows compatibility). |
229 | */ | 235 | */ |
230 | if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) == | 236 | gpe_dispatch_mask = gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK; |
231 | ACPI_GPE_DISPATCH_NONE) && (wake_device != ACPI_ROOT_OBJECT)) { | 237 | if (gpe_dispatch_mask != ACPI_GPE_DISPATCH_NONE |
238 | && gpe_dispatch_mask != ACPI_GPE_DISPATCH_NOTIFY) { | ||
239 | goto out; | ||
240 | } | ||
232 | 241 | ||
233 | /* Validate wake_device is of type Device */ | 242 | /* Validate wake_device is of type Device */ |
234 | 243 | ||
235 | device_node = ACPI_CAST_PTR(struct acpi_namespace_node, | 244 | device_node = ACPI_CAST_PTR(struct acpi_namespace_node, wake_device); |
236 | wake_device); | 245 | if (device_node->type != ACPI_TYPE_DEVICE) { |
237 | if (device_node->type != ACPI_TYPE_DEVICE) { | 246 | goto unlock_and_exit; |
238 | goto unlock_and_exit; | 247 | } |
239 | } | 248 | |
249 | if (gpe_dispatch_mask == ACPI_GPE_DISPATCH_NONE) { | ||
240 | gpe_event_info->flags = (ACPI_GPE_DISPATCH_NOTIFY | | 250 | gpe_event_info->flags = (ACPI_GPE_DISPATCH_NOTIFY | |
241 | ACPI_GPE_LEVEL_TRIGGERED); | 251 | ACPI_GPE_LEVEL_TRIGGERED); |
242 | gpe_event_info->dispatch.device_node = device_node; | 252 | gpe_event_info->dispatch.device.node = device_node; |
253 | gpe_event_info->dispatch.device.next = NULL; | ||
254 | } else { | ||
255 | /* There are multiple devices to notify implicitly. */ | ||
256 | |||
257 | notify_object = ACPI_ALLOCATE_ZEROED(sizeof(*notify_object)); | ||
258 | if (!notify_object) { | ||
259 | status = AE_NO_MEMORY; | ||
260 | goto unlock_and_exit; | ||
261 | } | ||
262 | |||
263 | notify_object->node = device_node; | ||
264 | notify_object->next = gpe_event_info->dispatch.device.next; | ||
265 | gpe_event_info->dispatch.device.next = notify_object; | ||
243 | } | 266 | } |
244 | 267 | ||
268 | out: | ||
245 | gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; | 269 | gpe_event_info->flags |= ACPI_GPE_CAN_WAKE; |
246 | status = AE_OK; | 270 | status = AE_OK; |
247 | 271 | ||
diff --git a/drivers/acpi/debugfs.c b/drivers/acpi/debugfs.c index 5df67f1d6c61..384f7abcff77 100644 --- a/drivers/acpi/debugfs.c +++ b/drivers/acpi/debugfs.c | |||
@@ -26,7 +26,9 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf, | |||
26 | size_t count, loff_t *ppos) | 26 | size_t count, loff_t *ppos) |
27 | { | 27 | { |
28 | static char *buf; | 28 | static char *buf; |
29 | static int uncopied_bytes; | 29 | static u32 max_size; |
30 | static u32 uncopied_bytes; | ||
31 | |||
30 | struct acpi_table_header table; | 32 | struct acpi_table_header table; |
31 | acpi_status status; | 33 | acpi_status status; |
32 | 34 | ||
@@ -37,19 +39,24 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf, | |||
37 | if (copy_from_user(&table, user_buf, | 39 | if (copy_from_user(&table, user_buf, |
38 | sizeof(struct acpi_table_header))) | 40 | sizeof(struct acpi_table_header))) |
39 | return -EFAULT; | 41 | return -EFAULT; |
40 | uncopied_bytes = table.length; | 42 | uncopied_bytes = max_size = table.length; |
41 | buf = kzalloc(uncopied_bytes, GFP_KERNEL); | 43 | buf = kzalloc(max_size, GFP_KERNEL); |
42 | if (!buf) | 44 | if (!buf) |
43 | return -ENOMEM; | 45 | return -ENOMEM; |
44 | } | 46 | } |
45 | 47 | ||
46 | if (uncopied_bytes < count) { | 48 | if (buf == NULL) |
47 | kfree(buf); | 49 | return -EINVAL; |
50 | |||
51 | if ((*ppos > max_size) || | ||
52 | (*ppos + count > max_size) || | ||
53 | (*ppos + count < count) || | ||
54 | (count > uncopied_bytes)) | ||
48 | return -EINVAL; | 55 | return -EINVAL; |
49 | } | ||
50 | 56 | ||
51 | if (copy_from_user(buf + (*ppos), user_buf, count)) { | 57 | if (copy_from_user(buf + (*ppos), user_buf, count)) { |
52 | kfree(buf); | 58 | kfree(buf); |
59 | buf = NULL; | ||
53 | return -EFAULT; | 60 | return -EFAULT; |
54 | } | 61 | } |
55 | 62 | ||
@@ -59,6 +66,7 @@ static ssize_t cm_write(struct file *file, const char __user * user_buf, | |||
59 | if (!uncopied_bytes) { | 66 | if (!uncopied_bytes) { |
60 | status = acpi_install_method(buf); | 67 | status = acpi_install_method(buf); |
61 | kfree(buf); | 68 | kfree(buf); |
69 | buf = NULL; | ||
62 | if (ACPI_FAILURE(status)) | 70 | if (ACPI_FAILURE(status)) |
63 | return -EINVAL; | 71 | return -EINVAL; |
64 | add_taint(TAINT_OVERRIDDEN_ACPI_TABLE); | 72 | add_taint(TAINT_OVERRIDDEN_ACPI_TABLE); |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index b9ba04fc2b34..77fc76f8aea9 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -3281,7 +3281,7 @@ static int set_geometry(unsigned int cmd, struct floppy_struct *g, | |||
3281 | struct block_device *bdev = opened_bdev[cnt]; | 3281 | struct block_device *bdev = opened_bdev[cnt]; |
3282 | if (!bdev || ITYPE(drive_state[cnt].fd_device) != type) | 3282 | if (!bdev || ITYPE(drive_state[cnt].fd_device) != type) |
3283 | continue; | 3283 | continue; |
3284 | __invalidate_device(bdev); | 3284 | __invalidate_device(bdev, true); |
3285 | } | 3285 | } |
3286 | mutex_unlock(&open_lock); | 3286 | mutex_unlock(&open_lock); |
3287 | } else { | 3287 | } else { |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 49e6a545eb63..dbf31ec9114d 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -78,7 +78,6 @@ | |||
78 | 78 | ||
79 | #include <asm/uaccess.h> | 79 | #include <asm/uaccess.h> |
80 | 80 | ||
81 | static DEFINE_MUTEX(loop_mutex); | ||
82 | static LIST_HEAD(loop_devices); | 81 | static LIST_HEAD(loop_devices); |
83 | static DEFINE_MUTEX(loop_devices_mutex); | 82 | static DEFINE_MUTEX(loop_devices_mutex); |
84 | 83 | ||
@@ -1501,11 +1500,9 @@ static int lo_open(struct block_device *bdev, fmode_t mode) | |||
1501 | { | 1500 | { |
1502 | struct loop_device *lo = bdev->bd_disk->private_data; | 1501 | struct loop_device *lo = bdev->bd_disk->private_data; |
1503 | 1502 | ||
1504 | mutex_lock(&loop_mutex); | ||
1505 | mutex_lock(&lo->lo_ctl_mutex); | 1503 | mutex_lock(&lo->lo_ctl_mutex); |
1506 | lo->lo_refcnt++; | 1504 | lo->lo_refcnt++; |
1507 | mutex_unlock(&lo->lo_ctl_mutex); | 1505 | mutex_unlock(&lo->lo_ctl_mutex); |
1508 | mutex_unlock(&loop_mutex); | ||
1509 | 1506 | ||
1510 | return 0; | 1507 | return 0; |
1511 | } | 1508 | } |
@@ -1515,7 +1512,6 @@ static int lo_release(struct gendisk *disk, fmode_t mode) | |||
1515 | struct loop_device *lo = disk->private_data; | 1512 | struct loop_device *lo = disk->private_data; |
1516 | int err; | 1513 | int err; |
1517 | 1514 | ||
1518 | mutex_lock(&loop_mutex); | ||
1519 | mutex_lock(&lo->lo_ctl_mutex); | 1515 | mutex_lock(&lo->lo_ctl_mutex); |
1520 | 1516 | ||
1521 | if (--lo->lo_refcnt) | 1517 | if (--lo->lo_refcnt) |
@@ -1540,7 +1536,6 @@ static int lo_release(struct gendisk *disk, fmode_t mode) | |||
1540 | out: | 1536 | out: |
1541 | mutex_unlock(&lo->lo_ctl_mutex); | 1537 | mutex_unlock(&lo->lo_ctl_mutex); |
1542 | out_unlocked: | 1538 | out_unlocked: |
1543 | mutex_unlock(&loop_mutex); | ||
1544 | return 0; | 1539 | return 0; |
1545 | } | 1540 | } |
1546 | 1541 | ||
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index d7aa39e349a6..9cb8668ff5f4 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -120,6 +120,10 @@ static DEFINE_SPINLOCK(minor_lock); | |||
120 | #define EXTENDED (1<<EXT_SHIFT) | 120 | #define EXTENDED (1<<EXT_SHIFT) |
121 | #define VDEV_IS_EXTENDED(dev) ((dev)&(EXTENDED)) | 121 | #define VDEV_IS_EXTENDED(dev) ((dev)&(EXTENDED)) |
122 | #define BLKIF_MINOR_EXT(dev) ((dev)&(~EXTENDED)) | 122 | #define BLKIF_MINOR_EXT(dev) ((dev)&(~EXTENDED)) |
123 | #define EMULATED_HD_DISK_MINOR_OFFSET (0) | ||
124 | #define EMULATED_HD_DISK_NAME_OFFSET (EMULATED_HD_DISK_MINOR_OFFSET / 256) | ||
125 | #define EMULATED_SD_DISK_MINOR_OFFSET (EMULATED_HD_DISK_MINOR_OFFSET + (4 * 16)) | ||
126 | #define EMULATED_SD_DISK_NAME_OFFSET (EMULATED_HD_DISK_NAME_OFFSET + 4) | ||
123 | 127 | ||
124 | #define DEV_NAME "xvd" /* name in /dev */ | 128 | #define DEV_NAME "xvd" /* name in /dev */ |
125 | 129 | ||
@@ -281,7 +285,7 @@ static int blkif_queue_request(struct request *req) | |||
281 | info->shadow[id].request = req; | 285 | info->shadow[id].request = req; |
282 | 286 | ||
283 | ring_req->id = id; | 287 | ring_req->id = id; |
284 | ring_req->sector_number = (blkif_sector_t)blk_rq_pos(req); | 288 | ring_req->u.rw.sector_number = (blkif_sector_t)blk_rq_pos(req); |
285 | ring_req->handle = info->handle; | 289 | ring_req->handle = info->handle; |
286 | 290 | ||
287 | ring_req->operation = rq_data_dir(req) ? | 291 | ring_req->operation = rq_data_dir(req) ? |
@@ -317,7 +321,7 @@ static int blkif_queue_request(struct request *req) | |||
317 | rq_data_dir(req) ); | 321 | rq_data_dir(req) ); |
318 | 322 | ||
319 | info->shadow[id].frame[i] = mfn_to_pfn(buffer_mfn); | 323 | info->shadow[id].frame[i] = mfn_to_pfn(buffer_mfn); |
320 | ring_req->seg[i] = | 324 | ring_req->u.rw.seg[i] = |
321 | (struct blkif_request_segment) { | 325 | (struct blkif_request_segment) { |
322 | .gref = ref, | 326 | .gref = ref, |
323 | .first_sect = fsect, | 327 | .first_sect = fsect, |
@@ -434,6 +438,65 @@ static void xlvbd_flush(struct blkfront_info *info) | |||
434 | info->feature_flush ? "enabled" : "disabled"); | 438 | info->feature_flush ? "enabled" : "disabled"); |
435 | } | 439 | } |
436 | 440 | ||
441 | static int xen_translate_vdev(int vdevice, int *minor, unsigned int *offset) | ||
442 | { | ||
443 | int major; | ||
444 | major = BLKIF_MAJOR(vdevice); | ||
445 | *minor = BLKIF_MINOR(vdevice); | ||
446 | switch (major) { | ||
447 | case XEN_IDE0_MAJOR: | ||
448 | *offset = (*minor / 64) + EMULATED_HD_DISK_NAME_OFFSET; | ||
449 | *minor = ((*minor / 64) * PARTS_PER_DISK) + | ||
450 | EMULATED_HD_DISK_MINOR_OFFSET; | ||
451 | break; | ||
452 | case XEN_IDE1_MAJOR: | ||
453 | *offset = (*minor / 64) + 2 + EMULATED_HD_DISK_NAME_OFFSET; | ||
454 | *minor = (((*minor / 64) + 2) * PARTS_PER_DISK) + | ||
455 | EMULATED_HD_DISK_MINOR_OFFSET; | ||
456 | break; | ||
457 | case XEN_SCSI_DISK0_MAJOR: | ||
458 | *offset = (*minor / PARTS_PER_DISK) + EMULATED_SD_DISK_NAME_OFFSET; | ||
459 | *minor = *minor + EMULATED_SD_DISK_MINOR_OFFSET; | ||
460 | break; | ||
461 | case XEN_SCSI_DISK1_MAJOR: | ||
462 | case XEN_SCSI_DISK2_MAJOR: | ||
463 | case XEN_SCSI_DISK3_MAJOR: | ||
464 | case XEN_SCSI_DISK4_MAJOR: | ||
465 | case XEN_SCSI_DISK5_MAJOR: | ||
466 | case XEN_SCSI_DISK6_MAJOR: | ||
467 | case XEN_SCSI_DISK7_MAJOR: | ||
468 | *offset = (*minor / PARTS_PER_DISK) + | ||
469 | ((major - XEN_SCSI_DISK1_MAJOR + 1) * 16) + | ||
470 | EMULATED_SD_DISK_NAME_OFFSET; | ||
471 | *minor = *minor + | ||
472 | ((major - XEN_SCSI_DISK1_MAJOR + 1) * 16 * PARTS_PER_DISK) + | ||
473 | EMULATED_SD_DISK_MINOR_OFFSET; | ||
474 | break; | ||
475 | case XEN_SCSI_DISK8_MAJOR: | ||
476 | case XEN_SCSI_DISK9_MAJOR: | ||
477 | case XEN_SCSI_DISK10_MAJOR: | ||
478 | case XEN_SCSI_DISK11_MAJOR: | ||
479 | case XEN_SCSI_DISK12_MAJOR: | ||
480 | case XEN_SCSI_DISK13_MAJOR: | ||
481 | case XEN_SCSI_DISK14_MAJOR: | ||
482 | case XEN_SCSI_DISK15_MAJOR: | ||
483 | *offset = (*minor / PARTS_PER_DISK) + | ||
484 | ((major - XEN_SCSI_DISK8_MAJOR + 8) * 16) + | ||
485 | EMULATED_SD_DISK_NAME_OFFSET; | ||
486 | *minor = *minor + | ||
487 | ((major - XEN_SCSI_DISK8_MAJOR + 8) * 16 * PARTS_PER_DISK) + | ||
488 | EMULATED_SD_DISK_MINOR_OFFSET; | ||
489 | break; | ||
490 | case XENVBD_MAJOR: | ||
491 | *offset = *minor / PARTS_PER_DISK; | ||
492 | break; | ||
493 | default: | ||
494 | printk(KERN_WARNING "blkfront: your disk configuration is " | ||
495 | "incorrect, please use an xvd device instead\n"); | ||
496 | return -ENODEV; | ||
497 | } | ||
498 | return 0; | ||
499 | } | ||
437 | 500 | ||
438 | static int xlvbd_alloc_gendisk(blkif_sector_t capacity, | 501 | static int xlvbd_alloc_gendisk(blkif_sector_t capacity, |
439 | struct blkfront_info *info, | 502 | struct blkfront_info *info, |
@@ -441,7 +504,7 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity, | |||
441 | { | 504 | { |
442 | struct gendisk *gd; | 505 | struct gendisk *gd; |
443 | int nr_minors = 1; | 506 | int nr_minors = 1; |
444 | int err = -ENODEV; | 507 | int err; |
445 | unsigned int offset; | 508 | unsigned int offset; |
446 | int minor; | 509 | int minor; |
447 | int nr_parts; | 510 | int nr_parts; |
@@ -456,12 +519,20 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity, | |||
456 | } | 519 | } |
457 | 520 | ||
458 | if (!VDEV_IS_EXTENDED(info->vdevice)) { | 521 | if (!VDEV_IS_EXTENDED(info->vdevice)) { |
459 | minor = BLKIF_MINOR(info->vdevice); | 522 | err = xen_translate_vdev(info->vdevice, &minor, &offset); |
460 | nr_parts = PARTS_PER_DISK; | 523 | if (err) |
524 | return err; | ||
525 | nr_parts = PARTS_PER_DISK; | ||
461 | } else { | 526 | } else { |
462 | minor = BLKIF_MINOR_EXT(info->vdevice); | 527 | minor = BLKIF_MINOR_EXT(info->vdevice); |
463 | nr_parts = PARTS_PER_EXT_DISK; | 528 | nr_parts = PARTS_PER_EXT_DISK; |
529 | offset = minor / nr_parts; | ||
530 | if (xen_hvm_domain() && offset <= EMULATED_HD_DISK_NAME_OFFSET + 4) | ||
531 | printk(KERN_WARNING "blkfront: vdevice 0x%x might conflict with " | ||
532 | "emulated IDE disks,\n\t choose an xvd device name" | ||
533 | "from xvde on\n", info->vdevice); | ||
464 | } | 534 | } |
535 | err = -ENODEV; | ||
465 | 536 | ||
466 | if ((minor % nr_parts) == 0) | 537 | if ((minor % nr_parts) == 0) |
467 | nr_minors = nr_parts; | 538 | nr_minors = nr_parts; |
@@ -475,8 +546,6 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity, | |||
475 | if (gd == NULL) | 546 | if (gd == NULL) |
476 | goto release; | 547 | goto release; |
477 | 548 | ||
478 | offset = minor / nr_parts; | ||
479 | |||
480 | if (nr_minors > 1) { | 549 | if (nr_minors > 1) { |
481 | if (offset < 26) | 550 | if (offset < 26) |
482 | sprintf(gd->disk_name, "%s%c", DEV_NAME, 'a' + offset); | 551 | sprintf(gd->disk_name, "%s%c", DEV_NAME, 'a' + offset); |
@@ -615,7 +684,7 @@ static void blkif_completion(struct blk_shadow *s) | |||
615 | { | 684 | { |
616 | int i; | 685 | int i; |
617 | for (i = 0; i < s->req.nr_segments; i++) | 686 | for (i = 0; i < s->req.nr_segments; i++) |
618 | gnttab_end_foreign_access(s->req.seg[i].gref, 0, 0UL); | 687 | gnttab_end_foreign_access(s->req.u.rw.seg[i].gref, 0, 0UL); |
619 | } | 688 | } |
620 | 689 | ||
621 | static irqreturn_t blkif_interrupt(int irq, void *dev_id) | 690 | static irqreturn_t blkif_interrupt(int irq, void *dev_id) |
@@ -932,7 +1001,7 @@ static int blkif_recover(struct blkfront_info *info) | |||
932 | /* Rewrite any grant references invalidated by susp/resume. */ | 1001 | /* Rewrite any grant references invalidated by susp/resume. */ |
933 | for (j = 0; j < req->nr_segments; j++) | 1002 | for (j = 0; j < req->nr_segments; j++) |
934 | gnttab_grant_foreign_access_ref( | 1003 | gnttab_grant_foreign_access_ref( |
935 | req->seg[j].gref, | 1004 | req->u.rw.seg[j].gref, |
936 | info->xbdev->otherend_id, | 1005 | info->xbdev->otherend_id, |
937 | pfn_to_mfn(info->shadow[req->id].frame[j]), | 1006 | pfn_to_mfn(info->shadow[req->id].frame[j]), |
938 | rq_data_dir(info->shadow[req->id].request)); | 1007 | rq_data_dir(info->shadow[req->id].request)); |
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 333c21289d97..6dcd55a74c0a 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c | |||
@@ -41,6 +41,9 @@ static struct usb_device_id ath3k_table[] = { | |||
41 | 41 | ||
42 | /* Atheros AR9285 Malbec with sflash firmware */ | 42 | /* Atheros AR9285 Malbec with sflash firmware */ |
43 | { USB_DEVICE(0x03F0, 0x311D) }, | 43 | { USB_DEVICE(0x03F0, 0x311D) }, |
44 | |||
45 | /* Atheros AR5BBU12 with sflash firmware */ | ||
46 | { USB_DEVICE(0x0489, 0xE02C) }, | ||
44 | { } /* Terminating entry */ | 47 | { } /* Terminating entry */ |
45 | }; | 48 | }; |
46 | 49 | ||
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 4cefa91e6c34..700a3840fddc 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c | |||
@@ -105,6 +105,9 @@ static struct usb_device_id blacklist_table[] = { | |||
105 | /* Atheros AR9285 Malbec with sflash firmware */ | 105 | /* Atheros AR9285 Malbec with sflash firmware */ |
106 | { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, | 106 | { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE }, |
107 | 107 | ||
108 | /* Atheros AR5BBU12 with sflash firmware */ | ||
109 | { USB_DEVICE(0x0489, 0xe02c), .driver_info = BTUSB_IGNORE }, | ||
110 | |||
108 | /* Broadcom BCM2035 */ | 111 | /* Broadcom BCM2035 */ |
109 | { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, | 112 | { USB_DEVICE(0x0a5c, 0x2035), .driver_info = BTUSB_WRONG_SCO_MTU }, |
110 | { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, | 113 | { USB_DEVICE(0x0a5c, 0x200a), .driver_info = BTUSB_WRONG_SCO_MTU }, |
@@ -829,7 +832,7 @@ static void btusb_work(struct work_struct *work) | |||
829 | 832 | ||
830 | if (hdev->conn_hash.sco_num > 0) { | 833 | if (hdev->conn_hash.sco_num > 0) { |
831 | if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) { | 834 | if (!test_bit(BTUSB_DID_ISO_RESUME, &data->flags)) { |
832 | err = usb_autopm_get_interface(data->isoc); | 835 | err = usb_autopm_get_interface(data->isoc ? data->isoc : data->intf); |
833 | if (err < 0) { | 836 | if (err < 0) { |
834 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); | 837 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); |
835 | usb_kill_anchored_urbs(&data->isoc_anchor); | 838 | usb_kill_anchored_urbs(&data->isoc_anchor); |
@@ -858,7 +861,7 @@ static void btusb_work(struct work_struct *work) | |||
858 | 861 | ||
859 | __set_isoc_interface(hdev, 0); | 862 | __set_isoc_interface(hdev, 0); |
860 | if (test_and_clear_bit(BTUSB_DID_ISO_RESUME, &data->flags)) | 863 | if (test_and_clear_bit(BTUSB_DID_ISO_RESUME, &data->flags)) |
861 | usb_autopm_put_interface(data->isoc); | 864 | usb_autopm_put_interface(data->isoc ? data->isoc : data->intf); |
862 | } | 865 | } |
863 | } | 866 | } |
864 | 867 | ||
@@ -1041,8 +1044,6 @@ static int btusb_probe(struct usb_interface *intf, | |||
1041 | 1044 | ||
1042 | usb_set_intfdata(intf, data); | 1045 | usb_set_intfdata(intf, data); |
1043 | 1046 | ||
1044 | usb_enable_autosuspend(interface_to_usbdev(intf)); | ||
1045 | |||
1046 | return 0; | 1047 | return 0; |
1047 | } | 1048 | } |
1048 | 1049 | ||
diff --git a/drivers/char/agp/amd64-agp.c b/drivers/char/agp/amd64-agp.c index 9252e85706ef..780498d76581 100644 --- a/drivers/char/agp/amd64-agp.c +++ b/drivers/char/agp/amd64-agp.c | |||
@@ -773,18 +773,23 @@ int __init agp_amd64_init(void) | |||
773 | #else | 773 | #else |
774 | printk(KERN_INFO PFX "You can boot with agp=try_unsupported\n"); | 774 | printk(KERN_INFO PFX "You can boot with agp=try_unsupported\n"); |
775 | #endif | 775 | #endif |
776 | pci_unregister_driver(&agp_amd64_pci_driver); | ||
776 | return -ENODEV; | 777 | return -ENODEV; |
777 | } | 778 | } |
778 | 779 | ||
779 | /* First check that we have at least one AMD64 NB */ | 780 | /* First check that we have at least one AMD64 NB */ |
780 | if (!pci_dev_present(amd_nb_misc_ids)) | 781 | if (!pci_dev_present(amd_nb_misc_ids)) { |
782 | pci_unregister_driver(&agp_amd64_pci_driver); | ||
781 | return -ENODEV; | 783 | return -ENODEV; |
784 | } | ||
782 | 785 | ||
783 | /* Look for any AGP bridge */ | 786 | /* Look for any AGP bridge */ |
784 | agp_amd64_pci_driver.id_table = agp_amd64_pci_promisc_table; | 787 | agp_amd64_pci_driver.id_table = agp_amd64_pci_promisc_table; |
785 | err = driver_attach(&agp_amd64_pci_driver.driver); | 788 | err = driver_attach(&agp_amd64_pci_driver.driver); |
786 | if (err == 0 && agp_bridges_found == 0) | 789 | if (err == 0 && agp_bridges_found == 0) { |
790 | pci_unregister_driver(&agp_amd64_pci_driver); | ||
787 | err = -ENODEV; | 791 | err = -ENODEV; |
792 | } | ||
788 | } | 793 | } |
789 | return err; | 794 | return err; |
790 | } | 795 | } |
diff --git a/drivers/char/agp/intel-agp.h b/drivers/char/agp/intel-agp.h index c195bfeade11..5feebe2800e9 100644 --- a/drivers/char/agp/intel-agp.h +++ b/drivers/char/agp/intel-agp.h | |||
@@ -130,6 +130,7 @@ | |||
130 | #define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4) | 130 | #define INTEL_GMCH_GMS_STOLEN_352M (0xd << 4) |
131 | 131 | ||
132 | #define I915_IFPADDR 0x60 | 132 | #define I915_IFPADDR 0x60 |
133 | #define I830_HIC 0x70 | ||
133 | 134 | ||
134 | /* Intel 965G registers */ | 135 | /* Intel 965G registers */ |
135 | #define I965_MSAC 0x62 | 136 | #define I965_MSAC 0x62 |
diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c index fab3d3265adb..0d09b537bb9a 100644 --- a/drivers/char/agp/intel-gtt.c +++ b/drivers/char/agp/intel-gtt.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/pagemap.h> | 22 | #include <linux/pagemap.h> |
23 | #include <linux/agp_backend.h> | 23 | #include <linux/agp_backend.h> |
24 | #include <linux/delay.h> | ||
24 | #include <asm/smp.h> | 25 | #include <asm/smp.h> |
25 | #include "agp.h" | 26 | #include "agp.h" |
26 | #include "intel-agp.h" | 27 | #include "intel-agp.h" |
@@ -70,12 +71,8 @@ static struct _intel_private { | |||
70 | u32 __iomem *gtt; /* I915G */ | 71 | u32 __iomem *gtt; /* I915G */ |
71 | bool clear_fake_agp; /* on first access via agp, fill with scratch */ | 72 | bool clear_fake_agp; /* on first access via agp, fill with scratch */ |
72 | int num_dcache_entries; | 73 | int num_dcache_entries; |
73 | union { | 74 | void __iomem *i9xx_flush_page; |
74 | void __iomem *i9xx_flush_page; | ||
75 | void *i8xx_flush_page; | ||
76 | }; | ||
77 | char *i81x_gtt_table; | 75 | char *i81x_gtt_table; |
78 | struct page *i8xx_page; | ||
79 | struct resource ifp_resource; | 76 | struct resource ifp_resource; |
80 | int resource_valid; | 77 | int resource_valid; |
81 | struct page *scratch_page; | 78 | struct page *scratch_page; |
@@ -722,28 +719,6 @@ static int intel_fake_agp_fetch_size(void) | |||
722 | 719 | ||
723 | static void i830_cleanup(void) | 720 | static void i830_cleanup(void) |
724 | { | 721 | { |
725 | if (intel_private.i8xx_flush_page) { | ||
726 | kunmap(intel_private.i8xx_flush_page); | ||
727 | intel_private.i8xx_flush_page = NULL; | ||
728 | } | ||
729 | |||
730 | __free_page(intel_private.i8xx_page); | ||
731 | intel_private.i8xx_page = NULL; | ||
732 | } | ||
733 | |||
734 | static void intel_i830_setup_flush(void) | ||
735 | { | ||
736 | /* return if we've already set the flush mechanism up */ | ||
737 | if (intel_private.i8xx_page) | ||
738 | return; | ||
739 | |||
740 | intel_private.i8xx_page = alloc_page(GFP_KERNEL); | ||
741 | if (!intel_private.i8xx_page) | ||
742 | return; | ||
743 | |||
744 | intel_private.i8xx_flush_page = kmap(intel_private.i8xx_page); | ||
745 | if (!intel_private.i8xx_flush_page) | ||
746 | i830_cleanup(); | ||
747 | } | 722 | } |
748 | 723 | ||
749 | /* The chipset_flush interface needs to get data that has already been | 724 | /* The chipset_flush interface needs to get data that has already been |
@@ -758,14 +733,27 @@ static void intel_i830_setup_flush(void) | |||
758 | */ | 733 | */ |
759 | static void i830_chipset_flush(void) | 734 | static void i830_chipset_flush(void) |
760 | { | 735 | { |
761 | unsigned int *pg = intel_private.i8xx_flush_page; | 736 | unsigned long timeout = jiffies + msecs_to_jiffies(1000); |
737 | |||
738 | /* Forcibly evict everything from the CPU write buffers. | ||
739 | * clflush appears to be insufficient. | ||
740 | */ | ||
741 | wbinvd_on_all_cpus(); | ||
742 | |||
743 | /* Now we've only seen documents for this magic bit on 855GM, | ||
744 | * we hope it exists for the other gen2 chipsets... | ||
745 | * | ||
746 | * Also works as advertised on my 845G. | ||
747 | */ | ||
748 | writel(readl(intel_private.registers+I830_HIC) | (1<<31), | ||
749 | intel_private.registers+I830_HIC); | ||
762 | 750 | ||
763 | memset(pg, 0, 1024); | 751 | while (readl(intel_private.registers+I830_HIC) & (1<<31)) { |
752 | if (time_after(jiffies, timeout)) | ||
753 | break; | ||
764 | 754 | ||
765 | if (cpu_has_clflush) | 755 | udelay(50); |
766 | clflush_cache_range(pg, 1024); | 756 | } |
767 | else if (wbinvd_on_all_cpus() != 0) | ||
768 | printk(KERN_ERR "Timed out waiting for cache flush.\n"); | ||
769 | } | 757 | } |
770 | 758 | ||
771 | static void i830_write_entry(dma_addr_t addr, unsigned int entry, | 759 | static void i830_write_entry(dma_addr_t addr, unsigned int entry, |
@@ -849,8 +837,6 @@ static int i830_setup(void) | |||
849 | 837 | ||
850 | intel_private.gtt_bus_addr = reg_addr + I810_PTE_BASE; | 838 | intel_private.gtt_bus_addr = reg_addr + I810_PTE_BASE; |
851 | 839 | ||
852 | intel_i830_setup_flush(); | ||
853 | |||
854 | return 0; | 840 | return 0; |
855 | } | 841 | } |
856 | 842 | ||
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 7855f9f45b8e..62787e30d508 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -900,6 +900,14 @@ static void sender(void *send_info, | |||
900 | printk("**Enqueue: %d.%9.9d\n", t.tv_sec, t.tv_usec); | 900 | printk("**Enqueue: %d.%9.9d\n", t.tv_sec, t.tv_usec); |
901 | #endif | 901 | #endif |
902 | 902 | ||
903 | /* | ||
904 | * last_timeout_jiffies is updated here to avoid | ||
905 | * smi_timeout() handler passing very large time_diff | ||
906 | * value to smi_event_handler() that causes | ||
907 | * the send command to abort. | ||
908 | */ | ||
909 | smi_info->last_timeout_jiffies = jiffies; | ||
910 | |||
903 | mod_timer(&smi_info->si_timer, jiffies + SI_TIMEOUT_JIFFIES); | 911 | mod_timer(&smi_info->si_timer, jiffies + SI_TIMEOUT_JIFFIES); |
904 | 912 | ||
905 | if (smi_info->thread) | 913 | if (smi_info->thread) |
diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 777181a2e603..bcbbc71febb7 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c | |||
@@ -830,8 +830,7 @@ static void monitor_card(unsigned long p) | |||
830 | test_bit(IS_ANY_T1, &dev->flags))) { | 830 | test_bit(IS_ANY_T1, &dev->flags))) { |
831 | DEBUGP(4, dev, "Perform AUTOPPS\n"); | 831 | DEBUGP(4, dev, "Perform AUTOPPS\n"); |
832 | set_bit(IS_AUTOPPS_ACT, &dev->flags); | 832 | set_bit(IS_AUTOPPS_ACT, &dev->flags); |
833 | ptsreq.protocol = ptsreq.protocol = | 833 | ptsreq.protocol = (0x01 << dev->proto); |
834 | (0x01 << dev->proto); | ||
835 | ptsreq.flags = 0x01; | 834 | ptsreq.flags = 0x01; |
836 | ptsreq.pts1 = 0x00; | 835 | ptsreq.pts1 = 0x00; |
837 | ptsreq.pts2 = 0x00; | 836 | ptsreq.pts2 = 0x00; |
diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index 94b8eb4d691d..444155a305ae 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c | |||
@@ -78,7 +78,6 @@ static void signalled_reboot_callback(void *callback_data) | |||
78 | static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) | 78 | static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) |
79 | { | 79 | { |
80 | struct ipw_dev *ipw = priv_data; | 80 | struct ipw_dev *ipw = priv_data; |
81 | struct resource *io_resource; | ||
82 | int ret; | 81 | int ret; |
83 | 82 | ||
84 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; | 83 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
@@ -92,9 +91,12 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) | |||
92 | if (ret) | 91 | if (ret) |
93 | return ret; | 92 | return ret; |
94 | 93 | ||
95 | io_resource = request_region(p_dev->resource[0]->start, | 94 | if (!request_region(p_dev->resource[0]->start, |
96 | resource_size(p_dev->resource[0]), | 95 | resource_size(p_dev->resource[0]), |
97 | IPWIRELESS_PCCARD_NAME); | 96 | IPWIRELESS_PCCARD_NAME)) { |
97 | ret = -EBUSY; | ||
98 | goto exit; | ||
99 | } | ||
98 | 100 | ||
99 | p_dev->resource[2]->flags |= | 101 | p_dev->resource[2]->flags |= |
100 | WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; | 102 | WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_CM | WIN_ENABLE; |
@@ -105,22 +107,25 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) | |||
105 | 107 | ||
106 | ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2], p_dev->card_addr); | 108 | ret = pcmcia_map_mem_page(p_dev, p_dev->resource[2], p_dev->card_addr); |
107 | if (ret != 0) | 109 | if (ret != 0) |
108 | goto exit2; | 110 | goto exit1; |
109 | 111 | ||
110 | ipw->is_v2_card = resource_size(p_dev->resource[2]) == 0x100; | 112 | ipw->is_v2_card = resource_size(p_dev->resource[2]) == 0x100; |
111 | 113 | ||
112 | ipw->attr_memory = ioremap(p_dev->resource[2]->start, | 114 | ipw->common_memory = ioremap(p_dev->resource[2]->start, |
113 | resource_size(p_dev->resource[2])); | 115 | resource_size(p_dev->resource[2])); |
114 | request_mem_region(p_dev->resource[2]->start, | 116 | if (!request_mem_region(p_dev->resource[2]->start, |
115 | resource_size(p_dev->resource[2]), | 117 | resource_size(p_dev->resource[2]), |
116 | IPWIRELESS_PCCARD_NAME); | 118 | IPWIRELESS_PCCARD_NAME)) { |
119 | ret = -EBUSY; | ||
120 | goto exit2; | ||
121 | } | ||
117 | 122 | ||
118 | p_dev->resource[3]->flags |= WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | | 123 | p_dev->resource[3]->flags |= WIN_DATA_WIDTH_16 | WIN_MEMORY_TYPE_AM | |
119 | WIN_ENABLE; | 124 | WIN_ENABLE; |
120 | p_dev->resource[3]->end = 0; /* this used to be 0x1000 */ | 125 | p_dev->resource[3]->end = 0; /* this used to be 0x1000 */ |
121 | ret = pcmcia_request_window(p_dev, p_dev->resource[3], 0); | 126 | ret = pcmcia_request_window(p_dev, p_dev->resource[3], 0); |
122 | if (ret != 0) | 127 | if (ret != 0) |
123 | goto exit2; | 128 | goto exit3; |
124 | 129 | ||
125 | ret = pcmcia_map_mem_page(p_dev, p_dev->resource[3], 0); | 130 | ret = pcmcia_map_mem_page(p_dev, p_dev->resource[3], 0); |
126 | if (ret != 0) | 131 | if (ret != 0) |
@@ -128,23 +133,28 @@ static int ipwireless_probe(struct pcmcia_device *p_dev, void *priv_data) | |||
128 | 133 | ||
129 | ipw->attr_memory = ioremap(p_dev->resource[3]->start, | 134 | ipw->attr_memory = ioremap(p_dev->resource[3]->start, |
130 | resource_size(p_dev->resource[3])); | 135 | resource_size(p_dev->resource[3])); |
131 | request_mem_region(p_dev->resource[3]->start, | 136 | if (!request_mem_region(p_dev->resource[3]->start, |
132 | resource_size(p_dev->resource[3]), | 137 | resource_size(p_dev->resource[3]), |
133 | IPWIRELESS_PCCARD_NAME); | 138 | IPWIRELESS_PCCARD_NAME)) { |
139 | ret = -EBUSY; | ||
140 | goto exit4; | ||
141 | } | ||
134 | 142 | ||
135 | return 0; | 143 | return 0; |
136 | 144 | ||
145 | exit4: | ||
146 | iounmap(ipw->attr_memory); | ||
137 | exit3: | 147 | exit3: |
148 | release_mem_region(p_dev->resource[2]->start, | ||
149 | resource_size(p_dev->resource[2])); | ||
138 | exit2: | 150 | exit2: |
139 | if (ipw->common_memory) { | 151 | iounmap(ipw->common_memory); |
140 | release_mem_region(p_dev->resource[2]->start, | ||
141 | resource_size(p_dev->resource[2])); | ||
142 | iounmap(ipw->common_memory); | ||
143 | } | ||
144 | exit1: | 152 | exit1: |
145 | release_resource(io_resource); | 153 | release_region(p_dev->resource[0]->start, |
154 | resource_size(p_dev->resource[0])); | ||
155 | exit: | ||
146 | pcmcia_disable_device(p_dev); | 156 | pcmcia_disable_device(p_dev); |
147 | return -1; | 157 | return ret; |
148 | } | 158 | } |
149 | 159 | ||
150 | static int config_ipwireless(struct ipw_dev *ipw) | 160 | static int config_ipwireless(struct ipw_dev *ipw) |
@@ -219,6 +229,8 @@ exit: | |||
219 | 229 | ||
220 | static void release_ipwireless(struct ipw_dev *ipw) | 230 | static void release_ipwireless(struct ipw_dev *ipw) |
221 | { | 231 | { |
232 | release_region(ipw->link->resource[0]->start, | ||
233 | resource_size(ipw->link->resource[0])); | ||
222 | if (ipw->common_memory) { | 234 | if (ipw->common_memory) { |
223 | release_mem_region(ipw->link->resource[2]->start, | 235 | release_mem_region(ipw->link->resource[2]->start, |
224 | resource_size(ipw->link->resource[2])); | 236 | resource_size(ipw->link->resource[2])); |
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index faf5a2c65926..1f46f1cd9225 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -364,14 +364,12 @@ unsigned long tpm_calc_ordinal_duration(struct tpm_chip *chip, | |||
364 | tpm_protected_ordinal_duration[ordinal & | 364 | tpm_protected_ordinal_duration[ordinal & |
365 | TPM_PROTECTED_ORDINAL_MASK]; | 365 | TPM_PROTECTED_ORDINAL_MASK]; |
366 | 366 | ||
367 | if (duration_idx != TPM_UNDEFINED) { | 367 | if (duration_idx != TPM_UNDEFINED) |
368 | duration = chip->vendor.duration[duration_idx]; | 368 | duration = chip->vendor.duration[duration_idx]; |
369 | /* if duration is 0, it's because chip->vendor.duration wasn't */ | 369 | if (duration <= 0) |
370 | /* filled yet, so we set the lowest timeout just to give enough */ | ||
371 | /* time for tpm_get_timeouts() to succeed */ | ||
372 | return (duration <= 0 ? HZ : duration); | ||
373 | } else | ||
374 | return 2 * 60 * HZ; | 370 | return 2 * 60 * HZ; |
371 | else | ||
372 | return duration; | ||
375 | } | 373 | } |
376 | EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); | 374 | EXPORT_SYMBOL_GPL(tpm_calc_ordinal_duration); |
377 | 375 | ||
@@ -577,11 +575,9 @@ duration: | |||
577 | if (rc) | 575 | if (rc) |
578 | return; | 576 | return; |
579 | 577 | ||
580 | if (be32_to_cpu(tpm_cmd.header.out.return_code) != 0 || | 578 | if (be32_to_cpu(tpm_cmd.header.out.return_code) |
581 | be32_to_cpu(tpm_cmd.header.out.length) | 579 | != 3 * sizeof(u32)) |
582 | != sizeof(tpm_cmd.header.out) + sizeof(u32) + 3 * sizeof(u32)) | ||
583 | return; | 580 | return; |
584 | |||
585 | duration_cap = &tpm_cmd.params.getcap_out.cap.duration; | 581 | duration_cap = &tpm_cmd.params.getcap_out.cap.duration; |
586 | chip->vendor.duration[TPM_SHORT] = | 582 | chip->vendor.duration[TPM_SHORT] = |
587 | usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short)); | 583 | usecs_to_jiffies(be32_to_cpu(duration_cap->tpm_short)); |
@@ -941,18 +937,6 @@ ssize_t tpm_show_caps_1_2(struct device * dev, | |||
941 | } | 937 | } |
942 | EXPORT_SYMBOL_GPL(tpm_show_caps_1_2); | 938 | EXPORT_SYMBOL_GPL(tpm_show_caps_1_2); |
943 | 939 | ||
944 | ssize_t tpm_show_timeouts(struct device *dev, struct device_attribute *attr, | ||
945 | char *buf) | ||
946 | { | ||
947 | struct tpm_chip *chip = dev_get_drvdata(dev); | ||
948 | |||
949 | return sprintf(buf, "%d %d %d\n", | ||
950 | jiffies_to_usecs(chip->vendor.duration[TPM_SHORT]), | ||
951 | jiffies_to_usecs(chip->vendor.duration[TPM_MEDIUM]), | ||
952 | jiffies_to_usecs(chip->vendor.duration[TPM_LONG])); | ||
953 | } | ||
954 | EXPORT_SYMBOL_GPL(tpm_show_timeouts); | ||
955 | |||
956 | ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, | 940 | ssize_t tpm_store_cancel(struct device *dev, struct device_attribute *attr, |
957 | const char *buf, size_t count) | 941 | const char *buf, size_t count) |
958 | { | 942 | { |
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index d84ff772c26f..72ddb031b69a 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
@@ -56,8 +56,6 @@ extern ssize_t tpm_show_owned(struct device *, struct device_attribute *attr, | |||
56 | char *); | 56 | char *); |
57 | extern ssize_t tpm_show_temp_deactivated(struct device *, | 57 | extern ssize_t tpm_show_temp_deactivated(struct device *, |
58 | struct device_attribute *attr, char *); | 58 | struct device_attribute *attr, char *); |
59 | extern ssize_t tpm_show_timeouts(struct device *, | ||
60 | struct device_attribute *attr, char *); | ||
61 | 59 | ||
62 | struct tpm_chip; | 60 | struct tpm_chip; |
63 | 61 | ||
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 0d1d38e5f266..dd21df55689d 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -376,7 +376,6 @@ static DEVICE_ATTR(temp_deactivated, S_IRUGO, tpm_show_temp_deactivated, | |||
376 | NULL); | 376 | NULL); |
377 | static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); | 377 | static DEVICE_ATTR(caps, S_IRUGO, tpm_show_caps_1_2, NULL); |
378 | static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); | 378 | static DEVICE_ATTR(cancel, S_IWUSR | S_IWGRP, NULL, tpm_store_cancel); |
379 | static DEVICE_ATTR(timeouts, S_IRUGO, tpm_show_timeouts, NULL); | ||
380 | 379 | ||
381 | static struct attribute *tis_attrs[] = { | 380 | static struct attribute *tis_attrs[] = { |
382 | &dev_attr_pubek.attr, | 381 | &dev_attr_pubek.attr, |
@@ -386,8 +385,7 @@ static struct attribute *tis_attrs[] = { | |||
386 | &dev_attr_owned.attr, | 385 | &dev_attr_owned.attr, |
387 | &dev_attr_temp_deactivated.attr, | 386 | &dev_attr_temp_deactivated.attr, |
388 | &dev_attr_caps.attr, | 387 | &dev_attr_caps.attr, |
389 | &dev_attr_cancel.attr, | 388 | &dev_attr_cancel.attr, NULL, |
390 | &dev_attr_timeouts.attr, NULL, | ||
391 | }; | 389 | }; |
392 | 390 | ||
393 | static struct attribute_group tis_attr_grp = { | 391 | static struct attribute_group tis_attr_grp = { |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 490393186338..84b164d1eb2b 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -388,6 +388,10 @@ static void discard_port_data(struct port *port) | |||
388 | unsigned int len; | 388 | unsigned int len; |
389 | int ret; | 389 | int ret; |
390 | 390 | ||
391 | if (!port->portdev) { | ||
392 | /* Device has been unplugged. vqs are already gone. */ | ||
393 | return; | ||
394 | } | ||
391 | vq = port->in_vq; | 395 | vq = port->in_vq; |
392 | if (port->inbuf) | 396 | if (port->inbuf) |
393 | buf = port->inbuf; | 397 | buf = port->inbuf; |
@@ -470,6 +474,10 @@ static void reclaim_consumed_buffers(struct port *port) | |||
470 | void *buf; | 474 | void *buf; |
471 | unsigned int len; | 475 | unsigned int len; |
472 | 476 | ||
477 | if (!port->portdev) { | ||
478 | /* Device has been unplugged. vqs are already gone. */ | ||
479 | return; | ||
480 | } | ||
473 | while ((buf = virtqueue_get_buf(port->out_vq, &len))) { | 481 | while ((buf = virtqueue_get_buf(port->out_vq, &len))) { |
474 | kfree(buf); | 482 | kfree(buf); |
475 | port->outvq_full = false; | 483 | port->outvq_full = false; |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 1109f6848a43..5cb4d09919d6 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1919,8 +1919,10 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
1919 | 1919 | ||
1920 | ret = sysdev_driver_register(&cpu_sysdev_class, | 1920 | ret = sysdev_driver_register(&cpu_sysdev_class, |
1921 | &cpufreq_sysdev_driver); | 1921 | &cpufreq_sysdev_driver); |
1922 | if (ret) | ||
1923 | goto err_null_driver; | ||
1922 | 1924 | ||
1923 | if ((!ret) && !(cpufreq_driver->flags & CPUFREQ_STICKY)) { | 1925 | if (!(cpufreq_driver->flags & CPUFREQ_STICKY)) { |
1924 | int i; | 1926 | int i; |
1925 | ret = -ENODEV; | 1927 | ret = -ENODEV; |
1926 | 1928 | ||
@@ -1935,21 +1937,22 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data) | |||
1935 | if (ret) { | 1937 | if (ret) { |
1936 | dprintk("no CPU initialized for driver %s\n", | 1938 | dprintk("no CPU initialized for driver %s\n", |
1937 | driver_data->name); | 1939 | driver_data->name); |
1938 | sysdev_driver_unregister(&cpu_sysdev_class, | 1940 | goto err_sysdev_unreg; |
1939 | &cpufreq_sysdev_driver); | ||
1940 | |||
1941 | spin_lock_irqsave(&cpufreq_driver_lock, flags); | ||
1942 | cpufreq_driver = NULL; | ||
1943 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | ||
1944 | } | 1941 | } |
1945 | } | 1942 | } |
1946 | 1943 | ||
1947 | if (!ret) { | 1944 | register_hotcpu_notifier(&cpufreq_cpu_notifier); |
1948 | register_hotcpu_notifier(&cpufreq_cpu_notifier); | 1945 | dprintk("driver %s up and running\n", driver_data->name); |
1949 | dprintk("driver %s up and running\n", driver_data->name); | 1946 | cpufreq_debug_enable_ratelimit(); |
1950 | cpufreq_debug_enable_ratelimit(); | ||
1951 | } | ||
1952 | 1947 | ||
1948 | return 0; | ||
1949 | err_sysdev_unreg: | ||
1950 | sysdev_driver_unregister(&cpu_sysdev_class, | ||
1951 | &cpufreq_sysdev_driver); | ||
1952 | err_null_driver: | ||
1953 | spin_lock_irqsave(&cpufreq_driver_lock, flags); | ||
1954 | cpufreq_driver = NULL; | ||
1955 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | ||
1953 | return ret; | 1956 | return ret; |
1954 | } | 1957 | } |
1955 | EXPORT_SYMBOL_GPL(cpufreq_register_driver); | 1958 | EXPORT_SYMBOL_GPL(cpufreq_register_driver); |
diff --git a/drivers/gpio/ml_ioh_gpio.c b/drivers/gpio/ml_ioh_gpio.c index cead8e6ff345..7f6f01a4b145 100644 --- a/drivers/gpio/ml_ioh_gpio.c +++ b/drivers/gpio/ml_ioh_gpio.c | |||
@@ -326,6 +326,7 @@ static DEFINE_PCI_DEVICE_TABLE(ioh_gpio_pcidev_id) = { | |||
326 | { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x802E) }, | 326 | { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x802E) }, |
327 | { 0, } | 327 | { 0, } |
328 | }; | 328 | }; |
329 | MODULE_DEVICE_TABLE(pci, ioh_gpio_pcidev_id); | ||
329 | 330 | ||
330 | static struct pci_driver ioh_gpio_driver = { | 331 | static struct pci_driver ioh_gpio_driver = { |
331 | .name = "ml_ioh_gpio", | 332 | .name = "ml_ioh_gpio", |
diff --git a/drivers/gpio/pch_gpio.c b/drivers/gpio/pch_gpio.c index 0eba0a75c804..2c6af8705103 100644 --- a/drivers/gpio/pch_gpio.c +++ b/drivers/gpio/pch_gpio.c | |||
@@ -286,6 +286,7 @@ static DEFINE_PCI_DEVICE_TABLE(pch_gpio_pcidev_id) = { | |||
286 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8803) }, | 286 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8803) }, |
287 | { 0, } | 287 | { 0, } |
288 | }; | 288 | }; |
289 | MODULE_DEVICE_TABLE(pci, pch_gpio_pcidev_id); | ||
289 | 290 | ||
290 | static struct pci_driver pch_gpio_driver = { | 291 | static struct pci_driver pch_gpio_driver = { |
291 | .name = "pch_gpio", | 292 | .name = "pch_gpio", |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 6977a1ce9d98..f73ef4390db6 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -672,7 +672,7 @@ int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info) | |||
672 | struct drm_crtc_helper_funcs *crtc_funcs; | 672 | struct drm_crtc_helper_funcs *crtc_funcs; |
673 | u16 *red, *green, *blue, *transp; | 673 | u16 *red, *green, *blue, *transp; |
674 | struct drm_crtc *crtc; | 674 | struct drm_crtc *crtc; |
675 | int i, rc = 0; | 675 | int i, j, rc = 0; |
676 | int start; | 676 | int start; |
677 | 677 | ||
678 | for (i = 0; i < fb_helper->crtc_count; i++) { | 678 | for (i = 0; i < fb_helper->crtc_count; i++) { |
@@ -685,7 +685,7 @@ int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info) | |||
685 | transp = cmap->transp; | 685 | transp = cmap->transp; |
686 | start = cmap->start; | 686 | start = cmap->start; |
687 | 687 | ||
688 | for (i = 0; i < cmap->len; i++) { | 688 | for (j = 0; j < cmap->len; j++) { |
689 | u16 hred, hgreen, hblue, htransp = 0xffff; | 689 | u16 hred, hgreen, hblue, htransp = 0xffff; |
690 | 690 | ||
691 | hred = *red++; | 691 | hred = *red++; |
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 3dadfa2a8528..28d1d3c24d65 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c | |||
@@ -164,8 +164,10 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc) | |||
164 | * available. In that case we can't account for this and just | 164 | * available. In that case we can't account for this and just |
165 | * hope for the best. | 165 | * hope for the best. |
166 | */ | 166 | */ |
167 | if ((vblrc > 0) && (abs(diff_ns) > 1000000)) | 167 | if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) { |
168 | atomic_inc(&dev->_vblank_count[crtc]); | 168 | atomic_inc(&dev->_vblank_count[crtc]); |
169 | smp_mb__after_atomic_inc(); | ||
170 | } | ||
169 | 171 | ||
170 | /* Invalidate all timestamps while vblank irq's are off. */ | 172 | /* Invalidate all timestamps while vblank irq's are off. */ |
171 | clear_vblank_timestamps(dev, crtc); | 173 | clear_vblank_timestamps(dev, crtc); |
@@ -491,6 +493,12 @@ void drm_calc_timestamping_constants(struct drm_crtc *crtc) | |||
491 | /* Dot clock in Hz: */ | 493 | /* Dot clock in Hz: */ |
492 | dotclock = (u64) crtc->hwmode.clock * 1000; | 494 | dotclock = (u64) crtc->hwmode.clock * 1000; |
493 | 495 | ||
496 | /* Fields of interlaced scanout modes are only halve a frame duration. | ||
497 | * Double the dotclock to get halve the frame-/line-/pixelduration. | ||
498 | */ | ||
499 | if (crtc->hwmode.flags & DRM_MODE_FLAG_INTERLACE) | ||
500 | dotclock *= 2; | ||
501 | |||
494 | /* Valid dotclock? */ | 502 | /* Valid dotclock? */ |
495 | if (dotclock > 0) { | 503 | if (dotclock > 0) { |
496 | /* Convert scanline length in pixels and video dot clock to | 504 | /* Convert scanline length in pixels and video dot clock to |
@@ -603,14 +611,6 @@ int drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev, int crtc, | |||
603 | return -EAGAIN; | 611 | return -EAGAIN; |
604 | } | 612 | } |
605 | 613 | ||
606 | /* Don't know yet how to handle interlaced or | ||
607 | * double scan modes. Just no-op for now. | ||
608 | */ | ||
609 | if (mode->flags & (DRM_MODE_FLAG_INTERLACE | DRM_MODE_FLAG_DBLSCAN)) { | ||
610 | DRM_DEBUG("crtc %d: Noop due to unsupported mode.\n", crtc); | ||
611 | return -ENOTSUPP; | ||
612 | } | ||
613 | |||
614 | /* Get current scanout position with system timestamp. | 614 | /* Get current scanout position with system timestamp. |
615 | * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times | 615 | * Repeat query up to DRM_TIMESTAMP_MAXRETRIES times |
616 | * if single query takes longer than max_error nanoseconds. | 616 | * if single query takes longer than max_error nanoseconds. |
@@ -858,10 +858,11 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc) | |||
858 | if (rc) { | 858 | if (rc) { |
859 | tslot = atomic_read(&dev->_vblank_count[crtc]) + diff; | 859 | tslot = atomic_read(&dev->_vblank_count[crtc]) + diff; |
860 | vblanktimestamp(dev, crtc, tslot) = t_vblank; | 860 | vblanktimestamp(dev, crtc, tslot) = t_vblank; |
861 | smp_wmb(); | ||
862 | } | 861 | } |
863 | 862 | ||
863 | smp_mb__before_atomic_inc(); | ||
864 | atomic_add(diff, &dev->_vblank_count[crtc]); | 864 | atomic_add(diff, &dev->_vblank_count[crtc]); |
865 | smp_mb__after_atomic_inc(); | ||
865 | } | 866 | } |
866 | 867 | ||
867 | /** | 868 | /** |
@@ -1011,7 +1012,8 @@ int drm_modeset_ctl(struct drm_device *dev, void *data, | |||
1011 | struct drm_file *file_priv) | 1012 | struct drm_file *file_priv) |
1012 | { | 1013 | { |
1013 | struct drm_modeset_ctl *modeset = data; | 1014 | struct drm_modeset_ctl *modeset = data; |
1014 | int crtc, ret = 0; | 1015 | int ret = 0; |
1016 | unsigned int crtc; | ||
1015 | 1017 | ||
1016 | /* If drm_vblank_init() hasn't been called yet, just no-op */ | 1018 | /* If drm_vblank_init() hasn't been called yet, just no-op */ |
1017 | if (!dev->num_crtcs) | 1019 | if (!dev->num_crtcs) |
@@ -1293,15 +1295,16 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc) | |||
1293 | * e.g., due to spurious vblank interrupts. We need to | 1295 | * e.g., due to spurious vblank interrupts. We need to |
1294 | * ignore those for accounting. | 1296 | * ignore those for accounting. |
1295 | */ | 1297 | */ |
1296 | if (abs(diff_ns) > DRM_REDUNDANT_VBLIRQ_THRESH_NS) { | 1298 | if (abs64(diff_ns) > DRM_REDUNDANT_VBLIRQ_THRESH_NS) { |
1297 | /* Store new timestamp in ringbuffer. */ | 1299 | /* Store new timestamp in ringbuffer. */ |
1298 | vblanktimestamp(dev, crtc, vblcount + 1) = tvblank; | 1300 | vblanktimestamp(dev, crtc, vblcount + 1) = tvblank; |
1299 | smp_wmb(); | ||
1300 | 1301 | ||
1301 | /* Increment cooked vblank count. This also atomically commits | 1302 | /* Increment cooked vblank count. This also atomically commits |
1302 | * the timestamp computed above. | 1303 | * the timestamp computed above. |
1303 | */ | 1304 | */ |
1305 | smp_mb__before_atomic_inc(); | ||
1304 | atomic_inc(&dev->_vblank_count[crtc]); | 1306 | atomic_inc(&dev->_vblank_count[crtc]); |
1307 | smp_mb__after_atomic_inc(); | ||
1305 | } else { | 1308 | } else { |
1306 | DRM_DEBUG("crtc %d: Redundant vblirq ignored. diff_ns = %d\n", | 1309 | DRM_DEBUG("crtc %d: Redundant vblirq ignored. diff_ns = %d\n", |
1307 | crtc, (int) diff_ns); | 1310 | crtc, (int) diff_ns); |
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 3601466c5502..4ff9b6cc973f 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -865,7 +865,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused) | |||
865 | int max_freq; | 865 | int max_freq; |
866 | 866 | ||
867 | /* RPSTAT1 is in the GT power well */ | 867 | /* RPSTAT1 is in the GT power well */ |
868 | __gen6_force_wake_get(dev_priv); | 868 | __gen6_gt_force_wake_get(dev_priv); |
869 | 869 | ||
870 | seq_printf(m, "GT_PERF_STATUS: 0x%08x\n", gt_perf_status); | 870 | seq_printf(m, "GT_PERF_STATUS: 0x%08x\n", gt_perf_status); |
871 | seq_printf(m, "RPSTAT1: 0x%08x\n", I915_READ(GEN6_RPSTAT1)); | 871 | seq_printf(m, "RPSTAT1: 0x%08x\n", I915_READ(GEN6_RPSTAT1)); |
@@ -888,7 +888,7 @@ static int i915_cur_delayinfo(struct seq_file *m, void *unused) | |||
888 | seq_printf(m, "Max non-overclocked (RP0) frequency: %dMHz\n", | 888 | seq_printf(m, "Max non-overclocked (RP0) frequency: %dMHz\n", |
889 | max_freq * 100); | 889 | max_freq * 100); |
890 | 890 | ||
891 | __gen6_force_wake_put(dev_priv); | 891 | __gen6_gt_force_wake_put(dev_priv); |
892 | } else { | 892 | } else { |
893 | seq_printf(m, "no P-state info available\n"); | 893 | seq_printf(m, "no P-state info available\n"); |
894 | } | 894 | } |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 17bd766f2081..e33d9be7df3b 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1895,6 +1895,17 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1895 | if (IS_GEN2(dev)) | 1895 | if (IS_GEN2(dev)) |
1896 | dma_set_coherent_mask(&dev->pdev->dev, DMA_BIT_MASK(30)); | 1896 | dma_set_coherent_mask(&dev->pdev->dev, DMA_BIT_MASK(30)); |
1897 | 1897 | ||
1898 | /* 965GM sometimes incorrectly writes to hardware status page (HWS) | ||
1899 | * using 32bit addressing, overwriting memory if HWS is located | ||
1900 | * above 4GB. | ||
1901 | * | ||
1902 | * The documentation also mentions an issue with undefined | ||
1903 | * behaviour if any general state is accessed within a page above 4GB, | ||
1904 | * which also needs to be handled carefully. | ||
1905 | */ | ||
1906 | if (IS_BROADWATER(dev) || IS_CRESTLINE(dev)) | ||
1907 | dma_set_coherent_mask(&dev->pdev->dev, DMA_BIT_MASK(32)); | ||
1908 | |||
1898 | mmio_bar = IS_GEN2(dev) ? 1 : 0; | 1909 | mmio_bar = IS_GEN2(dev) ? 1 : 0; |
1899 | dev_priv->regs = pci_iomap(dev->pdev, mmio_bar, 0); | 1910 | dev_priv->regs = pci_iomap(dev->pdev, mmio_bar, 0); |
1900 | if (!dev_priv->regs) { | 1911 | if (!dev_priv->regs) { |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 0ad533f06af9..22ec066adae6 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -46,6 +46,9 @@ module_param_named(fbpercrtc, i915_fbpercrtc, int, 0400); | |||
46 | unsigned int i915_powersave = 1; | 46 | unsigned int i915_powersave = 1; |
47 | module_param_named(powersave, i915_powersave, int, 0600); | 47 | module_param_named(powersave, i915_powersave, int, 0600); |
48 | 48 | ||
49 | unsigned int i915_semaphores = 0; | ||
50 | module_param_named(semaphores, i915_semaphores, int, 0600); | ||
51 | |||
49 | unsigned int i915_enable_rc6 = 0; | 52 | unsigned int i915_enable_rc6 = 0; |
50 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); | 53 | module_param_named(i915_enable_rc6, i915_enable_rc6, int, 0600); |
51 | 54 | ||
@@ -254,7 +257,7 @@ void intel_detect_pch (struct drm_device *dev) | |||
254 | } | 257 | } |
255 | } | 258 | } |
256 | 259 | ||
257 | void __gen6_force_wake_get(struct drm_i915_private *dev_priv) | 260 | void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv) |
258 | { | 261 | { |
259 | int count; | 262 | int count; |
260 | 263 | ||
@@ -270,12 +273,22 @@ void __gen6_force_wake_get(struct drm_i915_private *dev_priv) | |||
270 | udelay(10); | 273 | udelay(10); |
271 | } | 274 | } |
272 | 275 | ||
273 | void __gen6_force_wake_put(struct drm_i915_private *dev_priv) | 276 | void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv) |
274 | { | 277 | { |
275 | I915_WRITE_NOTRACE(FORCEWAKE, 0); | 278 | I915_WRITE_NOTRACE(FORCEWAKE, 0); |
276 | POSTING_READ(FORCEWAKE); | 279 | POSTING_READ(FORCEWAKE); |
277 | } | 280 | } |
278 | 281 | ||
282 | void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv) | ||
283 | { | ||
284 | int loop = 500; | ||
285 | u32 fifo = I915_READ_NOTRACE(GT_FIFO_FREE_ENTRIES); | ||
286 | while (fifo < 20 && loop--) { | ||
287 | udelay(10); | ||
288 | fifo = I915_READ_NOTRACE(GT_FIFO_FREE_ENTRIES); | ||
289 | } | ||
290 | } | ||
291 | |||
279 | static int i915_drm_freeze(struct drm_device *dev) | 292 | static int i915_drm_freeze(struct drm_device *dev) |
280 | { | 293 | { |
281 | struct drm_i915_private *dev_priv = dev->dev_private; | 294 | struct drm_i915_private *dev_priv = dev->dev_private; |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 65dfe81d0035..456f40484838 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -956,6 +956,7 @@ extern struct drm_ioctl_desc i915_ioctls[]; | |||
956 | extern int i915_max_ioctl; | 956 | extern int i915_max_ioctl; |
957 | extern unsigned int i915_fbpercrtc; | 957 | extern unsigned int i915_fbpercrtc; |
958 | extern unsigned int i915_powersave; | 958 | extern unsigned int i915_powersave; |
959 | extern unsigned int i915_semaphores; | ||
959 | extern unsigned int i915_lvds_downclock; | 960 | extern unsigned int i915_lvds_downclock; |
960 | extern unsigned int i915_panel_use_ssc; | 961 | extern unsigned int i915_panel_use_ssc; |
961 | extern unsigned int i915_enable_rc6; | 962 | extern unsigned int i915_enable_rc6; |
@@ -1177,6 +1178,9 @@ void i915_gem_detach_phys_object(struct drm_device *dev, | |||
1177 | void i915_gem_free_all_phys_object(struct drm_device *dev); | 1178 | void i915_gem_free_all_phys_object(struct drm_device *dev); |
1178 | void i915_gem_release(struct drm_device *dev, struct drm_file *file); | 1179 | void i915_gem_release(struct drm_device *dev, struct drm_file *file); |
1179 | 1180 | ||
1181 | uint32_t | ||
1182 | i915_gem_get_unfenced_gtt_alignment(struct drm_i915_gem_object *obj); | ||
1183 | |||
1180 | /* i915_gem_gtt.c */ | 1184 | /* i915_gem_gtt.c */ |
1181 | void i915_gem_restore_gtt_mappings(struct drm_device *dev); | 1185 | void i915_gem_restore_gtt_mappings(struct drm_device *dev); |
1182 | int __must_check i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj); | 1186 | int __must_check i915_gem_gtt_bind_object(struct drm_i915_gem_object *obj); |
@@ -1353,22 +1357,32 @@ __i915_write(64, q) | |||
1353 | * must be set to prevent GT core from power down and stale values being | 1357 | * must be set to prevent GT core from power down and stale values being |
1354 | * returned. | 1358 | * returned. |
1355 | */ | 1359 | */ |
1356 | void __gen6_force_wake_get(struct drm_i915_private *dev_priv); | 1360 | void __gen6_gt_force_wake_get(struct drm_i915_private *dev_priv); |
1357 | void __gen6_force_wake_put (struct drm_i915_private *dev_priv); | 1361 | void __gen6_gt_force_wake_put(struct drm_i915_private *dev_priv); |
1358 | static inline u32 i915_safe_read(struct drm_i915_private *dev_priv, u32 reg) | 1362 | void __gen6_gt_wait_for_fifo(struct drm_i915_private *dev_priv); |
1363 | |||
1364 | static inline u32 i915_gt_read(struct drm_i915_private *dev_priv, u32 reg) | ||
1359 | { | 1365 | { |
1360 | u32 val; | 1366 | u32 val; |
1361 | 1367 | ||
1362 | if (dev_priv->info->gen >= 6) { | 1368 | if (dev_priv->info->gen >= 6) { |
1363 | __gen6_force_wake_get(dev_priv); | 1369 | __gen6_gt_force_wake_get(dev_priv); |
1364 | val = I915_READ(reg); | 1370 | val = I915_READ(reg); |
1365 | __gen6_force_wake_put(dev_priv); | 1371 | __gen6_gt_force_wake_put(dev_priv); |
1366 | } else | 1372 | } else |
1367 | val = I915_READ(reg); | 1373 | val = I915_READ(reg); |
1368 | 1374 | ||
1369 | return val; | 1375 | return val; |
1370 | } | 1376 | } |
1371 | 1377 | ||
1378 | static inline void i915_gt_write(struct drm_i915_private *dev_priv, | ||
1379 | u32 reg, u32 val) | ||
1380 | { | ||
1381 | if (dev_priv->info->gen >= 6) | ||
1382 | __gen6_gt_wait_for_fifo(dev_priv); | ||
1383 | I915_WRITE(reg, val); | ||
1384 | } | ||
1385 | |||
1372 | static inline void | 1386 | static inline void |
1373 | i915_write(struct drm_i915_private *dev_priv, u32 reg, u64 val, int len) | 1387 | i915_write(struct drm_i915_private *dev_priv, u32 reg, u64 val, int len) |
1374 | { | 1388 | { |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index cf4f74c7c6fb..36e66cc5225e 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1398,7 +1398,7 @@ i915_gem_get_gtt_alignment(struct drm_i915_gem_object *obj) | |||
1398 | * Return the required GTT alignment for an object, only taking into account | 1398 | * Return the required GTT alignment for an object, only taking into account |
1399 | * unfenced tiled surface requirements. | 1399 | * unfenced tiled surface requirements. |
1400 | */ | 1400 | */ |
1401 | static uint32_t | 1401 | uint32_t |
1402 | i915_gem_get_unfenced_gtt_alignment(struct drm_i915_gem_object *obj) | 1402 | i915_gem_get_unfenced_gtt_alignment(struct drm_i915_gem_object *obj) |
1403 | { | 1403 | { |
1404 | struct drm_device *dev = obj->base.dev; | 1404 | struct drm_device *dev = obj->base.dev; |
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c index d2f445e825f2..50ab1614571c 100644 --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c | |||
@@ -772,8 +772,8 @@ i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj, | |||
772 | if (from == NULL || to == from) | 772 | if (from == NULL || to == from) |
773 | return 0; | 773 | return 0; |
774 | 774 | ||
775 | /* XXX gpu semaphores are currently causing hard hangs on SNB mobile */ | 775 | /* XXX gpu semaphores are implicated in various hard hangs on SNB */ |
776 | if (INTEL_INFO(obj->base.dev)->gen < 6 || IS_MOBILE(obj->base.dev)) | 776 | if (INTEL_INFO(obj->base.dev)->gen < 6 || !i915_semaphores) |
777 | return i915_gem_object_wait_rendering(obj, true); | 777 | return i915_gem_object_wait_rendering(obj, true); |
778 | 778 | ||
779 | idx = intel_ring_sync_index(from, to); | 779 | idx = intel_ring_sync_index(from, to); |
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index 22a32b9932c5..d64843e18df2 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
@@ -349,14 +349,27 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, | |||
349 | (obj->gtt_offset + obj->base.size <= dev_priv->mm.gtt_mappable_end && | 349 | (obj->gtt_offset + obj->base.size <= dev_priv->mm.gtt_mappable_end && |
350 | i915_gem_object_fence_ok(obj, args->tiling_mode)); | 350 | i915_gem_object_fence_ok(obj, args->tiling_mode)); |
351 | 351 | ||
352 | obj->tiling_changed = true; | 352 | /* Rebind if we need a change of alignment */ |
353 | obj->tiling_mode = args->tiling_mode; | 353 | if (!obj->map_and_fenceable) { |
354 | obj->stride = args->stride; | 354 | u32 unfenced_alignment = |
355 | i915_gem_get_unfenced_gtt_alignment(obj); | ||
356 | if (obj->gtt_offset & (unfenced_alignment - 1)) | ||
357 | ret = i915_gem_object_unbind(obj); | ||
358 | } | ||
359 | |||
360 | if (ret == 0) { | ||
361 | obj->tiling_changed = true; | ||
362 | obj->tiling_mode = args->tiling_mode; | ||
363 | obj->stride = args->stride; | ||
364 | } | ||
355 | } | 365 | } |
366 | /* we have to maintain this existing ABI... */ | ||
367 | args->stride = obj->stride; | ||
368 | args->tiling_mode = obj->tiling_mode; | ||
356 | drm_gem_object_unreference(&obj->base); | 369 | drm_gem_object_unreference(&obj->base); |
357 | mutex_unlock(&dev->struct_mutex); | 370 | mutex_unlock(&dev->struct_mutex); |
358 | 371 | ||
359 | return 0; | 372 | return ret; |
360 | } | 373 | } |
361 | 374 | ||
362 | /** | 375 | /** |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 97f946dcc1aa..8a9e08bf1cf7 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -316,6 +316,8 @@ static void i915_hotplug_work_func(struct work_struct *work) | |||
316 | struct drm_mode_config *mode_config = &dev->mode_config; | 316 | struct drm_mode_config *mode_config = &dev->mode_config; |
317 | struct intel_encoder *encoder; | 317 | struct intel_encoder *encoder; |
318 | 318 | ||
319 | DRM_DEBUG_KMS("running encoder hotplug functions\n"); | ||
320 | |||
319 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) | 321 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) |
320 | if (encoder->hot_plug) | 322 | if (encoder->hot_plug) |
321 | encoder->hot_plug(encoder); | 323 | encoder->hot_plug(encoder); |
@@ -1649,9 +1651,7 @@ static int ironlake_irq_postinstall(struct drm_device *dev) | |||
1649 | } else { | 1651 | } else { |
1650 | hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | | 1652 | hotplug_mask = SDE_CRT_HOTPLUG | SDE_PORTB_HOTPLUG | |
1651 | SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; | 1653 | SDE_PORTC_HOTPLUG | SDE_PORTD_HOTPLUG; |
1652 | hotplug_mask |= SDE_AUX_MASK | SDE_FDI_MASK | SDE_TRANS_MASK; | 1654 | hotplug_mask |= SDE_AUX_MASK; |
1653 | I915_WRITE(FDI_RXA_IMR, 0); | ||
1654 | I915_WRITE(FDI_RXB_IMR, 0); | ||
1655 | } | 1655 | } |
1656 | 1656 | ||
1657 | dev_priv->pch_irq_mask = ~hotplug_mask; | 1657 | dev_priv->pch_irq_mask = ~hotplug_mask; |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 15d94c63918c..2abe240dae58 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -3271,6 +3271,8 @@ | |||
3271 | #define FORCEWAKE 0xA18C | 3271 | #define FORCEWAKE 0xA18C |
3272 | #define FORCEWAKE_ACK 0x130090 | 3272 | #define FORCEWAKE_ACK 0x130090 |
3273 | 3273 | ||
3274 | #define GT_FIFO_FREE_ENTRIES 0x120008 | ||
3275 | |||
3274 | #define GEN6_RPNSWREQ 0xA008 | 3276 | #define GEN6_RPNSWREQ 0xA008 |
3275 | #define GEN6_TURBO_DISABLE (1<<31) | 3277 | #define GEN6_TURBO_DISABLE (1<<31) |
3276 | #define GEN6_FREQUENCY(x) ((x)<<25) | 3278 | #define GEN6_FREQUENCY(x) ((x)<<25) |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 3b006536b3d2..49fb54fd9a18 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1219,7 +1219,7 @@ static void sandybridge_blit_fbc_update(struct drm_device *dev) | |||
1219 | u32 blt_ecoskpd; | 1219 | u32 blt_ecoskpd; |
1220 | 1220 | ||
1221 | /* Make sure blitter notifies FBC of writes */ | 1221 | /* Make sure blitter notifies FBC of writes */ |
1222 | __gen6_force_wake_get(dev_priv); | 1222 | __gen6_gt_force_wake_get(dev_priv); |
1223 | blt_ecoskpd = I915_READ(GEN6_BLITTER_ECOSKPD); | 1223 | blt_ecoskpd = I915_READ(GEN6_BLITTER_ECOSKPD); |
1224 | blt_ecoskpd |= GEN6_BLITTER_FBC_NOTIFY << | 1224 | blt_ecoskpd |= GEN6_BLITTER_FBC_NOTIFY << |
1225 | GEN6_BLITTER_LOCK_SHIFT; | 1225 | GEN6_BLITTER_LOCK_SHIFT; |
@@ -1230,7 +1230,7 @@ static void sandybridge_blit_fbc_update(struct drm_device *dev) | |||
1230 | GEN6_BLITTER_LOCK_SHIFT); | 1230 | GEN6_BLITTER_LOCK_SHIFT); |
1231 | I915_WRITE(GEN6_BLITTER_ECOSKPD, blt_ecoskpd); | 1231 | I915_WRITE(GEN6_BLITTER_ECOSKPD, blt_ecoskpd); |
1232 | POSTING_READ(GEN6_BLITTER_ECOSKPD); | 1232 | POSTING_READ(GEN6_BLITTER_ECOSKPD); |
1233 | __gen6_force_wake_put(dev_priv); | 1233 | __gen6_gt_force_wake_put(dev_priv); |
1234 | } | 1234 | } |
1235 | 1235 | ||
1236 | static void ironlake_enable_fbc(struct drm_crtc *crtc, unsigned long interval) | 1236 | static void ironlake_enable_fbc(struct drm_crtc *crtc, unsigned long interval) |
@@ -1630,19 +1630,19 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
1630 | struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; | 1630 | struct drm_i915_gem_object *obj = to_intel_framebuffer(old_fb)->obj; |
1631 | 1631 | ||
1632 | wait_event(dev_priv->pending_flip_queue, | 1632 | wait_event(dev_priv->pending_flip_queue, |
1633 | atomic_read(&dev_priv->mm.wedged) || | ||
1633 | atomic_read(&obj->pending_flip) == 0); | 1634 | atomic_read(&obj->pending_flip) == 0); |
1634 | 1635 | ||
1635 | /* Big Hammer, we also need to ensure that any pending | 1636 | /* Big Hammer, we also need to ensure that any pending |
1636 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the | 1637 | * MI_WAIT_FOR_EVENT inside a user batch buffer on the |
1637 | * current scanout is retired before unpinning the old | 1638 | * current scanout is retired before unpinning the old |
1638 | * framebuffer. | 1639 | * framebuffer. |
1640 | * | ||
1641 | * This should only fail upon a hung GPU, in which case we | ||
1642 | * can safely continue. | ||
1639 | */ | 1643 | */ |
1640 | ret = i915_gem_object_flush_gpu(obj, false); | 1644 | ret = i915_gem_object_flush_gpu(obj, false); |
1641 | if (ret) { | 1645 | (void) ret; |
1642 | i915_gem_object_unpin(to_intel_framebuffer(crtc->fb)->obj); | ||
1643 | mutex_unlock(&dev->struct_mutex); | ||
1644 | return ret; | ||
1645 | } | ||
1646 | } | 1646 | } |
1647 | 1647 | ||
1648 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, | 1648 | ret = intel_pipe_set_base_atomic(crtc, crtc->fb, x, y, |
@@ -2045,6 +2045,31 @@ static void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc) | |||
2045 | atomic_read(&obj->pending_flip) == 0); | 2045 | atomic_read(&obj->pending_flip) == 0); |
2046 | } | 2046 | } |
2047 | 2047 | ||
2048 | static bool intel_crtc_driving_pch(struct drm_crtc *crtc) | ||
2049 | { | ||
2050 | struct drm_device *dev = crtc->dev; | ||
2051 | struct drm_mode_config *mode_config = &dev->mode_config; | ||
2052 | struct intel_encoder *encoder; | ||
2053 | |||
2054 | /* | ||
2055 | * If there's a non-PCH eDP on this crtc, it must be DP_A, and that | ||
2056 | * must be driven by its own crtc; no sharing is possible. | ||
2057 | */ | ||
2058 | list_for_each_entry(encoder, &mode_config->encoder_list, base.head) { | ||
2059 | if (encoder->base.crtc != crtc) | ||
2060 | continue; | ||
2061 | |||
2062 | switch (encoder->type) { | ||
2063 | case INTEL_OUTPUT_EDP: | ||
2064 | if (!intel_encoder_is_pch_edp(&encoder->base)) | ||
2065 | return false; | ||
2066 | continue; | ||
2067 | } | ||
2068 | } | ||
2069 | |||
2070 | return true; | ||
2071 | } | ||
2072 | |||
2048 | static void ironlake_crtc_enable(struct drm_crtc *crtc) | 2073 | static void ironlake_crtc_enable(struct drm_crtc *crtc) |
2049 | { | 2074 | { |
2050 | struct drm_device *dev = crtc->dev; | 2075 | struct drm_device *dev = crtc->dev; |
@@ -2053,6 +2078,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
2053 | int pipe = intel_crtc->pipe; | 2078 | int pipe = intel_crtc->pipe; |
2054 | int plane = intel_crtc->plane; | 2079 | int plane = intel_crtc->plane; |
2055 | u32 reg, temp; | 2080 | u32 reg, temp; |
2081 | bool is_pch_port = false; | ||
2056 | 2082 | ||
2057 | if (intel_crtc->active) | 2083 | if (intel_crtc->active) |
2058 | return; | 2084 | return; |
@@ -2066,7 +2092,56 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
2066 | I915_WRITE(PCH_LVDS, temp | LVDS_PORT_EN); | 2092 | I915_WRITE(PCH_LVDS, temp | LVDS_PORT_EN); |
2067 | } | 2093 | } |
2068 | 2094 | ||
2069 | ironlake_fdi_enable(crtc); | 2095 | is_pch_port = intel_crtc_driving_pch(crtc); |
2096 | |||
2097 | if (is_pch_port) | ||
2098 | ironlake_fdi_enable(crtc); | ||
2099 | else { | ||
2100 | /* disable CPU FDI tx and PCH FDI rx */ | ||
2101 | reg = FDI_TX_CTL(pipe); | ||
2102 | temp = I915_READ(reg); | ||
2103 | I915_WRITE(reg, temp & ~FDI_TX_ENABLE); | ||
2104 | POSTING_READ(reg); | ||
2105 | |||
2106 | reg = FDI_RX_CTL(pipe); | ||
2107 | temp = I915_READ(reg); | ||
2108 | temp &= ~(0x7 << 16); | ||
2109 | temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11; | ||
2110 | I915_WRITE(reg, temp & ~FDI_RX_ENABLE); | ||
2111 | |||
2112 | POSTING_READ(reg); | ||
2113 | udelay(100); | ||
2114 | |||
2115 | /* Ironlake workaround, disable clock pointer after downing FDI */ | ||
2116 | if (HAS_PCH_IBX(dev)) | ||
2117 | I915_WRITE(FDI_RX_CHICKEN(pipe), | ||
2118 | I915_READ(FDI_RX_CHICKEN(pipe) & | ||
2119 | ~FDI_RX_PHASE_SYNC_POINTER_ENABLE)); | ||
2120 | |||
2121 | /* still set train pattern 1 */ | ||
2122 | reg = FDI_TX_CTL(pipe); | ||
2123 | temp = I915_READ(reg); | ||
2124 | temp &= ~FDI_LINK_TRAIN_NONE; | ||
2125 | temp |= FDI_LINK_TRAIN_PATTERN_1; | ||
2126 | I915_WRITE(reg, temp); | ||
2127 | |||
2128 | reg = FDI_RX_CTL(pipe); | ||
2129 | temp = I915_READ(reg); | ||
2130 | if (HAS_PCH_CPT(dev)) { | ||
2131 | temp &= ~FDI_LINK_TRAIN_PATTERN_MASK_CPT; | ||
2132 | temp |= FDI_LINK_TRAIN_PATTERN_1_CPT; | ||
2133 | } else { | ||
2134 | temp &= ~FDI_LINK_TRAIN_NONE; | ||
2135 | temp |= FDI_LINK_TRAIN_PATTERN_1; | ||
2136 | } | ||
2137 | /* BPC in FDI rx is consistent with that in PIPECONF */ | ||
2138 | temp &= ~(0x07 << 16); | ||
2139 | temp |= (I915_READ(PIPECONF(pipe)) & PIPE_BPC_MASK) << 11; | ||
2140 | I915_WRITE(reg, temp); | ||
2141 | |||
2142 | POSTING_READ(reg); | ||
2143 | udelay(100); | ||
2144 | } | ||
2070 | 2145 | ||
2071 | /* Enable panel fitting for LVDS */ | 2146 | /* Enable panel fitting for LVDS */ |
2072 | if (dev_priv->pch_pf_size && | 2147 | if (dev_priv->pch_pf_size && |
@@ -2100,6 +2175,10 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
2100 | intel_flush_display_plane(dev, plane); | 2175 | intel_flush_display_plane(dev, plane); |
2101 | } | 2176 | } |
2102 | 2177 | ||
2178 | /* Skip the PCH stuff if possible */ | ||
2179 | if (!is_pch_port) | ||
2180 | goto done; | ||
2181 | |||
2103 | /* For PCH output, training FDI link */ | 2182 | /* For PCH output, training FDI link */ |
2104 | if (IS_GEN6(dev)) | 2183 | if (IS_GEN6(dev)) |
2105 | gen6_fdi_link_train(crtc); | 2184 | gen6_fdi_link_train(crtc); |
@@ -2184,7 +2263,7 @@ static void ironlake_crtc_enable(struct drm_crtc *crtc) | |||
2184 | I915_WRITE(reg, temp | TRANS_ENABLE); | 2263 | I915_WRITE(reg, temp | TRANS_ENABLE); |
2185 | if (wait_for(I915_READ(reg) & TRANS_STATE_ENABLE, 100)) | 2264 | if (wait_for(I915_READ(reg) & TRANS_STATE_ENABLE, 100)) |
2186 | DRM_ERROR("failed to enable transcoder %d\n", pipe); | 2265 | DRM_ERROR("failed to enable transcoder %d\n", pipe); |
2187 | 2266 | done: | |
2188 | intel_crtc_load_lut(crtc); | 2267 | intel_crtc_load_lut(crtc); |
2189 | intel_update_fbc(dev); | 2268 | intel_update_fbc(dev); |
2190 | intel_crtc_update_cursor(crtc, true); | 2269 | intel_crtc_update_cursor(crtc, true); |
@@ -6203,7 +6282,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv) | |||
6203 | * userspace... | 6282 | * userspace... |
6204 | */ | 6283 | */ |
6205 | I915_WRITE(GEN6_RC_STATE, 0); | 6284 | I915_WRITE(GEN6_RC_STATE, 0); |
6206 | __gen6_force_wake_get(dev_priv); | 6285 | __gen6_gt_force_wake_get(dev_priv); |
6207 | 6286 | ||
6208 | /* disable the counters and set deterministic thresholds */ | 6287 | /* disable the counters and set deterministic thresholds */ |
6209 | I915_WRITE(GEN6_RC_CONTROL, 0); | 6288 | I915_WRITE(GEN6_RC_CONTROL, 0); |
@@ -6301,7 +6380,7 @@ void gen6_enable_rps(struct drm_i915_private *dev_priv) | |||
6301 | /* enable all PM interrupts */ | 6380 | /* enable all PM interrupts */ |
6302 | I915_WRITE(GEN6_PMINTRMSK, 0); | 6381 | I915_WRITE(GEN6_PMINTRMSK, 0); |
6303 | 6382 | ||
6304 | __gen6_force_wake_put(dev_priv); | 6383 | __gen6_gt_force_wake_put(dev_priv); |
6305 | } | 6384 | } |
6306 | 6385 | ||
6307 | void intel_enable_clock_gating(struct drm_device *dev) | 6386 | void intel_enable_clock_gating(struct drm_device *dev) |
@@ -6496,7 +6575,7 @@ static void ironlake_disable_rc6(struct drm_device *dev) | |||
6496 | POSTING_READ(RSTDBYCTL); | 6575 | POSTING_READ(RSTDBYCTL); |
6497 | } | 6576 | } |
6498 | 6577 | ||
6499 | ironlake_disable_rc6(dev); | 6578 | ironlake_teardown_rc6(dev); |
6500 | } | 6579 | } |
6501 | 6580 | ||
6502 | static int ironlake_setup_rc6(struct drm_device *dev) | 6581 | static int ironlake_setup_rc6(struct drm_device *dev) |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index c65992df458d..f8f86e57df22 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -208,7 +208,6 @@ u32 intel_panel_get_backlight(struct drm_device *dev) | |||
208 | val &= ~1; | 208 | val &= ~1; |
209 | pci_read_config_byte(dev->pdev, PCI_LBPC, &lbpc); | 209 | pci_read_config_byte(dev->pdev, PCI_LBPC, &lbpc); |
210 | val *= lbpc; | 210 | val *= lbpc; |
211 | val >>= 1; | ||
212 | } | 211 | } |
213 | } | 212 | } |
214 | 213 | ||
@@ -235,11 +234,11 @@ void intel_panel_set_backlight(struct drm_device *dev, u32 level) | |||
235 | 234 | ||
236 | if (is_backlight_combination_mode(dev)){ | 235 | if (is_backlight_combination_mode(dev)){ |
237 | u32 max = intel_panel_get_max_backlight(dev); | 236 | u32 max = intel_panel_get_max_backlight(dev); |
238 | u8 lpbc; | 237 | u8 lbpc; |
239 | 238 | ||
240 | lpbc = level * 0xfe / max + 1; | 239 | lbpc = level * 0xfe / max + 1; |
241 | level /= lpbc; | 240 | level /= lbpc; |
242 | pci_write_config_byte(dev->pdev, PCI_LBPC, lpbc); | 241 | pci_write_config_byte(dev->pdev, PCI_LBPC, lbpc); |
243 | } | 242 | } |
244 | 243 | ||
245 | tmp = I915_READ(BLC_PWM_CTL); | 244 | tmp = I915_READ(BLC_PWM_CTL); |
diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h index 6d6fde85a636..34306865a5df 100644 --- a/drivers/gpu/drm/i915/intel_ringbuffer.h +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h | |||
@@ -14,22 +14,23 @@ struct intel_hw_status_page { | |||
14 | struct drm_i915_gem_object *obj; | 14 | struct drm_i915_gem_object *obj; |
15 | }; | 15 | }; |
16 | 16 | ||
17 | #define I915_RING_READ(reg) i915_safe_read(dev_priv, reg) | 17 | #define I915_RING_READ(reg) i915_gt_read(dev_priv, reg) |
18 | #define I915_RING_WRITE(reg, val) i915_gt_write(dev_priv, reg, val) | ||
18 | 19 | ||
19 | #define I915_READ_TAIL(ring) I915_RING_READ(RING_TAIL((ring)->mmio_base)) | 20 | #define I915_READ_TAIL(ring) I915_RING_READ(RING_TAIL((ring)->mmio_base)) |
20 | #define I915_WRITE_TAIL(ring, val) I915_WRITE(RING_TAIL((ring)->mmio_base), val) | 21 | #define I915_WRITE_TAIL(ring, val) I915_RING_WRITE(RING_TAIL((ring)->mmio_base), val) |
21 | 22 | ||
22 | #define I915_READ_START(ring) I915_RING_READ(RING_START((ring)->mmio_base)) | 23 | #define I915_READ_START(ring) I915_RING_READ(RING_START((ring)->mmio_base)) |
23 | #define I915_WRITE_START(ring, val) I915_WRITE(RING_START((ring)->mmio_base), val) | 24 | #define I915_WRITE_START(ring, val) I915_RING_WRITE(RING_START((ring)->mmio_base), val) |
24 | 25 | ||
25 | #define I915_READ_HEAD(ring) I915_RING_READ(RING_HEAD((ring)->mmio_base)) | 26 | #define I915_READ_HEAD(ring) I915_RING_READ(RING_HEAD((ring)->mmio_base)) |
26 | #define I915_WRITE_HEAD(ring, val) I915_WRITE(RING_HEAD((ring)->mmio_base), val) | 27 | #define I915_WRITE_HEAD(ring, val) I915_RING_WRITE(RING_HEAD((ring)->mmio_base), val) |
27 | 28 | ||
28 | #define I915_READ_CTL(ring) I915_RING_READ(RING_CTL((ring)->mmio_base)) | 29 | #define I915_READ_CTL(ring) I915_RING_READ(RING_CTL((ring)->mmio_base)) |
29 | #define I915_WRITE_CTL(ring, val) I915_WRITE(RING_CTL((ring)->mmio_base), val) | 30 | #define I915_WRITE_CTL(ring, val) I915_RING_WRITE(RING_CTL((ring)->mmio_base), val) |
30 | 31 | ||
31 | #define I915_WRITE_IMR(ring, val) I915_WRITE(RING_IMR((ring)->mmio_base), val) | ||
32 | #define I915_READ_IMR(ring) I915_RING_READ(RING_IMR((ring)->mmio_base)) | 32 | #define I915_READ_IMR(ring) I915_RING_READ(RING_IMR((ring)->mmio_base)) |
33 | #define I915_WRITE_IMR(ring, val) I915_RING_WRITE(RING_IMR((ring)->mmio_base), val) | ||
33 | 34 | ||
34 | #define I915_READ_NOPID(ring) I915_RING_READ(RING_NOPID((ring)->mmio_base)) | 35 | #define I915_READ_NOPID(ring) I915_RING_READ(RING_NOPID((ring)->mmio_base)) |
35 | #define I915_READ_SYNC_0(ring) I915_RING_READ(RING_SYNC_0((ring)->mmio_base)) | 36 | #define I915_READ_SYNC_0(ring) I915_RING_READ(RING_SYNC_0((ring)->mmio_base)) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index d38a4d9f9b0b..a52184007f5f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -49,7 +49,10 @@ nouveau_bo_del_ttm(struct ttm_buffer_object *bo) | |||
49 | DRM_ERROR("bo %p still attached to GEM object\n", bo); | 49 | DRM_ERROR("bo %p still attached to GEM object\n", bo); |
50 | 50 | ||
51 | nv10_mem_put_tile_region(dev, nvbo->tile, NULL); | 51 | nv10_mem_put_tile_region(dev, nvbo->tile, NULL); |
52 | nouveau_vm_put(&nvbo->vma); | 52 | if (nvbo->vma.node) { |
53 | nouveau_vm_unmap(&nvbo->vma); | ||
54 | nouveau_vm_put(&nvbo->vma); | ||
55 | } | ||
53 | kfree(nvbo); | 56 | kfree(nvbo); |
54 | } | 57 | } |
55 | 58 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c index 65699bfaaaea..b368ed74aad7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.c +++ b/drivers/gpu/drm/nouveau/nouveau_dma.c | |||
@@ -83,7 +83,8 @@ nouveau_dma_init(struct nouveau_channel *chan) | |||
83 | return ret; | 83 | return ret; |
84 | 84 | ||
85 | /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */ | 85 | /* NV_MEMORY_TO_MEMORY_FORMAT requires a notifier object */ |
86 | ret = nouveau_notifier_alloc(chan, NvNotify0, 32, &chan->m2mf_ntfy); | 86 | ret = nouveau_notifier_alloc(chan, NvNotify0, 32, 0xfd0, 0x1000, |
87 | &chan->m2mf_ntfy); | ||
87 | if (ret) | 88 | if (ret) |
88 | return ret; | 89 | return ret; |
89 | 90 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 9821fcacc3d2..982d70b12722 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -852,7 +852,8 @@ extern const struct ttm_mem_type_manager_func nouveau_vram_manager; | |||
852 | extern int nouveau_notifier_init_channel(struct nouveau_channel *); | 852 | extern int nouveau_notifier_init_channel(struct nouveau_channel *); |
853 | extern void nouveau_notifier_takedown_channel(struct nouveau_channel *); | 853 | extern void nouveau_notifier_takedown_channel(struct nouveau_channel *); |
854 | extern int nouveau_notifier_alloc(struct nouveau_channel *, uint32_t handle, | 854 | extern int nouveau_notifier_alloc(struct nouveau_channel *, uint32_t handle, |
855 | int cout, uint32_t *offset); | 855 | int cout, uint32_t start, uint32_t end, |
856 | uint32_t *offset); | ||
856 | extern int nouveau_notifier_offset(struct nouveau_gpuobj *, uint32_t *); | 857 | extern int nouveau_notifier_offset(struct nouveau_gpuobj *, uint32_t *); |
857 | extern int nouveau_ioctl_notifier_alloc(struct drm_device *, void *data, | 858 | extern int nouveau_ioctl_notifier_alloc(struct drm_device *, void *data, |
858 | struct drm_file *); | 859 | struct drm_file *); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mem.c b/drivers/gpu/drm/nouveau/nouveau_mem.c index 26347b7cd872..b0fb9bdcddb7 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mem.c +++ b/drivers/gpu/drm/nouveau/nouveau_mem.c | |||
@@ -725,8 +725,10 @@ nouveau_vram_manager_new(struct ttm_mem_type_manager *man, | |||
725 | ret = vram->get(dev, mem->num_pages << PAGE_SHIFT, | 725 | ret = vram->get(dev, mem->num_pages << PAGE_SHIFT, |
726 | mem->page_alignment << PAGE_SHIFT, size_nc, | 726 | mem->page_alignment << PAGE_SHIFT, size_nc, |
727 | (nvbo->tile_flags >> 8) & 0xff, &node); | 727 | (nvbo->tile_flags >> 8) & 0xff, &node); |
728 | if (ret) | 728 | if (ret) { |
729 | return ret; | 729 | mem->mm_node = NULL; |
730 | return (ret == -ENOSPC) ? 0 : ret; | ||
731 | } | ||
730 | 732 | ||
731 | node->page_shift = 12; | 733 | node->page_shift = 12; |
732 | if (nvbo->vma.node) | 734 | if (nvbo->vma.node) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_mm.c b/drivers/gpu/drm/nouveau/nouveau_mm.c index 8844b50c3e54..7609756b6faf 100644 --- a/drivers/gpu/drm/nouveau/nouveau_mm.c +++ b/drivers/gpu/drm/nouveau/nouveau_mm.c | |||
@@ -123,7 +123,7 @@ nouveau_mm_get(struct nouveau_mm *rmm, int type, u32 size, u32 size_nc, | |||
123 | return 0; | 123 | return 0; |
124 | } | 124 | } |
125 | 125 | ||
126 | return -ENOMEM; | 126 | return -ENOSPC; |
127 | } | 127 | } |
128 | 128 | ||
129 | int | 129 | int |
diff --git a/drivers/gpu/drm/nouveau/nouveau_notifier.c b/drivers/gpu/drm/nouveau/nouveau_notifier.c index fe29d604b820..5ea167623a82 100644 --- a/drivers/gpu/drm/nouveau/nouveau_notifier.c +++ b/drivers/gpu/drm/nouveau/nouveau_notifier.c | |||
@@ -96,7 +96,8 @@ nouveau_notifier_gpuobj_dtor(struct drm_device *dev, | |||
96 | 96 | ||
97 | int | 97 | int |
98 | nouveau_notifier_alloc(struct nouveau_channel *chan, uint32_t handle, | 98 | nouveau_notifier_alloc(struct nouveau_channel *chan, uint32_t handle, |
99 | int size, uint32_t *b_offset) | 99 | int size, uint32_t start, uint32_t end, |
100 | uint32_t *b_offset) | ||
100 | { | 101 | { |
101 | struct drm_device *dev = chan->dev; | 102 | struct drm_device *dev = chan->dev; |
102 | struct nouveau_gpuobj *nobj = NULL; | 103 | struct nouveau_gpuobj *nobj = NULL; |
@@ -104,9 +105,10 @@ nouveau_notifier_alloc(struct nouveau_channel *chan, uint32_t handle, | |||
104 | uint32_t offset; | 105 | uint32_t offset; |
105 | int target, ret; | 106 | int target, ret; |
106 | 107 | ||
107 | mem = drm_mm_search_free(&chan->notifier_heap, size, 0, 0); | 108 | mem = drm_mm_search_free_in_range(&chan->notifier_heap, size, 0, |
109 | start, end, 0); | ||
108 | if (mem) | 110 | if (mem) |
109 | mem = drm_mm_get_block(mem, size, 0); | 111 | mem = drm_mm_get_block_range(mem, size, 0, start, end); |
110 | if (!mem) { | 112 | if (!mem) { |
111 | NV_ERROR(dev, "Channel %d notifier block full\n", chan->id); | 113 | NV_ERROR(dev, "Channel %d notifier block full\n", chan->id); |
112 | return -ENOMEM; | 114 | return -ENOMEM; |
@@ -177,7 +179,8 @@ nouveau_ioctl_notifier_alloc(struct drm_device *dev, void *data, | |||
177 | if (IS_ERR(chan)) | 179 | if (IS_ERR(chan)) |
178 | return PTR_ERR(chan); | 180 | return PTR_ERR(chan); |
179 | 181 | ||
180 | ret = nouveau_notifier_alloc(chan, na->handle, na->size, &na->offset); | 182 | ret = nouveau_notifier_alloc(chan, na->handle, na->size, 0, 0x1000, |
183 | &na->offset); | ||
181 | nouveau_channel_put(&chan); | 184 | nouveau_channel_put(&chan); |
182 | return ret; | 185 | return ret; |
183 | } | 186 | } |
diff --git a/drivers/gpu/drm/nouveau/nv50_instmem.c b/drivers/gpu/drm/nouveau/nv50_instmem.c index ea0041810ae3..e57caa2a00e3 100644 --- a/drivers/gpu/drm/nouveau/nv50_instmem.c +++ b/drivers/gpu/drm/nouveau/nv50_instmem.c | |||
@@ -403,16 +403,24 @@ nv50_instmem_unmap(struct nouveau_gpuobj *gpuobj) | |||
403 | void | 403 | void |
404 | nv50_instmem_flush(struct drm_device *dev) | 404 | nv50_instmem_flush(struct drm_device *dev) |
405 | { | 405 | { |
406 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
407 | |||
408 | spin_lock(&dev_priv->ramin_lock); | ||
406 | nv_wr32(dev, 0x00330c, 0x00000001); | 409 | nv_wr32(dev, 0x00330c, 0x00000001); |
407 | if (!nv_wait(dev, 0x00330c, 0x00000002, 0x00000000)) | 410 | if (!nv_wait(dev, 0x00330c, 0x00000002, 0x00000000)) |
408 | NV_ERROR(dev, "PRAMIN flush timeout\n"); | 411 | NV_ERROR(dev, "PRAMIN flush timeout\n"); |
412 | spin_unlock(&dev_priv->ramin_lock); | ||
409 | } | 413 | } |
410 | 414 | ||
411 | void | 415 | void |
412 | nv84_instmem_flush(struct drm_device *dev) | 416 | nv84_instmem_flush(struct drm_device *dev) |
413 | { | 417 | { |
418 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
419 | |||
420 | spin_lock(&dev_priv->ramin_lock); | ||
414 | nv_wr32(dev, 0x070000, 0x00000001); | 421 | nv_wr32(dev, 0x070000, 0x00000001); |
415 | if (!nv_wait(dev, 0x070000, 0x00000002, 0x00000000)) | 422 | if (!nv_wait(dev, 0x070000, 0x00000002, 0x00000000)) |
416 | NV_ERROR(dev, "PRAMIN flush timeout\n"); | 423 | NV_ERROR(dev, "PRAMIN flush timeout\n"); |
424 | spin_unlock(&dev_priv->ramin_lock); | ||
417 | } | 425 | } |
418 | 426 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_vm.c b/drivers/gpu/drm/nouveau/nv50_vm.c index 459ff08241e5..6144156f255a 100644 --- a/drivers/gpu/drm/nouveau/nv50_vm.c +++ b/drivers/gpu/drm/nouveau/nv50_vm.c | |||
@@ -169,7 +169,11 @@ nv50_vm_flush(struct nouveau_vm *vm) | |||
169 | void | 169 | void |
170 | nv50_vm_flush_engine(struct drm_device *dev, int engine) | 170 | nv50_vm_flush_engine(struct drm_device *dev, int engine) |
171 | { | 171 | { |
172 | struct drm_nouveau_private *dev_priv = dev->dev_private; | ||
173 | |||
174 | spin_lock(&dev_priv->ramin_lock); | ||
172 | nv_wr32(dev, 0x100c80, (engine << 16) | 1); | 175 | nv_wr32(dev, 0x100c80, (engine << 16) | 1); |
173 | if (!nv_wait(dev, 0x100c80, 0x00000001, 0x00000000)) | 176 | if (!nv_wait(dev, 0x100c80, 0x00000001, 0x00000000)) |
174 | NV_ERROR(dev, "vm flush timeout: engine %d\n", engine); | 177 | NV_ERROR(dev, "vm flush timeout: engine %d\n", engine); |
178 | spin_unlock(&dev_priv->ramin_lock); | ||
175 | } | 179 | } |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index d270b3ff896b..6140ea1de45a 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -2194,7 +2194,6 @@ int evergreen_mc_init(struct radeon_device *rdev) | |||
2194 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; | 2194 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE) * 1024 * 1024; |
2195 | } | 2195 | } |
2196 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 2196 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
2197 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
2198 | r700_vram_gtt_location(rdev, &rdev->mc); | 2197 | r700_vram_gtt_location(rdev, &rdev->mc); |
2199 | radeon_update_bandwidth_info(rdev); | 2198 | radeon_update_bandwidth_info(rdev); |
2200 | 2199 | ||
@@ -2934,7 +2933,7 @@ static int evergreen_startup(struct radeon_device *rdev) | |||
2934 | /* XXX: ontario has problems blitting to gart at the moment */ | 2933 | /* XXX: ontario has problems blitting to gart at the moment */ |
2935 | if (rdev->family == CHIP_PALM) { | 2934 | if (rdev->family == CHIP_PALM) { |
2936 | rdev->asic->copy = NULL; | 2935 | rdev->asic->copy = NULL; |
2937 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | 2936 | radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size); |
2938 | } | 2937 | } |
2939 | 2938 | ||
2940 | /* allocate wb buffer */ | 2939 | /* allocate wb buffer */ |
diff --git a/drivers/gpu/drm/radeon/evergreen_blit_kms.c b/drivers/gpu/drm/radeon/evergreen_blit_kms.c index 2adfb03f479b..2be698e78ff2 100644 --- a/drivers/gpu/drm/radeon/evergreen_blit_kms.c +++ b/drivers/gpu/drm/radeon/evergreen_blit_kms.c | |||
@@ -623,7 +623,7 @@ done: | |||
623 | dev_err(rdev->dev, "(%d) pin blit object failed\n", r); | 623 | dev_err(rdev->dev, "(%d) pin blit object failed\n", r); |
624 | return r; | 624 | return r; |
625 | } | 625 | } |
626 | rdev->mc.active_vram_size = rdev->mc.real_vram_size; | 626 | radeon_ttm_set_active_vram_size(rdev, rdev->mc.real_vram_size); |
627 | return 0; | 627 | return 0; |
628 | } | 628 | } |
629 | 629 | ||
@@ -631,7 +631,7 @@ void evergreen_blit_fini(struct radeon_device *rdev) | |||
631 | { | 631 | { |
632 | int r; | 632 | int r; |
633 | 633 | ||
634 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | 634 | radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size); |
635 | if (rdev->r600_blit.shader_obj == NULL) | 635 | if (rdev->r600_blit.shader_obj == NULL) |
636 | return; | 636 | return; |
637 | /* If we can't reserve the bo, unref should be enough to destroy | 637 | /* If we can't reserve the bo, unref should be enough to destroy |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index 56deae5bf02e..e372f9e1e5ce 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -70,23 +70,6 @@ MODULE_FIRMWARE(FIRMWARE_R520); | |||
70 | 70 | ||
71 | void r100_pre_page_flip(struct radeon_device *rdev, int crtc) | 71 | void r100_pre_page_flip(struct radeon_device *rdev, int crtc) |
72 | { | 72 | { |
73 | struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc]; | ||
74 | u32 tmp; | ||
75 | |||
76 | /* make sure flip is at vb rather than hb */ | ||
77 | tmp = RREG32(RADEON_CRTC_OFFSET_CNTL + radeon_crtc->crtc_offset); | ||
78 | tmp &= ~RADEON_CRTC_OFFSET_FLIP_CNTL; | ||
79 | /* make sure pending bit is asserted */ | ||
80 | tmp |= RADEON_CRTC_GUI_TRIG_OFFSET_LEFT_EN; | ||
81 | WREG32(RADEON_CRTC_OFFSET_CNTL + radeon_crtc->crtc_offset, tmp); | ||
82 | |||
83 | /* set pageflip to happen as late as possible in the vblank interval. | ||
84 | * same field for crtc1/2 | ||
85 | */ | ||
86 | tmp = RREG32(RADEON_CRTC_GEN_CNTL); | ||
87 | tmp &= ~RADEON_CRTC_VSTAT_MODE_MASK; | ||
88 | WREG32(RADEON_CRTC_GEN_CNTL, tmp); | ||
89 | |||
90 | /* enable the pflip int */ | 73 | /* enable the pflip int */ |
91 | radeon_irq_kms_pflip_irq_get(rdev, crtc); | 74 | radeon_irq_kms_pflip_irq_get(rdev, crtc); |
92 | } | 75 | } |
@@ -1041,7 +1024,7 @@ int r100_cp_init(struct radeon_device *rdev, unsigned ring_size) | |||
1041 | return r; | 1024 | return r; |
1042 | } | 1025 | } |
1043 | rdev->cp.ready = true; | 1026 | rdev->cp.ready = true; |
1044 | rdev->mc.active_vram_size = rdev->mc.real_vram_size; | 1027 | radeon_ttm_set_active_vram_size(rdev, rdev->mc.real_vram_size); |
1045 | return 0; | 1028 | return 0; |
1046 | } | 1029 | } |
1047 | 1030 | ||
@@ -1059,7 +1042,7 @@ void r100_cp_fini(struct radeon_device *rdev) | |||
1059 | void r100_cp_disable(struct radeon_device *rdev) | 1042 | void r100_cp_disable(struct radeon_device *rdev) |
1060 | { | 1043 | { |
1061 | /* Disable ring */ | 1044 | /* Disable ring */ |
1062 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | 1045 | radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size); |
1063 | rdev->cp.ready = false; | 1046 | rdev->cp.ready = false; |
1064 | WREG32(RADEON_CP_CSQ_MODE, 0); | 1047 | WREG32(RADEON_CP_CSQ_MODE, 0); |
1065 | WREG32(RADEON_CP_CSQ_CNTL, 0); | 1048 | WREG32(RADEON_CP_CSQ_CNTL, 0); |
@@ -2329,7 +2312,6 @@ void r100_vram_init_sizes(struct radeon_device *rdev) | |||
2329 | /* FIXME we don't use the second aperture yet when we could use it */ | 2312 | /* FIXME we don't use the second aperture yet when we could use it */ |
2330 | if (rdev->mc.visible_vram_size > rdev->mc.aper_size) | 2313 | if (rdev->mc.visible_vram_size > rdev->mc.aper_size) |
2331 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 2314 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
2332 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
2333 | config_aper_size = RREG32(RADEON_CONFIG_APER_SIZE); | 2315 | config_aper_size = RREG32(RADEON_CONFIG_APER_SIZE); |
2334 | if (rdev->flags & RADEON_IS_IGP) { | 2316 | if (rdev->flags & RADEON_IS_IGP) { |
2335 | uint32_t tom; | 2317 | uint32_t tom; |
@@ -3490,7 +3472,7 @@ void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track | |||
3490 | track->num_texture = 16; | 3472 | track->num_texture = 16; |
3491 | track->maxy = 4096; | 3473 | track->maxy = 4096; |
3492 | track->separate_cube = 0; | 3474 | track->separate_cube = 0; |
3493 | track->aaresolve = true; | 3475 | track->aaresolve = false; |
3494 | track->aa.robj = NULL; | 3476 | track->aa.robj = NULL; |
3495 | } | 3477 | } |
3496 | 3478 | ||
@@ -3801,8 +3783,6 @@ static int r100_startup(struct radeon_device *rdev) | |||
3801 | r100_mc_program(rdev); | 3783 | r100_mc_program(rdev); |
3802 | /* Resume clock */ | 3784 | /* Resume clock */ |
3803 | r100_clock_startup(rdev); | 3785 | r100_clock_startup(rdev); |
3804 | /* Initialize GPU configuration (# pipes, ...) */ | ||
3805 | // r100_gpu_init(rdev); | ||
3806 | /* Initialize GART (initialize after TTM so we can allocate | 3786 | /* Initialize GART (initialize after TTM so we can allocate |
3807 | * memory through TTM but finalize after TTM) */ | 3787 | * memory through TTM but finalize after TTM) */ |
3808 | r100_enable_bm(rdev); | 3788 | r100_enable_bm(rdev); |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index de88624d5f87..9b3fad23b76c 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -1255,7 +1255,6 @@ int r600_mc_init(struct radeon_device *rdev) | |||
1255 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); | 1255 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); |
1256 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); | 1256 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); |
1257 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 1257 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
1258 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
1259 | r600_vram_gtt_location(rdev, &rdev->mc); | 1258 | r600_vram_gtt_location(rdev, &rdev->mc); |
1260 | 1259 | ||
1261 | if (rdev->flags & RADEON_IS_IGP) { | 1260 | if (rdev->flags & RADEON_IS_IGP) { |
@@ -1937,7 +1936,7 @@ void r600_pciep_wreg(struct radeon_device *rdev, u32 reg, u32 v) | |||
1937 | */ | 1936 | */ |
1938 | void r600_cp_stop(struct radeon_device *rdev) | 1937 | void r600_cp_stop(struct radeon_device *rdev) |
1939 | { | 1938 | { |
1940 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | 1939 | radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size); |
1941 | WREG32(R_0086D8_CP_ME_CNTL, S_0086D8_CP_ME_HALT(1)); | 1940 | WREG32(R_0086D8_CP_ME_CNTL, S_0086D8_CP_ME_HALT(1)); |
1942 | WREG32(SCRATCH_UMSK, 0); | 1941 | WREG32(SCRATCH_UMSK, 0); |
1943 | } | 1942 | } |
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index 41f7aafc97c4..df68d91e8190 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c | |||
@@ -558,7 +558,7 @@ done: | |||
558 | dev_err(rdev->dev, "(%d) pin blit object failed\n", r); | 558 | dev_err(rdev->dev, "(%d) pin blit object failed\n", r); |
559 | return r; | 559 | return r; |
560 | } | 560 | } |
561 | rdev->mc.active_vram_size = rdev->mc.real_vram_size; | 561 | radeon_ttm_set_active_vram_size(rdev, rdev->mc.real_vram_size); |
562 | return 0; | 562 | return 0; |
563 | } | 563 | } |
564 | 564 | ||
@@ -566,7 +566,7 @@ void r600_blit_fini(struct radeon_device *rdev) | |||
566 | { | 566 | { |
567 | int r; | 567 | int r; |
568 | 568 | ||
569 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | 569 | radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size); |
570 | if (rdev->r600_blit.shader_obj == NULL) | 570 | if (rdev->r600_blit.shader_obj == NULL) |
571 | return; | 571 | return; |
572 | /* If we can't reserve the bo, unref should be enough to destroy | 572 | /* If we can't reserve the bo, unref should be enough to destroy |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 56c48b67ef3d..6b3429495118 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -345,7 +345,6 @@ struct radeon_mc { | |||
345 | * about vram size near mc fb location */ | 345 | * about vram size near mc fb location */ |
346 | u64 mc_vram_size; | 346 | u64 mc_vram_size; |
347 | u64 visible_vram_size; | 347 | u64 visible_vram_size; |
348 | u64 active_vram_size; | ||
349 | u64 gtt_size; | 348 | u64 gtt_size; |
350 | u64 gtt_start; | 349 | u64 gtt_start; |
351 | u64 gtt_end; | 350 | u64 gtt_end; |
@@ -1448,6 +1447,7 @@ extern void radeon_vram_location(struct radeon_device *rdev, struct radeon_mc *m | |||
1448 | extern void radeon_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc); | 1447 | extern void radeon_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc); |
1449 | extern int radeon_resume_kms(struct drm_device *dev); | 1448 | extern int radeon_resume_kms(struct drm_device *dev); |
1450 | extern int radeon_suspend_kms(struct drm_device *dev, pm_message_t state); | 1449 | extern int radeon_suspend_kms(struct drm_device *dev, pm_message_t state); |
1450 | extern void radeon_ttm_set_active_vram_size(struct radeon_device *rdev, u64 size); | ||
1451 | 1451 | ||
1452 | /* r600, rv610, rv630, rv620, rv635, rv670, rs780, rs880 */ | 1452 | /* r600, rv610, rv630, rv620, rv635, rv670, rs780, rs880 */ |
1453 | extern bool r600_card_posted(struct radeon_device *rdev); | 1453 | extern bool r600_card_posted(struct radeon_device *rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c index e75d63b8e21d..793c5e6026ad 100644 --- a/drivers/gpu/drm/radeon/radeon_asic.c +++ b/drivers/gpu/drm/radeon/radeon_asic.c | |||
@@ -834,6 +834,9 @@ static struct radeon_asic sumo_asic = { | |||
834 | .pm_finish = &evergreen_pm_finish, | 834 | .pm_finish = &evergreen_pm_finish, |
835 | .pm_init_profile = &rs780_pm_init_profile, | 835 | .pm_init_profile = &rs780_pm_init_profile, |
836 | .pm_get_dynpm_state = &r600_pm_get_dynpm_state, | 836 | .pm_get_dynpm_state = &r600_pm_get_dynpm_state, |
837 | .pre_page_flip = &evergreen_pre_page_flip, | ||
838 | .page_flip = &evergreen_page_flip, | ||
839 | .post_page_flip = &evergreen_post_page_flip, | ||
837 | }; | 840 | }; |
838 | 841 | ||
839 | static struct radeon_asic btc_asic = { | 842 | static struct radeon_asic btc_asic = { |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 0e657095de7c..3e7e7f9eb781 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -971,7 +971,7 @@ void radeon_compute_pll_legacy(struct radeon_pll *pll, | |||
971 | max_fractional_feed_div = pll->max_frac_feedback_div; | 971 | max_fractional_feed_div = pll->max_frac_feedback_div; |
972 | } | 972 | } |
973 | 973 | ||
974 | for (post_div = min_post_div; post_div <= max_post_div; ++post_div) { | 974 | for (post_div = max_post_div; post_div >= min_post_div; --post_div) { |
975 | uint32_t ref_div; | 975 | uint32_t ref_div; |
976 | 976 | ||
977 | if ((pll->flags & RADEON_PLL_NO_ODD_POST_DIV) && (post_div & 1)) | 977 | if ((pll->flags & RADEON_PLL_NO_ODD_POST_DIV) && (post_div & 1)) |
diff --git a/drivers/gpu/drm/radeon/radeon_fb.c b/drivers/gpu/drm/radeon/radeon_fb.c index 66324b5bb5ba..cc44bdfec80f 100644 --- a/drivers/gpu/drm/radeon/radeon_fb.c +++ b/drivers/gpu/drm/radeon/radeon_fb.c | |||
@@ -113,11 +113,14 @@ static int radeonfb_create_pinned_object(struct radeon_fbdev *rfbdev, | |||
113 | u32 tiling_flags = 0; | 113 | u32 tiling_flags = 0; |
114 | int ret; | 114 | int ret; |
115 | int aligned_size, size; | 115 | int aligned_size, size; |
116 | int height = mode_cmd->height; | ||
116 | 117 | ||
117 | /* need to align pitch with crtc limits */ | 118 | /* need to align pitch with crtc limits */ |
118 | mode_cmd->pitch = radeon_align_pitch(rdev, mode_cmd->width, mode_cmd->bpp, fb_tiled) * ((mode_cmd->bpp + 1) / 8); | 119 | mode_cmd->pitch = radeon_align_pitch(rdev, mode_cmd->width, mode_cmd->bpp, fb_tiled) * ((mode_cmd->bpp + 1) / 8); |
119 | 120 | ||
120 | size = mode_cmd->pitch * mode_cmd->height; | 121 | if (rdev->family >= CHIP_R600) |
122 | height = ALIGN(mode_cmd->height, 8); | ||
123 | size = mode_cmd->pitch * height; | ||
121 | aligned_size = ALIGN(size, PAGE_SIZE); | 124 | aligned_size = ALIGN(size, PAGE_SIZE); |
122 | ret = radeon_gem_object_create(rdev, aligned_size, 0, | 125 | ret = radeon_gem_object_create(rdev, aligned_size, 0, |
123 | RADEON_GEM_DOMAIN_VRAM, | 126 | RADEON_GEM_DOMAIN_VRAM, |
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index df95eb83dac6..1fe95dfe48c9 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c | |||
@@ -156,9 +156,12 @@ int radeon_gem_info_ioctl(struct drm_device *dev, void *data, | |||
156 | { | 156 | { |
157 | struct radeon_device *rdev = dev->dev_private; | 157 | struct radeon_device *rdev = dev->dev_private; |
158 | struct drm_radeon_gem_info *args = data; | 158 | struct drm_radeon_gem_info *args = data; |
159 | struct ttm_mem_type_manager *man; | ||
160 | |||
161 | man = &rdev->mman.bdev.man[TTM_PL_VRAM]; | ||
159 | 162 | ||
160 | args->vram_size = rdev->mc.real_vram_size; | 163 | args->vram_size = rdev->mc.real_vram_size; |
161 | args->vram_visible = rdev->mc.real_vram_size; | 164 | args->vram_visible = (u64)man->size << PAGE_SHIFT; |
162 | if (rdev->stollen_vga_memory) | 165 | if (rdev->stollen_vga_memory) |
163 | args->vram_visible -= radeon_bo_size(rdev->stollen_vga_memory); | 166 | args->vram_visible -= radeon_bo_size(rdev->stollen_vga_memory); |
164 | args->vram_visible -= radeon_fbdev_total_size(rdev); | 167 | args->vram_visible -= radeon_fbdev_total_size(rdev); |
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c index cf0638c3b7c7..78968b738e88 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c | |||
@@ -443,7 +443,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, | |||
443 | (target_fb->bits_per_pixel * 8)); | 443 | (target_fb->bits_per_pixel * 8)); |
444 | crtc_pitch |= crtc_pitch << 16; | 444 | crtc_pitch |= crtc_pitch << 16; |
445 | 445 | ||
446 | 446 | crtc_offset_cntl |= RADEON_CRTC_GUI_TRIG_OFFSET_LEFT_EN; | |
447 | if (tiling_flags & RADEON_TILING_MACRO) { | 447 | if (tiling_flags & RADEON_TILING_MACRO) { |
448 | if (ASIC_IS_R300(rdev)) | 448 | if (ASIC_IS_R300(rdev)) |
449 | crtc_offset_cntl |= (R300_CRTC_X_Y_MODE_EN | | 449 | crtc_offset_cntl |= (R300_CRTC_X_Y_MODE_EN | |
@@ -502,6 +502,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc, | |||
502 | gen_cntl_val = RREG32(gen_cntl_reg); | 502 | gen_cntl_val = RREG32(gen_cntl_reg); |
503 | gen_cntl_val &= ~(0xf << 8); | 503 | gen_cntl_val &= ~(0xf << 8); |
504 | gen_cntl_val |= (format << 8); | 504 | gen_cntl_val |= (format << 8); |
505 | gen_cntl_val &= ~RADEON_CRTC_VSTAT_MODE_MASK; | ||
505 | WREG32(gen_cntl_reg, gen_cntl_val); | 506 | WREG32(gen_cntl_reg, gen_cntl_val); |
506 | 507 | ||
507 | crtc_offset = (u32)base; | 508 | crtc_offset = (u32)base; |
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c index e5b2cf10cbf4..8389b4c63d12 100644 --- a/drivers/gpu/drm/radeon/radeon_ttm.c +++ b/drivers/gpu/drm/radeon/radeon_ttm.c | |||
@@ -589,6 +589,20 @@ void radeon_ttm_fini(struct radeon_device *rdev) | |||
589 | DRM_INFO("radeon: ttm finalized\n"); | 589 | DRM_INFO("radeon: ttm finalized\n"); |
590 | } | 590 | } |
591 | 591 | ||
592 | /* this should only be called at bootup or when userspace | ||
593 | * isn't running */ | ||
594 | void radeon_ttm_set_active_vram_size(struct radeon_device *rdev, u64 size) | ||
595 | { | ||
596 | struct ttm_mem_type_manager *man; | ||
597 | |||
598 | if (!rdev->mman.initialized) | ||
599 | return; | ||
600 | |||
601 | man = &rdev->mman.bdev.man[TTM_PL_VRAM]; | ||
602 | /* this just adjusts TTM size idea, which sets lpfn to the correct value */ | ||
603 | man->size = size >> PAGE_SHIFT; | ||
604 | } | ||
605 | |||
592 | static struct vm_operations_struct radeon_ttm_vm_ops; | 606 | static struct vm_operations_struct radeon_ttm_vm_ops; |
593 | static const struct vm_operations_struct *ttm_vm_ops = NULL; | 607 | static const struct vm_operations_struct *ttm_vm_ops = NULL; |
594 | 608 | ||
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c index 5afe294ed51f..8af4679db23e 100644 --- a/drivers/gpu/drm/radeon/rs600.c +++ b/drivers/gpu/drm/radeon/rs600.c | |||
@@ -751,7 +751,6 @@ void rs600_mc_init(struct radeon_device *rdev) | |||
751 | rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE); | 751 | rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE); |
752 | rdev->mc.mc_vram_size = rdev->mc.real_vram_size; | 752 | rdev->mc.mc_vram_size = rdev->mc.real_vram_size; |
753 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 753 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
754 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
755 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | 754 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); |
756 | base = RREG32_MC(R_000004_MC_FB_LOCATION); | 755 | base = RREG32_MC(R_000004_MC_FB_LOCATION); |
757 | base = G_000004_MC_FB_START(base) << 16; | 756 | base = G_000004_MC_FB_START(base) << 16; |
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c index 6638c8e4c81b..66c949b7c18c 100644 --- a/drivers/gpu/drm/radeon/rs690.c +++ b/drivers/gpu/drm/radeon/rs690.c | |||
@@ -157,7 +157,6 @@ void rs690_mc_init(struct radeon_device *rdev) | |||
157 | rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); | 157 | rdev->mc.aper_base = pci_resource_start(rdev->pdev, 0); |
158 | rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); | 158 | rdev->mc.aper_size = pci_resource_len(rdev->pdev, 0); |
159 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 159 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
160 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
161 | base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); | 160 | base = RREG32_MC(R_000100_MCCFG_FB_LOCATION); |
162 | base = G_000100_MC_FB_START(base) << 16; | 161 | base = G_000100_MC_FB_START(base) << 16; |
163 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); | 162 | rdev->mc.igp_sideport_enabled = radeon_atombios_sideport_present(rdev); |
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index d8ba67690656..714ad45757d0 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c | |||
@@ -307,7 +307,7 @@ static void rv770_mc_program(struct radeon_device *rdev) | |||
307 | */ | 307 | */ |
308 | void r700_cp_stop(struct radeon_device *rdev) | 308 | void r700_cp_stop(struct radeon_device *rdev) |
309 | { | 309 | { |
310 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | 310 | radeon_ttm_set_active_vram_size(rdev, rdev->mc.visible_vram_size); |
311 | WREG32(CP_ME_CNTL, (CP_ME_HALT | CP_PFP_HALT)); | 311 | WREG32(CP_ME_CNTL, (CP_ME_HALT | CP_PFP_HALT)); |
312 | WREG32(SCRATCH_UMSK, 0); | 312 | WREG32(SCRATCH_UMSK, 0); |
313 | } | 313 | } |
@@ -1123,7 +1123,6 @@ int rv770_mc_init(struct radeon_device *rdev) | |||
1123 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); | 1123 | rdev->mc.mc_vram_size = RREG32(CONFIG_MEMSIZE); |
1124 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); | 1124 | rdev->mc.real_vram_size = RREG32(CONFIG_MEMSIZE); |
1125 | rdev->mc.visible_vram_size = rdev->mc.aper_size; | 1125 | rdev->mc.visible_vram_size = rdev->mc.aper_size; |
1126 | rdev->mc.active_vram_size = rdev->mc.visible_vram_size; | ||
1127 | r700_vram_gtt_location(rdev, &rdev->mc); | 1126 | r700_vram_gtt_location(rdev, &rdev->mc); |
1128 | radeon_update_bandwidth_info(rdev); | 1127 | radeon_update_bandwidth_info(rdev); |
1129 | 1128 | ||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 773e484f1646..297bc9a7d6e6 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -238,13 +238,13 @@ config SENSORS_K8TEMP | |||
238 | will be called k8temp. | 238 | will be called k8temp. |
239 | 239 | ||
240 | config SENSORS_K10TEMP | 240 | config SENSORS_K10TEMP |
241 | tristate "AMD Phenom/Sempron/Turion/Opteron temperature sensor" | 241 | tristate "AMD Family 10h/11h/12h/14h temperature sensor" |
242 | depends on X86 && PCI | 242 | depends on X86 && PCI |
243 | help | 243 | help |
244 | If you say yes here you get support for the temperature | 244 | If you say yes here you get support for the temperature |
245 | sensor(s) inside your CPU. Supported are later revisions of | 245 | sensor(s) inside your CPU. Supported are later revisions of |
246 | the AMD Family 10h and all revisions of the AMD Family 11h | 246 | the AMD Family 10h and all revisions of the AMD Family 11h, |
247 | microarchitectures. | 247 | 12h (Llano), and 14h (Brazos) microarchitectures. |
248 | 248 | ||
249 | This driver can also be built as a module. If so, the module | 249 | This driver can also be built as a module. If so, the module |
250 | will be called k10temp. | 250 | will be called k10temp. |
@@ -455,13 +455,14 @@ config SENSORS_JZ4740 | |||
455 | called jz4740-hwmon. | 455 | called jz4740-hwmon. |
456 | 456 | ||
457 | config SENSORS_JC42 | 457 | config SENSORS_JC42 |
458 | tristate "JEDEC JC42.4 compliant temperature sensors" | 458 | tristate "JEDEC JC42.4 compliant memory module temperature sensors" |
459 | depends on I2C | 459 | depends on I2C |
460 | help | 460 | help |
461 | If you say yes here you get support for Jedec JC42.4 compliant | 461 | If you say yes here, you get support for JEDEC JC42.4 compliant |
462 | temperature sensors. Support will include, but not be limited to, | 462 | temperature sensors, which are used on many DDR3 memory modules for |
463 | ADT7408, CAT34TS02,, CAT6095, MAX6604, MCP9805, MCP98242, MCP98243, | 463 | mobile devices and servers. Support will include, but not be limited |
464 | MCP9843, SE97, SE98, STTS424, TSE2002B3, and TS3000B3. | 464 | to, ADT7408, CAT34TS02, CAT6095, MAX6604, MCP9805, MCP98242, MCP98243, |
465 | MCP9843, SE97, SE98, STTS424(E), TSE2002B3, and TS3000B3. | ||
465 | 466 | ||
466 | This driver can also be built as a module. If so, the module | 467 | This driver can also be built as a module. If so, the module |
467 | will be called jc42. | 468 | will be called jc42. |
@@ -574,7 +575,7 @@ config SENSORS_LM85 | |||
574 | help | 575 | help |
575 | If you say yes here you get support for National Semiconductor LM85 | 576 | If you say yes here you get support for National Semiconductor LM85 |
576 | sensor chips and clones: ADM1027, ADT7463, ADT7468, EMC6D100, | 577 | sensor chips and clones: ADM1027, ADT7463, ADT7468, EMC6D100, |
577 | EMC6D101 and EMC6D102. | 578 | EMC6D101, EMC6D102, and EMC6D103. |
578 | 579 | ||
579 | This driver can also be built as a module. If so, the module | 580 | This driver can also be built as a module. If so, the module |
580 | will be called lm85. | 581 | will be called lm85. |
diff --git a/drivers/hwmon/ad7414.c b/drivers/hwmon/ad7414.c index 86d822aa9bbf..d46c0c758ddf 100644 --- a/drivers/hwmon/ad7414.c +++ b/drivers/hwmon/ad7414.c | |||
@@ -242,6 +242,7 @@ static const struct i2c_device_id ad7414_id[] = { | |||
242 | { "ad7414", 0 }, | 242 | { "ad7414", 0 }, |
243 | {} | 243 | {} |
244 | }; | 244 | }; |
245 | MODULE_DEVICE_TABLE(i2c, ad7414_id); | ||
245 | 246 | ||
246 | static struct i2c_driver ad7414_driver = { | 247 | static struct i2c_driver ad7414_driver = { |
247 | .driver = { | 248 | .driver = { |
diff --git a/drivers/hwmon/adt7411.c b/drivers/hwmon/adt7411.c index f13c843a2964..5cc3e3784b42 100644 --- a/drivers/hwmon/adt7411.c +++ b/drivers/hwmon/adt7411.c | |||
@@ -334,6 +334,7 @@ static const struct i2c_device_id adt7411_id[] = { | |||
334 | { "adt7411", 0 }, | 334 | { "adt7411", 0 }, |
335 | { } | 335 | { } |
336 | }; | 336 | }; |
337 | MODULE_DEVICE_TABLE(i2c, adt7411_id); | ||
337 | 338 | ||
338 | static struct i2c_driver adt7411_driver = { | 339 | static struct i2c_driver adt7411_driver = { |
339 | .driver = { | 340 | .driver = { |
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index 3f49dd376f02..6e06019015a5 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #define SIO_F71858FG_LD_HWM 0x02 /* Hardware monitor logical device */ | 37 | #define SIO_F71858FG_LD_HWM 0x02 /* Hardware monitor logical device */ |
38 | #define SIO_F71882FG_LD_HWM 0x04 /* Hardware monitor logical device */ | 38 | #define SIO_F71882FG_LD_HWM 0x04 /* Hardware monitor logical device */ |
39 | #define SIO_UNLOCK_KEY 0x87 /* Key to enable Super-I/O */ | 39 | #define SIO_UNLOCK_KEY 0x87 /* Key to enable Super-I/O */ |
40 | #define SIO_LOCK_KEY 0xAA /* Key to diasble Super-I/O */ | 40 | #define SIO_LOCK_KEY 0xAA /* Key to disable Super-I/O */ |
41 | 41 | ||
42 | #define SIO_REG_LDSEL 0x07 /* Logical device select */ | 42 | #define SIO_REG_LDSEL 0x07 /* Logical device select */ |
43 | #define SIO_REG_DEVID 0x20 /* Device ID (2 bytes) */ | 43 | #define SIO_REG_DEVID 0x20 /* Device ID (2 bytes) */ |
@@ -2111,7 +2111,6 @@ static int f71882fg_remove(struct platform_device *pdev) | |||
2111 | int nr_fans = (data->type == f71882fg) ? 4 : 3; | 2111 | int nr_fans = (data->type == f71882fg) ? 4 : 3; |
2112 | u8 start_reg = f71882fg_read8(data, F71882FG_REG_START); | 2112 | u8 start_reg = f71882fg_read8(data, F71882FG_REG_START); |
2113 | 2113 | ||
2114 | platform_set_drvdata(pdev, NULL); | ||
2115 | if (data->hwmon_dev) | 2114 | if (data->hwmon_dev) |
2116 | hwmon_device_unregister(data->hwmon_dev); | 2115 | hwmon_device_unregister(data->hwmon_dev); |
2117 | 2116 | ||
@@ -2178,6 +2177,7 @@ static int f71882fg_remove(struct platform_device *pdev) | |||
2178 | } | 2177 | } |
2179 | } | 2178 | } |
2180 | 2179 | ||
2180 | platform_set_drvdata(pdev, NULL); | ||
2181 | kfree(data); | 2181 | kfree(data); |
2182 | 2182 | ||
2183 | return 0; | 2183 | return 0; |
diff --git a/drivers/hwmon/jc42.c b/drivers/hwmon/jc42.c index 340fc78c8dde..934991237061 100644 --- a/drivers/hwmon/jc42.c +++ b/drivers/hwmon/jc42.c | |||
@@ -53,6 +53,8 @@ static const unsigned short normal_i2c[] = { | |||
53 | 53 | ||
54 | /* Configuration register defines */ | 54 | /* Configuration register defines */ |
55 | #define JC42_CFG_CRIT_ONLY (1 << 2) | 55 | #define JC42_CFG_CRIT_ONLY (1 << 2) |
56 | #define JC42_CFG_TCRIT_LOCK (1 << 6) | ||
57 | #define JC42_CFG_EVENT_LOCK (1 << 7) | ||
56 | #define JC42_CFG_SHUTDOWN (1 << 8) | 58 | #define JC42_CFG_SHUTDOWN (1 << 8) |
57 | #define JC42_CFG_HYST_SHIFT 9 | 59 | #define JC42_CFG_HYST_SHIFT 9 |
58 | #define JC42_CFG_HYST_MASK 0x03 | 60 | #define JC42_CFG_HYST_MASK 0x03 |
@@ -332,7 +334,7 @@ static ssize_t set_temp_crit_hyst(struct device *dev, | |||
332 | { | 334 | { |
333 | struct i2c_client *client = to_i2c_client(dev); | 335 | struct i2c_client *client = to_i2c_client(dev); |
334 | struct jc42_data *data = i2c_get_clientdata(client); | 336 | struct jc42_data *data = i2c_get_clientdata(client); |
335 | long val; | 337 | unsigned long val; |
336 | int diff, hyst; | 338 | int diff, hyst; |
337 | int err; | 339 | int err; |
338 | int ret = count; | 340 | int ret = count; |
@@ -380,14 +382,14 @@ static ssize_t show_alarm(struct device *dev, | |||
380 | 382 | ||
381 | static DEVICE_ATTR(temp1_input, S_IRUGO, | 383 | static DEVICE_ATTR(temp1_input, S_IRUGO, |
382 | show_temp_input, NULL); | 384 | show_temp_input, NULL); |
383 | static DEVICE_ATTR(temp1_crit, S_IWUSR | S_IRUGO, | 385 | static DEVICE_ATTR(temp1_crit, S_IRUGO, |
384 | show_temp_crit, set_temp_crit); | 386 | show_temp_crit, set_temp_crit); |
385 | static DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, | 387 | static DEVICE_ATTR(temp1_min, S_IRUGO, |
386 | show_temp_min, set_temp_min); | 388 | show_temp_min, set_temp_min); |
387 | static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, | 389 | static DEVICE_ATTR(temp1_max, S_IRUGO, |
388 | show_temp_max, set_temp_max); | 390 | show_temp_max, set_temp_max); |
389 | 391 | ||
390 | static DEVICE_ATTR(temp1_crit_hyst, S_IWUSR | S_IRUGO, | 392 | static DEVICE_ATTR(temp1_crit_hyst, S_IRUGO, |
391 | show_temp_crit_hyst, set_temp_crit_hyst); | 393 | show_temp_crit_hyst, set_temp_crit_hyst); |
392 | static DEVICE_ATTR(temp1_max_hyst, S_IRUGO, | 394 | static DEVICE_ATTR(temp1_max_hyst, S_IRUGO, |
393 | show_temp_max_hyst, NULL); | 395 | show_temp_max_hyst, NULL); |
@@ -412,8 +414,31 @@ static struct attribute *jc42_attributes[] = { | |||
412 | NULL | 414 | NULL |
413 | }; | 415 | }; |
414 | 416 | ||
417 | static mode_t jc42_attribute_mode(struct kobject *kobj, | ||
418 | struct attribute *attr, int index) | ||
419 | { | ||
420 | struct device *dev = container_of(kobj, struct device, kobj); | ||
421 | struct i2c_client *client = to_i2c_client(dev); | ||
422 | struct jc42_data *data = i2c_get_clientdata(client); | ||
423 | unsigned int config = data->config; | ||
424 | bool readonly; | ||
425 | |||
426 | if (attr == &dev_attr_temp1_crit.attr) | ||
427 | readonly = config & JC42_CFG_TCRIT_LOCK; | ||
428 | else if (attr == &dev_attr_temp1_min.attr || | ||
429 | attr == &dev_attr_temp1_max.attr) | ||
430 | readonly = config & JC42_CFG_EVENT_LOCK; | ||
431 | else if (attr == &dev_attr_temp1_crit_hyst.attr) | ||
432 | readonly = config & (JC42_CFG_EVENT_LOCK | JC42_CFG_TCRIT_LOCK); | ||
433 | else | ||
434 | readonly = true; | ||
435 | |||
436 | return S_IRUGO | (readonly ? 0 : S_IWUSR); | ||
437 | } | ||
438 | |||
415 | static const struct attribute_group jc42_group = { | 439 | static const struct attribute_group jc42_group = { |
416 | .attrs = jc42_attributes, | 440 | .attrs = jc42_attributes, |
441 | .is_visible = jc42_attribute_mode, | ||
417 | }; | 442 | }; |
418 | 443 | ||
419 | /* Return 0 if detection is successful, -ENODEV otherwise */ | 444 | /* Return 0 if detection is successful, -ENODEV otherwise */ |
diff --git a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c index da5a2404cd3e..82bf65aa2968 100644 --- a/drivers/hwmon/k10temp.c +++ b/drivers/hwmon/k10temp.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * k10temp.c - AMD Family 10h/11h processor hardware monitoring | 2 | * k10temp.c - AMD Family 10h/11h/12h/14h processor hardware monitoring |
3 | * | 3 | * |
4 | * Copyright (c) 2009 Clemens Ladisch <clemens@ladisch.de> | 4 | * Copyright (c) 2009 Clemens Ladisch <clemens@ladisch.de> |
5 | * | 5 | * |
@@ -25,7 +25,7 @@ | |||
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <asm/processor.h> | 26 | #include <asm/processor.h> |
27 | 27 | ||
28 | MODULE_DESCRIPTION("AMD Family 10h/11h CPU core temperature monitor"); | 28 | MODULE_DESCRIPTION("AMD Family 10h/11h/12h/14h CPU core temperature monitor"); |
29 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); | 29 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); |
30 | MODULE_LICENSE("GPL"); | 30 | MODULE_LICENSE("GPL"); |
31 | 31 | ||
@@ -208,6 +208,7 @@ static void __devexit k10temp_remove(struct pci_dev *pdev) | |||
208 | static const struct pci_device_id k10temp_id_table[] = { | 208 | static const struct pci_device_id k10temp_id_table[] = { |
209 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) }, | 209 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_10H_NB_MISC) }, |
210 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) }, | 210 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_11H_NB_MISC) }, |
211 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CNB17H_F3) }, | ||
211 | {} | 212 | {} |
212 | }; | 213 | }; |
213 | MODULE_DEVICE_TABLE(pci, k10temp_id_table); | 214 | MODULE_DEVICE_TABLE(pci, k10temp_id_table); |
diff --git a/drivers/hwmon/lm85.c b/drivers/hwmon/lm85.c index 1e229847f37a..d2cc28660816 100644 --- a/drivers/hwmon/lm85.c +++ b/drivers/hwmon/lm85.c | |||
@@ -41,7 +41,7 @@ static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; | |||
41 | enum chips { | 41 | enum chips { |
42 | any_chip, lm85b, lm85c, | 42 | any_chip, lm85b, lm85c, |
43 | adm1027, adt7463, adt7468, | 43 | adm1027, adt7463, adt7468, |
44 | emc6d100, emc6d102 | 44 | emc6d100, emc6d102, emc6d103 |
45 | }; | 45 | }; |
46 | 46 | ||
47 | /* The LM85 registers */ | 47 | /* The LM85 registers */ |
@@ -90,6 +90,9 @@ enum chips { | |||
90 | #define LM85_VERSTEP_EMC6D100_A0 0x60 | 90 | #define LM85_VERSTEP_EMC6D100_A0 0x60 |
91 | #define LM85_VERSTEP_EMC6D100_A1 0x61 | 91 | #define LM85_VERSTEP_EMC6D100_A1 0x61 |
92 | #define LM85_VERSTEP_EMC6D102 0x65 | 92 | #define LM85_VERSTEP_EMC6D102 0x65 |
93 | #define LM85_VERSTEP_EMC6D103_A0 0x68 | ||
94 | #define LM85_VERSTEP_EMC6D103_A1 0x69 | ||
95 | #define LM85_VERSTEP_EMC6D103S 0x6A /* Also known as EMC6D103:A2 */ | ||
93 | 96 | ||
94 | #define LM85_REG_CONFIG 0x40 | 97 | #define LM85_REG_CONFIG 0x40 |
95 | 98 | ||
@@ -348,6 +351,7 @@ static const struct i2c_device_id lm85_id[] = { | |||
348 | { "emc6d100", emc6d100 }, | 351 | { "emc6d100", emc6d100 }, |
349 | { "emc6d101", emc6d100 }, | 352 | { "emc6d101", emc6d100 }, |
350 | { "emc6d102", emc6d102 }, | 353 | { "emc6d102", emc6d102 }, |
354 | { "emc6d103", emc6d103 }, | ||
351 | { } | 355 | { } |
352 | }; | 356 | }; |
353 | MODULE_DEVICE_TABLE(i2c, lm85_id); | 357 | MODULE_DEVICE_TABLE(i2c, lm85_id); |
@@ -1250,6 +1254,20 @@ static int lm85_detect(struct i2c_client *client, struct i2c_board_info *info) | |||
1250 | case LM85_VERSTEP_EMC6D102: | 1254 | case LM85_VERSTEP_EMC6D102: |
1251 | type_name = "emc6d102"; | 1255 | type_name = "emc6d102"; |
1252 | break; | 1256 | break; |
1257 | case LM85_VERSTEP_EMC6D103_A0: | ||
1258 | case LM85_VERSTEP_EMC6D103_A1: | ||
1259 | type_name = "emc6d103"; | ||
1260 | break; | ||
1261 | /* | ||
1262 | * Registers apparently missing in EMC6D103S/EMC6D103:A2 | ||
1263 | * compared to EMC6D103:A0, EMC6D103:A1, and EMC6D102 | ||
1264 | * (according to the data sheets), but used unconditionally | ||
1265 | * in the driver: 62[5:7], 6D[0:7], and 6E[0:7]. | ||
1266 | * So skip EMC6D103S for now. | ||
1267 | case LM85_VERSTEP_EMC6D103S: | ||
1268 | type_name = "emc6d103s"; | ||
1269 | break; | ||
1270 | */ | ||
1253 | } | 1271 | } |
1254 | } else { | 1272 | } else { |
1255 | dev_dbg(&adapter->dev, | 1273 | dev_dbg(&adapter->dev, |
@@ -1283,6 +1301,7 @@ static int lm85_probe(struct i2c_client *client, | |||
1283 | case adt7468: | 1301 | case adt7468: |
1284 | case emc6d100: | 1302 | case emc6d100: |
1285 | case emc6d102: | 1303 | case emc6d102: |
1304 | case emc6d103: | ||
1286 | data->freq_map = adm1027_freq_map; | 1305 | data->freq_map = adm1027_freq_map; |
1287 | break; | 1306 | break; |
1288 | default: | 1307 | default: |
@@ -1468,7 +1487,7 @@ static struct lm85_data *lm85_update_device(struct device *dev) | |||
1468 | /* More alarm bits */ | 1487 | /* More alarm bits */ |
1469 | data->alarms |= lm85_read_value(client, | 1488 | data->alarms |= lm85_read_value(client, |
1470 | EMC6D100_REG_ALARM3) << 16; | 1489 | EMC6D100_REG_ALARM3) << 16; |
1471 | } else if (data->type == emc6d102) { | 1490 | } else if (data->type == emc6d102 || data->type == emc6d103) { |
1472 | /* Have to read LSB bits after the MSB ones because | 1491 | /* Have to read LSB bits after the MSB ones because |
1473 | the reading of the MSB bits has frozen the | 1492 | the reading of the MSB bits has frozen the |
1474 | LSBs (backward from the ADM1027). | 1493 | LSBs (backward from the ADM1027). |
diff --git a/drivers/i2c/busses/i2c-eg20t.c b/drivers/i2c/busses/i2c-eg20t.c index 2e067dd2ee51..50ea1f43bdc1 100644 --- a/drivers/i2c/busses/i2c-eg20t.c +++ b/drivers/i2c/busses/i2c-eg20t.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/pci.h> | 29 | #include <linux/pci.h> |
30 | #include <linux/mutex.h> | 30 | #include <linux/mutex.h> |
31 | #include <linux/ktime.h> | 31 | #include <linux/ktime.h> |
32 | #include <linux/slab.h> | ||
32 | 33 | ||
33 | #define PCH_EVENT_SET 0 /* I2C Interrupt Event Set Status */ | 34 | #define PCH_EVENT_SET 0 /* I2C Interrupt Event Set Status */ |
34 | #define PCH_EVENT_NONE 1 /* I2C Interrupt Event Clear Status */ | 35 | #define PCH_EVENT_NONE 1 /* I2C Interrupt Event Clear Status */ |
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c index ef3bcb1ce864..61653f079671 100644 --- a/drivers/i2c/busses/i2c-ocores.c +++ b/drivers/i2c/busses/i2c-ocores.c | |||
@@ -249,7 +249,7 @@ static struct i2c_adapter ocores_adapter = { | |||
249 | static int ocores_i2c_of_probe(struct platform_device* pdev, | 249 | static int ocores_i2c_of_probe(struct platform_device* pdev, |
250 | struct ocores_i2c* i2c) | 250 | struct ocores_i2c* i2c) |
251 | { | 251 | { |
252 | __be32* val; | 252 | const __be32* val; |
253 | 253 | ||
254 | val = of_get_property(pdev->dev.of_node, "regstep", NULL); | 254 | val = of_get_property(pdev->dev.of_node, "regstep", NULL); |
255 | if (!val) { | 255 | if (!val) { |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index b605ff3a1fa0..58a58c7eaa17 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -378,9 +378,7 @@ static int omap_i2c_init(struct omap_i2c_dev *dev) | |||
378 | * REVISIT: Some wkup sources might not be needed. | 378 | * REVISIT: Some wkup sources might not be needed. |
379 | */ | 379 | */ |
380 | dev->westate = OMAP_I2C_WE_ALL; | 380 | dev->westate = OMAP_I2C_WE_ALL; |
381 | if (dev->rev < OMAP_I2C_REV_ON_4430) | 381 | omap_i2c_write_reg(dev, OMAP_I2C_WE_REG, dev->westate); |
382 | omap_i2c_write_reg(dev, OMAP_I2C_WE_REG, | ||
383 | dev->westate); | ||
384 | } | 382 | } |
385 | } | 383 | } |
386 | omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); | 384 | omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); |
@@ -847,11 +845,15 @@ complete: | |||
847 | dev_err(dev->dev, "Arbitration lost\n"); | 845 | dev_err(dev->dev, "Arbitration lost\n"); |
848 | err |= OMAP_I2C_STAT_AL; | 846 | err |= OMAP_I2C_STAT_AL; |
849 | } | 847 | } |
848 | /* | ||
849 | * ProDB0017052: Clear ARDY bit twice | ||
850 | */ | ||
850 | if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK | | 851 | if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK | |
851 | OMAP_I2C_STAT_AL)) { | 852 | OMAP_I2C_STAT_AL)) { |
852 | omap_i2c_ack_stat(dev, stat & | 853 | omap_i2c_ack_stat(dev, stat & |
853 | (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR | | 854 | (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR | |
854 | OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)); | 855 | OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR | |
856 | OMAP_I2C_STAT_ARDY)); | ||
855 | omap_i2c_complete_cmd(dev, err); | 857 | omap_i2c_complete_cmd(dev, err); |
856 | return IRQ_HANDLED; | 858 | return IRQ_HANDLED; |
857 | } | 859 | } |
@@ -1137,12 +1139,41 @@ omap_i2c_remove(struct platform_device *pdev) | |||
1137 | return 0; | 1139 | return 0; |
1138 | } | 1140 | } |
1139 | 1141 | ||
1142 | #ifdef CONFIG_SUSPEND | ||
1143 | static int omap_i2c_suspend(struct device *dev) | ||
1144 | { | ||
1145 | if (!pm_runtime_suspended(dev)) | ||
1146 | if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_suspend) | ||
1147 | dev->bus->pm->runtime_suspend(dev); | ||
1148 | |||
1149 | return 0; | ||
1150 | } | ||
1151 | |||
1152 | static int omap_i2c_resume(struct device *dev) | ||
1153 | { | ||
1154 | if (!pm_runtime_suspended(dev)) | ||
1155 | if (dev->bus && dev->bus->pm && dev->bus->pm->runtime_resume) | ||
1156 | dev->bus->pm->runtime_resume(dev); | ||
1157 | |||
1158 | return 0; | ||
1159 | } | ||
1160 | |||
1161 | static struct dev_pm_ops omap_i2c_pm_ops = { | ||
1162 | .suspend = omap_i2c_suspend, | ||
1163 | .resume = omap_i2c_resume, | ||
1164 | }; | ||
1165 | #define OMAP_I2C_PM_OPS (&omap_i2c_pm_ops) | ||
1166 | #else | ||
1167 | #define OMAP_I2C_PM_OPS NULL | ||
1168 | #endif | ||
1169 | |||
1140 | static struct platform_driver omap_i2c_driver = { | 1170 | static struct platform_driver omap_i2c_driver = { |
1141 | .probe = omap_i2c_probe, | 1171 | .probe = omap_i2c_probe, |
1142 | .remove = omap_i2c_remove, | 1172 | .remove = omap_i2c_remove, |
1143 | .driver = { | 1173 | .driver = { |
1144 | .name = "omap_i2c", | 1174 | .name = "omap_i2c", |
1145 | .owner = THIS_MODULE, | 1175 | .owner = THIS_MODULE, |
1176 | .pm = OMAP_I2C_PM_OPS, | ||
1146 | }, | 1177 | }, |
1147 | }; | 1178 | }; |
1148 | 1179 | ||
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c index 495be451d326..266135ddf7fa 100644 --- a/drivers/i2c/busses/i2c-stu300.c +++ b/drivers/i2c/busses/i2c-stu300.c | |||
@@ -942,7 +942,7 @@ stu300_probe(struct platform_device *pdev) | |||
942 | adap->owner = THIS_MODULE; | 942 | adap->owner = THIS_MODULE; |
943 | /* DDC class but actually often used for more generic I2C */ | 943 | /* DDC class but actually often used for more generic I2C */ |
944 | adap->class = I2C_CLASS_DDC; | 944 | adap->class = I2C_CLASS_DDC; |
945 | strncpy(adap->name, "ST Microelectronics DDC I2C adapter", | 945 | strlcpy(adap->name, "ST Microelectronics DDC I2C adapter", |
946 | sizeof(adap->name)); | 946 | sizeof(adap->name)); |
947 | adap->nr = bus_nr; | 947 | adap->nr = bus_nr; |
948 | adap->algo = &stu300_algo; | 948 | adap->algo = &stu300_algo; |
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c index 1fa091e05690..4a5c4a44ffb1 100644 --- a/drivers/idle/intel_idle.c +++ b/drivers/idle/intel_idle.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include <linux/notifier.h> | 62 | #include <linux/notifier.h> |
63 | #include <linux/cpu.h> | 63 | #include <linux/cpu.h> |
64 | #include <asm/mwait.h> | 64 | #include <asm/mwait.h> |
65 | #include <asm/msr.h> | ||
65 | 66 | ||
66 | #define INTEL_IDLE_VERSION "0.4" | 67 | #define INTEL_IDLE_VERSION "0.4" |
67 | #define PREFIX "intel_idle: " | 68 | #define PREFIX "intel_idle: " |
@@ -85,6 +86,12 @@ static int intel_idle(struct cpuidle_device *dev, struct cpuidle_state *state); | |||
85 | static struct cpuidle_state *cpuidle_state_table; | 86 | static struct cpuidle_state *cpuidle_state_table; |
86 | 87 | ||
87 | /* | 88 | /* |
89 | * Hardware C-state auto-demotion may not always be optimal. | ||
90 | * Indicate which enable bits to clear here. | ||
91 | */ | ||
92 | static unsigned long long auto_demotion_disable_flags; | ||
93 | |||
94 | /* | ||
88 | * Set this flag for states where the HW flushes the TLB for us | 95 | * Set this flag for states where the HW flushes the TLB for us |
89 | * and so we don't need cross-calls to keep it consistent. | 96 | * and so we don't need cross-calls to keep it consistent. |
90 | * If this flag is set, SW flushes the TLB, so even if the | 97 | * If this flag is set, SW flushes the TLB, so even if the |
@@ -281,6 +288,15 @@ static struct notifier_block setup_broadcast_notifier = { | |||
281 | .notifier_call = setup_broadcast_cpuhp_notify, | 288 | .notifier_call = setup_broadcast_cpuhp_notify, |
282 | }; | 289 | }; |
283 | 290 | ||
291 | static void auto_demotion_disable(void *dummy) | ||
292 | { | ||
293 | unsigned long long msr_bits; | ||
294 | |||
295 | rdmsrl(MSR_NHM_SNB_PKG_CST_CFG_CTL, msr_bits); | ||
296 | msr_bits &= ~auto_demotion_disable_flags; | ||
297 | wrmsrl(MSR_NHM_SNB_PKG_CST_CFG_CTL, msr_bits); | ||
298 | } | ||
299 | |||
284 | /* | 300 | /* |
285 | * intel_idle_probe() | 301 | * intel_idle_probe() |
286 | */ | 302 | */ |
@@ -324,11 +340,17 @@ static int intel_idle_probe(void) | |||
324 | case 0x25: /* Westmere */ | 340 | case 0x25: /* Westmere */ |
325 | case 0x2C: /* Westmere */ | 341 | case 0x2C: /* Westmere */ |
326 | cpuidle_state_table = nehalem_cstates; | 342 | cpuidle_state_table = nehalem_cstates; |
343 | auto_demotion_disable_flags = | ||
344 | (NHM_C1_AUTO_DEMOTE | NHM_C3_AUTO_DEMOTE); | ||
327 | break; | 345 | break; |
328 | 346 | ||
329 | case 0x1C: /* 28 - Atom Processor */ | 347 | case 0x1C: /* 28 - Atom Processor */ |
348 | cpuidle_state_table = atom_cstates; | ||
349 | break; | ||
350 | |||
330 | case 0x26: /* 38 - Lincroft Atom Processor */ | 351 | case 0x26: /* 38 - Lincroft Atom Processor */ |
331 | cpuidle_state_table = atom_cstates; | 352 | cpuidle_state_table = atom_cstates; |
353 | auto_demotion_disable_flags = ATM_LNC_C6_AUTO_DEMOTE; | ||
332 | break; | 354 | break; |
333 | 355 | ||
334 | case 0x2A: /* SNB */ | 356 | case 0x2A: /* SNB */ |
@@ -436,6 +458,8 @@ static int intel_idle_cpuidle_devices_init(void) | |||
436 | return -EIO; | 458 | return -EIO; |
437 | } | 459 | } |
438 | } | 460 | } |
461 | if (auto_demotion_disable_flags) | ||
462 | smp_call_function(auto_demotion_disable, NULL, 1); | ||
439 | 463 | ||
440 | return 0; | 464 | return 0; |
441 | } | 465 | } |
diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c index 23cf8fc933ec..5b8f59d6c3e8 100644 --- a/drivers/input/gameport/gameport.c +++ b/drivers/input/gameport/gameport.c | |||
@@ -360,7 +360,7 @@ static int gameport_queue_event(void *object, struct module *owner, | |||
360 | event->owner = owner; | 360 | event->owner = owner; |
361 | 361 | ||
362 | list_add_tail(&event->node, &gameport_event_list); | 362 | list_add_tail(&event->node, &gameport_event_list); |
363 | schedule_work(&gameport_event_work); | 363 | queue_work(system_long_wq, &gameport_event_work); |
364 | 364 | ||
365 | out: | 365 | out: |
366 | spin_unlock_irqrestore(&gameport_event_lock, flags); | 366 | spin_unlock_irqrestore(&gameport_event_lock, flags); |
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c index ac471b77c18e..99ce9032d08c 100644 --- a/drivers/input/keyboard/tegra-kbc.c +++ b/drivers/input/keyboard/tegra-kbc.c | |||
@@ -71,8 +71,9 @@ struct tegra_kbc { | |||
71 | spinlock_t lock; | 71 | spinlock_t lock; |
72 | unsigned int repoll_dly; | 72 | unsigned int repoll_dly; |
73 | unsigned long cp_dly_jiffies; | 73 | unsigned long cp_dly_jiffies; |
74 | bool use_fn_map; | ||
74 | const struct tegra_kbc_platform_data *pdata; | 75 | const struct tegra_kbc_platform_data *pdata; |
75 | unsigned short keycode[KBC_MAX_KEY]; | 76 | unsigned short keycode[KBC_MAX_KEY * 2]; |
76 | unsigned short current_keys[KBC_MAX_KPENT]; | 77 | unsigned short current_keys[KBC_MAX_KPENT]; |
77 | unsigned int num_pressed_keys; | 78 | unsigned int num_pressed_keys; |
78 | struct timer_list timer; | 79 | struct timer_list timer; |
@@ -178,6 +179,40 @@ static const u32 tegra_kbc_default_keymap[] = { | |||
178 | KEY(15, 5, KEY_F2), | 179 | KEY(15, 5, KEY_F2), |
179 | KEY(15, 6, KEY_CAPSLOCK), | 180 | KEY(15, 6, KEY_CAPSLOCK), |
180 | KEY(15, 7, KEY_F6), | 181 | KEY(15, 7, KEY_F6), |
182 | |||
183 | /* Software Handled Function Keys */ | ||
184 | KEY(20, 0, KEY_KP7), | ||
185 | |||
186 | KEY(21, 0, KEY_KP9), | ||
187 | KEY(21, 1, KEY_KP8), | ||
188 | KEY(21, 2, KEY_KP4), | ||
189 | KEY(21, 4, KEY_KP1), | ||
190 | |||
191 | KEY(22, 1, KEY_KPSLASH), | ||
192 | KEY(22, 2, KEY_KP6), | ||
193 | KEY(22, 3, KEY_KP5), | ||
194 | KEY(22, 4, KEY_KP3), | ||
195 | KEY(22, 5, KEY_KP2), | ||
196 | KEY(22, 7, KEY_KP0), | ||
197 | |||
198 | KEY(27, 1, KEY_KPASTERISK), | ||
199 | KEY(27, 3, KEY_KPMINUS), | ||
200 | KEY(27, 4, KEY_KPPLUS), | ||
201 | KEY(27, 5, KEY_KPDOT), | ||
202 | |||
203 | KEY(28, 5, KEY_VOLUMEUP), | ||
204 | |||
205 | KEY(29, 3, KEY_HOME), | ||
206 | KEY(29, 4, KEY_END), | ||
207 | KEY(29, 5, KEY_BRIGHTNESSDOWN), | ||
208 | KEY(29, 6, KEY_VOLUMEDOWN), | ||
209 | KEY(29, 7, KEY_BRIGHTNESSUP), | ||
210 | |||
211 | KEY(30, 0, KEY_NUMLOCK), | ||
212 | KEY(30, 1, KEY_SCROLLLOCK), | ||
213 | KEY(30, 2, KEY_MUTE), | ||
214 | |||
215 | KEY(31, 4, KEY_HELP), | ||
181 | }; | 216 | }; |
182 | 217 | ||
183 | static const struct matrix_keymap_data tegra_kbc_default_keymap_data = { | 218 | static const struct matrix_keymap_data tegra_kbc_default_keymap_data = { |
@@ -224,6 +259,7 @@ static void tegra_kbc_report_keys(struct tegra_kbc *kbc) | |||
224 | unsigned int i; | 259 | unsigned int i; |
225 | unsigned int num_down = 0; | 260 | unsigned int num_down = 0; |
226 | unsigned long flags; | 261 | unsigned long flags; |
262 | bool fn_keypress = false; | ||
227 | 263 | ||
228 | spin_lock_irqsave(&kbc->lock, flags); | 264 | spin_lock_irqsave(&kbc->lock, flags); |
229 | for (i = 0; i < KBC_MAX_KPENT; i++) { | 265 | for (i = 0; i < KBC_MAX_KPENT; i++) { |
@@ -237,11 +273,28 @@ static void tegra_kbc_report_keys(struct tegra_kbc *kbc) | |||
237 | MATRIX_SCAN_CODE(row, col, KBC_ROW_SHIFT); | 273 | MATRIX_SCAN_CODE(row, col, KBC_ROW_SHIFT); |
238 | 274 | ||
239 | scancodes[num_down] = scancode; | 275 | scancodes[num_down] = scancode; |
240 | keycodes[num_down++] = kbc->keycode[scancode]; | 276 | keycodes[num_down] = kbc->keycode[scancode]; |
277 | /* If driver uses Fn map, do not report the Fn key. */ | ||
278 | if ((keycodes[num_down] == KEY_FN) && kbc->use_fn_map) | ||
279 | fn_keypress = true; | ||
280 | else | ||
281 | num_down++; | ||
241 | } | 282 | } |
242 | 283 | ||
243 | val >>= 8; | 284 | val >>= 8; |
244 | } | 285 | } |
286 | |||
287 | /* | ||
288 | * If the platform uses Fn keymaps, translate keys on a Fn keypress. | ||
289 | * Function keycodes are KBC_MAX_KEY apart from the plain keycodes. | ||
290 | */ | ||
291 | if (fn_keypress) { | ||
292 | for (i = 0; i < num_down; i++) { | ||
293 | scancodes[i] += KBC_MAX_KEY; | ||
294 | keycodes[i] = kbc->keycode[scancodes[i]]; | ||
295 | } | ||
296 | } | ||
297 | |||
245 | spin_unlock_irqrestore(&kbc->lock, flags); | 298 | spin_unlock_irqrestore(&kbc->lock, flags); |
246 | 299 | ||
247 | tegra_kbc_report_released_keys(kbc->idev, | 300 | tegra_kbc_report_released_keys(kbc->idev, |
@@ -594,8 +647,11 @@ static int __devinit tegra_kbc_probe(struct platform_device *pdev) | |||
594 | 647 | ||
595 | input_dev->keycode = kbc->keycode; | 648 | input_dev->keycode = kbc->keycode; |
596 | input_dev->keycodesize = sizeof(kbc->keycode[0]); | 649 | input_dev->keycodesize = sizeof(kbc->keycode[0]); |
597 | input_dev->keycodemax = ARRAY_SIZE(kbc->keycode); | 650 | input_dev->keycodemax = KBC_MAX_KEY; |
651 | if (pdata->use_fn_map) | ||
652 | input_dev->keycodemax *= 2; | ||
598 | 653 | ||
654 | kbc->use_fn_map = pdata->use_fn_map; | ||
599 | keymap_data = pdata->keymap_data ?: &tegra_kbc_default_keymap_data; | 655 | keymap_data = pdata->keymap_data ?: &tegra_kbc_default_keymap_data; |
600 | matrix_keypad_build_keymap(keymap_data, KBC_ROW_SHIFT, | 656 | matrix_keypad_build_keymap(keymap_data, KBC_ROW_SHIFT, |
601 | input_dev->keycode, input_dev->keybit); | 657 | input_dev->keycode, input_dev->keybit); |
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h index 25e5d042a72c..7453938bf5ef 100644 --- a/drivers/input/mouse/synaptics.h +++ b/drivers/input/mouse/synaptics.h | |||
@@ -51,6 +51,29 @@ | |||
51 | #define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) | 51 | #define SYN_EXT_CAP_REQUESTS(c) (((c) & 0x700000) >> 20) |
52 | #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) | 52 | #define SYN_CAP_MULTI_BUTTON_NO(ec) (((ec) & 0x00f000) >> 12) |
53 | #define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) | 53 | #define SYN_CAP_PRODUCT_ID(ec) (((ec) & 0xff0000) >> 16) |
54 | |||
55 | /* | ||
56 | * The following describes response for the 0x0c query. | ||
57 | * | ||
58 | * byte mask name meaning | ||
59 | * ---- ---- ------- ------------ | ||
60 | * 1 0x01 adjustable threshold capacitive button sensitivity | ||
61 | * can be adjusted | ||
62 | * 1 0x02 report max query 0x0d gives max coord reported | ||
63 | * 1 0x04 clearpad sensor is ClearPad product | ||
64 | * 1 0x08 advanced gesture not particularly meaningful | ||
65 | * 1 0x10 clickpad bit 0 1-button ClickPad | ||
66 | * 1 0x60 multifinger mode identifies firmware finger counting | ||
67 | * (not reporting!) algorithm. | ||
68 | * Not particularly meaningful | ||
69 | * 1 0x80 covered pad W clipped to 14, 15 == pad mostly covered | ||
70 | * 2 0x01 clickpad bit 1 2-button ClickPad | ||
71 | * 2 0x02 deluxe LED controls touchpad support LED commands | ||
72 | * ala multimedia control bar | ||
73 | * 2 0x04 reduced filtering firmware does less filtering on | ||
74 | * position data, driver should watch | ||
75 | * for noise. | ||
76 | */ | ||
54 | #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */ | 77 | #define SYN_CAP_CLICKPAD(ex0c) ((ex0c) & 0x100000) /* 1-button ClickPad */ |
55 | #define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */ | 78 | #define SYN_CAP_CLICKPAD2BTN(ex0c) ((ex0c) & 0x000100) /* 2-button ClickPad */ |
56 | #define SYN_CAP_MAX_DIMENSIONS(ex0c) ((ex0c) & 0x020000) | 79 | #define SYN_CAP_MAX_DIMENSIONS(ex0c) ((ex0c) & 0x020000) |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index 7c38d1fbabf2..ba70058e2be3 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -299,7 +299,7 @@ static int serio_queue_event(void *object, struct module *owner, | |||
299 | event->owner = owner; | 299 | event->owner = owner; |
300 | 300 | ||
301 | list_add_tail(&event->node, &serio_event_list); | 301 | list_add_tail(&event->node, &serio_event_list); |
302 | schedule_work(&serio_event_work); | 302 | queue_work(system_long_wq, &serio_event_work); |
303 | 303 | ||
304 | out: | 304 | out: |
305 | spin_unlock_irqrestore(&serio_event_lock, flags); | 305 | spin_unlock_irqrestore(&serio_event_lock, flags); |
diff --git a/drivers/isdn/hardware/eicon/istream.c b/drivers/isdn/hardware/eicon/istream.c index 18f8798442fa..7bd5baa547be 100644 --- a/drivers/isdn/hardware/eicon/istream.c +++ b/drivers/isdn/hardware/eicon/istream.c | |||
@@ -62,7 +62,7 @@ void diva_xdi_provide_istream_info (ADAPTER* a, | |||
62 | stream interface. | 62 | stream interface. |
63 | If synchronous service was requested, then function | 63 | If synchronous service was requested, then function |
64 | does return amount of data written to stream. | 64 | does return amount of data written to stream. |
65 | 'final' does indicate that pice of data to be written is | 65 | 'final' does indicate that piece of data to be written is |
66 | final part of frame (necessary only by structured datatransfer) | 66 | final part of frame (necessary only by structured datatransfer) |
67 | return 0 if zero lengh packet was written | 67 | return 0 if zero lengh packet was written |
68 | return -1 if stream is full | 68 | return -1 if stream is full |
diff --git a/drivers/md/linear.c b/drivers/md/linear.c index 8a2f767f26d8..0ed7f6bc2a7f 100644 --- a/drivers/md/linear.c +++ b/drivers/md/linear.c | |||
@@ -216,7 +216,6 @@ static int linear_run (mddev_t *mddev) | |||
216 | 216 | ||
217 | if (md_check_no_bitmap(mddev)) | 217 | if (md_check_no_bitmap(mddev)) |
218 | return -EINVAL; | 218 | return -EINVAL; |
219 | mddev->queue->queue_lock = &mddev->queue->__queue_lock; | ||
220 | conf = linear_conf(mddev, mddev->raid_disks); | 219 | conf = linear_conf(mddev, mddev->raid_disks); |
221 | 220 | ||
222 | if (!conf) | 221 | if (!conf) |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 0cc30ecda4c1..818313e277e7 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -553,6 +553,9 @@ static mddev_t * mddev_find(dev_t unit) | |||
553 | { | 553 | { |
554 | mddev_t *mddev, *new = NULL; | 554 | mddev_t *mddev, *new = NULL; |
555 | 555 | ||
556 | if (unit && MAJOR(unit) != MD_MAJOR) | ||
557 | unit &= ~((1<<MdpMinorShift)-1); | ||
558 | |||
556 | retry: | 559 | retry: |
557 | spin_lock(&all_mddevs_lock); | 560 | spin_lock(&all_mddevs_lock); |
558 | 561 | ||
@@ -4138,10 +4141,10 @@ array_size_store(mddev_t *mddev, const char *buf, size_t len) | |||
4138 | } | 4141 | } |
4139 | 4142 | ||
4140 | mddev->array_sectors = sectors; | 4143 | mddev->array_sectors = sectors; |
4141 | set_capacity(mddev->gendisk, mddev->array_sectors); | 4144 | if (mddev->pers) { |
4142 | if (mddev->pers) | 4145 | set_capacity(mddev->gendisk, mddev->array_sectors); |
4143 | revalidate_disk(mddev->gendisk); | 4146 | revalidate_disk(mddev->gendisk); |
4144 | 4147 | } | |
4145 | return len; | 4148 | return len; |
4146 | } | 4149 | } |
4147 | 4150 | ||
@@ -4624,6 +4627,7 @@ static int do_md_run(mddev_t *mddev) | |||
4624 | } | 4627 | } |
4625 | set_capacity(mddev->gendisk, mddev->array_sectors); | 4628 | set_capacity(mddev->gendisk, mddev->array_sectors); |
4626 | revalidate_disk(mddev->gendisk); | 4629 | revalidate_disk(mddev->gendisk); |
4630 | mddev->changed = 1; | ||
4627 | kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); | 4631 | kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE); |
4628 | out: | 4632 | out: |
4629 | return err; | 4633 | return err; |
@@ -4712,6 +4716,7 @@ static void md_clean(mddev_t *mddev) | |||
4712 | mddev->sync_speed_min = mddev->sync_speed_max = 0; | 4716 | mddev->sync_speed_min = mddev->sync_speed_max = 0; |
4713 | mddev->recovery = 0; | 4717 | mddev->recovery = 0; |
4714 | mddev->in_sync = 0; | 4718 | mddev->in_sync = 0; |
4719 | mddev->changed = 0; | ||
4715 | mddev->degraded = 0; | 4720 | mddev->degraded = 0; |
4716 | mddev->safemode = 0; | 4721 | mddev->safemode = 0; |
4717 | mddev->bitmap_info.offset = 0; | 4722 | mddev->bitmap_info.offset = 0; |
@@ -4827,6 +4832,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
4827 | 4832 | ||
4828 | set_capacity(disk, 0); | 4833 | set_capacity(disk, 0); |
4829 | mutex_unlock(&mddev->open_mutex); | 4834 | mutex_unlock(&mddev->open_mutex); |
4835 | mddev->changed = 1; | ||
4830 | revalidate_disk(disk); | 4836 | revalidate_disk(disk); |
4831 | 4837 | ||
4832 | if (mddev->ro) | 4838 | if (mddev->ro) |
@@ -6011,7 +6017,7 @@ static int md_open(struct block_device *bdev, fmode_t mode) | |||
6011 | atomic_inc(&mddev->openers); | 6017 | atomic_inc(&mddev->openers); |
6012 | mutex_unlock(&mddev->open_mutex); | 6018 | mutex_unlock(&mddev->open_mutex); |
6013 | 6019 | ||
6014 | check_disk_size_change(mddev->gendisk, bdev); | 6020 | check_disk_change(bdev); |
6015 | out: | 6021 | out: |
6016 | return err; | 6022 | return err; |
6017 | } | 6023 | } |
@@ -6026,6 +6032,21 @@ static int md_release(struct gendisk *disk, fmode_t mode) | |||
6026 | 6032 | ||
6027 | return 0; | 6033 | return 0; |
6028 | } | 6034 | } |
6035 | |||
6036 | static int md_media_changed(struct gendisk *disk) | ||
6037 | { | ||
6038 | mddev_t *mddev = disk->private_data; | ||
6039 | |||
6040 | return mddev->changed; | ||
6041 | } | ||
6042 | |||
6043 | static int md_revalidate(struct gendisk *disk) | ||
6044 | { | ||
6045 | mddev_t *mddev = disk->private_data; | ||
6046 | |||
6047 | mddev->changed = 0; | ||
6048 | return 0; | ||
6049 | } | ||
6029 | static const struct block_device_operations md_fops = | 6050 | static const struct block_device_operations md_fops = |
6030 | { | 6051 | { |
6031 | .owner = THIS_MODULE, | 6052 | .owner = THIS_MODULE, |
@@ -6036,6 +6057,8 @@ static const struct block_device_operations md_fops = | |||
6036 | .compat_ioctl = md_compat_ioctl, | 6057 | .compat_ioctl = md_compat_ioctl, |
6037 | #endif | 6058 | #endif |
6038 | .getgeo = md_getgeo, | 6059 | .getgeo = md_getgeo, |
6060 | .media_changed = md_media_changed, | ||
6061 | .revalidate_disk= md_revalidate, | ||
6039 | }; | 6062 | }; |
6040 | 6063 | ||
6041 | static int md_thread(void * arg) | 6064 | static int md_thread(void * arg) |
diff --git a/drivers/md/md.h b/drivers/md/md.h index 7e90b8593b2a..12215d437fcc 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h | |||
@@ -274,6 +274,8 @@ struct mddev_s | |||
274 | atomic_t active; /* general refcount */ | 274 | atomic_t active; /* general refcount */ |
275 | atomic_t openers; /* number of active opens */ | 275 | atomic_t openers; /* number of active opens */ |
276 | 276 | ||
277 | int changed; /* True if we might need to | ||
278 | * reread partition info */ | ||
277 | int degraded; /* whether md should consider | 279 | int degraded; /* whether md should consider |
278 | * adding a spare | 280 | * adding a spare |
279 | */ | 281 | */ |
diff --git a/drivers/md/multipath.c b/drivers/md/multipath.c index 6d7ddf32ef2e..3a62d440e27b 100644 --- a/drivers/md/multipath.c +++ b/drivers/md/multipath.c | |||
@@ -435,7 +435,6 @@ static int multipath_run (mddev_t *mddev) | |||
435 | * bookkeeping area. [whatever we allocate in multipath_run(), | 435 | * bookkeeping area. [whatever we allocate in multipath_run(), |
436 | * should be freed in multipath_stop()] | 436 | * should be freed in multipath_stop()] |
437 | */ | 437 | */ |
438 | mddev->queue->queue_lock = &mddev->queue->__queue_lock; | ||
439 | 438 | ||
440 | conf = kzalloc(sizeof(multipath_conf_t), GFP_KERNEL); | 439 | conf = kzalloc(sizeof(multipath_conf_t), GFP_KERNEL); |
441 | mddev->private = conf; | 440 | mddev->private = conf; |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 637a96855edb..c0ac457f1218 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -361,7 +361,6 @@ static int raid0_run(mddev_t *mddev) | |||
361 | if (md_check_no_bitmap(mddev)) | 361 | if (md_check_no_bitmap(mddev)) |
362 | return -EINVAL; | 362 | return -EINVAL; |
363 | blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors); | 363 | blk_queue_max_hw_sectors(mddev->queue, mddev->chunk_sectors); |
364 | mddev->queue->queue_lock = &mddev->queue->__queue_lock; | ||
365 | 364 | ||
366 | /* if private is not null, we are here after takeover */ | 365 | /* if private is not null, we are here after takeover */ |
367 | if (mddev->private == NULL) { | 366 | if (mddev->private == NULL) { |
@@ -670,6 +669,7 @@ static void *raid0_takeover_raid1(mddev_t *mddev) | |||
670 | mddev->new_layout = 0; | 669 | mddev->new_layout = 0; |
671 | mddev->new_chunk_sectors = 128; /* by default set chunk size to 64k */ | 670 | mddev->new_chunk_sectors = 128; /* by default set chunk size to 64k */ |
672 | mddev->delta_disks = 1 - mddev->raid_disks; | 671 | mddev->delta_disks = 1 - mddev->raid_disks; |
672 | mddev->raid_disks = 1; | ||
673 | /* make sure it will be not marked as dirty */ | 673 | /* make sure it will be not marked as dirty */ |
674 | mddev->recovery_cp = MaxSector; | 674 | mddev->recovery_cp = MaxSector; |
675 | 675 | ||
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index a23ffa397ba9..06cd712807d0 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -593,7 +593,10 @@ static int flush_pending_writes(conf_t *conf) | |||
593 | if (conf->pending_bio_list.head) { | 593 | if (conf->pending_bio_list.head) { |
594 | struct bio *bio; | 594 | struct bio *bio; |
595 | bio = bio_list_get(&conf->pending_bio_list); | 595 | bio = bio_list_get(&conf->pending_bio_list); |
596 | /* Only take the spinlock to quiet a warning */ | ||
597 | spin_lock(conf->mddev->queue->queue_lock); | ||
596 | blk_remove_plug(conf->mddev->queue); | 598 | blk_remove_plug(conf->mddev->queue); |
599 | spin_unlock(conf->mddev->queue->queue_lock); | ||
597 | spin_unlock_irq(&conf->device_lock); | 600 | spin_unlock_irq(&conf->device_lock); |
598 | /* flush any pending bitmap writes to | 601 | /* flush any pending bitmap writes to |
599 | * disk before proceeding w/ I/O */ | 602 | * disk before proceeding w/ I/O */ |
@@ -959,7 +962,7 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
959 | atomic_inc(&r1_bio->remaining); | 962 | atomic_inc(&r1_bio->remaining); |
960 | spin_lock_irqsave(&conf->device_lock, flags); | 963 | spin_lock_irqsave(&conf->device_lock, flags); |
961 | bio_list_add(&conf->pending_bio_list, mbio); | 964 | bio_list_add(&conf->pending_bio_list, mbio); |
962 | blk_plug_device(mddev->queue); | 965 | blk_plug_device_unlocked(mddev->queue); |
963 | spin_unlock_irqrestore(&conf->device_lock, flags); | 966 | spin_unlock_irqrestore(&conf->device_lock, flags); |
964 | } | 967 | } |
965 | r1_bio_write_done(r1_bio, bio->bi_vcnt, behind_pages, behind_pages != NULL); | 968 | r1_bio_write_done(r1_bio, bio->bi_vcnt, behind_pages, behind_pages != NULL); |
@@ -2021,7 +2024,6 @@ static int run(mddev_t *mddev) | |||
2021 | if (IS_ERR(conf)) | 2024 | if (IS_ERR(conf)) |
2022 | return PTR_ERR(conf); | 2025 | return PTR_ERR(conf); |
2023 | 2026 | ||
2024 | mddev->queue->queue_lock = &conf->device_lock; | ||
2025 | list_for_each_entry(rdev, &mddev->disks, same_set) { | 2027 | list_for_each_entry(rdev, &mddev->disks, same_set) { |
2026 | disk_stack_limits(mddev->gendisk, rdev->bdev, | 2028 | disk_stack_limits(mddev->gendisk, rdev->bdev, |
2027 | rdev->data_offset << 9); | 2029 | rdev->data_offset << 9); |
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 3b607b28741b..747d061d8e05 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -662,7 +662,10 @@ static int flush_pending_writes(conf_t *conf) | |||
662 | if (conf->pending_bio_list.head) { | 662 | if (conf->pending_bio_list.head) { |
663 | struct bio *bio; | 663 | struct bio *bio; |
664 | bio = bio_list_get(&conf->pending_bio_list); | 664 | bio = bio_list_get(&conf->pending_bio_list); |
665 | /* Spinlock only taken to quiet a warning */ | ||
666 | spin_lock(conf->mddev->queue->queue_lock); | ||
665 | blk_remove_plug(conf->mddev->queue); | 667 | blk_remove_plug(conf->mddev->queue); |
668 | spin_unlock(conf->mddev->queue->queue_lock); | ||
666 | spin_unlock_irq(&conf->device_lock); | 669 | spin_unlock_irq(&conf->device_lock); |
667 | /* flush any pending bitmap writes to disk | 670 | /* flush any pending bitmap writes to disk |
668 | * before proceeding w/ I/O */ | 671 | * before proceeding w/ I/O */ |
@@ -971,7 +974,7 @@ static int make_request(mddev_t *mddev, struct bio * bio) | |||
971 | atomic_inc(&r10_bio->remaining); | 974 | atomic_inc(&r10_bio->remaining); |
972 | spin_lock_irqsave(&conf->device_lock, flags); | 975 | spin_lock_irqsave(&conf->device_lock, flags); |
973 | bio_list_add(&conf->pending_bio_list, mbio); | 976 | bio_list_add(&conf->pending_bio_list, mbio); |
974 | blk_plug_device(mddev->queue); | 977 | blk_plug_device_unlocked(mddev->queue); |
975 | spin_unlock_irqrestore(&conf->device_lock, flags); | 978 | spin_unlock_irqrestore(&conf->device_lock, flags); |
976 | } | 979 | } |
977 | 980 | ||
@@ -2304,8 +2307,6 @@ static int run(mddev_t *mddev) | |||
2304 | if (!conf) | 2307 | if (!conf) |
2305 | goto out; | 2308 | goto out; |
2306 | 2309 | ||
2307 | mddev->queue->queue_lock = &conf->device_lock; | ||
2308 | |||
2309 | mddev->thread = conf->thread; | 2310 | mddev->thread = conf->thread; |
2310 | conf->thread = NULL; | 2311 | conf->thread = NULL; |
2311 | 2312 | ||
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 702812824195..78536fdbd87f 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -5204,7 +5204,6 @@ static int run(mddev_t *mddev) | |||
5204 | 5204 | ||
5205 | mddev->queue->backing_dev_info.congested_data = mddev; | 5205 | mddev->queue->backing_dev_info.congested_data = mddev; |
5206 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; | 5206 | mddev->queue->backing_dev_info.congested_fn = raid5_congested; |
5207 | mddev->queue->queue_lock = &conf->device_lock; | ||
5208 | mddev->queue->unplug_fn = raid5_unplug_queue; | 5207 | mddev->queue->unplug_fn = raid5_unplug_queue; |
5209 | 5208 | ||
5210 | chunk_size = mddev->chunk_sectors << 9; | 5209 | chunk_size = mddev->chunk_sectors << 9; |
diff --git a/drivers/media/common/tuners/tda8290.c b/drivers/media/common/tuners/tda8290.c index bc6a67768af1..8c4852114eeb 100644 --- a/drivers/media/common/tuners/tda8290.c +++ b/drivers/media/common/tuners/tda8290.c | |||
@@ -658,13 +658,13 @@ static int tda8290_probe(struct tuner_i2c_props *i2c_props) | |||
658 | #define TDA8290_ID 0x89 | 658 | #define TDA8290_ID 0x89 |
659 | u8 reg = 0x1f, id; | 659 | u8 reg = 0x1f, id; |
660 | struct i2c_msg msg_read[] = { | 660 | struct i2c_msg msg_read[] = { |
661 | { .addr = 0x4b, .flags = 0, .len = 1, .buf = ® }, | 661 | { .addr = i2c_props->addr, .flags = 0, .len = 1, .buf = ® }, |
662 | { .addr = 0x4b, .flags = I2C_M_RD, .len = 1, .buf = &id }, | 662 | { .addr = i2c_props->addr, .flags = I2C_M_RD, .len = 1, .buf = &id }, |
663 | }; | 663 | }; |
664 | 664 | ||
665 | /* detect tda8290 */ | 665 | /* detect tda8290 */ |
666 | if (i2c_transfer(i2c_props->adap, msg_read, 2) != 2) { | 666 | if (i2c_transfer(i2c_props->adap, msg_read, 2) != 2) { |
667 | printk(KERN_WARNING "%s: tda8290 couldn't read register 0x%02x\n", | 667 | printk(KERN_WARNING "%s: couldn't read register 0x%02x\n", |
668 | __func__, reg); | 668 | __func__, reg); |
669 | return -ENODEV; | 669 | return -ENODEV; |
670 | } | 670 | } |
@@ -685,13 +685,13 @@ static int tda8295_probe(struct tuner_i2c_props *i2c_props) | |||
685 | #define TDA8295C2_ID 0x8b | 685 | #define TDA8295C2_ID 0x8b |
686 | u8 reg = 0x2f, id; | 686 | u8 reg = 0x2f, id; |
687 | struct i2c_msg msg_read[] = { | 687 | struct i2c_msg msg_read[] = { |
688 | { .addr = 0x4b, .flags = 0, .len = 1, .buf = ® }, | 688 | { .addr = i2c_props->addr, .flags = 0, .len = 1, .buf = ® }, |
689 | { .addr = 0x4b, .flags = I2C_M_RD, .len = 1, .buf = &id }, | 689 | { .addr = i2c_props->addr, .flags = I2C_M_RD, .len = 1, .buf = &id }, |
690 | }; | 690 | }; |
691 | 691 | ||
692 | /* detect tda8290 */ | 692 | /* detect tda8295 */ |
693 | if (i2c_transfer(i2c_props->adap, msg_read, 2) != 2) { | 693 | if (i2c_transfer(i2c_props->adap, msg_read, 2) != 2) { |
694 | printk(KERN_WARNING "%s: tda8290 couldn't read register 0x%02x\n", | 694 | printk(KERN_WARNING "%s: couldn't read register 0x%02x\n", |
695 | __func__, reg); | 695 | __func__, reg); |
696 | return -ENODEV; | 696 | return -ENODEV; |
697 | } | 697 | } |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index defd83964ce2..193cdb77b76a 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c | |||
@@ -870,6 +870,23 @@ static int dib7070p_tuner_attach(struct dvb_usb_adapter *adap) | |||
870 | return 0; | 870 | return 0; |
871 | } | 871 | } |
872 | 872 | ||
873 | static int stk7700p_pid_filter(struct dvb_usb_adapter *adapter, int index, | ||
874 | u16 pid, int onoff) | ||
875 | { | ||
876 | struct dib0700_state *st = adapter->dev->priv; | ||
877 | if (st->is_dib7000pc) | ||
878 | return dib7000p_pid_filter(adapter->fe, index, pid, onoff); | ||
879 | return dib7000m_pid_filter(adapter->fe, index, pid, onoff); | ||
880 | } | ||
881 | |||
882 | static int stk7700p_pid_filter_ctrl(struct dvb_usb_adapter *adapter, int onoff) | ||
883 | { | ||
884 | struct dib0700_state *st = adapter->dev->priv; | ||
885 | if (st->is_dib7000pc) | ||
886 | return dib7000p_pid_filter_ctrl(adapter->fe, onoff); | ||
887 | return dib7000m_pid_filter_ctrl(adapter->fe, onoff); | ||
888 | } | ||
889 | |||
873 | static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff) | 890 | static int stk70x0p_pid_filter(struct dvb_usb_adapter *adapter, int index, u16 pid, int onoff) |
874 | { | 891 | { |
875 | return dib7000p_pid_filter(adapter->fe, index, pid, onoff); | 892 | return dib7000p_pid_filter(adapter->fe, index, pid, onoff); |
@@ -1875,8 +1892,8 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
1875 | { | 1892 | { |
1876 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | 1893 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, |
1877 | .pid_filter_count = 32, | 1894 | .pid_filter_count = 32, |
1878 | .pid_filter = stk70x0p_pid_filter, | 1895 | .pid_filter = stk7700p_pid_filter, |
1879 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, | 1896 | .pid_filter_ctrl = stk7700p_pid_filter_ctrl, |
1880 | .frontend_attach = stk7700p_frontend_attach, | 1897 | .frontend_attach = stk7700p_frontend_attach, |
1881 | .tuner_attach = stk7700p_tuner_attach, | 1898 | .tuner_attach = stk7700p_tuner_attach, |
1882 | 1899 | ||
diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c index 9eea4188303b..46ccd01a7696 100644 --- a/drivers/media/dvb/dvb-usb/lmedm04.c +++ b/drivers/media/dvb/dvb-usb/lmedm04.c | |||
@@ -659,7 +659,7 @@ static int lme2510_download_firmware(struct usb_device *dev, | |||
659 | } | 659 | } |
660 | 660 | ||
661 | /* Default firmware for LME2510C */ | 661 | /* Default firmware for LME2510C */ |
662 | const char lme_firmware[50] = "dvb-usb-lme2510c-s7395.fw"; | 662 | char lme_firmware[50] = "dvb-usb-lme2510c-s7395.fw"; |
663 | 663 | ||
664 | static void lme_coldreset(struct usb_device *dev) | 664 | static void lme_coldreset(struct usb_device *dev) |
665 | { | 665 | { |
@@ -1006,7 +1006,7 @@ static struct dvb_usb_device_properties lme2510c_properties = { | |||
1006 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, | 1006 | .caps = DVB_USB_IS_AN_I2C_ADAPTER, |
1007 | .usb_ctrl = DEVICE_SPECIFIC, | 1007 | .usb_ctrl = DEVICE_SPECIFIC, |
1008 | .download_firmware = lme2510_download_firmware, | 1008 | .download_firmware = lme2510_download_firmware, |
1009 | .firmware = lme_firmware, | 1009 | .firmware = (const char *)&lme_firmware, |
1010 | .size_of_priv = sizeof(struct lme2510_state), | 1010 | .size_of_priv = sizeof(struct lme2510_state), |
1011 | .num_adapters = 1, | 1011 | .num_adapters = 1, |
1012 | .adapter = { | 1012 | .adapter = { |
@@ -1109,5 +1109,5 @@ module_exit(lme2510_module_exit); | |||
1109 | 1109 | ||
1110 | MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); | 1110 | MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); |
1111 | MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0"); | 1111 | MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0"); |
1112 | MODULE_VERSION("1.74"); | 1112 | MODULE_VERSION("1.75"); |
1113 | MODULE_LICENSE("GPL"); | 1113 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/media/dvb/frontends/dib7000m.c b/drivers/media/dvb/frontends/dib7000m.c index c7f5ccf54aa5..289a79837f24 100644 --- a/drivers/media/dvb/frontends/dib7000m.c +++ b/drivers/media/dvb/frontends/dib7000m.c | |||
@@ -1285,6 +1285,25 @@ struct i2c_adapter * dib7000m_get_i2c_master(struct dvb_frontend *demod, enum di | |||
1285 | } | 1285 | } |
1286 | EXPORT_SYMBOL(dib7000m_get_i2c_master); | 1286 | EXPORT_SYMBOL(dib7000m_get_i2c_master); |
1287 | 1287 | ||
1288 | int dib7000m_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff) | ||
1289 | { | ||
1290 | struct dib7000m_state *state = fe->demodulator_priv; | ||
1291 | u16 val = dib7000m_read_word(state, 294 + state->reg_offs) & 0xffef; | ||
1292 | val |= (onoff & 0x1) << 4; | ||
1293 | dprintk("PID filter enabled %d", onoff); | ||
1294 | return dib7000m_write_word(state, 294 + state->reg_offs, val); | ||
1295 | } | ||
1296 | EXPORT_SYMBOL(dib7000m_pid_filter_ctrl); | ||
1297 | |||
1298 | int dib7000m_pid_filter(struct dvb_frontend *fe, u8 id, u16 pid, u8 onoff) | ||
1299 | { | ||
1300 | struct dib7000m_state *state = fe->demodulator_priv; | ||
1301 | dprintk("PID filter: index %x, PID %d, OnOff %d", id, pid, onoff); | ||
1302 | return dib7000m_write_word(state, 300 + state->reg_offs + id, | ||
1303 | onoff ? (1 << 13) | pid : 0); | ||
1304 | } | ||
1305 | EXPORT_SYMBOL(dib7000m_pid_filter); | ||
1306 | |||
1288 | #if 0 | 1307 | #if 0 |
1289 | /* used with some prototype boards */ | 1308 | /* used with some prototype boards */ |
1290 | int dib7000m_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, | 1309 | int dib7000m_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, |
diff --git a/drivers/media/dvb/frontends/dib7000m.h b/drivers/media/dvb/frontends/dib7000m.h index 113819ce9f0d..81fcf2241c64 100644 --- a/drivers/media/dvb/frontends/dib7000m.h +++ b/drivers/media/dvb/frontends/dib7000m.h | |||
@@ -46,6 +46,8 @@ extern struct dvb_frontend *dib7000m_attach(struct i2c_adapter *i2c_adap, | |||
46 | extern struct i2c_adapter *dib7000m_get_i2c_master(struct dvb_frontend *, | 46 | extern struct i2c_adapter *dib7000m_get_i2c_master(struct dvb_frontend *, |
47 | enum dibx000_i2c_interface, | 47 | enum dibx000_i2c_interface, |
48 | int); | 48 | int); |
49 | extern int dib7000m_pid_filter(struct dvb_frontend *, u8 id, u16 pid, u8 onoff); | ||
50 | extern int dib7000m_pid_filter_ctrl(struct dvb_frontend *fe, u8 onoff); | ||
49 | #else | 51 | #else |
50 | static inline | 52 | static inline |
51 | struct dvb_frontend *dib7000m_attach(struct i2c_adapter *i2c_adap, | 53 | struct dvb_frontend *dib7000m_attach(struct i2c_adapter *i2c_adap, |
@@ -63,6 +65,19 @@ struct i2c_adapter *dib7000m_get_i2c_master(struct dvb_frontend *demod, | |||
63 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | 65 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); |
64 | return NULL; | 66 | return NULL; |
65 | } | 67 | } |
68 | static inline int dib7000m_pid_filter(struct dvb_frontend *fe, u8 id, | ||
69 | u16 pid, u8 onoff) | ||
70 | { | ||
71 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
72 | return -ENODEV; | ||
73 | } | ||
74 | |||
75 | static inline int dib7000m_pid_filter_ctrl(struct dvb_frontend *fe, | ||
76 | uint8_t onoff) | ||
77 | { | ||
78 | printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); | ||
79 | return -ENODEV; | ||
80 | } | ||
66 | #endif | 81 | #endif |
67 | 82 | ||
68 | /* TODO | 83 | /* TODO |
diff --git a/drivers/media/dvb/mantis/mantis_pci.c b/drivers/media/dvb/mantis/mantis_pci.c index 59feeb84aec7..10a432a79d00 100644 --- a/drivers/media/dvb/mantis/mantis_pci.c +++ b/drivers/media/dvb/mantis/mantis_pci.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/moduleparam.h> | 22 | #include <linux/moduleparam.h> |
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <asm/io.h> | 24 | #include <asm/io.h> |
25 | #include <asm/pgtable.h> | ||
26 | #include <asm/page.h> | 25 | #include <asm/page.h> |
27 | #include <linux/kmod.h> | 26 | #include <linux/kmod.h> |
28 | #include <linux/vmalloc.h> | 27 | #include <linux/vmalloc.h> |
diff --git a/drivers/media/rc/ir-raw.c b/drivers/media/rc/ir-raw.c index 73230ff93b8a..01f258a2a57a 100644 --- a/drivers/media/rc/ir-raw.c +++ b/drivers/media/rc/ir-raw.c | |||
@@ -112,7 +112,7 @@ int ir_raw_event_store_edge(struct rc_dev *dev, enum raw_event_type type) | |||
112 | { | 112 | { |
113 | ktime_t now; | 113 | ktime_t now; |
114 | s64 delta; /* ns */ | 114 | s64 delta; /* ns */ |
115 | struct ir_raw_event ev; | 115 | DEFINE_IR_RAW_EVENT(ev); |
116 | int rc = 0; | 116 | int rc = 0; |
117 | 117 | ||
118 | if (!dev->raw) | 118 | if (!dev->raw) |
@@ -125,7 +125,6 @@ int ir_raw_event_store_edge(struct rc_dev *dev, enum raw_event_type type) | |||
125 | * being called for the first time, note that delta can't | 125 | * being called for the first time, note that delta can't |
126 | * possibly be negative. | 126 | * possibly be negative. |
127 | */ | 127 | */ |
128 | ev.duration = 0; | ||
129 | if (delta > IR_MAX_DURATION || !dev->raw->last_type) | 128 | if (delta > IR_MAX_DURATION || !dev->raw->last_type) |
130 | type |= IR_START_EVENT; | 129 | type |= IR_START_EVENT; |
131 | else | 130 | else |
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 6df0a4980645..e4f8eac7f717 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c | |||
@@ -148,6 +148,7 @@ enum mceusb_model_type { | |||
148 | MCE_GEN2_TX_INV, | 148 | MCE_GEN2_TX_INV, |
149 | POLARIS_EVK, | 149 | POLARIS_EVK, |
150 | CX_HYBRID_TV, | 150 | CX_HYBRID_TV, |
151 | MULTIFUNCTION, | ||
151 | }; | 152 | }; |
152 | 153 | ||
153 | struct mceusb_model { | 154 | struct mceusb_model { |
@@ -155,9 +156,10 @@ struct mceusb_model { | |||
155 | u32 mce_gen2:1; | 156 | u32 mce_gen2:1; |
156 | u32 mce_gen3:1; | 157 | u32 mce_gen3:1; |
157 | u32 tx_mask_normal:1; | 158 | u32 tx_mask_normal:1; |
158 | u32 is_polaris:1; | ||
159 | u32 no_tx:1; | 159 | u32 no_tx:1; |
160 | 160 | ||
161 | int ir_intfnum; | ||
162 | |||
161 | const char *rc_map; /* Allow specify a per-board map */ | 163 | const char *rc_map; /* Allow specify a per-board map */ |
162 | const char *name; /* per-board name */ | 164 | const char *name; /* per-board name */ |
163 | }; | 165 | }; |
@@ -179,7 +181,6 @@ static const struct mceusb_model mceusb_model[] = { | |||
179 | .tx_mask_normal = 1, | 181 | .tx_mask_normal = 1, |
180 | }, | 182 | }, |
181 | [POLARIS_EVK] = { | 183 | [POLARIS_EVK] = { |
182 | .is_polaris = 1, | ||
183 | /* | 184 | /* |
184 | * In fact, the EVK is shipped without | 185 | * In fact, the EVK is shipped without |
185 | * remotes, but we should have something handy, | 186 | * remotes, but we should have something handy, |
@@ -189,10 +190,13 @@ static const struct mceusb_model mceusb_model[] = { | |||
189 | .name = "Conexant Hybrid TV (cx231xx) MCE IR", | 190 | .name = "Conexant Hybrid TV (cx231xx) MCE IR", |
190 | }, | 191 | }, |
191 | [CX_HYBRID_TV] = { | 192 | [CX_HYBRID_TV] = { |
192 | .is_polaris = 1, | ||
193 | .no_tx = 1, /* tx isn't wired up at all */ | 193 | .no_tx = 1, /* tx isn't wired up at all */ |
194 | .name = "Conexant Hybrid TV (cx231xx) MCE IR", | 194 | .name = "Conexant Hybrid TV (cx231xx) MCE IR", |
195 | }, | 195 | }, |
196 | [MULTIFUNCTION] = { | ||
197 | .mce_gen2 = 1, | ||
198 | .ir_intfnum = 2, | ||
199 | }, | ||
196 | }; | 200 | }; |
197 | 201 | ||
198 | static struct usb_device_id mceusb_dev_table[] = { | 202 | static struct usb_device_id mceusb_dev_table[] = { |
@@ -216,8 +220,9 @@ static struct usb_device_id mceusb_dev_table[] = { | |||
216 | { USB_DEVICE(VENDOR_PHILIPS, 0x206c) }, | 220 | { USB_DEVICE(VENDOR_PHILIPS, 0x206c) }, |
217 | /* Philips/Spinel plus IR transceiver for ASUS */ | 221 | /* Philips/Spinel plus IR transceiver for ASUS */ |
218 | { USB_DEVICE(VENDOR_PHILIPS, 0x2088) }, | 222 | { USB_DEVICE(VENDOR_PHILIPS, 0x2088) }, |
219 | /* Realtek MCE IR Receiver */ | 223 | /* Realtek MCE IR Receiver and card reader */ |
220 | { USB_DEVICE(VENDOR_REALTEK, 0x0161) }, | 224 | { USB_DEVICE(VENDOR_REALTEK, 0x0161), |
225 | .driver_info = MULTIFUNCTION }, | ||
221 | /* SMK/Toshiba G83C0004D410 */ | 226 | /* SMK/Toshiba G83C0004D410 */ |
222 | { USB_DEVICE(VENDOR_SMK, 0x031d), | 227 | { USB_DEVICE(VENDOR_SMK, 0x031d), |
223 | .driver_info = MCE_GEN2_TX_INV }, | 228 | .driver_info = MCE_GEN2_TX_INV }, |
@@ -1101,7 +1106,7 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, | |||
1101 | bool is_gen3; | 1106 | bool is_gen3; |
1102 | bool is_microsoft_gen1; | 1107 | bool is_microsoft_gen1; |
1103 | bool tx_mask_normal; | 1108 | bool tx_mask_normal; |
1104 | bool is_polaris; | 1109 | int ir_intfnum; |
1105 | 1110 | ||
1106 | dev_dbg(&intf->dev, "%s called\n", __func__); | 1111 | dev_dbg(&intf->dev, "%s called\n", __func__); |
1107 | 1112 | ||
@@ -1110,13 +1115,11 @@ static int __devinit mceusb_dev_probe(struct usb_interface *intf, | |||
1110 | is_gen3 = mceusb_model[model].mce_gen3; | 1115 | is_gen3 = mceusb_model[model].mce_gen3; |
1111 | is_microsoft_gen1 = mceusb_model[model].mce_gen1; | 1116 | is_microsoft_gen1 = mceusb_model[model].mce_gen1; |
1112 | tx_mask_normal = mceusb_model[model].tx_mask_normal; | 1117 | tx_mask_normal = mceusb_model[model].tx_mask_normal; |
1113 | is_polaris = mceusb_model[model].is_polaris; | 1118 | ir_intfnum = mceusb_model[model].ir_intfnum; |
1114 | 1119 | ||
1115 | if (is_polaris) { | 1120 | /* There are multi-function devices with non-IR interfaces */ |
1116 | /* Interface 0 is IR */ | 1121 | if (idesc->desc.bInterfaceNumber != ir_intfnum) |
1117 | if (idesc->desc.bInterfaceNumber) | 1122 | return -ENODEV; |
1118 | return -ENODEV; | ||
1119 | } | ||
1120 | 1123 | ||
1121 | /* step through the endpoints to find first bulk in and out endpoint */ | 1124 | /* step through the endpoints to find first bulk in and out endpoint */ |
1122 | for (i = 0; i < idesc->desc.bNumEndpoints; ++i) { | 1125 | for (i = 0; i < idesc->desc.bNumEndpoints; ++i) { |
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index 273d9d674792..d4d64492a057 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c | |||
@@ -385,8 +385,9 @@ static void nvt_cir_regs_init(struct nvt_dev *nvt) | |||
385 | 385 | ||
386 | static void nvt_cir_wake_regs_init(struct nvt_dev *nvt) | 386 | static void nvt_cir_wake_regs_init(struct nvt_dev *nvt) |
387 | { | 387 | { |
388 | /* set number of bytes needed for wake key comparison (default 67) */ | 388 | /* set number of bytes needed for wake from s3 (default 65) */ |
389 | nvt_cir_wake_reg_write(nvt, CIR_WAKE_FIFO_LEN, CIR_WAKE_FIFO_CMP_DEEP); | 389 | nvt_cir_wake_reg_write(nvt, CIR_WAKE_FIFO_CMP_BYTES, |
390 | CIR_WAKE_FIFO_CMP_DEEP); | ||
390 | 391 | ||
391 | /* set tolerance/variance allowed per byte during wake compare */ | 392 | /* set tolerance/variance allowed per byte during wake compare */ |
392 | nvt_cir_wake_reg_write(nvt, CIR_WAKE_CMP_TOLERANCE, | 393 | nvt_cir_wake_reg_write(nvt, CIR_WAKE_CMP_TOLERANCE, |
diff --git a/drivers/media/rc/nuvoton-cir.h b/drivers/media/rc/nuvoton-cir.h index 1df82351cb03..048135eea702 100644 --- a/drivers/media/rc/nuvoton-cir.h +++ b/drivers/media/rc/nuvoton-cir.h | |||
@@ -305,8 +305,11 @@ struct nvt_dev { | |||
305 | #define CIR_WAKE_IRFIFOSTS_RX_EMPTY 0x20 | 305 | #define CIR_WAKE_IRFIFOSTS_RX_EMPTY 0x20 |
306 | #define CIR_WAKE_IRFIFOSTS_RX_FULL 0x10 | 306 | #define CIR_WAKE_IRFIFOSTS_RX_FULL 0x10 |
307 | 307 | ||
308 | /* CIR Wake FIFO buffer is 67 bytes long */ | 308 | /* |
309 | #define CIR_WAKE_FIFO_LEN 67 | 309 | * The CIR Wake FIFO buffer is 67 bytes long, but the stock remote wakes |
310 | * the system comparing only 65 bytes (fails with this set to 67) | ||
311 | */ | ||
312 | #define CIR_WAKE_FIFO_CMP_BYTES 65 | ||
310 | /* CIR Wake byte comparison tolerance */ | 313 | /* CIR Wake byte comparison tolerance */ |
311 | #define CIR_WAKE_CMP_TOLERANCE 5 | 314 | #define CIR_WAKE_CMP_TOLERANCE 5 |
312 | 315 | ||
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index 512a2f4ada0e..5b4422ef4e6d 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c | |||
@@ -850,7 +850,7 @@ static ssize_t store_protocols(struct device *device, | |||
850 | count++; | 850 | count++; |
851 | } else { | 851 | } else { |
852 | for (i = 0; i < ARRAY_SIZE(proto_names); i++) { | 852 | for (i = 0; i < ARRAY_SIZE(proto_names); i++) { |
853 | if (!strncasecmp(tmp, proto_names[i].name, strlen(proto_names[i].name))) { | 853 | if (!strcasecmp(tmp, proto_names[i].name)) { |
854 | tmp += strlen(proto_names[i].name); | 854 | tmp += strlen(proto_names[i].name); |
855 | mask = proto_names[i].type; | 855 | mask = proto_names[i].type; |
856 | break; | 856 | break; |
diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c index e41e4ad5cc40..9c475c600fc9 100644 --- a/drivers/media/video/au0828/au0828-video.c +++ b/drivers/media/video/au0828/au0828-video.c | |||
@@ -1758,7 +1758,12 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
1758 | if (rc < 0) | 1758 | if (rc < 0) |
1759 | return rc; | 1759 | return rc; |
1760 | 1760 | ||
1761 | return videobuf_reqbufs(&fh->vb_vidq, rb); | 1761 | if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1762 | rc = videobuf_reqbufs(&fh->vb_vidq, rb); | ||
1763 | else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) | ||
1764 | rc = videobuf_reqbufs(&fh->vb_vbiq, rb); | ||
1765 | |||
1766 | return rc; | ||
1762 | } | 1767 | } |
1763 | 1768 | ||
1764 | static int vidioc_querybuf(struct file *file, void *priv, | 1769 | static int vidioc_querybuf(struct file *file, void *priv, |
@@ -1772,7 +1777,12 @@ static int vidioc_querybuf(struct file *file, void *priv, | |||
1772 | if (rc < 0) | 1777 | if (rc < 0) |
1773 | return rc; | 1778 | return rc; |
1774 | 1779 | ||
1775 | return videobuf_querybuf(&fh->vb_vidq, b); | 1780 | if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1781 | rc = videobuf_querybuf(&fh->vb_vidq, b); | ||
1782 | else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) | ||
1783 | rc = videobuf_querybuf(&fh->vb_vbiq, b); | ||
1784 | |||
1785 | return rc; | ||
1776 | } | 1786 | } |
1777 | 1787 | ||
1778 | static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b) | 1788 | static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b) |
@@ -1785,7 +1795,12 @@ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b) | |||
1785 | if (rc < 0) | 1795 | if (rc < 0) |
1786 | return rc; | 1796 | return rc; |
1787 | 1797 | ||
1788 | return videobuf_qbuf(&fh->vb_vidq, b); | 1798 | if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1799 | rc = videobuf_qbuf(&fh->vb_vidq, b); | ||
1800 | else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) | ||
1801 | rc = videobuf_qbuf(&fh->vb_vbiq, b); | ||
1802 | |||
1803 | return rc; | ||
1789 | } | 1804 | } |
1790 | 1805 | ||
1791 | static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) | 1806 | static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) |
@@ -1806,7 +1821,12 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) | |||
1806 | dev->greenscreen_detected = 0; | 1821 | dev->greenscreen_detected = 0; |
1807 | } | 1822 | } |
1808 | 1823 | ||
1809 | return videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK); | 1824 | if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) |
1825 | rc = videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK); | ||
1826 | else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) | ||
1827 | rc = videobuf_dqbuf(&fh->vb_vbiq, b, file->f_flags & O_NONBLOCK); | ||
1828 | |||
1829 | return rc; | ||
1810 | } | 1830 | } |
1811 | 1831 | ||
1812 | static struct v4l2_file_operations au0828_v4l_fops = { | 1832 | static struct v4l2_file_operations au0828_v4l_fops = { |
diff --git a/drivers/media/video/cx18/cx18-cards.c b/drivers/media/video/cx18/cx18-cards.c index 87177733cf92..68ad1963f421 100644 --- a/drivers/media/video/cx18/cx18-cards.c +++ b/drivers/media/video/cx18/cx18-cards.c | |||
@@ -95,6 +95,53 @@ static const struct cx18_card cx18_card_hvr1600_esmt = { | |||
95 | .i2c = &cx18_i2c_std, | 95 | .i2c = &cx18_i2c_std, |
96 | }; | 96 | }; |
97 | 97 | ||
98 | static const struct cx18_card cx18_card_hvr1600_s5h1411 = { | ||
99 | .type = CX18_CARD_HVR_1600_S5H1411, | ||
100 | .name = "Hauppauge HVR-1600", | ||
101 | .comment = "Simultaneous Digital and Analog TV capture supported\n", | ||
102 | .v4l2_capabilities = CX18_CAP_ENCODER, | ||
103 | .hw_audio_ctrl = CX18_HW_418_AV, | ||
104 | .hw_muxer = CX18_HW_CS5345, | ||
105 | .hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER | | ||
106 | CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL | | ||
107 | CX18_HW_Z8F0811_IR_HAUP, | ||
108 | .video_inputs = { | ||
109 | { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 }, | ||
110 | { CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 }, | ||
111 | { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE3 }, | ||
112 | { CX18_CARD_INPUT_SVIDEO2, 2, CX18_AV_SVIDEO2 }, | ||
113 | { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE4 }, | ||
114 | }, | ||
115 | .audio_inputs = { | ||
116 | { CX18_CARD_INPUT_AUD_TUNER, | ||
117 | CX18_AV_AUDIO8, CS5345_IN_1 | CS5345_MCLK_1_5 }, | ||
118 | { CX18_CARD_INPUT_LINE_IN1, | ||
119 | CX18_AV_AUDIO_SERIAL1, CS5345_IN_2 }, | ||
120 | { CX18_CARD_INPUT_LINE_IN2, | ||
121 | CX18_AV_AUDIO_SERIAL1, CS5345_IN_3 }, | ||
122 | }, | ||
123 | .radio_input = { CX18_CARD_INPUT_AUD_TUNER, | ||
124 | CX18_AV_AUDIO_SERIAL1, CS5345_IN_4 }, | ||
125 | .ddr = { | ||
126 | /* ESMT M13S128324A-5B memory */ | ||
127 | .chip_config = 0x003, | ||
128 | .refresh = 0x30c, | ||
129 | .timing1 = 0x44220e82, | ||
130 | .timing2 = 0x08, | ||
131 | .tune_lane = 0, | ||
132 | .initial_emrs = 0, | ||
133 | }, | ||
134 | .gpio_init.initial_value = 0x3001, | ||
135 | .gpio_init.direction = 0x3001, | ||
136 | .gpio_i2c_slave_reset = { | ||
137 | .active_lo_mask = 0x3001, | ||
138 | .msecs_asserted = 10, | ||
139 | .msecs_recovery = 40, | ||
140 | .ir_reset_mask = 0x0001, | ||
141 | }, | ||
142 | .i2c = &cx18_i2c_std, | ||
143 | }; | ||
144 | |||
98 | static const struct cx18_card cx18_card_hvr1600_samsung = { | 145 | static const struct cx18_card cx18_card_hvr1600_samsung = { |
99 | .type = CX18_CARD_HVR_1600_SAMSUNG, | 146 | .type = CX18_CARD_HVR_1600_SAMSUNG, |
100 | .name = "Hauppauge HVR-1600 (Preproduction)", | 147 | .name = "Hauppauge HVR-1600 (Preproduction)", |
@@ -523,7 +570,8 @@ static const struct cx18_card *cx18_card_list[] = { | |||
523 | &cx18_card_toshiba_qosmio_dvbt, | 570 | &cx18_card_toshiba_qosmio_dvbt, |
524 | &cx18_card_leadtek_pvr2100, | 571 | &cx18_card_leadtek_pvr2100, |
525 | &cx18_card_leadtek_dvr3100h, | 572 | &cx18_card_leadtek_dvr3100h, |
526 | &cx18_card_gotview_dvd3 | 573 | &cx18_card_gotview_dvd3, |
574 | &cx18_card_hvr1600_s5h1411 | ||
527 | }; | 575 | }; |
528 | 576 | ||
529 | const struct cx18_card *cx18_get_card(u16 index) | 577 | const struct cx18_card *cx18_get_card(u16 index) |
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c index 944af8adbe0c..b1c3cbd92743 100644 --- a/drivers/media/video/cx18/cx18-driver.c +++ b/drivers/media/video/cx18/cx18-driver.c | |||
@@ -157,6 +157,7 @@ MODULE_PARM_DESC(cardtype, | |||
157 | "\t\t\t 7 = Leadtek WinFast PVR2100\n" | 157 | "\t\t\t 7 = Leadtek WinFast PVR2100\n" |
158 | "\t\t\t 8 = Leadtek WinFast DVR3100 H\n" | 158 | "\t\t\t 8 = Leadtek WinFast DVR3100 H\n" |
159 | "\t\t\t 9 = GoTView PCI DVD3 Hybrid\n" | 159 | "\t\t\t 9 = GoTView PCI DVD3 Hybrid\n" |
160 | "\t\t\t 10 = Hauppauge HVR 1600 (S5H1411)\n" | ||
160 | "\t\t\t 0 = Autodetect (default)\n" | 161 | "\t\t\t 0 = Autodetect (default)\n" |
161 | "\t\t\t-1 = Ignore this card\n\t\t"); | 162 | "\t\t\t-1 = Ignore this card\n\t\t"); |
162 | MODULE_PARM_DESC(pal, "Set PAL standard: B, G, H, D, K, I, M, N, Nc, 60"); | 163 | MODULE_PARM_DESC(pal, "Set PAL standard: B, G, H, D, K, I, M, N, Nc, 60"); |
@@ -337,6 +338,7 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) | |||
337 | switch (cx->card->type) { | 338 | switch (cx->card->type) { |
338 | case CX18_CARD_HVR_1600_ESMT: | 339 | case CX18_CARD_HVR_1600_ESMT: |
339 | case CX18_CARD_HVR_1600_SAMSUNG: | 340 | case CX18_CARD_HVR_1600_SAMSUNG: |
341 | case CX18_CARD_HVR_1600_S5H1411: | ||
340 | tveeprom_hauppauge_analog(&c, tv, eedata); | 342 | tveeprom_hauppauge_analog(&c, tv, eedata); |
341 | break; | 343 | break; |
342 | case CX18_CARD_YUAN_MPC718: | 344 | case CX18_CARD_YUAN_MPC718: |
@@ -365,7 +367,25 @@ static void cx18_process_eeprom(struct cx18 *cx) | |||
365 | from the model number. Use the cardtype module option if you | 367 | from the model number. Use the cardtype module option if you |
366 | have one of these preproduction models. */ | 368 | have one of these preproduction models. */ |
367 | switch (tv.model) { | 369 | switch (tv.model) { |
368 | case 74000 ... 74999: | 370 | case 74301: /* Retail models */ |
371 | case 74321: | ||
372 | case 74351: /* OEM models */ | ||
373 | case 74361: | ||
374 | /* Digital side is s5h1411/tda18271 */ | ||
375 | cx->card = cx18_get_card(CX18_CARD_HVR_1600_S5H1411); | ||
376 | break; | ||
377 | case 74021: /* Retail models */ | ||
378 | case 74031: | ||
379 | case 74041: | ||
380 | case 74141: | ||
381 | case 74541: /* OEM models */ | ||
382 | case 74551: | ||
383 | case 74591: | ||
384 | case 74651: | ||
385 | case 74691: | ||
386 | case 74751: | ||
387 | case 74891: | ||
388 | /* Digital side is s5h1409/mxl5005s */ | ||
369 | cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); | 389 | cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); |
370 | break; | 390 | break; |
371 | case 0x718: | 391 | case 0x718: |
@@ -377,7 +397,8 @@ static void cx18_process_eeprom(struct cx18 *cx) | |||
377 | CX18_ERR("Invalid EEPROM\n"); | 397 | CX18_ERR("Invalid EEPROM\n"); |
378 | return; | 398 | return; |
379 | default: | 399 | default: |
380 | CX18_ERR("Unknown model %d, defaulting to HVR-1600\n", tv.model); | 400 | CX18_ERR("Unknown model %d, defaulting to original HVR-1600 " |
401 | "(cardtype=1)\n", tv.model); | ||
381 | cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); | 402 | cx->card = cx18_get_card(CX18_CARD_HVR_1600_ESMT); |
382 | break; | 403 | break; |
383 | } | 404 | } |
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h index 306caac6d3fc..f736679d2517 100644 --- a/drivers/media/video/cx18/cx18-driver.h +++ b/drivers/media/video/cx18/cx18-driver.h | |||
@@ -85,7 +85,8 @@ | |||
85 | #define CX18_CARD_LEADTEK_PVR2100 6 /* Leadtek WinFast PVR2100 */ | 85 | #define CX18_CARD_LEADTEK_PVR2100 6 /* Leadtek WinFast PVR2100 */ |
86 | #define CX18_CARD_LEADTEK_DVR3100H 7 /* Leadtek WinFast DVR3100 H */ | 86 | #define CX18_CARD_LEADTEK_DVR3100H 7 /* Leadtek WinFast DVR3100 H */ |
87 | #define CX18_CARD_GOTVIEW_PCI_DVD3 8 /* GoTView PCI DVD3 Hybrid */ | 87 | #define CX18_CARD_GOTVIEW_PCI_DVD3 8 /* GoTView PCI DVD3 Hybrid */ |
88 | #define CX18_CARD_LAST 8 | 88 | #define CX18_CARD_HVR_1600_S5H1411 9 /* Hauppauge HVR 1600 s5h1411/tda18271*/ |
89 | #define CX18_CARD_LAST 9 | ||
89 | 90 | ||
90 | #define CX18_ENC_STREAM_TYPE_MPG 0 | 91 | #define CX18_ENC_STREAM_TYPE_MPG 0 |
91 | #define CX18_ENC_STREAM_TYPE_TS 1 | 92 | #define CX18_ENC_STREAM_TYPE_TS 1 |
diff --git a/drivers/media/video/cx18/cx18-dvb.c b/drivers/media/video/cx18/cx18-dvb.c index f0381d62518d..f41922bd4020 100644 --- a/drivers/media/video/cx18/cx18-dvb.c +++ b/drivers/media/video/cx18/cx18-dvb.c | |||
@@ -29,6 +29,8 @@ | |||
29 | #include "cx18-gpio.h" | 29 | #include "cx18-gpio.h" |
30 | #include "s5h1409.h" | 30 | #include "s5h1409.h" |
31 | #include "mxl5005s.h" | 31 | #include "mxl5005s.h" |
32 | #include "s5h1411.h" | ||
33 | #include "tda18271.h" | ||
32 | #include "zl10353.h" | 34 | #include "zl10353.h" |
33 | 35 | ||
34 | #include <linux/firmware.h> | 36 | #include <linux/firmware.h> |
@@ -77,6 +79,32 @@ static struct s5h1409_config hauppauge_hvr1600_config = { | |||
77 | }; | 79 | }; |
78 | 80 | ||
79 | /* | 81 | /* |
82 | * CX18_CARD_HVR_1600_S5H1411 | ||
83 | */ | ||
84 | static struct s5h1411_config hcw_s5h1411_config = { | ||
85 | .output_mode = S5H1411_SERIAL_OUTPUT, | ||
86 | .gpio = S5H1411_GPIO_OFF, | ||
87 | .vsb_if = S5H1411_IF_44000, | ||
88 | .qam_if = S5H1411_IF_4000, | ||
89 | .inversion = S5H1411_INVERSION_ON, | ||
90 | .status_mode = S5H1411_DEMODLOCKING, | ||
91 | .mpeg_timing = S5H1411_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK, | ||
92 | }; | ||
93 | |||
94 | static struct tda18271_std_map hauppauge_tda18271_std_map = { | ||
95 | .atsc_6 = { .if_freq = 5380, .agc_mode = 3, .std = 3, | ||
96 | .if_lvl = 6, .rfagc_top = 0x37 }, | ||
97 | .qam_6 = { .if_freq = 4000, .agc_mode = 3, .std = 0, | ||
98 | .if_lvl = 6, .rfagc_top = 0x37 }, | ||
99 | }; | ||
100 | |||
101 | static struct tda18271_config hauppauge_tda18271_config = { | ||
102 | .std_map = &hauppauge_tda18271_std_map, | ||
103 | .gate = TDA18271_GATE_DIGITAL, | ||
104 | .output_opt = TDA18271_OUTPUT_LT_OFF, | ||
105 | }; | ||
106 | |||
107 | /* | ||
80 | * CX18_CARD_LEADTEK_DVR3100H | 108 | * CX18_CARD_LEADTEK_DVR3100H |
81 | */ | 109 | */ |
82 | /* Information/confirmation of proper config values provided by Terry Wu */ | 110 | /* Information/confirmation of proper config values provided by Terry Wu */ |
@@ -244,6 +272,7 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed) | |||
244 | switch (cx->card->type) { | 272 | switch (cx->card->type) { |
245 | case CX18_CARD_HVR_1600_ESMT: | 273 | case CX18_CARD_HVR_1600_ESMT: |
246 | case CX18_CARD_HVR_1600_SAMSUNG: | 274 | case CX18_CARD_HVR_1600_SAMSUNG: |
275 | case CX18_CARD_HVR_1600_S5H1411: | ||
247 | v = cx18_read_reg(cx, CX18_REG_DMUX_NUM_PORT_0_CONTROL); | 276 | v = cx18_read_reg(cx, CX18_REG_DMUX_NUM_PORT_0_CONTROL); |
248 | v |= 0x00400000; /* Serial Mode */ | 277 | v |= 0x00400000; /* Serial Mode */ |
249 | v |= 0x00002000; /* Data Length - Byte */ | 278 | v |= 0x00002000; /* Data Length - Byte */ |
@@ -455,6 +484,15 @@ static int dvb_register(struct cx18_stream *stream) | |||
455 | ret = 0; | 484 | ret = 0; |
456 | } | 485 | } |
457 | break; | 486 | break; |
487 | case CX18_CARD_HVR_1600_S5H1411: | ||
488 | dvb->fe = dvb_attach(s5h1411_attach, | ||
489 | &hcw_s5h1411_config, | ||
490 | &cx->i2c_adap[0]); | ||
491 | if (dvb->fe != NULL) | ||
492 | dvb_attach(tda18271_attach, dvb->fe, | ||
493 | 0x60, &cx->i2c_adap[0], | ||
494 | &hauppauge_tda18271_config); | ||
495 | break; | ||
458 | case CX18_CARD_LEADTEK_DVR3100H: | 496 | case CX18_CARD_LEADTEK_DVR3100H: |
459 | dvb->fe = dvb_attach(zl10353_attach, | 497 | dvb->fe = dvb_attach(zl10353_attach, |
460 | &leadtek_dvr3100h_demod, | 498 | &leadtek_dvr3100h_demod, |
diff --git a/drivers/media/video/cx23885/cx23885-i2c.c b/drivers/media/video/cx23885/cx23885-i2c.c index ed3d8f55029b..307ff543c254 100644 --- a/drivers/media/video/cx23885/cx23885-i2c.c +++ b/drivers/media/video/cx23885/cx23885-i2c.c | |||
@@ -122,10 +122,6 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, | |||
122 | 122 | ||
123 | if (!i2c_wait_done(i2c_adap)) | 123 | if (!i2c_wait_done(i2c_adap)) |
124 | goto eio; | 124 | goto eio; |
125 | if (!i2c_slave_did_ack(i2c_adap)) { | ||
126 | retval = -ENXIO; | ||
127 | goto err; | ||
128 | } | ||
129 | if (i2c_debug) { | 125 | if (i2c_debug) { |
130 | printk(" <W %02x %02x", msg->addr << 1, msg->buf[0]); | 126 | printk(" <W %02x %02x", msg->addr << 1, msg->buf[0]); |
131 | if (!(ctrl & I2C_NOSTOP)) | 127 | if (!(ctrl & I2C_NOSTOP)) |
@@ -158,7 +154,6 @@ static int i2c_sendbytes(struct i2c_adapter *i2c_adap, | |||
158 | 154 | ||
159 | eio: | 155 | eio: |
160 | retval = -EIO; | 156 | retval = -EIO; |
161 | err: | ||
162 | if (i2c_debug) | 157 | if (i2c_debug) |
163 | printk(KERN_ERR " ERR: %d\n", retval); | 158 | printk(KERN_ERR " ERR: %d\n", retval); |
164 | return retval; | 159 | return retval; |
@@ -209,10 +204,6 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, | |||
209 | 204 | ||
210 | if (!i2c_wait_done(i2c_adap)) | 205 | if (!i2c_wait_done(i2c_adap)) |
211 | goto eio; | 206 | goto eio; |
212 | if (cnt == 0 && !i2c_slave_did_ack(i2c_adap)) { | ||
213 | retval = -ENXIO; | ||
214 | goto err; | ||
215 | } | ||
216 | msg->buf[cnt] = cx_read(bus->reg_rdata) & 0xff; | 207 | msg->buf[cnt] = cx_read(bus->reg_rdata) & 0xff; |
217 | if (i2c_debug) { | 208 | if (i2c_debug) { |
218 | dprintk(1, " %02x", msg->buf[cnt]); | 209 | dprintk(1, " %02x", msg->buf[cnt]); |
@@ -224,7 +215,6 @@ static int i2c_readbytes(struct i2c_adapter *i2c_adap, | |||
224 | 215 | ||
225 | eio: | 216 | eio: |
226 | retval = -EIO; | 217 | retval = -EIO; |
227 | err: | ||
228 | if (i2c_debug) | 218 | if (i2c_debug) |
229 | printk(KERN_ERR " ERR: %d\n", retval); | 219 | printk(KERN_ERR " ERR: %d\n", retval); |
230 | return retval; | 220 | return retval; |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 6fc09dd41b9d..35796e035247 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -2015,7 +2015,8 @@ static int cx25840_probe(struct i2c_client *client, | |||
2015 | kfree(state); | 2015 | kfree(state); |
2016 | return err; | 2016 | return err; |
2017 | } | 2017 | } |
2018 | v4l2_ctrl_cluster(2, &state->volume); | 2018 | if (!is_cx2583x(state)) |
2019 | v4l2_ctrl_cluster(2, &state->volume); | ||
2019 | v4l2_ctrl_handler_setup(&state->hdl); | 2020 | v4l2_ctrl_handler_setup(&state->hdl); |
2020 | 2021 | ||
2021 | if (client->dev.platform_data) { | 2022 | if (client->dev.platform_data) { |
diff --git a/drivers/media/video/ivtv/ivtv-irq.c b/drivers/media/video/ivtv/ivtv-irq.c index 9b4faf009196..9c29e964d400 100644 --- a/drivers/media/video/ivtv/ivtv-irq.c +++ b/drivers/media/video/ivtv/ivtv-irq.c | |||
@@ -628,22 +628,66 @@ static void ivtv_irq_enc_pio_complete(struct ivtv *itv) | |||
628 | static void ivtv_irq_dma_err(struct ivtv *itv) | 628 | static void ivtv_irq_dma_err(struct ivtv *itv) |
629 | { | 629 | { |
630 | u32 data[CX2341X_MBOX_MAX_DATA]; | 630 | u32 data[CX2341X_MBOX_MAX_DATA]; |
631 | u32 status; | ||
631 | 632 | ||
632 | del_timer(&itv->dma_timer); | 633 | del_timer(&itv->dma_timer); |
634 | |||
633 | ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, 2, data); | 635 | ivtv_api_get_data(&itv->enc_mbox, IVTV_MBOX_DMA_END, 2, data); |
636 | status = read_reg(IVTV_REG_DMASTATUS); | ||
634 | IVTV_DEBUG_WARN("DMA ERROR %08x %08x %08x %d\n", data[0], data[1], | 637 | IVTV_DEBUG_WARN("DMA ERROR %08x %08x %08x %d\n", data[0], data[1], |
635 | read_reg(IVTV_REG_DMASTATUS), itv->cur_dma_stream); | 638 | status, itv->cur_dma_stream); |
636 | write_reg(read_reg(IVTV_REG_DMASTATUS) & 3, IVTV_REG_DMASTATUS); | 639 | /* |
640 | * We do *not* write back to the IVTV_REG_DMASTATUS register to | ||
641 | * clear the error status, if either the encoder write (0x02) or | ||
642 | * decoder read (0x01) bus master DMA operation do not indicate | ||
643 | * completed. We can race with the DMA engine, which may have | ||
644 | * transitioned to completed status *after* we read the register. | ||
645 | * Setting a IVTV_REG_DMASTATUS flag back to "busy" status, after the | ||
646 | * DMA engine has completed, will cause the DMA engine to stop working. | ||
647 | */ | ||
648 | status &= 0x3; | ||
649 | if (status == 0x3) | ||
650 | write_reg(status, IVTV_REG_DMASTATUS); | ||
651 | |||
637 | if (!test_bit(IVTV_F_I_UDMA, &itv->i_flags) && | 652 | if (!test_bit(IVTV_F_I_UDMA, &itv->i_flags) && |
638 | itv->cur_dma_stream >= 0 && itv->cur_dma_stream < IVTV_MAX_STREAMS) { | 653 | itv->cur_dma_stream >= 0 && itv->cur_dma_stream < IVTV_MAX_STREAMS) { |
639 | struct ivtv_stream *s = &itv->streams[itv->cur_dma_stream]; | 654 | struct ivtv_stream *s = &itv->streams[itv->cur_dma_stream]; |
640 | 655 | ||
641 | /* retry */ | 656 | if (s->type >= IVTV_DEC_STREAM_TYPE_MPG) { |
642 | if (s->type >= IVTV_DEC_STREAM_TYPE_MPG) | 657 | /* retry */ |
658 | /* | ||
659 | * FIXME - handle cases of DMA error similar to | ||
660 | * encoder below, except conditioned on status & 0x1 | ||
661 | */ | ||
643 | ivtv_dma_dec_start(s); | 662 | ivtv_dma_dec_start(s); |
644 | else | 663 | return; |
645 | ivtv_dma_enc_start(s); | 664 | } else { |
646 | return; | 665 | if ((status & 0x2) == 0) { |
666 | /* | ||
667 | * CX2341x Bus Master DMA write is ongoing. | ||
668 | * Reset the timer and let it complete. | ||
669 | */ | ||
670 | itv->dma_timer.expires = | ||
671 | jiffies + msecs_to_jiffies(600); | ||
672 | add_timer(&itv->dma_timer); | ||
673 | return; | ||
674 | } | ||
675 | |||
676 | if (itv->dma_retries < 3) { | ||
677 | /* | ||
678 | * CX2341x Bus Master DMA write has ended. | ||
679 | * Retry the write, starting with the first | ||
680 | * xfer segment. Just retrying the current | ||
681 | * segment is not sufficient. | ||
682 | */ | ||
683 | s->sg_processed = 0; | ||
684 | itv->dma_retries++; | ||
685 | ivtv_dma_enc_start_xfer(s); | ||
686 | return; | ||
687 | } | ||
688 | /* Too many retries, give up on this one */ | ||
689 | } | ||
690 | |||
647 | } | 691 | } |
648 | if (test_bit(IVTV_F_I_UDMA, &itv->i_flags)) { | 692 | if (test_bit(IVTV_F_I_UDMA, &itv->i_flags)) { |
649 | ivtv_udma_start(itv); | 693 | ivtv_udma_start(itv); |
diff --git a/drivers/media/video/mem2mem_testdev.c b/drivers/media/video/mem2mem_testdev.c index c179041d91f8..e7e717800ee2 100644 --- a/drivers/media/video/mem2mem_testdev.c +++ b/drivers/media/video/mem2mem_testdev.c | |||
@@ -1011,7 +1011,6 @@ static int m2mtest_remove(struct platform_device *pdev) | |||
1011 | v4l2_m2m_release(dev->m2m_dev); | 1011 | v4l2_m2m_release(dev->m2m_dev); |
1012 | del_timer_sync(&dev->timer); | 1012 | del_timer_sync(&dev->timer); |
1013 | video_unregister_device(dev->vfd); | 1013 | video_unregister_device(dev->vfd); |
1014 | video_device_release(dev->vfd); | ||
1015 | v4l2_device_unregister(&dev->v4l2_dev); | 1014 | v4l2_device_unregister(&dev->v4l2_dev); |
1016 | kfree(dev); | 1015 | kfree(dev); |
1017 | 1016 | ||
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index b63f8cafa671..561909b65ce6 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c | |||
@@ -57,7 +57,7 @@ | |||
57 | #include <linux/usb.h> | 57 | #include <linux/usb.h> |
58 | 58 | ||
59 | #define S2255_MAJOR_VERSION 1 | 59 | #define S2255_MAJOR_VERSION 1 |
60 | #define S2255_MINOR_VERSION 20 | 60 | #define S2255_MINOR_VERSION 21 |
61 | #define S2255_RELEASE 0 | 61 | #define S2255_RELEASE 0 |
62 | #define S2255_VERSION KERNEL_VERSION(S2255_MAJOR_VERSION, \ | 62 | #define S2255_VERSION KERNEL_VERSION(S2255_MAJOR_VERSION, \ |
63 | S2255_MINOR_VERSION, \ | 63 | S2255_MINOR_VERSION, \ |
@@ -312,9 +312,9 @@ struct s2255_fh { | |||
312 | }; | 312 | }; |
313 | 313 | ||
314 | /* current cypress EEPROM firmware version */ | 314 | /* current cypress EEPROM firmware version */ |
315 | #define S2255_CUR_USB_FWVER ((3 << 8) | 6) | 315 | #define S2255_CUR_USB_FWVER ((3 << 8) | 11) |
316 | /* current DSP FW version */ | 316 | /* current DSP FW version */ |
317 | #define S2255_CUR_DSP_FWVER 8 | 317 | #define S2255_CUR_DSP_FWVER 10102 |
318 | /* Need DSP version 5+ for video status feature */ | 318 | /* Need DSP version 5+ for video status feature */ |
319 | #define S2255_MIN_DSP_STATUS 5 | 319 | #define S2255_MIN_DSP_STATUS 5 |
320 | #define S2255_MIN_DSP_COLORFILTER 8 | 320 | #define S2255_MIN_DSP_COLORFILTER 8 |
@@ -492,9 +492,11 @@ static void planar422p_to_yuv_packed(const unsigned char *in, | |||
492 | 492 | ||
493 | static void s2255_reset_dsppower(struct s2255_dev *dev) | 493 | static void s2255_reset_dsppower(struct s2255_dev *dev) |
494 | { | 494 | { |
495 | s2255_vendor_req(dev, 0x40, 0x0b0b, 0x0b0b, NULL, 0, 1); | 495 | s2255_vendor_req(dev, 0x40, 0x0b0b, 0x0b01, NULL, 0, 1); |
496 | msleep(10); | 496 | msleep(10); |
497 | s2255_vendor_req(dev, 0x50, 0x0000, 0x0000, NULL, 0, 1); | 497 | s2255_vendor_req(dev, 0x50, 0x0000, 0x0000, NULL, 0, 1); |
498 | msleep(600); | ||
499 | s2255_vendor_req(dev, 0x10, 0x0000, 0x0000, NULL, 0, 1); | ||
498 | return; | 500 | return; |
499 | } | 501 | } |
500 | 502 | ||
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index 6a1f94042612..c45e6305b26f 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c | |||
@@ -143,9 +143,9 @@ static void asic3_irq_demux(unsigned int irq, struct irq_desc *desc) | |||
143 | unsigned long flags; | 143 | unsigned long flags; |
144 | struct asic3 *asic; | 144 | struct asic3 *asic; |
145 | 145 | ||
146 | desc->chip->ack(irq); | 146 | desc->irq_data.chip->irq_ack(&desc->irq_data); |
147 | 147 | ||
148 | asic = desc->handler_data; | 148 | asic = get_irq_data(irq); |
149 | 149 | ||
150 | for (iter = 0 ; iter < MAX_ASIC_ISR_LOOPS; iter++) { | 150 | for (iter = 0 ; iter < MAX_ASIC_ISR_LOOPS; iter++) { |
151 | u32 status; | 151 | u32 status; |
diff --git a/drivers/mfd/davinci_voicecodec.c b/drivers/mfd/davinci_voicecodec.c index 33c923d215c7..fdd8a1b8bc67 100644 --- a/drivers/mfd/davinci_voicecodec.c +++ b/drivers/mfd/davinci_voicecodec.c | |||
@@ -118,12 +118,12 @@ static int __init davinci_vc_probe(struct platform_device *pdev) | |||
118 | 118 | ||
119 | /* Voice codec interface client */ | 119 | /* Voice codec interface client */ |
120 | cell = &davinci_vc->cells[DAVINCI_VC_VCIF_CELL]; | 120 | cell = &davinci_vc->cells[DAVINCI_VC_VCIF_CELL]; |
121 | cell->name = "davinci_vcif"; | 121 | cell->name = "davinci-vcif"; |
122 | cell->driver_data = davinci_vc; | 122 | cell->driver_data = davinci_vc; |
123 | 123 | ||
124 | /* Voice codec CQ93VC client */ | 124 | /* Voice codec CQ93VC client */ |
125 | cell = &davinci_vc->cells[DAVINCI_VC_CQ93VC_CELL]; | 125 | cell = &davinci_vc->cells[DAVINCI_VC_CQ93VC_CELL]; |
126 | cell->name = "cq93vc"; | 126 | cell->name = "cq93vc-codec"; |
127 | cell->driver_data = davinci_vc; | 127 | cell->driver_data = davinci_vc; |
128 | 128 | ||
129 | ret = mfd_add_devices(&pdev->dev, pdev->id, davinci_vc->cells, | 129 | ret = mfd_add_devices(&pdev->dev, pdev->id, davinci_vc->cells, |
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index 627cf577b16d..e9018d1394ee 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c | |||
@@ -150,12 +150,12 @@ static inline int __tps6586x_write(struct i2c_client *client, | |||
150 | static inline int __tps6586x_writes(struct i2c_client *client, int reg, | 150 | static inline int __tps6586x_writes(struct i2c_client *client, int reg, |
151 | int len, uint8_t *val) | 151 | int len, uint8_t *val) |
152 | { | 152 | { |
153 | int ret; | 153 | int ret, i; |
154 | 154 | ||
155 | ret = i2c_smbus_write_i2c_block_data(client, reg, len, val); | 155 | for (i = 0; i < len; i++) { |
156 | if (ret < 0) { | 156 | ret = __tps6586x_write(client, reg + i, *(val + i)); |
157 | dev_err(&client->dev, "failed writings to 0x%02x\n", reg); | 157 | if (ret < 0) |
158 | return ret; | 158 | return ret; |
159 | } | 159 | } |
160 | 160 | ||
161 | return 0; | 161 | return 0; |
diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c index 000cb414a78a..92b85e28a15e 100644 --- a/drivers/mfd/ucb1x00-ts.c +++ b/drivers/mfd/ucb1x00-ts.c | |||
@@ -385,12 +385,18 @@ static int ucb1x00_ts_add(struct ucb1x00_dev *dev) | |||
385 | idev->close = ucb1x00_ts_close; | 385 | idev->close = ucb1x00_ts_close; |
386 | 386 | ||
387 | __set_bit(EV_ABS, idev->evbit); | 387 | __set_bit(EV_ABS, idev->evbit); |
388 | __set_bit(ABS_X, idev->absbit); | ||
389 | __set_bit(ABS_Y, idev->absbit); | ||
390 | __set_bit(ABS_PRESSURE, idev->absbit); | ||
391 | 388 | ||
392 | input_set_drvdata(idev, ts); | 389 | input_set_drvdata(idev, ts); |
393 | 390 | ||
391 | ucb1x00_adc_enable(ts->ucb); | ||
392 | ts->x_res = ucb1x00_ts_read_xres(ts); | ||
393 | ts->y_res = ucb1x00_ts_read_yres(ts); | ||
394 | ucb1x00_adc_disable(ts->ucb); | ||
395 | |||
396 | input_set_abs_params(idev, ABS_X, 0, ts->x_res, 0, 0); | ||
397 | input_set_abs_params(idev, ABS_Y, 0, ts->y_res, 0, 0); | ||
398 | input_set_abs_params(idev, ABS_PRESSURE, 0, 0, 0, 0); | ||
399 | |||
394 | err = input_register_device(idev); | 400 | err = input_register_device(idev); |
395 | if (err) | 401 | if (err) |
396 | goto fail; | 402 | goto fail; |
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 41233c7fa581..f4016a075fd6 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c | |||
@@ -246,6 +246,16 @@ static int wm8994_suspend(struct device *dev) | |||
246 | struct wm8994 *wm8994 = dev_get_drvdata(dev); | 246 | struct wm8994 *wm8994 = dev_get_drvdata(dev); |
247 | int ret; | 247 | int ret; |
248 | 248 | ||
249 | /* Don't actually go through with the suspend if the CODEC is | ||
250 | * still active (eg, for audio passthrough from CP. */ | ||
251 | ret = wm8994_reg_read(wm8994, WM8994_POWER_MANAGEMENT_1); | ||
252 | if (ret < 0) { | ||
253 | dev_err(dev, "Failed to read power status: %d\n", ret); | ||
254 | } else if (ret & WM8994_VMID_SEL_MASK) { | ||
255 | dev_dbg(dev, "CODEC still active, ignoring suspend\n"); | ||
256 | return 0; | ||
257 | } | ||
258 | |||
249 | /* GPIO configuration state is saved here since we may be configuring | 259 | /* GPIO configuration state is saved here since we may be configuring |
250 | * the GPIO alternate functions even if we're not using the gpiolib | 260 | * the GPIO alternate functions even if we're not using the gpiolib |
251 | * driver for them. | 261 | * driver for them. |
@@ -261,6 +271,8 @@ static int wm8994_suspend(struct device *dev) | |||
261 | if (ret < 0) | 271 | if (ret < 0) |
262 | dev_err(dev, "Failed to save LDO registers: %d\n", ret); | 272 | dev_err(dev, "Failed to save LDO registers: %d\n", ret); |
263 | 273 | ||
274 | wm8994->suspended = true; | ||
275 | |||
264 | ret = regulator_bulk_disable(wm8994->num_supplies, | 276 | ret = regulator_bulk_disable(wm8994->num_supplies, |
265 | wm8994->supplies); | 277 | wm8994->supplies); |
266 | if (ret != 0) { | 278 | if (ret != 0) { |
@@ -276,6 +288,10 @@ static int wm8994_resume(struct device *dev) | |||
276 | struct wm8994 *wm8994 = dev_get_drvdata(dev); | 288 | struct wm8994 *wm8994 = dev_get_drvdata(dev); |
277 | int ret; | 289 | int ret; |
278 | 290 | ||
291 | /* We may have lied to the PM core about suspending */ | ||
292 | if (!wm8994->suspended) | ||
293 | return 0; | ||
294 | |||
279 | ret = regulator_bulk_enable(wm8994->num_supplies, | 295 | ret = regulator_bulk_enable(wm8994->num_supplies, |
280 | wm8994->supplies); | 296 | wm8994->supplies); |
281 | if (ret != 0) { | 297 | if (ret != 0) { |
@@ -298,6 +314,8 @@ static int wm8994_resume(struct device *dev) | |||
298 | if (ret < 0) | 314 | if (ret < 0) |
299 | dev_err(dev, "Failed to restore GPIO registers: %d\n", ret); | 315 | dev_err(dev, "Failed to restore GPIO registers: %d\n", ret); |
300 | 316 | ||
317 | wm8994->suspended = false; | ||
318 | |||
301 | return 0; | 319 | return 0; |
302 | } | 320 | } |
303 | #endif | 321 | #endif |
diff --git a/drivers/misc/bmp085.c b/drivers/misc/bmp085.c index 63ee4c1a5315..b6e1c9a6679e 100644 --- a/drivers/misc/bmp085.c +++ b/drivers/misc/bmp085.c | |||
@@ -449,6 +449,7 @@ static const struct i2c_device_id bmp085_id[] = { | |||
449 | { "bmp085", 0 }, | 449 | { "bmp085", 0 }, |
450 | { } | 450 | { } |
451 | }; | 451 | }; |
452 | MODULE_DEVICE_TABLE(i2c, bmp085_id); | ||
452 | 453 | ||
453 | static struct i2c_driver bmp085_driver = { | 454 | static struct i2c_driver bmp085_driver = { |
454 | .driver = { | 455 | .driver = { |
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 6625c057be05..150b5f3cd401 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c | |||
@@ -1529,7 +1529,7 @@ void mmc_rescan(struct work_struct *work) | |||
1529 | * still present | 1529 | * still present |
1530 | */ | 1530 | */ |
1531 | if (host->bus_ops && host->bus_ops->detect && !host->bus_dead | 1531 | if (host->bus_ops && host->bus_ops->detect && !host->bus_dead |
1532 | && mmc_card_is_removable(host)) | 1532 | && !(host->caps & MMC_CAP_NONREMOVABLE)) |
1533 | host->bus_ops->detect(host); | 1533 | host->bus_ops->detect(host); |
1534 | 1534 | ||
1535 | /* | 1535 | /* |
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 5c4a54d9b6a4..ebc62ad4cc56 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c | |||
@@ -792,7 +792,6 @@ int mmc_attach_sdio(struct mmc_host *host) | |||
792 | */ | 792 | */ |
793 | mmc_release_host(host); | 793 | mmc_release_host(host); |
794 | err = mmc_add_card(host->card); | 794 | err = mmc_add_card(host->card); |
795 | mmc_claim_host(host); | ||
796 | if (err) | 795 | if (err) |
797 | goto remove_added; | 796 | goto remove_added; |
798 | 797 | ||
@@ -805,12 +804,12 @@ int mmc_attach_sdio(struct mmc_host *host) | |||
805 | goto remove_added; | 804 | goto remove_added; |
806 | } | 805 | } |
807 | 806 | ||
807 | mmc_claim_host(host); | ||
808 | return 0; | 808 | return 0; |
809 | 809 | ||
810 | 810 | ||
811 | remove_added: | 811 | remove_added: |
812 | /* Remove without lock if the device has been added. */ | 812 | /* Remove without lock if the device has been added. */ |
813 | mmc_release_host(host); | ||
814 | mmc_sdio_remove(host); | 813 | mmc_sdio_remove(host); |
815 | mmc_claim_host(host); | 814 | mmc_claim_host(host); |
816 | remove: | 815 | remove: |
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index a8c3e1c9b02a..4aaa88f8ab5f 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -1230,10 +1230,32 @@ static int inval_cache_and_wait_for_operation( | |||
1230 | sleep_time = chip_op_time / 2; | 1230 | sleep_time = chip_op_time / 2; |
1231 | 1231 | ||
1232 | for (;;) { | 1232 | for (;;) { |
1233 | if (chip->state != chip_state) { | ||
1234 | /* Someone's suspended the operation: sleep */ | ||
1235 | DECLARE_WAITQUEUE(wait, current); | ||
1236 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
1237 | add_wait_queue(&chip->wq, &wait); | ||
1238 | mutex_unlock(&chip->mutex); | ||
1239 | schedule(); | ||
1240 | remove_wait_queue(&chip->wq, &wait); | ||
1241 | mutex_lock(&chip->mutex); | ||
1242 | continue; | ||
1243 | } | ||
1244 | |||
1233 | status = map_read(map, cmd_adr); | 1245 | status = map_read(map, cmd_adr); |
1234 | if (map_word_andequal(map, status, status_OK, status_OK)) | 1246 | if (map_word_andequal(map, status, status_OK, status_OK)) |
1235 | break; | 1247 | break; |
1236 | 1248 | ||
1249 | if (chip->erase_suspended && chip_state == FL_ERASING) { | ||
1250 | /* Erase suspend occured while sleep: reset timeout */ | ||
1251 | timeo = reset_timeo; | ||
1252 | chip->erase_suspended = 0; | ||
1253 | } | ||
1254 | if (chip->write_suspended && chip_state == FL_WRITING) { | ||
1255 | /* Write suspend occured while sleep: reset timeout */ | ||
1256 | timeo = reset_timeo; | ||
1257 | chip->write_suspended = 0; | ||
1258 | } | ||
1237 | if (!timeo) { | 1259 | if (!timeo) { |
1238 | map_write(map, CMD(0x70), cmd_adr); | 1260 | map_write(map, CMD(0x70), cmd_adr); |
1239 | chip->state = FL_STATUS; | 1261 | chip->state = FL_STATUS; |
@@ -1257,27 +1279,6 @@ static int inval_cache_and_wait_for_operation( | |||
1257 | timeo--; | 1279 | timeo--; |
1258 | } | 1280 | } |
1259 | mutex_lock(&chip->mutex); | 1281 | mutex_lock(&chip->mutex); |
1260 | |||
1261 | while (chip->state != chip_state) { | ||
1262 | /* Someone's suspended the operation: sleep */ | ||
1263 | DECLARE_WAITQUEUE(wait, current); | ||
1264 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
1265 | add_wait_queue(&chip->wq, &wait); | ||
1266 | mutex_unlock(&chip->mutex); | ||
1267 | schedule(); | ||
1268 | remove_wait_queue(&chip->wq, &wait); | ||
1269 | mutex_lock(&chip->mutex); | ||
1270 | } | ||
1271 | if (chip->erase_suspended && chip_state == FL_ERASING) { | ||
1272 | /* Erase suspend occured while sleep: reset timeout */ | ||
1273 | timeo = reset_timeo; | ||
1274 | chip->erase_suspended = 0; | ||
1275 | } | ||
1276 | if (chip->write_suspended && chip_state == FL_WRITING) { | ||
1277 | /* Write suspend occured while sleep: reset timeout */ | ||
1278 | timeo = reset_timeo; | ||
1279 | chip->write_suspended = 0; | ||
1280 | } | ||
1281 | } | 1282 | } |
1282 | 1283 | ||
1283 | /* Done and happy. */ | 1284 | /* Done and happy. */ |
diff --git a/drivers/mtd/chips/jedec_probe.c b/drivers/mtd/chips/jedec_probe.c index d72a5fb2d041..4e1be51cc122 100644 --- a/drivers/mtd/chips/jedec_probe.c +++ b/drivers/mtd/chips/jedec_probe.c | |||
@@ -1935,14 +1935,14 @@ static void jedec_reset(u32 base, struct map_info *map, struct cfi_private *cfi) | |||
1935 | } | 1935 | } |
1936 | 1936 | ||
1937 | 1937 | ||
1938 | static int cfi_jedec_setup(struct cfi_private *p_cfi, int index) | 1938 | static int cfi_jedec_setup(struct map_info *map, struct cfi_private *cfi, int index) |
1939 | { | 1939 | { |
1940 | int i,num_erase_regions; | 1940 | int i,num_erase_regions; |
1941 | uint8_t uaddr; | 1941 | uint8_t uaddr; |
1942 | 1942 | ||
1943 | if (! (jedec_table[index].devtypes & p_cfi->device_type)) { | 1943 | if (!(jedec_table[index].devtypes & cfi->device_type)) { |
1944 | DEBUG(MTD_DEBUG_LEVEL1, "Rejecting potential %s with incompatible %d-bit device type\n", | 1944 | DEBUG(MTD_DEBUG_LEVEL1, "Rejecting potential %s with incompatible %d-bit device type\n", |
1945 | jedec_table[index].name, 4 * (1<<p_cfi->device_type)); | 1945 | jedec_table[index].name, 4 * (1<<cfi->device_type)); |
1946 | return 0; | 1946 | return 0; |
1947 | } | 1947 | } |
1948 | 1948 | ||
@@ -1950,27 +1950,28 @@ static int cfi_jedec_setup(struct cfi_private *p_cfi, int index) | |||
1950 | 1950 | ||
1951 | num_erase_regions = jedec_table[index].nr_regions; | 1951 | num_erase_regions = jedec_table[index].nr_regions; |
1952 | 1952 | ||
1953 | p_cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL); | 1953 | cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL); |
1954 | if (!p_cfi->cfiq) { | 1954 | if (!cfi->cfiq) { |
1955 | //xx printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name); | 1955 | //xx printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name); |
1956 | return 0; | 1956 | return 0; |
1957 | } | 1957 | } |
1958 | 1958 | ||
1959 | memset(p_cfi->cfiq,0,sizeof(struct cfi_ident)); | 1959 | memset(cfi->cfiq, 0, sizeof(struct cfi_ident)); |
1960 | 1960 | ||
1961 | p_cfi->cfiq->P_ID = jedec_table[index].cmd_set; | 1961 | cfi->cfiq->P_ID = jedec_table[index].cmd_set; |
1962 | p_cfi->cfiq->NumEraseRegions = jedec_table[index].nr_regions; | 1962 | cfi->cfiq->NumEraseRegions = jedec_table[index].nr_regions; |
1963 | p_cfi->cfiq->DevSize = jedec_table[index].dev_size; | 1963 | cfi->cfiq->DevSize = jedec_table[index].dev_size; |
1964 | p_cfi->cfi_mode = CFI_MODE_JEDEC; | 1964 | cfi->cfi_mode = CFI_MODE_JEDEC; |
1965 | cfi->sector_erase_cmd = CMD(0x30); | ||
1965 | 1966 | ||
1966 | for (i=0; i<num_erase_regions; i++){ | 1967 | for (i=0; i<num_erase_regions; i++){ |
1967 | p_cfi->cfiq->EraseRegionInfo[i] = jedec_table[index].regions[i]; | 1968 | cfi->cfiq->EraseRegionInfo[i] = jedec_table[index].regions[i]; |
1968 | } | 1969 | } |
1969 | p_cfi->cmdset_priv = NULL; | 1970 | cfi->cmdset_priv = NULL; |
1970 | 1971 | ||
1971 | /* This may be redundant for some cases, but it doesn't hurt */ | 1972 | /* This may be redundant for some cases, but it doesn't hurt */ |
1972 | p_cfi->mfr = jedec_table[index].mfr_id; | 1973 | cfi->mfr = jedec_table[index].mfr_id; |
1973 | p_cfi->id = jedec_table[index].dev_id; | 1974 | cfi->id = jedec_table[index].dev_id; |
1974 | 1975 | ||
1975 | uaddr = jedec_table[index].uaddr; | 1976 | uaddr = jedec_table[index].uaddr; |
1976 | 1977 | ||
@@ -1978,8 +1979,8 @@ static int cfi_jedec_setup(struct cfi_private *p_cfi, int index) | |||
1978 | our brains explode when we see the datasheets talking about address | 1979 | our brains explode when we see the datasheets talking about address |
1979 | lines numbered from A-1 to A18. The CFI table has unlock addresses | 1980 | lines numbered from A-1 to A18. The CFI table has unlock addresses |
1980 | in device-words according to the mode the device is connected in */ | 1981 | in device-words according to the mode the device is connected in */ |
1981 | p_cfi->addr_unlock1 = unlock_addrs[uaddr].addr1 / p_cfi->device_type; | 1982 | cfi->addr_unlock1 = unlock_addrs[uaddr].addr1 / cfi->device_type; |
1982 | p_cfi->addr_unlock2 = unlock_addrs[uaddr].addr2 / p_cfi->device_type; | 1983 | cfi->addr_unlock2 = unlock_addrs[uaddr].addr2 / cfi->device_type; |
1983 | 1984 | ||
1984 | return 1; /* ok */ | 1985 | return 1; /* ok */ |
1985 | } | 1986 | } |
@@ -2175,7 +2176,7 @@ static int jedec_probe_chip(struct map_info *map, __u32 base, | |||
2175 | "MTD %s(): matched device 0x%x,0x%x unlock_addrs: 0x%.4x 0x%.4x\n", | 2176 | "MTD %s(): matched device 0x%x,0x%x unlock_addrs: 0x%.4x 0x%.4x\n", |
2176 | __func__, cfi->mfr, cfi->id, | 2177 | __func__, cfi->mfr, cfi->id, |
2177 | cfi->addr_unlock1, cfi->addr_unlock2 ); | 2178 | cfi->addr_unlock1, cfi->addr_unlock2 ); |
2178 | if (!cfi_jedec_setup(cfi, i)) | 2179 | if (!cfi_jedec_setup(map, cfi, i)) |
2179 | return 0; | 2180 | return 0; |
2180 | goto ok_out; | 2181 | goto ok_out; |
2181 | } | 2182 | } |
diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c index 77d64ce19e9f..92de7e3a49a5 100644 --- a/drivers/mtd/maps/amd76xrom.c +++ b/drivers/mtd/maps/amd76xrom.c | |||
@@ -151,6 +151,7 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev, | |||
151 | printk(KERN_ERR MOD_NAME | 151 | printk(KERN_ERR MOD_NAME |
152 | " %s(): Unable to register resource %pR - kernel bug?\n", | 152 | " %s(): Unable to register resource %pR - kernel bug?\n", |
153 | __func__, &window->rsrc); | 153 | __func__, &window->rsrc); |
154 | return -EBUSY; | ||
154 | } | 155 | } |
155 | 156 | ||
156 | 157 | ||
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index cb20c67995d8..e0a2373bf0e2 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c | |||
@@ -413,7 +413,6 @@ error3: | |||
413 | error2: | 413 | error2: |
414 | list_del(&new->list); | 414 | list_del(&new->list); |
415 | error1: | 415 | error1: |
416 | kfree(new); | ||
417 | return ret; | 416 | return ret; |
418 | } | 417 | } |
419 | 418 | ||
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index 15682ec8530e..28af71c61834 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
@@ -968,6 +968,6 @@ static void __exit omap_nand_exit(void) | |||
968 | module_init(omap_nand_init); | 968 | module_init(omap_nand_init); |
969 | module_exit(omap_nand_exit); | 969 | module_exit(omap_nand_exit); |
970 | 970 | ||
971 | MODULE_ALIAS(DRIVER_NAME); | 971 | MODULE_ALIAS("platform:" DRIVER_NAME); |
972 | MODULE_LICENSE("GPL"); | 972 | MODULE_LICENSE("GPL"); |
973 | MODULE_DESCRIPTION("Glue layer for NAND flash on TI OMAP boards"); | 973 | MODULE_DESCRIPTION("Glue layer for NAND flash on TI OMAP boards"); |
diff --git a/drivers/mtd/onenand/generic.c b/drivers/mtd/onenand/generic.c index e78914938c5c..ac08750748a3 100644 --- a/drivers/mtd/onenand/generic.c +++ b/drivers/mtd/onenand/generic.c | |||
@@ -131,7 +131,7 @@ static struct platform_driver generic_onenand_driver = { | |||
131 | .remove = __devexit_p(generic_onenand_remove), | 131 | .remove = __devexit_p(generic_onenand_remove), |
132 | }; | 132 | }; |
133 | 133 | ||
134 | MODULE_ALIAS(DRIVER_NAME); | 134 | MODULE_ALIAS("platform:" DRIVER_NAME); |
135 | 135 | ||
136 | static int __init generic_onenand_init(void) | 136 | static int __init generic_onenand_init(void) |
137 | { | 137 | { |
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c index ac31f461cc1c..c849cacf4b2f 100644 --- a/drivers/mtd/onenand/omap2.c +++ b/drivers/mtd/onenand/omap2.c | |||
@@ -860,7 +860,7 @@ static void __exit omap2_onenand_exit(void) | |||
860 | module_init(omap2_onenand_init); | 860 | module_init(omap2_onenand_init); |
861 | module_exit(omap2_onenand_exit); | 861 | module_exit(omap2_onenand_exit); |
862 | 862 | ||
863 | MODULE_ALIAS(DRIVER_NAME); | 863 | MODULE_ALIAS("platform:" DRIVER_NAME); |
864 | MODULE_LICENSE("GPL"); | 864 | MODULE_LICENSE("GPL"); |
865 | MODULE_AUTHOR("Jarkko Lavinen <jarkko.lavinen@nokia.com>"); | 865 | MODULE_AUTHOR("Jarkko Lavinen <jarkko.lavinen@nokia.com>"); |
866 | MODULE_DESCRIPTION("Glue layer for OneNAND flash on OMAP2 / OMAP3"); | 866 | MODULE_DESCRIPTION("Glue layer for OneNAND flash on OMAP2 / OMAP3"); |
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c index 39214e512452..7ca0eded2561 100644 --- a/drivers/net/ariadne.c +++ b/drivers/net/ariadne.c | |||
@@ -425,11 +425,6 @@ static irqreturn_t ariadne_interrupt(int irq, void *data) | |||
425 | int csr0, boguscnt; | 425 | int csr0, boguscnt; |
426 | int handled = 0; | 426 | int handled = 0; |
427 | 427 | ||
428 | if (dev == NULL) { | ||
429 | printk(KERN_WARNING "ariadne_interrupt(): irq for unknown device.\n"); | ||
430 | return IRQ_NONE; | ||
431 | } | ||
432 | |||
433 | lance->RAP = CSR0; /* PCnet-ISA Controller Status */ | 428 | lance->RAP = CSR0; /* PCnet-ISA Controller Status */ |
434 | 429 | ||
435 | if (!(lance->RDP & INTR)) /* Check if any interrupt has been */ | 430 | if (!(lance->RDP & INTR)) /* Check if any interrupt has been */ |
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h index 653c62475cb6..8849699c66c4 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h | |||
@@ -22,7 +22,7 @@ | |||
22 | * (you will need to reboot afterwards) */ | 22 | * (you will need to reboot afterwards) */ |
23 | /* #define BNX2X_STOP_ON_ERROR */ | 23 | /* #define BNX2X_STOP_ON_ERROR */ |
24 | 24 | ||
25 | #define DRV_MODULE_VERSION "1.62.00-5" | 25 | #define DRV_MODULE_VERSION "1.62.00-6" |
26 | #define DRV_MODULE_RELDATE "2011/01/30" | 26 | #define DRV_MODULE_RELDATE "2011/01/30" |
27 | #define BNX2X_BC_VER 0x040200 | 27 | #define BNX2X_BC_VER 0x040200 |
28 | 28 | ||
@@ -1211,6 +1211,7 @@ struct bnx2x { | |||
1211 | /* DCBX Negotation results */ | 1211 | /* DCBX Negotation results */ |
1212 | struct dcbx_features dcbx_local_feat; | 1212 | struct dcbx_features dcbx_local_feat; |
1213 | u32 dcbx_error; | 1213 | u32 dcbx_error; |
1214 | u32 pending_max; | ||
1214 | }; | 1215 | }; |
1215 | 1216 | ||
1216 | /** | 1217 | /** |
@@ -1613,19 +1614,23 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms, | |||
1613 | #define BNX2X_BTR 4 | 1614 | #define BNX2X_BTR 4 |
1614 | #define MAX_SPQ_PENDING 8 | 1615 | #define MAX_SPQ_PENDING 8 |
1615 | 1616 | ||
1616 | 1617 | /* CMNG constants, as derived from system spec calculations */ | |
1617 | /* CMNG constants | 1618 | /* default MIN rate in case VNIC min rate is configured to zero - 100Mbps */ |
1618 | derived from lab experiments, and not from system spec calculations !!! */ | 1619 | #define DEF_MIN_RATE 100 |
1619 | #define DEF_MIN_RATE 100 | 1620 | /* resolution of the rate shaping timer - 400 usec */ |
1620 | /* resolution of the rate shaping timer - 100 usec */ | 1621 | #define RS_PERIODIC_TIMEOUT_USEC 400 |
1621 | #define RS_PERIODIC_TIMEOUT_USEC 100 | ||
1622 | /* resolution of fairness algorithm in usecs - | ||
1623 | coefficient for calculating the actual t fair */ | ||
1624 | #define T_FAIR_COEF 10000000 | ||
1625 | /* number of bytes in single QM arbitration cycle - | 1622 | /* number of bytes in single QM arbitration cycle - |
1626 | coefficient for calculating the fairness timer */ | 1623 | * coefficient for calculating the fairness timer */ |
1627 | #define QM_ARB_BYTES 40000 | 1624 | #define QM_ARB_BYTES 160000 |
1628 | #define FAIR_MEM 2 | 1625 | /* resolution of Min algorithm 1:100 */ |
1626 | #define MIN_RES 100 | ||
1627 | /* how many bytes above threshold for the minimal credit of Min algorithm*/ | ||
1628 | #define MIN_ABOVE_THRESH 32768 | ||
1629 | /* Fairness algorithm integration time coefficient - | ||
1630 | * for calculating the actual Tfair */ | ||
1631 | #define T_FAIR_COEF ((MIN_ABOVE_THRESH + QM_ARB_BYTES) * 8 * MIN_RES) | ||
1632 | /* Memory of fairness algorithm . 2 cycles */ | ||
1633 | #define FAIR_MEM 2 | ||
1629 | 1634 | ||
1630 | 1635 | ||
1631 | #define ATTN_NIG_FOR_FUNC (1L << 8) | 1636 | #define ATTN_NIG_FOR_FUNC (1L << 8) |
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c index 710ce5d04c53..a71b32940533 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.c +++ b/drivers/net/bnx2x/bnx2x_cmn.c | |||
@@ -259,10 +259,44 @@ static void bnx2x_tpa_start(struct bnx2x_fastpath *fp, u16 queue, | |||
259 | #endif | 259 | #endif |
260 | } | 260 | } |
261 | 261 | ||
262 | /* Timestamp option length allowed for TPA aggregation: | ||
263 | * | ||
264 | * nop nop kind length echo val | ||
265 | */ | ||
266 | #define TPA_TSTAMP_OPT_LEN 12 | ||
267 | /** | ||
268 | * Calculate the approximate value of the MSS for this | ||
269 | * aggregation using the first packet of it. | ||
270 | * | ||
271 | * @param bp | ||
272 | * @param parsing_flags Parsing flags from the START CQE | ||
273 | * @param len_on_bd Total length of the first packet for the | ||
274 | * aggregation. | ||
275 | */ | ||
276 | static inline u16 bnx2x_set_lro_mss(struct bnx2x *bp, u16 parsing_flags, | ||
277 | u16 len_on_bd) | ||
278 | { | ||
279 | /* TPA arrgregation won't have an IP options and TCP options | ||
280 | * other than timestamp. | ||
281 | */ | ||
282 | u16 hdrs_len = ETH_HLEN + sizeof(struct iphdr) + sizeof(struct tcphdr); | ||
283 | |||
284 | |||
285 | /* Check if there was a TCP timestamp, if there is it's will | ||
286 | * always be 12 bytes length: nop nop kind length echo val. | ||
287 | * | ||
288 | * Otherwise FW would close the aggregation. | ||
289 | */ | ||
290 | if (parsing_flags & PARSING_FLAGS_TIME_STAMP_EXIST_FLAG) | ||
291 | hdrs_len += TPA_TSTAMP_OPT_LEN; | ||
292 | |||
293 | return len_on_bd - hdrs_len; | ||
294 | } | ||
295 | |||
262 | static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp, | 296 | static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp, |
263 | struct sk_buff *skb, | 297 | struct sk_buff *skb, |
264 | struct eth_fast_path_rx_cqe *fp_cqe, | 298 | struct eth_fast_path_rx_cqe *fp_cqe, |
265 | u16 cqe_idx) | 299 | u16 cqe_idx, u16 parsing_flags) |
266 | { | 300 | { |
267 | struct sw_rx_page *rx_pg, old_rx_pg; | 301 | struct sw_rx_page *rx_pg, old_rx_pg; |
268 | u16 len_on_bd = le16_to_cpu(fp_cqe->len_on_bd); | 302 | u16 len_on_bd = le16_to_cpu(fp_cqe->len_on_bd); |
@@ -275,8 +309,8 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
275 | 309 | ||
276 | /* This is needed in order to enable forwarding support */ | 310 | /* This is needed in order to enable forwarding support */ |
277 | if (frag_size) | 311 | if (frag_size) |
278 | skb_shinfo(skb)->gso_size = min((u32)SGE_PAGE_SIZE, | 312 | skb_shinfo(skb)->gso_size = bnx2x_set_lro_mss(bp, parsing_flags, |
279 | max(frag_size, (u32)len_on_bd)); | 313 | len_on_bd); |
280 | 314 | ||
281 | #ifdef BNX2X_STOP_ON_ERROR | 315 | #ifdef BNX2X_STOP_ON_ERROR |
282 | if (pages > min_t(u32, 8, MAX_SKB_FRAGS)*SGE_PAGE_SIZE*PAGES_PER_SGE) { | 316 | if (pages > min_t(u32, 8, MAX_SKB_FRAGS)*SGE_PAGE_SIZE*PAGES_PER_SGE) { |
@@ -344,6 +378,8 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
344 | if (likely(new_skb)) { | 378 | if (likely(new_skb)) { |
345 | /* fix ip xsum and give it to the stack */ | 379 | /* fix ip xsum and give it to the stack */ |
346 | /* (no need to map the new skb) */ | 380 | /* (no need to map the new skb) */ |
381 | u16 parsing_flags = | ||
382 | le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags); | ||
347 | 383 | ||
348 | prefetch(skb); | 384 | prefetch(skb); |
349 | prefetch(((char *)(skb)) + L1_CACHE_BYTES); | 385 | prefetch(((char *)(skb)) + L1_CACHE_BYTES); |
@@ -373,9 +409,9 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
373 | } | 409 | } |
374 | 410 | ||
375 | if (!bnx2x_fill_frag_skb(bp, fp, skb, | 411 | if (!bnx2x_fill_frag_skb(bp, fp, skb, |
376 | &cqe->fast_path_cqe, cqe_idx)) { | 412 | &cqe->fast_path_cqe, cqe_idx, |
377 | if ((le16_to_cpu(cqe->fast_path_cqe. | 413 | parsing_flags)) { |
378 | pars_flags.flags) & PARSING_FLAGS_VLAN)) | 414 | if (parsing_flags & PARSING_FLAGS_VLAN) |
379 | __vlan_hwaccel_put_tag(skb, | 415 | __vlan_hwaccel_put_tag(skb, |
380 | le16_to_cpu(cqe->fast_path_cqe. | 416 | le16_to_cpu(cqe->fast_path_cqe. |
381 | vlan_tag)); | 417 | vlan_tag)); |
@@ -703,19 +739,20 @@ u16 bnx2x_get_mf_speed(struct bnx2x *bp) | |||
703 | { | 739 | { |
704 | u16 line_speed = bp->link_vars.line_speed; | 740 | u16 line_speed = bp->link_vars.line_speed; |
705 | if (IS_MF(bp)) { | 741 | if (IS_MF(bp)) { |
706 | u16 maxCfg = (bp->mf_config[BP_VN(bp)] & | 742 | u16 maxCfg = bnx2x_extract_max_cfg(bp, |
707 | FUNC_MF_CFG_MAX_BW_MASK) >> | 743 | bp->mf_config[BP_VN(bp)]); |
708 | FUNC_MF_CFG_MAX_BW_SHIFT; | 744 | |
709 | /* Calculate the current MAX line speed limit for the DCC | 745 | /* Calculate the current MAX line speed limit for the MF |
710 | * capable devices | 746 | * devices |
711 | */ | 747 | */ |
712 | if (IS_MF_SD(bp)) { | 748 | if (IS_MF_SI(bp)) |
749 | line_speed = (line_speed * maxCfg) / 100; | ||
750 | else { /* SD mode */ | ||
713 | u16 vn_max_rate = maxCfg * 100; | 751 | u16 vn_max_rate = maxCfg * 100; |
714 | 752 | ||
715 | if (vn_max_rate < line_speed) | 753 | if (vn_max_rate < line_speed) |
716 | line_speed = vn_max_rate; | 754 | line_speed = vn_max_rate; |
717 | } else /* IS_MF_SI(bp)) */ | 755 | } |
718 | line_speed = (line_speed * maxCfg) / 100; | ||
719 | } | 756 | } |
720 | 757 | ||
721 | return line_speed; | 758 | return line_speed; |
@@ -959,6 +996,23 @@ void bnx2x_free_skbs(struct bnx2x *bp) | |||
959 | bnx2x_free_rx_skbs(bp); | 996 | bnx2x_free_rx_skbs(bp); |
960 | } | 997 | } |
961 | 998 | ||
999 | void bnx2x_update_max_mf_config(struct bnx2x *bp, u32 value) | ||
1000 | { | ||
1001 | /* load old values */ | ||
1002 | u32 mf_cfg = bp->mf_config[BP_VN(bp)]; | ||
1003 | |||
1004 | if (value != bnx2x_extract_max_cfg(bp, mf_cfg)) { | ||
1005 | /* leave all but MAX value */ | ||
1006 | mf_cfg &= ~FUNC_MF_CFG_MAX_BW_MASK; | ||
1007 | |||
1008 | /* set new MAX value */ | ||
1009 | mf_cfg |= (value << FUNC_MF_CFG_MAX_BW_SHIFT) | ||
1010 | & FUNC_MF_CFG_MAX_BW_MASK; | ||
1011 | |||
1012 | bnx2x_fw_command(bp, DRV_MSG_CODE_SET_MF_BW, mf_cfg); | ||
1013 | } | ||
1014 | } | ||
1015 | |||
962 | static void bnx2x_free_msix_irqs(struct bnx2x *bp) | 1016 | static void bnx2x_free_msix_irqs(struct bnx2x *bp) |
963 | { | 1017 | { |
964 | int i, offset = 1; | 1018 | int i, offset = 1; |
@@ -1427,6 +1481,11 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode) | |||
1427 | 1481 | ||
1428 | bnx2x_set_eth_mac(bp, 1); | 1482 | bnx2x_set_eth_mac(bp, 1); |
1429 | 1483 | ||
1484 | if (bp->pending_max) { | ||
1485 | bnx2x_update_max_mf_config(bp, bp->pending_max); | ||
1486 | bp->pending_max = 0; | ||
1487 | } | ||
1488 | |||
1430 | if (bp->port.pmf) | 1489 | if (bp->port.pmf) |
1431 | bnx2x_initial_phy_init(bp, load_mode); | 1490 | bnx2x_initial_phy_init(bp, load_mode); |
1432 | 1491 | ||
diff --git a/drivers/net/bnx2x/bnx2x_cmn.h b/drivers/net/bnx2x/bnx2x_cmn.h index 03eb4d68e6bb..85ea7f26b51f 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.h +++ b/drivers/net/bnx2x/bnx2x_cmn.h | |||
@@ -341,6 +341,15 @@ void bnx2x_dcbx_init(struct bnx2x *bp); | |||
341 | */ | 341 | */ |
342 | int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state); | 342 | int bnx2x_set_power_state(struct bnx2x *bp, pci_power_t state); |
343 | 343 | ||
344 | /** | ||
345 | * Updates MAX part of MF configuration in HW | ||
346 | * (if required) | ||
347 | * | ||
348 | * @param bp | ||
349 | * @param value | ||
350 | */ | ||
351 | void bnx2x_update_max_mf_config(struct bnx2x *bp, u32 value); | ||
352 | |||
344 | /* dev_close main block */ | 353 | /* dev_close main block */ |
345 | int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode); | 354 | int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode); |
346 | 355 | ||
@@ -1044,4 +1053,24 @@ static inline void storm_memset_cmng(struct bnx2x *bp, | |||
1044 | void bnx2x_acquire_phy_lock(struct bnx2x *bp); | 1053 | void bnx2x_acquire_phy_lock(struct bnx2x *bp); |
1045 | void bnx2x_release_phy_lock(struct bnx2x *bp); | 1054 | void bnx2x_release_phy_lock(struct bnx2x *bp); |
1046 | 1055 | ||
1056 | /** | ||
1057 | * Extracts MAX BW part from MF configuration. | ||
1058 | * | ||
1059 | * @param bp | ||
1060 | * @param mf_cfg | ||
1061 | * | ||
1062 | * @return u16 | ||
1063 | */ | ||
1064 | static inline u16 bnx2x_extract_max_cfg(struct bnx2x *bp, u32 mf_cfg) | ||
1065 | { | ||
1066 | u16 max_cfg = (mf_cfg & FUNC_MF_CFG_MAX_BW_MASK) >> | ||
1067 | FUNC_MF_CFG_MAX_BW_SHIFT; | ||
1068 | if (!max_cfg) { | ||
1069 | BNX2X_ERR("Illegal configuration detected for Max BW - " | ||
1070 | "using 100 instead\n"); | ||
1071 | max_cfg = 100; | ||
1072 | } | ||
1073 | return max_cfg; | ||
1074 | } | ||
1075 | |||
1047 | #endif /* BNX2X_CMN_H */ | 1076 | #endif /* BNX2X_CMN_H */ |
diff --git a/drivers/net/bnx2x/bnx2x_ethtool.c b/drivers/net/bnx2x/bnx2x_ethtool.c index 5b44a8b48509..7e92f9d0dcfd 100644 --- a/drivers/net/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/bnx2x/bnx2x_ethtool.c | |||
@@ -238,7 +238,7 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
238 | speed |= (cmd->speed_hi << 16); | 238 | speed |= (cmd->speed_hi << 16); |
239 | 239 | ||
240 | if (IS_MF_SI(bp)) { | 240 | if (IS_MF_SI(bp)) { |
241 | u32 param = 0; | 241 | u32 part; |
242 | u32 line_speed = bp->link_vars.line_speed; | 242 | u32 line_speed = bp->link_vars.line_speed; |
243 | 243 | ||
244 | /* use 10G if no link detected */ | 244 | /* use 10G if no link detected */ |
@@ -251,23 +251,22 @@ static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
251 | REQ_BC_VER_4_SET_MF_BW); | 251 | REQ_BC_VER_4_SET_MF_BW); |
252 | return -EINVAL; | 252 | return -EINVAL; |
253 | } | 253 | } |
254 | if (line_speed < speed) { | 254 | |
255 | BNX2X_DEV_INFO("New speed should be less or equal " | 255 | part = (speed * 100) / line_speed; |
256 | "to actual line speed\n"); | 256 | |
257 | if (line_speed < speed || !part) { | ||
258 | BNX2X_DEV_INFO("Speed setting should be in a range " | ||
259 | "from 1%% to 100%% " | ||
260 | "of actual line speed\n"); | ||
257 | return -EINVAL; | 261 | return -EINVAL; |
258 | } | 262 | } |
259 | /* load old values */ | ||
260 | param = bp->mf_config[BP_VN(bp)]; | ||
261 | |||
262 | /* leave only MIN value */ | ||
263 | param &= FUNC_MF_CFG_MIN_BW_MASK; | ||
264 | 263 | ||
265 | /* set new MAX value */ | 264 | if (bp->state != BNX2X_STATE_OPEN) |
266 | param |= (((speed * 100) / line_speed) | 265 | /* store value for following "load" */ |
267 | << FUNC_MF_CFG_MAX_BW_SHIFT) | 266 | bp->pending_max = part; |
268 | & FUNC_MF_CFG_MAX_BW_MASK; | 267 | else |
268 | bnx2x_update_max_mf_config(bp, part); | ||
269 | 269 | ||
270 | bnx2x_fw_command(bp, DRV_MSG_CODE_SET_MF_BW, param); | ||
271 | return 0; | 270 | return 0; |
272 | } | 271 | } |
273 | 272 | ||
@@ -1781,9 +1780,7 @@ static int bnx2x_test_nvram(struct bnx2x *bp) | |||
1781 | { 0x100, 0x350 }, /* manuf_info */ | 1780 | { 0x100, 0x350 }, /* manuf_info */ |
1782 | { 0x450, 0xf0 }, /* feature_info */ | 1781 | { 0x450, 0xf0 }, /* feature_info */ |
1783 | { 0x640, 0x64 }, /* upgrade_key_info */ | 1782 | { 0x640, 0x64 }, /* upgrade_key_info */ |
1784 | { 0x6a4, 0x64 }, | ||
1785 | { 0x708, 0x70 }, /* manuf_key_info */ | 1783 | { 0x708, 0x70 }, /* manuf_key_info */ |
1786 | { 0x778, 0x70 }, | ||
1787 | { 0, 0 } | 1784 | { 0, 0 } |
1788 | }; | 1785 | }; |
1789 | __be32 buf[0x350 / 4]; | 1786 | __be32 buf[0x350 / 4]; |
@@ -1933,11 +1930,11 @@ static void bnx2x_self_test(struct net_device *dev, | |||
1933 | buf[4] = 1; | 1930 | buf[4] = 1; |
1934 | etest->flags |= ETH_TEST_FL_FAILED; | 1931 | etest->flags |= ETH_TEST_FL_FAILED; |
1935 | } | 1932 | } |
1936 | if (bp->port.pmf) | 1933 | |
1937 | if (bnx2x_link_test(bp, is_serdes) != 0) { | 1934 | if (bnx2x_link_test(bp, is_serdes) != 0) { |
1938 | buf[5] = 1; | 1935 | buf[5] = 1; |
1939 | etest->flags |= ETH_TEST_FL_FAILED; | 1936 | etest->flags |= ETH_TEST_FL_FAILED; |
1940 | } | 1937 | } |
1941 | 1938 | ||
1942 | #ifdef BNX2X_EXTRA_DEBUG | 1939 | #ifdef BNX2X_EXTRA_DEBUG |
1943 | bnx2x_panic_dump(bp); | 1940 | bnx2x_panic_dump(bp); |
diff --git a/drivers/net/bnx2x/bnx2x_init.h b/drivers/net/bnx2x/bnx2x_init.h index 5a268e9a0895..fa6dbe3f2058 100644 --- a/drivers/net/bnx2x/bnx2x_init.h +++ b/drivers/net/bnx2x/bnx2x_init.h | |||
@@ -241,7 +241,7 @@ static const struct { | |||
241 | /* Block IGU, MISC, PXP and PXP2 parity errors as long as we don't | 241 | /* Block IGU, MISC, PXP and PXP2 parity errors as long as we don't |
242 | * want to handle "system kill" flow at the moment. | 242 | * want to handle "system kill" flow at the moment. |
243 | */ | 243 | */ |
244 | BLOCK_PRTY_INFO(PXP, 0x3ffffff, 0x3ffffff, 0x3ffffff, 0x3ffffff), | 244 | BLOCK_PRTY_INFO(PXP, 0x7ffffff, 0x3ffffff, 0x3ffffff, 0x7ffffff), |
245 | BLOCK_PRTY_INFO_0(PXP2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), | 245 | BLOCK_PRTY_INFO_0(PXP2, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff), |
246 | BLOCK_PRTY_INFO_1(PXP2, 0x7ff, 0x7f, 0x7f, 0x7ff), | 246 | BLOCK_PRTY_INFO_1(PXP2, 0x7ff, 0x7f, 0x7f, 0x7ff), |
247 | BLOCK_PRTY_INFO(HC, 0x7, 0x7, 0x7, 0), | 247 | BLOCK_PRTY_INFO(HC, 0x7, 0x7, 0x7, 0), |
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c index d584d32c747d..aa032339e321 100644 --- a/drivers/net/bnx2x/bnx2x_main.c +++ b/drivers/net/bnx2x/bnx2x_main.c | |||
@@ -1974,13 +1974,22 @@ static void bnx2x_init_vn_minmax(struct bnx2x *bp, int vn) | |||
1974 | vn_max_rate = 0; | 1974 | vn_max_rate = 0; |
1975 | 1975 | ||
1976 | } else { | 1976 | } else { |
1977 | u32 maxCfg = bnx2x_extract_max_cfg(bp, vn_cfg); | ||
1978 | |||
1977 | vn_min_rate = ((vn_cfg & FUNC_MF_CFG_MIN_BW_MASK) >> | 1979 | vn_min_rate = ((vn_cfg & FUNC_MF_CFG_MIN_BW_MASK) >> |
1978 | FUNC_MF_CFG_MIN_BW_SHIFT) * 100; | 1980 | FUNC_MF_CFG_MIN_BW_SHIFT) * 100; |
1979 | /* If min rate is zero - set it to 1 */ | 1981 | /* If fairness is enabled (not all min rates are zeroes) and |
1982 | if current min rate is zero - set it to 1. | ||
1983 | This is a requirement of the algorithm. */ | ||
1980 | if (bp->vn_weight_sum && (vn_min_rate == 0)) | 1984 | if (bp->vn_weight_sum && (vn_min_rate == 0)) |
1981 | vn_min_rate = DEF_MIN_RATE; | 1985 | vn_min_rate = DEF_MIN_RATE; |
1982 | vn_max_rate = ((vn_cfg & FUNC_MF_CFG_MAX_BW_MASK) >> | 1986 | |
1983 | FUNC_MF_CFG_MAX_BW_SHIFT) * 100; | 1987 | if (IS_MF_SI(bp)) |
1988 | /* maxCfg in percents of linkspeed */ | ||
1989 | vn_max_rate = (bp->link_vars.line_speed * maxCfg) / 100; | ||
1990 | else | ||
1991 | /* maxCfg is absolute in 100Mb units */ | ||
1992 | vn_max_rate = maxCfg * 100; | ||
1984 | } | 1993 | } |
1985 | 1994 | ||
1986 | DP(NETIF_MSG_IFUP, | 1995 | DP(NETIF_MSG_IFUP, |
@@ -2006,7 +2015,8 @@ static void bnx2x_init_vn_minmax(struct bnx2x *bp, int vn) | |||
2006 | m_fair_vn.vn_credit_delta = | 2015 | m_fair_vn.vn_credit_delta = |
2007 | max_t(u32, (vn_min_rate * (T_FAIR_COEF / | 2016 | max_t(u32, (vn_min_rate * (T_FAIR_COEF / |
2008 | (8 * bp->vn_weight_sum))), | 2017 | (8 * bp->vn_weight_sum))), |
2009 | (bp->cmng.fair_vars.fair_threshold * 2)); | 2018 | (bp->cmng.fair_vars.fair_threshold + |
2019 | MIN_ABOVE_THRESH)); | ||
2010 | DP(NETIF_MSG_IFUP, "m_fair_vn.vn_credit_delta %d\n", | 2020 | DP(NETIF_MSG_IFUP, "m_fair_vn.vn_credit_delta %d\n", |
2011 | m_fair_vn.vn_credit_delta); | 2021 | m_fair_vn.vn_credit_delta); |
2012 | } | 2022 | } |
@@ -2082,8 +2092,9 @@ static void bnx2x_cmng_fns_init(struct bnx2x *bp, u8 read_cfg, u8 cmng_type) | |||
2082 | bnx2x_calc_vn_weight_sum(bp); | 2092 | bnx2x_calc_vn_weight_sum(bp); |
2083 | 2093 | ||
2084 | /* calculate and set min-max rate for each vn */ | 2094 | /* calculate and set min-max rate for each vn */ |
2085 | for (vn = VN_0; vn < E1HVN_MAX; vn++) | 2095 | if (bp->port.pmf) |
2086 | bnx2x_init_vn_minmax(bp, vn); | 2096 | for (vn = VN_0; vn < E1HVN_MAX; vn++) |
2097 | bnx2x_init_vn_minmax(bp, vn); | ||
2087 | 2098 | ||
2088 | /* always enable rate shaping and fairness */ | 2099 | /* always enable rate shaping and fairness */ |
2089 | bp->cmng.flags.cmng_enables |= | 2100 | bp->cmng.flags.cmng_enables |= |
@@ -2152,13 +2163,6 @@ static void bnx2x_link_attn(struct bnx2x *bp) | |||
2152 | bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP); | 2163 | bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP); |
2153 | } | 2164 | } |
2154 | 2165 | ||
2155 | /* indicate link status only if link status actually changed */ | ||
2156 | if (prev_link_status != bp->link_vars.link_status) | ||
2157 | bnx2x_link_report(bp); | ||
2158 | |||
2159 | if (IS_MF(bp)) | ||
2160 | bnx2x_link_sync_notify(bp); | ||
2161 | |||
2162 | if (bp->link_vars.link_up && bp->link_vars.line_speed) { | 2166 | if (bp->link_vars.link_up && bp->link_vars.line_speed) { |
2163 | int cmng_fns = bnx2x_get_cmng_fns_mode(bp); | 2167 | int cmng_fns = bnx2x_get_cmng_fns_mode(bp); |
2164 | 2168 | ||
@@ -2170,6 +2174,13 @@ static void bnx2x_link_attn(struct bnx2x *bp) | |||
2170 | DP(NETIF_MSG_IFUP, | 2174 | DP(NETIF_MSG_IFUP, |
2171 | "single function mode without fairness\n"); | 2175 | "single function mode without fairness\n"); |
2172 | } | 2176 | } |
2177 | |||
2178 | if (IS_MF(bp)) | ||
2179 | bnx2x_link_sync_notify(bp); | ||
2180 | |||
2181 | /* indicate link status only if link status actually changed */ | ||
2182 | if (prev_link_status != bp->link_vars.link_status) | ||
2183 | bnx2x_link_report(bp); | ||
2173 | } | 2184 | } |
2174 | 2185 | ||
2175 | void bnx2x__link_status_update(struct bnx2x *bp) | 2186 | void bnx2x__link_status_update(struct bnx2x *bp) |
diff --git a/drivers/net/bnx2x/bnx2x_stats.c b/drivers/net/bnx2x/bnx2x_stats.c index bda60d590fa8..3445ded6674f 100644 --- a/drivers/net/bnx2x/bnx2x_stats.c +++ b/drivers/net/bnx2x/bnx2x_stats.c | |||
@@ -1239,14 +1239,14 @@ void bnx2x_stats_handle(struct bnx2x *bp, enum bnx2x_stats_event event) | |||
1239 | if (unlikely(bp->panic)) | 1239 | if (unlikely(bp->panic)) |
1240 | return; | 1240 | return; |
1241 | 1241 | ||
1242 | bnx2x_stats_stm[bp->stats_state][event].action(bp); | ||
1243 | |||
1242 | /* Protect a state change flow */ | 1244 | /* Protect a state change flow */ |
1243 | spin_lock_bh(&bp->stats_lock); | 1245 | spin_lock_bh(&bp->stats_lock); |
1244 | state = bp->stats_state; | 1246 | state = bp->stats_state; |
1245 | bp->stats_state = bnx2x_stats_stm[state][event].next_state; | 1247 | bp->stats_state = bnx2x_stats_stm[state][event].next_state; |
1246 | spin_unlock_bh(&bp->stats_lock); | 1248 | spin_unlock_bh(&bp->stats_lock); |
1247 | 1249 | ||
1248 | bnx2x_stats_stm[state][event].action(bp); | ||
1249 | |||
1250 | if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp)) | 1250 | if ((event != STATS_EVENT_UPDATE) || netif_msg_timer(bp)) |
1251 | DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n", | 1251 | DP(BNX2X_MSG_STATS, "state %d -> event %d -> state %d\n", |
1252 | state, event, bp->stats_state); | 1252 | state, event, bp->stats_state); |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 1024ae158227..a5d5d0b5b155 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -281,23 +281,23 @@ static inline int __check_agg_selection_timer(struct port *port) | |||
281 | } | 281 | } |
282 | 282 | ||
283 | /** | 283 | /** |
284 | * __get_rx_machine_lock - lock the port's RX machine | 284 | * __get_state_machine_lock - lock the port's state machines |
285 | * @port: the port we're looking at | 285 | * @port: the port we're looking at |
286 | * | 286 | * |
287 | */ | 287 | */ |
288 | static inline void __get_rx_machine_lock(struct port *port) | 288 | static inline void __get_state_machine_lock(struct port *port) |
289 | { | 289 | { |
290 | spin_lock_bh(&(SLAVE_AD_INFO(port->slave).rx_machine_lock)); | 290 | spin_lock_bh(&(SLAVE_AD_INFO(port->slave).state_machine_lock)); |
291 | } | 291 | } |
292 | 292 | ||
293 | /** | 293 | /** |
294 | * __release_rx_machine_lock - unlock the port's RX machine | 294 | * __release_state_machine_lock - unlock the port's state machines |
295 | * @port: the port we're looking at | 295 | * @port: the port we're looking at |
296 | * | 296 | * |
297 | */ | 297 | */ |
298 | static inline void __release_rx_machine_lock(struct port *port) | 298 | static inline void __release_state_machine_lock(struct port *port) |
299 | { | 299 | { |
300 | spin_unlock_bh(&(SLAVE_AD_INFO(port->slave).rx_machine_lock)); | 300 | spin_unlock_bh(&(SLAVE_AD_INFO(port->slave).state_machine_lock)); |
301 | } | 301 | } |
302 | 302 | ||
303 | /** | 303 | /** |
@@ -388,14 +388,14 @@ static u8 __get_duplex(struct port *port) | |||
388 | } | 388 | } |
389 | 389 | ||
390 | /** | 390 | /** |
391 | * __initialize_port_locks - initialize a port's RX machine spinlock | 391 | * __initialize_port_locks - initialize a port's STATE machine spinlock |
392 | * @port: the port we're looking at | 392 | * @port: the port we're looking at |
393 | * | 393 | * |
394 | */ | 394 | */ |
395 | static inline void __initialize_port_locks(struct port *port) | 395 | static inline void __initialize_port_locks(struct port *port) |
396 | { | 396 | { |
397 | // make sure it isn't called twice | 397 | // make sure it isn't called twice |
398 | spin_lock_init(&(SLAVE_AD_INFO(port->slave).rx_machine_lock)); | 398 | spin_lock_init(&(SLAVE_AD_INFO(port->slave).state_machine_lock)); |
399 | } | 399 | } |
400 | 400 | ||
401 | //conversions | 401 | //conversions |
@@ -1025,9 +1025,6 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port) | |||
1025 | { | 1025 | { |
1026 | rx_states_t last_state; | 1026 | rx_states_t last_state; |
1027 | 1027 | ||
1028 | // Lock to prevent 2 instances of this function to run simultaneously(rx interrupt and periodic machine callback) | ||
1029 | __get_rx_machine_lock(port); | ||
1030 | |||
1031 | // keep current State Machine state to compare later if it was changed | 1028 | // keep current State Machine state to compare later if it was changed |
1032 | last_state = port->sm_rx_state; | 1029 | last_state = port->sm_rx_state; |
1033 | 1030 | ||
@@ -1133,7 +1130,6 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port) | |||
1133 | pr_err("%s: An illegal loopback occurred on adapter (%s).\n" | 1130 | pr_err("%s: An illegal loopback occurred on adapter (%s).\n" |
1134 | "Check the configuration to verify that all adapters are connected to 802.3ad compliant switch ports\n", | 1131 | "Check the configuration to verify that all adapters are connected to 802.3ad compliant switch ports\n", |
1135 | port->slave->dev->master->name, port->slave->dev->name); | 1132 | port->slave->dev->master->name, port->slave->dev->name); |
1136 | __release_rx_machine_lock(port); | ||
1137 | return; | 1133 | return; |
1138 | } | 1134 | } |
1139 | __update_selected(lacpdu, port); | 1135 | __update_selected(lacpdu, port); |
@@ -1153,7 +1149,6 @@ static void ad_rx_machine(struct lacpdu *lacpdu, struct port *port) | |||
1153 | break; | 1149 | break; |
1154 | } | 1150 | } |
1155 | } | 1151 | } |
1156 | __release_rx_machine_lock(port); | ||
1157 | } | 1152 | } |
1158 | 1153 | ||
1159 | /** | 1154 | /** |
@@ -2155,6 +2150,12 @@ void bond_3ad_state_machine_handler(struct work_struct *work) | |||
2155 | goto re_arm; | 2150 | goto re_arm; |
2156 | } | 2151 | } |
2157 | 2152 | ||
2153 | /* Lock around state machines to protect data accessed | ||
2154 | * by all (e.g., port->sm_vars). ad_rx_machine may run | ||
2155 | * concurrently due to incoming LACPDU. | ||
2156 | */ | ||
2157 | __get_state_machine_lock(port); | ||
2158 | |||
2158 | ad_rx_machine(NULL, port); | 2159 | ad_rx_machine(NULL, port); |
2159 | ad_periodic_machine(port); | 2160 | ad_periodic_machine(port); |
2160 | ad_port_selection_logic(port); | 2161 | ad_port_selection_logic(port); |
@@ -2164,6 +2165,8 @@ void bond_3ad_state_machine_handler(struct work_struct *work) | |||
2164 | // turn off the BEGIN bit, since we already handled it | 2165 | // turn off the BEGIN bit, since we already handled it |
2165 | if (port->sm_vars & AD_PORT_BEGIN) | 2166 | if (port->sm_vars & AD_PORT_BEGIN) |
2166 | port->sm_vars &= ~AD_PORT_BEGIN; | 2167 | port->sm_vars &= ~AD_PORT_BEGIN; |
2168 | |||
2169 | __release_state_machine_lock(port); | ||
2167 | } | 2170 | } |
2168 | 2171 | ||
2169 | re_arm: | 2172 | re_arm: |
@@ -2200,7 +2203,10 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u | |||
2200 | case AD_TYPE_LACPDU: | 2203 | case AD_TYPE_LACPDU: |
2201 | pr_debug("Received LACPDU on port %d\n", | 2204 | pr_debug("Received LACPDU on port %d\n", |
2202 | port->actor_port_number); | 2205 | port->actor_port_number); |
2206 | /* Protect against concurrent state machines */ | ||
2207 | __get_state_machine_lock(port); | ||
2203 | ad_rx_machine(lacpdu, port); | 2208 | ad_rx_machine(lacpdu, port); |
2209 | __release_state_machine_lock(port); | ||
2204 | break; | 2210 | break; |
2205 | 2211 | ||
2206 | case AD_TYPE_MARKER: | 2212 | case AD_TYPE_MARKER: |
diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h index 2c46a154f2c6..b28baff70864 100644 --- a/drivers/net/bonding/bond_3ad.h +++ b/drivers/net/bonding/bond_3ad.h | |||
@@ -264,7 +264,8 @@ struct ad_bond_info { | |||
264 | struct ad_slave_info { | 264 | struct ad_slave_info { |
265 | struct aggregator aggregator; // 802.3ad aggregator structure | 265 | struct aggregator aggregator; // 802.3ad aggregator structure |
266 | struct port port; // 802.3ad port structure | 266 | struct port port; // 802.3ad port structure |
267 | spinlock_t rx_machine_lock; // To avoid race condition between callback and receive interrupt | 267 | spinlock_t state_machine_lock; /* mutex state machines vs. |
268 | incoming LACPDU */ | ||
268 | u16 id; | 269 | u16 id; |
269 | }; | 270 | }; |
270 | 271 | ||
diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c index 5157e15e96eb..aeea9f9ff6e8 100644 --- a/drivers/net/can/softing/softing_main.c +++ b/drivers/net/can/softing/softing_main.c | |||
@@ -633,6 +633,7 @@ static const struct net_device_ops softing_netdev_ops = { | |||
633 | }; | 633 | }; |
634 | 634 | ||
635 | static const struct can_bittiming_const softing_btr_const = { | 635 | static const struct can_bittiming_const softing_btr_const = { |
636 | .name = "softing", | ||
636 | .tseg1_min = 1, | 637 | .tseg1_min = 1, |
637 | .tseg1_max = 16, | 638 | .tseg1_max = 16, |
638 | .tseg2_min = 1, | 639 | .tseg2_min = 1, |
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index 7ff170cbc7dc..302be4aa69d6 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -2760,6 +2760,8 @@ static u32 cnic_service_bnx2_queues(struct cnic_dev *dev) | |||
2760 | u32 status_idx = (u16) *cp->kcq1.status_idx_ptr; | 2760 | u32 status_idx = (u16) *cp->kcq1.status_idx_ptr; |
2761 | int kcqe_cnt; | 2761 | int kcqe_cnt; |
2762 | 2762 | ||
2763 | /* status block index must be read before reading other fields */ | ||
2764 | rmb(); | ||
2763 | cp->kwq_con_idx = *cp->kwq_con_idx_ptr; | 2765 | cp->kwq_con_idx = *cp->kwq_con_idx_ptr; |
2764 | 2766 | ||
2765 | while ((kcqe_cnt = cnic_get_kcqes(dev, &cp->kcq1))) { | 2767 | while ((kcqe_cnt = cnic_get_kcqes(dev, &cp->kcq1))) { |
@@ -2770,6 +2772,8 @@ static u32 cnic_service_bnx2_queues(struct cnic_dev *dev) | |||
2770 | barrier(); | 2772 | barrier(); |
2771 | if (status_idx != *cp->kcq1.status_idx_ptr) { | 2773 | if (status_idx != *cp->kcq1.status_idx_ptr) { |
2772 | status_idx = (u16) *cp->kcq1.status_idx_ptr; | 2774 | status_idx = (u16) *cp->kcq1.status_idx_ptr; |
2775 | /* status block index must be read first */ | ||
2776 | rmb(); | ||
2773 | cp->kwq_con_idx = *cp->kwq_con_idx_ptr; | 2777 | cp->kwq_con_idx = *cp->kwq_con_idx_ptr; |
2774 | } else | 2778 | } else |
2775 | break; | 2779 | break; |
@@ -2888,6 +2892,8 @@ static u32 cnic_service_bnx2x_kcq(struct cnic_dev *dev, struct kcq_info *info) | |||
2888 | u32 last_status = *info->status_idx_ptr; | 2892 | u32 last_status = *info->status_idx_ptr; |
2889 | int kcqe_cnt; | 2893 | int kcqe_cnt; |
2890 | 2894 | ||
2895 | /* status block index must be read before reading the KCQ */ | ||
2896 | rmb(); | ||
2891 | while ((kcqe_cnt = cnic_get_kcqes(dev, info))) { | 2897 | while ((kcqe_cnt = cnic_get_kcqes(dev, info))) { |
2892 | 2898 | ||
2893 | service_kcqes(dev, kcqe_cnt); | 2899 | service_kcqes(dev, kcqe_cnt); |
@@ -2898,6 +2904,8 @@ static u32 cnic_service_bnx2x_kcq(struct cnic_dev *dev, struct kcq_info *info) | |||
2898 | break; | 2904 | break; |
2899 | 2905 | ||
2900 | last_status = *info->status_idx_ptr; | 2906 | last_status = *info->status_idx_ptr; |
2907 | /* status block index must be read before reading the KCQ */ | ||
2908 | rmb(); | ||
2901 | } | 2909 | } |
2902 | return last_status; | 2910 | return last_status; |
2903 | } | 2911 | } |
@@ -2906,26 +2914,35 @@ static void cnic_service_bnx2x_bh(unsigned long data) | |||
2906 | { | 2914 | { |
2907 | struct cnic_dev *dev = (struct cnic_dev *) data; | 2915 | struct cnic_dev *dev = (struct cnic_dev *) data; |
2908 | struct cnic_local *cp = dev->cnic_priv; | 2916 | struct cnic_local *cp = dev->cnic_priv; |
2909 | u32 status_idx; | 2917 | u32 status_idx, new_status_idx; |
2910 | 2918 | ||
2911 | if (unlikely(!test_bit(CNIC_F_CNIC_UP, &dev->flags))) | 2919 | if (unlikely(!test_bit(CNIC_F_CNIC_UP, &dev->flags))) |
2912 | return; | 2920 | return; |
2913 | 2921 | ||
2914 | status_idx = cnic_service_bnx2x_kcq(dev, &cp->kcq1); | 2922 | while (1) { |
2923 | status_idx = cnic_service_bnx2x_kcq(dev, &cp->kcq1); | ||
2915 | 2924 | ||
2916 | CNIC_WR16(dev, cp->kcq1.io_addr, cp->kcq1.sw_prod_idx + MAX_KCQ_IDX); | 2925 | CNIC_WR16(dev, cp->kcq1.io_addr, |
2926 | cp->kcq1.sw_prod_idx + MAX_KCQ_IDX); | ||
2917 | 2927 | ||
2918 | if (BNX2X_CHIP_IS_E2(cp->chip_id)) { | 2928 | if (!BNX2X_CHIP_IS_E2(cp->chip_id)) { |
2919 | status_idx = cnic_service_bnx2x_kcq(dev, &cp->kcq2); | 2929 | cnic_ack_bnx2x_int(dev, cp->bnx2x_igu_sb_id, USTORM_ID, |
2930 | status_idx, IGU_INT_ENABLE, 1); | ||
2931 | break; | ||
2932 | } | ||
2933 | |||
2934 | new_status_idx = cnic_service_bnx2x_kcq(dev, &cp->kcq2); | ||
2935 | |||
2936 | if (new_status_idx != status_idx) | ||
2937 | continue; | ||
2920 | 2938 | ||
2921 | CNIC_WR16(dev, cp->kcq2.io_addr, cp->kcq2.sw_prod_idx + | 2939 | CNIC_WR16(dev, cp->kcq2.io_addr, cp->kcq2.sw_prod_idx + |
2922 | MAX_KCQ_IDX); | 2940 | MAX_KCQ_IDX); |
2923 | 2941 | ||
2924 | cnic_ack_igu_sb(dev, cp->bnx2x_igu_sb_id, IGU_SEG_ACCESS_DEF, | 2942 | cnic_ack_igu_sb(dev, cp->bnx2x_igu_sb_id, IGU_SEG_ACCESS_DEF, |
2925 | status_idx, IGU_INT_ENABLE, 1); | 2943 | status_idx, IGU_INT_ENABLE, 1); |
2926 | } else { | 2944 | |
2927 | cnic_ack_bnx2x_int(dev, cp->bnx2x_igu_sb_id, USTORM_ID, | 2945 | break; |
2928 | status_idx, IGU_INT_ENABLE, 1); | ||
2929 | } | 2946 | } |
2930 | } | 2947 | } |
2931 | 2948 | ||
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 2a628d17d178..7018bfe408a4 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -1008,7 +1008,7 @@ static void emac_rx_handler(void *token, int len, int status) | |||
1008 | int ret; | 1008 | int ret; |
1009 | 1009 | ||
1010 | /* free and bail if we are shutting down */ | 1010 | /* free and bail if we are shutting down */ |
1011 | if (unlikely(!netif_running(ndev))) { | 1011 | if (unlikely(!netif_running(ndev) || !netif_carrier_ok(ndev))) { |
1012 | dev_kfree_skb_any(skb); | 1012 | dev_kfree_skb_any(skb); |
1013 | return; | 1013 | return; |
1014 | } | 1014 | } |
diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c index 2d4c4fc1d900..461dd6f905f7 100644 --- a/drivers/net/dm9000.c +++ b/drivers/net/dm9000.c | |||
@@ -802,10 +802,7 @@ dm9000_init_dm9000(struct net_device *dev) | |||
802 | /* Checksum mode */ | 802 | /* Checksum mode */ |
803 | dm9000_set_rx_csum_unlocked(dev, db->rx_csum); | 803 | dm9000_set_rx_csum_unlocked(dev, db->rx_csum); |
804 | 804 | ||
805 | /* GPIO0 on pre-activate PHY */ | ||
806 | iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */ | ||
807 | iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ | 805 | iow(db, DM9000_GPCR, GPCR_GEP_CNTL); /* Let GPIO0 output */ |
808 | iow(db, DM9000_GPR, 0); /* Enable PHY */ | ||
809 | 806 | ||
810 | ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0; | 807 | ncr = (db->flags & DM9000_PLATF_EXT_PHY) ? NCR_EXT_PHY : 0; |
811 | 808 | ||
@@ -852,8 +849,8 @@ static void dm9000_timeout(struct net_device *dev) | |||
852 | unsigned long flags; | 849 | unsigned long flags; |
853 | 850 | ||
854 | /* Save previous register address */ | 851 | /* Save previous register address */ |
855 | reg_save = readb(db->io_addr); | ||
856 | spin_lock_irqsave(&db->lock, flags); | 852 | spin_lock_irqsave(&db->lock, flags); |
853 | reg_save = readb(db->io_addr); | ||
857 | 854 | ||
858 | netif_stop_queue(dev); | 855 | netif_stop_queue(dev); |
859 | dm9000_reset(db); | 856 | dm9000_reset(db); |
@@ -1194,6 +1191,10 @@ dm9000_open(struct net_device *dev) | |||
1194 | if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev)) | 1191 | if (request_irq(dev->irq, dm9000_interrupt, irqflags, dev->name, dev)) |
1195 | return -EAGAIN; | 1192 | return -EAGAIN; |
1196 | 1193 | ||
1194 | /* GPIO0 on pre-activate PHY, Reg 1F is not set by reset */ | ||
1195 | iow(db, DM9000_GPR, 0); /* REG_1F bit0 activate phyxcer */ | ||
1196 | mdelay(1); /* delay needs by DM9000B */ | ||
1197 | |||
1197 | /* Initialize DM9000 board */ | 1198 | /* Initialize DM9000 board */ |
1198 | dm9000_reset(db); | 1199 | dm9000_reset(db); |
1199 | dm9000_init_dm9000(dev); | 1200 | dm9000_init_dm9000(dev); |
diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c index 9d8a20b72fa9..8318ea06cb6d 100644 --- a/drivers/net/dnet.c +++ b/drivers/net/dnet.c | |||
@@ -337,8 +337,6 @@ static int dnet_mii_init(struct dnet *bp) | |||
337 | for (i = 0; i < PHY_MAX_ADDR; i++) | 337 | for (i = 0; i < PHY_MAX_ADDR; i++) |
338 | bp->mii_bus->irq[i] = PHY_POLL; | 338 | bp->mii_bus->irq[i] = PHY_POLL; |
339 | 339 | ||
340 | platform_set_drvdata(bp->dev, bp->mii_bus); | ||
341 | |||
342 | if (mdiobus_register(bp->mii_bus)) { | 340 | if (mdiobus_register(bp->mii_bus)) { |
343 | err = -ENXIO; | 341 | err = -ENXIO; |
344 | goto err_out_free_mdio_irq; | 342 | goto err_out_free_mdio_irq; |
@@ -863,6 +861,7 @@ static int __devinit dnet_probe(struct platform_device *pdev) | |||
863 | bp = netdev_priv(dev); | 861 | bp = netdev_priv(dev); |
864 | bp->dev = dev; | 862 | bp->dev = dev; |
865 | 863 | ||
864 | platform_set_drvdata(pdev, dev); | ||
866 | SET_NETDEV_DEV(dev, &pdev->dev); | 865 | SET_NETDEV_DEV(dev, &pdev->dev); |
867 | 866 | ||
868 | spin_lock_init(&bp->lock); | 867 | spin_lock_init(&bp->lock); |
diff --git a/drivers/net/e1000/e1000_osdep.h b/drivers/net/e1000/e1000_osdep.h index 55c1711f1688..33e7c45a4fe4 100644 --- a/drivers/net/e1000/e1000_osdep.h +++ b/drivers/net/e1000/e1000_osdep.h | |||
@@ -42,7 +42,8 @@ | |||
42 | #define GBE_CONFIG_RAM_BASE \ | 42 | #define GBE_CONFIG_RAM_BASE \ |
43 | ((unsigned int)(CONFIG_RAM_BASE + GBE_CONFIG_OFFSET)) | 43 | ((unsigned int)(CONFIG_RAM_BASE + GBE_CONFIG_OFFSET)) |
44 | 44 | ||
45 | #define GBE_CONFIG_BASE_VIRT phys_to_virt(GBE_CONFIG_RAM_BASE) | 45 | #define GBE_CONFIG_BASE_VIRT \ |
46 | ((void __iomem *)phys_to_virt(GBE_CONFIG_RAM_BASE)) | ||
46 | 47 | ||
47 | #define GBE_CONFIG_FLASH_WRITE(base, offset, count, data) \ | 48 | #define GBE_CONFIG_FLASH_WRITE(base, offset, count, data) \ |
48 | (iowrite16_rep(base + offset, data, count)) | 49 | (iowrite16_rep(base + offset, data, count)) |
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c index 3fa110ddb041..2e5022849f18 100644 --- a/drivers/net/e1000e/netdev.c +++ b/drivers/net/e1000e/netdev.c | |||
@@ -5967,7 +5967,8 @@ static int __devinit e1000_probe(struct pci_dev *pdev, | |||
5967 | /* APME bit in EEPROM is mapped to WUC.APME */ | 5967 | /* APME bit in EEPROM is mapped to WUC.APME */ |
5968 | eeprom_data = er32(WUC); | 5968 | eeprom_data = er32(WUC); |
5969 | eeprom_apme_mask = E1000_WUC_APME; | 5969 | eeprom_apme_mask = E1000_WUC_APME; |
5970 | if (eeprom_data & E1000_WUC_PHY_WAKE) | 5970 | if ((hw->mac.type > e1000_ich10lan) && |
5971 | (eeprom_data & E1000_WUC_PHY_WAKE)) | ||
5971 | adapter->flags2 |= FLAG2_HAS_PHY_WAKEUP; | 5972 | adapter->flags2 |= FLAG2_HAS_PHY_WAKEUP; |
5972 | } else if (adapter->flags & FLAG_APME_IN_CTRL3) { | 5973 | } else if (adapter->flags & FLAG_APME_IN_CTRL3) { |
5973 | if (adapter->flags & FLAG_APME_CHECK_PORT_B && | 5974 | if (adapter->flags & FLAG_APME_CHECK_PORT_B && |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 2a71373719ae..cd0282d5d40f 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -74,7 +74,8 @@ static struct platform_device_id fec_devtype[] = { | |||
74 | }, { | 74 | }, { |
75 | .name = "imx28-fec", | 75 | .name = "imx28-fec", |
76 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME, | 76 | .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME, |
77 | } | 77 | }, |
78 | { } | ||
78 | }; | 79 | }; |
79 | 80 | ||
80 | static unsigned char macaddr[ETH_ALEN]; | 81 | static unsigned char macaddr[ETH_ALEN]; |
diff --git a/drivers/net/igbvf/vf.c b/drivers/net/igbvf/vf.c index 74486a8b009a..af3822f9ea9a 100644 --- a/drivers/net/igbvf/vf.c +++ b/drivers/net/igbvf/vf.c | |||
@@ -220,7 +220,7 @@ static u32 e1000_hash_mc_addr_vf(struct e1000_hw *hw, u8 *mc_addr) | |||
220 | * The parameter rar_count will usually be hw->mac.rar_entry_count | 220 | * The parameter rar_count will usually be hw->mac.rar_entry_count |
221 | * unless there are workarounds that change this. | 221 | * unless there are workarounds that change this. |
222 | **/ | 222 | **/ |
223 | void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, | 223 | static void e1000_update_mc_addr_list_vf(struct e1000_hw *hw, |
224 | u8 *mc_addr_list, u32 mc_addr_count, | 224 | u8 *mc_addr_list, u32 mc_addr_count, |
225 | u32 rar_used_count, u32 rar_count) | 225 | u32 rar_used_count, u32 rar_count) |
226 | { | 226 | { |
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index f69e73e2191e..79ccb54ab00c 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -260,7 +260,7 @@ static int macb_mii_init(struct macb *bp) | |||
260 | for (i = 0; i < PHY_MAX_ADDR; i++) | 260 | for (i = 0; i < PHY_MAX_ADDR; i++) |
261 | bp->mii_bus->irq[i] = PHY_POLL; | 261 | bp->mii_bus->irq[i] = PHY_POLL; |
262 | 262 | ||
263 | platform_set_drvdata(bp->dev, bp->mii_bus); | 263 | dev_set_drvdata(&bp->dev->dev, bp->mii_bus); |
264 | 264 | ||
265 | if (mdiobus_register(bp->mii_bus)) | 265 | if (mdiobus_register(bp->mii_bus)) |
266 | goto err_out_free_mdio_irq; | 266 | goto err_out_free_mdio_irq; |
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 5933621ac3ff..fc27a9926d9e 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -528,8 +528,9 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, | |||
528 | vnet_hdr_len = q->vnet_hdr_sz; | 528 | vnet_hdr_len = q->vnet_hdr_sz; |
529 | 529 | ||
530 | err = -EINVAL; | 530 | err = -EINVAL; |
531 | if ((len -= vnet_hdr_len) < 0) | 531 | if (len < vnet_hdr_len) |
532 | goto err; | 532 | goto err; |
533 | len -= vnet_hdr_len; | ||
533 | 534 | ||
534 | err = memcpy_fromiovecend((void *)&vnet_hdr, iv, 0, | 535 | err = memcpy_fromiovecend((void *)&vnet_hdr, iv, 0, |
535 | sizeof(vnet_hdr)); | 536 | sizeof(vnet_hdr)); |
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 9226cda4d054..530ab5a10bd3 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
@@ -691,6 +691,7 @@ static struct pcmcia_device_id fmvj18x_ids[] = { | |||
691 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0x0e0a), | 691 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0105, 0x0e0a), |
692 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x0e01), | 692 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x0e01), |
693 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x0a05), | 693 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x0a05), |
694 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x0b05), | ||
694 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x1101), | 695 | PCMCIA_PFC_DEVICE_MANF_CARD(0, 0x0032, 0x1101), |
695 | PCMCIA_DEVICE_NULL, | 696 | PCMCIA_DEVICE_NULL, |
696 | }; | 697 | }; |
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c index 27e6f6d43cac..e3ebd90ae651 100644 --- a/drivers/net/r6040.c +++ b/drivers/net/r6040.c | |||
@@ -49,8 +49,8 @@ | |||
49 | #include <asm/processor.h> | 49 | #include <asm/processor.h> |
50 | 50 | ||
51 | #define DRV_NAME "r6040" | 51 | #define DRV_NAME "r6040" |
52 | #define DRV_VERSION "0.26" | 52 | #define DRV_VERSION "0.27" |
53 | #define DRV_RELDATE "30May2010" | 53 | #define DRV_RELDATE "23Feb2011" |
54 | 54 | ||
55 | /* PHY CHIP Address */ | 55 | /* PHY CHIP Address */ |
56 | #define PHY1_ADDR 1 /* For MAC1 */ | 56 | #define PHY1_ADDR 1 /* For MAC1 */ |
@@ -69,6 +69,8 @@ | |||
69 | 69 | ||
70 | /* MAC registers */ | 70 | /* MAC registers */ |
71 | #define MCR0 0x00 /* Control register 0 */ | 71 | #define MCR0 0x00 /* Control register 0 */ |
72 | #define MCR0_PROMISC 0x0020 /* Promiscuous mode */ | ||
73 | #define MCR0_HASH_EN 0x0100 /* Enable multicast hash table function */ | ||
72 | #define MCR1 0x04 /* Control register 1 */ | 74 | #define MCR1 0x04 /* Control register 1 */ |
73 | #define MAC_RST 0x0001 /* Reset the MAC */ | 75 | #define MAC_RST 0x0001 /* Reset the MAC */ |
74 | #define MBCR 0x08 /* Bus control */ | 76 | #define MBCR 0x08 /* Bus control */ |
@@ -851,77 +853,92 @@ static void r6040_multicast_list(struct net_device *dev) | |||
851 | { | 853 | { |
852 | struct r6040_private *lp = netdev_priv(dev); | 854 | struct r6040_private *lp = netdev_priv(dev); |
853 | void __iomem *ioaddr = lp->base; | 855 | void __iomem *ioaddr = lp->base; |
854 | u16 *adrp; | ||
855 | u16 reg; | ||
856 | unsigned long flags; | 856 | unsigned long flags; |
857 | struct netdev_hw_addr *ha; | 857 | struct netdev_hw_addr *ha; |
858 | int i; | 858 | int i; |
859 | u16 *adrp; | ||
860 | u16 hash_table[4] = { 0 }; | ||
861 | |||
862 | spin_lock_irqsave(&lp->lock, flags); | ||
859 | 863 | ||
860 | /* MAC Address */ | 864 | /* Keep our MAC Address */ |
861 | adrp = (u16 *)dev->dev_addr; | 865 | adrp = (u16 *)dev->dev_addr; |
862 | iowrite16(adrp[0], ioaddr + MID_0L); | 866 | iowrite16(adrp[0], ioaddr + MID_0L); |
863 | iowrite16(adrp[1], ioaddr + MID_0M); | 867 | iowrite16(adrp[1], ioaddr + MID_0M); |
864 | iowrite16(adrp[2], ioaddr + MID_0H); | 868 | iowrite16(adrp[2], ioaddr + MID_0H); |
865 | 869 | ||
866 | /* Promiscous Mode */ | ||
867 | spin_lock_irqsave(&lp->lock, flags); | ||
868 | |||
869 | /* Clear AMCP & PROM bits */ | 870 | /* Clear AMCP & PROM bits */ |
870 | reg = ioread16(ioaddr) & ~0x0120; | 871 | lp->mcr0 = ioread16(ioaddr + MCR0) & ~(MCR0_PROMISC | MCR0_HASH_EN); |
871 | if (dev->flags & IFF_PROMISC) { | ||
872 | reg |= 0x0020; | ||
873 | lp->mcr0 |= 0x0020; | ||
874 | } | ||
875 | /* Too many multicast addresses | ||
876 | * accept all traffic */ | ||
877 | else if ((netdev_mc_count(dev) > MCAST_MAX) || | ||
878 | (dev->flags & IFF_ALLMULTI)) | ||
879 | reg |= 0x0020; | ||
880 | 872 | ||
881 | iowrite16(reg, ioaddr); | 873 | /* Promiscuous mode */ |
882 | spin_unlock_irqrestore(&lp->lock, flags); | 874 | if (dev->flags & IFF_PROMISC) |
875 | lp->mcr0 |= MCR0_PROMISC; | ||
883 | 876 | ||
884 | /* Build the hash table */ | 877 | /* Enable multicast hash table function to |
885 | if (netdev_mc_count(dev) > MCAST_MAX) { | 878 | * receive all multicast packets. */ |
886 | u16 hash_table[4]; | 879 | else if (dev->flags & IFF_ALLMULTI) { |
887 | u32 crc; | 880 | lp->mcr0 |= MCR0_HASH_EN; |
888 | 881 | ||
889 | for (i = 0; i < 4; i++) | 882 | for (i = 0; i < MCAST_MAX ; i++) { |
890 | hash_table[i] = 0; | 883 | iowrite16(0, ioaddr + MID_1L + 8 * i); |
884 | iowrite16(0, ioaddr + MID_1M + 8 * i); | ||
885 | iowrite16(0, ioaddr + MID_1H + 8 * i); | ||
886 | } | ||
891 | 887 | ||
888 | for (i = 0; i < 4; i++) | ||
889 | hash_table[i] = 0xffff; | ||
890 | } | ||
891 | /* Use internal multicast address registers if the number of | ||
892 | * multicast addresses is not greater than MCAST_MAX. */ | ||
893 | else if (netdev_mc_count(dev) <= MCAST_MAX) { | ||
894 | i = 0; | ||
892 | netdev_for_each_mc_addr(ha, dev) { | 895 | netdev_for_each_mc_addr(ha, dev) { |
893 | char *addrs = ha->addr; | 896 | u16 *adrp = (u16 *) ha->addr; |
897 | iowrite16(adrp[0], ioaddr + MID_1L + 8 * i); | ||
898 | iowrite16(adrp[1], ioaddr + MID_1M + 8 * i); | ||
899 | iowrite16(adrp[2], ioaddr + MID_1H + 8 * i); | ||
900 | i++; | ||
901 | } | ||
902 | while (i < MCAST_MAX) { | ||
903 | iowrite16(0, ioaddr + MID_1L + 8 * i); | ||
904 | iowrite16(0, ioaddr + MID_1M + 8 * i); | ||
905 | iowrite16(0, ioaddr + MID_1H + 8 * i); | ||
906 | i++; | ||
907 | } | ||
908 | } | ||
909 | /* Otherwise, Enable multicast hash table function. */ | ||
910 | else { | ||
911 | u32 crc; | ||
894 | 912 | ||
895 | if (!(*addrs & 1)) | 913 | lp->mcr0 |= MCR0_HASH_EN; |
896 | continue; | 914 | |
915 | for (i = 0; i < MCAST_MAX ; i++) { | ||
916 | iowrite16(0, ioaddr + MID_1L + 8 * i); | ||
917 | iowrite16(0, ioaddr + MID_1M + 8 * i); | ||
918 | iowrite16(0, ioaddr + MID_1H + 8 * i); | ||
919 | } | ||
897 | 920 | ||
898 | crc = ether_crc_le(6, addrs); | 921 | /* Build multicast hash table */ |
922 | netdev_for_each_mc_addr(ha, dev) { | ||
923 | u8 *addrs = ha->addr; | ||
924 | |||
925 | crc = ether_crc(ETH_ALEN, addrs); | ||
899 | crc >>= 26; | 926 | crc >>= 26; |
900 | hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf)); | 927 | hash_table[crc >> 4] |= 1 << (crc & 0xf); |
901 | } | 928 | } |
902 | /* Fill the MAC hash tables with their values */ | 929 | } |
930 | |||
931 | iowrite16(lp->mcr0, ioaddr + MCR0); | ||
932 | |||
933 | /* Fill the MAC hash tables with their values */ | ||
934 | if (lp->mcr0 && MCR0_HASH_EN) { | ||
903 | iowrite16(hash_table[0], ioaddr + MAR0); | 935 | iowrite16(hash_table[0], ioaddr + MAR0); |
904 | iowrite16(hash_table[1], ioaddr + MAR1); | 936 | iowrite16(hash_table[1], ioaddr + MAR1); |
905 | iowrite16(hash_table[2], ioaddr + MAR2); | 937 | iowrite16(hash_table[2], ioaddr + MAR2); |
906 | iowrite16(hash_table[3], ioaddr + MAR3); | 938 | iowrite16(hash_table[3], ioaddr + MAR3); |
907 | } | 939 | } |
908 | /* Multicast Address 1~4 case */ | 940 | |
909 | i = 0; | 941 | spin_unlock_irqrestore(&lp->lock, flags); |
910 | netdev_for_each_mc_addr(ha, dev) { | ||
911 | if (i >= MCAST_MAX) | ||
912 | break; | ||
913 | adrp = (u16 *) ha->addr; | ||
914 | iowrite16(adrp[0], ioaddr + MID_1L + 8 * i); | ||
915 | iowrite16(adrp[1], ioaddr + MID_1M + 8 * i); | ||
916 | iowrite16(adrp[2], ioaddr + MID_1H + 8 * i); | ||
917 | i++; | ||
918 | } | ||
919 | while (i < MCAST_MAX) { | ||
920 | iowrite16(0xffff, ioaddr + MID_1L + 8 * i); | ||
921 | iowrite16(0xffff, ioaddr + MID_1M + 8 * i); | ||
922 | iowrite16(0xffff, ioaddr + MID_1H + 8 * i); | ||
923 | i++; | ||
924 | } | ||
925 | } | 942 | } |
926 | 943 | ||
927 | static void netdev_get_drvinfo(struct net_device *dev, | 944 | static void netdev_get_drvinfo(struct net_device *dev, |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 469ab0b7ce31..7ffdb80adf40 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/dma-mapping.h> | 25 | #include <linux/dma-mapping.h> |
26 | #include <linux/pm_runtime.h> | 26 | #include <linux/pm_runtime.h> |
27 | #include <linux/firmware.h> | 27 | #include <linux/firmware.h> |
28 | #include <linux/pci-aspm.h> | ||
28 | 29 | ||
29 | #include <asm/system.h> | 30 | #include <asm/system.h> |
30 | #include <asm/io.h> | 31 | #include <asm/io.h> |
@@ -617,8 +618,9 @@ static void ocp_write(struct rtl8169_private *tp, u8 mask, u16 reg, u32 data) | |||
617 | } | 618 | } |
618 | } | 619 | } |
619 | 620 | ||
620 | static void rtl8168_oob_notify(void __iomem *ioaddr, u8 cmd) | 621 | static void rtl8168_oob_notify(struct rtl8169_private *tp, u8 cmd) |
621 | { | 622 | { |
623 | void __iomem *ioaddr = tp->mmio_addr; | ||
622 | int i; | 624 | int i; |
623 | 625 | ||
624 | RTL_W8(ERIDR, cmd); | 626 | RTL_W8(ERIDR, cmd); |
@@ -630,7 +632,7 @@ static void rtl8168_oob_notify(void __iomem *ioaddr, u8 cmd) | |||
630 | break; | 632 | break; |
631 | } | 633 | } |
632 | 634 | ||
633 | ocp_write(ioaddr, 0x1, 0x30, 0x00000001); | 635 | ocp_write(tp, 0x1, 0x30, 0x00000001); |
634 | } | 636 | } |
635 | 637 | ||
636 | #define OOB_CMD_RESET 0x00 | 638 | #define OOB_CMD_RESET 0x00 |
@@ -2868,8 +2870,11 @@ static void r8168_pll_power_down(struct rtl8169_private *tp) | |||
2868 | { | 2870 | { |
2869 | void __iomem *ioaddr = tp->mmio_addr; | 2871 | void __iomem *ioaddr = tp->mmio_addr; |
2870 | 2872 | ||
2871 | if (tp->mac_version == RTL_GIGA_MAC_VER_27) | 2873 | if (((tp->mac_version == RTL_GIGA_MAC_VER_27) || |
2874 | (tp->mac_version == RTL_GIGA_MAC_VER_28)) && | ||
2875 | (ocp_read(tp, 0x0f, 0x0010) & 0x00008000)) { | ||
2872 | return; | 2876 | return; |
2877 | } | ||
2873 | 2878 | ||
2874 | if (((tp->mac_version == RTL_GIGA_MAC_VER_23) || | 2879 | if (((tp->mac_version == RTL_GIGA_MAC_VER_23) || |
2875 | (tp->mac_version == RTL_GIGA_MAC_VER_24)) && | 2880 | (tp->mac_version == RTL_GIGA_MAC_VER_24)) && |
@@ -2891,6 +2896,8 @@ static void r8168_pll_power_down(struct rtl8169_private *tp) | |||
2891 | switch (tp->mac_version) { | 2896 | switch (tp->mac_version) { |
2892 | case RTL_GIGA_MAC_VER_25: | 2897 | case RTL_GIGA_MAC_VER_25: |
2893 | case RTL_GIGA_MAC_VER_26: | 2898 | case RTL_GIGA_MAC_VER_26: |
2899 | case RTL_GIGA_MAC_VER_27: | ||
2900 | case RTL_GIGA_MAC_VER_28: | ||
2894 | RTL_W8(PMCH, RTL_R8(PMCH) & ~0x80); | 2901 | RTL_W8(PMCH, RTL_R8(PMCH) & ~0x80); |
2895 | break; | 2902 | break; |
2896 | } | 2903 | } |
@@ -2900,12 +2907,17 @@ static void r8168_pll_power_up(struct rtl8169_private *tp) | |||
2900 | { | 2907 | { |
2901 | void __iomem *ioaddr = tp->mmio_addr; | 2908 | void __iomem *ioaddr = tp->mmio_addr; |
2902 | 2909 | ||
2903 | if (tp->mac_version == RTL_GIGA_MAC_VER_27) | 2910 | if (((tp->mac_version == RTL_GIGA_MAC_VER_27) || |
2911 | (tp->mac_version == RTL_GIGA_MAC_VER_28)) && | ||
2912 | (ocp_read(tp, 0x0f, 0x0010) & 0x00008000)) { | ||
2904 | return; | 2913 | return; |
2914 | } | ||
2905 | 2915 | ||
2906 | switch (tp->mac_version) { | 2916 | switch (tp->mac_version) { |
2907 | case RTL_GIGA_MAC_VER_25: | 2917 | case RTL_GIGA_MAC_VER_25: |
2908 | case RTL_GIGA_MAC_VER_26: | 2918 | case RTL_GIGA_MAC_VER_26: |
2919 | case RTL_GIGA_MAC_VER_27: | ||
2920 | case RTL_GIGA_MAC_VER_28: | ||
2909 | RTL_W8(PMCH, RTL_R8(PMCH) | 0x80); | 2921 | RTL_W8(PMCH, RTL_R8(PMCH) | 0x80); |
2910 | break; | 2922 | break; |
2911 | } | 2923 | } |
@@ -3009,6 +3021,11 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3009 | mii->reg_num_mask = 0x1f; | 3021 | mii->reg_num_mask = 0x1f; |
3010 | mii->supports_gmii = !!(cfg->features & RTL_FEATURE_GMII); | 3022 | mii->supports_gmii = !!(cfg->features & RTL_FEATURE_GMII); |
3011 | 3023 | ||
3024 | /* disable ASPM completely as that cause random device stop working | ||
3025 | * problems as well as full system hangs for some PCIe devices users */ | ||
3026 | pci_disable_link_state(pdev, PCIE_LINK_STATE_L0S | PCIE_LINK_STATE_L1 | | ||
3027 | PCIE_LINK_STATE_CLKPM); | ||
3028 | |||
3012 | /* enable device (incl. PCI PM wakeup and hotplug setup) */ | 3029 | /* enable device (incl. PCI PM wakeup and hotplug setup) */ |
3013 | rc = pci_enable_device(pdev); | 3030 | rc = pci_enable_device(pdev); |
3014 | if (rc < 0) { | 3031 | if (rc < 0) { |
@@ -3042,7 +3059,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
3042 | goto err_out_mwi_2; | 3059 | goto err_out_mwi_2; |
3043 | } | 3060 | } |
3044 | 3061 | ||
3045 | tp->cp_cmd = PCIMulRW | RxChkSum; | 3062 | tp->cp_cmd = RxChkSum; |
3046 | 3063 | ||
3047 | if ((sizeof(dma_addr_t) > 4) && | 3064 | if ((sizeof(dma_addr_t) > 4) && |
3048 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { | 3065 | !pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) && use_dac) { |
@@ -3318,7 +3335,8 @@ static void rtl8169_hw_reset(struct rtl8169_private *tp) | |||
3318 | /* Disable interrupts */ | 3335 | /* Disable interrupts */ |
3319 | rtl8169_irq_mask_and_ack(ioaddr); | 3336 | rtl8169_irq_mask_and_ack(ioaddr); |
3320 | 3337 | ||
3321 | if (tp->mac_version == RTL_GIGA_MAC_VER_28) { | 3338 | if (tp->mac_version == RTL_GIGA_MAC_VER_27 || |
3339 | tp->mac_version == RTL_GIGA_MAC_VER_28) { | ||
3322 | while (RTL_R8(TxPoll) & NPQ) | 3340 | while (RTL_R8(TxPoll) & NPQ) |
3323 | udelay(20); | 3341 | udelay(20); |
3324 | 3342 | ||
@@ -3847,8 +3865,7 @@ static void rtl_hw_start_8168(struct net_device *dev) | |||
3847 | Cxpl_dbg_sel | \ | 3865 | Cxpl_dbg_sel | \ |
3848 | ASF | \ | 3866 | ASF | \ |
3849 | PktCntrDisable | \ | 3867 | PktCntrDisable | \ |
3850 | PCIDAC | \ | 3868 | Mac_dbgo_sel) |
3851 | PCIMulRW) | ||
3852 | 3869 | ||
3853 | static void rtl_hw_start_8102e_1(void __iomem *ioaddr, struct pci_dev *pdev) | 3870 | static void rtl_hw_start_8102e_1(void __iomem *ioaddr, struct pci_dev *pdev) |
3854 | { | 3871 | { |
@@ -3878,8 +3895,6 @@ static void rtl_hw_start_8102e_1(void __iomem *ioaddr, struct pci_dev *pdev) | |||
3878 | if ((cfg1 & LEDS0) && (cfg1 & LEDS1)) | 3895 | if ((cfg1 & LEDS0) && (cfg1 & LEDS1)) |
3879 | RTL_W8(Config1, cfg1 & ~LEDS0); | 3896 | RTL_W8(Config1, cfg1 & ~LEDS0); |
3880 | 3897 | ||
3881 | RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R810X_CPCMD_QUIRK_MASK); | ||
3882 | |||
3883 | rtl_ephy_init(ioaddr, e_info_8102e_1, ARRAY_SIZE(e_info_8102e_1)); | 3898 | rtl_ephy_init(ioaddr, e_info_8102e_1, ARRAY_SIZE(e_info_8102e_1)); |
3884 | } | 3899 | } |
3885 | 3900 | ||
@@ -3891,8 +3906,6 @@ static void rtl_hw_start_8102e_2(void __iomem *ioaddr, struct pci_dev *pdev) | |||
3891 | 3906 | ||
3892 | RTL_W8(Config1, MEMMAP | IOMAP | VPD | PMEnable); | 3907 | RTL_W8(Config1, MEMMAP | IOMAP | VPD | PMEnable); |
3893 | RTL_W8(Config3, RTL_R8(Config3) & ~Beacon_en); | 3908 | RTL_W8(Config3, RTL_R8(Config3) & ~Beacon_en); |
3894 | |||
3895 | RTL_W16(CPlusCmd, RTL_R16(CPlusCmd) & ~R810X_CPCMD_QUIRK_MASK); | ||
3896 | } | 3909 | } |
3897 | 3910 | ||
3898 | static void rtl_hw_start_8102e_3(void __iomem *ioaddr, struct pci_dev *pdev) | 3911 | static void rtl_hw_start_8102e_3(void __iomem *ioaddr, struct pci_dev *pdev) |
@@ -3918,6 +3931,8 @@ static void rtl_hw_start_8101(struct net_device *dev) | |||
3918 | } | 3931 | } |
3919 | } | 3932 | } |
3920 | 3933 | ||
3934 | RTL_W8(Cfg9346, Cfg9346_Unlock); | ||
3935 | |||
3921 | switch (tp->mac_version) { | 3936 | switch (tp->mac_version) { |
3922 | case RTL_GIGA_MAC_VER_07: | 3937 | case RTL_GIGA_MAC_VER_07: |
3923 | rtl_hw_start_8102e_1(ioaddr, pdev); | 3938 | rtl_hw_start_8102e_1(ioaddr, pdev); |
@@ -3932,14 +3947,13 @@ static void rtl_hw_start_8101(struct net_device *dev) | |||
3932 | break; | 3947 | break; |
3933 | } | 3948 | } |
3934 | 3949 | ||
3935 | RTL_W8(Cfg9346, Cfg9346_Unlock); | 3950 | RTL_W8(Cfg9346, Cfg9346_Lock); |
3936 | 3951 | ||
3937 | RTL_W8(MaxTxPacketSize, TxPacketMax); | 3952 | RTL_W8(MaxTxPacketSize, TxPacketMax); |
3938 | 3953 | ||
3939 | rtl_set_rx_max_size(ioaddr, rx_buf_sz); | 3954 | rtl_set_rx_max_size(ioaddr, rx_buf_sz); |
3940 | 3955 | ||
3941 | tp->cp_cmd |= rtl_rw_cpluscmd(ioaddr) | PCIMulRW; | 3956 | tp->cp_cmd &= ~R810X_CPCMD_QUIRK_MASK; |
3942 | |||
3943 | RTL_W16(CPlusCmd, tp->cp_cmd); | 3957 | RTL_W16(CPlusCmd, tp->cp_cmd); |
3944 | 3958 | ||
3945 | RTL_W16(IntrMitigate, 0x0000); | 3959 | RTL_W16(IntrMitigate, 0x0000); |
@@ -3949,14 +3963,10 @@ static void rtl_hw_start_8101(struct net_device *dev) | |||
3949 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); | 3963 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); |
3950 | rtl_set_rx_tx_config_registers(tp); | 3964 | rtl_set_rx_tx_config_registers(tp); |
3951 | 3965 | ||
3952 | RTL_W8(Cfg9346, Cfg9346_Lock); | ||
3953 | |||
3954 | RTL_R8(IntrMask); | 3966 | RTL_R8(IntrMask); |
3955 | 3967 | ||
3956 | rtl_set_rx_mode(dev); | 3968 | rtl_set_rx_mode(dev); |
3957 | 3969 | ||
3958 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); | ||
3959 | |||
3960 | RTL_W16(MultiIntr, RTL_R16(MultiIntr) & 0xf000); | 3970 | RTL_W16(MultiIntr, RTL_R16(MultiIntr) & 0xf000); |
3961 | 3971 | ||
3962 | RTL_W16(IntrMask, tp->intr_event); | 3972 | RTL_W16(IntrMask, tp->intr_event); |
diff --git a/drivers/net/sfc/ethtool.c b/drivers/net/sfc/ethtool.c index 0e8bb19ed60d..ca886d98bdc7 100644 --- a/drivers/net/sfc/ethtool.c +++ b/drivers/net/sfc/ethtool.c | |||
@@ -569,9 +569,14 @@ static void efx_ethtool_self_test(struct net_device *net_dev, | |||
569 | struct ethtool_test *test, u64 *data) | 569 | struct ethtool_test *test, u64 *data) |
570 | { | 570 | { |
571 | struct efx_nic *efx = netdev_priv(net_dev); | 571 | struct efx_nic *efx = netdev_priv(net_dev); |
572 | struct efx_self_tests efx_tests; | 572 | struct efx_self_tests *efx_tests; |
573 | int already_up; | 573 | int already_up; |
574 | int rc; | 574 | int rc = -ENOMEM; |
575 | |||
576 | efx_tests = kzalloc(sizeof(*efx_tests), GFP_KERNEL); | ||
577 | if (!efx_tests) | ||
578 | goto fail; | ||
579 | |||
575 | 580 | ||
576 | ASSERT_RTNL(); | 581 | ASSERT_RTNL(); |
577 | if (efx->state != STATE_RUNNING) { | 582 | if (efx->state != STATE_RUNNING) { |
@@ -589,13 +594,11 @@ static void efx_ethtool_self_test(struct net_device *net_dev, | |||
589 | if (rc) { | 594 | if (rc) { |
590 | netif_err(efx, drv, efx->net_dev, | 595 | netif_err(efx, drv, efx->net_dev, |
591 | "failed opening device.\n"); | 596 | "failed opening device.\n"); |
592 | goto fail2; | 597 | goto fail1; |
593 | } | 598 | } |
594 | } | 599 | } |
595 | 600 | ||
596 | memset(&efx_tests, 0, sizeof(efx_tests)); | 601 | rc = efx_selftest(efx, efx_tests, test->flags); |
597 | |||
598 | rc = efx_selftest(efx, &efx_tests, test->flags); | ||
599 | 602 | ||
600 | if (!already_up) | 603 | if (!already_up) |
601 | dev_close(efx->net_dev); | 604 | dev_close(efx->net_dev); |
@@ -604,10 +607,11 @@ static void efx_ethtool_self_test(struct net_device *net_dev, | |||
604 | rc == 0 ? "passed" : "failed", | 607 | rc == 0 ? "passed" : "failed", |
605 | (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); | 608 | (test->flags & ETH_TEST_FL_OFFLINE) ? "off" : "on"); |
606 | 609 | ||
607 | fail2: | 610 | fail1: |
608 | fail1: | ||
609 | /* Fill ethtool results structures */ | 611 | /* Fill ethtool results structures */ |
610 | efx_ethtool_fill_self_tests(efx, &efx_tests, NULL, data); | 612 | efx_ethtool_fill_self_tests(efx, efx_tests, NULL, data); |
613 | kfree(efx_tests); | ||
614 | fail: | ||
611 | if (rc) | 615 | if (rc) |
612 | test->flags |= ETH_TEST_FL_FAILED; | 616 | test->flags |= ETH_TEST_FL_FAILED; |
613 | } | 617 | } |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 42daf98ba736..35b28f42d208 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -3856,9 +3856,6 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, | |||
3856 | memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port*8, ETH_ALEN); | 3856 | memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port*8, ETH_ALEN); |
3857 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); | 3857 | memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len); |
3858 | 3858 | ||
3859 | /* device is off until link detection */ | ||
3860 | netif_carrier_off(dev); | ||
3861 | |||
3862 | return dev; | 3859 | return dev; |
3863 | } | 3860 | } |
3864 | 3861 | ||
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c index 64bfdae5956f..d70bde95460b 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c | |||
@@ -1178,6 +1178,11 @@ static int smsc911x_open(struct net_device *dev) | |||
1178 | smsc911x_reg_write(pdata, HW_CFG, 0x00050000); | 1178 | smsc911x_reg_write(pdata, HW_CFG, 0x00050000); |
1179 | smsc911x_reg_write(pdata, AFC_CFG, 0x006E3740); | 1179 | smsc911x_reg_write(pdata, AFC_CFG, 0x006E3740); |
1180 | 1180 | ||
1181 | /* Increase the legal frame size of VLAN tagged frames to 1522 bytes */ | ||
1182 | spin_lock_irq(&pdata->mac_lock); | ||
1183 | smsc911x_mac_write(pdata, VLAN1, ETH_P_8021Q); | ||
1184 | spin_unlock_irq(&pdata->mac_lock); | ||
1185 | |||
1181 | /* Make sure EEPROM has finished loading before setting GPIO_CFG */ | 1186 | /* Make sure EEPROM has finished loading before setting GPIO_CFG */ |
1182 | timeout = 50; | 1187 | timeout = 50; |
1183 | while ((smsc911x_reg_read(pdata, E2P_CMD) & E2P_CMD_EPC_BUSY_) && | 1188 | while ((smsc911x_reg_read(pdata, E2P_CMD) & E2P_CMD_EPC_BUSY_) && |
diff --git a/drivers/net/usb/dm9601.c b/drivers/net/usb/dm9601.c index 02b622e3b9fb..5002f5be47be 100644 --- a/drivers/net/usb/dm9601.c +++ b/drivers/net/usb/dm9601.c | |||
@@ -651,6 +651,10 @@ static const struct usb_device_id products[] = { | |||
651 | .driver_info = (unsigned long)&dm9601_info, | 651 | .driver_info = (unsigned long)&dm9601_info, |
652 | }, | 652 | }, |
653 | { | 653 | { |
654 | USB_DEVICE(0x0fe6, 0x9700), /* DM9601 USB to Fast Ethernet Adapter */ | ||
655 | .driver_info = (unsigned long)&dm9601_info, | ||
656 | }, | ||
657 | { | ||
654 | USB_DEVICE(0x0a46, 0x9000), /* DM9000E */ | 658 | USB_DEVICE(0x0a46, 0x9000), /* DM9000E */ |
655 | .driver_info = (unsigned long)&dm9601_info, | 659 | .driver_info = (unsigned long)&dm9601_info, |
656 | }, | 660 | }, |
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c index 78c26fdccad1..62ce2f4e8605 100644 --- a/drivers/net/wireless/ath/ath5k/phy.c +++ b/drivers/net/wireless/ath/ath5k/phy.c | |||
@@ -282,6 +282,34 @@ int ath5k_hw_phy_disable(struct ath5k_hw *ah) | |||
282 | return 0; | 282 | return 0; |
283 | } | 283 | } |
284 | 284 | ||
285 | /* | ||
286 | * Wait for synth to settle | ||
287 | */ | ||
288 | static void ath5k_hw_wait_for_synth(struct ath5k_hw *ah, | ||
289 | struct ieee80211_channel *channel) | ||
290 | { | ||
291 | /* | ||
292 | * On 5211+ read activation -> rx delay | ||
293 | * and use it (100ns steps). | ||
294 | */ | ||
295 | if (ah->ah_version != AR5K_AR5210) { | ||
296 | u32 delay; | ||
297 | delay = ath5k_hw_reg_read(ah, AR5K_PHY_RX_DELAY) & | ||
298 | AR5K_PHY_RX_DELAY_M; | ||
299 | delay = (channel->hw_value & CHANNEL_CCK) ? | ||
300 | ((delay << 2) / 22) : (delay / 10); | ||
301 | if (ah->ah_bwmode == AR5K_BWMODE_10MHZ) | ||
302 | delay = delay << 1; | ||
303 | if (ah->ah_bwmode == AR5K_BWMODE_5MHZ) | ||
304 | delay = delay << 2; | ||
305 | /* XXX: /2 on turbo ? Let's be safe | ||
306 | * for now */ | ||
307 | udelay(100 + delay); | ||
308 | } else { | ||
309 | mdelay(1); | ||
310 | } | ||
311 | } | ||
312 | |||
285 | 313 | ||
286 | /**********************\ | 314 | /**********************\ |
287 | * RF Gain optimization * | 315 | * RF Gain optimization * |
@@ -1253,6 +1281,7 @@ static int ath5k_hw_channel(struct ath5k_hw *ah, | |||
1253 | case AR5K_RF5111: | 1281 | case AR5K_RF5111: |
1254 | ret = ath5k_hw_rf5111_channel(ah, channel); | 1282 | ret = ath5k_hw_rf5111_channel(ah, channel); |
1255 | break; | 1283 | break; |
1284 | case AR5K_RF2317: | ||
1256 | case AR5K_RF2425: | 1285 | case AR5K_RF2425: |
1257 | ret = ath5k_hw_rf2425_channel(ah, channel); | 1286 | ret = ath5k_hw_rf2425_channel(ah, channel); |
1258 | break; | 1287 | break; |
@@ -3237,6 +3266,13 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, | |||
3237 | /* Failed */ | 3266 | /* Failed */ |
3238 | if (i >= 100) | 3267 | if (i >= 100) |
3239 | return -EIO; | 3268 | return -EIO; |
3269 | |||
3270 | /* Set channel and wait for synth */ | ||
3271 | ret = ath5k_hw_channel(ah, channel); | ||
3272 | if (ret) | ||
3273 | return ret; | ||
3274 | |||
3275 | ath5k_hw_wait_for_synth(ah, channel); | ||
3240 | } | 3276 | } |
3241 | 3277 | ||
3242 | /* | 3278 | /* |
@@ -3251,13 +3287,53 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, | |||
3251 | if (ret) | 3287 | if (ret) |
3252 | return ret; | 3288 | return ret; |
3253 | 3289 | ||
3290 | /* Write OFDM timings on 5212*/ | ||
3291 | if (ah->ah_version == AR5K_AR5212 && | ||
3292 | channel->hw_value & CHANNEL_OFDM) { | ||
3293 | |||
3294 | ret = ath5k_hw_write_ofdm_timings(ah, channel); | ||
3295 | if (ret) | ||
3296 | return ret; | ||
3297 | |||
3298 | /* Spur info is available only from EEPROM versions | ||
3299 | * greater than 5.3, but the EEPROM routines will use | ||
3300 | * static values for older versions */ | ||
3301 | if (ah->ah_mac_srev >= AR5K_SREV_AR5424) | ||
3302 | ath5k_hw_set_spur_mitigation_filter(ah, | ||
3303 | channel); | ||
3304 | } | ||
3305 | |||
3306 | /* If we used fast channel switching | ||
3307 | * we are done, release RF bus and | ||
3308 | * fire up NF calibration. | ||
3309 | * | ||
3310 | * Note: Only NF calibration due to | ||
3311 | * channel change, not AGC calibration | ||
3312 | * since AGC is still running ! | ||
3313 | */ | ||
3314 | if (fast) { | ||
3315 | /* | ||
3316 | * Release RF Bus grant | ||
3317 | */ | ||
3318 | AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_RFBUS_REQ, | ||
3319 | AR5K_PHY_RFBUS_REQ_REQUEST); | ||
3320 | |||
3321 | /* | ||
3322 | * Start NF calibration | ||
3323 | */ | ||
3324 | AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL, | ||
3325 | AR5K_PHY_AGCCTL_NF); | ||
3326 | |||
3327 | return ret; | ||
3328 | } | ||
3329 | |||
3254 | /* | 3330 | /* |
3255 | * For 5210 we do all initialization using | 3331 | * For 5210 we do all initialization using |
3256 | * initvals, so we don't have to modify | 3332 | * initvals, so we don't have to modify |
3257 | * any settings (5210 also only supports | 3333 | * any settings (5210 also only supports |
3258 | * a/aturbo modes) | 3334 | * a/aturbo modes) |
3259 | */ | 3335 | */ |
3260 | if ((ah->ah_version != AR5K_AR5210) && !fast) { | 3336 | if (ah->ah_version != AR5K_AR5210) { |
3261 | 3337 | ||
3262 | /* | 3338 | /* |
3263 | * Write initial RF gain settings | 3339 | * Write initial RF gain settings |
@@ -3276,22 +3352,6 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, | |||
3276 | if (ret) | 3352 | if (ret) |
3277 | return ret; | 3353 | return ret; |
3278 | 3354 | ||
3279 | /* Write OFDM timings on 5212*/ | ||
3280 | if (ah->ah_version == AR5K_AR5212 && | ||
3281 | channel->hw_value & CHANNEL_OFDM) { | ||
3282 | |||
3283 | ret = ath5k_hw_write_ofdm_timings(ah, channel); | ||
3284 | if (ret) | ||
3285 | return ret; | ||
3286 | |||
3287 | /* Spur info is available only from EEPROM versions | ||
3288 | * greater than 5.3, but the EEPROM routines will use | ||
3289 | * static values for older versions */ | ||
3290 | if (ah->ah_mac_srev >= AR5K_SREV_AR5424) | ||
3291 | ath5k_hw_set_spur_mitigation_filter(ah, | ||
3292 | channel); | ||
3293 | } | ||
3294 | |||
3295 | /*Enable/disable 802.11b mode on 5111 | 3355 | /*Enable/disable 802.11b mode on 5111 |
3296 | (enable 2111 frequency converter + CCK)*/ | 3356 | (enable 2111 frequency converter + CCK)*/ |
3297 | if (ah->ah_radio == AR5K_RF5111) { | 3357 | if (ah->ah_radio == AR5K_RF5111) { |
@@ -3322,47 +3382,20 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel, | |||
3322 | */ | 3382 | */ |
3323 | ath5k_hw_reg_write(ah, AR5K_PHY_ACT_ENABLE, AR5K_PHY_ACT); | 3383 | ath5k_hw_reg_write(ah, AR5K_PHY_ACT_ENABLE, AR5K_PHY_ACT); |
3324 | 3384 | ||
3385 | ath5k_hw_wait_for_synth(ah, channel); | ||
3386 | |||
3325 | /* | 3387 | /* |
3326 | * On 5211+ read activation -> rx delay | 3388 | * Perform ADC test to see if baseband is ready |
3327 | * and use it. | 3389 | * Set tx hold and check adc test register |
3328 | */ | 3390 | */ |
3329 | if (ah->ah_version != AR5K_AR5210) { | 3391 | phy_tst1 = ath5k_hw_reg_read(ah, AR5K_PHY_TST1); |
3330 | u32 delay; | 3392 | ath5k_hw_reg_write(ah, AR5K_PHY_TST1_TXHOLD, AR5K_PHY_TST1); |
3331 | delay = ath5k_hw_reg_read(ah, AR5K_PHY_RX_DELAY) & | 3393 | for (i = 0; i <= 20; i++) { |
3332 | AR5K_PHY_RX_DELAY_M; | 3394 | if (!(ath5k_hw_reg_read(ah, AR5K_PHY_ADC_TEST) & 0x10)) |
3333 | delay = (channel->hw_value & CHANNEL_CCK) ? | 3395 | break; |
3334 | ((delay << 2) / 22) : (delay / 10); | 3396 | udelay(200); |
3335 | if (ah->ah_bwmode == AR5K_BWMODE_10MHZ) | ||
3336 | delay = delay << 1; | ||
3337 | if (ah->ah_bwmode == AR5K_BWMODE_5MHZ) | ||
3338 | delay = delay << 2; | ||
3339 | /* XXX: /2 on turbo ? Let's be safe | ||
3340 | * for now */ | ||
3341 | udelay(100 + delay); | ||
3342 | } else { | ||
3343 | mdelay(1); | ||
3344 | } | ||
3345 | |||
3346 | if (fast) | ||
3347 | /* | ||
3348 | * Release RF Bus grant | ||
3349 | */ | ||
3350 | AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_RFBUS_REQ, | ||
3351 | AR5K_PHY_RFBUS_REQ_REQUEST); | ||
3352 | else { | ||
3353 | /* | ||
3354 | * Perform ADC test to see if baseband is ready | ||
3355 | * Set tx hold and check adc test register | ||
3356 | */ | ||
3357 | phy_tst1 = ath5k_hw_reg_read(ah, AR5K_PHY_TST1); | ||
3358 | ath5k_hw_reg_write(ah, AR5K_PHY_TST1_TXHOLD, AR5K_PHY_TST1); | ||
3359 | for (i = 0; i <= 20; i++) { | ||
3360 | if (!(ath5k_hw_reg_read(ah, AR5K_PHY_ADC_TEST) & 0x10)) | ||
3361 | break; | ||
3362 | udelay(200); | ||
3363 | } | ||
3364 | ath5k_hw_reg_write(ah, phy_tst1, AR5K_PHY_TST1); | ||
3365 | } | 3397 | } |
3398 | ath5k_hw_reg_write(ah, phy_tst1, AR5K_PHY_TST1); | ||
3366 | 3399 | ||
3367 | /* | 3400 | /* |
3368 | * Start automatic gain control calibration | 3401 | * Start automatic gain control calibration |
diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h index 23838e37d45f..1a7fa6ea4cf5 100644 --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/device.h> | 21 | #include <linux/device.h> |
22 | #include <linux/leds.h> | 22 | #include <linux/leds.h> |
23 | #include <linux/completion.h> | 23 | #include <linux/completion.h> |
24 | #include <linux/pm_qos_params.h> | ||
25 | 24 | ||
26 | #include "debug.h" | 25 | #include "debug.h" |
27 | #include "common.h" | 26 | #include "common.h" |
@@ -57,8 +56,6 @@ struct ath_node; | |||
57 | 56 | ||
58 | #define A_MAX(a, b) ((a) > (b) ? (a) : (b)) | 57 | #define A_MAX(a, b) ((a) > (b) ? (a) : (b)) |
59 | 58 | ||
60 | #define ATH9K_PM_QOS_DEFAULT_VALUE 55 | ||
61 | |||
62 | #define TSF_TO_TU(_h,_l) \ | 59 | #define TSF_TO_TU(_h,_l) \ |
63 | ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10)) | 60 | ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10)) |
64 | 61 | ||
@@ -633,8 +630,6 @@ struct ath_softc { | |||
633 | struct ath_descdma txsdma; | 630 | struct ath_descdma txsdma; |
634 | 631 | ||
635 | struct ath_ant_comb ant_comb; | 632 | struct ath_ant_comb ant_comb; |
636 | |||
637 | struct pm_qos_request_list pm_qos_req; | ||
638 | }; | 633 | }; |
639 | 634 | ||
640 | struct ath_wiphy { | 635 | struct ath_wiphy { |
@@ -666,7 +661,6 @@ static inline void ath_read_cachesize(struct ath_common *common, int *csz) | |||
666 | extern struct ieee80211_ops ath9k_ops; | 661 | extern struct ieee80211_ops ath9k_ops; |
667 | extern int ath9k_modparam_nohwcrypt; | 662 | extern int ath9k_modparam_nohwcrypt; |
668 | extern int led_blink; | 663 | extern int led_blink; |
669 | extern int ath9k_pm_qos_value; | ||
670 | extern bool is_ath9k_unloaded; | 664 | extern bool is_ath9k_unloaded; |
671 | 665 | ||
672 | irqreturn_t ath_isr(int irq, void *dev); | 666 | irqreturn_t ath_isr(int irq, void *dev); |
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c index 5ab3084eb9cb..07b1633b7f3f 100644 --- a/drivers/net/wireless/ath/ath9k/hif_usb.c +++ b/drivers/net/wireless/ath/ath9k/hif_usb.c | |||
@@ -219,8 +219,9 @@ static int __hif_usb_tx(struct hif_device_usb *hif_dev) | |||
219 | struct tx_buf *tx_buf = NULL; | 219 | struct tx_buf *tx_buf = NULL; |
220 | struct sk_buff *nskb = NULL; | 220 | struct sk_buff *nskb = NULL; |
221 | int ret = 0, i; | 221 | int ret = 0, i; |
222 | u16 *hdr, tx_skb_cnt = 0; | 222 | u16 tx_skb_cnt = 0; |
223 | u8 *buf; | 223 | u8 *buf; |
224 | __le16 *hdr; | ||
224 | 225 | ||
225 | if (hif_dev->tx.tx_skb_cnt == 0) | 226 | if (hif_dev->tx.tx_skb_cnt == 0) |
226 | return 0; | 227 | return 0; |
@@ -245,9 +246,9 @@ static int __hif_usb_tx(struct hif_device_usb *hif_dev) | |||
245 | 246 | ||
246 | buf = tx_buf->buf; | 247 | buf = tx_buf->buf; |
247 | buf += tx_buf->offset; | 248 | buf += tx_buf->offset; |
248 | hdr = (u16 *)buf; | 249 | hdr = (__le16 *)buf; |
249 | *hdr++ = nskb->len; | 250 | *hdr++ = cpu_to_le16(nskb->len); |
250 | *hdr++ = ATH_USB_TX_STREAM_MODE_TAG; | 251 | *hdr++ = cpu_to_le16(ATH_USB_TX_STREAM_MODE_TAG); |
251 | buf += 4; | 252 | buf += 4; |
252 | memcpy(buf, nskb->data, nskb->len); | 253 | memcpy(buf, nskb->data, nskb->len); |
253 | tx_buf->len = nskb->len + 4; | 254 | tx_buf->len = nskb->len + 4; |
diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c index 087a6a95edd5..a033d01bf8a0 100644 --- a/drivers/net/wireless/ath/ath9k/init.c +++ b/drivers/net/wireless/ath/ath9k/init.c | |||
@@ -41,10 +41,6 @@ static int ath9k_btcoex_enable; | |||
41 | module_param_named(btcoex_enable, ath9k_btcoex_enable, int, 0444); | 41 | module_param_named(btcoex_enable, ath9k_btcoex_enable, int, 0444); |
42 | MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence"); | 42 | MODULE_PARM_DESC(btcoex_enable, "Enable wifi-BT coexistence"); |
43 | 43 | ||
44 | int ath9k_pm_qos_value = ATH9K_PM_QOS_DEFAULT_VALUE; | ||
45 | module_param_named(pmqos, ath9k_pm_qos_value, int, S_IRUSR | S_IRGRP | S_IROTH); | ||
46 | MODULE_PARM_DESC(pmqos, "User specified PM-QOS value"); | ||
47 | |||
48 | bool is_ath9k_unloaded; | 44 | bool is_ath9k_unloaded; |
49 | /* We use the hw_value as an index into our private channel structure */ | 45 | /* We use the hw_value as an index into our private channel structure */ |
50 | 46 | ||
@@ -762,9 +758,6 @@ int ath9k_init_device(u16 devid, struct ath_softc *sc, u16 subsysid, | |||
762 | ath_init_leds(sc); | 758 | ath_init_leds(sc); |
763 | ath_start_rfkill_poll(sc); | 759 | ath_start_rfkill_poll(sc); |
764 | 760 | ||
765 | pm_qos_add_request(&sc->pm_qos_req, PM_QOS_CPU_DMA_LATENCY, | ||
766 | PM_QOS_DEFAULT_VALUE); | ||
767 | |||
768 | return 0; | 761 | return 0; |
769 | 762 | ||
770 | error_world: | 763 | error_world: |
@@ -831,7 +824,6 @@ void ath9k_deinit_device(struct ath_softc *sc) | |||
831 | } | 824 | } |
832 | 825 | ||
833 | ieee80211_unregister_hw(hw); | 826 | ieee80211_unregister_hw(hw); |
834 | pm_qos_remove_request(&sc->pm_qos_req); | ||
835 | ath_rx_cleanup(sc); | 827 | ath_rx_cleanup(sc); |
836 | ath_tx_cleanup(sc); | 828 | ath_tx_cleanup(sc); |
837 | ath9k_deinit_softc(sc); | 829 | ath9k_deinit_softc(sc); |
diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c index 180170d3ce25..2915b11edefb 100644 --- a/drivers/net/wireless/ath/ath9k/mac.c +++ b/drivers/net/wireless/ath/ath9k/mac.c | |||
@@ -885,7 +885,7 @@ void ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints) | |||
885 | struct ath_common *common = ath9k_hw_common(ah); | 885 | struct ath_common *common = ath9k_hw_common(ah); |
886 | 886 | ||
887 | if (!(ints & ATH9K_INT_GLOBAL)) | 887 | if (!(ints & ATH9K_INT_GLOBAL)) |
888 | ath9k_hw_enable_interrupts(ah); | 888 | ath9k_hw_disable_interrupts(ah); |
889 | 889 | ||
890 | ath_dbg(common, ATH_DBG_INTERRUPT, "0x%x => 0x%x\n", omask, ints); | 890 | ath_dbg(common, ATH_DBG_INTERRUPT, "0x%x => 0x%x\n", omask, ints); |
891 | 891 | ||
@@ -963,7 +963,8 @@ void ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints) | |||
963 | REG_CLR_BIT(ah, AR_IMR_S5, AR_IMR_S5_TIM_TIMER); | 963 | REG_CLR_BIT(ah, AR_IMR_S5, AR_IMR_S5_TIM_TIMER); |
964 | } | 964 | } |
965 | 965 | ||
966 | ath9k_hw_enable_interrupts(ah); | 966 | if (ints & ATH9K_INT_GLOBAL) |
967 | ath9k_hw_enable_interrupts(ah); | ||
967 | 968 | ||
968 | return; | 969 | return; |
969 | } | 970 | } |
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index da5c64597c1f..a09d15f7aa6e 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -1173,12 +1173,6 @@ static int ath9k_start(struct ieee80211_hw *hw) | |||
1173 | ath9k_btcoex_timer_resume(sc); | 1173 | ath9k_btcoex_timer_resume(sc); |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | /* User has the option to provide pm-qos value as a module | ||
1177 | * parameter rather than using the default value of | ||
1178 | * 'ATH9K_PM_QOS_DEFAULT_VALUE'. | ||
1179 | */ | ||
1180 | pm_qos_update_request(&sc->pm_qos_req, ath9k_pm_qos_value); | ||
1181 | |||
1182 | if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en) | 1176 | if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en) |
1183 | common->bus_ops->extn_synch_en(common); | 1177 | common->bus_ops->extn_synch_en(common); |
1184 | 1178 | ||
@@ -1345,8 +1339,6 @@ static void ath9k_stop(struct ieee80211_hw *hw) | |||
1345 | 1339 | ||
1346 | sc->sc_flags |= SC_OP_INVALID; | 1340 | sc->sc_flags |= SC_OP_INVALID; |
1347 | 1341 | ||
1348 | pm_qos_update_request(&sc->pm_qos_req, PM_QOS_DEFAULT_VALUE); | ||
1349 | |||
1350 | mutex_unlock(&sc->mutex); | 1342 | mutex_unlock(&sc->mutex); |
1351 | 1343 | ||
1352 | ath_dbg(common, ATH_DBG_CONFIG, "Driver halt\n"); | 1344 | ath_dbg(common, ATH_DBG_CONFIG, "Driver halt\n"); |
diff --git a/drivers/net/wireless/ath/carl9170/usb.c b/drivers/net/wireless/ath/carl9170/usb.c index 537732e5964f..f82c400be288 100644 --- a/drivers/net/wireless/ath/carl9170/usb.c +++ b/drivers/net/wireless/ath/carl9170/usb.c | |||
@@ -118,6 +118,8 @@ static struct usb_device_id carl9170_usb_ids[] = { | |||
118 | { USB_DEVICE(0x057c, 0x8402) }, | 118 | { USB_DEVICE(0x057c, 0x8402) }, |
119 | /* Qwest/Actiontec 802AIN Wireless N USB Network Adapter */ | 119 | /* Qwest/Actiontec 802AIN Wireless N USB Network Adapter */ |
120 | { USB_DEVICE(0x1668, 0x1200) }, | 120 | { USB_DEVICE(0x1668, 0x1200) }, |
121 | /* Airlive X.USB a/b/g/n */ | ||
122 | { USB_DEVICE(0x1b75, 0x9170) }, | ||
121 | 123 | ||
122 | /* terminate */ | 124 | /* terminate */ |
123 | {} | 125 | {} |
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c index 79ab0a6b1386..537fb8c84e3a 100644 --- a/drivers/net/wireless/iwlwifi/iwl-5000.c +++ b/drivers/net/wireless/iwlwifi/iwl-5000.c | |||
@@ -51,7 +51,7 @@ | |||
51 | #include "iwl-agn-debugfs.h" | 51 | #include "iwl-agn-debugfs.h" |
52 | 52 | ||
53 | /* Highest firmware API version supported */ | 53 | /* Highest firmware API version supported */ |
54 | #define IWL5000_UCODE_API_MAX 2 | 54 | #define IWL5000_UCODE_API_MAX 5 |
55 | #define IWL5150_UCODE_API_MAX 2 | 55 | #define IWL5150_UCODE_API_MAX 2 |
56 | 56 | ||
57 | /* Lowest firmware API version supported */ | 57 | /* Lowest firmware API version supported */ |
diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c index 1eacba4daa5b..0494d7b102d4 100644 --- a/drivers/net/wireless/p54/p54pci.c +++ b/drivers/net/wireless/p54/p54pci.c | |||
@@ -199,6 +199,7 @@ static void p54p_check_rx_ring(struct ieee80211_hw *dev, u32 *index, | |||
199 | while (i != idx) { | 199 | while (i != idx) { |
200 | u16 len; | 200 | u16 len; |
201 | struct sk_buff *skb; | 201 | struct sk_buff *skb; |
202 | dma_addr_t dma_addr; | ||
202 | desc = &ring[i]; | 203 | desc = &ring[i]; |
203 | len = le16_to_cpu(desc->len); | 204 | len = le16_to_cpu(desc->len); |
204 | skb = rx_buf[i]; | 205 | skb = rx_buf[i]; |
@@ -216,17 +217,20 @@ static void p54p_check_rx_ring(struct ieee80211_hw *dev, u32 *index, | |||
216 | 217 | ||
217 | len = priv->common.rx_mtu; | 218 | len = priv->common.rx_mtu; |
218 | } | 219 | } |
220 | dma_addr = le32_to_cpu(desc->host_addr); | ||
221 | pci_dma_sync_single_for_cpu(priv->pdev, dma_addr, | ||
222 | priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE); | ||
219 | skb_put(skb, len); | 223 | skb_put(skb, len); |
220 | 224 | ||
221 | if (p54_rx(dev, skb)) { | 225 | if (p54_rx(dev, skb)) { |
222 | pci_unmap_single(priv->pdev, | 226 | pci_unmap_single(priv->pdev, dma_addr, |
223 | le32_to_cpu(desc->host_addr), | 227 | priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE); |
224 | priv->common.rx_mtu + 32, | ||
225 | PCI_DMA_FROMDEVICE); | ||
226 | rx_buf[i] = NULL; | 228 | rx_buf[i] = NULL; |
227 | desc->host_addr = 0; | 229 | desc->host_addr = cpu_to_le32(0); |
228 | } else { | 230 | } else { |
229 | skb_trim(skb, 0); | 231 | skb_trim(skb, 0); |
232 | pci_dma_sync_single_for_device(priv->pdev, dma_addr, | ||
233 | priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE); | ||
230 | desc->len = cpu_to_le16(priv->common.rx_mtu + 32); | 234 | desc->len = cpu_to_le16(priv->common.rx_mtu + 32); |
231 | } | 235 | } |
232 | 236 | ||
diff --git a/drivers/net/wireless/p54/p54usb.c b/drivers/net/wireless/p54/p54usb.c index 21713a7638c4..9b344a921e74 100644 --- a/drivers/net/wireless/p54/p54usb.c +++ b/drivers/net/wireless/p54/p54usb.c | |||
@@ -98,6 +98,7 @@ static struct usb_device_id p54u_table[] __devinitdata = { | |||
98 | {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ | 98 | {USB_DEVICE(0x1413, 0x5400)}, /* Telsey 802.11g USB2.0 Adapter */ |
99 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ | 99 | {USB_DEVICE(0x1435, 0x0427)}, /* Inventel UR054G */ |
100 | {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */ | 100 | {USB_DEVICE(0x1668, 0x1050)}, /* Actiontec 802UIG-1 */ |
101 | {USB_DEVICE(0x1740, 0x1000)}, /* Senao NUB-350 */ | ||
101 | {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ | 102 | {USB_DEVICE(0x2001, 0x3704)}, /* DLink DWL-G122 rev A2 */ |
102 | {USB_DEVICE(0x2001, 0x3705)}, /* D-Link DWL-G120 rev C1 */ | 103 | {USB_DEVICE(0x2001, 0x3705)}, /* D-Link DWL-G120 rev C1 */ |
103 | {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */ | 104 | {USB_DEVICE(0x413c, 0x5513)}, /* Dell WLA3310 USB Wireless Adapter */ |
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c index 848cc2cce247..518542b4bf9e 100644 --- a/drivers/net/wireless/rndis_wlan.c +++ b/drivers/net/wireless/rndis_wlan.c | |||
@@ -2597,6 +2597,9 @@ static int rndis_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | |||
2597 | __le32 mode; | 2597 | __le32 mode; |
2598 | int ret; | 2598 | int ret; |
2599 | 2599 | ||
2600 | if (priv->device_type != RNDIS_BCM4320B) | ||
2601 | return -ENOTSUPP; | ||
2602 | |||
2600 | netdev_dbg(usbdev->net, "%s(): %s, %d\n", __func__, | 2603 | netdev_dbg(usbdev->net, "%s(): %s, %d\n", __func__, |
2601 | enabled ? "enabled" : "disabled", | 2604 | enabled ? "enabled" : "disabled", |
2602 | timeout); | 2605 | timeout); |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index aa97971a38af..3b3f1e45ab3e 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -652,6 +652,12 @@ static void rt2800pci_fill_rxdone(struct queue_entry *entry, | |||
652 | */ | 652 | */ |
653 | rxdesc->flags |= RX_FLAG_IV_STRIPPED; | 653 | rxdesc->flags |= RX_FLAG_IV_STRIPPED; |
654 | 654 | ||
655 | /* | ||
656 | * The hardware has already checked the Michael Mic and has | ||
657 | * stripped it from the frame. Signal this to mac80211. | ||
658 | */ | ||
659 | rxdesc->flags |= RX_FLAG_MMIC_STRIPPED; | ||
660 | |||
655 | if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) | 661 | if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) |
656 | rxdesc->flags |= RX_FLAG_DECRYPTED; | 662 | rxdesc->flags |= RX_FLAG_DECRYPTED; |
657 | else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) | 663 | else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) |
@@ -1065,6 +1071,8 @@ static DEFINE_PCI_DEVICE_TABLE(rt2800pci_device_table) = { | |||
1065 | { PCI_DEVICE(0x1814, 0x3390), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1071 | { PCI_DEVICE(0x1814, 0x3390), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1066 | #endif | 1072 | #endif |
1067 | #ifdef CONFIG_RT2800PCI_RT35XX | 1073 | #ifdef CONFIG_RT2800PCI_RT35XX |
1074 | { PCI_DEVICE(0x1432, 0x7711), PCI_DEVICE_DATA(&rt2800pci_ops) }, | ||
1075 | { PCI_DEVICE(0x1432, 0x7722), PCI_DEVICE_DATA(&rt2800pci_ops) }, | ||
1068 | { PCI_DEVICE(0x1814, 0x3060), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1076 | { PCI_DEVICE(0x1814, 0x3060), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1069 | { PCI_DEVICE(0x1814, 0x3062), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1077 | { PCI_DEVICE(0x1814, 0x3062), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
1070 | { PCI_DEVICE(0x1814, 0x3562), PCI_DEVICE_DATA(&rt2800pci_ops) }, | 1078 | { PCI_DEVICE(0x1814, 0x3562), PCI_DEVICE_DATA(&rt2800pci_ops) }, |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index b97a4a54ff4c..197a36c05fda 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -486,6 +486,12 @@ static void rt2800usb_fill_rxdone(struct queue_entry *entry, | |||
486 | */ | 486 | */ |
487 | rxdesc->flags |= RX_FLAG_IV_STRIPPED; | 487 | rxdesc->flags |= RX_FLAG_IV_STRIPPED; |
488 | 488 | ||
489 | /* | ||
490 | * The hardware has already checked the Michael Mic and has | ||
491 | * stripped it from the frame. Signal this to mac80211. | ||
492 | */ | ||
493 | rxdesc->flags |= RX_FLAG_MMIC_STRIPPED; | ||
494 | |||
489 | if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) | 495 | if (rxdesc->cipher_status == RX_CRYPTO_SUCCESS) |
490 | rxdesc->flags |= RX_FLAG_DECRYPTED; | 496 | rxdesc->flags |= RX_FLAG_DECRYPTED; |
491 | else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) | 497 | else if (rxdesc->cipher_status == RX_CRYPTO_FAIL_MIC) |
diff --git a/drivers/nfc/Kconfig b/drivers/nfc/Kconfig index ffedfd492754..ea1580085347 100644 --- a/drivers/nfc/Kconfig +++ b/drivers/nfc/Kconfig | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | menuconfig NFC_DEVICES | 5 | menuconfig NFC_DEVICES |
6 | bool "NFC devices" | 6 | bool "Near Field Communication (NFC) devices" |
7 | default n | 7 | default n |
8 | ---help--- | 8 | ---help--- |
9 | You'll have to say Y if your computer contains an NFC device that | 9 | You'll have to say Y if your computer contains an NFC device that |
diff --git a/drivers/nfc/pn544.c b/drivers/nfc/pn544.c index bae647264dd6..724f65d8f9e4 100644 --- a/drivers/nfc/pn544.c +++ b/drivers/nfc/pn544.c | |||
@@ -60,7 +60,7 @@ enum pn544_irq { | |||
60 | struct pn544_info { | 60 | struct pn544_info { |
61 | struct miscdevice miscdev; | 61 | struct miscdevice miscdev; |
62 | struct i2c_client *i2c_dev; | 62 | struct i2c_client *i2c_dev; |
63 | struct regulator_bulk_data regs[2]; | 63 | struct regulator_bulk_data regs[3]; |
64 | 64 | ||
65 | enum pn544_state state; | 65 | enum pn544_state state; |
66 | wait_queue_head_t read_wait; | 66 | wait_queue_head_t read_wait; |
@@ -74,6 +74,7 @@ struct pn544_info { | |||
74 | 74 | ||
75 | static const char reg_vdd_io[] = "Vdd_IO"; | 75 | static const char reg_vdd_io[] = "Vdd_IO"; |
76 | static const char reg_vbat[] = "VBat"; | 76 | static const char reg_vbat[] = "VBat"; |
77 | static const char reg_vsim[] = "VSim"; | ||
77 | 78 | ||
78 | /* sysfs interface */ | 79 | /* sysfs interface */ |
79 | static ssize_t pn544_test(struct device *dev, | 80 | static ssize_t pn544_test(struct device *dev, |
@@ -740,6 +741,7 @@ static int __devinit pn544_probe(struct i2c_client *client, | |||
740 | 741 | ||
741 | info->regs[0].supply = reg_vdd_io; | 742 | info->regs[0].supply = reg_vdd_io; |
742 | info->regs[1].supply = reg_vbat; | 743 | info->regs[1].supply = reg_vbat; |
744 | info->regs[2].supply = reg_vsim; | ||
743 | r = regulator_bulk_get(&client->dev, ARRAY_SIZE(info->regs), | 745 | r = regulator_bulk_get(&client->dev, ARRAY_SIZE(info->regs), |
744 | info->regs); | 746 | info->regs); |
745 | if (r < 0) | 747 | if (r < 0) |
diff --git a/drivers/of/pdt.c b/drivers/of/pdt.c index 28295d0a50f6..4d87b5dc9284 100644 --- a/drivers/of/pdt.c +++ b/drivers/of/pdt.c | |||
@@ -36,19 +36,55 @@ unsigned int of_pdt_unique_id __initdata; | |||
36 | (p)->unique_id = of_pdt_unique_id++; \ | 36 | (p)->unique_id = of_pdt_unique_id++; \ |
37 | } while (0) | 37 | } while (0) |
38 | 38 | ||
39 | static inline const char *of_pdt_node_name(struct device_node *dp) | 39 | static char * __init of_pdt_build_full_name(struct device_node *dp) |
40 | { | 40 | { |
41 | return dp->path_component_name; | 41 | int len, ourlen, plen; |
42 | char *n; | ||
43 | |||
44 | dp->path_component_name = build_path_component(dp); | ||
45 | |||
46 | plen = strlen(dp->parent->full_name); | ||
47 | ourlen = strlen(dp->path_component_name); | ||
48 | len = ourlen + plen + 2; | ||
49 | |||
50 | n = prom_early_alloc(len); | ||
51 | strcpy(n, dp->parent->full_name); | ||
52 | if (!of_node_is_root(dp->parent)) { | ||
53 | strcpy(n + plen, "/"); | ||
54 | plen++; | ||
55 | } | ||
56 | strcpy(n + plen, dp->path_component_name); | ||
57 | |||
58 | return n; | ||
42 | } | 59 | } |
43 | 60 | ||
44 | #else | 61 | #else /* CONFIG_SPARC */ |
45 | 62 | ||
46 | static inline void of_pdt_incr_unique_id(void *p) { } | 63 | static inline void of_pdt_incr_unique_id(void *p) { } |
47 | static inline void irq_trans_init(struct device_node *dp) { } | 64 | static inline void irq_trans_init(struct device_node *dp) { } |
48 | 65 | ||
49 | static inline const char *of_pdt_node_name(struct device_node *dp) | 66 | static char * __init of_pdt_build_full_name(struct device_node *dp) |
50 | { | 67 | { |
51 | return dp->name; | 68 | static int failsafe_id = 0; /* for generating unique names on failure */ |
69 | char *buf; | ||
70 | int len; | ||
71 | |||
72 | if (of_pdt_prom_ops->pkg2path(dp->phandle, NULL, 0, &len)) | ||
73 | goto failsafe; | ||
74 | |||
75 | buf = prom_early_alloc(len + 1); | ||
76 | if (of_pdt_prom_ops->pkg2path(dp->phandle, buf, len, &len)) | ||
77 | goto failsafe; | ||
78 | return buf; | ||
79 | |||
80 | failsafe: | ||
81 | buf = prom_early_alloc(strlen(dp->parent->full_name) + | ||
82 | strlen(dp->name) + 16); | ||
83 | sprintf(buf, "%s/%s@unknown%i", | ||
84 | of_node_is_root(dp->parent) ? "" : dp->parent->full_name, | ||
85 | dp->name, failsafe_id++); | ||
86 | pr_err("%s: pkg2path failed; assigning %s\n", __func__, buf); | ||
87 | return buf; | ||
52 | } | 88 | } |
53 | 89 | ||
54 | #endif /* !CONFIG_SPARC */ | 90 | #endif /* !CONFIG_SPARC */ |
@@ -132,47 +168,6 @@ static char * __init of_pdt_get_one_property(phandle node, const char *name) | |||
132 | return buf; | 168 | return buf; |
133 | } | 169 | } |
134 | 170 | ||
135 | static char * __init of_pdt_try_pkg2path(phandle node) | ||
136 | { | ||
137 | char *res, *buf = NULL; | ||
138 | int len; | ||
139 | |||
140 | if (!of_pdt_prom_ops->pkg2path) | ||
141 | return NULL; | ||
142 | |||
143 | if (of_pdt_prom_ops->pkg2path(node, buf, 0, &len)) | ||
144 | return NULL; | ||
145 | buf = prom_early_alloc(len + 1); | ||
146 | if (of_pdt_prom_ops->pkg2path(node, buf, len, &len)) { | ||
147 | pr_err("%s: package-to-path failed\n", __func__); | ||
148 | return NULL; | ||
149 | } | ||
150 | |||
151 | res = strrchr(buf, '/'); | ||
152 | if (!res) { | ||
153 | pr_err("%s: couldn't find / in %s\n", __func__, buf); | ||
154 | return NULL; | ||
155 | } | ||
156 | return res+1; | ||
157 | } | ||
158 | |||
159 | /* | ||
160 | * When fetching the node's name, first try using package-to-path; if | ||
161 | * that fails (either because the arch hasn't supplied a PROM callback, | ||
162 | * or some other random failure), fall back to just looking at the node's | ||
163 | * 'name' property. | ||
164 | */ | ||
165 | static char * __init of_pdt_build_name(phandle node) | ||
166 | { | ||
167 | char *buf; | ||
168 | |||
169 | buf = of_pdt_try_pkg2path(node); | ||
170 | if (!buf) | ||
171 | buf = of_pdt_get_one_property(node, "name"); | ||
172 | |||
173 | return buf; | ||
174 | } | ||
175 | |||
176 | static struct device_node * __init of_pdt_create_node(phandle node, | 171 | static struct device_node * __init of_pdt_create_node(phandle node, |
177 | struct device_node *parent) | 172 | struct device_node *parent) |
178 | { | 173 | { |
@@ -187,7 +182,7 @@ static struct device_node * __init of_pdt_create_node(phandle node, | |||
187 | 182 | ||
188 | kref_init(&dp->kref); | 183 | kref_init(&dp->kref); |
189 | 184 | ||
190 | dp->name = of_pdt_build_name(node); | 185 | dp->name = of_pdt_get_one_property(node, "name"); |
191 | dp->type = of_pdt_get_one_property(node, "device_type"); | 186 | dp->type = of_pdt_get_one_property(node, "device_type"); |
192 | dp->phandle = node; | 187 | dp->phandle = node; |
193 | 188 | ||
@@ -198,26 +193,6 @@ static struct device_node * __init of_pdt_create_node(phandle node, | |||
198 | return dp; | 193 | return dp; |
199 | } | 194 | } |
200 | 195 | ||
201 | static char * __init of_pdt_build_full_name(struct device_node *dp) | ||
202 | { | ||
203 | int len, ourlen, plen; | ||
204 | char *n; | ||
205 | |||
206 | plen = strlen(dp->parent->full_name); | ||
207 | ourlen = strlen(of_pdt_node_name(dp)); | ||
208 | len = ourlen + plen + 2; | ||
209 | |||
210 | n = prom_early_alloc(len); | ||
211 | strcpy(n, dp->parent->full_name); | ||
212 | if (!of_node_is_root(dp->parent)) { | ||
213 | strcpy(n + plen, "/"); | ||
214 | plen++; | ||
215 | } | ||
216 | strcpy(n + plen, of_pdt_node_name(dp)); | ||
217 | |||
218 | return n; | ||
219 | } | ||
220 | |||
221 | static struct device_node * __init of_pdt_build_tree(struct device_node *parent, | 196 | static struct device_node * __init of_pdt_build_tree(struct device_node *parent, |
222 | phandle node, | 197 | phandle node, |
223 | struct device_node ***nextp) | 198 | struct device_node ***nextp) |
@@ -240,9 +215,6 @@ static struct device_node * __init of_pdt_build_tree(struct device_node *parent, | |||
240 | *(*nextp) = dp; | 215 | *(*nextp) = dp; |
241 | *nextp = &dp->allnext; | 216 | *nextp = &dp->allnext; |
242 | 217 | ||
243 | #if defined(CONFIG_SPARC) | ||
244 | dp->path_component_name = build_path_component(dp); | ||
245 | #endif | ||
246 | dp->full_name = of_pdt_build_full_name(dp); | 218 | dp->full_name = of_pdt_build_full_name(dp); |
247 | 219 | ||
248 | dp->child = of_pdt_build_tree(dp, | 220 | dp->child = of_pdt_build_tree(dp, |
diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c index 3a5a6fcc0ead..492b7d807fe8 100644 --- a/drivers/pci/xen-pcifront.c +++ b/drivers/pci/xen-pcifront.c | |||
@@ -243,7 +243,7 @@ struct pci_ops pcifront_bus_ops = { | |||
243 | 243 | ||
244 | #ifdef CONFIG_PCI_MSI | 244 | #ifdef CONFIG_PCI_MSI |
245 | static int pci_frontend_enable_msix(struct pci_dev *dev, | 245 | static int pci_frontend_enable_msix(struct pci_dev *dev, |
246 | int **vector, int nvec) | 246 | int vector[], int nvec) |
247 | { | 247 | { |
248 | int err; | 248 | int err; |
249 | int i; | 249 | int i; |
@@ -277,18 +277,24 @@ static int pci_frontend_enable_msix(struct pci_dev *dev, | |||
277 | if (likely(!err)) { | 277 | if (likely(!err)) { |
278 | if (likely(!op.value)) { | 278 | if (likely(!op.value)) { |
279 | /* we get the result */ | 279 | /* we get the result */ |
280 | for (i = 0; i < nvec; i++) | 280 | for (i = 0; i < nvec; i++) { |
281 | *(*vector+i) = op.msix_entries[i].vector; | 281 | if (op.msix_entries[i].vector <= 0) { |
282 | return 0; | 282 | dev_warn(&dev->dev, "MSI-X entry %d is invalid: %d!\n", |
283 | i, op.msix_entries[i].vector); | ||
284 | err = -EINVAL; | ||
285 | vector[i] = -1; | ||
286 | continue; | ||
287 | } | ||
288 | vector[i] = op.msix_entries[i].vector; | ||
289 | } | ||
283 | } else { | 290 | } else { |
284 | printk(KERN_DEBUG "enable msix get value %x\n", | 291 | printk(KERN_DEBUG "enable msix get value %x\n", |
285 | op.value); | 292 | op.value); |
286 | return op.value; | ||
287 | } | 293 | } |
288 | } else { | 294 | } else { |
289 | dev_err(&dev->dev, "enable msix get err %x\n", err); | 295 | dev_err(&dev->dev, "enable msix get err %x\n", err); |
290 | return err; | ||
291 | } | 296 | } |
297 | return err; | ||
292 | } | 298 | } |
293 | 299 | ||
294 | static void pci_frontend_disable_msix(struct pci_dev *dev) | 300 | static void pci_frontend_disable_msix(struct pci_dev *dev) |
@@ -310,7 +316,7 @@ static void pci_frontend_disable_msix(struct pci_dev *dev) | |||
310 | dev_err(&dev->dev, "pci_disable_msix get err %x\n", err); | 316 | dev_err(&dev->dev, "pci_disable_msix get err %x\n", err); |
311 | } | 317 | } |
312 | 318 | ||
313 | static int pci_frontend_enable_msi(struct pci_dev *dev, int **vector) | 319 | static int pci_frontend_enable_msi(struct pci_dev *dev, int vector[]) |
314 | { | 320 | { |
315 | int err; | 321 | int err; |
316 | struct xen_pci_op op = { | 322 | struct xen_pci_op op = { |
@@ -324,7 +330,13 @@ static int pci_frontend_enable_msi(struct pci_dev *dev, int **vector) | |||
324 | 330 | ||
325 | err = do_pci_op(pdev, &op); | 331 | err = do_pci_op(pdev, &op); |
326 | if (likely(!err)) { | 332 | if (likely(!err)) { |
327 | *(*vector) = op.value; | 333 | vector[0] = op.value; |
334 | if (op.value <= 0) { | ||
335 | dev_warn(&dev->dev, "MSI entry is invalid: %d!\n", | ||
336 | op.value); | ||
337 | err = -EINVAL; | ||
338 | vector[0] = -1; | ||
339 | } | ||
328 | } else { | 340 | } else { |
329 | dev_err(&dev->dev, "pci frontend enable msi failed for dev " | 341 | dev_err(&dev->dev, "pci frontend enable msi failed for dev " |
330 | "%x:%x\n", op.bus, op.devfn); | 342 | "%x:%x\n", op.bus, op.devfn); |
@@ -733,8 +745,7 @@ static void free_pdev(struct pcifront_device *pdev) | |||
733 | 745 | ||
734 | pcifront_free_roots(pdev); | 746 | pcifront_free_roots(pdev); |
735 | 747 | ||
736 | /*For PCIE_AER error handling job*/ | 748 | cancel_work_sync(&pdev->op_work); |
737 | flush_scheduled_work(); | ||
738 | 749 | ||
739 | if (pdev->irq >= 0) | 750 | if (pdev->irq >= 0) |
740 | unbind_from_irqhandler(pdev->irq, pdev); | 751 | unbind_from_irqhandler(pdev->irq, pdev); |
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 0bdda5b3ed55..42fbf1a75576 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -518,6 +518,8 @@ int pcmcia_enable_device(struct pcmcia_device *p_dev) | |||
518 | flags |= CONF_ENABLE_IOCARD; | 518 | flags |= CONF_ENABLE_IOCARD; |
519 | if (flags & CONF_ENABLE_IOCARD) | 519 | if (flags & CONF_ENABLE_IOCARD) |
520 | s->socket.flags |= SS_IOCARD; | 520 | s->socket.flags |= SS_IOCARD; |
521 | if (flags & CONF_ENABLE_ZVCARD) | ||
522 | s->socket.flags |= SS_ZVCARD | SS_IOCARD; | ||
521 | if (flags & CONF_ENABLE_SPKR) { | 523 | if (flags & CONF_ENABLE_SPKR) { |
522 | s->socket.flags |= SS_SPKR_ENA; | 524 | s->socket.flags |= SS_SPKR_ENA; |
523 | status = CCSR_AUDIO_ENA; | 525 | status = CCSR_AUDIO_ENA; |
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 3755e7c8c715..2c540542b5af 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c | |||
@@ -215,7 +215,7 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt, | |||
215 | } | 215 | } |
216 | #endif | 216 | #endif |
217 | 217 | ||
218 | static void pxa2xx_configure_sockets(struct device *dev) | 218 | void pxa2xx_configure_sockets(struct device *dev) |
219 | { | 219 | { |
220 | struct pcmcia_low_level *ops = dev->platform_data; | 220 | struct pcmcia_low_level *ops = dev->platform_data; |
221 | /* | 221 | /* |
diff --git a/drivers/pcmcia/pxa2xx_base.h b/drivers/pcmcia/pxa2xx_base.h index bb62ea87b8f9..b609b45469ed 100644 --- a/drivers/pcmcia/pxa2xx_base.h +++ b/drivers/pcmcia/pxa2xx_base.h | |||
@@ -1,3 +1,4 @@ | |||
1 | int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt); | 1 | int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt); |
2 | void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops); | 2 | void pxa2xx_drv_pcmcia_ops(struct pcmcia_low_level *ops); |
3 | void pxa2xx_configure_sockets(struct device *dev); | ||
3 | 4 | ||
diff --git a/drivers/pcmcia/pxa2xx_colibri.c b/drivers/pcmcia/pxa2xx_colibri.c index c3f72192af66..a52039564e74 100644 --- a/drivers/pcmcia/pxa2xx_colibri.c +++ b/drivers/pcmcia/pxa2xx_colibri.c | |||
@@ -181,6 +181,9 @@ static int __init colibri_pcmcia_init(void) | |||
181 | { | 181 | { |
182 | int ret; | 182 | int ret; |
183 | 183 | ||
184 | if (!machine_is_colibri() && !machine_is_colibri320()) | ||
185 | return -ENODEV; | ||
186 | |||
184 | colibri_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); | 187 | colibri_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); |
185 | if (!colibri_pcmcia_device) | 188 | if (!colibri_pcmcia_device) |
186 | return -ENOMEM; | 189 | return -ENOMEM; |
diff --git a/drivers/pcmcia/pxa2xx_lubbock.c b/drivers/pcmcia/pxa2xx_lubbock.c index b9f8c8fb42bd..25afe637c657 100644 --- a/drivers/pcmcia/pxa2xx_lubbock.c +++ b/drivers/pcmcia/pxa2xx_lubbock.c | |||
@@ -226,6 +226,7 @@ int pcmcia_lubbock_init(struct sa1111_dev *sadev) | |||
226 | lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); | 226 | lubbock_set_misc_wr((1 << 15) | (1 << 14), 0); |
227 | 227 | ||
228 | pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops); | 228 | pxa2xx_drv_pcmcia_ops(&lubbock_pcmcia_ops); |
229 | pxa2xx_configure_sockets(&sadev->dev); | ||
229 | ret = sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops, | 230 | ret = sa1111_pcmcia_add(sadev, &lubbock_pcmcia_ops, |
230 | pxa2xx_drv_pcmcia_add_one); | 231 | pxa2xx_drv_pcmcia_add_one); |
231 | } | 232 | } |
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index d163bc2e2b9e..a59af5b24f0a 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
@@ -227,7 +227,7 @@ config SONYPI_COMPAT | |||
227 | config IDEAPAD_LAPTOP | 227 | config IDEAPAD_LAPTOP |
228 | tristate "Lenovo IdeaPad Laptop Extras" | 228 | tristate "Lenovo IdeaPad Laptop Extras" |
229 | depends on ACPI | 229 | depends on ACPI |
230 | depends on RFKILL | 230 | depends on RFKILL && INPUT |
231 | select INPUT_SPARSEKMAP | 231 | select INPUT_SPARSEKMAP |
232 | help | 232 | help |
233 | This is a driver for the rfkill switches on Lenovo IdeaPad netbooks. | 233 | This is a driver for the rfkill switches on Lenovo IdeaPad netbooks. |
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index c5c4b8c32eb8..38b34a73866a 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c | |||
@@ -84,7 +84,7 @@ MODULE_LICENSE("GPL"); | |||
84 | */ | 84 | */ |
85 | #define AMW0_GUID1 "67C3371D-95A3-4C37-BB61-DD47B491DAAB" | 85 | #define AMW0_GUID1 "67C3371D-95A3-4C37-BB61-DD47B491DAAB" |
86 | #define AMW0_GUID2 "431F16ED-0C2B-444C-B267-27DEB140CF9C" | 86 | #define AMW0_GUID2 "431F16ED-0C2B-444C-B267-27DEB140CF9C" |
87 | #define WMID_GUID1 "6AF4F258-B401-42fd-BE91-3D4AC2D7C0D3" | 87 | #define WMID_GUID1 "6AF4F258-B401-42FD-BE91-3D4AC2D7C0D3" |
88 | #define WMID_GUID2 "95764E09-FB56-4e83-B31A-37761F60994A" | 88 | #define WMID_GUID2 "95764E09-FB56-4e83-B31A-37761F60994A" |
89 | #define WMID_GUID3 "61EF69EA-865C-4BC3-A502-A0DEBA0CB531" | 89 | #define WMID_GUID3 "61EF69EA-865C-4BC3-A502-A0DEBA0CB531" |
90 | 90 | ||
@@ -1280,7 +1280,7 @@ static ssize_t set_bool_threeg(struct device *dev, | |||
1280 | return -EINVAL; | 1280 | return -EINVAL; |
1281 | return count; | 1281 | return count; |
1282 | } | 1282 | } |
1283 | static DEVICE_ATTR(threeg, S_IWUGO | S_IRUGO | S_IWUSR, show_bool_threeg, | 1283 | static DEVICE_ATTR(threeg, S_IRUGO | S_IWUSR, show_bool_threeg, |
1284 | set_bool_threeg); | 1284 | set_bool_threeg); |
1285 | 1285 | ||
1286 | static ssize_t show_interface(struct device *dev, struct device_attribute *attr, | 1286 | static ssize_t show_interface(struct device *dev, struct device_attribute *attr, |
diff --git a/drivers/platform/x86/asus_acpi.c b/drivers/platform/x86/asus_acpi.c index 4633fd8532cc..fe495939c307 100644 --- a/drivers/platform/x86/asus_acpi.c +++ b/drivers/platform/x86/asus_acpi.c | |||
@@ -1081,14 +1081,8 @@ static int asus_hotk_add_fs(struct acpi_device *device) | |||
1081 | struct proc_dir_entry *proc; | 1081 | struct proc_dir_entry *proc; |
1082 | mode_t mode; | 1082 | mode_t mode; |
1083 | 1083 | ||
1084 | /* | ||
1085 | * If parameter uid or gid is not changed, keep the default setting for | ||
1086 | * our proc entries (-rw-rw-rw-) else, it means we care about security, | ||
1087 | * and then set to -rw-rw---- | ||
1088 | */ | ||
1089 | |||
1090 | if ((asus_uid == 0) && (asus_gid == 0)) { | 1084 | if ((asus_uid == 0) && (asus_gid == 0)) { |
1091 | mode = S_IFREG | S_IRUGO | S_IWUGO; | 1085 | mode = S_IFREG | S_IRUGO | S_IWUSR | S_IWGRP; |
1092 | } else { | 1086 | } else { |
1093 | mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP; | 1087 | mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP; |
1094 | printk(KERN_WARNING " asus_uid and asus_gid parameters are " | 1088 | printk(KERN_WARNING " asus_uid and asus_gid parameters are " |
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index 34657f96b5a5..ad24ef36f9f7 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c | |||
@@ -290,9 +290,12 @@ static int dell_rfkill_set(void *data, bool blocked) | |||
290 | dell_send_request(buffer, 17, 11); | 290 | dell_send_request(buffer, 17, 11); |
291 | 291 | ||
292 | /* If the hardware switch controls this radio, and the hardware | 292 | /* If the hardware switch controls this radio, and the hardware |
293 | switch is disabled, don't allow changing the software state */ | 293 | switch is disabled, don't allow changing the software state. |
294 | If the hardware switch is reported as not supported, always | ||
295 | fire the SMI to toggle the killswitch. */ | ||
294 | if ((hwswitch_state & BIT(hwswitch_bit)) && | 296 | if ((hwswitch_state & BIT(hwswitch_bit)) && |
295 | !(buffer->output[1] & BIT(16))) { | 297 | !(buffer->output[1] & BIT(16)) && |
298 | (buffer->output[1] & BIT(0))) { | ||
296 | ret = -EINVAL; | 299 | ret = -EINVAL; |
297 | goto out; | 300 | goto out; |
298 | } | 301 | } |
@@ -398,6 +401,23 @@ static const struct file_operations dell_debugfs_fops = { | |||
398 | 401 | ||
399 | static void dell_update_rfkill(struct work_struct *ignored) | 402 | static void dell_update_rfkill(struct work_struct *ignored) |
400 | { | 403 | { |
404 | int status; | ||
405 | |||
406 | get_buffer(); | ||
407 | dell_send_request(buffer, 17, 11); | ||
408 | status = buffer->output[1]; | ||
409 | release_buffer(); | ||
410 | |||
411 | /* if hardware rfkill is not supported, set it explicitly */ | ||
412 | if (!(status & BIT(0))) { | ||
413 | if (wifi_rfkill) | ||
414 | dell_rfkill_set((void *)1, !((status & BIT(17)) >> 17)); | ||
415 | if (bluetooth_rfkill) | ||
416 | dell_rfkill_set((void *)2, !((status & BIT(18)) >> 18)); | ||
417 | if (wwan_rfkill) | ||
418 | dell_rfkill_set((void *)3, !((status & BIT(19)) >> 19)); | ||
419 | } | ||
420 | |||
401 | if (wifi_rfkill) | 421 | if (wifi_rfkill) |
402 | dell_rfkill_query(wifi_rfkill, (void *)1); | 422 | dell_rfkill_query(wifi_rfkill, (void *)1); |
403 | if (bluetooth_rfkill) | 423 | if (bluetooth_rfkill) |
diff --git a/drivers/platform/x86/intel_pmic_gpio.c b/drivers/platform/x86/intel_pmic_gpio.c index 930e62762365..61433d492862 100644 --- a/drivers/platform/x86/intel_pmic_gpio.c +++ b/drivers/platform/x86/intel_pmic_gpio.c | |||
@@ -60,69 +60,20 @@ enum pmic_gpio_register { | |||
60 | #define GPOSW_DOU 0x08 | 60 | #define GPOSW_DOU 0x08 |
61 | #define GPOSW_RDRV 0x30 | 61 | #define GPOSW_RDRV 0x30 |
62 | 62 | ||
63 | #define GPIO_UPDATE_TYPE 0x80000000 | ||
63 | 64 | ||
64 | #define NUM_GPIO 24 | 65 | #define NUM_GPIO 24 |
65 | 66 | ||
66 | struct pmic_gpio_irq { | ||
67 | spinlock_t lock; | ||
68 | u32 trigger[NUM_GPIO]; | ||
69 | u32 dirty; | ||
70 | struct work_struct work; | ||
71 | }; | ||
72 | |||
73 | |||
74 | struct pmic_gpio { | 67 | struct pmic_gpio { |
68 | struct mutex buslock; | ||
75 | struct gpio_chip chip; | 69 | struct gpio_chip chip; |
76 | struct pmic_gpio_irq irqtypes; | ||
77 | void *gpiointr; | 70 | void *gpiointr; |
78 | int irq; | 71 | int irq; |
79 | unsigned irq_base; | 72 | unsigned irq_base; |
73 | unsigned int update_type; | ||
74 | u32 trigger_type; | ||
80 | }; | 75 | }; |
81 | 76 | ||
82 | static void pmic_program_irqtype(int gpio, int type) | ||
83 | { | ||
84 | if (type & IRQ_TYPE_EDGE_RISING) | ||
85 | intel_scu_ipc_update_register(GPIO0 + gpio, 0x20, 0x20); | ||
86 | else | ||
87 | intel_scu_ipc_update_register(GPIO0 + gpio, 0x00, 0x20); | ||
88 | |||
89 | if (type & IRQ_TYPE_EDGE_FALLING) | ||
90 | intel_scu_ipc_update_register(GPIO0 + gpio, 0x10, 0x10); | ||
91 | else | ||
92 | intel_scu_ipc_update_register(GPIO0 + gpio, 0x00, 0x10); | ||
93 | }; | ||
94 | |||
95 | static void pmic_irqtype_work(struct work_struct *work) | ||
96 | { | ||
97 | struct pmic_gpio_irq *t = | ||
98 | container_of(work, struct pmic_gpio_irq, work); | ||
99 | unsigned long flags; | ||
100 | int i; | ||
101 | u16 type; | ||
102 | |||
103 | spin_lock_irqsave(&t->lock, flags); | ||
104 | /* As we drop the lock, we may need multiple scans if we race the | ||
105 | pmic_irq_type function */ | ||
106 | while (t->dirty) { | ||
107 | /* | ||
108 | * For each pin that has the dirty bit set send an IPC | ||
109 | * message to configure the hardware via the PMIC | ||
110 | */ | ||
111 | for (i = 0; i < NUM_GPIO; i++) { | ||
112 | if (!(t->dirty & (1 << i))) | ||
113 | continue; | ||
114 | t->dirty &= ~(1 << i); | ||
115 | /* We can't trust the array entry or dirty | ||
116 | once the lock is dropped */ | ||
117 | type = t->trigger[i]; | ||
118 | spin_unlock_irqrestore(&t->lock, flags); | ||
119 | pmic_program_irqtype(i, type); | ||
120 | spin_lock_irqsave(&t->lock, flags); | ||
121 | } | ||
122 | } | ||
123 | spin_unlock_irqrestore(&t->lock, flags); | ||
124 | } | ||
125 | |||
126 | static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned offset) | 77 | static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned offset) |
127 | { | 78 | { |
128 | if (offset > 8) { | 79 | if (offset > 8) { |
@@ -190,25 +141,24 @@ static void pmic_gpio_set(struct gpio_chip *chip, unsigned offset, int value) | |||
190 | 1 << (offset - 16)); | 141 | 1 << (offset - 16)); |
191 | } | 142 | } |
192 | 143 | ||
193 | static int pmic_irq_type(unsigned irq, unsigned type) | 144 | /* |
145 | * This is called from genirq with pg->buslock locked and | ||
146 | * irq_desc->lock held. We can not access the scu bus here, so we | ||
147 | * store the change and update in the bus_sync_unlock() function below | ||
148 | */ | ||
149 | static int pmic_irq_type(struct irq_data *data, unsigned type) | ||
194 | { | 150 | { |
195 | struct pmic_gpio *pg = get_irq_chip_data(irq); | 151 | struct pmic_gpio *pg = irq_data_get_irq_chip_data(data); |
196 | u32 gpio = irq - pg->irq_base; | 152 | u32 gpio = data->irq - pg->irq_base; |
197 | unsigned long flags; | ||
198 | 153 | ||
199 | if (gpio >= pg->chip.ngpio) | 154 | if (gpio >= pg->chip.ngpio) |
200 | return -EINVAL; | 155 | return -EINVAL; |
201 | 156 | ||
202 | spin_lock_irqsave(&pg->irqtypes.lock, flags); | 157 | pg->trigger_type = type; |
203 | pg->irqtypes.trigger[gpio] = type; | 158 | pg->update_type = gpio | GPIO_UPDATE_TYPE; |
204 | pg->irqtypes.dirty |= (1 << gpio); | ||
205 | spin_unlock_irqrestore(&pg->irqtypes.lock, flags); | ||
206 | schedule_work(&pg->irqtypes.work); | ||
207 | return 0; | 159 | return 0; |
208 | } | 160 | } |
209 | 161 | ||
210 | |||
211 | |||
212 | static int pmic_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | 162 | static int pmic_gpio_to_irq(struct gpio_chip *chip, unsigned offset) |
213 | { | 163 | { |
214 | struct pmic_gpio *pg = container_of(chip, struct pmic_gpio, chip); | 164 | struct pmic_gpio *pg = container_of(chip, struct pmic_gpio, chip); |
@@ -217,38 +167,32 @@ static int pmic_gpio_to_irq(struct gpio_chip *chip, unsigned offset) | |||
217 | } | 167 | } |
218 | 168 | ||
219 | /* the gpiointr register is read-clear, so just do nothing. */ | 169 | /* the gpiointr register is read-clear, so just do nothing. */ |
220 | static void pmic_irq_unmask(unsigned irq) | 170 | static void pmic_irq_unmask(struct irq_data *data) { } |
221 | { | ||
222 | }; | ||
223 | 171 | ||
224 | static void pmic_irq_mask(unsigned irq) | 172 | static void pmic_irq_mask(struct irq_data *data) { } |
225 | { | ||
226 | }; | ||
227 | 173 | ||
228 | static struct irq_chip pmic_irqchip = { | 174 | static struct irq_chip pmic_irqchip = { |
229 | .name = "PMIC-GPIO", | 175 | .name = "PMIC-GPIO", |
230 | .mask = pmic_irq_mask, | 176 | .irq_mask = pmic_irq_mask, |
231 | .unmask = pmic_irq_unmask, | 177 | .irq_unmask = pmic_irq_unmask, |
232 | .set_type = pmic_irq_type, | 178 | .irq_set_type = pmic_irq_type, |
233 | }; | 179 | }; |
234 | 180 | ||
235 | static void pmic_irq_handler(unsigned irq, struct irq_desc *desc) | 181 | static irqreturn_t pmic_irq_handler(int irq, void *data) |
236 | { | 182 | { |
237 | struct pmic_gpio *pg = (struct pmic_gpio *)get_irq_data(irq); | 183 | struct pmic_gpio *pg = data; |
238 | u8 intsts = *((u8 *)pg->gpiointr + 4); | 184 | u8 intsts = *((u8 *)pg->gpiointr + 4); |
239 | int gpio; | 185 | int gpio; |
186 | irqreturn_t ret = IRQ_NONE; | ||
240 | 187 | ||
241 | for (gpio = 0; gpio < 8; gpio++) { | 188 | for (gpio = 0; gpio < 8; gpio++) { |
242 | if (intsts & (1 << gpio)) { | 189 | if (intsts & (1 << gpio)) { |
243 | pr_debug("pmic pin %d triggered\n", gpio); | 190 | pr_debug("pmic pin %d triggered\n", gpio); |
244 | generic_handle_irq(pg->irq_base + gpio); | 191 | generic_handle_irq(pg->irq_base + gpio); |
192 | ret = IRQ_HANDLED; | ||
245 | } | 193 | } |
246 | } | 194 | } |
247 | 195 | return ret; | |
248 | if (desc->chip->irq_eoi) | ||
249 | desc->chip->irq_eoi(irq_get_irq_data(irq)); | ||
250 | else | ||
251 | dev_warn(pg->chip.dev, "missing EOI handler for irq %d\n", irq); | ||
252 | } | 196 | } |
253 | 197 | ||
254 | static int __devinit platform_pmic_gpio_probe(struct platform_device *pdev) | 198 | static int __devinit platform_pmic_gpio_probe(struct platform_device *pdev) |
@@ -297,8 +241,7 @@ static int __devinit platform_pmic_gpio_probe(struct platform_device *pdev) | |||
297 | pg->chip.can_sleep = 1; | 241 | pg->chip.can_sleep = 1; |
298 | pg->chip.dev = dev; | 242 | pg->chip.dev = dev; |
299 | 243 | ||
300 | INIT_WORK(&pg->irqtypes.work, pmic_irqtype_work); | 244 | mutex_init(&pg->buslock); |
301 | spin_lock_init(&pg->irqtypes.lock); | ||
302 | 245 | ||
303 | pg->chip.dev = dev; | 246 | pg->chip.dev = dev; |
304 | retval = gpiochip_add(&pg->chip); | 247 | retval = gpiochip_add(&pg->chip); |
@@ -306,8 +249,13 @@ static int __devinit platform_pmic_gpio_probe(struct platform_device *pdev) | |||
306 | printk(KERN_ERR "%s: Can not add pmic gpio chip.\n", __func__); | 249 | printk(KERN_ERR "%s: Can not add pmic gpio chip.\n", __func__); |
307 | goto err; | 250 | goto err; |
308 | } | 251 | } |
309 | set_irq_data(pg->irq, pg); | 252 | |
310 | set_irq_chained_handler(pg->irq, pmic_irq_handler); | 253 | retval = request_irq(pg->irq, pmic_irq_handler, 0, "pmic", pg); |
254 | if (retval) { | ||
255 | printk(KERN_WARNING "pmic: Interrupt request failed\n"); | ||
256 | goto err; | ||
257 | } | ||
258 | |||
311 | for (i = 0; i < 8; i++) { | 259 | for (i = 0; i < 8; i++) { |
312 | set_irq_chip_and_handler_name(i + pg->irq_base, &pmic_irqchip, | 260 | set_irq_chip_and_handler_name(i + pg->irq_base, &pmic_irqchip, |
313 | handle_simple_irq, "demux"); | 261 | handle_simple_irq, "demux"); |
diff --git a/drivers/platform/x86/tc1100-wmi.c b/drivers/platform/x86/tc1100-wmi.c index 1fe0f1feff71..865ef78d6f1a 100644 --- a/drivers/platform/x86/tc1100-wmi.c +++ b/drivers/platform/x86/tc1100-wmi.c | |||
@@ -162,7 +162,7 @@ set_bool_##value(struct device *dev, struct device_attribute *attr, \ | |||
162 | return -EINVAL; \ | 162 | return -EINVAL; \ |
163 | return count; \ | 163 | return count; \ |
164 | } \ | 164 | } \ |
165 | static DEVICE_ATTR(value, S_IWUGO | S_IRUGO | S_IWUSR, \ | 165 | static DEVICE_ATTR(value, S_IRUGO | S_IWUSR, \ |
166 | show_bool_##value, set_bool_##value); | 166 | show_bool_##value, set_bool_##value); |
167 | 167 | ||
168 | show_set_bool(wireless, TC1100_INSTANCE_WIRELESS); | 168 | show_set_bool(wireless, TC1100_INSTANCE_WIRELESS); |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index dd599585c6a9..eb9922385ef8 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -2275,16 +2275,12 @@ static void tpacpi_input_send_key(const unsigned int scancode) | |||
2275 | if (keycode != KEY_RESERVED) { | 2275 | if (keycode != KEY_RESERVED) { |
2276 | mutex_lock(&tpacpi_inputdev_send_mutex); | 2276 | mutex_lock(&tpacpi_inputdev_send_mutex); |
2277 | 2277 | ||
2278 | input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, scancode); | ||
2278 | input_report_key(tpacpi_inputdev, keycode, 1); | 2279 | input_report_key(tpacpi_inputdev, keycode, 1); |
2279 | if (keycode == KEY_UNKNOWN) | ||
2280 | input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, | ||
2281 | scancode); | ||
2282 | input_sync(tpacpi_inputdev); | 2280 | input_sync(tpacpi_inputdev); |
2283 | 2281 | ||
2282 | input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, scancode); | ||
2284 | input_report_key(tpacpi_inputdev, keycode, 0); | 2283 | input_report_key(tpacpi_inputdev, keycode, 0); |
2285 | if (keycode == KEY_UNKNOWN) | ||
2286 | input_event(tpacpi_inputdev, EV_MSC, MSC_SCAN, | ||
2287 | scancode); | ||
2288 | input_sync(tpacpi_inputdev); | 2284 | input_sync(tpacpi_inputdev); |
2289 | 2285 | ||
2290 | mutex_unlock(&tpacpi_inputdev_send_mutex); | 2286 | mutex_unlock(&tpacpi_inputdev_send_mutex); |
diff --git a/drivers/pps/generators/Kconfig b/drivers/pps/generators/Kconfig index f3a73dd77660..e4c4f3dc0728 100644 --- a/drivers/pps/generators/Kconfig +++ b/drivers/pps/generators/Kconfig | |||
@@ -6,7 +6,7 @@ comment "PPS generators support" | |||
6 | 6 | ||
7 | config PPS_GENERATOR_PARPORT | 7 | config PPS_GENERATOR_PARPORT |
8 | tristate "Parallel port PPS signal generator" | 8 | tristate "Parallel port PPS signal generator" |
9 | depends on PARPORT | 9 | depends on PARPORT && BROKEN |
10 | help | 10 | help |
11 | If you say yes here you get support for a PPS signal generator which | 11 | If you say yes here you get support for a PPS signal generator which |
12 | utilizes STROBE pin of a parallel port to send PPS signals. It uses | 12 | utilizes STROBE pin of a parallel port to send PPS signals. It uses |
diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c index cba1b43f7519..a4e8eb9fece6 100644 --- a/drivers/pps/kapi.c +++ b/drivers/pps/kapi.c | |||
@@ -168,7 +168,7 @@ void pps_event(struct pps_device *pps, struct pps_event_time *ts, int event, | |||
168 | { | 168 | { |
169 | unsigned long flags; | 169 | unsigned long flags; |
170 | int captured = 0; | 170 | int captured = 0; |
171 | struct pps_ktime ts_real; | 171 | struct pps_ktime ts_real = { .sec = 0, .nsec = 0, .flags = 0 }; |
172 | 172 | ||
173 | /* check event type */ | 173 | /* check event type */ |
174 | BUG_ON((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0); | 174 | BUG_ON((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0); |
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c index 76b41853a877..1269fbd2deca 100644 --- a/drivers/rapidio/rio-sysfs.c +++ b/drivers/rapidio/rio-sysfs.c | |||
@@ -77,9 +77,9 @@ rio_read_config(struct file *filp, struct kobject *kobj, | |||
77 | 77 | ||
78 | /* Several chips lock up trying to read undefined config space */ | 78 | /* Several chips lock up trying to read undefined config space */ |
79 | if (capable(CAP_SYS_ADMIN)) | 79 | if (capable(CAP_SYS_ADMIN)) |
80 | size = 0x200000; | 80 | size = RIO_MAINT_SPACE_SZ; |
81 | 81 | ||
82 | if (off > size) | 82 | if (off >= size) |
83 | return 0; | 83 | return 0; |
84 | if (off + count > size) { | 84 | if (off + count > size) { |
85 | size -= off; | 85 | size -= off; |
@@ -147,10 +147,10 @@ rio_write_config(struct file *filp, struct kobject *kobj, | |||
147 | loff_t init_off = off; | 147 | loff_t init_off = off; |
148 | u8 *data = (u8 *) buf; | 148 | u8 *data = (u8 *) buf; |
149 | 149 | ||
150 | if (off > 0x200000) | 150 | if (off >= RIO_MAINT_SPACE_SZ) |
151 | return 0; | 151 | return 0; |
152 | if (off + count > 0x200000) { | 152 | if (off + count > RIO_MAINT_SPACE_SZ) { |
153 | size = 0x200000 - off; | 153 | size = RIO_MAINT_SPACE_SZ - off; |
154 | count = size; | 154 | count = size; |
155 | } | 155 | } |
156 | 156 | ||
@@ -200,7 +200,7 @@ static struct bin_attribute rio_config_attr = { | |||
200 | .name = "config", | 200 | .name = "config", |
201 | .mode = S_IRUGO | S_IWUSR, | 201 | .mode = S_IRUGO | S_IWUSR, |
202 | }, | 202 | }, |
203 | .size = 0x200000, | 203 | .size = RIO_MAINT_SPACE_SZ, |
204 | .read = rio_read_config, | 204 | .read = rio_read_config, |
205 | .write = rio_write_config, | 205 | .write = rio_write_config, |
206 | }; | 206 | }; |
diff --git a/drivers/regulator/mc13xxx-regulator-core.c b/drivers/regulator/mc13xxx-regulator-core.c index f53d31b950d4..2bb5de1f2421 100644 --- a/drivers/regulator/mc13xxx-regulator-core.c +++ b/drivers/regulator/mc13xxx-regulator-core.c | |||
@@ -174,7 +174,7 @@ static int mc13xxx_regulator_get_voltage(struct regulator_dev *rdev) | |||
174 | 174 | ||
175 | dev_dbg(rdev_get_dev(rdev), "%s id: %d val: %d\n", __func__, id, val); | 175 | dev_dbg(rdev_get_dev(rdev), "%s id: %d val: %d\n", __func__, id, val); |
176 | 176 | ||
177 | BUG_ON(val < 0 || val > mc13xxx_regulators[id].desc.n_voltages); | 177 | BUG_ON(val > mc13xxx_regulators[id].desc.n_voltages); |
178 | 178 | ||
179 | return mc13xxx_regulators[id].voltages[val]; | 179 | return mc13xxx_regulators[id].voltages[val]; |
180 | } | 180 | } |
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c index 8b0d2c4bde91..06df898842c0 100644 --- a/drivers/regulator/wm831x-dcdc.c +++ b/drivers/regulator/wm831x-dcdc.c | |||
@@ -120,6 +120,7 @@ static unsigned int wm831x_dcdc_get_mode(struct regulator_dev *rdev) | |||
120 | return REGULATOR_MODE_IDLE; | 120 | return REGULATOR_MODE_IDLE; |
121 | default: | 121 | default: |
122 | BUG(); | 122 | BUG(); |
123 | return -EINVAL; | ||
123 | } | 124 | } |
124 | } | 125 | } |
125 | 126 | ||
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index c36749e4c926..5469c52cba3d 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c | |||
@@ -309,7 +309,7 @@ static const struct rtc_class_ops at91_rtc_ops = { | |||
309 | .read_alarm = at91_rtc_readalarm, | 309 | .read_alarm = at91_rtc_readalarm, |
310 | .set_alarm = at91_rtc_setalarm, | 310 | .set_alarm = at91_rtc_setalarm, |
311 | .proc = at91_rtc_proc, | 311 | .proc = at91_rtc_proc, |
312 | .alarm_irq_enabled = at91_rtc_alarm_irq_enable, | 312 | .alarm_irq_enable = at91_rtc_alarm_irq_enable, |
313 | }; | 313 | }; |
314 | 314 | ||
315 | /* | 315 | /* |
diff --git a/drivers/rtc/rtc-ds3232.c b/drivers/rtc/rtc-ds3232.c index 23a9ee19764c..950735415a7c 100644 --- a/drivers/rtc/rtc-ds3232.c +++ b/drivers/rtc/rtc-ds3232.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * RTC client/driver for the Maxim/Dallas DS3232 Real-Time Clock over I2C | 2 | * RTC client/driver for the Maxim/Dallas DS3232 Real-Time Clock over I2C |
3 | * | 3 | * |
4 | * Copyright (C) 2009-2010 Freescale Semiconductor. | 4 | * Copyright (C) 2009-2011 Freescale Semiconductor. |
5 | * Author: Jack Lan <jack.lan@freescale.com> | 5 | * Author: Jack Lan <jack.lan@freescale.com> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify it | 7 | * This program is free software; you can redistribute it and/or modify it |
@@ -141,9 +141,11 @@ static int ds3232_read_time(struct device *dev, struct rtc_time *time) | |||
141 | time->tm_hour = bcd2bin(hour); | 141 | time->tm_hour = bcd2bin(hour); |
142 | } | 142 | } |
143 | 143 | ||
144 | time->tm_wday = bcd2bin(week); | 144 | /* Day of the week in linux range is 0~6 while 1~7 in RTC chip */ |
145 | time->tm_wday = bcd2bin(week) - 1; | ||
145 | time->tm_mday = bcd2bin(day); | 146 | time->tm_mday = bcd2bin(day); |
146 | time->tm_mon = bcd2bin(month & 0x7F); | 147 | /* linux tm_mon range:0~11, while month range is 1~12 in RTC chip */ |
148 | time->tm_mon = bcd2bin(month & 0x7F) - 1; | ||
147 | if (century) | 149 | if (century) |
148 | add_century = 100; | 150 | add_century = 100; |
149 | 151 | ||
@@ -162,9 +164,11 @@ static int ds3232_set_time(struct device *dev, struct rtc_time *time) | |||
162 | buf[0] = bin2bcd(time->tm_sec); | 164 | buf[0] = bin2bcd(time->tm_sec); |
163 | buf[1] = bin2bcd(time->tm_min); | 165 | buf[1] = bin2bcd(time->tm_min); |
164 | buf[2] = bin2bcd(time->tm_hour); | 166 | buf[2] = bin2bcd(time->tm_hour); |
165 | buf[3] = bin2bcd(time->tm_wday); /* Day of the week */ | 167 | /* Day of the week in linux range is 0~6 while 1~7 in RTC chip */ |
168 | buf[3] = bin2bcd(time->tm_wday + 1); | ||
166 | buf[4] = bin2bcd(time->tm_mday); /* Date */ | 169 | buf[4] = bin2bcd(time->tm_mday); /* Date */ |
167 | buf[5] = bin2bcd(time->tm_mon); | 170 | /* linux tm_mon range:0~11, while month range is 1~12 in RTC chip */ |
171 | buf[5] = bin2bcd(time->tm_mon + 1); | ||
168 | if (time->tm_year >= 100) { | 172 | if (time->tm_year >= 100) { |
169 | buf[5] |= 0x80; | 173 | buf[5] |= 0x80; |
170 | buf[6] = bin2bcd(time->tm_year - 100); | 174 | buf[6] = bin2bcd(time->tm_year - 100); |
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index cf953ecbfca9..b80fa2882408 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -77,18 +77,20 @@ static irqreturn_t s3c_rtc_tickirq(int irq, void *id) | |||
77 | } | 77 | } |
78 | 78 | ||
79 | /* Update control registers */ | 79 | /* Update control registers */ |
80 | static void s3c_rtc_setaie(int to) | 80 | static int s3c_rtc_setaie(struct device *dev, unsigned int enabled) |
81 | { | 81 | { |
82 | unsigned int tmp; | 82 | unsigned int tmp; |
83 | 83 | ||
84 | pr_debug("%s: aie=%d\n", __func__, to); | 84 | pr_debug("%s: aie=%d\n", __func__, enabled); |
85 | 85 | ||
86 | tmp = readb(s3c_rtc_base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN; | 86 | tmp = readb(s3c_rtc_base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN; |
87 | 87 | ||
88 | if (to) | 88 | if (enabled) |
89 | tmp |= S3C2410_RTCALM_ALMEN; | 89 | tmp |= S3C2410_RTCALM_ALMEN; |
90 | 90 | ||
91 | writeb(tmp, s3c_rtc_base + S3C2410_RTCALM); | 91 | writeb(tmp, s3c_rtc_base + S3C2410_RTCALM); |
92 | |||
93 | return 0; | ||
92 | } | 94 | } |
93 | 95 | ||
94 | static int s3c_rtc_setpie(struct device *dev, int enabled) | 96 | static int s3c_rtc_setpie(struct device *dev, int enabled) |
@@ -308,7 +310,7 @@ static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
308 | 310 | ||
309 | writeb(alrm_en, base + S3C2410_RTCALM); | 311 | writeb(alrm_en, base + S3C2410_RTCALM); |
310 | 312 | ||
311 | s3c_rtc_setaie(alrm->enabled); | 313 | s3c_rtc_setaie(dev, alrm->enabled); |
312 | 314 | ||
313 | return 0; | 315 | return 0; |
314 | } | 316 | } |
@@ -440,7 +442,7 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev) | |||
440 | rtc_device_unregister(rtc); | 442 | rtc_device_unregister(rtc); |
441 | 443 | ||
442 | s3c_rtc_setpie(&dev->dev, 0); | 444 | s3c_rtc_setpie(&dev->dev, 0); |
443 | s3c_rtc_setaie(0); | 445 | s3c_rtc_setaie(&dev->dev, 0); |
444 | 446 | ||
445 | clk_disable(rtc_clk); | 447 | clk_disable(rtc_clk); |
446 | clk_put(rtc_clk); | 448 | clk_put(rtc_clk); |
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 318672d05563..a9fe23d5bd0f 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -72,7 +72,7 @@ static struct dasd_discipline dasd_eckd_discipline; | |||
72 | static struct ccw_device_id dasd_eckd_ids[] = { | 72 | static struct ccw_device_id dasd_eckd_ids[] = { |
73 | { CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3390, 0), .driver_info = 0x1}, | 73 | { CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3390, 0), .driver_info = 0x1}, |
74 | { CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3390, 0), .driver_info = 0x2}, | 74 | { CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3390, 0), .driver_info = 0x2}, |
75 | { CCW_DEVICE_DEVTYPE (0x3880, 0, 0x3390, 0), .driver_info = 0x3}, | 75 | { CCW_DEVICE_DEVTYPE (0x3880, 0, 0x3380, 0), .driver_info = 0x3}, |
76 | { CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3380, 0), .driver_info = 0x4}, | 76 | { CCW_DEVICE_DEVTYPE (0x3990, 0, 0x3380, 0), .driver_info = 0x4}, |
77 | { CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3380, 0), .driver_info = 0x5}, | 77 | { CCW_DEVICE_DEVTYPE (0x2105, 0, 0x3380, 0), .driver_info = 0x5}, |
78 | { CCW_DEVICE_DEVTYPE (0x9343, 0, 0x9345, 0), .driver_info = 0x6}, | 78 | { CCW_DEVICE_DEVTYPE (0x9343, 0, 0x9345, 0), .driver_info = 0x6}, |
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c index c881a14fa5dd..1f6a4d894e73 100644 --- a/drivers/s390/block/xpram.c +++ b/drivers/s390/block/xpram.c | |||
@@ -62,8 +62,8 @@ static int xpram_devs; | |||
62 | /* | 62 | /* |
63 | * Parameter parsing functions. | 63 | * Parameter parsing functions. |
64 | */ | 64 | */ |
65 | static int __initdata devs = XPRAM_DEVS; | 65 | static int devs = XPRAM_DEVS; |
66 | static char __initdata *sizes[XPRAM_MAX_DEVS]; | 66 | static char *sizes[XPRAM_MAX_DEVS]; |
67 | 67 | ||
68 | module_param(devs, int, 0); | 68 | module_param(devs, int, 0); |
69 | module_param_array(sizes, charp, NULL, 0); | 69 | module_param_array(sizes, charp, NULL, 0); |
diff --git a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c index 8cd58e412b5e..5ad44daef73b 100644 --- a/drivers/s390/char/keyboard.c +++ b/drivers/s390/char/keyboard.c | |||
@@ -460,7 +460,8 @@ kbd_ioctl(struct kbd_data *kbd, struct file *file, | |||
460 | unsigned int cmd, unsigned long arg) | 460 | unsigned int cmd, unsigned long arg) |
461 | { | 461 | { |
462 | void __user *argp; | 462 | void __user *argp; |
463 | int ct, perm; | 463 | unsigned int ct; |
464 | int perm; | ||
464 | 465 | ||
465 | argp = (void __user *)arg; | 466 | argp = (void __user *)arg; |
466 | 467 | ||
diff --git a/drivers/s390/char/tape.h b/drivers/s390/char/tape.h index 7a242f073632..267b54e8ff5a 100644 --- a/drivers/s390/char/tape.h +++ b/drivers/s390/char/tape.h | |||
@@ -280,6 +280,14 @@ tape_do_io_free(struct tape_device *device, struct tape_request *request) | |||
280 | return rc; | 280 | return rc; |
281 | } | 281 | } |
282 | 282 | ||
283 | static inline void | ||
284 | tape_do_io_async_free(struct tape_device *device, struct tape_request *request) | ||
285 | { | ||
286 | request->callback = (void *) tape_free_request; | ||
287 | request->callback_data = NULL; | ||
288 | tape_do_io_async(device, request); | ||
289 | } | ||
290 | |||
283 | extern int tape_oper_handler(int irq, int status); | 291 | extern int tape_oper_handler(int irq, int status); |
284 | extern void tape_noper_handler(int irq, int status); | 292 | extern void tape_noper_handler(int irq, int status); |
285 | extern int tape_open(struct tape_device *); | 293 | extern int tape_open(struct tape_device *); |
diff --git a/drivers/s390/char/tape_34xx.c b/drivers/s390/char/tape_34xx.c index c17f35b6136a..c26511171ffe 100644 --- a/drivers/s390/char/tape_34xx.c +++ b/drivers/s390/char/tape_34xx.c | |||
@@ -53,23 +53,11 @@ static void tape_34xx_delete_sbid_from(struct tape_device *, int); | |||
53 | * Medium sense for 34xx tapes. There is no 'real' medium sense call. | 53 | * Medium sense for 34xx tapes. There is no 'real' medium sense call. |
54 | * So we just do a normal sense. | 54 | * So we just do a normal sense. |
55 | */ | 55 | */ |
56 | static int | 56 | static void __tape_34xx_medium_sense(struct tape_request *request) |
57 | tape_34xx_medium_sense(struct tape_device *device) | ||
58 | { | 57 | { |
59 | struct tape_request *request; | 58 | struct tape_device *device = request->device; |
60 | unsigned char *sense; | 59 | unsigned char *sense; |
61 | int rc; | ||
62 | |||
63 | request = tape_alloc_request(1, 32); | ||
64 | if (IS_ERR(request)) { | ||
65 | DBF_EXCEPTION(6, "MSEN fail\n"); | ||
66 | return PTR_ERR(request); | ||
67 | } | ||
68 | |||
69 | request->op = TO_MSEN; | ||
70 | tape_ccw_end(request->cpaddr, SENSE, 32, request->cpdata); | ||
71 | 60 | ||
72 | rc = tape_do_io_interruptible(device, request); | ||
73 | if (request->rc == 0) { | 61 | if (request->rc == 0) { |
74 | sense = request->cpdata; | 62 | sense = request->cpdata; |
75 | 63 | ||
@@ -88,15 +76,47 @@ tape_34xx_medium_sense(struct tape_device *device) | |||
88 | device->tape_generic_status |= GMT_WR_PROT(~0); | 76 | device->tape_generic_status |= GMT_WR_PROT(~0); |
89 | else | 77 | else |
90 | device->tape_generic_status &= ~GMT_WR_PROT(~0); | 78 | device->tape_generic_status &= ~GMT_WR_PROT(~0); |
91 | } else { | 79 | } else |
92 | DBF_EVENT(4, "tape_34xx: medium sense failed with rc=%d\n", | 80 | DBF_EVENT(4, "tape_34xx: medium sense failed with rc=%d\n", |
93 | request->rc); | 81 | request->rc); |
94 | } | ||
95 | tape_free_request(request); | 82 | tape_free_request(request); |
83 | } | ||
84 | |||
85 | static int tape_34xx_medium_sense(struct tape_device *device) | ||
86 | { | ||
87 | struct tape_request *request; | ||
88 | int rc; | ||
89 | |||
90 | request = tape_alloc_request(1, 32); | ||
91 | if (IS_ERR(request)) { | ||
92 | DBF_EXCEPTION(6, "MSEN fail\n"); | ||
93 | return PTR_ERR(request); | ||
94 | } | ||
96 | 95 | ||
96 | request->op = TO_MSEN; | ||
97 | tape_ccw_end(request->cpaddr, SENSE, 32, request->cpdata); | ||
98 | rc = tape_do_io_interruptible(device, request); | ||
99 | __tape_34xx_medium_sense(request); | ||
97 | return rc; | 100 | return rc; |
98 | } | 101 | } |
99 | 102 | ||
103 | static void tape_34xx_medium_sense_async(struct tape_device *device) | ||
104 | { | ||
105 | struct tape_request *request; | ||
106 | |||
107 | request = tape_alloc_request(1, 32); | ||
108 | if (IS_ERR(request)) { | ||
109 | DBF_EXCEPTION(6, "MSEN fail\n"); | ||
110 | return; | ||
111 | } | ||
112 | |||
113 | request->op = TO_MSEN; | ||
114 | tape_ccw_end(request->cpaddr, SENSE, 32, request->cpdata); | ||
115 | request->callback = (void *) __tape_34xx_medium_sense; | ||
116 | request->callback_data = NULL; | ||
117 | tape_do_io_async(device, request); | ||
118 | } | ||
119 | |||
100 | struct tape_34xx_work { | 120 | struct tape_34xx_work { |
101 | struct tape_device *device; | 121 | struct tape_device *device; |
102 | enum tape_op op; | 122 | enum tape_op op; |
@@ -109,6 +129,9 @@ struct tape_34xx_work { | |||
109 | * is inserted but cannot call tape_do_io* from an interrupt context. | 129 | * is inserted but cannot call tape_do_io* from an interrupt context. |
110 | * Maybe that's useful for other actions we want to start from the | 130 | * Maybe that's useful for other actions we want to start from the |
111 | * interrupt handler. | 131 | * interrupt handler. |
132 | * Note: the work handler is called by the system work queue. The tape | ||
133 | * commands started by the handler need to be asynchrounous, otherwise | ||
134 | * a deadlock can occur e.g. in case of a deferred cc=1 (see __tape_do_irq). | ||
112 | */ | 135 | */ |
113 | static void | 136 | static void |
114 | tape_34xx_work_handler(struct work_struct *work) | 137 | tape_34xx_work_handler(struct work_struct *work) |
@@ -119,7 +142,7 @@ tape_34xx_work_handler(struct work_struct *work) | |||
119 | 142 | ||
120 | switch(p->op) { | 143 | switch(p->op) { |
121 | case TO_MSEN: | 144 | case TO_MSEN: |
122 | tape_34xx_medium_sense(device); | 145 | tape_34xx_medium_sense_async(device); |
123 | break; | 146 | break; |
124 | default: | 147 | default: |
125 | DBF_EVENT(3, "T34XX: internal error: unknown work\n"); | 148 | DBF_EVENT(3, "T34XX: internal error: unknown work\n"); |
diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c index fbe361fcd2c0..de2e99e0a71b 100644 --- a/drivers/s390/char/tape_3590.c +++ b/drivers/s390/char/tape_3590.c | |||
@@ -329,17 +329,17 @@ out: | |||
329 | /* | 329 | /* |
330 | * Enable encryption | 330 | * Enable encryption |
331 | */ | 331 | */ |
332 | static int tape_3592_enable_crypt(struct tape_device *device) | 332 | static struct tape_request *__tape_3592_enable_crypt(struct tape_device *device) |
333 | { | 333 | { |
334 | struct tape_request *request; | 334 | struct tape_request *request; |
335 | char *data; | 335 | char *data; |
336 | 336 | ||
337 | DBF_EVENT(6, "tape_3592_enable_crypt\n"); | 337 | DBF_EVENT(6, "tape_3592_enable_crypt\n"); |
338 | if (!crypt_supported(device)) | 338 | if (!crypt_supported(device)) |
339 | return -ENOSYS; | 339 | return ERR_PTR(-ENOSYS); |
340 | request = tape_alloc_request(2, 72); | 340 | request = tape_alloc_request(2, 72); |
341 | if (IS_ERR(request)) | 341 | if (IS_ERR(request)) |
342 | return PTR_ERR(request); | 342 | return request; |
343 | data = request->cpdata; | 343 | data = request->cpdata; |
344 | memset(data,0,72); | 344 | memset(data,0,72); |
345 | 345 | ||
@@ -354,23 +354,42 @@ static int tape_3592_enable_crypt(struct tape_device *device) | |||
354 | request->op = TO_CRYPT_ON; | 354 | request->op = TO_CRYPT_ON; |
355 | tape_ccw_cc(request->cpaddr, MODE_SET_CB, 36, data); | 355 | tape_ccw_cc(request->cpaddr, MODE_SET_CB, 36, data); |
356 | tape_ccw_end(request->cpaddr + 1, MODE_SET_CB, 36, data + 36); | 356 | tape_ccw_end(request->cpaddr + 1, MODE_SET_CB, 36, data + 36); |
357 | return request; | ||
358 | } | ||
359 | |||
360 | static int tape_3592_enable_crypt(struct tape_device *device) | ||
361 | { | ||
362 | struct tape_request *request; | ||
363 | |||
364 | request = __tape_3592_enable_crypt(device); | ||
365 | if (IS_ERR(request)) | ||
366 | return PTR_ERR(request); | ||
357 | return tape_do_io_free(device, request); | 367 | return tape_do_io_free(device, request); |
358 | } | 368 | } |
359 | 369 | ||
370 | static void tape_3592_enable_crypt_async(struct tape_device *device) | ||
371 | { | ||
372 | struct tape_request *request; | ||
373 | |||
374 | request = __tape_3592_enable_crypt(device); | ||
375 | if (!IS_ERR(request)) | ||
376 | tape_do_io_async_free(device, request); | ||
377 | } | ||
378 | |||
360 | /* | 379 | /* |
361 | * Disable encryption | 380 | * Disable encryption |
362 | */ | 381 | */ |
363 | static int tape_3592_disable_crypt(struct tape_device *device) | 382 | static struct tape_request *__tape_3592_disable_crypt(struct tape_device *device) |
364 | { | 383 | { |
365 | struct tape_request *request; | 384 | struct tape_request *request; |
366 | char *data; | 385 | char *data; |
367 | 386 | ||
368 | DBF_EVENT(6, "tape_3592_disable_crypt\n"); | 387 | DBF_EVENT(6, "tape_3592_disable_crypt\n"); |
369 | if (!crypt_supported(device)) | 388 | if (!crypt_supported(device)) |
370 | return -ENOSYS; | 389 | return ERR_PTR(-ENOSYS); |
371 | request = tape_alloc_request(2, 72); | 390 | request = tape_alloc_request(2, 72); |
372 | if (IS_ERR(request)) | 391 | if (IS_ERR(request)) |
373 | return PTR_ERR(request); | 392 | return request; |
374 | data = request->cpdata; | 393 | data = request->cpdata; |
375 | memset(data,0,72); | 394 | memset(data,0,72); |
376 | 395 | ||
@@ -383,9 +402,28 @@ static int tape_3592_disable_crypt(struct tape_device *device) | |||
383 | tape_ccw_cc(request->cpaddr, MODE_SET_CB, 36, data); | 402 | tape_ccw_cc(request->cpaddr, MODE_SET_CB, 36, data); |
384 | tape_ccw_end(request->cpaddr + 1, MODE_SET_CB, 36, data + 36); | 403 | tape_ccw_end(request->cpaddr + 1, MODE_SET_CB, 36, data + 36); |
385 | 404 | ||
405 | return request; | ||
406 | } | ||
407 | |||
408 | static int tape_3592_disable_crypt(struct tape_device *device) | ||
409 | { | ||
410 | struct tape_request *request; | ||
411 | |||
412 | request = __tape_3592_disable_crypt(device); | ||
413 | if (IS_ERR(request)) | ||
414 | return PTR_ERR(request); | ||
386 | return tape_do_io_free(device, request); | 415 | return tape_do_io_free(device, request); |
387 | } | 416 | } |
388 | 417 | ||
418 | static void tape_3592_disable_crypt_async(struct tape_device *device) | ||
419 | { | ||
420 | struct tape_request *request; | ||
421 | |||
422 | request = __tape_3592_disable_crypt(device); | ||
423 | if (!IS_ERR(request)) | ||
424 | tape_do_io_async_free(device, request); | ||
425 | } | ||
426 | |||
389 | /* | 427 | /* |
390 | * IOCTL: Set encryption status | 428 | * IOCTL: Set encryption status |
391 | */ | 429 | */ |
@@ -457,8 +495,7 @@ tape_3590_ioctl(struct tape_device *device, unsigned int cmd, unsigned long arg) | |||
457 | /* | 495 | /* |
458 | * SENSE Medium: Get Sense data about medium state | 496 | * SENSE Medium: Get Sense data about medium state |
459 | */ | 497 | */ |
460 | static int | 498 | static int tape_3590_sense_medium(struct tape_device *device) |
461 | tape_3590_sense_medium(struct tape_device *device) | ||
462 | { | 499 | { |
463 | struct tape_request *request; | 500 | struct tape_request *request; |
464 | 501 | ||
@@ -470,6 +507,18 @@ tape_3590_sense_medium(struct tape_device *device) | |||
470 | return tape_do_io_free(device, request); | 507 | return tape_do_io_free(device, request); |
471 | } | 508 | } |
472 | 509 | ||
510 | static void tape_3590_sense_medium_async(struct tape_device *device) | ||
511 | { | ||
512 | struct tape_request *request; | ||
513 | |||
514 | request = tape_alloc_request(1, 128); | ||
515 | if (IS_ERR(request)) | ||
516 | return; | ||
517 | request->op = TO_MSEN; | ||
518 | tape_ccw_end(request->cpaddr, MEDIUM_SENSE, 128, request->cpdata); | ||
519 | tape_do_io_async_free(device, request); | ||
520 | } | ||
521 | |||
473 | /* | 522 | /* |
474 | * MTTELL: Tell block. Return the number of block relative to current file. | 523 | * MTTELL: Tell block. Return the number of block relative to current file. |
475 | */ | 524 | */ |
@@ -546,15 +595,14 @@ tape_3590_read_opposite(struct tape_device *device, | |||
546 | * 2. The attention msg is written to the "read subsystem data" buffer. | 595 | * 2. The attention msg is written to the "read subsystem data" buffer. |
547 | * In this case we probably should print it to the console. | 596 | * In this case we probably should print it to the console. |
548 | */ | 597 | */ |
549 | static int | 598 | static void tape_3590_read_attmsg_async(struct tape_device *device) |
550 | tape_3590_read_attmsg(struct tape_device *device) | ||
551 | { | 599 | { |
552 | struct tape_request *request; | 600 | struct tape_request *request; |
553 | char *buf; | 601 | char *buf; |
554 | 602 | ||
555 | request = tape_alloc_request(3, 4096); | 603 | request = tape_alloc_request(3, 4096); |
556 | if (IS_ERR(request)) | 604 | if (IS_ERR(request)) |
557 | return PTR_ERR(request); | 605 | return; |
558 | request->op = TO_READ_ATTMSG; | 606 | request->op = TO_READ_ATTMSG; |
559 | buf = request->cpdata; | 607 | buf = request->cpdata; |
560 | buf[0] = PREP_RD_SS_DATA; | 608 | buf[0] = PREP_RD_SS_DATA; |
@@ -562,12 +610,15 @@ tape_3590_read_attmsg(struct tape_device *device) | |||
562 | tape_ccw_cc(request->cpaddr, PERFORM_SS_FUNC, 12, buf); | 610 | tape_ccw_cc(request->cpaddr, PERFORM_SS_FUNC, 12, buf); |
563 | tape_ccw_cc(request->cpaddr + 1, READ_SS_DATA, 4096 - 12, buf + 12); | 611 | tape_ccw_cc(request->cpaddr + 1, READ_SS_DATA, 4096 - 12, buf + 12); |
564 | tape_ccw_end(request->cpaddr + 2, NOP, 0, NULL); | 612 | tape_ccw_end(request->cpaddr + 2, NOP, 0, NULL); |
565 | return tape_do_io_free(device, request); | 613 | tape_do_io_async_free(device, request); |
566 | } | 614 | } |
567 | 615 | ||
568 | /* | 616 | /* |
569 | * These functions are used to schedule follow-up actions from within an | 617 | * These functions are used to schedule follow-up actions from within an |
570 | * interrupt context (like unsolicited interrupts). | 618 | * interrupt context (like unsolicited interrupts). |
619 | * Note: the work handler is called by the system work queue. The tape | ||
620 | * commands started by the handler need to be asynchrounous, otherwise | ||
621 | * a deadlock can occur e.g. in case of a deferred cc=1 (see __tape_do_irq). | ||
571 | */ | 622 | */ |
572 | struct work_handler_data { | 623 | struct work_handler_data { |
573 | struct tape_device *device; | 624 | struct tape_device *device; |
@@ -583,16 +634,16 @@ tape_3590_work_handler(struct work_struct *work) | |||
583 | 634 | ||
584 | switch (p->op) { | 635 | switch (p->op) { |
585 | case TO_MSEN: | 636 | case TO_MSEN: |
586 | tape_3590_sense_medium(p->device); | 637 | tape_3590_sense_medium_async(p->device); |
587 | break; | 638 | break; |
588 | case TO_READ_ATTMSG: | 639 | case TO_READ_ATTMSG: |
589 | tape_3590_read_attmsg(p->device); | 640 | tape_3590_read_attmsg_async(p->device); |
590 | break; | 641 | break; |
591 | case TO_CRYPT_ON: | 642 | case TO_CRYPT_ON: |
592 | tape_3592_enable_crypt(p->device); | 643 | tape_3592_enable_crypt_async(p->device); |
593 | break; | 644 | break; |
594 | case TO_CRYPT_OFF: | 645 | case TO_CRYPT_OFF: |
595 | tape_3592_disable_crypt(p->device); | 646 | tape_3592_disable_crypt_async(p->device); |
596 | break; | 647 | break; |
597 | default: | 648 | default: |
598 | DBF_EVENT(3, "T3590: work handler undefined for " | 649 | DBF_EVENT(3, "T3590: work handler undefined for " |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9045c52abd25..fb2bb35c62cb 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -443,7 +443,7 @@ static void scsi_run_queue(struct request_queue *q) | |||
443 | &sdev->request_queue->queue_flags); | 443 | &sdev->request_queue->queue_flags); |
444 | if (flagset) | 444 | if (flagset) |
445 | queue_flag_set(QUEUE_FLAG_REENTER, sdev->request_queue); | 445 | queue_flag_set(QUEUE_FLAG_REENTER, sdev->request_queue); |
446 | __blk_run_queue(sdev->request_queue); | 446 | __blk_run_queue(sdev->request_queue, false); |
447 | if (flagset) | 447 | if (flagset) |
448 | queue_flag_clear(QUEUE_FLAG_REENTER, sdev->request_queue); | 448 | queue_flag_clear(QUEUE_FLAG_REENTER, sdev->request_queue); |
449 | spin_unlock(sdev->request_queue->queue_lock); | 449 | spin_unlock(sdev->request_queue->queue_lock); |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 998c01be3234..5c3ccfc6b622 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -3829,7 +3829,7 @@ fc_bsg_goose_queue(struct fc_rport *rport) | |||
3829 | !test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags); | 3829 | !test_bit(QUEUE_FLAG_REENTER, &rport->rqst_q->queue_flags); |
3830 | if (flagset) | 3830 | if (flagset) |
3831 | queue_flag_set(QUEUE_FLAG_REENTER, rport->rqst_q); | 3831 | queue_flag_set(QUEUE_FLAG_REENTER, rport->rqst_q); |
3832 | __blk_run_queue(rport->rqst_q); | 3832 | __blk_run_queue(rport->rqst_q, false); |
3833 | if (flagset) | 3833 | if (flagset) |
3834 | queue_flag_clear(QUEUE_FLAG_REENTER, rport->rqst_q); | 3834 | queue_flag_clear(QUEUE_FLAG_REENTER, rport->rqst_q); |
3835 | spin_unlock_irqrestore(rport->rqst_q->queue_lock, flags); | 3835 | spin_unlock_irqrestore(rport->rqst_q->queue_lock, flags); |
diff --git a/drivers/target/target_core_tmr.c b/drivers/target/target_core_tmr.c index 158cecbec718..4a109835e420 100644 --- a/drivers/target/target_core_tmr.c +++ b/drivers/target/target_core_tmr.c | |||
@@ -282,6 +282,9 @@ int core_tmr_lun_reset( | |||
282 | 282 | ||
283 | atomic_set(&task->task_active, 0); | 283 | atomic_set(&task->task_active, 0); |
284 | atomic_set(&task->task_stop, 0); | 284 | atomic_set(&task->task_stop, 0); |
285 | } else { | ||
286 | if (atomic_read(&task->task_execute_queue) != 0) | ||
287 | transport_remove_task_from_execute_queue(task, dev); | ||
285 | } | 288 | } |
286 | __transport_stop_task_timer(task, &flags); | 289 | __transport_stop_task_timer(task, &flags); |
287 | 290 | ||
@@ -301,6 +304,7 @@ int core_tmr_lun_reset( | |||
301 | DEBUG_LR("LUN_RESET: got t_transport_active = 1 for" | 304 | DEBUG_LR("LUN_RESET: got t_transport_active = 1 for" |
302 | " task: %p, t_fe_count: %d dev: %p\n", task, | 305 | " task: %p, t_fe_count: %d dev: %p\n", task, |
303 | fe_count, dev); | 306 | fe_count, dev); |
307 | atomic_set(&T_TASK(cmd)->t_transport_aborted, 1); | ||
304 | spin_unlock_irqrestore(&T_TASK(cmd)->t_state_lock, | 308 | spin_unlock_irqrestore(&T_TASK(cmd)->t_state_lock, |
305 | flags); | 309 | flags); |
306 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, fe_count); | 310 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, fe_count); |
@@ -310,6 +314,7 @@ int core_tmr_lun_reset( | |||
310 | } | 314 | } |
311 | DEBUG_LR("LUN_RESET: Got t_transport_active = 0 for task: %p," | 315 | DEBUG_LR("LUN_RESET: Got t_transport_active = 0 for task: %p," |
312 | " t_fe_count: %d dev: %p\n", task, fe_count, dev); | 316 | " t_fe_count: %d dev: %p\n", task, fe_count, dev); |
317 | atomic_set(&T_TASK(cmd)->t_transport_aborted, 1); | ||
313 | spin_unlock_irqrestore(&T_TASK(cmd)->t_state_lock, flags); | 318 | spin_unlock_irqrestore(&T_TASK(cmd)->t_state_lock, flags); |
314 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, fe_count); | 319 | core_tmr_handle_tas_abort(tmr_nacl, cmd, tas, fe_count); |
315 | 320 | ||
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 236e22d8cfae..4bbf6c147f89 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c | |||
@@ -1207,7 +1207,7 @@ transport_get_task_from_execute_queue(struct se_device *dev) | |||
1207 | * | 1207 | * |
1208 | * | 1208 | * |
1209 | */ | 1209 | */ |
1210 | static void transport_remove_task_from_execute_queue( | 1210 | void transport_remove_task_from_execute_queue( |
1211 | struct se_task *task, | 1211 | struct se_task *task, |
1212 | struct se_device *dev) | 1212 | struct se_device *dev) |
1213 | { | 1213 | { |
@@ -5549,7 +5549,8 @@ static void transport_generic_wait_for_tasks( | |||
5549 | 5549 | ||
5550 | atomic_set(&T_TASK(cmd)->transport_lun_stop, 0); | 5550 | atomic_set(&T_TASK(cmd)->transport_lun_stop, 0); |
5551 | } | 5551 | } |
5552 | if (!atomic_read(&T_TASK(cmd)->t_transport_active)) | 5552 | if (!atomic_read(&T_TASK(cmd)->t_transport_active) || |
5553 | atomic_read(&T_TASK(cmd)->t_transport_aborted)) | ||
5553 | goto remove; | 5554 | goto remove; |
5554 | 5555 | ||
5555 | atomic_set(&T_TASK(cmd)->t_transport_stop, 1); | 5556 | atomic_set(&T_TASK(cmd)->t_transport_stop, 1); |
@@ -5956,6 +5957,9 @@ static void transport_processing_shutdown(struct se_device *dev) | |||
5956 | 5957 | ||
5957 | atomic_set(&task->task_active, 0); | 5958 | atomic_set(&task->task_active, 0); |
5958 | atomic_set(&task->task_stop, 0); | 5959 | atomic_set(&task->task_stop, 0); |
5960 | } else { | ||
5961 | if (atomic_read(&task->task_execute_queue) != 0) | ||
5962 | transport_remove_task_from_execute_queue(task, dev); | ||
5959 | } | 5963 | } |
5960 | __transport_stop_task_timer(task, &flags); | 5964 | __transport_stop_task_timer(task, &flags); |
5961 | 5965 | ||
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index f7a5dba3ca23..bf7c687519ef 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig | |||
@@ -4,7 +4,6 @@ | |||
4 | 4 | ||
5 | menuconfig THERMAL | 5 | menuconfig THERMAL |
6 | tristate "Generic Thermal sysfs driver" | 6 | tristate "Generic Thermal sysfs driver" |
7 | depends on NET | ||
8 | help | 7 | help |
9 | Generic Thermal Sysfs driver offers a generic mechanism for | 8 | Generic Thermal Sysfs driver offers a generic mechanism for |
10 | thermal management. Usually it's made up of one or more thermal | 9 | thermal management. Usually it's made up of one or more thermal |
diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c index 7d0e63c79280..713b7ea4a607 100644 --- a/drivers/thermal/thermal_sys.c +++ b/drivers/thermal/thermal_sys.c | |||
@@ -62,20 +62,6 @@ static DEFINE_MUTEX(thermal_list_lock); | |||
62 | 62 | ||
63 | static unsigned int thermal_event_seqnum; | 63 | static unsigned int thermal_event_seqnum; |
64 | 64 | ||
65 | static struct genl_family thermal_event_genl_family = { | ||
66 | .id = GENL_ID_GENERATE, | ||
67 | .name = THERMAL_GENL_FAMILY_NAME, | ||
68 | .version = THERMAL_GENL_VERSION, | ||
69 | .maxattr = THERMAL_GENL_ATTR_MAX, | ||
70 | }; | ||
71 | |||
72 | static struct genl_multicast_group thermal_event_mcgrp = { | ||
73 | .name = THERMAL_GENL_MCAST_GROUP_NAME, | ||
74 | }; | ||
75 | |||
76 | static int genetlink_init(void); | ||
77 | static void genetlink_exit(void); | ||
78 | |||
79 | static int get_idr(struct idr *idr, struct mutex *lock, int *id) | 65 | static int get_idr(struct idr *idr, struct mutex *lock, int *id) |
80 | { | 66 | { |
81 | int err; | 67 | int err; |
@@ -1225,6 +1211,18 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz) | |||
1225 | 1211 | ||
1226 | EXPORT_SYMBOL(thermal_zone_device_unregister); | 1212 | EXPORT_SYMBOL(thermal_zone_device_unregister); |
1227 | 1213 | ||
1214 | #ifdef CONFIG_NET | ||
1215 | static struct genl_family thermal_event_genl_family = { | ||
1216 | .id = GENL_ID_GENERATE, | ||
1217 | .name = THERMAL_GENL_FAMILY_NAME, | ||
1218 | .version = THERMAL_GENL_VERSION, | ||
1219 | .maxattr = THERMAL_GENL_ATTR_MAX, | ||
1220 | }; | ||
1221 | |||
1222 | static struct genl_multicast_group thermal_event_mcgrp = { | ||
1223 | .name = THERMAL_GENL_MCAST_GROUP_NAME, | ||
1224 | }; | ||
1225 | |||
1228 | int generate_netlink_event(u32 orig, enum events event) | 1226 | int generate_netlink_event(u32 orig, enum events event) |
1229 | { | 1227 | { |
1230 | struct sk_buff *skb; | 1228 | struct sk_buff *skb; |
@@ -1301,6 +1299,15 @@ static int genetlink_init(void) | |||
1301 | return result; | 1299 | return result; |
1302 | } | 1300 | } |
1303 | 1301 | ||
1302 | static void genetlink_exit(void) | ||
1303 | { | ||
1304 | genl_unregister_family(&thermal_event_genl_family); | ||
1305 | } | ||
1306 | #else /* !CONFIG_NET */ | ||
1307 | static inline int genetlink_init(void) { return 0; } | ||
1308 | static inline void genetlink_exit(void) {} | ||
1309 | #endif /* !CONFIG_NET */ | ||
1310 | |||
1304 | static int __init thermal_init(void) | 1311 | static int __init thermal_init(void) |
1305 | { | 1312 | { |
1306 | int result = 0; | 1313 | int result = 0; |
@@ -1316,11 +1323,6 @@ static int __init thermal_init(void) | |||
1316 | return result; | 1323 | return result; |
1317 | } | 1324 | } |
1318 | 1325 | ||
1319 | static void genetlink_exit(void) | ||
1320 | { | ||
1321 | genl_unregister_family(&thermal_event_genl_family); | ||
1322 | } | ||
1323 | |||
1324 | static void __exit thermal_exit(void) | 1326 | static void __exit thermal_exit(void) |
1325 | { | 1327 | { |
1326 | class_unregister(&thermal_class); | 1328 | class_unregister(&thermal_class); |
diff --git a/drivers/tty/serial/serial_cs.c b/drivers/tty/serial/serial_cs.c index 93760b2ea172..1ef4df9bf7e4 100644 --- a/drivers/tty/serial/serial_cs.c +++ b/drivers/tty/serial/serial_cs.c | |||
@@ -712,6 +712,7 @@ static struct pcmcia_device_id serial_ids[] = { | |||
712 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "Xircom", "CreditCard Ethernet+Modem II", 0x2e3ee845, 0xeca401bf), | 712 | PCMCIA_PFC_DEVICE_PROD_ID12(1, "Xircom", "CreditCard Ethernet+Modem II", 0x2e3ee845, 0xeca401bf), |
713 | PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x0e01), | 713 | PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x0e01), |
714 | PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x0a05), | 714 | PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x0a05), |
715 | PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x0b05), | ||
715 | PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x1101), | 716 | PCMCIA_PFC_DEVICE_MANF_CARD(1, 0x0032, 0x1101), |
716 | PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0104, 0x0070), | 717 | PCMCIA_MFC_DEVICE_MANF_CARD(0, 0x0104, 0x0070), |
717 | PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0101, 0x0562), | 718 | PCMCIA_MFC_DEVICE_MANF_CARD(1, 0x0101, 0x0562), |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index d041c6826e43..0f299b7aad60 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -2681,17 +2681,13 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, | |||
2681 | 2681 | ||
2682 | mutex_lock(&usb_address0_mutex); | 2682 | mutex_lock(&usb_address0_mutex); |
2683 | 2683 | ||
2684 | if (!udev->config && oldspeed == USB_SPEED_SUPER) { | 2684 | /* Reset the device; full speed may morph to high speed */ |
2685 | /* Don't reset USB 3.0 devices during an initial setup */ | 2685 | /* FIXME a USB 2.0 device may morph into SuperSpeed on reset. */ |
2686 | usb_set_device_state(udev, USB_STATE_DEFAULT); | 2686 | retval = hub_port_reset(hub, port1, udev, delay); |
2687 | } else { | 2687 | if (retval < 0) /* error or disconnect */ |
2688 | /* Reset the device; full speed may morph to high speed */ | 2688 | goto fail; |
2689 | /* FIXME a USB 2.0 device may morph into SuperSpeed on reset. */ | 2689 | /* success, speed is known */ |
2690 | retval = hub_port_reset(hub, port1, udev, delay); | 2690 | |
2691 | if (retval < 0) /* error or disconnect */ | ||
2692 | goto fail; | ||
2693 | /* success, speed is known */ | ||
2694 | } | ||
2695 | retval = -ENODEV; | 2691 | retval = -ENODEV; |
2696 | 2692 | ||
2697 | if (oldspeed != USB_SPEED_UNKNOWN && oldspeed != udev->speed) { | 2693 | if (oldspeed != USB_SPEED_UNKNOWN && oldspeed != udev->speed) { |
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 44c595432d6f..81ce6a8e1d94 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -48,6 +48,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
48 | { USB_DEVICE(0x04b4, 0x0526), .driver_info = | 48 | { USB_DEVICE(0x04b4, 0x0526), .driver_info = |
49 | USB_QUIRK_CONFIG_INTF_STRINGS }, | 49 | USB_QUIRK_CONFIG_INTF_STRINGS }, |
50 | 50 | ||
51 | /* Samsung Android phone modem - ID conflict with SPH-I500 */ | ||
52 | { USB_DEVICE(0x04e8, 0x6601), .driver_info = | ||
53 | USB_QUIRK_CONFIG_INTF_STRINGS }, | ||
54 | |||
51 | /* Roland SC-8820 */ | 55 | /* Roland SC-8820 */ |
52 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, | 56 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, |
53 | 57 | ||
@@ -68,6 +72,10 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
68 | /* M-Systems Flash Disk Pioneers */ | 72 | /* M-Systems Flash Disk Pioneers */ |
69 | { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, | 73 | { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME }, |
70 | 74 | ||
75 | /* Keytouch QWERTY Panel keyboard */ | ||
76 | { USB_DEVICE(0x0926, 0x3333), .driver_info = | ||
77 | USB_QUIRK_CONFIG_INTF_STRINGS }, | ||
78 | |||
71 | /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ | 79 | /* X-Rite/Gretag-Macbeth Eye-One Pro display colorimeter */ |
72 | { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, | 80 | { USB_DEVICE(0x0971, 0x2000), .driver_info = USB_QUIRK_NO_SET_INTF }, |
73 | 81 | ||
diff --git a/drivers/usb/gadget/f_phonet.c b/drivers/usb/gadget/f_phonet.c index 3c6e1a058745..5e1495097ec3 100644 --- a/drivers/usb/gadget/f_phonet.c +++ b/drivers/usb/gadget/f_phonet.c | |||
@@ -346,14 +346,19 @@ static void pn_rx_complete(struct usb_ep *ep, struct usb_request *req) | |||
346 | 346 | ||
347 | if (unlikely(!skb)) | 347 | if (unlikely(!skb)) |
348 | break; | 348 | break; |
349 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, 0, | ||
350 | req->actual); | ||
351 | page = NULL; | ||
352 | 349 | ||
353 | if (req->actual < req->length) { /* Last fragment */ | 350 | if (skb->len == 0) { /* First fragment */ |
354 | skb->protocol = htons(ETH_P_PHONET); | 351 | skb->protocol = htons(ETH_P_PHONET); |
355 | skb_reset_mac_header(skb); | 352 | skb_reset_mac_header(skb); |
356 | pskb_pull(skb, 1); | 353 | /* Can't use pskb_pull() on page in IRQ */ |
354 | memcpy(skb_put(skb, 1), page_address(page), 1); | ||
355 | } | ||
356 | |||
357 | skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, page, | ||
358 | skb->len == 0, req->actual); | ||
359 | page = NULL; | ||
360 | |||
361 | if (req->actual < req->length) { /* Last fragment */ | ||
357 | skb->dev = dev; | 362 | skb->dev = dev; |
358 | dev->stats.rx_packets++; | 363 | dev->stats.rx_packets++; |
359 | dev->stats.rx_bytes += skb->len; | 364 | dev->stats.rx_bytes += skb->len; |
diff --git a/drivers/usb/host/ehci-xilinx-of.c b/drivers/usb/host/ehci-xilinx-of.c index e8f4f36fdf0b..a6f21b891f68 100644 --- a/drivers/usb/host/ehci-xilinx-of.c +++ b/drivers/usb/host/ehci-xilinx-of.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include <linux/of.h> | 30 | #include <linux/of.h> |
31 | #include <linux/of_platform.h> | 31 | #include <linux/of_platform.h> |
32 | #include <linux/of_address.h> | ||
32 | 33 | ||
33 | /** | 34 | /** |
34 | * ehci_xilinx_of_setup - Initialize the device for ehci_reset() | 35 | * ehci_xilinx_of_setup - Initialize the device for ehci_reset() |
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index fcbf4abbf381..0231814a97a5 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c | |||
@@ -169,9 +169,10 @@ static void xhci_print_ports(struct xhci_hcd *xhci) | |||
169 | } | 169 | } |
170 | } | 170 | } |
171 | 171 | ||
172 | void xhci_print_ir_set(struct xhci_hcd *xhci, struct xhci_intr_reg *ir_set, int set_num) | 172 | void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num) |
173 | { | 173 | { |
174 | void *addr; | 174 | struct xhci_intr_reg __iomem *ir_set = &xhci->run_regs->ir_set[set_num]; |
175 | void __iomem *addr; | ||
175 | u32 temp; | 176 | u32 temp; |
176 | u64 temp_64; | 177 | u64 temp_64; |
177 | 178 | ||
@@ -449,7 +450,7 @@ char *xhci_get_slot_state(struct xhci_hcd *xhci, | |||
449 | } | 450 | } |
450 | } | 451 | } |
451 | 452 | ||
452 | void xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx) | 453 | static void xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx) |
453 | { | 454 | { |
454 | /* Fields are 32 bits wide, DMA addresses are in bytes */ | 455 | /* Fields are 32 bits wide, DMA addresses are in bytes */ |
455 | int field_size = 32 / 8; | 456 | int field_size = 32 / 8; |
@@ -488,7 +489,7 @@ void xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx) | |||
488 | dbg_rsvd64(xhci, (u64 *)slot_ctx, dma); | 489 | dbg_rsvd64(xhci, (u64 *)slot_ctx, dma); |
489 | } | 490 | } |
490 | 491 | ||
491 | void xhci_dbg_ep_ctx(struct xhci_hcd *xhci, | 492 | static void xhci_dbg_ep_ctx(struct xhci_hcd *xhci, |
492 | struct xhci_container_ctx *ctx, | 493 | struct xhci_container_ctx *ctx, |
493 | unsigned int last_ep) | 494 | unsigned int last_ep) |
494 | { | 495 | { |
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index 1d0f45f0e7a6..a9534396e85b 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -307,7 +307,7 @@ struct xhci_ep_ctx *xhci_get_ep_ctx(struct xhci_hcd *xhci, | |||
307 | 307 | ||
308 | /***************** Streams structures manipulation *************************/ | 308 | /***************** Streams structures manipulation *************************/ |
309 | 309 | ||
310 | void xhci_free_stream_ctx(struct xhci_hcd *xhci, | 310 | static void xhci_free_stream_ctx(struct xhci_hcd *xhci, |
311 | unsigned int num_stream_ctxs, | 311 | unsigned int num_stream_ctxs, |
312 | struct xhci_stream_ctx *stream_ctx, dma_addr_t dma) | 312 | struct xhci_stream_ctx *stream_ctx, dma_addr_t dma) |
313 | { | 313 | { |
@@ -335,7 +335,7 @@ void xhci_free_stream_ctx(struct xhci_hcd *xhci, | |||
335 | * The stream context array must be a power of 2, and can be as small as | 335 | * The stream context array must be a power of 2, and can be as small as |
336 | * 64 bytes or as large as 1MB. | 336 | * 64 bytes or as large as 1MB. |
337 | */ | 337 | */ |
338 | struct xhci_stream_ctx *xhci_alloc_stream_ctx(struct xhci_hcd *xhci, | 338 | static struct xhci_stream_ctx *xhci_alloc_stream_ctx(struct xhci_hcd *xhci, |
339 | unsigned int num_stream_ctxs, dma_addr_t *dma, | 339 | unsigned int num_stream_ctxs, dma_addr_t *dma, |
340 | gfp_t mem_flags) | 340 | gfp_t mem_flags) |
341 | { | 341 | { |
@@ -1900,11 +1900,11 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
1900 | val &= DBOFF_MASK; | 1900 | val &= DBOFF_MASK; |
1901 | xhci_dbg(xhci, "// Doorbell array is located at offset 0x%x" | 1901 | xhci_dbg(xhci, "// Doorbell array is located at offset 0x%x" |
1902 | " from cap regs base addr\n", val); | 1902 | " from cap regs base addr\n", val); |
1903 | xhci->dba = (void *) xhci->cap_regs + val; | 1903 | xhci->dba = (void __iomem *) xhci->cap_regs + val; |
1904 | xhci_dbg_regs(xhci); | 1904 | xhci_dbg_regs(xhci); |
1905 | xhci_print_run_regs(xhci); | 1905 | xhci_print_run_regs(xhci); |
1906 | /* Set ir_set to interrupt register set 0 */ | 1906 | /* Set ir_set to interrupt register set 0 */ |
1907 | xhci->ir_set = (void *) xhci->run_regs->ir_set; | 1907 | xhci->ir_set = &xhci->run_regs->ir_set[0]; |
1908 | 1908 | ||
1909 | /* | 1909 | /* |
1910 | * Event ring setup: Allocate a normal ring, but also setup | 1910 | * Event ring setup: Allocate a normal ring, but also setup |
@@ -1961,7 +1961,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) | |||
1961 | /* Set the event ring dequeue address */ | 1961 | /* Set the event ring dequeue address */ |
1962 | xhci_set_hc_event_deq(xhci); | 1962 | xhci_set_hc_event_deq(xhci); |
1963 | xhci_dbg(xhci, "Wrote ERST address to ir_set 0.\n"); | 1963 | xhci_dbg(xhci, "Wrote ERST address to ir_set 0.\n"); |
1964 | xhci_print_ir_set(xhci, xhci->ir_set, 0); | 1964 | xhci_print_ir_set(xhci, 0); |
1965 | 1965 | ||
1966 | /* | 1966 | /* |
1967 | * XXX: Might need to set the Interrupter Moderation Register to | 1967 | * XXX: Might need to set the Interrupter Moderation Register to |
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index 3e8211c1ce5a..3289bf4832c9 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -474,8 +474,11 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, | |||
474 | state->new_deq_seg = find_trb_seg(cur_td->start_seg, | 474 | state->new_deq_seg = find_trb_seg(cur_td->start_seg, |
475 | dev->eps[ep_index].stopped_trb, | 475 | dev->eps[ep_index].stopped_trb, |
476 | &state->new_cycle_state); | 476 | &state->new_cycle_state); |
477 | if (!state->new_deq_seg) | 477 | if (!state->new_deq_seg) { |
478 | BUG(); | 478 | WARN_ON(1); |
479 | return; | ||
480 | } | ||
481 | |||
479 | /* Dig out the cycle state saved by the xHC during the stop ep cmd */ | 482 | /* Dig out the cycle state saved by the xHC during the stop ep cmd */ |
480 | xhci_dbg(xhci, "Finding endpoint context\n"); | 483 | xhci_dbg(xhci, "Finding endpoint context\n"); |
481 | ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index); | 484 | ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index); |
@@ -486,8 +489,10 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, | |||
486 | state->new_deq_seg = find_trb_seg(state->new_deq_seg, | 489 | state->new_deq_seg = find_trb_seg(state->new_deq_seg, |
487 | state->new_deq_ptr, | 490 | state->new_deq_ptr, |
488 | &state->new_cycle_state); | 491 | &state->new_cycle_state); |
489 | if (!state->new_deq_seg) | 492 | if (!state->new_deq_seg) { |
490 | BUG(); | 493 | WARN_ON(1); |
494 | return; | ||
495 | } | ||
491 | 496 | ||
492 | trb = &state->new_deq_ptr->generic; | 497 | trb = &state->new_deq_ptr->generic; |
493 | if ((trb->field[3] & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK) && | 498 | if ((trb->field[3] & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK) && |
@@ -2363,12 +2368,13 @@ static unsigned int count_sg_trbs_needed(struct xhci_hcd *xhci, struct urb *urb) | |||
2363 | 2368 | ||
2364 | /* Scatter gather list entries may cross 64KB boundaries */ | 2369 | /* Scatter gather list entries may cross 64KB boundaries */ |
2365 | running_total = TRB_MAX_BUFF_SIZE - | 2370 | running_total = TRB_MAX_BUFF_SIZE - |
2366 | (sg_dma_address(sg) & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | 2371 | (sg_dma_address(sg) & (TRB_MAX_BUFF_SIZE - 1)); |
2372 | running_total &= TRB_MAX_BUFF_SIZE - 1; | ||
2367 | if (running_total != 0) | 2373 | if (running_total != 0) |
2368 | num_trbs++; | 2374 | num_trbs++; |
2369 | 2375 | ||
2370 | /* How many more 64KB chunks to transfer, how many more TRBs? */ | 2376 | /* How many more 64KB chunks to transfer, how many more TRBs? */ |
2371 | while (running_total < sg_dma_len(sg)) { | 2377 | while (running_total < sg_dma_len(sg) && running_total < temp) { |
2372 | num_trbs++; | 2378 | num_trbs++; |
2373 | running_total += TRB_MAX_BUFF_SIZE; | 2379 | running_total += TRB_MAX_BUFF_SIZE; |
2374 | } | 2380 | } |
@@ -2394,11 +2400,11 @@ static unsigned int count_sg_trbs_needed(struct xhci_hcd *xhci, struct urb *urb) | |||
2394 | static void check_trb_math(struct urb *urb, int num_trbs, int running_total) | 2400 | static void check_trb_math(struct urb *urb, int num_trbs, int running_total) |
2395 | { | 2401 | { |
2396 | if (num_trbs != 0) | 2402 | if (num_trbs != 0) |
2397 | dev_dbg(&urb->dev->dev, "%s - ep %#x - Miscalculated number of " | 2403 | dev_err(&urb->dev->dev, "%s - ep %#x - Miscalculated number of " |
2398 | "TRBs, %d left\n", __func__, | 2404 | "TRBs, %d left\n", __func__, |
2399 | urb->ep->desc.bEndpointAddress, num_trbs); | 2405 | urb->ep->desc.bEndpointAddress, num_trbs); |
2400 | if (running_total != urb->transfer_buffer_length) | 2406 | if (running_total != urb->transfer_buffer_length) |
2401 | dev_dbg(&urb->dev->dev, "%s - ep %#x - Miscalculated tx length, " | 2407 | dev_err(&urb->dev->dev, "%s - ep %#x - Miscalculated tx length, " |
2402 | "queued %#x (%d), asked for %#x (%d)\n", | 2408 | "queued %#x (%d), asked for %#x (%d)\n", |
2403 | __func__, | 2409 | __func__, |
2404 | urb->ep->desc.bEndpointAddress, | 2410 | urb->ep->desc.bEndpointAddress, |
@@ -2533,8 +2539,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2533 | sg = urb->sg; | 2539 | sg = urb->sg; |
2534 | addr = (u64) sg_dma_address(sg); | 2540 | addr = (u64) sg_dma_address(sg); |
2535 | this_sg_len = sg_dma_len(sg); | 2541 | this_sg_len = sg_dma_len(sg); |
2536 | trb_buff_len = TRB_MAX_BUFF_SIZE - | 2542 | trb_buff_len = TRB_MAX_BUFF_SIZE - (addr & (TRB_MAX_BUFF_SIZE - 1)); |
2537 | (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | ||
2538 | trb_buff_len = min_t(int, trb_buff_len, this_sg_len); | 2543 | trb_buff_len = min_t(int, trb_buff_len, this_sg_len); |
2539 | if (trb_buff_len > urb->transfer_buffer_length) | 2544 | if (trb_buff_len > urb->transfer_buffer_length) |
2540 | trb_buff_len = urb->transfer_buffer_length; | 2545 | trb_buff_len = urb->transfer_buffer_length; |
@@ -2572,7 +2577,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2572 | (unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1), | 2577 | (unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1), |
2573 | (unsigned int) addr + trb_buff_len); | 2578 | (unsigned int) addr + trb_buff_len); |
2574 | if (TRB_MAX_BUFF_SIZE - | 2579 | if (TRB_MAX_BUFF_SIZE - |
2575 | (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1)) < trb_buff_len) { | 2580 | (addr & (TRB_MAX_BUFF_SIZE - 1)) < trb_buff_len) { |
2576 | xhci_warn(xhci, "WARN: sg dma xfer crosses 64KB boundaries!\n"); | 2581 | xhci_warn(xhci, "WARN: sg dma xfer crosses 64KB boundaries!\n"); |
2577 | xhci_dbg(xhci, "Next boundary at %#x, end dma = %#x\n", | 2582 | xhci_dbg(xhci, "Next boundary at %#x, end dma = %#x\n", |
2578 | (unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1), | 2583 | (unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1), |
@@ -2616,7 +2621,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2616 | } | 2621 | } |
2617 | 2622 | ||
2618 | trb_buff_len = TRB_MAX_BUFF_SIZE - | 2623 | trb_buff_len = TRB_MAX_BUFF_SIZE - |
2619 | (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | 2624 | (addr & (TRB_MAX_BUFF_SIZE - 1)); |
2620 | trb_buff_len = min_t(int, trb_buff_len, this_sg_len); | 2625 | trb_buff_len = min_t(int, trb_buff_len, this_sg_len); |
2621 | if (running_total + trb_buff_len > urb->transfer_buffer_length) | 2626 | if (running_total + trb_buff_len > urb->transfer_buffer_length) |
2622 | trb_buff_len = | 2627 | trb_buff_len = |
@@ -2656,7 +2661,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2656 | num_trbs = 0; | 2661 | num_trbs = 0; |
2657 | /* How much data is (potentially) left before the 64KB boundary? */ | 2662 | /* How much data is (potentially) left before the 64KB boundary? */ |
2658 | running_total = TRB_MAX_BUFF_SIZE - | 2663 | running_total = TRB_MAX_BUFF_SIZE - |
2659 | (urb->transfer_dma & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | 2664 | (urb->transfer_dma & (TRB_MAX_BUFF_SIZE - 1)); |
2665 | running_total &= TRB_MAX_BUFF_SIZE - 1; | ||
2660 | 2666 | ||
2661 | /* If there's some data on this 64KB chunk, or we have to send a | 2667 | /* If there's some data on this 64KB chunk, or we have to send a |
2662 | * zero-length transfer, we need at least one TRB | 2668 | * zero-length transfer, we need at least one TRB |
@@ -2700,8 +2706,8 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, | |||
2700 | /* How much data is in the first TRB? */ | 2706 | /* How much data is in the first TRB? */ |
2701 | addr = (u64) urb->transfer_dma; | 2707 | addr = (u64) urb->transfer_dma; |
2702 | trb_buff_len = TRB_MAX_BUFF_SIZE - | 2708 | trb_buff_len = TRB_MAX_BUFF_SIZE - |
2703 | (urb->transfer_dma & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | 2709 | (urb->transfer_dma & (TRB_MAX_BUFF_SIZE - 1)); |
2704 | if (urb->transfer_buffer_length < trb_buff_len) | 2710 | if (trb_buff_len > urb->transfer_buffer_length) |
2705 | trb_buff_len = urb->transfer_buffer_length; | 2711 | trb_buff_len = urb->transfer_buffer_length; |
2706 | 2712 | ||
2707 | first_trb = true; | 2713 | first_trb = true; |
@@ -2879,8 +2885,8 @@ static int count_isoc_trbs_needed(struct xhci_hcd *xhci, | |||
2879 | addr = (u64) (urb->transfer_dma + urb->iso_frame_desc[i].offset); | 2885 | addr = (u64) (urb->transfer_dma + urb->iso_frame_desc[i].offset); |
2880 | td_len = urb->iso_frame_desc[i].length; | 2886 | td_len = urb->iso_frame_desc[i].length; |
2881 | 2887 | ||
2882 | running_total = TRB_MAX_BUFF_SIZE - | 2888 | running_total = TRB_MAX_BUFF_SIZE - (addr & (TRB_MAX_BUFF_SIZE - 1)); |
2883 | (addr & ((1 << TRB_MAX_BUFF_SHIFT) - 1)); | 2889 | running_total &= TRB_MAX_BUFF_SIZE - 1; |
2884 | if (running_total != 0) | 2890 | if (running_total != 0) |
2885 | num_trbs++; | 2891 | num_trbs++; |
2886 | 2892 | ||
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 34cf4e165877..2083fc2179b2 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -109,7 +109,7 @@ int xhci_halt(struct xhci_hcd *xhci) | |||
109 | /* | 109 | /* |
110 | * Set the run bit and wait for the host to be running. | 110 | * Set the run bit and wait for the host to be running. |
111 | */ | 111 | */ |
112 | int xhci_start(struct xhci_hcd *xhci) | 112 | static int xhci_start(struct xhci_hcd *xhci) |
113 | { | 113 | { |
114 | u32 temp; | 114 | u32 temp; |
115 | int ret; | 115 | int ret; |
@@ -329,7 +329,7 @@ int xhci_init(struct usb_hcd *hcd) | |||
329 | 329 | ||
330 | 330 | ||
331 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING | 331 | #ifdef CONFIG_USB_XHCI_HCD_DEBUGGING |
332 | void xhci_event_ring_work(unsigned long arg) | 332 | static void xhci_event_ring_work(unsigned long arg) |
333 | { | 333 | { |
334 | unsigned long flags; | 334 | unsigned long flags; |
335 | int temp; | 335 | int temp; |
@@ -473,7 +473,7 @@ int xhci_run(struct usb_hcd *hcd) | |||
473 | xhci->ir_set, (unsigned int) ER_IRQ_ENABLE(temp)); | 473 | xhci->ir_set, (unsigned int) ER_IRQ_ENABLE(temp)); |
474 | xhci_writel(xhci, ER_IRQ_ENABLE(temp), | 474 | xhci_writel(xhci, ER_IRQ_ENABLE(temp), |
475 | &xhci->ir_set->irq_pending); | 475 | &xhci->ir_set->irq_pending); |
476 | xhci_print_ir_set(xhci, xhci->ir_set, 0); | 476 | xhci_print_ir_set(xhci, 0); |
477 | 477 | ||
478 | if (NUM_TEST_NOOPS > 0) | 478 | if (NUM_TEST_NOOPS > 0) |
479 | doorbell = xhci_setup_one_noop(xhci); | 479 | doorbell = xhci_setup_one_noop(xhci); |
@@ -528,7 +528,7 @@ void xhci_stop(struct usb_hcd *hcd) | |||
528 | temp = xhci_readl(xhci, &xhci->ir_set->irq_pending); | 528 | temp = xhci_readl(xhci, &xhci->ir_set->irq_pending); |
529 | xhci_writel(xhci, ER_IRQ_DISABLE(temp), | 529 | xhci_writel(xhci, ER_IRQ_DISABLE(temp), |
530 | &xhci->ir_set->irq_pending); | 530 | &xhci->ir_set->irq_pending); |
531 | xhci_print_ir_set(xhci, xhci->ir_set, 0); | 531 | xhci_print_ir_set(xhci, 0); |
532 | 532 | ||
533 | xhci_dbg(xhci, "cleaning up memory\n"); | 533 | xhci_dbg(xhci, "cleaning up memory\n"); |
534 | xhci_mem_cleanup(xhci); | 534 | xhci_mem_cleanup(xhci); |
@@ -755,7 +755,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
755 | temp = xhci_readl(xhci, &xhci->ir_set->irq_pending); | 755 | temp = xhci_readl(xhci, &xhci->ir_set->irq_pending); |
756 | xhci_writel(xhci, ER_IRQ_DISABLE(temp), | 756 | xhci_writel(xhci, ER_IRQ_DISABLE(temp), |
757 | &xhci->ir_set->irq_pending); | 757 | &xhci->ir_set->irq_pending); |
758 | xhci_print_ir_set(xhci, xhci->ir_set, 0); | 758 | xhci_print_ir_set(xhci, 0); |
759 | 759 | ||
760 | xhci_dbg(xhci, "cleaning up memory\n"); | 760 | xhci_dbg(xhci, "cleaning up memory\n"); |
761 | xhci_mem_cleanup(xhci); | 761 | xhci_mem_cleanup(xhci); |
@@ -857,7 +857,7 @@ unsigned int xhci_last_valid_endpoint(u32 added_ctxs) | |||
857 | /* Returns 1 if the arguments are OK; | 857 | /* Returns 1 if the arguments are OK; |
858 | * returns 0 this is a root hub; returns -EINVAL for NULL pointers. | 858 | * returns 0 this is a root hub; returns -EINVAL for NULL pointers. |
859 | */ | 859 | */ |
860 | int xhci_check_args(struct usb_hcd *hcd, struct usb_device *udev, | 860 | static int xhci_check_args(struct usb_hcd *hcd, struct usb_device *udev, |
861 | struct usb_host_endpoint *ep, int check_ep, bool check_virt_dev, | 861 | struct usb_host_endpoint *ep, int check_ep, bool check_virt_dev, |
862 | const char *func) { | 862 | const char *func) { |
863 | struct xhci_hcd *xhci; | 863 | struct xhci_hcd *xhci; |
@@ -1693,7 +1693,7 @@ static void xhci_setup_input_ctx_for_config_ep(struct xhci_hcd *xhci, | |||
1693 | xhci_dbg_ctx(xhci, in_ctx, xhci_last_valid_endpoint(add_flags)); | 1693 | xhci_dbg_ctx(xhci, in_ctx, xhci_last_valid_endpoint(add_flags)); |
1694 | } | 1694 | } |
1695 | 1695 | ||
1696 | void xhci_setup_input_ctx_for_quirk(struct xhci_hcd *xhci, | 1696 | static void xhci_setup_input_ctx_for_quirk(struct xhci_hcd *xhci, |
1697 | unsigned int slot_id, unsigned int ep_index, | 1697 | unsigned int slot_id, unsigned int ep_index, |
1698 | struct xhci_dequeue_state *deq_state) | 1698 | struct xhci_dequeue_state *deq_state) |
1699 | { | 1699 | { |
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 7f236fd22015..7f127df6dd55 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1348,7 +1348,7 @@ static inline int xhci_link_trb_quirk(struct xhci_hcd *xhci) | |||
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | /* xHCI debugging */ | 1350 | /* xHCI debugging */ |
1351 | void xhci_print_ir_set(struct xhci_hcd *xhci, struct xhci_intr_reg *ir_set, int set_num); | 1351 | void xhci_print_ir_set(struct xhci_hcd *xhci, int set_num); |
1352 | void xhci_print_registers(struct xhci_hcd *xhci); | 1352 | void xhci_print_registers(struct xhci_hcd *xhci); |
1353 | void xhci_dbg_regs(struct xhci_hcd *xhci); | 1353 | void xhci_dbg_regs(struct xhci_hcd *xhci); |
1354 | void xhci_print_run_regs(struct xhci_hcd *xhci); | 1354 | void xhci_print_run_regs(struct xhci_hcd *xhci); |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 54a8bd1047d6..c292d5c499e7 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -1864,6 +1864,7 @@ allocate_instance(struct device *dev, | |||
1864 | INIT_LIST_HEAD(&musb->out_bulk); | 1864 | INIT_LIST_HEAD(&musb->out_bulk); |
1865 | 1865 | ||
1866 | hcd->uses_new_polling = 1; | 1866 | hcd->uses_new_polling = 1; |
1867 | hcd->has_tt = 1; | ||
1867 | 1868 | ||
1868 | musb->vbuserr_retry = VBUSERR_RETRY_COUNT; | 1869 | musb->vbuserr_retry = VBUSERR_RETRY_COUNT; |
1869 | musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON; | 1870 | musb->a_wait_bcon = OTG_TIME_A_WAIT_BCON; |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index d74a8113ae74..e6400be8a0f8 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -488,6 +488,15 @@ struct musb { | |||
488 | unsigned set_address:1; | 488 | unsigned set_address:1; |
489 | unsigned test_mode:1; | 489 | unsigned test_mode:1; |
490 | unsigned softconnect:1; | 490 | unsigned softconnect:1; |
491 | |||
492 | u8 address; | ||
493 | u8 test_mode_nr; | ||
494 | u16 ackpend; /* ep0 */ | ||
495 | enum musb_g_ep0_state ep0_state; | ||
496 | struct usb_gadget g; /* the gadget */ | ||
497 | struct usb_gadget_driver *gadget_driver; /* its driver */ | ||
498 | #endif | ||
499 | |||
491 | /* | 500 | /* |
492 | * FIXME: Remove this flag. | 501 | * FIXME: Remove this flag. |
493 | * | 502 | * |
@@ -501,14 +510,6 @@ struct musb { | |||
501 | */ | 510 | */ |
502 | unsigned double_buffer_not_ok:1 __deprecated; | 511 | unsigned double_buffer_not_ok:1 __deprecated; |
503 | 512 | ||
504 | u8 address; | ||
505 | u8 test_mode_nr; | ||
506 | u16 ackpend; /* ep0 */ | ||
507 | enum musb_g_ep0_state ep0_state; | ||
508 | struct usb_gadget g; /* the gadget */ | ||
509 | struct usb_gadget_driver *gadget_driver; /* its driver */ | ||
510 | #endif | ||
511 | |||
512 | struct musb_hdrc_config *config; | 513 | struct musb_hdrc_config *config; |
513 | 514 | ||
514 | #ifdef MUSB_CONFIG_PROC_FS | 515 | #ifdef MUSB_CONFIG_PROC_FS |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index a3f12333fc41..bc8badd16897 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -362,6 +362,7 @@ static int omap2430_musb_init(struct musb *musb) | |||
362 | 362 | ||
363 | static int omap2430_musb_exit(struct musb *musb) | 363 | static int omap2430_musb_exit(struct musb *musb) |
364 | { | 364 | { |
365 | del_timer_sync(&musb_idle_timer); | ||
365 | 366 | ||
366 | omap2430_low_level_exit(musb); | 367 | omap2430_low_level_exit(musb); |
367 | otg_put_transceiver(musb->xceiv); | 368 | otg_put_transceiver(musb->xceiv); |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 7481ff8a49e4..0457813eebee 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -301,6 +301,9 @@ static const struct usb_device_id id_table[] = { | |||
301 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ | 301 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ |
302 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 302 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
303 | }, | 303 | }, |
304 | { USB_DEVICE(0x0f3d, 0x68A3), /* Airprime/Sierra Wireless Direct IP modems */ | ||
305 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | ||
306 | }, | ||
304 | { USB_DEVICE(0x413C, 0x08133) }, /* Dell Computer Corp. Wireless 5720 VZW Mobile Broadband (EVDO Rev-A) Minicard GPS Port */ | 307 | { USB_DEVICE(0x413C, 0x08133) }, /* Dell Computer Corp. Wireless 5720 VZW Mobile Broadband (EVDO Rev-A) Minicard GPS Port */ |
305 | 308 | ||
306 | { } | 309 | { } |
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index b004b2a485c3..9c014e2ecd68 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c | |||
@@ -295,12 +295,15 @@ static void usb_wwan_indat_callback(struct urb *urb) | |||
295 | __func__, status, endpoint); | 295 | __func__, status, endpoint); |
296 | } else { | 296 | } else { |
297 | tty = tty_port_tty_get(&port->port); | 297 | tty = tty_port_tty_get(&port->port); |
298 | if (urb->actual_length) { | 298 | if (tty) { |
299 | tty_insert_flip_string(tty, data, urb->actual_length); | 299 | if (urb->actual_length) { |
300 | tty_flip_buffer_push(tty); | 300 | tty_insert_flip_string(tty, data, |
301 | } else | 301 | urb->actual_length); |
302 | dbg("%s: empty read urb received", __func__); | 302 | tty_flip_buffer_push(tty); |
303 | tty_kref_put(tty); | 303 | } else |
304 | dbg("%s: empty read urb received", __func__); | ||
305 | tty_kref_put(tty); | ||
306 | } | ||
304 | 307 | ||
305 | /* Resubmit urb so we continue receiving */ | 308 | /* Resubmit urb so we continue receiving */ |
306 | if (status != -ESHUTDOWN) { | 309 | if (status != -ESHUTDOWN) { |
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 15a5d89b7f39..1c11959a7d58 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/uaccess.h> | 27 | #include <linux/uaccess.h> |
28 | #include <linux/usb.h> | 28 | #include <linux/usb.h> |
29 | #include <linux/usb/serial.h> | 29 | #include <linux/usb/serial.h> |
30 | #include <linux/usb/cdc.h> | ||
30 | #include "visor.h" | 31 | #include "visor.h" |
31 | 32 | ||
32 | /* | 33 | /* |
@@ -479,6 +480,17 @@ static int visor_probe(struct usb_serial *serial, | |||
479 | 480 | ||
480 | dbg("%s", __func__); | 481 | dbg("%s", __func__); |
481 | 482 | ||
483 | /* | ||
484 | * some Samsung Android phones in modem mode have the same ID | ||
485 | * as SPH-I500, but they are ACM devices, so dont bind to them | ||
486 | */ | ||
487 | if (id->idVendor == SAMSUNG_VENDOR_ID && | ||
488 | id->idProduct == SAMSUNG_SPH_I500_ID && | ||
489 | serial->dev->descriptor.bDeviceClass == USB_CLASS_COMM && | ||
490 | serial->dev->descriptor.bDeviceSubClass == | ||
491 | USB_CDC_SUBCLASS_ACM) | ||
492 | return -ENODEV; | ||
493 | |||
482 | if (serial->dev->actconfig->desc.bConfigurationValue != 1) { | 494 | if (serial->dev->actconfig->desc.bConfigurationValue != 1) { |
483 | dev_err(&serial->dev->dev, "active config #%d != 1 ??\n", | 495 | dev_err(&serial->dev->dev, "active config #%d != 1 ??\n", |
484 | serial->dev->actconfig->desc.bConfigurationValue); | 496 | serial->dev->actconfig->desc.bConfigurationValue); |
diff --git a/drivers/video/backlight/ltv350qv.c b/drivers/video/backlight/ltv350qv.c index 8010aaeb5adb..dd0e84a9bd2f 100644 --- a/drivers/video/backlight/ltv350qv.c +++ b/drivers/video/backlight/ltv350qv.c | |||
@@ -239,11 +239,15 @@ static int __devinit ltv350qv_probe(struct spi_device *spi) | |||
239 | lcd->spi = spi; | 239 | lcd->spi = spi; |
240 | lcd->power = FB_BLANK_POWERDOWN; | 240 | lcd->power = FB_BLANK_POWERDOWN; |
241 | lcd->buffer = kzalloc(8, GFP_KERNEL); | 241 | lcd->buffer = kzalloc(8, GFP_KERNEL); |
242 | if (!lcd->buffer) { | ||
243 | ret = -ENOMEM; | ||
244 | goto out_free_lcd; | ||
245 | } | ||
242 | 246 | ||
243 | ld = lcd_device_register("ltv350qv", &spi->dev, lcd, <v_ops); | 247 | ld = lcd_device_register("ltv350qv", &spi->dev, lcd, <v_ops); |
244 | if (IS_ERR(ld)) { | 248 | if (IS_ERR(ld)) { |
245 | ret = PTR_ERR(ld); | 249 | ret = PTR_ERR(ld); |
246 | goto out_free_lcd; | 250 | goto out_free_buffer; |
247 | } | 251 | } |
248 | lcd->ld = ld; | 252 | lcd->ld = ld; |
249 | 253 | ||
@@ -257,6 +261,8 @@ static int __devinit ltv350qv_probe(struct spi_device *spi) | |||
257 | 261 | ||
258 | out_unregister: | 262 | out_unregister: |
259 | lcd_device_unregister(ld); | 263 | lcd_device_unregister(ld); |
264 | out_free_buffer: | ||
265 | kfree(lcd->buffer); | ||
260 | out_free_lcd: | 266 | out_free_lcd: |
261 | kfree(lcd); | 267 | kfree(lcd); |
262 | return ret; | 268 | return ret; |
@@ -268,6 +274,7 @@ static int __devexit ltv350qv_remove(struct spi_device *spi) | |||
268 | 274 | ||
269 | ltv350qv_power(lcd, FB_BLANK_POWERDOWN); | 275 | ltv350qv_power(lcd, FB_BLANK_POWERDOWN); |
270 | lcd_device_unregister(lcd->ld); | 276 | lcd_device_unregister(lcd->ld); |
277 | kfree(lcd->buffer); | ||
271 | kfree(lcd); | 278 | kfree(lcd); |
272 | 279 | ||
273 | return 0; | 280 | return 0; |
diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c index eca855a55c0d..3de4ba0260a5 100644 --- a/drivers/watchdog/cpwd.c +++ b/drivers/watchdog/cpwd.c | |||
@@ -646,7 +646,7 @@ static int __devexit cpwd_remove(struct platform_device *op) | |||
646 | struct cpwd *p = dev_get_drvdata(&op->dev); | 646 | struct cpwd *p = dev_get_drvdata(&op->dev); |
647 | int i; | 647 | int i; |
648 | 648 | ||
649 | for (i = 0; i < 4; i++) { | 649 | for (i = 0; i < WD_NUMDEVS; i++) { |
650 | misc_deregister(&p->devs[i].misc); | 650 | misc_deregister(&p->devs[i].misc); |
651 | 651 | ||
652 | if (!p->enabled) { | 652 | if (!p->enabled) { |
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index 24b966d5061a..204a5603c4ae 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c | |||
@@ -710,7 +710,7 @@ static int __devinit hpwdt_init_nmi_decoding(struct pci_dev *dev) | |||
710 | return 0; | 710 | return 0; |
711 | } | 711 | } |
712 | 712 | ||
713 | static void __devexit hpwdt_exit_nmi_decoding(void) | 713 | static void hpwdt_exit_nmi_decoding(void) |
714 | { | 714 | { |
715 | unregister_die_notifier(&die_notifier); | 715 | unregister_die_notifier(&die_notifier); |
716 | if (cru_rom_addr) | 716 | if (cru_rom_addr) |
@@ -726,7 +726,7 @@ static int __devinit hpwdt_init_nmi_decoding(struct pci_dev *dev) | |||
726 | return 0; | 726 | return 0; |
727 | } | 727 | } |
728 | 728 | ||
729 | static void __devexit hpwdt_exit_nmi_decoding(void) | 729 | static void hpwdt_exit_nmi_decoding(void) |
730 | { | 730 | { |
731 | } | 731 | } |
732 | #endif /* CONFIG_HPWDT_NMI_DECODING */ | 732 | #endif /* CONFIG_HPWDT_NMI_DECODING */ |
diff --git a/drivers/watchdog/sbc_fitpc2_wdt.c b/drivers/watchdog/sbc_fitpc2_wdt.c index c7d67e9a7465..79906255eeb6 100644 --- a/drivers/watchdog/sbc_fitpc2_wdt.c +++ b/drivers/watchdog/sbc_fitpc2_wdt.c | |||
@@ -201,11 +201,14 @@ static struct miscdevice fitpc2_wdt_miscdev = { | |||
201 | static int __init fitpc2_wdt_init(void) | 201 | static int __init fitpc2_wdt_init(void) |
202 | { | 202 | { |
203 | int err; | 203 | int err; |
204 | const char *brd_name; | ||
204 | 205 | ||
205 | if (!strstr(dmi_get_system_info(DMI_BOARD_NAME), "SBC-FITPC2")) | 206 | brd_name = dmi_get_system_info(DMI_BOARD_NAME); |
207 | |||
208 | if (!brd_name || !strstr(brd_name, "SBC-FITPC2")) | ||
206 | return -ENODEV; | 209 | return -ENODEV; |
207 | 210 | ||
208 | pr_info("%s found\n", dmi_get_system_info(DMI_BOARD_NAME)); | 211 | pr_info("%s found\n", brd_name); |
209 | 212 | ||
210 | if (!request_region(COMMAND_PORT, 1, WATCHDOG_NAME)) { | 213 | if (!request_region(COMMAND_PORT, 1, WATCHDOG_NAME)) { |
211 | pr_err("I/O address 0x%04x already in use\n", COMMAND_PORT); | 214 | pr_err("I/O address 0x%04x already in use\n", COMMAND_PORT); |
diff --git a/drivers/watchdog/sch311x_wdt.c b/drivers/watchdog/sch311x_wdt.c index 0461858e07d0..b61ab1c54293 100644 --- a/drivers/watchdog/sch311x_wdt.c +++ b/drivers/watchdog/sch311x_wdt.c | |||
@@ -508,7 +508,7 @@ static int __init sch311x_detect(int sio_config_port, unsigned short *addr) | |||
508 | sch311x_sio_outb(sio_config_port, 0x07, 0x0a); | 508 | sch311x_sio_outb(sio_config_port, 0x07, 0x0a); |
509 | 509 | ||
510 | /* Check if Logical Device Register is currently active */ | 510 | /* Check if Logical Device Register is currently active */ |
511 | if (sch311x_sio_inb(sio_config_port, 0x30) && 0x01 == 0) | 511 | if ((sch311x_sio_inb(sio_config_port, 0x30) & 0x01) == 0) |
512 | printk(KERN_INFO PFX "Seems that LDN 0x0a is not active...\n"); | 512 | printk(KERN_INFO PFX "Seems that LDN 0x0a is not active...\n"); |
513 | 513 | ||
514 | /* Get the base address of the runtime registers */ | 514 | /* Get the base address of the runtime registers */ |
diff --git a/drivers/watchdog/w83697ug_wdt.c b/drivers/watchdog/w83697ug_wdt.c index a6c12dec91a1..df2a64dc9672 100644 --- a/drivers/watchdog/w83697ug_wdt.c +++ b/drivers/watchdog/w83697ug_wdt.c | |||
@@ -109,7 +109,7 @@ static int w83697ug_select_wd_register(void) | |||
109 | outb_p(0x08, WDT_EFDR); /* select logical device 8 (GPIO2) */ | 109 | outb_p(0x08, WDT_EFDR); /* select logical device 8 (GPIO2) */ |
110 | outb_p(0x30, WDT_EFER); /* select CR30 */ | 110 | outb_p(0x30, WDT_EFER); /* select CR30 */ |
111 | c = inb_p(WDT_EFDR); | 111 | c = inb_p(WDT_EFDR); |
112 | outb_p(c || 0x01, WDT_EFDR); /* set bit 0 to activate GPIO2 */ | 112 | outb_p(c | 0x01, WDT_EFDR); /* set bit 0 to activate GPIO2 */ |
113 | 113 | ||
114 | return 0; | 114 | return 0; |
115 | } | 115 | } |
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 43f9f02c7db0..718050ace08f 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c | |||
@@ -232,7 +232,7 @@ static int increase_reservation(unsigned long nr_pages) | |||
232 | set_phys_to_machine(pfn, frame_list[i]); | 232 | set_phys_to_machine(pfn, frame_list[i]); |
233 | 233 | ||
234 | /* Link back into the page tables if not highmem. */ | 234 | /* Link back into the page tables if not highmem. */ |
235 | if (pfn < max_low_pfn) { | 235 | if (!xen_hvm_domain() && pfn < max_low_pfn) { |
236 | int ret; | 236 | int ret; |
237 | ret = HYPERVISOR_update_va_mapping( | 237 | ret = HYPERVISOR_update_va_mapping( |
238 | (unsigned long)__va(pfn << PAGE_SHIFT), | 238 | (unsigned long)__va(pfn << PAGE_SHIFT), |
@@ -280,7 +280,7 @@ static int decrease_reservation(unsigned long nr_pages) | |||
280 | 280 | ||
281 | scrub_page(page); | 281 | scrub_page(page); |
282 | 282 | ||
283 | if (!PageHighMem(page)) { | 283 | if (!xen_hvm_domain() && !PageHighMem(page)) { |
284 | ret = HYPERVISOR_update_va_mapping( | 284 | ret = HYPERVISOR_update_va_mapping( |
285 | (unsigned long)__va(pfn << PAGE_SHIFT), | 285 | (unsigned long)__va(pfn << PAGE_SHIFT), |
286 | __pte_ma(0), 0); | 286 | __pte_ma(0), 0); |
@@ -296,7 +296,7 @@ static int decrease_reservation(unsigned long nr_pages) | |||
296 | /* No more mappings: invalidate P2M and add to balloon. */ | 296 | /* No more mappings: invalidate P2M and add to balloon. */ |
297 | for (i = 0; i < nr_pages; i++) { | 297 | for (i = 0; i < nr_pages; i++) { |
298 | pfn = mfn_to_pfn(frame_list[i]); | 298 | pfn = mfn_to_pfn(frame_list[i]); |
299 | set_phys_to_machine(pfn, INVALID_P2M_ENTRY); | 299 | __set_phys_to_machine(pfn, INVALID_P2M_ENTRY); |
300 | balloon_append(pfn_to_page(pfn)); | 300 | balloon_append(pfn_to_page(pfn)); |
301 | } | 301 | } |
302 | 302 | ||
@@ -392,15 +392,19 @@ static struct notifier_block xenstore_notifier; | |||
392 | 392 | ||
393 | static int __init balloon_init(void) | 393 | static int __init balloon_init(void) |
394 | { | 394 | { |
395 | unsigned long pfn, extra_pfn_end; | 395 | unsigned long pfn, nr_pages, extra_pfn_end; |
396 | struct page *page; | 396 | struct page *page; |
397 | 397 | ||
398 | if (!xen_pv_domain()) | 398 | if (!xen_domain()) |
399 | return -ENODEV; | 399 | return -ENODEV; |
400 | 400 | ||
401 | pr_info("xen_balloon: Initialising balloon driver.\n"); | 401 | pr_info("xen_balloon: Initialising balloon driver.\n"); |
402 | 402 | ||
403 | balloon_stats.current_pages = min(xen_start_info->nr_pages, max_pfn); | 403 | if (xen_pv_domain()) |
404 | nr_pages = xen_start_info->nr_pages; | ||
405 | else | ||
406 | nr_pages = max_pfn; | ||
407 | balloon_stats.current_pages = min(nr_pages, max_pfn); | ||
404 | balloon_stats.target_pages = balloon_stats.current_pages; | 408 | balloon_stats.target_pages = balloon_stats.current_pages; |
405 | balloon_stats.balloon_low = 0; | 409 | balloon_stats.balloon_low = 0; |
406 | balloon_stats.balloon_high = 0; | 410 | balloon_stats.balloon_high = 0; |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 74681478100a..149fa875e396 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -114,7 +114,7 @@ struct cpu_evtchn_s { | |||
114 | static __initdata struct cpu_evtchn_s init_evtchn_mask = { | 114 | static __initdata struct cpu_evtchn_s init_evtchn_mask = { |
115 | .bits[0 ... (NR_EVENT_CHANNELS/BITS_PER_LONG)-1] = ~0ul, | 115 | .bits[0 ... (NR_EVENT_CHANNELS/BITS_PER_LONG)-1] = ~0ul, |
116 | }; | 116 | }; |
117 | static struct cpu_evtchn_s *cpu_evtchn_mask_p = &init_evtchn_mask; | 117 | static struct cpu_evtchn_s __refdata *cpu_evtchn_mask_p = &init_evtchn_mask; |
118 | 118 | ||
119 | static inline unsigned long *cpu_evtchn_mask(int cpu) | 119 | static inline unsigned long *cpu_evtchn_mask(int cpu) |
120 | { | 120 | { |
@@ -277,7 +277,7 @@ static void bind_evtchn_to_cpu(unsigned int chn, unsigned int cpu) | |||
277 | 277 | ||
278 | BUG_ON(irq == -1); | 278 | BUG_ON(irq == -1); |
279 | #ifdef CONFIG_SMP | 279 | #ifdef CONFIG_SMP |
280 | cpumask_copy(irq_to_desc(irq)->affinity, cpumask_of(cpu)); | 280 | cpumask_copy(irq_to_desc(irq)->irq_data.affinity, cpumask_of(cpu)); |
281 | #endif | 281 | #endif |
282 | 282 | ||
283 | clear_bit(chn, cpu_evtchn_mask(cpu_from_irq(irq))); | 283 | clear_bit(chn, cpu_evtchn_mask(cpu_from_irq(irq))); |
@@ -294,7 +294,7 @@ static void init_evtchn_cpu_bindings(void) | |||
294 | 294 | ||
295 | /* By default all event channels notify CPU#0. */ | 295 | /* By default all event channels notify CPU#0. */ |
296 | for_each_irq_desc(i, desc) { | 296 | for_each_irq_desc(i, desc) { |
297 | cpumask_copy(desc->affinity, cpumask_of(0)); | 297 | cpumask_copy(desc->irq_data.affinity, cpumask_of(0)); |
298 | } | 298 | } |
299 | #endif | 299 | #endif |
300 | 300 | ||
@@ -376,81 +376,69 @@ static void unmask_evtchn(int port) | |||
376 | put_cpu(); | 376 | put_cpu(); |
377 | } | 377 | } |
378 | 378 | ||
379 | static int get_nr_hw_irqs(void) | 379 | static int xen_allocate_irq_dynamic(void) |
380 | { | 380 | { |
381 | int ret = 1; | 381 | int first = 0; |
382 | int irq; | ||
382 | 383 | ||
383 | #ifdef CONFIG_X86_IO_APIC | 384 | #ifdef CONFIG_X86_IO_APIC |
384 | ret = get_nr_irqs_gsi(); | 385 | /* |
386 | * For an HVM guest or domain 0 which see "real" (emulated or | ||
387 | * actual repectively) GSIs we allocate dynamic IRQs | ||
388 | * e.g. those corresponding to event channels or MSIs | ||
389 | * etc. from the range above those "real" GSIs to avoid | ||
390 | * collisions. | ||
391 | */ | ||
392 | if (xen_initial_domain() || xen_hvm_domain()) | ||
393 | first = get_nr_irqs_gsi(); | ||
385 | #endif | 394 | #endif |
386 | 395 | ||
387 | return ret; | 396 | retry: |
388 | } | 397 | irq = irq_alloc_desc_from(first, -1); |
389 | 398 | ||
390 | static int find_unbound_pirq(int type) | 399 | if (irq == -ENOMEM && first > NR_IRQS_LEGACY) { |
391 | { | 400 | printk(KERN_ERR "Out of dynamic IRQ space and eating into GSI space. You should increase nr_irqs\n"); |
392 | int rc, i; | 401 | first = max(NR_IRQS_LEGACY, first - NR_IRQS_LEGACY); |
393 | struct physdev_get_free_pirq op_get_free_pirq; | 402 | goto retry; |
394 | op_get_free_pirq.type = type; | 403 | } |
395 | 404 | ||
396 | rc = HYPERVISOR_physdev_op(PHYSDEVOP_get_free_pirq, &op_get_free_pirq); | 405 | if (irq < 0) |
397 | if (!rc) | 406 | panic("No available IRQ to bind to: increase nr_irqs!\n"); |
398 | return op_get_free_pirq.pirq; | ||
399 | 407 | ||
400 | for (i = 0; i < nr_irqs; i++) { | 408 | return irq; |
401 | if (pirq_to_irq[i] < 0) | ||
402 | return i; | ||
403 | } | ||
404 | return -1; | ||
405 | } | 409 | } |
406 | 410 | ||
407 | static int find_unbound_irq(void) | 411 | static int xen_allocate_irq_gsi(unsigned gsi) |
408 | { | 412 | { |
409 | struct irq_data *data; | 413 | int irq; |
410 | int irq, res; | ||
411 | int bottom = get_nr_hw_irqs(); | ||
412 | int top = nr_irqs-1; | ||
413 | |||
414 | if (bottom == nr_irqs) | ||
415 | goto no_irqs; | ||
416 | 414 | ||
417 | /* This loop starts from the top of IRQ space and goes down. | 415 | /* |
418 | * We need this b/c if we have a PCI device in a Xen PV guest | 416 | * A PV guest has no concept of a GSI (since it has no ACPI |
419 | * we do not have an IO-APIC (though the backend might have them) | 417 | * nor access to/knowledge of the physical APICs). Therefore |
420 | * mapped in. To not have a collision of physical IRQs with the Xen | 418 | * all IRQs are dynamically allocated from the entire IRQ |
421 | * event channels start at the top of the IRQ space for virtual IRQs. | 419 | * space. |
422 | */ | 420 | */ |
423 | for (irq = top; irq > bottom; irq--) { | 421 | if (xen_pv_domain() && !xen_initial_domain()) |
424 | data = irq_get_irq_data(irq); | 422 | return xen_allocate_irq_dynamic(); |
425 | /* only 15->0 have init'd desc; handle irq > 16 */ | ||
426 | if (!data) | ||
427 | break; | ||
428 | if (data->chip == &no_irq_chip) | ||
429 | break; | ||
430 | if (data->chip != &xen_dynamic_chip) | ||
431 | continue; | ||
432 | if (irq_info[irq].type == IRQT_UNBOUND) | ||
433 | return irq; | ||
434 | } | ||
435 | |||
436 | if (irq == bottom) | ||
437 | goto no_irqs; | ||
438 | 423 | ||
439 | res = irq_alloc_desc_at(irq, -1); | 424 | /* Legacy IRQ descriptors are already allocated by the arch. */ |
425 | if (gsi < NR_IRQS_LEGACY) | ||
426 | return gsi; | ||
440 | 427 | ||
441 | if (WARN_ON(res != irq)) | 428 | irq = irq_alloc_desc_at(gsi, -1); |
442 | return -1; | 429 | if (irq < 0) |
430 | panic("Unable to allocate to IRQ%d (%d)\n", gsi, irq); | ||
443 | 431 | ||
444 | return irq; | 432 | return irq; |
445 | |||
446 | no_irqs: | ||
447 | panic("No available IRQ to bind to: increase nr_irqs!\n"); | ||
448 | } | 433 | } |
449 | 434 | ||
450 | static bool identity_mapped_irq(unsigned irq) | 435 | static void xen_free_irq(unsigned irq) |
451 | { | 436 | { |
452 | /* identity map all the hardware irqs */ | 437 | /* Legacy IRQ descriptors are managed by the arch. */ |
453 | return irq < get_nr_hw_irqs(); | 438 | if (irq < NR_IRQS_LEGACY) |
439 | return; | ||
440 | |||
441 | irq_free_desc(irq); | ||
454 | } | 442 | } |
455 | 443 | ||
456 | static void pirq_unmask_notify(int irq) | 444 | static void pirq_unmask_notify(int irq) |
@@ -486,7 +474,7 @@ static bool probing_irq(int irq) | |||
486 | return desc && desc->action == NULL; | 474 | return desc && desc->action == NULL; |
487 | } | 475 | } |
488 | 476 | ||
489 | static unsigned int startup_pirq(unsigned int irq) | 477 | static unsigned int __startup_pirq(unsigned int irq) |
490 | { | 478 | { |
491 | struct evtchn_bind_pirq bind_pirq; | 479 | struct evtchn_bind_pirq bind_pirq; |
492 | struct irq_info *info = info_for_irq(irq); | 480 | struct irq_info *info = info_for_irq(irq); |
@@ -524,9 +512,15 @@ out: | |||
524 | return 0; | 512 | return 0; |
525 | } | 513 | } |
526 | 514 | ||
527 | static void shutdown_pirq(unsigned int irq) | 515 | static unsigned int startup_pirq(struct irq_data *data) |
516 | { | ||
517 | return __startup_pirq(data->irq); | ||
518 | } | ||
519 | |||
520 | static void shutdown_pirq(struct irq_data *data) | ||
528 | { | 521 | { |
529 | struct evtchn_close close; | 522 | struct evtchn_close close; |
523 | unsigned int irq = data->irq; | ||
530 | struct irq_info *info = info_for_irq(irq); | 524 | struct irq_info *info = info_for_irq(irq); |
531 | int evtchn = evtchn_from_irq(irq); | 525 | int evtchn = evtchn_from_irq(irq); |
532 | 526 | ||
@@ -546,20 +540,20 @@ static void shutdown_pirq(unsigned int irq) | |||
546 | info->evtchn = 0; | 540 | info->evtchn = 0; |
547 | } | 541 | } |
548 | 542 | ||
549 | static void enable_pirq(unsigned int irq) | 543 | static void enable_pirq(struct irq_data *data) |
550 | { | 544 | { |
551 | startup_pirq(irq); | 545 | startup_pirq(data); |
552 | } | 546 | } |
553 | 547 | ||
554 | static void disable_pirq(unsigned int irq) | 548 | static void disable_pirq(struct irq_data *data) |
555 | { | 549 | { |
556 | } | 550 | } |
557 | 551 | ||
558 | static void ack_pirq(unsigned int irq) | 552 | static void ack_pirq(struct irq_data *data) |
559 | { | 553 | { |
560 | int evtchn = evtchn_from_irq(irq); | 554 | int evtchn = evtchn_from_irq(data->irq); |
561 | 555 | ||
562 | move_native_irq(irq); | 556 | move_native_irq(data->irq); |
563 | 557 | ||
564 | if (VALID_EVTCHN(evtchn)) { | 558 | if (VALID_EVTCHN(evtchn)) { |
565 | mask_evtchn(evtchn); | 559 | mask_evtchn(evtchn); |
@@ -567,23 +561,6 @@ static void ack_pirq(unsigned int irq) | |||
567 | } | 561 | } |
568 | } | 562 | } |
569 | 563 | ||
570 | static void end_pirq(unsigned int irq) | ||
571 | { | ||
572 | int evtchn = evtchn_from_irq(irq); | ||
573 | struct irq_desc *desc = irq_to_desc(irq); | ||
574 | |||
575 | if (WARN_ON(!desc)) | ||
576 | return; | ||
577 | |||
578 | if ((desc->status & (IRQ_DISABLED|IRQ_PENDING)) == | ||
579 | (IRQ_DISABLED|IRQ_PENDING)) { | ||
580 | shutdown_pirq(irq); | ||
581 | } else if (VALID_EVTCHN(evtchn)) { | ||
582 | unmask_evtchn(evtchn); | ||
583 | pirq_unmask_notify(irq); | ||
584 | } | ||
585 | } | ||
586 | |||
587 | static int find_irq_by_gsi(unsigned gsi) | 564 | static int find_irq_by_gsi(unsigned gsi) |
588 | { | 565 | { |
589 | int irq; | 566 | int irq; |
@@ -638,14 +615,7 @@ int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name) | |||
638 | goto out; /* XXX need refcount? */ | 615 | goto out; /* XXX need refcount? */ |
639 | } | 616 | } |
640 | 617 | ||
641 | /* If we are a PV guest, we don't have GSIs (no ACPI passed). Therefore | 618 | irq = xen_allocate_irq_gsi(gsi); |
642 | * we are using the !xen_initial_domain() to drop in the function.*/ | ||
643 | if (identity_mapped_irq(gsi) || (!xen_initial_domain() && | ||
644 | xen_pv_domain())) { | ||
645 | irq = gsi; | ||
646 | irq_alloc_desc_at(irq, -1); | ||
647 | } else | ||
648 | irq = find_unbound_irq(); | ||
649 | 619 | ||
650 | set_irq_chip_and_handler_name(irq, &xen_pirq_chip, | 620 | set_irq_chip_and_handler_name(irq, &xen_pirq_chip, |
651 | handle_level_irq, name); | 621 | handle_level_irq, name); |
@@ -658,7 +628,7 @@ int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name) | |||
658 | * this in the priv domain. */ | 628 | * this in the priv domain. */ |
659 | if (xen_initial_domain() && | 629 | if (xen_initial_domain() && |
660 | HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op)) { | 630 | HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op)) { |
661 | irq_free_desc(irq); | 631 | xen_free_irq(irq); |
662 | irq = -ENOSPC; | 632 | irq = -ENOSPC; |
663 | goto out; | 633 | goto out; |
664 | } | 634 | } |
@@ -674,87 +644,46 @@ out: | |||
674 | } | 644 | } |
675 | 645 | ||
676 | #ifdef CONFIG_PCI_MSI | 646 | #ifdef CONFIG_PCI_MSI |
677 | #include <linux/msi.h> | 647 | int xen_allocate_pirq_msi(struct pci_dev *dev, struct msi_desc *msidesc) |
678 | #include "../pci/msi.h" | ||
679 | |||
680 | void xen_allocate_pirq_msi(char *name, int *irq, int *pirq, int alloc) | ||
681 | { | 648 | { |
682 | spin_lock(&irq_mapping_update_lock); | 649 | int rc; |
683 | 650 | struct physdev_get_free_pirq op_get_free_pirq; | |
684 | if (alloc & XEN_ALLOC_IRQ) { | ||
685 | *irq = find_unbound_irq(); | ||
686 | if (*irq == -1) | ||
687 | goto out; | ||
688 | } | ||
689 | |||
690 | if (alloc & XEN_ALLOC_PIRQ) { | ||
691 | *pirq = find_unbound_pirq(MAP_PIRQ_TYPE_MSI); | ||
692 | if (*pirq == -1) | ||
693 | goto out; | ||
694 | } | ||
695 | 651 | ||
696 | set_irq_chip_and_handler_name(*irq, &xen_pirq_chip, | 652 | op_get_free_pirq.type = MAP_PIRQ_TYPE_MSI; |
697 | handle_level_irq, name); | 653 | rc = HYPERVISOR_physdev_op(PHYSDEVOP_get_free_pirq, &op_get_free_pirq); |
698 | 654 | ||
699 | irq_info[*irq] = mk_pirq_info(0, *pirq, 0, 0); | 655 | WARN_ONCE(rc == -ENOSYS, |
700 | pirq_to_irq[*pirq] = *irq; | 656 | "hypervisor does not support the PHYSDEVOP_get_free_pirq interface\n"); |
701 | 657 | ||
702 | out: | 658 | return rc ? -1 : op_get_free_pirq.pirq; |
703 | spin_unlock(&irq_mapping_update_lock); | ||
704 | } | 659 | } |
705 | 660 | ||
706 | int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type) | 661 | int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc, |
662 | int pirq, int vector, const char *name) | ||
707 | { | 663 | { |
708 | int irq = -1; | 664 | int irq, ret; |
709 | struct physdev_map_pirq map_irq; | ||
710 | int rc; | ||
711 | int pos; | ||
712 | u32 table_offset, bir; | ||
713 | |||
714 | memset(&map_irq, 0, sizeof(map_irq)); | ||
715 | map_irq.domid = DOMID_SELF; | ||
716 | map_irq.type = MAP_PIRQ_TYPE_MSI; | ||
717 | map_irq.index = -1; | ||
718 | map_irq.pirq = -1; | ||
719 | map_irq.bus = dev->bus->number; | ||
720 | map_irq.devfn = dev->devfn; | ||
721 | |||
722 | if (type == PCI_CAP_ID_MSIX) { | ||
723 | pos = pci_find_capability(dev, PCI_CAP_ID_MSIX); | ||
724 | |||
725 | pci_read_config_dword(dev, msix_table_offset_reg(pos), | ||
726 | &table_offset); | ||
727 | bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK); | ||
728 | |||
729 | map_irq.table_base = pci_resource_start(dev, bir); | ||
730 | map_irq.entry_nr = msidesc->msi_attrib.entry_nr; | ||
731 | } | ||
732 | 665 | ||
733 | spin_lock(&irq_mapping_update_lock); | 666 | spin_lock(&irq_mapping_update_lock); |
734 | 667 | ||
735 | irq = find_unbound_irq(); | 668 | irq = xen_allocate_irq_dynamic(); |
736 | |||
737 | if (irq == -1) | 669 | if (irq == -1) |
738 | goto out; | 670 | goto out; |
739 | 671 | ||
740 | rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq); | ||
741 | if (rc) { | ||
742 | printk(KERN_WARNING "xen map irq failed %d\n", rc); | ||
743 | |||
744 | irq_free_desc(irq); | ||
745 | |||
746 | irq = -1; | ||
747 | goto out; | ||
748 | } | ||
749 | irq_info[irq] = mk_pirq_info(0, map_irq.pirq, 0, map_irq.index); | ||
750 | |||
751 | set_irq_chip_and_handler_name(irq, &xen_pirq_chip, | 672 | set_irq_chip_and_handler_name(irq, &xen_pirq_chip, |
752 | handle_level_irq, | 673 | handle_level_irq, name); |
753 | (type == PCI_CAP_ID_MSIX) ? "msi-x":"msi"); | ||
754 | 674 | ||
675 | irq_info[irq] = mk_pirq_info(0, pirq, 0, vector); | ||
676 | pirq_to_irq[pirq] = irq; | ||
677 | ret = set_irq_msi(irq, msidesc); | ||
678 | if (ret < 0) | ||
679 | goto error_irq; | ||
755 | out: | 680 | out: |
756 | spin_unlock(&irq_mapping_update_lock); | 681 | spin_unlock(&irq_mapping_update_lock); |
757 | return irq; | 682 | return irq; |
683 | error_irq: | ||
684 | spin_unlock(&irq_mapping_update_lock); | ||
685 | xen_free_irq(irq); | ||
686 | return -1; | ||
758 | } | 687 | } |
759 | #endif | 688 | #endif |
760 | 689 | ||
@@ -779,11 +708,12 @@ int xen_destroy_irq(int irq) | |||
779 | printk(KERN_WARNING "unmap irq failed %d\n", rc); | 708 | printk(KERN_WARNING "unmap irq failed %d\n", rc); |
780 | goto out; | 709 | goto out; |
781 | } | 710 | } |
782 | pirq_to_irq[info->u.pirq.pirq] = -1; | ||
783 | } | 711 | } |
712 | pirq_to_irq[info->u.pirq.pirq] = -1; | ||
713 | |||
784 | irq_info[irq] = mk_unbound_info(); | 714 | irq_info[irq] = mk_unbound_info(); |
785 | 715 | ||
786 | irq_free_desc(irq); | 716 | xen_free_irq(irq); |
787 | 717 | ||
788 | out: | 718 | out: |
789 | spin_unlock(&irq_mapping_update_lock); | 719 | spin_unlock(&irq_mapping_update_lock); |
@@ -814,7 +744,7 @@ int bind_evtchn_to_irq(unsigned int evtchn) | |||
814 | irq = evtchn_to_irq[evtchn]; | 744 | irq = evtchn_to_irq[evtchn]; |
815 | 745 | ||
816 | if (irq == -1) { | 746 | if (irq == -1) { |
817 | irq = find_unbound_irq(); | 747 | irq = xen_allocate_irq_dynamic(); |
818 | 748 | ||
819 | set_irq_chip_and_handler_name(irq, &xen_dynamic_chip, | 749 | set_irq_chip_and_handler_name(irq, &xen_dynamic_chip, |
820 | handle_fasteoi_irq, "event"); | 750 | handle_fasteoi_irq, "event"); |
@@ -839,7 +769,7 @@ static int bind_ipi_to_irq(unsigned int ipi, unsigned int cpu) | |||
839 | irq = per_cpu(ipi_to_irq, cpu)[ipi]; | 769 | irq = per_cpu(ipi_to_irq, cpu)[ipi]; |
840 | 770 | ||
841 | if (irq == -1) { | 771 | if (irq == -1) { |
842 | irq = find_unbound_irq(); | 772 | irq = xen_allocate_irq_dynamic(); |
843 | if (irq < 0) | 773 | if (irq < 0) |
844 | goto out; | 774 | goto out; |
845 | 775 | ||
@@ -875,7 +805,7 @@ int bind_virq_to_irq(unsigned int virq, unsigned int cpu) | |||
875 | irq = per_cpu(virq_to_irq, cpu)[virq]; | 805 | irq = per_cpu(virq_to_irq, cpu)[virq]; |
876 | 806 | ||
877 | if (irq == -1) { | 807 | if (irq == -1) { |
878 | irq = find_unbound_irq(); | 808 | irq = xen_allocate_irq_dynamic(); |
879 | 809 | ||
880 | set_irq_chip_and_handler_name(irq, &xen_percpu_chip, | 810 | set_irq_chip_and_handler_name(irq, &xen_percpu_chip, |
881 | handle_percpu_irq, "virq"); | 811 | handle_percpu_irq, "virq"); |
@@ -934,7 +864,7 @@ static void unbind_from_irq(unsigned int irq) | |||
934 | if (irq_info[irq].type != IRQT_UNBOUND) { | 864 | if (irq_info[irq].type != IRQT_UNBOUND) { |
935 | irq_info[irq] = mk_unbound_info(); | 865 | irq_info[irq] = mk_unbound_info(); |
936 | 866 | ||
937 | irq_free_desc(irq); | 867 | xen_free_irq(irq); |
938 | } | 868 | } |
939 | 869 | ||
940 | spin_unlock(&irq_mapping_update_lock); | 870 | spin_unlock(&irq_mapping_update_lock); |
@@ -990,7 +920,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi, | |||
990 | if (irq < 0) | 920 | if (irq < 0) |
991 | return irq; | 921 | return irq; |
992 | 922 | ||
993 | irqflags |= IRQF_NO_SUSPEND; | 923 | irqflags |= IRQF_NO_SUSPEND | IRQF_FORCE_RESUME; |
994 | retval = request_irq(irq, handler, irqflags, devname, dev_id); | 924 | retval = request_irq(irq, handler, irqflags, devname, dev_id); |
995 | if (retval != 0) { | 925 | if (retval != 0) { |
996 | unbind_from_irq(irq); | 926 | unbind_from_irq(irq); |
@@ -1234,11 +1164,12 @@ static int rebind_irq_to_cpu(unsigned irq, unsigned tcpu) | |||
1234 | return 0; | 1164 | return 0; |
1235 | } | 1165 | } |
1236 | 1166 | ||
1237 | static int set_affinity_irq(unsigned irq, const struct cpumask *dest) | 1167 | static int set_affinity_irq(struct irq_data *data, const struct cpumask *dest, |
1168 | bool force) | ||
1238 | { | 1169 | { |
1239 | unsigned tcpu = cpumask_first(dest); | 1170 | unsigned tcpu = cpumask_first(dest); |
1240 | 1171 | ||
1241 | return rebind_irq_to_cpu(irq, tcpu); | 1172 | return rebind_irq_to_cpu(data->irq, tcpu); |
1242 | } | 1173 | } |
1243 | 1174 | ||
1244 | int resend_irq_on_evtchn(unsigned int irq) | 1175 | int resend_irq_on_evtchn(unsigned int irq) |
@@ -1257,35 +1188,35 @@ int resend_irq_on_evtchn(unsigned int irq) | |||
1257 | return 1; | 1188 | return 1; |
1258 | } | 1189 | } |
1259 | 1190 | ||
1260 | static void enable_dynirq(unsigned int irq) | 1191 | static void enable_dynirq(struct irq_data *data) |
1261 | { | 1192 | { |
1262 | int evtchn = evtchn_from_irq(irq); | 1193 | int evtchn = evtchn_from_irq(data->irq); |
1263 | 1194 | ||
1264 | if (VALID_EVTCHN(evtchn)) | 1195 | if (VALID_EVTCHN(evtchn)) |
1265 | unmask_evtchn(evtchn); | 1196 | unmask_evtchn(evtchn); |
1266 | } | 1197 | } |
1267 | 1198 | ||
1268 | static void disable_dynirq(unsigned int irq) | 1199 | static void disable_dynirq(struct irq_data *data) |
1269 | { | 1200 | { |
1270 | int evtchn = evtchn_from_irq(irq); | 1201 | int evtchn = evtchn_from_irq(data->irq); |
1271 | 1202 | ||
1272 | if (VALID_EVTCHN(evtchn)) | 1203 | if (VALID_EVTCHN(evtchn)) |
1273 | mask_evtchn(evtchn); | 1204 | mask_evtchn(evtchn); |
1274 | } | 1205 | } |
1275 | 1206 | ||
1276 | static void ack_dynirq(unsigned int irq) | 1207 | static void ack_dynirq(struct irq_data *data) |
1277 | { | 1208 | { |
1278 | int evtchn = evtchn_from_irq(irq); | 1209 | int evtchn = evtchn_from_irq(data->irq); |
1279 | 1210 | ||
1280 | move_masked_irq(irq); | 1211 | move_masked_irq(data->irq); |
1281 | 1212 | ||
1282 | if (VALID_EVTCHN(evtchn)) | 1213 | if (VALID_EVTCHN(evtchn)) |
1283 | unmask_evtchn(evtchn); | 1214 | unmask_evtchn(evtchn); |
1284 | } | 1215 | } |
1285 | 1216 | ||
1286 | static int retrigger_dynirq(unsigned int irq) | 1217 | static int retrigger_dynirq(struct irq_data *data) |
1287 | { | 1218 | { |
1288 | int evtchn = evtchn_from_irq(irq); | 1219 | int evtchn = evtchn_from_irq(data->irq); |
1289 | struct shared_info *sh = HYPERVISOR_shared_info; | 1220 | struct shared_info *sh = HYPERVISOR_shared_info; |
1290 | int ret = 0; | 1221 | int ret = 0; |
1291 | 1222 | ||
@@ -1334,7 +1265,7 @@ static void restore_cpu_pirqs(void) | |||
1334 | 1265 | ||
1335 | printk(KERN_DEBUG "xen: --> irq=%d, pirq=%d\n", irq, map_irq.pirq); | 1266 | printk(KERN_DEBUG "xen: --> irq=%d, pirq=%d\n", irq, map_irq.pirq); |
1336 | 1267 | ||
1337 | startup_pirq(irq); | 1268 | __startup_pirq(irq); |
1338 | } | 1269 | } |
1339 | } | 1270 | } |
1340 | 1271 | ||
@@ -1445,7 +1376,6 @@ void xen_poll_irq(int irq) | |||
1445 | void xen_irq_resume(void) | 1376 | void xen_irq_resume(void) |
1446 | { | 1377 | { |
1447 | unsigned int cpu, irq, evtchn; | 1378 | unsigned int cpu, irq, evtchn; |
1448 | struct irq_desc *desc; | ||
1449 | 1379 | ||
1450 | init_evtchn_cpu_bindings(); | 1380 | init_evtchn_cpu_bindings(); |
1451 | 1381 | ||
@@ -1465,66 +1395,48 @@ void xen_irq_resume(void) | |||
1465 | restore_cpu_ipis(cpu); | 1395 | restore_cpu_ipis(cpu); |
1466 | } | 1396 | } |
1467 | 1397 | ||
1468 | /* | ||
1469 | * Unmask any IRQF_NO_SUSPEND IRQs which are enabled. These | ||
1470 | * are not handled by the IRQ core. | ||
1471 | */ | ||
1472 | for_each_irq_desc(irq, desc) { | ||
1473 | if (!desc->action || !(desc->action->flags & IRQF_NO_SUSPEND)) | ||
1474 | continue; | ||
1475 | if (desc->status & IRQ_DISABLED) | ||
1476 | continue; | ||
1477 | |||
1478 | evtchn = evtchn_from_irq(irq); | ||
1479 | if (evtchn == -1) | ||
1480 | continue; | ||
1481 | |||
1482 | unmask_evtchn(evtchn); | ||
1483 | } | ||
1484 | |||
1485 | restore_cpu_pirqs(); | 1398 | restore_cpu_pirqs(); |
1486 | } | 1399 | } |
1487 | 1400 | ||
1488 | static struct irq_chip xen_dynamic_chip __read_mostly = { | 1401 | static struct irq_chip xen_dynamic_chip __read_mostly = { |
1489 | .name = "xen-dyn", | 1402 | .name = "xen-dyn", |
1490 | 1403 | ||
1491 | .disable = disable_dynirq, | 1404 | .irq_disable = disable_dynirq, |
1492 | .mask = disable_dynirq, | 1405 | .irq_mask = disable_dynirq, |
1493 | .unmask = enable_dynirq, | 1406 | .irq_unmask = enable_dynirq, |
1494 | 1407 | ||
1495 | .eoi = ack_dynirq, | 1408 | .irq_eoi = ack_dynirq, |
1496 | .set_affinity = set_affinity_irq, | 1409 | .irq_set_affinity = set_affinity_irq, |
1497 | .retrigger = retrigger_dynirq, | 1410 | .irq_retrigger = retrigger_dynirq, |
1498 | }; | 1411 | }; |
1499 | 1412 | ||
1500 | static struct irq_chip xen_pirq_chip __read_mostly = { | 1413 | static struct irq_chip xen_pirq_chip __read_mostly = { |
1501 | .name = "xen-pirq", | 1414 | .name = "xen-pirq", |
1502 | 1415 | ||
1503 | .startup = startup_pirq, | 1416 | .irq_startup = startup_pirq, |
1504 | .shutdown = shutdown_pirq, | 1417 | .irq_shutdown = shutdown_pirq, |
1505 | 1418 | ||
1506 | .enable = enable_pirq, | 1419 | .irq_enable = enable_pirq, |
1507 | .unmask = enable_pirq, | 1420 | .irq_unmask = enable_pirq, |
1508 | 1421 | ||
1509 | .disable = disable_pirq, | 1422 | .irq_disable = disable_pirq, |
1510 | .mask = disable_pirq, | 1423 | .irq_mask = disable_pirq, |
1511 | 1424 | ||
1512 | .ack = ack_pirq, | 1425 | .irq_ack = ack_pirq, |
1513 | .end = end_pirq, | ||
1514 | 1426 | ||
1515 | .set_affinity = set_affinity_irq, | 1427 | .irq_set_affinity = set_affinity_irq, |
1516 | 1428 | ||
1517 | .retrigger = retrigger_dynirq, | 1429 | .irq_retrigger = retrigger_dynirq, |
1518 | }; | 1430 | }; |
1519 | 1431 | ||
1520 | static struct irq_chip xen_percpu_chip __read_mostly = { | 1432 | static struct irq_chip xen_percpu_chip __read_mostly = { |
1521 | .name = "xen-percpu", | 1433 | .name = "xen-percpu", |
1522 | 1434 | ||
1523 | .disable = disable_dynirq, | 1435 | .irq_disable = disable_dynirq, |
1524 | .mask = disable_dynirq, | 1436 | .irq_mask = disable_dynirq, |
1525 | .unmask = enable_dynirq, | 1437 | .irq_unmask = enable_dynirq, |
1526 | 1438 | ||
1527 | .ack = ack_dynirq, | 1439 | .irq_ack = ack_dynirq, |
1528 | }; | 1440 | }; |
1529 | 1441 | ||
1530 | int xen_set_callback_via(uint64_t via) | 1442 | int xen_set_callback_via(uint64_t via) |
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index 24177272bcb8..ebb292859b59 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
@@ -34,42 +34,38 @@ enum shutdown_state { | |||
34 | /* Ignore multiple shutdown requests. */ | 34 | /* Ignore multiple shutdown requests. */ |
35 | static enum shutdown_state shutting_down = SHUTDOWN_INVALID; | 35 | static enum shutdown_state shutting_down = SHUTDOWN_INVALID; |
36 | 36 | ||
37 | #ifdef CONFIG_PM_SLEEP | 37 | struct suspend_info { |
38 | static int xen_hvm_suspend(void *data) | 38 | int cancelled; |
39 | { | 39 | unsigned long arg; /* extra hypercall argument */ |
40 | int err; | 40 | void (*pre)(void); |
41 | struct sched_shutdown r = { .reason = SHUTDOWN_suspend }; | 41 | void (*post)(int cancelled); |
42 | int *cancelled = data; | 42 | }; |
43 | |||
44 | BUG_ON(!irqs_disabled()); | ||
45 | |||
46 | err = sysdev_suspend(PMSG_SUSPEND); | ||
47 | if (err) { | ||
48 | printk(KERN_ERR "xen_hvm_suspend: sysdev_suspend failed: %d\n", | ||
49 | err); | ||
50 | return err; | ||
51 | } | ||
52 | |||
53 | *cancelled = HYPERVISOR_sched_op(SCHEDOP_shutdown, &r); | ||
54 | 43 | ||
55 | xen_hvm_post_suspend(*cancelled); | 44 | static void xen_hvm_post_suspend(int cancelled) |
45 | { | ||
46 | xen_arch_hvm_post_suspend(cancelled); | ||
56 | gnttab_resume(); | 47 | gnttab_resume(); |
48 | } | ||
57 | 49 | ||
58 | if (!*cancelled) { | 50 | static void xen_pre_suspend(void) |
59 | xen_irq_resume(); | 51 | { |
60 | xen_console_resume(); | 52 | xen_mm_pin_all(); |
61 | xen_timer_resume(); | 53 | gnttab_suspend(); |
62 | } | 54 | xen_arch_pre_suspend(); |
63 | 55 | } | |
64 | sysdev_resume(); | ||
65 | 56 | ||
66 | return 0; | 57 | static void xen_post_suspend(int cancelled) |
58 | { | ||
59 | xen_arch_post_suspend(cancelled); | ||
60 | gnttab_resume(); | ||
61 | xen_mm_unpin_all(); | ||
67 | } | 62 | } |
68 | 63 | ||
64 | #ifdef CONFIG_PM_SLEEP | ||
69 | static int xen_suspend(void *data) | 65 | static int xen_suspend(void *data) |
70 | { | 66 | { |
67 | struct suspend_info *si = data; | ||
71 | int err; | 68 | int err; |
72 | int *cancelled = data; | ||
73 | 69 | ||
74 | BUG_ON(!irqs_disabled()); | 70 | BUG_ON(!irqs_disabled()); |
75 | 71 | ||
@@ -80,22 +76,20 @@ static int xen_suspend(void *data) | |||
80 | return err; | 76 | return err; |
81 | } | 77 | } |
82 | 78 | ||
83 | xen_mm_pin_all(); | 79 | if (si->pre) |
84 | gnttab_suspend(); | 80 | si->pre(); |
85 | xen_pre_suspend(); | ||
86 | 81 | ||
87 | /* | 82 | /* |
88 | * This hypercall returns 1 if suspend was cancelled | 83 | * This hypercall returns 1 if suspend was cancelled |
89 | * or the domain was merely checkpointed, and 0 if it | 84 | * or the domain was merely checkpointed, and 0 if it |
90 | * is resuming in a new domain. | 85 | * is resuming in a new domain. |
91 | */ | 86 | */ |
92 | *cancelled = HYPERVISOR_suspend(virt_to_mfn(xen_start_info)); | 87 | si->cancelled = HYPERVISOR_suspend(si->arg); |
93 | 88 | ||
94 | xen_post_suspend(*cancelled); | 89 | if (si->post) |
95 | gnttab_resume(); | 90 | si->post(si->cancelled); |
96 | xen_mm_unpin_all(); | ||
97 | 91 | ||
98 | if (!*cancelled) { | 92 | if (!si->cancelled) { |
99 | xen_irq_resume(); | 93 | xen_irq_resume(); |
100 | xen_console_resume(); | 94 | xen_console_resume(); |
101 | xen_timer_resume(); | 95 | xen_timer_resume(); |
@@ -109,7 +103,7 @@ static int xen_suspend(void *data) | |||
109 | static void do_suspend(void) | 103 | static void do_suspend(void) |
110 | { | 104 | { |
111 | int err; | 105 | int err; |
112 | int cancelled = 1; | 106 | struct suspend_info si; |
113 | 107 | ||
114 | shutting_down = SHUTDOWN_SUSPEND; | 108 | shutting_down = SHUTDOWN_SUSPEND; |
115 | 109 | ||
@@ -139,20 +133,29 @@ static void do_suspend(void) | |||
139 | goto out_resume; | 133 | goto out_resume; |
140 | } | 134 | } |
141 | 135 | ||
142 | if (xen_hvm_domain()) | 136 | si.cancelled = 1; |
143 | err = stop_machine(xen_hvm_suspend, &cancelled, cpumask_of(0)); | 137 | |
144 | else | 138 | if (xen_hvm_domain()) { |
145 | err = stop_machine(xen_suspend, &cancelled, cpumask_of(0)); | 139 | si.arg = 0UL; |
140 | si.pre = NULL; | ||
141 | si.post = &xen_hvm_post_suspend; | ||
142 | } else { | ||
143 | si.arg = virt_to_mfn(xen_start_info); | ||
144 | si.pre = &xen_pre_suspend; | ||
145 | si.post = &xen_post_suspend; | ||
146 | } | ||
147 | |||
148 | err = stop_machine(xen_suspend, &si, cpumask_of(0)); | ||
146 | 149 | ||
147 | dpm_resume_noirq(PMSG_RESUME); | 150 | dpm_resume_noirq(PMSG_RESUME); |
148 | 151 | ||
149 | if (err) { | 152 | if (err) { |
150 | printk(KERN_ERR "failed to start xen_suspend: %d\n", err); | 153 | printk(KERN_ERR "failed to start xen_suspend: %d\n", err); |
151 | cancelled = 1; | 154 | si.cancelled = 1; |
152 | } | 155 | } |
153 | 156 | ||
154 | out_resume: | 157 | out_resume: |
155 | if (!cancelled) { | 158 | if (!si.cancelled) { |
156 | xen_arch_resume(); | 159 | xen_arch_resume(); |
157 | xs_resume(); | 160 | xs_resume(); |
158 | } else | 161 | } else |
@@ -172,12 +175,39 @@ out: | |||
172 | } | 175 | } |
173 | #endif /* CONFIG_PM_SLEEP */ | 176 | #endif /* CONFIG_PM_SLEEP */ |
174 | 177 | ||
178 | struct shutdown_handler { | ||
179 | const char *command; | ||
180 | void (*cb)(void); | ||
181 | }; | ||
182 | |||
183 | static void do_poweroff(void) | ||
184 | { | ||
185 | shutting_down = SHUTDOWN_POWEROFF; | ||
186 | orderly_poweroff(false); | ||
187 | } | ||
188 | |||
189 | static void do_reboot(void) | ||
190 | { | ||
191 | shutting_down = SHUTDOWN_POWEROFF; /* ? */ | ||
192 | ctrl_alt_del(); | ||
193 | } | ||
194 | |||
175 | static void shutdown_handler(struct xenbus_watch *watch, | 195 | static void shutdown_handler(struct xenbus_watch *watch, |
176 | const char **vec, unsigned int len) | 196 | const char **vec, unsigned int len) |
177 | { | 197 | { |
178 | char *str; | 198 | char *str; |
179 | struct xenbus_transaction xbt; | 199 | struct xenbus_transaction xbt; |
180 | int err; | 200 | int err; |
201 | static struct shutdown_handler handlers[] = { | ||
202 | { "poweroff", do_poweroff }, | ||
203 | { "halt", do_poweroff }, | ||
204 | { "reboot", do_reboot }, | ||
205 | #ifdef CONFIG_PM_SLEEP | ||
206 | { "suspend", do_suspend }, | ||
207 | #endif | ||
208 | {NULL, NULL}, | ||
209 | }; | ||
210 | static struct shutdown_handler *handler; | ||
181 | 211 | ||
182 | if (shutting_down != SHUTDOWN_INVALID) | 212 | if (shutting_down != SHUTDOWN_INVALID) |
183 | return; | 213 | return; |
@@ -194,7 +224,14 @@ static void shutdown_handler(struct xenbus_watch *watch, | |||
194 | return; | 224 | return; |
195 | } | 225 | } |
196 | 226 | ||
197 | xenbus_write(xbt, "control", "shutdown", ""); | 227 | for (handler = &handlers[0]; handler->command; handler++) { |
228 | if (strcmp(str, handler->command) == 0) | ||
229 | break; | ||
230 | } | ||
231 | |||
232 | /* Only acknowledge commands which we are prepared to handle. */ | ||
233 | if (handler->cb) | ||
234 | xenbus_write(xbt, "control", "shutdown", ""); | ||
198 | 235 | ||
199 | err = xenbus_transaction_end(xbt, 0); | 236 | err = xenbus_transaction_end(xbt, 0); |
200 | if (err == -EAGAIN) { | 237 | if (err == -EAGAIN) { |
@@ -202,17 +239,8 @@ static void shutdown_handler(struct xenbus_watch *watch, | |||
202 | goto again; | 239 | goto again; |
203 | } | 240 | } |
204 | 241 | ||
205 | if (strcmp(str, "poweroff") == 0 || | 242 | if (handler->cb) { |
206 | strcmp(str, "halt") == 0) { | 243 | handler->cb(); |
207 | shutting_down = SHUTDOWN_POWEROFF; | ||
208 | orderly_poweroff(false); | ||
209 | } else if (strcmp(str, "reboot") == 0) { | ||
210 | shutting_down = SHUTDOWN_POWEROFF; /* ? */ | ||
211 | ctrl_alt_del(); | ||
212 | #ifdef CONFIG_PM_SLEEP | ||
213 | } else if (strcmp(str, "suspend") == 0) { | ||
214 | do_suspend(); | ||
215 | #endif | ||
216 | } else { | 244 | } else { |
217 | printk(KERN_INFO "Ignoring shutdown request: %s\n", str); | 245 | printk(KERN_INFO "Ignoring shutdown request: %s\n", str); |
218 | shutting_down = SHUTDOWN_INVALID; | 246 | shutting_down = SHUTDOWN_INVALID; |
@@ -291,27 +319,18 @@ static int shutdown_event(struct notifier_block *notifier, | |||
291 | return NOTIFY_DONE; | 319 | return NOTIFY_DONE; |
292 | } | 320 | } |
293 | 321 | ||
294 | static int __init __setup_shutdown_event(void) | ||
295 | { | ||
296 | /* Delay initialization in the PV on HVM case */ | ||
297 | if (xen_hvm_domain()) | ||
298 | return 0; | ||
299 | |||
300 | if (!xen_pv_domain()) | ||
301 | return -ENODEV; | ||
302 | |||
303 | return xen_setup_shutdown_event(); | ||
304 | } | ||
305 | |||
306 | int xen_setup_shutdown_event(void) | 322 | int xen_setup_shutdown_event(void) |
307 | { | 323 | { |
308 | static struct notifier_block xenstore_notifier = { | 324 | static struct notifier_block xenstore_notifier = { |
309 | .notifier_call = shutdown_event | 325 | .notifier_call = shutdown_event |
310 | }; | 326 | }; |
327 | |||
328 | if (!xen_domain()) | ||
329 | return -ENODEV; | ||
311 | register_xenstore_notifier(&xenstore_notifier); | 330 | register_xenstore_notifier(&xenstore_notifier); |
312 | 331 | ||
313 | return 0; | 332 | return 0; |
314 | } | 333 | } |
315 | EXPORT_SYMBOL_GPL(xen_setup_shutdown_event); | 334 | EXPORT_SYMBOL_GPL(xen_setup_shutdown_event); |
316 | 335 | ||
317 | subsys_initcall(__setup_shutdown_event); | 336 | subsys_initcall(xen_setup_shutdown_event); |
diff --git a/drivers/xen/platform-pci.c b/drivers/xen/platform-pci.c index afbe041f42c5..319dd0a94d51 100644 --- a/drivers/xen/platform-pci.c +++ b/drivers/xen/platform-pci.c | |||
@@ -156,9 +156,6 @@ static int __devinit platform_pci_init(struct pci_dev *pdev, | |||
156 | if (ret) | 156 | if (ret) |
157 | goto out; | 157 | goto out; |
158 | xenbus_probe(NULL); | 158 | xenbus_probe(NULL); |
159 | ret = xen_setup_shutdown_event(); | ||
160 | if (ret) | ||
161 | goto out; | ||
162 | return 0; | 159 | return 0; |
163 | 160 | ||
164 | out: | 161 | out: |
diff --git a/fs/Kconfig b/fs/Kconfig index 3db9caa57edc..7cb53aafac1e 100644 --- a/fs/Kconfig +++ b/fs/Kconfig | |||
@@ -47,7 +47,7 @@ config FS_POSIX_ACL | |||
47 | def_bool n | 47 | def_bool n |
48 | 48 | ||
49 | config EXPORTFS | 49 | config EXPORTFS |
50 | tristate | 50 | bool |
51 | 51 | ||
52 | config FILE_LOCKING | 52 | config FILE_LOCKING |
53 | bool "Enable POSIX file locking API" if EXPERT | 53 | bool "Enable POSIX file locking API" if EXPERT |
diff --git a/fs/Makefile b/fs/Makefile index a7f7cef0c0c8..ba01202844c5 100644 --- a/fs/Makefile +++ b/fs/Makefile | |||
@@ -48,6 +48,8 @@ obj-$(CONFIG_FS_POSIX_ACL) += posix_acl.o xattr_acl.o | |||
48 | obj-$(CONFIG_NFS_COMMON) += nfs_common/ | 48 | obj-$(CONFIG_NFS_COMMON) += nfs_common/ |
49 | obj-$(CONFIG_GENERIC_ACL) += generic_acl.o | 49 | obj-$(CONFIG_GENERIC_ACL) += generic_acl.o |
50 | 50 | ||
51 | obj-$(CONFIG_FHANDLE) += fhandle.o | ||
52 | |||
51 | obj-y += quota/ | 53 | obj-y += quota/ |
52 | 54 | ||
53 | obj-$(CONFIG_PROC_FS) += proc/ | 55 | obj-$(CONFIG_PROC_FS) += proc/ |
diff --git a/fs/afs/write.c b/fs/afs/write.c index 15690bb1d3b5..789b3afb3423 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c | |||
@@ -140,6 +140,7 @@ int afs_write_begin(struct file *file, struct address_space *mapping, | |||
140 | candidate->first = candidate->last = index; | 140 | candidate->first = candidate->last = index; |
141 | candidate->offset_first = from; | 141 | candidate->offset_first = from; |
142 | candidate->to_last = to; | 142 | candidate->to_last = to; |
143 | INIT_LIST_HEAD(&candidate->link); | ||
143 | candidate->usage = 1; | 144 | candidate->usage = 1; |
144 | candidate->state = AFS_WBACK_PENDING; | 145 | candidate->state = AFS_WBACK_PENDING; |
145 | init_waitqueue_head(&candidate->waitq); | 146 | init_waitqueue_head(&candidate->waitq); |
@@ -239,15 +239,23 @@ static void __put_ioctx(struct kioctx *ctx) | |||
239 | call_rcu(&ctx->rcu_head, ctx_rcu_free); | 239 | call_rcu(&ctx->rcu_head, ctx_rcu_free); |
240 | } | 240 | } |
241 | 241 | ||
242 | #define get_ioctx(kioctx) do { \ | 242 | static inline void get_ioctx(struct kioctx *kioctx) |
243 | BUG_ON(atomic_read(&(kioctx)->users) <= 0); \ | 243 | { |
244 | atomic_inc(&(kioctx)->users); \ | 244 | BUG_ON(atomic_read(&kioctx->users) <= 0); |
245 | } while (0) | 245 | atomic_inc(&kioctx->users); |
246 | #define put_ioctx(kioctx) do { \ | 246 | } |
247 | BUG_ON(atomic_read(&(kioctx)->users) <= 0); \ | 247 | |
248 | if (unlikely(atomic_dec_and_test(&(kioctx)->users))) \ | 248 | static inline int try_get_ioctx(struct kioctx *kioctx) |
249 | __put_ioctx(kioctx); \ | 249 | { |
250 | } while (0) | 250 | return atomic_inc_not_zero(&kioctx->users); |
251 | } | ||
252 | |||
253 | static inline void put_ioctx(struct kioctx *kioctx) | ||
254 | { | ||
255 | BUG_ON(atomic_read(&kioctx->users) <= 0); | ||
256 | if (unlikely(atomic_dec_and_test(&kioctx->users))) | ||
257 | __put_ioctx(kioctx); | ||
258 | } | ||
251 | 259 | ||
252 | /* ioctx_alloc | 260 | /* ioctx_alloc |
253 | * Allocates and initializes an ioctx. Returns an ERR_PTR if it failed. | 261 | * Allocates and initializes an ioctx. Returns an ERR_PTR if it failed. |
@@ -601,8 +609,13 @@ static struct kioctx *lookup_ioctx(unsigned long ctx_id) | |||
601 | rcu_read_lock(); | 609 | rcu_read_lock(); |
602 | 610 | ||
603 | hlist_for_each_entry_rcu(ctx, n, &mm->ioctx_list, list) { | 611 | hlist_for_each_entry_rcu(ctx, n, &mm->ioctx_list, list) { |
604 | if (ctx->user_id == ctx_id && !ctx->dead) { | 612 | /* |
605 | get_ioctx(ctx); | 613 | * RCU protects us against accessing freed memory but |
614 | * we have to be careful not to get a reference when the | ||
615 | * reference count already dropped to 0 (ctx->dead test | ||
616 | * is unreliable because of races). | ||
617 | */ | ||
618 | if (ctx->user_id == ctx_id && !ctx->dead && try_get_ioctx(ctx)){ | ||
606 | ret = ctx; | 619 | ret = ctx; |
607 | break; | 620 | break; |
608 | } | 621 | } |
@@ -1629,6 +1642,23 @@ static int io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, | |||
1629 | goto out_put_req; | 1642 | goto out_put_req; |
1630 | 1643 | ||
1631 | spin_lock_irq(&ctx->ctx_lock); | 1644 | spin_lock_irq(&ctx->ctx_lock); |
1645 | /* | ||
1646 | * We could have raced with io_destroy() and are currently holding a | ||
1647 | * reference to ctx which should be destroyed. We cannot submit IO | ||
1648 | * since ctx gets freed as soon as io_submit() puts its reference. The | ||
1649 | * check here is reliable: io_destroy() sets ctx->dead before waiting | ||
1650 | * for outstanding IO and the barrier between these two is realized by | ||
1651 | * unlock of mm->ioctx_lock and lock of ctx->ctx_lock. Analogously we | ||
1652 | * increment ctx->reqs_active before checking for ctx->dead and the | ||
1653 | * barrier is realized by unlock and lock of ctx->ctx_lock. Thus if we | ||
1654 | * don't see ctx->dead set here, io_destroy() waits for our IO to | ||
1655 | * finish. | ||
1656 | */ | ||
1657 | if (ctx->dead) { | ||
1658 | spin_unlock_irq(&ctx->ctx_lock); | ||
1659 | ret = -EINVAL; | ||
1660 | goto out_put_req; | ||
1661 | } | ||
1632 | aio_run_iocb(req); | 1662 | aio_run_iocb(req); |
1633 | if (!list_empty(&ctx->run_list)) { | 1663 | if (!list_empty(&ctx->run_list)) { |
1634 | /* drain the run list */ | 1664 | /* drain the run list */ |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 4fb8a3431531..889287019599 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -873,6 +873,11 @@ int bd_link_disk_holder(struct block_device *bdev, struct gendisk *disk) | |||
873 | ret = add_symlink(bdev->bd_part->holder_dir, &disk_to_dev(disk)->kobj); | 873 | ret = add_symlink(bdev->bd_part->holder_dir, &disk_to_dev(disk)->kobj); |
874 | if (ret) | 874 | if (ret) |
875 | goto out_del; | 875 | goto out_del; |
876 | /* | ||
877 | * bdev could be deleted beneath us which would implicitly destroy | ||
878 | * the holder directory. Hold on to it. | ||
879 | */ | ||
880 | kobject_get(bdev->bd_part->holder_dir); | ||
876 | 881 | ||
877 | list_add(&holder->list, &bdev->bd_holder_disks); | 882 | list_add(&holder->list, &bdev->bd_holder_disks); |
878 | goto out_unlock; | 883 | goto out_unlock; |
@@ -909,6 +914,7 @@ void bd_unlink_disk_holder(struct block_device *bdev, struct gendisk *disk) | |||
909 | del_symlink(disk->slave_dir, &part_to_dev(bdev->bd_part)->kobj); | 914 | del_symlink(disk->slave_dir, &part_to_dev(bdev->bd_part)->kobj); |
910 | del_symlink(bdev->bd_part->holder_dir, | 915 | del_symlink(bdev->bd_part->holder_dir, |
911 | &disk_to_dev(disk)->kobj); | 916 | &disk_to_dev(disk)->kobj); |
917 | kobject_put(bdev->bd_part->holder_dir); | ||
912 | list_del_init(&holder->list); | 918 | list_del_init(&holder->list); |
913 | kfree(holder); | 919 | kfree(holder); |
914 | } | 920 | } |
@@ -922,14 +928,15 @@ EXPORT_SYMBOL_GPL(bd_unlink_disk_holder); | |||
922 | * flush_disk - invalidates all buffer-cache entries on a disk | 928 | * flush_disk - invalidates all buffer-cache entries on a disk |
923 | * | 929 | * |
924 | * @bdev: struct block device to be flushed | 930 | * @bdev: struct block device to be flushed |
931 | * @kill_dirty: flag to guide handling of dirty inodes | ||
925 | * | 932 | * |
926 | * Invalidates all buffer-cache entries on a disk. It should be called | 933 | * Invalidates all buffer-cache entries on a disk. It should be called |
927 | * when a disk has been changed -- either by a media change or online | 934 | * when a disk has been changed -- either by a media change or online |
928 | * resize. | 935 | * resize. |
929 | */ | 936 | */ |
930 | static void flush_disk(struct block_device *bdev) | 937 | static void flush_disk(struct block_device *bdev, bool kill_dirty) |
931 | { | 938 | { |
932 | if (__invalidate_device(bdev)) { | 939 | if (__invalidate_device(bdev, kill_dirty)) { |
933 | char name[BDEVNAME_SIZE] = ""; | 940 | char name[BDEVNAME_SIZE] = ""; |
934 | 941 | ||
935 | if (bdev->bd_disk) | 942 | if (bdev->bd_disk) |
@@ -966,7 +973,7 @@ void check_disk_size_change(struct gendisk *disk, struct block_device *bdev) | |||
966 | "%s: detected capacity change from %lld to %lld\n", | 973 | "%s: detected capacity change from %lld to %lld\n", |
967 | name, bdev_size, disk_size); | 974 | name, bdev_size, disk_size); |
968 | i_size_write(bdev->bd_inode, disk_size); | 975 | i_size_write(bdev->bd_inode, disk_size); |
969 | flush_disk(bdev); | 976 | flush_disk(bdev, false); |
970 | } | 977 | } |
971 | } | 978 | } |
972 | EXPORT_SYMBOL(check_disk_size_change); | 979 | EXPORT_SYMBOL(check_disk_size_change); |
@@ -1019,7 +1026,7 @@ int check_disk_change(struct block_device *bdev) | |||
1019 | if (!(events & DISK_EVENT_MEDIA_CHANGE)) | 1026 | if (!(events & DISK_EVENT_MEDIA_CHANGE)) |
1020 | return 0; | 1027 | return 0; |
1021 | 1028 | ||
1022 | flush_disk(bdev); | 1029 | flush_disk(bdev, true); |
1023 | if (bdops->revalidate_disk) | 1030 | if (bdops->revalidate_disk) |
1024 | bdops->revalidate_disk(bdev->bd_disk); | 1031 | bdops->revalidate_disk(bdev->bd_disk); |
1025 | return 1; | 1032 | return 1; |
@@ -1600,7 +1607,7 @@ fail: | |||
1600 | } | 1607 | } |
1601 | EXPORT_SYMBOL(lookup_bdev); | 1608 | EXPORT_SYMBOL(lookup_bdev); |
1602 | 1609 | ||
1603 | int __invalidate_device(struct block_device *bdev) | 1610 | int __invalidate_device(struct block_device *bdev, bool kill_dirty) |
1604 | { | 1611 | { |
1605 | struct super_block *sb = get_super(bdev); | 1612 | struct super_block *sb = get_super(bdev); |
1606 | int res = 0; | 1613 | int res = 0; |
@@ -1613,7 +1620,7 @@ int __invalidate_device(struct block_device *bdev) | |||
1613 | * hold). | 1620 | * hold). |
1614 | */ | 1621 | */ |
1615 | shrink_dcache_sb(sb); | 1622 | shrink_dcache_sb(sb); |
1616 | res = invalidate_inodes(sb); | 1623 | res = invalidate_inodes(sb, kill_dirty); |
1617 | drop_super(sb); | 1624 | drop_super(sb); |
1618 | } | 1625 | } |
1619 | invalidate_bdev(bdev); | 1626 | invalidate_bdev(bdev); |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 2c98b3af6052..7f78cc78fdd0 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -729,6 +729,15 @@ struct btrfs_space_info { | |||
729 | u64 disk_total; /* total bytes on disk, takes mirrors into | 729 | u64 disk_total; /* total bytes on disk, takes mirrors into |
730 | account */ | 730 | account */ |
731 | 731 | ||
732 | /* | ||
733 | * we bump reservation progress every time we decrement | ||
734 | * bytes_reserved. This way people waiting for reservations | ||
735 | * know something good has happened and they can check | ||
736 | * for progress. The number here isn't to be trusted, it | ||
737 | * just shows reclaim activity | ||
738 | */ | ||
739 | unsigned long reservation_progress; | ||
740 | |||
732 | int full; /* indicates that we cannot allocate any more | 741 | int full; /* indicates that we cannot allocate any more |
733 | chunks for this space */ | 742 | chunks for this space */ |
734 | int force_alloc; /* set if we need to force a chunk alloc for | 743 | int force_alloc; /* set if we need to force a chunk alloc for |
@@ -1254,6 +1263,7 @@ struct btrfs_root { | |||
1254 | #define BTRFS_MOUNT_SPACE_CACHE (1 << 12) | 1263 | #define BTRFS_MOUNT_SPACE_CACHE (1 << 12) |
1255 | #define BTRFS_MOUNT_CLEAR_CACHE (1 << 13) | 1264 | #define BTRFS_MOUNT_CLEAR_CACHE (1 << 13) |
1256 | #define BTRFS_MOUNT_USER_SUBVOL_RM_ALLOWED (1 << 14) | 1265 | #define BTRFS_MOUNT_USER_SUBVOL_RM_ALLOWED (1 << 14) |
1266 | #define BTRFS_MOUNT_ENOSPC_DEBUG (1 << 15) | ||
1257 | 1267 | ||
1258 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) | 1268 | #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt) |
1259 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) | 1269 | #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt) |
@@ -2218,6 +2228,8 @@ int btrfs_error_unpin_extent_range(struct btrfs_root *root, | |||
2218 | u64 start, u64 end); | 2228 | u64 start, u64 end); |
2219 | int btrfs_error_discard_extent(struct btrfs_root *root, u64 bytenr, | 2229 | int btrfs_error_discard_extent(struct btrfs_root *root, u64 bytenr, |
2220 | u64 num_bytes); | 2230 | u64 num_bytes); |
2231 | int btrfs_force_chunk_alloc(struct btrfs_trans_handle *trans, | ||
2232 | struct btrfs_root *root, u64 type); | ||
2221 | 2233 | ||
2222 | /* ctree.c */ | 2234 | /* ctree.c */ |
2223 | int btrfs_bin_search(struct extent_buffer *eb, struct btrfs_key *key, | 2235 | int btrfs_bin_search(struct extent_buffer *eb, struct btrfs_key *key, |
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c index ff27d7a477b2..b4ffad859adb 100644 --- a/fs/btrfs/export.c +++ b/fs/btrfs/export.c | |||
@@ -21,9 +21,13 @@ static int btrfs_encode_fh(struct dentry *dentry, u32 *fh, int *max_len, | |||
21 | int len = *max_len; | 21 | int len = *max_len; |
22 | int type; | 22 | int type; |
23 | 23 | ||
24 | if ((len < BTRFS_FID_SIZE_NON_CONNECTABLE) || | 24 | if (connectable && (len < BTRFS_FID_SIZE_CONNECTABLE)) { |
25 | (connectable && len < BTRFS_FID_SIZE_CONNECTABLE)) | 25 | *max_len = BTRFS_FID_SIZE_CONNECTABLE; |
26 | return 255; | 26 | return 255; |
27 | } else if (len < BTRFS_FID_SIZE_NON_CONNECTABLE) { | ||
28 | *max_len = BTRFS_FID_SIZE_NON_CONNECTABLE; | ||
29 | return 255; | ||
30 | } | ||
27 | 31 | ||
28 | len = BTRFS_FID_SIZE_NON_CONNECTABLE; | 32 | len = BTRFS_FID_SIZE_NON_CONNECTABLE; |
29 | type = FILEID_BTRFS_WITHOUT_PARENT; | 33 | type = FILEID_BTRFS_WITHOUT_PARENT; |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index f3c96fc01439..7b3089b5c2df 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -3342,15 +3342,16 @@ static int shrink_delalloc(struct btrfs_trans_handle *trans, | |||
3342 | u64 max_reclaim; | 3342 | u64 max_reclaim; |
3343 | u64 reclaimed = 0; | 3343 | u64 reclaimed = 0; |
3344 | long time_left; | 3344 | long time_left; |
3345 | int pause = 1; | ||
3346 | int nr_pages = (2 * 1024 * 1024) >> PAGE_CACHE_SHIFT; | 3345 | int nr_pages = (2 * 1024 * 1024) >> PAGE_CACHE_SHIFT; |
3347 | int loops = 0; | 3346 | int loops = 0; |
3347 | unsigned long progress; | ||
3348 | 3348 | ||
3349 | block_rsv = &root->fs_info->delalloc_block_rsv; | 3349 | block_rsv = &root->fs_info->delalloc_block_rsv; |
3350 | space_info = block_rsv->space_info; | 3350 | space_info = block_rsv->space_info; |
3351 | 3351 | ||
3352 | smp_mb(); | 3352 | smp_mb(); |
3353 | reserved = space_info->bytes_reserved; | 3353 | reserved = space_info->bytes_reserved; |
3354 | progress = space_info->reservation_progress; | ||
3354 | 3355 | ||
3355 | if (reserved == 0) | 3356 | if (reserved == 0) |
3356 | return 0; | 3357 | return 0; |
@@ -3365,31 +3366,36 @@ static int shrink_delalloc(struct btrfs_trans_handle *trans, | |||
3365 | writeback_inodes_sb_nr_if_idle(root->fs_info->sb, nr_pages); | 3366 | writeback_inodes_sb_nr_if_idle(root->fs_info->sb, nr_pages); |
3366 | 3367 | ||
3367 | spin_lock(&space_info->lock); | 3368 | spin_lock(&space_info->lock); |
3368 | if (reserved > space_info->bytes_reserved) { | 3369 | if (reserved > space_info->bytes_reserved) |
3369 | loops = 0; | ||
3370 | reclaimed += reserved - space_info->bytes_reserved; | 3370 | reclaimed += reserved - space_info->bytes_reserved; |
3371 | } else { | ||
3372 | loops++; | ||
3373 | } | ||
3374 | reserved = space_info->bytes_reserved; | 3371 | reserved = space_info->bytes_reserved; |
3375 | spin_unlock(&space_info->lock); | 3372 | spin_unlock(&space_info->lock); |
3376 | 3373 | ||
3374 | loops++; | ||
3375 | |||
3377 | if (reserved == 0 || reclaimed >= max_reclaim) | 3376 | if (reserved == 0 || reclaimed >= max_reclaim) |
3378 | break; | 3377 | break; |
3379 | 3378 | ||
3380 | if (trans && trans->transaction->blocked) | 3379 | if (trans && trans->transaction->blocked) |
3381 | return -EAGAIN; | 3380 | return -EAGAIN; |
3382 | 3381 | ||
3383 | __set_current_state(TASK_INTERRUPTIBLE); | 3382 | time_left = schedule_timeout_interruptible(1); |
3384 | time_left = schedule_timeout(pause); | ||
3385 | 3383 | ||
3386 | /* We were interrupted, exit */ | 3384 | /* We were interrupted, exit */ |
3387 | if (time_left) | 3385 | if (time_left) |
3388 | break; | 3386 | break; |
3389 | 3387 | ||
3390 | pause <<= 1; | 3388 | /* we've kicked the IO a few times, if anything has been freed, |
3391 | if (pause > HZ / 10) | 3389 | * exit. There is no sense in looping here for a long time |
3392 | pause = HZ / 10; | 3390 | * when we really need to commit the transaction, or there are |
3391 | * just too many writers without enough free space | ||
3392 | */ | ||
3393 | |||
3394 | if (loops > 3) { | ||
3395 | smp_mb(); | ||
3396 | if (progress != space_info->reservation_progress) | ||
3397 | break; | ||
3398 | } | ||
3393 | 3399 | ||
3394 | } | 3400 | } |
3395 | return reclaimed >= to_reclaim; | 3401 | return reclaimed >= to_reclaim; |
@@ -3612,6 +3618,7 @@ void block_rsv_release_bytes(struct btrfs_block_rsv *block_rsv, | |||
3612 | if (num_bytes) { | 3618 | if (num_bytes) { |
3613 | spin_lock(&space_info->lock); | 3619 | spin_lock(&space_info->lock); |
3614 | space_info->bytes_reserved -= num_bytes; | 3620 | space_info->bytes_reserved -= num_bytes; |
3621 | space_info->reservation_progress++; | ||
3615 | spin_unlock(&space_info->lock); | 3622 | spin_unlock(&space_info->lock); |
3616 | } | 3623 | } |
3617 | } | 3624 | } |
@@ -3844,6 +3851,7 @@ static void update_global_block_rsv(struct btrfs_fs_info *fs_info) | |||
3844 | if (block_rsv->reserved >= block_rsv->size) { | 3851 | if (block_rsv->reserved >= block_rsv->size) { |
3845 | num_bytes = block_rsv->reserved - block_rsv->size; | 3852 | num_bytes = block_rsv->reserved - block_rsv->size; |
3846 | sinfo->bytes_reserved -= num_bytes; | 3853 | sinfo->bytes_reserved -= num_bytes; |
3854 | sinfo->reservation_progress++; | ||
3847 | block_rsv->reserved = block_rsv->size; | 3855 | block_rsv->reserved = block_rsv->size; |
3848 | block_rsv->full = 1; | 3856 | block_rsv->full = 1; |
3849 | } | 3857 | } |
@@ -4005,7 +4013,6 @@ int btrfs_delalloc_reserve_metadata(struct inode *inode, u64 num_bytes) | |||
4005 | to_reserve = 0; | 4013 | to_reserve = 0; |
4006 | } | 4014 | } |
4007 | spin_unlock(&BTRFS_I(inode)->accounting_lock); | 4015 | spin_unlock(&BTRFS_I(inode)->accounting_lock); |
4008 | |||
4009 | to_reserve += calc_csum_metadata_size(inode, num_bytes); | 4016 | to_reserve += calc_csum_metadata_size(inode, num_bytes); |
4010 | ret = reserve_metadata_bytes(NULL, root, block_rsv, to_reserve, 1); | 4017 | ret = reserve_metadata_bytes(NULL, root, block_rsv, to_reserve, 1); |
4011 | if (ret) | 4018 | if (ret) |
@@ -4133,6 +4140,7 @@ static int update_block_group(struct btrfs_trans_handle *trans, | |||
4133 | btrfs_set_block_group_used(&cache->item, old_val); | 4140 | btrfs_set_block_group_used(&cache->item, old_val); |
4134 | cache->reserved -= num_bytes; | 4141 | cache->reserved -= num_bytes; |
4135 | cache->space_info->bytes_reserved -= num_bytes; | 4142 | cache->space_info->bytes_reserved -= num_bytes; |
4143 | cache->space_info->reservation_progress++; | ||
4136 | cache->space_info->bytes_used += num_bytes; | 4144 | cache->space_info->bytes_used += num_bytes; |
4137 | cache->space_info->disk_used += num_bytes * factor; | 4145 | cache->space_info->disk_used += num_bytes * factor; |
4138 | spin_unlock(&cache->lock); | 4146 | spin_unlock(&cache->lock); |
@@ -4184,6 +4192,7 @@ static int pin_down_extent(struct btrfs_root *root, | |||
4184 | if (reserved) { | 4192 | if (reserved) { |
4185 | cache->reserved -= num_bytes; | 4193 | cache->reserved -= num_bytes; |
4186 | cache->space_info->bytes_reserved -= num_bytes; | 4194 | cache->space_info->bytes_reserved -= num_bytes; |
4195 | cache->space_info->reservation_progress++; | ||
4187 | } | 4196 | } |
4188 | spin_unlock(&cache->lock); | 4197 | spin_unlock(&cache->lock); |
4189 | spin_unlock(&cache->space_info->lock); | 4198 | spin_unlock(&cache->space_info->lock); |
@@ -4234,6 +4243,7 @@ static int update_reserved_bytes(struct btrfs_block_group_cache *cache, | |||
4234 | space_info->bytes_readonly += num_bytes; | 4243 | space_info->bytes_readonly += num_bytes; |
4235 | cache->reserved -= num_bytes; | 4244 | cache->reserved -= num_bytes; |
4236 | space_info->bytes_reserved -= num_bytes; | 4245 | space_info->bytes_reserved -= num_bytes; |
4246 | space_info->reservation_progress++; | ||
4237 | } | 4247 | } |
4238 | spin_unlock(&cache->lock); | 4248 | spin_unlock(&cache->lock); |
4239 | spin_unlock(&space_info->lock); | 4249 | spin_unlock(&space_info->lock); |
@@ -4712,6 +4722,7 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans, | |||
4712 | if (ret) { | 4722 | if (ret) { |
4713 | spin_lock(&cache->space_info->lock); | 4723 | spin_lock(&cache->space_info->lock); |
4714 | cache->space_info->bytes_reserved -= buf->len; | 4724 | cache->space_info->bytes_reserved -= buf->len; |
4725 | cache->space_info->reservation_progress++; | ||
4715 | spin_unlock(&cache->space_info->lock); | 4726 | spin_unlock(&cache->space_info->lock); |
4716 | } | 4727 | } |
4717 | goto out; | 4728 | goto out; |
@@ -5376,7 +5387,7 @@ again: | |||
5376 | num_bytes, data, 1); | 5387 | num_bytes, data, 1); |
5377 | goto again; | 5388 | goto again; |
5378 | } | 5389 | } |
5379 | if (ret == -ENOSPC) { | 5390 | if (ret == -ENOSPC && btrfs_test_opt(root, ENOSPC_DEBUG)) { |
5380 | struct btrfs_space_info *sinfo; | 5391 | struct btrfs_space_info *sinfo; |
5381 | 5392 | ||
5382 | sinfo = __find_space_info(root->fs_info, data); | 5393 | sinfo = __find_space_info(root->fs_info, data); |
@@ -8065,6 +8076,13 @@ out: | |||
8065 | return ret; | 8076 | return ret; |
8066 | } | 8077 | } |
8067 | 8078 | ||
8079 | int btrfs_force_chunk_alloc(struct btrfs_trans_handle *trans, | ||
8080 | struct btrfs_root *root, u64 type) | ||
8081 | { | ||
8082 | u64 alloc_flags = get_alloc_profile(root, type); | ||
8083 | return do_chunk_alloc(trans, root, 2 * 1024 * 1024, alloc_flags, 1); | ||
8084 | } | ||
8085 | |||
8068 | /* | 8086 | /* |
8069 | * helper to account the unused space of all the readonly block group in the | 8087 | * helper to account the unused space of all the readonly block group in the |
8070 | * list. takes mirrors into account. | 8088 | * list. takes mirrors into account. |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 92ac5192c518..714adc4ac4c2 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -1433,12 +1433,13 @@ int extent_clear_unlock_delalloc(struct inode *inode, | |||
1433 | */ | 1433 | */ |
1434 | u64 count_range_bits(struct extent_io_tree *tree, | 1434 | u64 count_range_bits(struct extent_io_tree *tree, |
1435 | u64 *start, u64 search_end, u64 max_bytes, | 1435 | u64 *start, u64 search_end, u64 max_bytes, |
1436 | unsigned long bits) | 1436 | unsigned long bits, int contig) |
1437 | { | 1437 | { |
1438 | struct rb_node *node; | 1438 | struct rb_node *node; |
1439 | struct extent_state *state; | 1439 | struct extent_state *state; |
1440 | u64 cur_start = *start; | 1440 | u64 cur_start = *start; |
1441 | u64 total_bytes = 0; | 1441 | u64 total_bytes = 0; |
1442 | u64 last = 0; | ||
1442 | int found = 0; | 1443 | int found = 0; |
1443 | 1444 | ||
1444 | if (search_end <= cur_start) { | 1445 | if (search_end <= cur_start) { |
@@ -1463,7 +1464,9 @@ u64 count_range_bits(struct extent_io_tree *tree, | |||
1463 | state = rb_entry(node, struct extent_state, rb_node); | 1464 | state = rb_entry(node, struct extent_state, rb_node); |
1464 | if (state->start > search_end) | 1465 | if (state->start > search_end) |
1465 | break; | 1466 | break; |
1466 | if (state->end >= cur_start && (state->state & bits)) { | 1467 | if (contig && found && state->start > last + 1) |
1468 | break; | ||
1469 | if (state->end >= cur_start && (state->state & bits) == bits) { | ||
1467 | total_bytes += min(search_end, state->end) + 1 - | 1470 | total_bytes += min(search_end, state->end) + 1 - |
1468 | max(cur_start, state->start); | 1471 | max(cur_start, state->start); |
1469 | if (total_bytes >= max_bytes) | 1472 | if (total_bytes >= max_bytes) |
@@ -1472,6 +1475,9 @@ u64 count_range_bits(struct extent_io_tree *tree, | |||
1472 | *start = state->start; | 1475 | *start = state->start; |
1473 | found = 1; | 1476 | found = 1; |
1474 | } | 1477 | } |
1478 | last = state->end; | ||
1479 | } else if (contig && found) { | ||
1480 | break; | ||
1475 | } | 1481 | } |
1476 | node = rb_next(node); | 1482 | node = rb_next(node); |
1477 | if (!node) | 1483 | if (!node) |
@@ -2912,6 +2918,46 @@ out: | |||
2912 | return sector; | 2918 | return sector; |
2913 | } | 2919 | } |
2914 | 2920 | ||
2921 | /* | ||
2922 | * helper function for fiemap, which doesn't want to see any holes. | ||
2923 | * This maps until we find something past 'last' | ||
2924 | */ | ||
2925 | static struct extent_map *get_extent_skip_holes(struct inode *inode, | ||
2926 | u64 offset, | ||
2927 | u64 last, | ||
2928 | get_extent_t *get_extent) | ||
2929 | { | ||
2930 | u64 sectorsize = BTRFS_I(inode)->root->sectorsize; | ||
2931 | struct extent_map *em; | ||
2932 | u64 len; | ||
2933 | |||
2934 | if (offset >= last) | ||
2935 | return NULL; | ||
2936 | |||
2937 | while(1) { | ||
2938 | len = last - offset; | ||
2939 | if (len == 0) | ||
2940 | break; | ||
2941 | len = (len + sectorsize - 1) & ~(sectorsize - 1); | ||
2942 | em = get_extent(inode, NULL, 0, offset, len, 0); | ||
2943 | if (!em || IS_ERR(em)) | ||
2944 | return em; | ||
2945 | |||
2946 | /* if this isn't a hole return it */ | ||
2947 | if (!test_bit(EXTENT_FLAG_VACANCY, &em->flags) && | ||
2948 | em->block_start != EXTENT_MAP_HOLE) { | ||
2949 | return em; | ||
2950 | } | ||
2951 | |||
2952 | /* this is a hole, advance to the next extent */ | ||
2953 | offset = extent_map_end(em); | ||
2954 | free_extent_map(em); | ||
2955 | if (offset >= last) | ||
2956 | break; | ||
2957 | } | ||
2958 | return NULL; | ||
2959 | } | ||
2960 | |||
2915 | int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | 2961 | int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
2916 | __u64 start, __u64 len, get_extent_t *get_extent) | 2962 | __u64 start, __u64 len, get_extent_t *get_extent) |
2917 | { | 2963 | { |
@@ -2921,16 +2967,19 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
2921 | u32 flags = 0; | 2967 | u32 flags = 0; |
2922 | u32 found_type; | 2968 | u32 found_type; |
2923 | u64 last; | 2969 | u64 last; |
2970 | u64 last_for_get_extent = 0; | ||
2924 | u64 disko = 0; | 2971 | u64 disko = 0; |
2972 | u64 isize = i_size_read(inode); | ||
2925 | struct btrfs_key found_key; | 2973 | struct btrfs_key found_key; |
2926 | struct extent_map *em = NULL; | 2974 | struct extent_map *em = NULL; |
2927 | struct extent_state *cached_state = NULL; | 2975 | struct extent_state *cached_state = NULL; |
2928 | struct btrfs_path *path; | 2976 | struct btrfs_path *path; |
2929 | struct btrfs_file_extent_item *item; | 2977 | struct btrfs_file_extent_item *item; |
2930 | int end = 0; | 2978 | int end = 0; |
2931 | u64 em_start = 0, em_len = 0; | 2979 | u64 em_start = 0; |
2980 | u64 em_len = 0; | ||
2981 | u64 em_end = 0; | ||
2932 | unsigned long emflags; | 2982 | unsigned long emflags; |
2933 | int hole = 0; | ||
2934 | 2983 | ||
2935 | if (len == 0) | 2984 | if (len == 0) |
2936 | return -EINVAL; | 2985 | return -EINVAL; |
@@ -2940,6 +2989,10 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
2940 | return -ENOMEM; | 2989 | return -ENOMEM; |
2941 | path->leave_spinning = 1; | 2990 | path->leave_spinning = 1; |
2942 | 2991 | ||
2992 | /* | ||
2993 | * lookup the last file extent. We're not using i_size here | ||
2994 | * because there might be preallocation past i_size | ||
2995 | */ | ||
2943 | ret = btrfs_lookup_file_extent(NULL, BTRFS_I(inode)->root, | 2996 | ret = btrfs_lookup_file_extent(NULL, BTRFS_I(inode)->root, |
2944 | path, inode->i_ino, -1, 0); | 2997 | path, inode->i_ino, -1, 0); |
2945 | if (ret < 0) { | 2998 | if (ret < 0) { |
@@ -2953,18 +3006,38 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
2953 | btrfs_item_key_to_cpu(path->nodes[0], &found_key, path->slots[0]); | 3006 | btrfs_item_key_to_cpu(path->nodes[0], &found_key, path->slots[0]); |
2954 | found_type = btrfs_key_type(&found_key); | 3007 | found_type = btrfs_key_type(&found_key); |
2955 | 3008 | ||
2956 | /* No extents, just return */ | 3009 | /* No extents, but there might be delalloc bits */ |
2957 | if (found_key.objectid != inode->i_ino || | 3010 | if (found_key.objectid != inode->i_ino || |
2958 | found_type != BTRFS_EXTENT_DATA_KEY) { | 3011 | found_type != BTRFS_EXTENT_DATA_KEY) { |
2959 | btrfs_free_path(path); | 3012 | /* have to trust i_size as the end */ |
2960 | return 0; | 3013 | last = (u64)-1; |
3014 | last_for_get_extent = isize; | ||
3015 | } else { | ||
3016 | /* | ||
3017 | * remember the start of the last extent. There are a | ||
3018 | * bunch of different factors that go into the length of the | ||
3019 | * extent, so its much less complex to remember where it started | ||
3020 | */ | ||
3021 | last = found_key.offset; | ||
3022 | last_for_get_extent = last + 1; | ||
2961 | } | 3023 | } |
2962 | last = found_key.offset; | ||
2963 | btrfs_free_path(path); | 3024 | btrfs_free_path(path); |
2964 | 3025 | ||
3026 | /* | ||
3027 | * we might have some extents allocated but more delalloc past those | ||
3028 | * extents. so, we trust isize unless the start of the last extent is | ||
3029 | * beyond isize | ||
3030 | */ | ||
3031 | if (last < isize) { | ||
3032 | last = (u64)-1; | ||
3033 | last_for_get_extent = isize; | ||
3034 | } | ||
3035 | |||
2965 | lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0, | 3036 | lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0, |
2966 | &cached_state, GFP_NOFS); | 3037 | &cached_state, GFP_NOFS); |
2967 | em = get_extent(inode, NULL, 0, off, max - off, 0); | 3038 | |
3039 | em = get_extent_skip_holes(inode, off, last_for_get_extent, | ||
3040 | get_extent); | ||
2968 | if (!em) | 3041 | if (!em) |
2969 | goto out; | 3042 | goto out; |
2970 | if (IS_ERR(em)) { | 3043 | if (IS_ERR(em)) { |
@@ -2973,22 +3046,38 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
2973 | } | 3046 | } |
2974 | 3047 | ||
2975 | while (!end) { | 3048 | while (!end) { |
2976 | hole = 0; | 3049 | u64 offset_in_extent; |
2977 | off = em->start + em->len; | ||
2978 | if (off >= max) | ||
2979 | end = 1; | ||
2980 | 3050 | ||
2981 | if (em->block_start == EXTENT_MAP_HOLE) { | 3051 | /* break if the extent we found is outside the range */ |
2982 | hole = 1; | 3052 | if (em->start >= max || extent_map_end(em) < off) |
2983 | goto next; | 3053 | break; |
2984 | } | ||
2985 | 3054 | ||
2986 | em_start = em->start; | 3055 | /* |
2987 | em_len = em->len; | 3056 | * get_extent may return an extent that starts before our |
3057 | * requested range. We have to make sure the ranges | ||
3058 | * we return to fiemap always move forward and don't | ||
3059 | * overlap, so adjust the offsets here | ||
3060 | */ | ||
3061 | em_start = max(em->start, off); | ||
2988 | 3062 | ||
3063 | /* | ||
3064 | * record the offset from the start of the extent | ||
3065 | * for adjusting the disk offset below | ||
3066 | */ | ||
3067 | offset_in_extent = em_start - em->start; | ||
3068 | em_end = extent_map_end(em); | ||
3069 | em_len = em_end - em_start; | ||
3070 | emflags = em->flags; | ||
2989 | disko = 0; | 3071 | disko = 0; |
2990 | flags = 0; | 3072 | flags = 0; |
2991 | 3073 | ||
3074 | /* | ||
3075 | * bump off for our next call to get_extent | ||
3076 | */ | ||
3077 | off = extent_map_end(em); | ||
3078 | if (off >= max) | ||
3079 | end = 1; | ||
3080 | |||
2992 | if (em->block_start == EXTENT_MAP_LAST_BYTE) { | 3081 | if (em->block_start == EXTENT_MAP_LAST_BYTE) { |
2993 | end = 1; | 3082 | end = 1; |
2994 | flags |= FIEMAP_EXTENT_LAST; | 3083 | flags |= FIEMAP_EXTENT_LAST; |
@@ -2999,42 +3088,34 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
2999 | flags |= (FIEMAP_EXTENT_DELALLOC | | 3088 | flags |= (FIEMAP_EXTENT_DELALLOC | |
3000 | FIEMAP_EXTENT_UNKNOWN); | 3089 | FIEMAP_EXTENT_UNKNOWN); |
3001 | } else { | 3090 | } else { |
3002 | disko = em->block_start; | 3091 | disko = em->block_start + offset_in_extent; |
3003 | } | 3092 | } |
3004 | if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) | 3093 | if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags)) |
3005 | flags |= FIEMAP_EXTENT_ENCODED; | 3094 | flags |= FIEMAP_EXTENT_ENCODED; |
3006 | 3095 | ||
3007 | next: | ||
3008 | emflags = em->flags; | ||
3009 | free_extent_map(em); | 3096 | free_extent_map(em); |
3010 | em = NULL; | 3097 | em = NULL; |
3011 | if (!end) { | 3098 | if ((em_start >= last) || em_len == (u64)-1 || |
3012 | em = get_extent(inode, NULL, 0, off, max - off, 0); | 3099 | (last == (u64)-1 && isize <= em_end)) { |
3013 | if (!em) | ||
3014 | goto out; | ||
3015 | if (IS_ERR(em)) { | ||
3016 | ret = PTR_ERR(em); | ||
3017 | goto out; | ||
3018 | } | ||
3019 | emflags = em->flags; | ||
3020 | } | ||
3021 | |||
3022 | if (test_bit(EXTENT_FLAG_VACANCY, &emflags)) { | ||
3023 | flags |= FIEMAP_EXTENT_LAST; | 3100 | flags |= FIEMAP_EXTENT_LAST; |
3024 | end = 1; | 3101 | end = 1; |
3025 | } | 3102 | } |
3026 | 3103 | ||
3027 | if (em_start == last) { | 3104 | /* now scan forward to see if this is really the last extent. */ |
3105 | em = get_extent_skip_holes(inode, off, last_for_get_extent, | ||
3106 | get_extent); | ||
3107 | if (IS_ERR(em)) { | ||
3108 | ret = PTR_ERR(em); | ||
3109 | goto out; | ||
3110 | } | ||
3111 | if (!em) { | ||
3028 | flags |= FIEMAP_EXTENT_LAST; | 3112 | flags |= FIEMAP_EXTENT_LAST; |
3029 | end = 1; | 3113 | end = 1; |
3030 | } | 3114 | } |
3031 | 3115 | ret = fiemap_fill_next_extent(fieinfo, em_start, disko, | |
3032 | if (!hole) { | 3116 | em_len, flags); |
3033 | ret = fiemap_fill_next_extent(fieinfo, em_start, disko, | 3117 | if (ret) |
3034 | em_len, flags); | 3118 | goto out_free; |
3035 | if (ret) | ||
3036 | goto out_free; | ||
3037 | } | ||
3038 | } | 3119 | } |
3039 | out_free: | 3120 | out_free: |
3040 | free_extent_map(em); | 3121 | free_extent_map(em); |
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h index 7083cfafd061..9318dfefd59c 100644 --- a/fs/btrfs/extent_io.h +++ b/fs/btrfs/extent_io.h | |||
@@ -191,7 +191,7 @@ void extent_io_exit(void); | |||
191 | 191 | ||
192 | u64 count_range_bits(struct extent_io_tree *tree, | 192 | u64 count_range_bits(struct extent_io_tree *tree, |
193 | u64 *start, u64 search_end, | 193 | u64 *start, u64 search_end, |
194 | u64 max_bytes, unsigned long bits); | 194 | u64 max_bytes, unsigned long bits, int contig); |
195 | 195 | ||
196 | void free_extent_state(struct extent_state *state); | 196 | void free_extent_state(struct extent_state *state); |
197 | int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, | 197 | int test_range_bit(struct extent_io_tree *tree, u64 start, u64 end, |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 7084140d5940..f447b783bb84 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -70,6 +70,19 @@ static noinline int btrfs_copy_from_user(loff_t pos, int num_pages, | |||
70 | 70 | ||
71 | /* Flush processor's dcache for this page */ | 71 | /* Flush processor's dcache for this page */ |
72 | flush_dcache_page(page); | 72 | flush_dcache_page(page); |
73 | |||
74 | /* | ||
75 | * if we get a partial write, we can end up with | ||
76 | * partially up to date pages. These add | ||
77 | * a lot of complexity, so make sure they don't | ||
78 | * happen by forcing this copy to be retried. | ||
79 | * | ||
80 | * The rest of the btrfs_file_write code will fall | ||
81 | * back to page at a time copies after we return 0. | ||
82 | */ | ||
83 | if (!PageUptodate(page) && copied < count) | ||
84 | copied = 0; | ||
85 | |||
73 | iov_iter_advance(i, copied); | 86 | iov_iter_advance(i, copied); |
74 | write_bytes -= copied; | 87 | write_bytes -= copied; |
75 | total_copied += copied; | 88 | total_copied += copied; |
@@ -763,6 +776,27 @@ out: | |||
763 | } | 776 | } |
764 | 777 | ||
765 | /* | 778 | /* |
779 | * on error we return an unlocked page and the error value | ||
780 | * on success we return a locked page and 0 | ||
781 | */ | ||
782 | static int prepare_uptodate_page(struct page *page, u64 pos) | ||
783 | { | ||
784 | int ret = 0; | ||
785 | |||
786 | if ((pos & (PAGE_CACHE_SIZE - 1)) && !PageUptodate(page)) { | ||
787 | ret = btrfs_readpage(NULL, page); | ||
788 | if (ret) | ||
789 | return ret; | ||
790 | lock_page(page); | ||
791 | if (!PageUptodate(page)) { | ||
792 | unlock_page(page); | ||
793 | return -EIO; | ||
794 | } | ||
795 | } | ||
796 | return 0; | ||
797 | } | ||
798 | |||
799 | /* | ||
766 | * this gets pages into the page cache and locks them down, it also properly | 800 | * this gets pages into the page cache and locks them down, it also properly |
767 | * waits for data=ordered extents to finish before allowing the pages to be | 801 | * waits for data=ordered extents to finish before allowing the pages to be |
768 | * modified. | 802 | * modified. |
@@ -777,6 +811,7 @@ static noinline int prepare_pages(struct btrfs_root *root, struct file *file, | |||
777 | unsigned long index = pos >> PAGE_CACHE_SHIFT; | 811 | unsigned long index = pos >> PAGE_CACHE_SHIFT; |
778 | struct inode *inode = fdentry(file)->d_inode; | 812 | struct inode *inode = fdentry(file)->d_inode; |
779 | int err = 0; | 813 | int err = 0; |
814 | int faili = 0; | ||
780 | u64 start_pos; | 815 | u64 start_pos; |
781 | u64 last_pos; | 816 | u64 last_pos; |
782 | 817 | ||
@@ -794,15 +829,24 @@ again: | |||
794 | for (i = 0; i < num_pages; i++) { | 829 | for (i = 0; i < num_pages; i++) { |
795 | pages[i] = grab_cache_page(inode->i_mapping, index + i); | 830 | pages[i] = grab_cache_page(inode->i_mapping, index + i); |
796 | if (!pages[i]) { | 831 | if (!pages[i]) { |
797 | int c; | 832 | faili = i - 1; |
798 | for (c = i - 1; c >= 0; c--) { | 833 | err = -ENOMEM; |
799 | unlock_page(pages[c]); | 834 | goto fail; |
800 | page_cache_release(pages[c]); | 835 | } |
801 | } | 836 | |
802 | return -ENOMEM; | 837 | if (i == 0) |
838 | err = prepare_uptodate_page(pages[i], pos); | ||
839 | if (i == num_pages - 1) | ||
840 | err = prepare_uptodate_page(pages[i], | ||
841 | pos + write_bytes); | ||
842 | if (err) { | ||
843 | page_cache_release(pages[i]); | ||
844 | faili = i - 1; | ||
845 | goto fail; | ||
803 | } | 846 | } |
804 | wait_on_page_writeback(pages[i]); | 847 | wait_on_page_writeback(pages[i]); |
805 | } | 848 | } |
849 | err = 0; | ||
806 | if (start_pos < inode->i_size) { | 850 | if (start_pos < inode->i_size) { |
807 | struct btrfs_ordered_extent *ordered; | 851 | struct btrfs_ordered_extent *ordered; |
808 | lock_extent_bits(&BTRFS_I(inode)->io_tree, | 852 | lock_extent_bits(&BTRFS_I(inode)->io_tree, |
@@ -842,6 +886,14 @@ again: | |||
842 | WARN_ON(!PageLocked(pages[i])); | 886 | WARN_ON(!PageLocked(pages[i])); |
843 | } | 887 | } |
844 | return 0; | 888 | return 0; |
889 | fail: | ||
890 | while (faili >= 0) { | ||
891 | unlock_page(pages[faili]); | ||
892 | page_cache_release(pages[faili]); | ||
893 | faili--; | ||
894 | } | ||
895 | return err; | ||
896 | |||
845 | } | 897 | } |
846 | 898 | ||
847 | static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | 899 | static ssize_t btrfs_file_aio_write(struct kiocb *iocb, |
@@ -851,7 +903,6 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
851 | struct file *file = iocb->ki_filp; | 903 | struct file *file = iocb->ki_filp; |
852 | struct inode *inode = fdentry(file)->d_inode; | 904 | struct inode *inode = fdentry(file)->d_inode; |
853 | struct btrfs_root *root = BTRFS_I(inode)->root; | 905 | struct btrfs_root *root = BTRFS_I(inode)->root; |
854 | struct page *pinned[2]; | ||
855 | struct page **pages = NULL; | 906 | struct page **pages = NULL; |
856 | struct iov_iter i; | 907 | struct iov_iter i; |
857 | loff_t *ppos = &iocb->ki_pos; | 908 | loff_t *ppos = &iocb->ki_pos; |
@@ -872,9 +923,6 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
872 | will_write = ((file->f_flags & O_DSYNC) || IS_SYNC(inode) || | 923 | will_write = ((file->f_flags & O_DSYNC) || IS_SYNC(inode) || |
873 | (file->f_flags & O_DIRECT)); | 924 | (file->f_flags & O_DIRECT)); |
874 | 925 | ||
875 | pinned[0] = NULL; | ||
876 | pinned[1] = NULL; | ||
877 | |||
878 | start_pos = pos; | 926 | start_pos = pos; |
879 | 927 | ||
880 | vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE); | 928 | vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE); |
@@ -962,32 +1010,6 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
962 | first_index = pos >> PAGE_CACHE_SHIFT; | 1010 | first_index = pos >> PAGE_CACHE_SHIFT; |
963 | last_index = (pos + iov_iter_count(&i)) >> PAGE_CACHE_SHIFT; | 1011 | last_index = (pos + iov_iter_count(&i)) >> PAGE_CACHE_SHIFT; |
964 | 1012 | ||
965 | /* | ||
966 | * there are lots of better ways to do this, but this code | ||
967 | * makes sure the first and last page in the file range are | ||
968 | * up to date and ready for cow | ||
969 | */ | ||
970 | if ((pos & (PAGE_CACHE_SIZE - 1))) { | ||
971 | pinned[0] = grab_cache_page(inode->i_mapping, first_index); | ||
972 | if (!PageUptodate(pinned[0])) { | ||
973 | ret = btrfs_readpage(NULL, pinned[0]); | ||
974 | BUG_ON(ret); | ||
975 | wait_on_page_locked(pinned[0]); | ||
976 | } else { | ||
977 | unlock_page(pinned[0]); | ||
978 | } | ||
979 | } | ||
980 | if ((pos + iov_iter_count(&i)) & (PAGE_CACHE_SIZE - 1)) { | ||
981 | pinned[1] = grab_cache_page(inode->i_mapping, last_index); | ||
982 | if (!PageUptodate(pinned[1])) { | ||
983 | ret = btrfs_readpage(NULL, pinned[1]); | ||
984 | BUG_ON(ret); | ||
985 | wait_on_page_locked(pinned[1]); | ||
986 | } else { | ||
987 | unlock_page(pinned[1]); | ||
988 | } | ||
989 | } | ||
990 | |||
991 | while (iov_iter_count(&i) > 0) { | 1013 | while (iov_iter_count(&i) > 0) { |
992 | size_t offset = pos & (PAGE_CACHE_SIZE - 1); | 1014 | size_t offset = pos & (PAGE_CACHE_SIZE - 1); |
993 | size_t write_bytes = min(iov_iter_count(&i), | 1015 | size_t write_bytes = min(iov_iter_count(&i), |
@@ -1024,8 +1046,20 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
1024 | 1046 | ||
1025 | copied = btrfs_copy_from_user(pos, num_pages, | 1047 | copied = btrfs_copy_from_user(pos, num_pages, |
1026 | write_bytes, pages, &i); | 1048 | write_bytes, pages, &i); |
1027 | dirty_pages = (copied + offset + PAGE_CACHE_SIZE - 1) >> | 1049 | |
1028 | PAGE_CACHE_SHIFT; | 1050 | /* |
1051 | * if we have trouble faulting in the pages, fall | ||
1052 | * back to one page at a time | ||
1053 | */ | ||
1054 | if (copied < write_bytes) | ||
1055 | nrptrs = 1; | ||
1056 | |||
1057 | if (copied == 0) | ||
1058 | dirty_pages = 0; | ||
1059 | else | ||
1060 | dirty_pages = (copied + offset + | ||
1061 | PAGE_CACHE_SIZE - 1) >> | ||
1062 | PAGE_CACHE_SHIFT; | ||
1029 | 1063 | ||
1030 | if (num_pages > dirty_pages) { | 1064 | if (num_pages > dirty_pages) { |
1031 | if (copied > 0) | 1065 | if (copied > 0) |
@@ -1069,10 +1103,6 @@ out: | |||
1069 | err = ret; | 1103 | err = ret; |
1070 | 1104 | ||
1071 | kfree(pages); | 1105 | kfree(pages); |
1072 | if (pinned[0]) | ||
1073 | page_cache_release(pinned[0]); | ||
1074 | if (pinned[1]) | ||
1075 | page_cache_release(pinned[1]); | ||
1076 | *ppos = pos; | 1106 | *ppos = pos; |
1077 | 1107 | ||
1078 | /* | 1108 | /* |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index fb9bd7832b6d..4a0107e18747 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -1913,7 +1913,7 @@ static int btrfs_clean_io_failures(struct inode *inode, u64 start) | |||
1913 | 1913 | ||
1914 | private = 0; | 1914 | private = 0; |
1915 | if (count_range_bits(&BTRFS_I(inode)->io_failure_tree, &private, | 1915 | if (count_range_bits(&BTRFS_I(inode)->io_failure_tree, &private, |
1916 | (u64)-1, 1, EXTENT_DIRTY)) { | 1916 | (u64)-1, 1, EXTENT_DIRTY, 0)) { |
1917 | ret = get_state_private(&BTRFS_I(inode)->io_failure_tree, | 1917 | ret = get_state_private(&BTRFS_I(inode)->io_failure_tree, |
1918 | start, &private_failure); | 1918 | start, &private_failure); |
1919 | if (ret == 0) { | 1919 | if (ret == 0) { |
@@ -4806,9 +4806,6 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | |||
4806 | int err; | 4806 | int err; |
4807 | int drop_inode = 0; | 4807 | int drop_inode = 0; |
4808 | 4808 | ||
4809 | if (inode->i_nlink == 0) | ||
4810 | return -ENOENT; | ||
4811 | |||
4812 | /* do not allow sys_link's with other subvols of the same device */ | 4809 | /* do not allow sys_link's with other subvols of the same device */ |
4813 | if (root->objectid != BTRFS_I(inode)->root->objectid) | 4810 | if (root->objectid != BTRFS_I(inode)->root->objectid) |
4814 | return -EPERM; | 4811 | return -EPERM; |
@@ -4821,10 +4818,11 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir, | |||
4821 | goto fail; | 4818 | goto fail; |
4822 | 4819 | ||
4823 | /* | 4820 | /* |
4824 | * 1 item for inode ref | 4821 | * 2 items for inode and inode ref |
4825 | * 2 items for dir items | 4822 | * 2 items for dir items |
4823 | * 1 item for parent inode | ||
4826 | */ | 4824 | */ |
4827 | trans = btrfs_start_transaction(root, 3); | 4825 | trans = btrfs_start_transaction(root, 5); |
4828 | if (IS_ERR(trans)) { | 4826 | if (IS_ERR(trans)) { |
4829 | err = PTR_ERR(trans); | 4827 | err = PTR_ERR(trans); |
4830 | goto fail; | 4828 | goto fail; |
@@ -5280,6 +5278,128 @@ out: | |||
5280 | return em; | 5278 | return em; |
5281 | } | 5279 | } |
5282 | 5280 | ||
5281 | struct extent_map *btrfs_get_extent_fiemap(struct inode *inode, struct page *page, | ||
5282 | size_t pg_offset, u64 start, u64 len, | ||
5283 | int create) | ||
5284 | { | ||
5285 | struct extent_map *em; | ||
5286 | struct extent_map *hole_em = NULL; | ||
5287 | u64 range_start = start; | ||
5288 | u64 end; | ||
5289 | u64 found; | ||
5290 | u64 found_end; | ||
5291 | int err = 0; | ||
5292 | |||
5293 | em = btrfs_get_extent(inode, page, pg_offset, start, len, create); | ||
5294 | if (IS_ERR(em)) | ||
5295 | return em; | ||
5296 | if (em) { | ||
5297 | /* | ||
5298 | * if our em maps to a hole, there might | ||
5299 | * actually be delalloc bytes behind it | ||
5300 | */ | ||
5301 | if (em->block_start != EXTENT_MAP_HOLE) | ||
5302 | return em; | ||
5303 | else | ||
5304 | hole_em = em; | ||
5305 | } | ||
5306 | |||
5307 | /* check to see if we've wrapped (len == -1 or similar) */ | ||
5308 | end = start + len; | ||
5309 | if (end < start) | ||
5310 | end = (u64)-1; | ||
5311 | else | ||
5312 | end -= 1; | ||
5313 | |||
5314 | em = NULL; | ||
5315 | |||
5316 | /* ok, we didn't find anything, lets look for delalloc */ | ||
5317 | found = count_range_bits(&BTRFS_I(inode)->io_tree, &range_start, | ||
5318 | end, len, EXTENT_DELALLOC, 1); | ||
5319 | found_end = range_start + found; | ||
5320 | if (found_end < range_start) | ||
5321 | found_end = (u64)-1; | ||
5322 | |||
5323 | /* | ||
5324 | * we didn't find anything useful, return | ||
5325 | * the original results from get_extent() | ||
5326 | */ | ||
5327 | if (range_start > end || found_end <= start) { | ||
5328 | em = hole_em; | ||
5329 | hole_em = NULL; | ||
5330 | goto out; | ||
5331 | } | ||
5332 | |||
5333 | /* adjust the range_start to make sure it doesn't | ||
5334 | * go backwards from the start they passed in | ||
5335 | */ | ||
5336 | range_start = max(start,range_start); | ||
5337 | found = found_end - range_start; | ||
5338 | |||
5339 | if (found > 0) { | ||
5340 | u64 hole_start = start; | ||
5341 | u64 hole_len = len; | ||
5342 | |||
5343 | em = alloc_extent_map(GFP_NOFS); | ||
5344 | if (!em) { | ||
5345 | err = -ENOMEM; | ||
5346 | goto out; | ||
5347 | } | ||
5348 | /* | ||
5349 | * when btrfs_get_extent can't find anything it | ||
5350 | * returns one huge hole | ||
5351 | * | ||
5352 | * make sure what it found really fits our range, and | ||
5353 | * adjust to make sure it is based on the start from | ||
5354 | * the caller | ||
5355 | */ | ||
5356 | if (hole_em) { | ||
5357 | u64 calc_end = extent_map_end(hole_em); | ||
5358 | |||
5359 | if (calc_end <= start || (hole_em->start > end)) { | ||
5360 | free_extent_map(hole_em); | ||
5361 | hole_em = NULL; | ||
5362 | } else { | ||
5363 | hole_start = max(hole_em->start, start); | ||
5364 | hole_len = calc_end - hole_start; | ||
5365 | } | ||
5366 | } | ||
5367 | em->bdev = NULL; | ||
5368 | if (hole_em && range_start > hole_start) { | ||
5369 | /* our hole starts before our delalloc, so we | ||
5370 | * have to return just the parts of the hole | ||
5371 | * that go until the delalloc starts | ||
5372 | */ | ||
5373 | em->len = min(hole_len, | ||
5374 | range_start - hole_start); | ||
5375 | em->start = hole_start; | ||
5376 | em->orig_start = hole_start; | ||
5377 | /* | ||
5378 | * don't adjust block start at all, | ||
5379 | * it is fixed at EXTENT_MAP_HOLE | ||
5380 | */ | ||
5381 | em->block_start = hole_em->block_start; | ||
5382 | em->block_len = hole_len; | ||
5383 | } else { | ||
5384 | em->start = range_start; | ||
5385 | em->len = found; | ||
5386 | em->orig_start = range_start; | ||
5387 | em->block_start = EXTENT_MAP_DELALLOC; | ||
5388 | em->block_len = found; | ||
5389 | } | ||
5390 | } else if (hole_em) { | ||
5391 | return hole_em; | ||
5392 | } | ||
5393 | out: | ||
5394 | |||
5395 | free_extent_map(hole_em); | ||
5396 | if (err) { | ||
5397 | free_extent_map(em); | ||
5398 | return ERR_PTR(err); | ||
5399 | } | ||
5400 | return em; | ||
5401 | } | ||
5402 | |||
5283 | static struct extent_map *btrfs_new_extent_direct(struct inode *inode, | 5403 | static struct extent_map *btrfs_new_extent_direct(struct inode *inode, |
5284 | u64 start, u64 len) | 5404 | u64 start, u64 len) |
5285 | { | 5405 | { |
@@ -5934,6 +6054,7 @@ static void btrfs_submit_direct(int rw, struct bio *bio, struct inode *inode, | |||
5934 | if (!skip_sum) { | 6054 | if (!skip_sum) { |
5935 | dip->csums = kmalloc(sizeof(u32) * bio->bi_vcnt, GFP_NOFS); | 6055 | dip->csums = kmalloc(sizeof(u32) * bio->bi_vcnt, GFP_NOFS); |
5936 | if (!dip->csums) { | 6056 | if (!dip->csums) { |
6057 | kfree(dip); | ||
5937 | ret = -ENOMEM; | 6058 | ret = -ENOMEM; |
5938 | goto free_ordered; | 6059 | goto free_ordered; |
5939 | } | 6060 | } |
@@ -6102,7 +6223,7 @@ out: | |||
6102 | static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | 6223 | static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, |
6103 | __u64 start, __u64 len) | 6224 | __u64 start, __u64 len) |
6104 | { | 6225 | { |
6105 | return extent_fiemap(inode, fieinfo, start, len, btrfs_get_extent); | 6226 | return extent_fiemap(inode, fieinfo, start, len, btrfs_get_extent_fiemap); |
6106 | } | 6227 | } |
6107 | 6228 | ||
6108 | int btrfs_readpage(struct file *file, struct page *page) | 6229 | int btrfs_readpage(struct file *file, struct page *page) |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index be2d4f6aaa5e..5fdb2abc4fa7 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -1071,12 +1071,15 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file, | |||
1071 | if (copy_from_user(&flags, arg, sizeof(flags))) | 1071 | if (copy_from_user(&flags, arg, sizeof(flags))) |
1072 | return -EFAULT; | 1072 | return -EFAULT; |
1073 | 1073 | ||
1074 | if (flags & ~BTRFS_SUBVOL_CREATE_ASYNC) | 1074 | if (flags & BTRFS_SUBVOL_CREATE_ASYNC) |
1075 | return -EINVAL; | 1075 | return -EINVAL; |
1076 | 1076 | ||
1077 | if (flags & ~BTRFS_SUBVOL_RDONLY) | 1077 | if (flags & ~BTRFS_SUBVOL_RDONLY) |
1078 | return -EOPNOTSUPP; | 1078 | return -EOPNOTSUPP; |
1079 | 1079 | ||
1080 | if (!is_owner_or_cap(inode)) | ||
1081 | return -EACCES; | ||
1082 | |||
1080 | down_write(&root->fs_info->subvol_sem); | 1083 | down_write(&root->fs_info->subvol_sem); |
1081 | 1084 | ||
1082 | /* nothing to do */ | 1085 | /* nothing to do */ |
@@ -1097,7 +1100,7 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file, | |||
1097 | goto out_reset; | 1100 | goto out_reset; |
1098 | } | 1101 | } |
1099 | 1102 | ||
1100 | ret = btrfs_update_root(trans, root, | 1103 | ret = btrfs_update_root(trans, root->fs_info->tree_root, |
1101 | &root->root_key, &root->root_item); | 1104 | &root->root_key, &root->root_item); |
1102 | 1105 | ||
1103 | btrfs_commit_transaction(trans, root); | 1106 | btrfs_commit_transaction(trans, root); |
diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c index cc9b450399df..a178f5ebea78 100644 --- a/fs/btrfs/lzo.c +++ b/fs/btrfs/lzo.c | |||
@@ -280,6 +280,7 @@ static int lzo_decompress_biovec(struct list_head *ws, | |||
280 | unsigned long tot_out; | 280 | unsigned long tot_out; |
281 | unsigned long tot_len; | 281 | unsigned long tot_len; |
282 | char *buf; | 282 | char *buf; |
283 | bool may_late_unmap, need_unmap; | ||
283 | 284 | ||
284 | data_in = kmap(pages_in[0]); | 285 | data_in = kmap(pages_in[0]); |
285 | tot_len = read_compress_length(data_in); | 286 | tot_len = read_compress_length(data_in); |
@@ -300,11 +301,13 @@ static int lzo_decompress_biovec(struct list_head *ws, | |||
300 | 301 | ||
301 | tot_in += in_len; | 302 | tot_in += in_len; |
302 | working_bytes = in_len; | 303 | working_bytes = in_len; |
304 | may_late_unmap = need_unmap = false; | ||
303 | 305 | ||
304 | /* fast path: avoid using the working buffer */ | 306 | /* fast path: avoid using the working buffer */ |
305 | if (in_page_bytes_left >= in_len) { | 307 | if (in_page_bytes_left >= in_len) { |
306 | buf = data_in + in_offset; | 308 | buf = data_in + in_offset; |
307 | bytes = in_len; | 309 | bytes = in_len; |
310 | may_late_unmap = true; | ||
308 | goto cont; | 311 | goto cont; |
309 | } | 312 | } |
310 | 313 | ||
@@ -329,14 +332,17 @@ cont: | |||
329 | if (working_bytes == 0 && tot_in >= tot_len) | 332 | if (working_bytes == 0 && tot_in >= tot_len) |
330 | break; | 333 | break; |
331 | 334 | ||
332 | kunmap(pages_in[page_in_index]); | 335 | if (page_in_index + 1 >= total_pages_in) { |
333 | page_in_index++; | ||
334 | if (page_in_index >= total_pages_in) { | ||
335 | ret = -1; | 336 | ret = -1; |
336 | data_in = NULL; | ||
337 | goto done; | 337 | goto done; |
338 | } | 338 | } |
339 | data_in = kmap(pages_in[page_in_index]); | 339 | |
340 | if (may_late_unmap) | ||
341 | need_unmap = true; | ||
342 | else | ||
343 | kunmap(pages_in[page_in_index]); | ||
344 | |||
345 | data_in = kmap(pages_in[++page_in_index]); | ||
340 | 346 | ||
341 | in_page_bytes_left = PAGE_CACHE_SIZE; | 347 | in_page_bytes_left = PAGE_CACHE_SIZE; |
342 | in_offset = 0; | 348 | in_offset = 0; |
@@ -346,6 +352,8 @@ cont: | |||
346 | out_len = lzo1x_worst_compress(PAGE_CACHE_SIZE); | 352 | out_len = lzo1x_worst_compress(PAGE_CACHE_SIZE); |
347 | ret = lzo1x_decompress_safe(buf, in_len, workspace->buf, | 353 | ret = lzo1x_decompress_safe(buf, in_len, workspace->buf, |
348 | &out_len); | 354 | &out_len); |
355 | if (need_unmap) | ||
356 | kunmap(pages_in[page_in_index - 1]); | ||
349 | if (ret != LZO_E_OK) { | 357 | if (ret != LZO_E_OK) { |
350 | printk(KERN_WARNING "btrfs decompress failed\n"); | 358 | printk(KERN_WARNING "btrfs decompress failed\n"); |
351 | ret = -1; | 359 | ret = -1; |
@@ -363,8 +371,7 @@ cont: | |||
363 | break; | 371 | break; |
364 | } | 372 | } |
365 | done: | 373 | done: |
366 | if (data_in) | 374 | kunmap(pages_in[page_in_index]); |
367 | kunmap(pages_in[page_in_index]); | ||
368 | return ret; | 375 | return ret; |
369 | } | 376 | } |
370 | 377 | ||
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 0825e4ed9447..31ade5802ae8 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c | |||
@@ -3654,6 +3654,7 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
3654 | u32 item_size; | 3654 | u32 item_size; |
3655 | int ret; | 3655 | int ret; |
3656 | int err = 0; | 3656 | int err = 0; |
3657 | int progress = 0; | ||
3657 | 3658 | ||
3658 | path = btrfs_alloc_path(); | 3659 | path = btrfs_alloc_path(); |
3659 | if (!path) | 3660 | if (!path) |
@@ -3666,9 +3667,10 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
3666 | } | 3667 | } |
3667 | 3668 | ||
3668 | while (1) { | 3669 | while (1) { |
3670 | progress++; | ||
3669 | trans = btrfs_start_transaction(rc->extent_root, 0); | 3671 | trans = btrfs_start_transaction(rc->extent_root, 0); |
3670 | BUG_ON(IS_ERR(trans)); | 3672 | BUG_ON(IS_ERR(trans)); |
3671 | 3673 | restart: | |
3672 | if (update_backref_cache(trans, &rc->backref_cache)) { | 3674 | if (update_backref_cache(trans, &rc->backref_cache)) { |
3673 | btrfs_end_transaction(trans, rc->extent_root); | 3675 | btrfs_end_transaction(trans, rc->extent_root); |
3674 | continue; | 3676 | continue; |
@@ -3781,6 +3783,15 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) | |||
3781 | } | 3783 | } |
3782 | } | 3784 | } |
3783 | } | 3785 | } |
3786 | if (trans && progress && err == -ENOSPC) { | ||
3787 | ret = btrfs_force_chunk_alloc(trans, rc->extent_root, | ||
3788 | rc->block_group->flags); | ||
3789 | if (ret == 0) { | ||
3790 | err = 0; | ||
3791 | progress = 0; | ||
3792 | goto restart; | ||
3793 | } | ||
3794 | } | ||
3784 | 3795 | ||
3785 | btrfs_release_path(rc->extent_root, path); | 3796 | btrfs_release_path(rc->extent_root, path); |
3786 | clear_extent_bits(&rc->processed_blocks, 0, (u64)-1, EXTENT_DIRTY, | 3797 | clear_extent_bits(&rc->processed_blocks, 0, (u64)-1, EXTENT_DIRTY, |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index a004008f7d28..d39a9895d932 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -155,7 +155,8 @@ enum { | |||
155 | Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress, | 155 | Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress, |
156 | Opt_compress_type, Opt_compress_force, Opt_compress_force_type, | 156 | Opt_compress_type, Opt_compress_force, Opt_compress_force_type, |
157 | Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard, | 157 | Opt_notreelog, Opt_ratio, Opt_flushoncommit, Opt_discard, |
158 | Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, Opt_err, | 158 | Opt_space_cache, Opt_clear_cache, Opt_user_subvol_rm_allowed, |
159 | Opt_enospc_debug, Opt_err, | ||
159 | }; | 160 | }; |
160 | 161 | ||
161 | static match_table_t tokens = { | 162 | static match_table_t tokens = { |
@@ -184,6 +185,7 @@ static match_table_t tokens = { | |||
184 | {Opt_space_cache, "space_cache"}, | 185 | {Opt_space_cache, "space_cache"}, |
185 | {Opt_clear_cache, "clear_cache"}, | 186 | {Opt_clear_cache, "clear_cache"}, |
186 | {Opt_user_subvol_rm_allowed, "user_subvol_rm_allowed"}, | 187 | {Opt_user_subvol_rm_allowed, "user_subvol_rm_allowed"}, |
188 | {Opt_enospc_debug, "enospc_debug"}, | ||
187 | {Opt_err, NULL}, | 189 | {Opt_err, NULL}, |
188 | }; | 190 | }; |
189 | 191 | ||
@@ -358,6 +360,9 @@ int btrfs_parse_options(struct btrfs_root *root, char *options) | |||
358 | case Opt_user_subvol_rm_allowed: | 360 | case Opt_user_subvol_rm_allowed: |
359 | btrfs_set_opt(info->mount_opt, USER_SUBVOL_RM_ALLOWED); | 361 | btrfs_set_opt(info->mount_opt, USER_SUBVOL_RM_ALLOWED); |
360 | break; | 362 | break; |
363 | case Opt_enospc_debug: | ||
364 | btrfs_set_opt(info->mount_opt, ENOSPC_DEBUG); | ||
365 | break; | ||
361 | case Opt_err: | 366 | case Opt_err: |
362 | printk(KERN_INFO "btrfs: unrecognized mount option " | 367 | printk(KERN_INFO "btrfs: unrecognized mount option " |
363 | "'%s'\n", p); | 368 | "'%s'\n", p); |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index af7dbca15276..dd13eb81ee40 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1338,11 +1338,11 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path) | |||
1338 | 1338 | ||
1339 | ret = btrfs_shrink_device(device, 0); | 1339 | ret = btrfs_shrink_device(device, 0); |
1340 | if (ret) | 1340 | if (ret) |
1341 | goto error_brelse; | 1341 | goto error_undo; |
1342 | 1342 | ||
1343 | ret = btrfs_rm_dev_item(root->fs_info->chunk_root, device); | 1343 | ret = btrfs_rm_dev_item(root->fs_info->chunk_root, device); |
1344 | if (ret) | 1344 | if (ret) |
1345 | goto error_brelse; | 1345 | goto error_undo; |
1346 | 1346 | ||
1347 | device->in_fs_metadata = 0; | 1347 | device->in_fs_metadata = 0; |
1348 | 1348 | ||
@@ -1416,6 +1416,13 @@ out: | |||
1416 | mutex_unlock(&root->fs_info->volume_mutex); | 1416 | mutex_unlock(&root->fs_info->volume_mutex); |
1417 | mutex_unlock(&uuid_mutex); | 1417 | mutex_unlock(&uuid_mutex); |
1418 | return ret; | 1418 | return ret; |
1419 | error_undo: | ||
1420 | if (device->writeable) { | ||
1421 | list_add(&device->dev_alloc_list, | ||
1422 | &root->fs_info->fs_devices->alloc_list); | ||
1423 | root->fs_info->fs_devices->rw_devices++; | ||
1424 | } | ||
1425 | goto error_brelse; | ||
1419 | } | 1426 | } |
1420 | 1427 | ||
1421 | /* | 1428 | /* |
@@ -1633,7 +1640,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1633 | device->dev_root = root->fs_info->dev_root; | 1640 | device->dev_root = root->fs_info->dev_root; |
1634 | device->bdev = bdev; | 1641 | device->bdev = bdev; |
1635 | device->in_fs_metadata = 1; | 1642 | device->in_fs_metadata = 1; |
1636 | device->mode = 0; | 1643 | device->mode = FMODE_EXCL; |
1637 | set_blocksize(device->bdev, 4096); | 1644 | set_blocksize(device->bdev, 4096); |
1638 | 1645 | ||
1639 | if (seeding_dev) { | 1646 | if (seeding_dev) { |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 0bc68de8edd7..ebafa65a29b6 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -409,7 +409,7 @@ more: | |||
409 | spin_lock(&inode->i_lock); | 409 | spin_lock(&inode->i_lock); |
410 | if (ci->i_release_count == fi->dir_release_count) { | 410 | if (ci->i_release_count == fi->dir_release_count) { |
411 | dout(" marking %p complete\n", inode); | 411 | dout(" marking %p complete\n", inode); |
412 | ci->i_ceph_flags |= CEPH_I_COMPLETE; | 412 | /* ci->i_ceph_flags |= CEPH_I_COMPLETE; */ |
413 | ci->i_max_offset = filp->f_pos; | 413 | ci->i_max_offset = filp->f_pos; |
414 | } | 414 | } |
415 | spin_unlock(&inode->i_lock); | 415 | spin_unlock(&inode->i_lock); |
@@ -496,6 +496,7 @@ struct dentry *ceph_finish_lookup(struct ceph_mds_request *req, | |||
496 | 496 | ||
497 | /* .snap dir? */ | 497 | /* .snap dir? */ |
498 | if (err == -ENOENT && | 498 | if (err == -ENOENT && |
499 | ceph_snap(parent) == CEPH_NOSNAP && | ||
499 | strcmp(dentry->d_name.name, | 500 | strcmp(dentry->d_name.name, |
500 | fsc->mount_options->snapdir_name) == 0) { | 501 | fsc->mount_options->snapdir_name) == 0) { |
501 | struct inode *inode = ceph_get_snapdir(parent); | 502 | struct inode *inode = ceph_get_snapdir(parent); |
@@ -992,7 +993,7 @@ static int ceph_d_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
992 | { | 993 | { |
993 | struct inode *dir; | 994 | struct inode *dir; |
994 | 995 | ||
995 | if (nd->flags & LOOKUP_RCU) | 996 | if (nd && nd->flags & LOOKUP_RCU) |
996 | return -ECHILD; | 997 | return -ECHILD; |
997 | 998 | ||
998 | dir = dentry->d_parent->d_inode; | 999 | dir = dentry->d_parent->d_inode; |
@@ -1029,28 +1030,8 @@ out_touch: | |||
1029 | static void ceph_dentry_release(struct dentry *dentry) | 1030 | static void ceph_dentry_release(struct dentry *dentry) |
1030 | { | 1031 | { |
1031 | struct ceph_dentry_info *di = ceph_dentry(dentry); | 1032 | struct ceph_dentry_info *di = ceph_dentry(dentry); |
1032 | struct inode *parent_inode = NULL; | ||
1033 | u64 snapid = CEPH_NOSNAP; | ||
1034 | 1033 | ||
1035 | if (!IS_ROOT(dentry)) { | 1034 | dout("dentry_release %p\n", dentry); |
1036 | parent_inode = dentry->d_parent->d_inode; | ||
1037 | if (parent_inode) | ||
1038 | snapid = ceph_snap(parent_inode); | ||
1039 | } | ||
1040 | dout("dentry_release %p parent %p\n", dentry, parent_inode); | ||
1041 | if (parent_inode && snapid != CEPH_SNAPDIR) { | ||
1042 | struct ceph_inode_info *ci = ceph_inode(parent_inode); | ||
1043 | |||
1044 | spin_lock(&parent_inode->i_lock); | ||
1045 | if (ci->i_shared_gen == di->lease_shared_gen || | ||
1046 | snapid <= CEPH_MAXSNAP) { | ||
1047 | dout(" clearing %p complete (d_release)\n", | ||
1048 | parent_inode); | ||
1049 | ci->i_ceph_flags &= ~CEPH_I_COMPLETE; | ||
1050 | ci->i_release_count++; | ||
1051 | } | ||
1052 | spin_unlock(&parent_inode->i_lock); | ||
1053 | } | ||
1054 | if (di) { | 1035 | if (di) { |
1055 | ceph_dentry_lru_del(dentry); | 1036 | ceph_dentry_lru_del(dentry); |
1056 | if (di->lease_session) | 1037 | if (di->lease_session) |
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 5625463aa479..193bfa5e9cbd 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -707,7 +707,7 @@ static int fill_inode(struct inode *inode, | |||
707 | (issued & CEPH_CAP_FILE_EXCL) == 0 && | 707 | (issued & CEPH_CAP_FILE_EXCL) == 0 && |
708 | (ci->i_ceph_flags & CEPH_I_COMPLETE) == 0) { | 708 | (ci->i_ceph_flags & CEPH_I_COMPLETE) == 0) { |
709 | dout(" marking %p complete (empty)\n", inode); | 709 | dout(" marking %p complete (empty)\n", inode); |
710 | ci->i_ceph_flags |= CEPH_I_COMPLETE; | 710 | /* ci->i_ceph_flags |= CEPH_I_COMPLETE; */ |
711 | ci->i_max_offset = 2; | 711 | ci->i_max_offset = 2; |
712 | } | 712 | } |
713 | break; | 713 | break; |
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c index 39c243acd062..f40b9139e437 100644 --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c | |||
@@ -584,10 +584,14 @@ static void queue_realm_cap_snaps(struct ceph_snap_realm *realm) | |||
584 | if (lastinode) | 584 | if (lastinode) |
585 | iput(lastinode); | 585 | iput(lastinode); |
586 | 586 | ||
587 | dout("queue_realm_cap_snaps %p %llx children\n", realm, realm->ino); | 587 | list_for_each_entry(child, &realm->children, child_item) { |
588 | list_for_each_entry(child, &realm->children, child_item) | 588 | dout("queue_realm_cap_snaps %p %llx queue child %p %llx\n", |
589 | queue_realm_cap_snaps(child); | 589 | realm, realm->ino, child, child->ino); |
590 | list_del_init(&child->dirty_item); | ||
591 | list_add(&child->dirty_item, &realm->dirty_item); | ||
592 | } | ||
590 | 593 | ||
594 | list_del_init(&realm->dirty_item); | ||
591 | dout("queue_realm_cap_snaps %p %llx done\n", realm, realm->ino); | 595 | dout("queue_realm_cap_snaps %p %llx done\n", realm, realm->ino); |
592 | } | 596 | } |
593 | 597 | ||
@@ -683,7 +687,9 @@ more: | |||
683 | * queue cap snaps _after_ we've built the new snap contexts, | 687 | * queue cap snaps _after_ we've built the new snap contexts, |
684 | * so that i_head_snapc can be set appropriately. | 688 | * so that i_head_snapc can be set appropriately. |
685 | */ | 689 | */ |
686 | list_for_each_entry(realm, &dirty_realms, dirty_item) { | 690 | while (!list_empty(&dirty_realms)) { |
691 | realm = list_first_entry(&dirty_realms, struct ceph_snap_realm, | ||
692 | dirty_item); | ||
687 | queue_realm_cap_snaps(realm); | 693 | queue_realm_cap_snaps(realm); |
688 | } | 694 | } |
689 | 695 | ||
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 4a3330235d55..a9371b6578c0 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -127,5 +127,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); | |||
127 | extern const struct export_operations cifs_export_ops; | 127 | extern const struct export_operations cifs_export_ops; |
128 | #endif /* EXPERIMENTAL */ | 128 | #endif /* EXPERIMENTAL */ |
129 | 129 | ||
130 | #define CIFS_VERSION "1.70" | 130 | #define CIFS_VERSION "1.71" |
131 | #endif /* _CIFSFS_H */ | 131 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index 8d9189f64477..79f641eeda30 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -170,7 +170,7 @@ cifs_convert_address(struct sockaddr *dst, const char *src, int len) | |||
170 | { | 170 | { |
171 | int rc, alen, slen; | 171 | int rc, alen, slen; |
172 | const char *pct; | 172 | const char *pct; |
173 | char *endp, scope_id[13]; | 173 | char scope_id[13]; |
174 | struct sockaddr_in *s4 = (struct sockaddr_in *) dst; | 174 | struct sockaddr_in *s4 = (struct sockaddr_in *) dst; |
175 | struct sockaddr_in6 *s6 = (struct sockaddr_in6 *) dst; | 175 | struct sockaddr_in6 *s6 = (struct sockaddr_in6 *) dst; |
176 | 176 | ||
@@ -197,9 +197,9 @@ cifs_convert_address(struct sockaddr *dst, const char *src, int len) | |||
197 | memcpy(scope_id, pct + 1, slen); | 197 | memcpy(scope_id, pct + 1, slen); |
198 | scope_id[slen] = '\0'; | 198 | scope_id[slen] = '\0'; |
199 | 199 | ||
200 | s6->sin6_scope_id = (u32) simple_strtoul(pct, &endp, 0); | 200 | rc = strict_strtoul(scope_id, 0, |
201 | if (endp != scope_id + slen) | 201 | (unsigned long *)&s6->sin6_scope_id); |
202 | return 0; | 202 | rc = (rc == 0) ? 1 : 0; |
203 | } | 203 | } |
204 | 204 | ||
205 | return rc; | 205 | return rc; |
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 1adc9625a344..16765703131b 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -656,13 +656,13 @@ ssetup_ntlmssp_authenticate: | |||
656 | 656 | ||
657 | if (type == LANMAN) { | 657 | if (type == LANMAN) { |
658 | #ifdef CONFIG_CIFS_WEAK_PW_HASH | 658 | #ifdef CONFIG_CIFS_WEAK_PW_HASH |
659 | char lnm_session_key[CIFS_SESS_KEY_SIZE]; | 659 | char lnm_session_key[CIFS_AUTH_RESP_SIZE]; |
660 | 660 | ||
661 | pSMB->req.hdr.Flags2 &= ~SMBFLG2_UNICODE; | 661 | pSMB->req.hdr.Flags2 &= ~SMBFLG2_UNICODE; |
662 | 662 | ||
663 | /* no capabilities flags in old lanman negotiation */ | 663 | /* no capabilities flags in old lanman negotiation */ |
664 | 664 | ||
665 | pSMB->old_req.PasswordLength = cpu_to_le16(CIFS_SESS_KEY_SIZE); | 665 | pSMB->old_req.PasswordLength = cpu_to_le16(CIFS_AUTH_RESP_SIZE); |
666 | 666 | ||
667 | /* Calculate hash with password and copy into bcc_ptr. | 667 | /* Calculate hash with password and copy into bcc_ptr. |
668 | * Encryption Key (stored as in cryptkey) gets used if the | 668 | * Encryption Key (stored as in cryptkey) gets used if the |
@@ -675,8 +675,8 @@ ssetup_ntlmssp_authenticate: | |||
675 | true : false, lnm_session_key); | 675 | true : false, lnm_session_key); |
676 | 676 | ||
677 | ses->flags |= CIFS_SES_LANMAN; | 677 | ses->flags |= CIFS_SES_LANMAN; |
678 | memcpy(bcc_ptr, (char *)lnm_session_key, CIFS_SESS_KEY_SIZE); | 678 | memcpy(bcc_ptr, (char *)lnm_session_key, CIFS_AUTH_RESP_SIZE); |
679 | bcc_ptr += CIFS_SESS_KEY_SIZE; | 679 | bcc_ptr += CIFS_AUTH_RESP_SIZE; |
680 | 680 | ||
681 | /* can not sign if LANMAN negotiated so no need | 681 | /* can not sign if LANMAN negotiated so no need |
682 | to calculate signing key? but what if server | 682 | to calculate signing key? but what if server |
diff --git a/fs/compat.c b/fs/compat.c index f6fd0a00e6cc..c6d31a3bab88 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -262,35 +262,19 @@ static int put_compat_statfs(struct compat_statfs __user *ubuf, struct kstatfs * | |||
262 | */ | 262 | */ |
263 | asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_statfs __user *buf) | 263 | asmlinkage long compat_sys_statfs(const char __user *pathname, struct compat_statfs __user *buf) |
264 | { | 264 | { |
265 | struct path path; | 265 | struct kstatfs tmp; |
266 | int error; | 266 | int error = user_statfs(pathname, &tmp); |
267 | 267 | if (!error) | |
268 | error = user_path(pathname, &path); | 268 | error = put_compat_statfs(buf, &tmp); |
269 | if (!error) { | ||
270 | struct kstatfs tmp; | ||
271 | error = vfs_statfs(&path, &tmp); | ||
272 | if (!error) | ||
273 | error = put_compat_statfs(buf, &tmp); | ||
274 | path_put(&path); | ||
275 | } | ||
276 | return error; | 269 | return error; |
277 | } | 270 | } |
278 | 271 | ||
279 | asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user *buf) | 272 | asmlinkage long compat_sys_fstatfs(unsigned int fd, struct compat_statfs __user *buf) |
280 | { | 273 | { |
281 | struct file * file; | ||
282 | struct kstatfs tmp; | 274 | struct kstatfs tmp; |
283 | int error; | 275 | int error = fd_statfs(fd, &tmp); |
284 | |||
285 | error = -EBADF; | ||
286 | file = fget(fd); | ||
287 | if (!file) | ||
288 | goto out; | ||
289 | error = vfs_statfs(&file->f_path, &tmp); | ||
290 | if (!error) | 276 | if (!error) |
291 | error = put_compat_statfs(buf, &tmp); | 277 | error = put_compat_statfs(buf, &tmp); |
292 | fput(file); | ||
293 | out: | ||
294 | return error; | 278 | return error; |
295 | } | 279 | } |
296 | 280 | ||
@@ -329,41 +313,29 @@ static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstat | |||
329 | 313 | ||
330 | asmlinkage long compat_sys_statfs64(const char __user *pathname, compat_size_t sz, struct compat_statfs64 __user *buf) | 314 | asmlinkage long compat_sys_statfs64(const char __user *pathname, compat_size_t sz, struct compat_statfs64 __user *buf) |
331 | { | 315 | { |
332 | struct path path; | 316 | struct kstatfs tmp; |
333 | int error; | 317 | int error; |
334 | 318 | ||
335 | if (sz != sizeof(*buf)) | 319 | if (sz != sizeof(*buf)) |
336 | return -EINVAL; | 320 | return -EINVAL; |
337 | 321 | ||
338 | error = user_path(pathname, &path); | 322 | error = user_statfs(pathname, &tmp); |
339 | if (!error) { | 323 | if (!error) |
340 | struct kstatfs tmp; | 324 | error = put_compat_statfs64(buf, &tmp); |
341 | error = vfs_statfs(&path, &tmp); | ||
342 | if (!error) | ||
343 | error = put_compat_statfs64(buf, &tmp); | ||
344 | path_put(&path); | ||
345 | } | ||
346 | return error; | 325 | return error; |
347 | } | 326 | } |
348 | 327 | ||
349 | asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct compat_statfs64 __user *buf) | 328 | asmlinkage long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct compat_statfs64 __user *buf) |
350 | { | 329 | { |
351 | struct file * file; | ||
352 | struct kstatfs tmp; | 330 | struct kstatfs tmp; |
353 | int error; | 331 | int error; |
354 | 332 | ||
355 | if (sz != sizeof(*buf)) | 333 | if (sz != sizeof(*buf)) |
356 | return -EINVAL; | 334 | return -EINVAL; |
357 | 335 | ||
358 | error = -EBADF; | 336 | error = fd_statfs(fd, &tmp); |
359 | file = fget(fd); | ||
360 | if (!file) | ||
361 | goto out; | ||
362 | error = vfs_statfs(&file->f_path, &tmp); | ||
363 | if (!error) | 337 | if (!error) |
364 | error = put_compat_statfs64(buf, &tmp); | 338 | error = put_compat_statfs64(buf, &tmp); |
365 | fput(file); | ||
366 | out: | ||
367 | return error; | 339 | return error; |
368 | } | 340 | } |
369 | 341 | ||
@@ -1228,7 +1200,9 @@ compat_sys_preadv(unsigned long fd, const struct compat_iovec __user *vec, | |||
1228 | file = fget_light(fd, &fput_needed); | 1200 | file = fget_light(fd, &fput_needed); |
1229 | if (!file) | 1201 | if (!file) |
1230 | return -EBADF; | 1202 | return -EBADF; |
1231 | ret = compat_readv(file, vec, vlen, &pos); | 1203 | ret = -ESPIPE; |
1204 | if (file->f_mode & FMODE_PREAD) | ||
1205 | ret = compat_readv(file, vec, vlen, &pos); | ||
1232 | fput_light(file, fput_needed); | 1206 | fput_light(file, fput_needed); |
1233 | return ret; | 1207 | return ret; |
1234 | } | 1208 | } |
@@ -1285,7 +1259,9 @@ compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec, | |||
1285 | file = fget_light(fd, &fput_needed); | 1259 | file = fget_light(fd, &fput_needed); |
1286 | if (!file) | 1260 | if (!file) |
1287 | return -EBADF; | 1261 | return -EBADF; |
1288 | ret = compat_writev(file, vec, vlen, &pos); | 1262 | ret = -ESPIPE; |
1263 | if (file->f_mode & FMODE_PWRITE) | ||
1264 | ret = compat_writev(file, vec, vlen, &pos); | ||
1289 | fput_light(file, fput_needed); | 1265 | fput_light(file, fput_needed); |
1290 | return ret; | 1266 | return ret; |
1291 | } | 1267 | } |
@@ -2308,3 +2284,16 @@ asmlinkage long compat_sys_timerfd_gettime(int ufd, | |||
2308 | } | 2284 | } |
2309 | 2285 | ||
2310 | #endif /* CONFIG_TIMERFD */ | 2286 | #endif /* CONFIG_TIMERFD */ |
2287 | |||
2288 | #ifdef CONFIG_FHANDLE | ||
2289 | /* | ||
2290 | * Exactly like fs/open.c:sys_open_by_handle_at(), except that it | ||
2291 | * doesn't set the O_LARGEFILE flag. | ||
2292 | */ | ||
2293 | asmlinkage long | ||
2294 | compat_sys_open_by_handle_at(int mountdirfd, | ||
2295 | struct file_handle __user *handle, int flags) | ||
2296 | { | ||
2297 | return do_handle_open(mountdirfd, handle, flags); | ||
2298 | } | ||
2299 | #endif | ||
diff --git a/fs/dcache.c b/fs/dcache.c index 2a6bd9a4ae97..a39fe47c466f 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -296,8 +296,12 @@ static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent) | |||
296 | __releases(parent->d_lock) | 296 | __releases(parent->d_lock) |
297 | __releases(dentry->d_inode->i_lock) | 297 | __releases(dentry->d_inode->i_lock) |
298 | { | 298 | { |
299 | dentry->d_parent = NULL; | ||
300 | list_del(&dentry->d_u.d_child); | 299 | list_del(&dentry->d_u.d_child); |
300 | /* | ||
301 | * Inform try_to_ascend() that we are no longer attached to the | ||
302 | * dentry tree | ||
303 | */ | ||
304 | dentry->d_flags |= DCACHE_DISCONNECTED; | ||
301 | if (parent) | 305 | if (parent) |
302 | spin_unlock(&parent->d_lock); | 306 | spin_unlock(&parent->d_lock); |
303 | dentry_iput(dentry); | 307 | dentry_iput(dentry); |
@@ -1012,6 +1016,35 @@ void shrink_dcache_for_umount(struct super_block *sb) | |||
1012 | } | 1016 | } |
1013 | 1017 | ||
1014 | /* | 1018 | /* |
1019 | * This tries to ascend one level of parenthood, but | ||
1020 | * we can race with renaming, so we need to re-check | ||
1021 | * the parenthood after dropping the lock and check | ||
1022 | * that the sequence number still matches. | ||
1023 | */ | ||
1024 | static struct dentry *try_to_ascend(struct dentry *old, int locked, unsigned seq) | ||
1025 | { | ||
1026 | struct dentry *new = old->d_parent; | ||
1027 | |||
1028 | rcu_read_lock(); | ||
1029 | spin_unlock(&old->d_lock); | ||
1030 | spin_lock(&new->d_lock); | ||
1031 | |||
1032 | /* | ||
1033 | * might go back up the wrong parent if we have had a rename | ||
1034 | * or deletion | ||
1035 | */ | ||
1036 | if (new != old->d_parent || | ||
1037 | (old->d_flags & DCACHE_DISCONNECTED) || | ||
1038 | (!locked && read_seqretry(&rename_lock, seq))) { | ||
1039 | spin_unlock(&new->d_lock); | ||
1040 | new = NULL; | ||
1041 | } | ||
1042 | rcu_read_unlock(); | ||
1043 | return new; | ||
1044 | } | ||
1045 | |||
1046 | |||
1047 | /* | ||
1015 | * Search for at least 1 mount point in the dentry's subdirs. | 1048 | * Search for at least 1 mount point in the dentry's subdirs. |
1016 | * We descend to the next level whenever the d_subdirs | 1049 | * We descend to the next level whenever the d_subdirs |
1017 | * list is non-empty and continue searching. | 1050 | * list is non-empty and continue searching. |
@@ -1066,24 +1099,10 @@ resume: | |||
1066 | * All done at this level ... ascend and resume the search. | 1099 | * All done at this level ... ascend and resume the search. |
1067 | */ | 1100 | */ |
1068 | if (this_parent != parent) { | 1101 | if (this_parent != parent) { |
1069 | struct dentry *tmp; | 1102 | struct dentry *child = this_parent; |
1070 | struct dentry *child; | 1103 | this_parent = try_to_ascend(this_parent, locked, seq); |
1071 | 1104 | if (!this_parent) | |
1072 | tmp = this_parent->d_parent; | ||
1073 | rcu_read_lock(); | ||
1074 | spin_unlock(&this_parent->d_lock); | ||
1075 | child = this_parent; | ||
1076 | this_parent = tmp; | ||
1077 | spin_lock(&this_parent->d_lock); | ||
1078 | /* might go back up the wrong parent if we have had a rename | ||
1079 | * or deletion */ | ||
1080 | if (this_parent != child->d_parent || | ||
1081 | (!locked && read_seqretry(&rename_lock, seq))) { | ||
1082 | spin_unlock(&this_parent->d_lock); | ||
1083 | rcu_read_unlock(); | ||
1084 | goto rename_retry; | 1105 | goto rename_retry; |
1085 | } | ||
1086 | rcu_read_unlock(); | ||
1087 | next = child->d_u.d_child.next; | 1106 | next = child->d_u.d_child.next; |
1088 | goto resume; | 1107 | goto resume; |
1089 | } | 1108 | } |
@@ -1181,24 +1200,10 @@ resume: | |||
1181 | * All done at this level ... ascend and resume the search. | 1200 | * All done at this level ... ascend and resume the search. |
1182 | */ | 1201 | */ |
1183 | if (this_parent != parent) { | 1202 | if (this_parent != parent) { |
1184 | struct dentry *tmp; | 1203 | struct dentry *child = this_parent; |
1185 | struct dentry *child; | 1204 | this_parent = try_to_ascend(this_parent, locked, seq); |
1186 | 1205 | if (!this_parent) | |
1187 | tmp = this_parent->d_parent; | ||
1188 | rcu_read_lock(); | ||
1189 | spin_unlock(&this_parent->d_lock); | ||
1190 | child = this_parent; | ||
1191 | this_parent = tmp; | ||
1192 | spin_lock(&this_parent->d_lock); | ||
1193 | /* might go back up the wrong parent if we have had a rename | ||
1194 | * or deletion */ | ||
1195 | if (this_parent != child->d_parent || | ||
1196 | (!locked && read_seqretry(&rename_lock, seq))) { | ||
1197 | spin_unlock(&this_parent->d_lock); | ||
1198 | rcu_read_unlock(); | ||
1199 | goto rename_retry; | 1206 | goto rename_retry; |
1200 | } | ||
1201 | rcu_read_unlock(); | ||
1202 | next = child->d_u.d_child.next; | 1207 | next = child->d_u.d_child.next; |
1203 | goto resume; | 1208 | goto resume; |
1204 | } | 1209 | } |
@@ -1523,6 +1528,28 @@ struct dentry * d_alloc_root(struct inode * root_inode) | |||
1523 | } | 1528 | } |
1524 | EXPORT_SYMBOL(d_alloc_root); | 1529 | EXPORT_SYMBOL(d_alloc_root); |
1525 | 1530 | ||
1531 | static struct dentry * __d_find_any_alias(struct inode *inode) | ||
1532 | { | ||
1533 | struct dentry *alias; | ||
1534 | |||
1535 | if (list_empty(&inode->i_dentry)) | ||
1536 | return NULL; | ||
1537 | alias = list_first_entry(&inode->i_dentry, struct dentry, d_alias); | ||
1538 | __dget(alias); | ||
1539 | return alias; | ||
1540 | } | ||
1541 | |||
1542 | static struct dentry * d_find_any_alias(struct inode *inode) | ||
1543 | { | ||
1544 | struct dentry *de; | ||
1545 | |||
1546 | spin_lock(&inode->i_lock); | ||
1547 | de = __d_find_any_alias(inode); | ||
1548 | spin_unlock(&inode->i_lock); | ||
1549 | return de; | ||
1550 | } | ||
1551 | |||
1552 | |||
1526 | /** | 1553 | /** |
1527 | * d_obtain_alias - find or allocate a dentry for a given inode | 1554 | * d_obtain_alias - find or allocate a dentry for a given inode |
1528 | * @inode: inode to allocate the dentry for | 1555 | * @inode: inode to allocate the dentry for |
@@ -1552,7 +1579,7 @@ struct dentry *d_obtain_alias(struct inode *inode) | |||
1552 | if (IS_ERR(inode)) | 1579 | if (IS_ERR(inode)) |
1553 | return ERR_CAST(inode); | 1580 | return ERR_CAST(inode); |
1554 | 1581 | ||
1555 | res = d_find_alias(inode); | 1582 | res = d_find_any_alias(inode); |
1556 | if (res) | 1583 | if (res) |
1557 | goto out_iput; | 1584 | goto out_iput; |
1558 | 1585 | ||
@@ -1565,7 +1592,7 @@ struct dentry *d_obtain_alias(struct inode *inode) | |||
1565 | 1592 | ||
1566 | 1593 | ||
1567 | spin_lock(&inode->i_lock); | 1594 | spin_lock(&inode->i_lock); |
1568 | res = __d_find_alias(inode, 0); | 1595 | res = __d_find_any_alias(inode); |
1569 | if (res) { | 1596 | if (res) { |
1570 | spin_unlock(&inode->i_lock); | 1597 | spin_unlock(&inode->i_lock); |
1571 | dput(tmp); | 1598 | dput(tmp); |
@@ -2920,28 +2947,14 @@ resume: | |||
2920 | spin_unlock(&dentry->d_lock); | 2947 | spin_unlock(&dentry->d_lock); |
2921 | } | 2948 | } |
2922 | if (this_parent != root) { | 2949 | if (this_parent != root) { |
2923 | struct dentry *tmp; | 2950 | struct dentry *child = this_parent; |
2924 | struct dentry *child; | ||
2925 | |||
2926 | tmp = this_parent->d_parent; | ||
2927 | if (!(this_parent->d_flags & DCACHE_GENOCIDE)) { | 2951 | if (!(this_parent->d_flags & DCACHE_GENOCIDE)) { |
2928 | this_parent->d_flags |= DCACHE_GENOCIDE; | 2952 | this_parent->d_flags |= DCACHE_GENOCIDE; |
2929 | this_parent->d_count--; | 2953 | this_parent->d_count--; |
2930 | } | 2954 | } |
2931 | rcu_read_lock(); | 2955 | this_parent = try_to_ascend(this_parent, locked, seq); |
2932 | spin_unlock(&this_parent->d_lock); | 2956 | if (!this_parent) |
2933 | child = this_parent; | ||
2934 | this_parent = tmp; | ||
2935 | spin_lock(&this_parent->d_lock); | ||
2936 | /* might go back up the wrong parent if we have had a rename | ||
2937 | * or deletion */ | ||
2938 | if (this_parent != child->d_parent || | ||
2939 | (!locked && read_seqretry(&rename_lock, seq))) { | ||
2940 | spin_unlock(&this_parent->d_lock); | ||
2941 | rcu_read_unlock(); | ||
2942 | goto rename_retry; | 2957 | goto rename_retry; |
2943 | } | ||
2944 | rcu_read_unlock(); | ||
2945 | next = child->d_u.d_child.next; | 2958 | next = child->d_u.d_child.next; |
2946 | goto resume; | 2959 | goto resume; |
2947 | } | 2960 | } |
diff --git a/fs/ecryptfs/dentry.c b/fs/ecryptfs/dentry.c index 6fc4f319b550..534c1d46e69e 100644 --- a/fs/ecryptfs/dentry.c +++ b/fs/ecryptfs/dentry.c | |||
@@ -46,24 +46,28 @@ static int ecryptfs_d_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
46 | { | 46 | { |
47 | struct dentry *lower_dentry; | 47 | struct dentry *lower_dentry; |
48 | struct vfsmount *lower_mnt; | 48 | struct vfsmount *lower_mnt; |
49 | struct dentry *dentry_save; | 49 | struct dentry *dentry_save = NULL; |
50 | struct vfsmount *vfsmount_save; | 50 | struct vfsmount *vfsmount_save = NULL; |
51 | int rc = 1; | 51 | int rc = 1; |
52 | 52 | ||
53 | if (nd->flags & LOOKUP_RCU) | 53 | if (nd && nd->flags & LOOKUP_RCU) |
54 | return -ECHILD; | 54 | return -ECHILD; |
55 | 55 | ||
56 | lower_dentry = ecryptfs_dentry_to_lower(dentry); | 56 | lower_dentry = ecryptfs_dentry_to_lower(dentry); |
57 | lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); | 57 | lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); |
58 | if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate) | 58 | if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate) |
59 | goto out; | 59 | goto out; |
60 | dentry_save = nd->path.dentry; | 60 | if (nd) { |
61 | vfsmount_save = nd->path.mnt; | 61 | dentry_save = nd->path.dentry; |
62 | nd->path.dentry = lower_dentry; | 62 | vfsmount_save = nd->path.mnt; |
63 | nd->path.mnt = lower_mnt; | 63 | nd->path.dentry = lower_dentry; |
64 | nd->path.mnt = lower_mnt; | ||
65 | } | ||
64 | rc = lower_dentry->d_op->d_revalidate(lower_dentry, nd); | 66 | rc = lower_dentry->d_op->d_revalidate(lower_dentry, nd); |
65 | nd->path.dentry = dentry_save; | 67 | if (nd) { |
66 | nd->path.mnt = vfsmount_save; | 68 | nd->path.dentry = dentry_save; |
69 | nd->path.mnt = vfsmount_save; | ||
70 | } | ||
67 | if (dentry->d_inode) { | 71 | if (dentry->d_inode) { |
68 | struct inode *lower_inode = | 72 | struct inode *lower_inode = |
69 | ecryptfs_inode_to_lower(dentry->d_inode); | 73 | ecryptfs_inode_to_lower(dentry->d_inode); |
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index dbc84ed96336..e00753496e3e 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h | |||
@@ -632,8 +632,7 @@ int ecryptfs_interpose(struct dentry *hidden_dentry, | |||
632 | u32 flags); | 632 | u32 flags); |
633 | int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | 633 | int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, |
634 | struct dentry *lower_dentry, | 634 | struct dentry *lower_dentry, |
635 | struct inode *ecryptfs_dir_inode, | 635 | struct inode *ecryptfs_dir_inode); |
636 | struct nameidata *ecryptfs_nd); | ||
637 | int ecryptfs_decode_and_decrypt_filename(char **decrypted_name, | 636 | int ecryptfs_decode_and_decrypt_filename(char **decrypted_name, |
638 | size_t *decrypted_name_size, | 637 | size_t *decrypted_name_size, |
639 | struct dentry *ecryptfs_dentry, | 638 | struct dentry *ecryptfs_dentry, |
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index 81e10e6a9443..7d1050e254f9 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -317,6 +317,7 @@ ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
317 | 317 | ||
318 | const struct file_operations ecryptfs_dir_fops = { | 318 | const struct file_operations ecryptfs_dir_fops = { |
319 | .readdir = ecryptfs_readdir, | 319 | .readdir = ecryptfs_readdir, |
320 | .read = generic_read_dir, | ||
320 | .unlocked_ioctl = ecryptfs_unlocked_ioctl, | 321 | .unlocked_ioctl = ecryptfs_unlocked_ioctl, |
321 | #ifdef CONFIG_COMPAT | 322 | #ifdef CONFIG_COMPAT |
322 | .compat_ioctl = ecryptfs_compat_ioctl, | 323 | .compat_ioctl = ecryptfs_compat_ioctl, |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index bd33f87a1907..b592938a84bc 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -74,16 +74,20 @@ ecryptfs_create_underlying_file(struct inode *lower_dir_inode, | |||
74 | unsigned int flags_save; | 74 | unsigned int flags_save; |
75 | int rc; | 75 | int rc; |
76 | 76 | ||
77 | dentry_save = nd->path.dentry; | 77 | if (nd) { |
78 | vfsmount_save = nd->path.mnt; | 78 | dentry_save = nd->path.dentry; |
79 | flags_save = nd->flags; | 79 | vfsmount_save = nd->path.mnt; |
80 | nd->path.dentry = lower_dentry; | 80 | flags_save = nd->flags; |
81 | nd->path.mnt = lower_mnt; | 81 | nd->path.dentry = lower_dentry; |
82 | nd->flags &= ~LOOKUP_OPEN; | 82 | nd->path.mnt = lower_mnt; |
83 | nd->flags &= ~LOOKUP_OPEN; | ||
84 | } | ||
83 | rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd); | 85 | rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd); |
84 | nd->path.dentry = dentry_save; | 86 | if (nd) { |
85 | nd->path.mnt = vfsmount_save; | 87 | nd->path.dentry = dentry_save; |
86 | nd->flags = flags_save; | 88 | nd->path.mnt = vfsmount_save; |
89 | nd->flags = flags_save; | ||
90 | } | ||
87 | return rc; | 91 | return rc; |
88 | } | 92 | } |
89 | 93 | ||
@@ -241,8 +245,7 @@ out: | |||
241 | */ | 245 | */ |
242 | int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | 246 | int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, |
243 | struct dentry *lower_dentry, | 247 | struct dentry *lower_dentry, |
244 | struct inode *ecryptfs_dir_inode, | 248 | struct inode *ecryptfs_dir_inode) |
245 | struct nameidata *ecryptfs_nd) | ||
246 | { | 249 | { |
247 | struct dentry *lower_dir_dentry; | 250 | struct dentry *lower_dir_dentry; |
248 | struct vfsmount *lower_mnt; | 251 | struct vfsmount *lower_mnt; |
@@ -290,8 +293,6 @@ int ecryptfs_lookup_and_interpose_lower(struct dentry *ecryptfs_dentry, | |||
290 | goto out; | 293 | goto out; |
291 | if (special_file(lower_inode->i_mode)) | 294 | if (special_file(lower_inode->i_mode)) |
292 | goto out; | 295 | goto out; |
293 | if (!ecryptfs_nd) | ||
294 | goto out; | ||
295 | /* Released in this function */ | 296 | /* Released in this function */ |
296 | page_virt = kmem_cache_zalloc(ecryptfs_header_cache_2, GFP_USER); | 297 | page_virt = kmem_cache_zalloc(ecryptfs_header_cache_2, GFP_USER); |
297 | if (!page_virt) { | 298 | if (!page_virt) { |
@@ -349,75 +350,6 @@ out: | |||
349 | } | 350 | } |
350 | 351 | ||
351 | /** | 352 | /** |
352 | * ecryptfs_new_lower_dentry | ||
353 | * @name: The name of the new dentry. | ||
354 | * @lower_dir_dentry: Parent directory of the new dentry. | ||
355 | * @nd: nameidata from last lookup. | ||
356 | * | ||
357 | * Create a new dentry or get it from lower parent dir. | ||
358 | */ | ||
359 | static struct dentry * | ||
360 | ecryptfs_new_lower_dentry(struct qstr *name, struct dentry *lower_dir_dentry, | ||
361 | struct nameidata *nd) | ||
362 | { | ||
363 | struct dentry *new_dentry; | ||
364 | struct dentry *tmp; | ||
365 | struct inode *lower_dir_inode; | ||
366 | |||
367 | lower_dir_inode = lower_dir_dentry->d_inode; | ||
368 | |||
369 | tmp = d_alloc(lower_dir_dentry, name); | ||
370 | if (!tmp) | ||
371 | return ERR_PTR(-ENOMEM); | ||
372 | |||
373 | mutex_lock(&lower_dir_inode->i_mutex); | ||
374 | new_dentry = lower_dir_inode->i_op->lookup(lower_dir_inode, tmp, nd); | ||
375 | mutex_unlock(&lower_dir_inode->i_mutex); | ||
376 | |||
377 | if (!new_dentry) | ||
378 | new_dentry = tmp; | ||
379 | else | ||
380 | dput(tmp); | ||
381 | |||
382 | return new_dentry; | ||
383 | } | ||
384 | |||
385 | |||
386 | /** | ||
387 | * ecryptfs_lookup_one_lower | ||
388 | * @ecryptfs_dentry: The eCryptfs dentry that we are looking up | ||
389 | * @lower_dir_dentry: lower parent directory | ||
390 | * @name: lower file name | ||
391 | * | ||
392 | * Get the lower dentry from vfs. If lower dentry does not exist yet, | ||
393 | * create it. | ||
394 | */ | ||
395 | static struct dentry * | ||
396 | ecryptfs_lookup_one_lower(struct dentry *ecryptfs_dentry, | ||
397 | struct dentry *lower_dir_dentry, struct qstr *name) | ||
398 | { | ||
399 | struct nameidata nd; | ||
400 | struct vfsmount *lower_mnt; | ||
401 | int err; | ||
402 | |||
403 | lower_mnt = mntget(ecryptfs_dentry_to_lower_mnt( | ||
404 | ecryptfs_dentry->d_parent)); | ||
405 | err = vfs_path_lookup(lower_dir_dentry, lower_mnt, name->name , 0, &nd); | ||
406 | mntput(lower_mnt); | ||
407 | |||
408 | if (!err) { | ||
409 | /* we dont need the mount */ | ||
410 | mntput(nd.path.mnt); | ||
411 | return nd.path.dentry; | ||
412 | } | ||
413 | if (err != -ENOENT) | ||
414 | return ERR_PTR(err); | ||
415 | |||
416 | /* create a new lower dentry */ | ||
417 | return ecryptfs_new_lower_dentry(name, lower_dir_dentry, &nd); | ||
418 | } | ||
419 | |||
420 | /** | ||
421 | * ecryptfs_lookup | 353 | * ecryptfs_lookup |
422 | * @ecryptfs_dir_inode: The eCryptfs directory inode | 354 | * @ecryptfs_dir_inode: The eCryptfs directory inode |
423 | * @ecryptfs_dentry: The eCryptfs dentry that we are looking up | 355 | * @ecryptfs_dentry: The eCryptfs dentry that we are looking up |
@@ -434,7 +366,6 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
434 | size_t encrypted_and_encoded_name_size; | 366 | size_t encrypted_and_encoded_name_size; |
435 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat = NULL; | 367 | struct ecryptfs_mount_crypt_stat *mount_crypt_stat = NULL; |
436 | struct dentry *lower_dir_dentry, *lower_dentry; | 368 | struct dentry *lower_dir_dentry, *lower_dentry; |
437 | struct qstr lower_name; | ||
438 | int rc = 0; | 369 | int rc = 0; |
439 | 370 | ||
440 | if ((ecryptfs_dentry->d_name.len == 1 | 371 | if ((ecryptfs_dentry->d_name.len == 1 |
@@ -444,20 +375,14 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
444 | goto out_d_drop; | 375 | goto out_d_drop; |
445 | } | 376 | } |
446 | lower_dir_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry->d_parent); | 377 | lower_dir_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry->d_parent); |
447 | lower_name.name = ecryptfs_dentry->d_name.name; | 378 | mutex_lock(&lower_dir_dentry->d_inode->i_mutex); |
448 | lower_name.len = ecryptfs_dentry->d_name.len; | 379 | lower_dentry = lookup_one_len(ecryptfs_dentry->d_name.name, |
449 | lower_name.hash = ecryptfs_dentry->d_name.hash; | 380 | lower_dir_dentry, |
450 | if (lower_dir_dentry->d_op && lower_dir_dentry->d_op->d_hash) { | 381 | ecryptfs_dentry->d_name.len); |
451 | rc = lower_dir_dentry->d_op->d_hash(lower_dir_dentry, | 382 | mutex_unlock(&lower_dir_dentry->d_inode->i_mutex); |
452 | lower_dir_dentry->d_inode, &lower_name); | ||
453 | if (rc < 0) | ||
454 | goto out_d_drop; | ||
455 | } | ||
456 | lower_dentry = ecryptfs_lookup_one_lower(ecryptfs_dentry, | ||
457 | lower_dir_dentry, &lower_name); | ||
458 | if (IS_ERR(lower_dentry)) { | 383 | if (IS_ERR(lower_dentry)) { |
459 | rc = PTR_ERR(lower_dentry); | 384 | rc = PTR_ERR(lower_dentry); |
460 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_lower() returned " | 385 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " |
461 | "[%d] on lower_dentry = [%s]\n", __func__, rc, | 386 | "[%d] on lower_dentry = [%s]\n", __func__, rc, |
462 | encrypted_and_encoded_name); | 387 | encrypted_and_encoded_name); |
463 | goto out_d_drop; | 388 | goto out_d_drop; |
@@ -479,28 +404,21 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, | |||
479 | "filename; rc = [%d]\n", __func__, rc); | 404 | "filename; rc = [%d]\n", __func__, rc); |
480 | goto out_d_drop; | 405 | goto out_d_drop; |
481 | } | 406 | } |
482 | lower_name.name = encrypted_and_encoded_name; | 407 | mutex_lock(&lower_dir_dentry->d_inode->i_mutex); |
483 | lower_name.len = encrypted_and_encoded_name_size; | 408 | lower_dentry = lookup_one_len(encrypted_and_encoded_name, |
484 | lower_name.hash = full_name_hash(lower_name.name, lower_name.len); | 409 | lower_dir_dentry, |
485 | if (lower_dir_dentry->d_op && lower_dir_dentry->d_op->d_hash) { | 410 | encrypted_and_encoded_name_size); |
486 | rc = lower_dir_dentry->d_op->d_hash(lower_dir_dentry, | 411 | mutex_unlock(&lower_dir_dentry->d_inode->i_mutex); |
487 | lower_dir_dentry->d_inode, &lower_name); | ||
488 | if (rc < 0) | ||
489 | goto out_d_drop; | ||
490 | } | ||
491 | lower_dentry = ecryptfs_lookup_one_lower(ecryptfs_dentry, | ||
492 | lower_dir_dentry, &lower_name); | ||
493 | if (IS_ERR(lower_dentry)) { | 412 | if (IS_ERR(lower_dentry)) { |
494 | rc = PTR_ERR(lower_dentry); | 413 | rc = PTR_ERR(lower_dentry); |
495 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_lower() returned " | 414 | ecryptfs_printk(KERN_DEBUG, "%s: lookup_one_len() returned " |
496 | "[%d] on lower_dentry = [%s]\n", __func__, rc, | 415 | "[%d] on lower_dentry = [%s]\n", __func__, rc, |
497 | encrypted_and_encoded_name); | 416 | encrypted_and_encoded_name); |
498 | goto out_d_drop; | 417 | goto out_d_drop; |
499 | } | 418 | } |
500 | lookup_and_interpose: | 419 | lookup_and_interpose: |
501 | rc = ecryptfs_lookup_and_interpose_lower(ecryptfs_dentry, lower_dentry, | 420 | rc = ecryptfs_lookup_and_interpose_lower(ecryptfs_dentry, lower_dentry, |
502 | ecryptfs_dir_inode, | 421 | ecryptfs_dir_inode); |
503 | ecryptfs_nd); | ||
504 | goto out; | 422 | goto out; |
505 | out_d_drop: | 423 | out_d_drop: |
506 | d_drop(ecryptfs_dentry); | 424 | d_drop(ecryptfs_dentry); |
@@ -1092,6 +1010,8 @@ int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
1092 | rc = vfs_getattr(ecryptfs_dentry_to_lower_mnt(dentry), | 1010 | rc = vfs_getattr(ecryptfs_dentry_to_lower_mnt(dentry), |
1093 | ecryptfs_dentry_to_lower(dentry), &lower_stat); | 1011 | ecryptfs_dentry_to_lower(dentry), &lower_stat); |
1094 | if (!rc) { | 1012 | if (!rc) { |
1013 | fsstack_copy_attr_all(dentry->d_inode, | ||
1014 | ecryptfs_inode_to_lower(dentry->d_inode)); | ||
1095 | generic_fillattr(dentry->d_inode, stat); | 1015 | generic_fillattr(dentry->d_inode, stat); |
1096 | stat->blocks = lower_stat.blocks; | 1016 | stat->blocks = lower_stat.blocks; |
1097 | } | 1017 | } |
diff --git a/fs/eventfd.c b/fs/eventfd.c index e0194b3e14d6..d9a591773919 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c | |||
@@ -99,7 +99,7 @@ EXPORT_SYMBOL_GPL(eventfd_ctx_get); | |||
99 | * @ctx: [in] Pointer to eventfd context. | 99 | * @ctx: [in] Pointer to eventfd context. |
100 | * | 100 | * |
101 | * The eventfd context reference must have been previously acquired either | 101 | * The eventfd context reference must have been previously acquired either |
102 | * with eventfd_ctx_get() or eventfd_ctx_fdget()). | 102 | * with eventfd_ctx_get() or eventfd_ctx_fdget(). |
103 | */ | 103 | */ |
104 | void eventfd_ctx_put(struct eventfd_ctx *ctx) | 104 | void eventfd_ctx_put(struct eventfd_ctx *ctx) |
105 | { | 105 | { |
@@ -146,9 +146,9 @@ static void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt) | |||
146 | * eventfd_ctx_remove_wait_queue - Read the current counter and removes wait queue. | 146 | * eventfd_ctx_remove_wait_queue - Read the current counter and removes wait queue. |
147 | * @ctx: [in] Pointer to eventfd context. | 147 | * @ctx: [in] Pointer to eventfd context. |
148 | * @wait: [in] Wait queue to be removed. | 148 | * @wait: [in] Wait queue to be removed. |
149 | * @cnt: [out] Pointer to the 64bit conter value. | 149 | * @cnt: [out] Pointer to the 64-bit counter value. |
150 | * | 150 | * |
151 | * Returns zero if successful, or the following error codes: | 151 | * Returns %0 if successful, or the following error codes: |
152 | * | 152 | * |
153 | * -EAGAIN : The operation would have blocked. | 153 | * -EAGAIN : The operation would have blocked. |
154 | * | 154 | * |
@@ -175,11 +175,11 @@ EXPORT_SYMBOL_GPL(eventfd_ctx_remove_wait_queue); | |||
175 | * eventfd_ctx_read - Reads the eventfd counter or wait if it is zero. | 175 | * eventfd_ctx_read - Reads the eventfd counter or wait if it is zero. |
176 | * @ctx: [in] Pointer to eventfd context. | 176 | * @ctx: [in] Pointer to eventfd context. |
177 | * @no_wait: [in] Different from zero if the operation should not block. | 177 | * @no_wait: [in] Different from zero if the operation should not block. |
178 | * @cnt: [out] Pointer to the 64bit conter value. | 178 | * @cnt: [out] Pointer to the 64-bit counter value. |
179 | * | 179 | * |
180 | * Returns zero if successful, or the following error codes: | 180 | * Returns %0 if successful, or the following error codes: |
181 | * | 181 | * |
182 | * -EAGAIN : The operation would have blocked but @no_wait was nonzero. | 182 | * -EAGAIN : The operation would have blocked but @no_wait was non-zero. |
183 | * -ERESTARTSYS : A signal interrupted the wait operation. | 183 | * -ERESTARTSYS : A signal interrupted the wait operation. |
184 | * | 184 | * |
185 | * If @no_wait is zero, the function might sleep until the eventfd internal | 185 | * If @no_wait is zero, the function might sleep until the eventfd internal |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 267d0ada4541..4a09af9e9a63 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -63,6 +63,13 @@ | |||
63 | * cleanup path and it is also acquired by eventpoll_release_file() | 63 | * cleanup path and it is also acquired by eventpoll_release_file() |
64 | * if a file has been pushed inside an epoll set and it is then | 64 | * if a file has been pushed inside an epoll set and it is then |
65 | * close()d without a previous call toepoll_ctl(EPOLL_CTL_DEL). | 65 | * close()d without a previous call toepoll_ctl(EPOLL_CTL_DEL). |
66 | * It is also acquired when inserting an epoll fd onto another epoll | ||
67 | * fd. We do this so that we walk the epoll tree and ensure that this | ||
68 | * insertion does not create a cycle of epoll file descriptors, which | ||
69 | * could lead to deadlock. We need a global mutex to prevent two | ||
70 | * simultaneous inserts (A into B and B into A) from racing and | ||
71 | * constructing a cycle without either insert observing that it is | ||
72 | * going to. | ||
66 | * It is possible to drop the "ep->mtx" and to use the global | 73 | * It is possible to drop the "ep->mtx" and to use the global |
67 | * mutex "epmutex" (together with "ep->lock") to have it working, | 74 | * mutex "epmutex" (together with "ep->lock") to have it working, |
68 | * but having "ep->mtx" will make the interface more scalable. | 75 | * but having "ep->mtx" will make the interface more scalable. |
@@ -224,6 +231,9 @@ static long max_user_watches __read_mostly; | |||
224 | */ | 231 | */ |
225 | static DEFINE_MUTEX(epmutex); | 232 | static DEFINE_MUTEX(epmutex); |
226 | 233 | ||
234 | /* Used to check for epoll file descriptor inclusion loops */ | ||
235 | static struct nested_calls poll_loop_ncalls; | ||
236 | |||
227 | /* Used for safe wake up implementation */ | 237 | /* Used for safe wake up implementation */ |
228 | static struct nested_calls poll_safewake_ncalls; | 238 | static struct nested_calls poll_safewake_ncalls; |
229 | 239 | ||
@@ -1198,6 +1208,62 @@ retry: | |||
1198 | return res; | 1208 | return res; |
1199 | } | 1209 | } |
1200 | 1210 | ||
1211 | /** | ||
1212 | * ep_loop_check_proc - Callback function to be passed to the @ep_call_nested() | ||
1213 | * API, to verify that adding an epoll file inside another | ||
1214 | * epoll structure, does not violate the constraints, in | ||
1215 | * terms of closed loops, or too deep chains (which can | ||
1216 | * result in excessive stack usage). | ||
1217 | * | ||
1218 | * @priv: Pointer to the epoll file to be currently checked. | ||
1219 | * @cookie: Original cookie for this call. This is the top-of-the-chain epoll | ||
1220 | * data structure pointer. | ||
1221 | * @call_nests: Current dept of the @ep_call_nested() call stack. | ||
1222 | * | ||
1223 | * Returns: Returns zero if adding the epoll @file inside current epoll | ||
1224 | * structure @ep does not violate the constraints, or -1 otherwise. | ||
1225 | */ | ||
1226 | static int ep_loop_check_proc(void *priv, void *cookie, int call_nests) | ||
1227 | { | ||
1228 | int error = 0; | ||
1229 | struct file *file = priv; | ||
1230 | struct eventpoll *ep = file->private_data; | ||
1231 | struct rb_node *rbp; | ||
1232 | struct epitem *epi; | ||
1233 | |||
1234 | mutex_lock(&ep->mtx); | ||
1235 | for (rbp = rb_first(&ep->rbr); rbp; rbp = rb_next(rbp)) { | ||
1236 | epi = rb_entry(rbp, struct epitem, rbn); | ||
1237 | if (unlikely(is_file_epoll(epi->ffd.file))) { | ||
1238 | error = ep_call_nested(&poll_loop_ncalls, EP_MAX_NESTS, | ||
1239 | ep_loop_check_proc, epi->ffd.file, | ||
1240 | epi->ffd.file->private_data, current); | ||
1241 | if (error != 0) | ||
1242 | break; | ||
1243 | } | ||
1244 | } | ||
1245 | mutex_unlock(&ep->mtx); | ||
1246 | |||
1247 | return error; | ||
1248 | } | ||
1249 | |||
1250 | /** | ||
1251 | * ep_loop_check - Performs a check to verify that adding an epoll file (@file) | ||
1252 | * another epoll file (represented by @ep) does not create | ||
1253 | * closed loops or too deep chains. | ||
1254 | * | ||
1255 | * @ep: Pointer to the epoll private data structure. | ||
1256 | * @file: Pointer to the epoll file to be checked. | ||
1257 | * | ||
1258 | * Returns: Returns zero if adding the epoll @file inside current epoll | ||
1259 | * structure @ep does not violate the constraints, or -1 otherwise. | ||
1260 | */ | ||
1261 | static int ep_loop_check(struct eventpoll *ep, struct file *file) | ||
1262 | { | ||
1263 | return ep_call_nested(&poll_loop_ncalls, EP_MAX_NESTS, | ||
1264 | ep_loop_check_proc, file, ep, current); | ||
1265 | } | ||
1266 | |||
1201 | /* | 1267 | /* |
1202 | * Open an eventpoll file descriptor. | 1268 | * Open an eventpoll file descriptor. |
1203 | */ | 1269 | */ |
@@ -1246,6 +1312,7 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, | |||
1246 | struct epoll_event __user *, event) | 1312 | struct epoll_event __user *, event) |
1247 | { | 1313 | { |
1248 | int error; | 1314 | int error; |
1315 | int did_lock_epmutex = 0; | ||
1249 | struct file *file, *tfile; | 1316 | struct file *file, *tfile; |
1250 | struct eventpoll *ep; | 1317 | struct eventpoll *ep; |
1251 | struct epitem *epi; | 1318 | struct epitem *epi; |
@@ -1287,6 +1354,25 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, | |||
1287 | */ | 1354 | */ |
1288 | ep = file->private_data; | 1355 | ep = file->private_data; |
1289 | 1356 | ||
1357 | /* | ||
1358 | * When we insert an epoll file descriptor, inside another epoll file | ||
1359 | * descriptor, there is the change of creating closed loops, which are | ||
1360 | * better be handled here, than in more critical paths. | ||
1361 | * | ||
1362 | * We hold epmutex across the loop check and the insert in this case, in | ||
1363 | * order to prevent two separate inserts from racing and each doing the | ||
1364 | * insert "at the same time" such that ep_loop_check passes on both | ||
1365 | * before either one does the insert, thereby creating a cycle. | ||
1366 | */ | ||
1367 | if (unlikely(is_file_epoll(tfile) && op == EPOLL_CTL_ADD)) { | ||
1368 | mutex_lock(&epmutex); | ||
1369 | did_lock_epmutex = 1; | ||
1370 | error = -ELOOP; | ||
1371 | if (ep_loop_check(ep, tfile) != 0) | ||
1372 | goto error_tgt_fput; | ||
1373 | } | ||
1374 | |||
1375 | |||
1290 | mutex_lock(&ep->mtx); | 1376 | mutex_lock(&ep->mtx); |
1291 | 1377 | ||
1292 | /* | 1378 | /* |
@@ -1322,6 +1408,9 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, | |||
1322 | mutex_unlock(&ep->mtx); | 1408 | mutex_unlock(&ep->mtx); |
1323 | 1409 | ||
1324 | error_tgt_fput: | 1410 | error_tgt_fput: |
1411 | if (unlikely(did_lock_epmutex)) | ||
1412 | mutex_unlock(&epmutex); | ||
1413 | |||
1325 | fput(tfile); | 1414 | fput(tfile); |
1326 | error_fput: | 1415 | error_fput: |
1327 | fput(file); | 1416 | fput(file); |
@@ -1441,6 +1530,12 @@ static int __init eventpoll_init(void) | |||
1441 | EP_ITEM_COST; | 1530 | EP_ITEM_COST; |
1442 | BUG_ON(max_user_watches < 0); | 1531 | BUG_ON(max_user_watches < 0); |
1443 | 1532 | ||
1533 | /* | ||
1534 | * Initialize the structure used to perform epoll file descriptor | ||
1535 | * inclusion loops checks. | ||
1536 | */ | ||
1537 | ep_nested_calls_init(&poll_loop_ncalls); | ||
1538 | |||
1444 | /* Initialize the structure used to perform safe poll wait head wake ups */ | 1539 | /* Initialize the structure used to perform safe poll wait head wake ups */ |
1445 | ep_nested_calls_init(&poll_safewake_ncalls); | 1540 | ep_nested_calls_init(&poll_safewake_ncalls); |
1446 | 1541 | ||
@@ -115,13 +115,16 @@ SYSCALL_DEFINE1(uselib, const char __user *, library) | |||
115 | struct file *file; | 115 | struct file *file; |
116 | char *tmp = getname(library); | 116 | char *tmp = getname(library); |
117 | int error = PTR_ERR(tmp); | 117 | int error = PTR_ERR(tmp); |
118 | static const struct open_flags uselib_flags = { | ||
119 | .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC, | ||
120 | .acc_mode = MAY_READ | MAY_EXEC | MAY_OPEN, | ||
121 | .intent = LOOKUP_OPEN | ||
122 | }; | ||
118 | 123 | ||
119 | if (IS_ERR(tmp)) | 124 | if (IS_ERR(tmp)) |
120 | goto out; | 125 | goto out; |
121 | 126 | ||
122 | file = do_filp_open(AT_FDCWD, tmp, | 127 | file = do_filp_open(AT_FDCWD, tmp, &uselib_flags, LOOKUP_FOLLOW); |
123 | O_LARGEFILE | O_RDONLY | __FMODE_EXEC, 0, | ||
124 | MAY_READ | MAY_EXEC | MAY_OPEN); | ||
125 | putname(tmp); | 128 | putname(tmp); |
126 | error = PTR_ERR(file); | 129 | error = PTR_ERR(file); |
127 | if (IS_ERR(file)) | 130 | if (IS_ERR(file)) |
@@ -721,10 +724,13 @@ struct file *open_exec(const char *name) | |||
721 | { | 724 | { |
722 | struct file *file; | 725 | struct file *file; |
723 | int err; | 726 | int err; |
727 | static const struct open_flags open_exec_flags = { | ||
728 | .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC, | ||
729 | .acc_mode = MAY_EXEC | MAY_OPEN, | ||
730 | .intent = LOOKUP_OPEN | ||
731 | }; | ||
724 | 732 | ||
725 | file = do_filp_open(AT_FDCWD, name, | 733 | file = do_filp_open(AT_FDCWD, name, &open_exec_flags, LOOKUP_FOLLOW); |
726 | O_LARGEFILE | O_RDONLY | __FMODE_EXEC, 0, | ||
727 | MAY_EXEC | MAY_OPEN); | ||
728 | if (IS_ERR(file)) | 734 | if (IS_ERR(file)) |
729 | goto out; | 735 | goto out; |
730 | 736 | ||
diff --git a/fs/exofs/namei.c b/fs/exofs/namei.c index 264e95d02830..4d70db110cfc 100644 --- a/fs/exofs/namei.c +++ b/fs/exofs/namei.c | |||
@@ -272,7 +272,6 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
272 | new_de = exofs_find_entry(new_dir, new_dentry, &new_page); | 272 | new_de = exofs_find_entry(new_dir, new_dentry, &new_page); |
273 | if (!new_de) | 273 | if (!new_de) |
274 | goto out_dir; | 274 | goto out_dir; |
275 | inode_inc_link_count(old_inode); | ||
276 | err = exofs_set_link(new_dir, new_de, new_page, old_inode); | 275 | err = exofs_set_link(new_dir, new_de, new_page, old_inode); |
277 | new_inode->i_ctime = CURRENT_TIME; | 276 | new_inode->i_ctime = CURRENT_TIME; |
278 | if (dir_de) | 277 | if (dir_de) |
@@ -286,12 +285,9 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
286 | if (new_dir->i_nlink >= EXOFS_LINK_MAX) | 285 | if (new_dir->i_nlink >= EXOFS_LINK_MAX) |
287 | goto out_dir; | 286 | goto out_dir; |
288 | } | 287 | } |
289 | inode_inc_link_count(old_inode); | ||
290 | err = exofs_add_link(new_dentry, old_inode); | 288 | err = exofs_add_link(new_dentry, old_inode); |
291 | if (err) { | 289 | if (err) |
292 | inode_dec_link_count(old_inode); | ||
293 | goto out_dir; | 290 | goto out_dir; |
294 | } | ||
295 | if (dir_de) | 291 | if (dir_de) |
296 | inode_inc_link_count(new_dir); | 292 | inode_inc_link_count(new_dir); |
297 | } | 293 | } |
@@ -299,7 +295,7 @@ static int exofs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
299 | old_inode->i_ctime = CURRENT_TIME; | 295 | old_inode->i_ctime = CURRENT_TIME; |
300 | 296 | ||
301 | exofs_delete_entry(old_de, old_page); | 297 | exofs_delete_entry(old_de, old_page); |
302 | inode_dec_link_count(old_inode); | 298 | mark_inode_dirty(old_inode); |
303 | 299 | ||
304 | if (dir_de) { | 300 | if (dir_de) { |
305 | err = exofs_set_link(old_inode, dir_de, dir_page, new_dir); | 301 | err = exofs_set_link(old_inode, dir_de, dir_page, new_dir); |
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index 4b6825740dd5..b05acb796135 100644 --- a/fs/exportfs/expfs.c +++ b/fs/exportfs/expfs.c | |||
@@ -320,9 +320,14 @@ static int export_encode_fh(struct dentry *dentry, struct fid *fid, | |||
320 | struct inode * inode = dentry->d_inode; | 320 | struct inode * inode = dentry->d_inode; |
321 | int len = *max_len; | 321 | int len = *max_len; |
322 | int type = FILEID_INO32_GEN; | 322 | int type = FILEID_INO32_GEN; |
323 | 323 | ||
324 | if (len < 2 || (connectable && len < 4)) | 324 | if (connectable && (len < 4)) { |
325 | *max_len = 4; | ||
326 | return 255; | ||
327 | } else if (len < 2) { | ||
328 | *max_len = 2; | ||
325 | return 255; | 329 | return 255; |
330 | } | ||
326 | 331 | ||
327 | len = 2; | 332 | len = 2; |
328 | fid->i32.ino = inode->i_ino; | 333 | fid->i32.ino = inode->i_ino; |
@@ -369,6 +374,8 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid, | |||
369 | /* | 374 | /* |
370 | * Try to get any dentry for the given file handle from the filesystem. | 375 | * Try to get any dentry for the given file handle from the filesystem. |
371 | */ | 376 | */ |
377 | if (!nop || !nop->fh_to_dentry) | ||
378 | return ERR_PTR(-ESTALE); | ||
372 | result = nop->fh_to_dentry(mnt->mnt_sb, fid, fh_len, fileid_type); | 379 | result = nop->fh_to_dentry(mnt->mnt_sb, fid, fh_len, fileid_type); |
373 | if (!result) | 380 | if (!result) |
374 | result = ERR_PTR(-ESTALE); | 381 | result = ERR_PTR(-ESTALE); |
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index 2e1d8341d827..adb91855ccd0 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c | |||
@@ -344,7 +344,6 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, | |||
344 | new_de = ext2_find_entry (new_dir, &new_dentry->d_name, &new_page); | 344 | new_de = ext2_find_entry (new_dir, &new_dentry->d_name, &new_page); |
345 | if (!new_de) | 345 | if (!new_de) |
346 | goto out_dir; | 346 | goto out_dir; |
347 | inode_inc_link_count(old_inode); | ||
348 | ext2_set_link(new_dir, new_de, new_page, old_inode, 1); | 347 | ext2_set_link(new_dir, new_de, new_page, old_inode, 1); |
349 | new_inode->i_ctime = CURRENT_TIME_SEC; | 348 | new_inode->i_ctime = CURRENT_TIME_SEC; |
350 | if (dir_de) | 349 | if (dir_de) |
@@ -356,12 +355,9 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, | |||
356 | if (new_dir->i_nlink >= EXT2_LINK_MAX) | 355 | if (new_dir->i_nlink >= EXT2_LINK_MAX) |
357 | goto out_dir; | 356 | goto out_dir; |
358 | } | 357 | } |
359 | inode_inc_link_count(old_inode); | ||
360 | err = ext2_add_link(new_dentry, old_inode); | 358 | err = ext2_add_link(new_dentry, old_inode); |
361 | if (err) { | 359 | if (err) |
362 | inode_dec_link_count(old_inode); | ||
363 | goto out_dir; | 360 | goto out_dir; |
364 | } | ||
365 | if (dir_de) | 361 | if (dir_de) |
366 | inode_inc_link_count(new_dir); | 362 | inode_inc_link_count(new_dir); |
367 | } | 363 | } |
@@ -369,12 +365,11 @@ static int ext2_rename (struct inode * old_dir, struct dentry * old_dentry, | |||
369 | /* | 365 | /* |
370 | * Like most other Unix systems, set the ctime for inodes on a | 366 | * Like most other Unix systems, set the ctime for inodes on a |
371 | * rename. | 367 | * rename. |
372 | * inode_dec_link_count() will mark the inode dirty. | ||
373 | */ | 368 | */ |
374 | old_inode->i_ctime = CURRENT_TIME_SEC; | 369 | old_inode->i_ctime = CURRENT_TIME_SEC; |
370 | mark_inode_dirty(old_inode); | ||
375 | 371 | ||
376 | ext2_delete_entry (old_de, old_page); | 372 | ext2_delete_entry (old_de, old_page); |
377 | inode_dec_link_count(old_inode); | ||
378 | 373 | ||
379 | if (dir_de) { | 374 | if (dir_de) { |
380 | if (old_dir != new_dir) | 375 | if (old_dir != new_dir) |
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index b27ba71810ec..561f69256266 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -2253,13 +2253,6 @@ static int ext3_link (struct dentry * old_dentry, | |||
2253 | 2253 | ||
2254 | dquot_initialize(dir); | 2254 | dquot_initialize(dir); |
2255 | 2255 | ||
2256 | /* | ||
2257 | * Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing | ||
2258 | * otherwise has the potential to corrupt the orphan inode list. | ||
2259 | */ | ||
2260 | if (inode->i_nlink == 0) | ||
2261 | return -ENOENT; | ||
2262 | |||
2263 | retry: | 2256 | retry: |
2264 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + | 2257 | handle = ext3_journal_start(dir, EXT3_DATA_TRANS_BLOCKS(dir->i_sb) + |
2265 | EXT3_INDEX_EXTRA_TRANS_BLOCKS); | 2258 | EXT3_INDEX_EXTRA_TRANS_BLOCKS); |
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index 85c8cc8f2473..9cc19a1dea8e 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -1936,6 +1936,7 @@ static int ext3_fill_super (struct super_block *sb, void *data, int silent) | |||
1936 | sb->s_qcop = &ext3_qctl_operations; | 1936 | sb->s_qcop = &ext3_qctl_operations; |
1937 | sb->dq_op = &ext3_quota_operations; | 1937 | sb->dq_op = &ext3_quota_operations; |
1938 | #endif | 1938 | #endif |
1939 | memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid)); | ||
1939 | INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */ | 1940 | INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */ |
1940 | mutex_init(&sbi->s_orphan_lock); | 1941 | mutex_init(&sbi->s_orphan_lock); |
1941 | mutex_init(&sbi->s_resize_lock); | 1942 | mutex_init(&sbi->s_resize_lock); |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 5485390d32c5..e781b7ea5630 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -2304,13 +2304,6 @@ static int ext4_link(struct dentry *old_dentry, | |||
2304 | 2304 | ||
2305 | dquot_initialize(dir); | 2305 | dquot_initialize(dir); |
2306 | 2306 | ||
2307 | /* | ||
2308 | * Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing | ||
2309 | * otherwise has the potential to corrupt the orphan inode list. | ||
2310 | */ | ||
2311 | if (inode->i_nlink == 0) | ||
2312 | return -ENOENT; | ||
2313 | |||
2314 | retry: | 2307 | retry: |
2315 | handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + | 2308 | handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + |
2316 | EXT4_INDEX_EXTRA_TRANS_BLOCKS); | 2309 | EXT4_INDEX_EXTRA_TRANS_BLOCKS); |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index f6a318f836b2..5977b356a435 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -3415,6 +3415,8 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3415 | sb->s_qcop = &ext4_qctl_operations; | 3415 | sb->s_qcop = &ext4_qctl_operations; |
3416 | sb->dq_op = &ext4_quota_operations; | 3416 | sb->dq_op = &ext4_quota_operations; |
3417 | #endif | 3417 | #endif |
3418 | memcpy(sb->s_uuid, es->s_uuid, sizeof(es->s_uuid)); | ||
3419 | |||
3418 | INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */ | 3420 | INIT_LIST_HEAD(&sbi->s_orphan); /* unlinked but open files */ |
3419 | mutex_init(&sbi->s_orphan_lock); | 3421 | mutex_init(&sbi->s_orphan_lock); |
3420 | mutex_init(&sbi->s_resize_lock); | 3422 | mutex_init(&sbi->s_resize_lock); |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 86753fe10bd1..0e277ec4b612 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -757,8 +757,10 @@ fat_encode_fh(struct dentry *de, __u32 *fh, int *lenp, int connectable) | |||
757 | struct inode *inode = de->d_inode; | 757 | struct inode *inode = de->d_inode; |
758 | u32 ipos_h, ipos_m, ipos_l; | 758 | u32 ipos_h, ipos_m, ipos_l; |
759 | 759 | ||
760 | if (len < 5) | 760 | if (len < 5) { |
761 | *lenp = 5; | ||
761 | return 255; /* no room */ | 762 | return 255; /* no room */ |
763 | } | ||
762 | 764 | ||
763 | ipos_h = MSDOS_I(inode)->i_pos >> 8; | 765 | ipos_h = MSDOS_I(inode)->i_pos >> 8; |
764 | ipos_m = (MSDOS_I(inode)->i_pos & 0xf0) << 24; | 766 | ipos_m = (MSDOS_I(inode)->i_pos & 0xf0) << 24; |
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index f88f752babd9..adae3fb7451a 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
@@ -43,7 +43,7 @@ static int vfat_revalidate_shortname(struct dentry *dentry) | |||
43 | 43 | ||
44 | static int vfat_revalidate(struct dentry *dentry, struct nameidata *nd) | 44 | static int vfat_revalidate(struct dentry *dentry, struct nameidata *nd) |
45 | { | 45 | { |
46 | if (nd->flags & LOOKUP_RCU) | 46 | if (nd && nd->flags & LOOKUP_RCU) |
47 | return -ECHILD; | 47 | return -ECHILD; |
48 | 48 | ||
49 | /* This is not negative dentry. Always valid. */ | 49 | /* This is not negative dentry. Always valid. */ |
@@ -54,7 +54,7 @@ static int vfat_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
54 | 54 | ||
55 | static int vfat_revalidate_ci(struct dentry *dentry, struct nameidata *nd) | 55 | static int vfat_revalidate_ci(struct dentry *dentry, struct nameidata *nd) |
56 | { | 56 | { |
57 | if (nd->flags & LOOKUP_RCU) | 57 | if (nd && nd->flags & LOOKUP_RCU) |
58 | return -ECHILD; | 58 | return -ECHILD; |
59 | 59 | ||
60 | /* | 60 | /* |
diff --git a/fs/fcntl.c b/fs/fcntl.c index cb1026181bdc..6c82e5bac039 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c | |||
@@ -131,7 +131,7 @@ SYSCALL_DEFINE2(dup2, unsigned int, oldfd, unsigned int, newfd) | |||
131 | SYSCALL_DEFINE1(dup, unsigned int, fildes) | 131 | SYSCALL_DEFINE1(dup, unsigned int, fildes) |
132 | { | 132 | { |
133 | int ret = -EBADF; | 133 | int ret = -EBADF; |
134 | struct file *file = fget(fildes); | 134 | struct file *file = fget_raw(fildes); |
135 | 135 | ||
136 | if (file) { | 136 | if (file) { |
137 | ret = get_unused_fd(); | 137 | ret = get_unused_fd(); |
@@ -426,15 +426,35 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg, | |||
426 | return err; | 426 | return err; |
427 | } | 427 | } |
428 | 428 | ||
429 | static int check_fcntl_cmd(unsigned cmd) | ||
430 | { | ||
431 | switch (cmd) { | ||
432 | case F_DUPFD: | ||
433 | case F_DUPFD_CLOEXEC: | ||
434 | case F_GETFD: | ||
435 | case F_SETFD: | ||
436 | case F_GETFL: | ||
437 | return 1; | ||
438 | } | ||
439 | return 0; | ||
440 | } | ||
441 | |||
429 | SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, unsigned long, arg) | 442 | SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, unsigned long, arg) |
430 | { | 443 | { |
431 | struct file *filp; | 444 | struct file *filp; |
432 | long err = -EBADF; | 445 | long err = -EBADF; |
433 | 446 | ||
434 | filp = fget(fd); | 447 | filp = fget_raw(fd); |
435 | if (!filp) | 448 | if (!filp) |
436 | goto out; | 449 | goto out; |
437 | 450 | ||
451 | if (unlikely(filp->f_mode & FMODE_PATH)) { | ||
452 | if (!check_fcntl_cmd(cmd)) { | ||
453 | fput(filp); | ||
454 | goto out; | ||
455 | } | ||
456 | } | ||
457 | |||
438 | err = security_file_fcntl(filp, cmd, arg); | 458 | err = security_file_fcntl(filp, cmd, arg); |
439 | if (err) { | 459 | if (err) { |
440 | fput(filp); | 460 | fput(filp); |
@@ -456,10 +476,17 @@ SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd, | |||
456 | long err; | 476 | long err; |
457 | 477 | ||
458 | err = -EBADF; | 478 | err = -EBADF; |
459 | filp = fget(fd); | 479 | filp = fget_raw(fd); |
460 | if (!filp) | 480 | if (!filp) |
461 | goto out; | 481 | goto out; |
462 | 482 | ||
483 | if (unlikely(filp->f_mode & FMODE_PATH)) { | ||
484 | if (!check_fcntl_cmd(cmd)) { | ||
485 | fput(filp); | ||
486 | goto out; | ||
487 | } | ||
488 | } | ||
489 | |||
463 | err = security_file_fcntl(filp, cmd, arg); | 490 | err = security_file_fcntl(filp, cmd, arg); |
464 | if (err) { | 491 | if (err) { |
465 | fput(filp); | 492 | fput(filp); |
@@ -808,14 +835,14 @@ static int __init fcntl_init(void) | |||
808 | * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY | 835 | * Exceptions: O_NONBLOCK is a two bit define on parisc; O_NDELAY |
809 | * is defined as O_NONBLOCK on some platforms and not on others. | 836 | * is defined as O_NONBLOCK on some platforms and not on others. |
810 | */ | 837 | */ |
811 | BUILD_BUG_ON(18 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( | 838 | BUILD_BUG_ON(19 - 1 /* for O_RDONLY being 0 */ != HWEIGHT32( |
812 | O_RDONLY | O_WRONLY | O_RDWR | | 839 | O_RDONLY | O_WRONLY | O_RDWR | |
813 | O_CREAT | O_EXCL | O_NOCTTY | | 840 | O_CREAT | O_EXCL | O_NOCTTY | |
814 | O_TRUNC | O_APPEND | /* O_NONBLOCK | */ | 841 | O_TRUNC | O_APPEND | /* O_NONBLOCK | */ |
815 | __O_SYNC | O_DSYNC | FASYNC | | 842 | __O_SYNC | O_DSYNC | FASYNC | |
816 | O_DIRECT | O_LARGEFILE | O_DIRECTORY | | 843 | O_DIRECT | O_LARGEFILE | O_DIRECTORY | |
817 | O_NOFOLLOW | O_NOATIME | O_CLOEXEC | | 844 | O_NOFOLLOW | O_NOATIME | O_CLOEXEC | |
818 | __FMODE_EXEC | 845 | __FMODE_EXEC | O_PATH |
819 | )); | 846 | )); |
820 | 847 | ||
821 | fasync_cache = kmem_cache_create("fasync_cache", | 848 | fasync_cache = kmem_cache_create("fasync_cache", |
diff --git a/fs/fhandle.c b/fs/fhandle.c new file mode 100644 index 000000000000..bf93ad2bee07 --- /dev/null +++ b/fs/fhandle.c | |||
@@ -0,0 +1,265 @@ | |||
1 | #include <linux/syscalls.h> | ||
2 | #include <linux/slab.h> | ||
3 | #include <linux/fs.h> | ||
4 | #include <linux/file.h> | ||
5 | #include <linux/mount.h> | ||
6 | #include <linux/namei.h> | ||
7 | #include <linux/exportfs.h> | ||
8 | #include <linux/fs_struct.h> | ||
9 | #include <linux/fsnotify.h> | ||
10 | #include <asm/uaccess.h> | ||
11 | #include "internal.h" | ||
12 | |||
13 | static long do_sys_name_to_handle(struct path *path, | ||
14 | struct file_handle __user *ufh, | ||
15 | int __user *mnt_id) | ||
16 | { | ||
17 | long retval; | ||
18 | struct file_handle f_handle; | ||
19 | int handle_dwords, handle_bytes; | ||
20 | struct file_handle *handle = NULL; | ||
21 | |||
22 | /* | ||
23 | * We need t make sure wether the file system | ||
24 | * support decoding of the file handle | ||
25 | */ | ||
26 | if (!path->mnt->mnt_sb->s_export_op || | ||
27 | !path->mnt->mnt_sb->s_export_op->fh_to_dentry) | ||
28 | return -EOPNOTSUPP; | ||
29 | |||
30 | if (copy_from_user(&f_handle, ufh, sizeof(struct file_handle))) | ||
31 | return -EFAULT; | ||
32 | |||
33 | if (f_handle.handle_bytes > MAX_HANDLE_SZ) | ||
34 | return -EINVAL; | ||
35 | |||
36 | handle = kmalloc(sizeof(struct file_handle) + f_handle.handle_bytes, | ||
37 | GFP_KERNEL); | ||
38 | if (!handle) | ||
39 | return -ENOMEM; | ||
40 | |||
41 | /* convert handle size to multiple of sizeof(u32) */ | ||
42 | handle_dwords = f_handle.handle_bytes >> 2; | ||
43 | |||
44 | /* we ask for a non connected handle */ | ||
45 | retval = exportfs_encode_fh(path->dentry, | ||
46 | (struct fid *)handle->f_handle, | ||
47 | &handle_dwords, 0); | ||
48 | handle->handle_type = retval; | ||
49 | /* convert handle size to bytes */ | ||
50 | handle_bytes = handle_dwords * sizeof(u32); | ||
51 | handle->handle_bytes = handle_bytes; | ||
52 | if ((handle->handle_bytes > f_handle.handle_bytes) || | ||
53 | (retval == 255) || (retval == -ENOSPC)) { | ||
54 | /* As per old exportfs_encode_fh documentation | ||
55 | * we could return ENOSPC to indicate overflow | ||
56 | * But file system returned 255 always. So handle | ||
57 | * both the values | ||
58 | */ | ||
59 | /* | ||
60 | * set the handle size to zero so we copy only | ||
61 | * non variable part of the file_handle | ||
62 | */ | ||
63 | handle_bytes = 0; | ||
64 | retval = -EOVERFLOW; | ||
65 | } else | ||
66 | retval = 0; | ||
67 | /* copy the mount id */ | ||
68 | if (copy_to_user(mnt_id, &path->mnt->mnt_id, sizeof(*mnt_id)) || | ||
69 | copy_to_user(ufh, handle, | ||
70 | sizeof(struct file_handle) + handle_bytes)) | ||
71 | retval = -EFAULT; | ||
72 | kfree(handle); | ||
73 | return retval; | ||
74 | } | ||
75 | |||
76 | /** | ||
77 | * sys_name_to_handle_at: convert name to handle | ||
78 | * @dfd: directory relative to which name is interpreted if not absolute | ||
79 | * @name: name that should be converted to handle. | ||
80 | * @handle: resulting file handle | ||
81 | * @mnt_id: mount id of the file system containing the file | ||
82 | * @flag: flag value to indicate whether to follow symlink or not | ||
83 | * | ||
84 | * @handle->handle_size indicate the space available to store the | ||
85 | * variable part of the file handle in bytes. If there is not | ||
86 | * enough space, the field is updated to return the minimum | ||
87 | * value required. | ||
88 | */ | ||
89 | SYSCALL_DEFINE5(name_to_handle_at, int, dfd, const char __user *, name, | ||
90 | struct file_handle __user *, handle, int __user *, mnt_id, | ||
91 | int, flag) | ||
92 | { | ||
93 | struct path path; | ||
94 | int lookup_flags; | ||
95 | int err; | ||
96 | |||
97 | if ((flag & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0) | ||
98 | return -EINVAL; | ||
99 | |||
100 | lookup_flags = (flag & AT_SYMLINK_FOLLOW) ? LOOKUP_FOLLOW : 0; | ||
101 | if (flag & AT_EMPTY_PATH) | ||
102 | lookup_flags |= LOOKUP_EMPTY; | ||
103 | err = user_path_at(dfd, name, lookup_flags, &path); | ||
104 | if (!err) { | ||
105 | err = do_sys_name_to_handle(&path, handle, mnt_id); | ||
106 | path_put(&path); | ||
107 | } | ||
108 | return err; | ||
109 | } | ||
110 | |||
111 | static struct vfsmount *get_vfsmount_from_fd(int fd) | ||
112 | { | ||
113 | struct path path; | ||
114 | |||
115 | if (fd == AT_FDCWD) { | ||
116 | struct fs_struct *fs = current->fs; | ||
117 | spin_lock(&fs->lock); | ||
118 | path = fs->pwd; | ||
119 | mntget(path.mnt); | ||
120 | spin_unlock(&fs->lock); | ||
121 | } else { | ||
122 | int fput_needed; | ||
123 | struct file *file = fget_light(fd, &fput_needed); | ||
124 | if (!file) | ||
125 | return ERR_PTR(-EBADF); | ||
126 | path = file->f_path; | ||
127 | mntget(path.mnt); | ||
128 | fput_light(file, fput_needed); | ||
129 | } | ||
130 | return path.mnt; | ||
131 | } | ||
132 | |||
133 | static int vfs_dentry_acceptable(void *context, struct dentry *dentry) | ||
134 | { | ||
135 | return 1; | ||
136 | } | ||
137 | |||
138 | static int do_handle_to_path(int mountdirfd, struct file_handle *handle, | ||
139 | struct path *path) | ||
140 | { | ||
141 | int retval = 0; | ||
142 | int handle_dwords; | ||
143 | |||
144 | path->mnt = get_vfsmount_from_fd(mountdirfd); | ||
145 | if (IS_ERR(path->mnt)) { | ||
146 | retval = PTR_ERR(path->mnt); | ||
147 | goto out_err; | ||
148 | } | ||
149 | /* change the handle size to multiple of sizeof(u32) */ | ||
150 | handle_dwords = handle->handle_bytes >> 2; | ||
151 | path->dentry = exportfs_decode_fh(path->mnt, | ||
152 | (struct fid *)handle->f_handle, | ||
153 | handle_dwords, handle->handle_type, | ||
154 | vfs_dentry_acceptable, NULL); | ||
155 | if (IS_ERR(path->dentry)) { | ||
156 | retval = PTR_ERR(path->dentry); | ||
157 | goto out_mnt; | ||
158 | } | ||
159 | return 0; | ||
160 | out_mnt: | ||
161 | mntput(path->mnt); | ||
162 | out_err: | ||
163 | return retval; | ||
164 | } | ||
165 | |||
166 | static int handle_to_path(int mountdirfd, struct file_handle __user *ufh, | ||
167 | struct path *path) | ||
168 | { | ||
169 | int retval = 0; | ||
170 | struct file_handle f_handle; | ||
171 | struct file_handle *handle = NULL; | ||
172 | |||
173 | /* | ||
174 | * With handle we don't look at the execute bit on the | ||
175 | * the directory. Ideally we would like CAP_DAC_SEARCH. | ||
176 | * But we don't have that | ||
177 | */ | ||
178 | if (!capable(CAP_DAC_READ_SEARCH)) { | ||
179 | retval = -EPERM; | ||
180 | goto out_err; | ||
181 | } | ||
182 | if (copy_from_user(&f_handle, ufh, sizeof(struct file_handle))) { | ||
183 | retval = -EFAULT; | ||
184 | goto out_err; | ||
185 | } | ||
186 | if ((f_handle.handle_bytes > MAX_HANDLE_SZ) || | ||
187 | (f_handle.handle_bytes == 0)) { | ||
188 | retval = -EINVAL; | ||
189 | goto out_err; | ||
190 | } | ||
191 | handle = kmalloc(sizeof(struct file_handle) + f_handle.handle_bytes, | ||
192 | GFP_KERNEL); | ||
193 | if (!handle) { | ||
194 | retval = -ENOMEM; | ||
195 | goto out_err; | ||
196 | } | ||
197 | /* copy the full handle */ | ||
198 | if (copy_from_user(handle, ufh, | ||
199 | sizeof(struct file_handle) + | ||
200 | f_handle.handle_bytes)) { | ||
201 | retval = -EFAULT; | ||
202 | goto out_handle; | ||
203 | } | ||
204 | |||
205 | retval = do_handle_to_path(mountdirfd, handle, path); | ||
206 | |||
207 | out_handle: | ||
208 | kfree(handle); | ||
209 | out_err: | ||
210 | return retval; | ||
211 | } | ||
212 | |||
213 | long do_handle_open(int mountdirfd, | ||
214 | struct file_handle __user *ufh, int open_flag) | ||
215 | { | ||
216 | long retval = 0; | ||
217 | struct path path; | ||
218 | struct file *file; | ||
219 | int fd; | ||
220 | |||
221 | retval = handle_to_path(mountdirfd, ufh, &path); | ||
222 | if (retval) | ||
223 | return retval; | ||
224 | |||
225 | fd = get_unused_fd_flags(open_flag); | ||
226 | if (fd < 0) { | ||
227 | path_put(&path); | ||
228 | return fd; | ||
229 | } | ||
230 | file = file_open_root(path.dentry, path.mnt, "", open_flag); | ||
231 | if (IS_ERR(file)) { | ||
232 | put_unused_fd(fd); | ||
233 | retval = PTR_ERR(file); | ||
234 | } else { | ||
235 | retval = fd; | ||
236 | fsnotify_open(file); | ||
237 | fd_install(fd, file); | ||
238 | } | ||
239 | path_put(&path); | ||
240 | return retval; | ||
241 | } | ||
242 | |||
243 | /** | ||
244 | * sys_open_by_handle_at: Open the file handle | ||
245 | * @mountdirfd: directory file descriptor | ||
246 | * @handle: file handle to be opened | ||
247 | * @flag: open flags. | ||
248 | * | ||
249 | * @mountdirfd indicate the directory file descriptor | ||
250 | * of the mount point. file handle is decoded relative | ||
251 | * to the vfsmount pointed by the @mountdirfd. @flags | ||
252 | * value is same as the open(2) flags. | ||
253 | */ | ||
254 | SYSCALL_DEFINE3(open_by_handle_at, int, mountdirfd, | ||
255 | struct file_handle __user *, handle, | ||
256 | int, flags) | ||
257 | { | ||
258 | long ret; | ||
259 | |||
260 | if (force_o_largefile()) | ||
261 | flags |= O_LARGEFILE; | ||
262 | |||
263 | ret = do_handle_open(mountdirfd, handle, flags); | ||
264 | return ret; | ||
265 | } | ||
diff --git a/fs/file_table.c b/fs/file_table.c index eb36b6b17e26..74a9544ac770 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -276,11 +276,10 @@ struct file *fget(unsigned int fd) | |||
276 | rcu_read_lock(); | 276 | rcu_read_lock(); |
277 | file = fcheck_files(files, fd); | 277 | file = fcheck_files(files, fd); |
278 | if (file) { | 278 | if (file) { |
279 | if (!atomic_long_inc_not_zero(&file->f_count)) { | 279 | /* File object ref couldn't be taken */ |
280 | /* File object ref couldn't be taken */ | 280 | if (file->f_mode & FMODE_PATH || |
281 | rcu_read_unlock(); | 281 | !atomic_long_inc_not_zero(&file->f_count)) |
282 | return NULL; | 282 | file = NULL; |
283 | } | ||
284 | } | 283 | } |
285 | rcu_read_unlock(); | 284 | rcu_read_unlock(); |
286 | 285 | ||
@@ -289,6 +288,25 @@ struct file *fget(unsigned int fd) | |||
289 | 288 | ||
290 | EXPORT_SYMBOL(fget); | 289 | EXPORT_SYMBOL(fget); |
291 | 290 | ||
291 | struct file *fget_raw(unsigned int fd) | ||
292 | { | ||
293 | struct file *file; | ||
294 | struct files_struct *files = current->files; | ||
295 | |||
296 | rcu_read_lock(); | ||
297 | file = fcheck_files(files, fd); | ||
298 | if (file) { | ||
299 | /* File object ref couldn't be taken */ | ||
300 | if (!atomic_long_inc_not_zero(&file->f_count)) | ||
301 | file = NULL; | ||
302 | } | ||
303 | rcu_read_unlock(); | ||
304 | |||
305 | return file; | ||
306 | } | ||
307 | |||
308 | EXPORT_SYMBOL(fget_raw); | ||
309 | |||
292 | /* | 310 | /* |
293 | * Lightweight file lookup - no refcnt increment if fd table isn't shared. | 311 | * Lightweight file lookup - no refcnt increment if fd table isn't shared. |
294 | * | 312 | * |
@@ -313,6 +331,33 @@ struct file *fget_light(unsigned int fd, int *fput_needed) | |||
313 | *fput_needed = 0; | 331 | *fput_needed = 0; |
314 | if (atomic_read(&files->count) == 1) { | 332 | if (atomic_read(&files->count) == 1) { |
315 | file = fcheck_files(files, fd); | 333 | file = fcheck_files(files, fd); |
334 | if (file && (file->f_mode & FMODE_PATH)) | ||
335 | file = NULL; | ||
336 | } else { | ||
337 | rcu_read_lock(); | ||
338 | file = fcheck_files(files, fd); | ||
339 | if (file) { | ||
340 | if (!(file->f_mode & FMODE_PATH) && | ||
341 | atomic_long_inc_not_zero(&file->f_count)) | ||
342 | *fput_needed = 1; | ||
343 | else | ||
344 | /* Didn't get the reference, someone's freed */ | ||
345 | file = NULL; | ||
346 | } | ||
347 | rcu_read_unlock(); | ||
348 | } | ||
349 | |||
350 | return file; | ||
351 | } | ||
352 | |||
353 | struct file *fget_raw_light(unsigned int fd, int *fput_needed) | ||
354 | { | ||
355 | struct file *file; | ||
356 | struct files_struct *files = current->files; | ||
357 | |||
358 | *fput_needed = 0; | ||
359 | if (atomic_read(&files->count) == 1) { | ||
360 | file = fcheck_files(files, fd); | ||
316 | } else { | 361 | } else { |
317 | rcu_read_lock(); | 362 | rcu_read_lock(); |
318 | file = fcheck_files(files, fd); | 363 | file = fcheck_files(files, fd); |
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index bfed8447ed80..8bd0ef9286c3 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -158,7 +158,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd) | |||
158 | { | 158 | { |
159 | struct inode *inode; | 159 | struct inode *inode; |
160 | 160 | ||
161 | if (nd->flags & LOOKUP_RCU) | 161 | if (nd && nd->flags & LOOKUP_RCU) |
162 | return -ECHILD; | 162 | return -ECHILD; |
163 | 163 | ||
164 | inode = entry->d_inode; | 164 | inode = entry->d_inode; |
@@ -1283,8 +1283,11 @@ static int fuse_do_setattr(struct dentry *entry, struct iattr *attr, | |||
1283 | if (err) | 1283 | if (err) |
1284 | return err; | 1284 | return err; |
1285 | 1285 | ||
1286 | if ((attr->ia_valid & ATTR_OPEN) && fc->atomic_o_trunc) | 1286 | if (attr->ia_valid & ATTR_OPEN) { |
1287 | return 0; | 1287 | if (fc->atomic_o_trunc) |
1288 | return 0; | ||
1289 | file = NULL; | ||
1290 | } | ||
1288 | 1291 | ||
1289 | if (attr->ia_valid & ATTR_SIZE) | 1292 | if (attr->ia_valid & ATTR_SIZE) |
1290 | is_truncate = true; | 1293 | is_truncate = true; |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 95da1bc1c826..9e0832dbb1e3 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -86,18 +86,52 @@ struct fuse_file *fuse_file_get(struct fuse_file *ff) | |||
86 | return ff; | 86 | return ff; |
87 | } | 87 | } |
88 | 88 | ||
89 | static void fuse_release_async(struct work_struct *work) | ||
90 | { | ||
91 | struct fuse_req *req; | ||
92 | struct fuse_conn *fc; | ||
93 | struct path path; | ||
94 | |||
95 | req = container_of(work, struct fuse_req, misc.release.work); | ||
96 | path = req->misc.release.path; | ||
97 | fc = get_fuse_conn(path.dentry->d_inode); | ||
98 | |||
99 | fuse_put_request(fc, req); | ||
100 | path_put(&path); | ||
101 | } | ||
102 | |||
89 | static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req) | 103 | static void fuse_release_end(struct fuse_conn *fc, struct fuse_req *req) |
90 | { | 104 | { |
91 | path_put(&req->misc.release.path); | 105 | if (fc->destroy_req) { |
106 | /* | ||
107 | * If this is a fuseblk mount, then it's possible that | ||
108 | * releasing the path will result in releasing the | ||
109 | * super block and sending the DESTROY request. If | ||
110 | * the server is single threaded, this would hang. | ||
111 | * For this reason do the path_put() in a separate | ||
112 | * thread. | ||
113 | */ | ||
114 | atomic_inc(&req->count); | ||
115 | INIT_WORK(&req->misc.release.work, fuse_release_async); | ||
116 | schedule_work(&req->misc.release.work); | ||
117 | } else { | ||
118 | path_put(&req->misc.release.path); | ||
119 | } | ||
92 | } | 120 | } |
93 | 121 | ||
94 | static void fuse_file_put(struct fuse_file *ff) | 122 | static void fuse_file_put(struct fuse_file *ff, bool sync) |
95 | { | 123 | { |
96 | if (atomic_dec_and_test(&ff->count)) { | 124 | if (atomic_dec_and_test(&ff->count)) { |
97 | struct fuse_req *req = ff->reserved_req; | 125 | struct fuse_req *req = ff->reserved_req; |
98 | 126 | ||
99 | req->end = fuse_release_end; | 127 | if (sync) { |
100 | fuse_request_send_background(ff->fc, req); | 128 | fuse_request_send(ff->fc, req); |
129 | path_put(&req->misc.release.path); | ||
130 | fuse_put_request(ff->fc, req); | ||
131 | } else { | ||
132 | req->end = fuse_release_end; | ||
133 | fuse_request_send_background(ff->fc, req); | ||
134 | } | ||
101 | kfree(ff); | 135 | kfree(ff); |
102 | } | 136 | } |
103 | } | 137 | } |
@@ -219,8 +253,12 @@ void fuse_release_common(struct file *file, int opcode) | |||
219 | * Normally this will send the RELEASE request, however if | 253 | * Normally this will send the RELEASE request, however if |
220 | * some asynchronous READ or WRITE requests are outstanding, | 254 | * some asynchronous READ or WRITE requests are outstanding, |
221 | * the sending will be delayed. | 255 | * the sending will be delayed. |
256 | * | ||
257 | * Make the release synchronous if this is a fuseblk mount, | ||
258 | * synchronous RELEASE is allowed (and desirable) in this case | ||
259 | * because the server can be trusted not to screw up. | ||
222 | */ | 260 | */ |
223 | fuse_file_put(ff); | 261 | fuse_file_put(ff, ff->fc->destroy_req != NULL); |
224 | } | 262 | } |
225 | 263 | ||
226 | static int fuse_open(struct inode *inode, struct file *file) | 264 | static int fuse_open(struct inode *inode, struct file *file) |
@@ -558,7 +596,7 @@ static void fuse_readpages_end(struct fuse_conn *fc, struct fuse_req *req) | |||
558 | page_cache_release(page); | 596 | page_cache_release(page); |
559 | } | 597 | } |
560 | if (req->ff) | 598 | if (req->ff) |
561 | fuse_file_put(req->ff); | 599 | fuse_file_put(req->ff, false); |
562 | } | 600 | } |
563 | 601 | ||
564 | static void fuse_send_readpages(struct fuse_req *req, struct file *file) | 602 | static void fuse_send_readpages(struct fuse_req *req, struct file *file) |
@@ -1137,7 +1175,7 @@ static ssize_t fuse_direct_write(struct file *file, const char __user *buf, | |||
1137 | static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req) | 1175 | static void fuse_writepage_free(struct fuse_conn *fc, struct fuse_req *req) |
1138 | { | 1176 | { |
1139 | __free_page(req->pages[0]); | 1177 | __free_page(req->pages[0]); |
1140 | fuse_file_put(req->ff); | 1178 | fuse_file_put(req->ff, false); |
1141 | } | 1179 | } |
1142 | 1180 | ||
1143 | static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req) | 1181 | static void fuse_writepage_finish(struct fuse_conn *fc, struct fuse_req *req) |
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index ae5744a2f9e9..d4286947bc2c 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/rwsem.h> | 21 | #include <linux/rwsem.h> |
22 | #include <linux/rbtree.h> | 22 | #include <linux/rbtree.h> |
23 | #include <linux/poll.h> | 23 | #include <linux/poll.h> |
24 | #include <linux/workqueue.h> | ||
24 | 25 | ||
25 | /** Max number of pages that can be used in a single read request */ | 26 | /** Max number of pages that can be used in a single read request */ |
26 | #define FUSE_MAX_PAGES_PER_REQ 32 | 27 | #define FUSE_MAX_PAGES_PER_REQ 32 |
@@ -262,7 +263,10 @@ struct fuse_req { | |||
262 | /** Data for asynchronous requests */ | 263 | /** Data for asynchronous requests */ |
263 | union { | 264 | union { |
264 | struct { | 265 | struct { |
265 | struct fuse_release_in in; | 266 | union { |
267 | struct fuse_release_in in; | ||
268 | struct work_struct work; | ||
269 | }; | ||
266 | struct path path; | 270 | struct path path; |
267 | } release; | 271 | } release; |
268 | struct fuse_init_in init_in; | 272 | struct fuse_init_in init_in; |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 9e3f68cc1bd1..051b1a084528 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -637,8 +637,10 @@ static int fuse_encode_fh(struct dentry *dentry, u32 *fh, int *max_len, | |||
637 | u64 nodeid; | 637 | u64 nodeid; |
638 | u32 generation; | 638 | u32 generation; |
639 | 639 | ||
640 | if (*max_len < len) | 640 | if (*max_len < len) { |
641 | *max_len = len; | ||
641 | return 255; | 642 | return 255; |
643 | } | ||
642 | 644 | ||
643 | nodeid = get_fuse_inode(inode)->nodeid; | 645 | nodeid = get_fuse_inode(inode)->nodeid; |
644 | generation = inode->i_generation; | 646 | generation = inode->i_generation; |
diff --git a/fs/gfs2/dentry.c b/fs/gfs2/dentry.c index 4a456338b873..0da8da2c991d 100644 --- a/fs/gfs2/dentry.c +++ b/fs/gfs2/dentry.c | |||
@@ -44,7 +44,7 @@ static int gfs2_drevalidate(struct dentry *dentry, struct nameidata *nd) | |||
44 | int error; | 44 | int error; |
45 | int had_lock = 0; | 45 | int had_lock = 0; |
46 | 46 | ||
47 | if (nd->flags & LOOKUP_RCU) | 47 | if (nd && nd->flags & LOOKUP_RCU) |
48 | return -ECHILD; | 48 | return -ECHILD; |
49 | 49 | ||
50 | parent = dget_parent(dentry); | 50 | parent = dget_parent(dentry); |
diff --git a/fs/gfs2/export.c b/fs/gfs2/export.c index 9023db8184f9..b5a5e60df0d5 100644 --- a/fs/gfs2/export.c +++ b/fs/gfs2/export.c | |||
@@ -36,9 +36,13 @@ static int gfs2_encode_fh(struct dentry *dentry, __u32 *p, int *len, | |||
36 | struct super_block *sb = inode->i_sb; | 36 | struct super_block *sb = inode->i_sb; |
37 | struct gfs2_inode *ip = GFS2_I(inode); | 37 | struct gfs2_inode *ip = GFS2_I(inode); |
38 | 38 | ||
39 | if (*len < GFS2_SMALL_FH_SIZE || | 39 | if (connectable && (*len < GFS2_LARGE_FH_SIZE)) { |
40 | (connectable && *len < GFS2_LARGE_FH_SIZE)) | 40 | *len = GFS2_LARGE_FH_SIZE; |
41 | return 255; | 41 | return 255; |
42 | } else if (*len < GFS2_SMALL_FH_SIZE) { | ||
43 | *len = GFS2_SMALL_FH_SIZE; | ||
44 | return 255; | ||
45 | } | ||
42 | 46 | ||
43 | fh[0] = cpu_to_be32(ip->i_no_formal_ino >> 32); | 47 | fh[0] = cpu_to_be32(ip->i_no_formal_ino >> 32); |
44 | fh[1] = cpu_to_be32(ip->i_no_formal_ino & 0xFFFFFFFF); | 48 | fh[1] = cpu_to_be32(ip->i_no_formal_ino & 0xFFFFFFFF); |
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c index 85ba027d1c4d..72c31a315d96 100644 --- a/fs/gfs2/main.c +++ b/fs/gfs2/main.c | |||
@@ -59,14 +59,7 @@ static void gfs2_init_gl_aspace_once(void *foo) | |||
59 | struct address_space *mapping = (struct address_space *)(gl + 1); | 59 | struct address_space *mapping = (struct address_space *)(gl + 1); |
60 | 60 | ||
61 | gfs2_init_glock_once(gl); | 61 | gfs2_init_glock_once(gl); |
62 | memset(mapping, 0, sizeof(*mapping)); | 62 | address_space_init_once(mapping); |
63 | INIT_RADIX_TREE(&mapping->page_tree, GFP_ATOMIC); | ||
64 | spin_lock_init(&mapping->tree_lock); | ||
65 | spin_lock_init(&mapping->i_mmap_lock); | ||
66 | INIT_LIST_HEAD(&mapping->private_list); | ||
67 | spin_lock_init(&mapping->private_lock); | ||
68 | INIT_RAW_PRIO_TREE_ROOT(&mapping->i_mmap); | ||
69 | INIT_LIST_HEAD(&mapping->i_mmap_nonlinear); | ||
70 | } | 63 | } |
71 | 64 | ||
72 | /** | 65 | /** |
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c index afa66aaa2237..b4d70b13be92 100644 --- a/fs/hfs/dir.c +++ b/fs/hfs/dir.c | |||
@@ -238,46 +238,22 @@ static int hfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
238 | } | 238 | } |
239 | 239 | ||
240 | /* | 240 | /* |
241 | * hfs_unlink() | 241 | * hfs_remove() |
242 | * | 242 | * |
243 | * This is the unlink() entry in the inode_operations structure for | 243 | * This serves as both unlink() and rmdir() in the inode_operations |
244 | * regular HFS directories. The purpose is to delete an existing | 244 | * structure for regular HFS directories. The purpose is to delete |
245 | * file, given the inode for the parent directory and the name | 245 | * an existing child, given the inode for the parent directory and |
246 | * (and its length) of the existing file. | 246 | * the name (and its length) of the existing directory. |
247 | */ | ||
248 | static int hfs_unlink(struct inode *dir, struct dentry *dentry) | ||
249 | { | ||
250 | struct inode *inode; | ||
251 | int res; | ||
252 | |||
253 | inode = dentry->d_inode; | ||
254 | res = hfs_cat_delete(inode->i_ino, dir, &dentry->d_name); | ||
255 | if (res) | ||
256 | return res; | ||
257 | |||
258 | drop_nlink(inode); | ||
259 | hfs_delete_inode(inode); | ||
260 | inode->i_ctime = CURRENT_TIME_SEC; | ||
261 | mark_inode_dirty(inode); | ||
262 | |||
263 | return res; | ||
264 | } | ||
265 | |||
266 | /* | ||
267 | * hfs_rmdir() | ||
268 | * | 247 | * |
269 | * This is the rmdir() entry in the inode_operations structure for | 248 | * HFS does not have hardlinks, so both rmdir and unlink set the |
270 | * regular HFS directories. The purpose is to delete an existing | 249 | * link count to 0. The only difference is the emptiness check. |
271 | * directory, given the inode for the parent directory and the name | ||
272 | * (and its length) of the existing directory. | ||
273 | */ | 250 | */ |
274 | static int hfs_rmdir(struct inode *dir, struct dentry *dentry) | 251 | static int hfs_remove(struct inode *dir, struct dentry *dentry) |
275 | { | 252 | { |
276 | struct inode *inode; | 253 | struct inode *inode = dentry->d_inode; |
277 | int res; | 254 | int res; |
278 | 255 | ||
279 | inode = dentry->d_inode; | 256 | if (S_ISDIR(inode->i_mode) && inode->i_size != 2) |
280 | if (inode->i_size != 2) | ||
281 | return -ENOTEMPTY; | 257 | return -ENOTEMPTY; |
282 | res = hfs_cat_delete(inode->i_ino, dir, &dentry->d_name); | 258 | res = hfs_cat_delete(inode->i_ino, dir, &dentry->d_name); |
283 | if (res) | 259 | if (res) |
@@ -307,7 +283,7 @@ static int hfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
307 | 283 | ||
308 | /* Unlink destination if it already exists */ | 284 | /* Unlink destination if it already exists */ |
309 | if (new_dentry->d_inode) { | 285 | if (new_dentry->d_inode) { |
310 | res = hfs_unlink(new_dir, new_dentry); | 286 | res = hfs_remove(new_dir, new_dentry); |
311 | if (res) | 287 | if (res) |
312 | return res; | 288 | return res; |
313 | } | 289 | } |
@@ -332,9 +308,9 @@ const struct file_operations hfs_dir_operations = { | |||
332 | const struct inode_operations hfs_dir_inode_operations = { | 308 | const struct inode_operations hfs_dir_inode_operations = { |
333 | .create = hfs_create, | 309 | .create = hfs_create, |
334 | .lookup = hfs_lookup, | 310 | .lookup = hfs_lookup, |
335 | .unlink = hfs_unlink, | 311 | .unlink = hfs_remove, |
336 | .mkdir = hfs_mkdir, | 312 | .mkdir = hfs_mkdir, |
337 | .rmdir = hfs_rmdir, | 313 | .rmdir = hfs_remove, |
338 | .rename = hfs_rename, | 314 | .rename = hfs_rename, |
339 | .setattr = hfs_inode_setattr, | 315 | .setattr = hfs_inode_setattr, |
340 | }; | 316 | }; |
diff --git a/fs/inode.c b/fs/inode.c index da85e56378f3..0647d80accf6 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -295,6 +295,20 @@ static void destroy_inode(struct inode *inode) | |||
295 | call_rcu(&inode->i_rcu, i_callback); | 295 | call_rcu(&inode->i_rcu, i_callback); |
296 | } | 296 | } |
297 | 297 | ||
298 | void address_space_init_once(struct address_space *mapping) | ||
299 | { | ||
300 | memset(mapping, 0, sizeof(*mapping)); | ||
301 | INIT_RADIX_TREE(&mapping->page_tree, GFP_ATOMIC); | ||
302 | spin_lock_init(&mapping->tree_lock); | ||
303 | spin_lock_init(&mapping->i_mmap_lock); | ||
304 | INIT_LIST_HEAD(&mapping->private_list); | ||
305 | spin_lock_init(&mapping->private_lock); | ||
306 | INIT_RAW_PRIO_TREE_ROOT(&mapping->i_mmap); | ||
307 | INIT_LIST_HEAD(&mapping->i_mmap_nonlinear); | ||
308 | mutex_init(&mapping->unmap_mutex); | ||
309 | } | ||
310 | EXPORT_SYMBOL(address_space_init_once); | ||
311 | |||
298 | /* | 312 | /* |
299 | * These are initializations that only need to be done | 313 | * These are initializations that only need to be done |
300 | * once, because the fields are idempotent across use | 314 | * once, because the fields are idempotent across use |
@@ -308,13 +322,7 @@ void inode_init_once(struct inode *inode) | |||
308 | INIT_LIST_HEAD(&inode->i_devices); | 322 | INIT_LIST_HEAD(&inode->i_devices); |
309 | INIT_LIST_HEAD(&inode->i_wb_list); | 323 | INIT_LIST_HEAD(&inode->i_wb_list); |
310 | INIT_LIST_HEAD(&inode->i_lru); | 324 | INIT_LIST_HEAD(&inode->i_lru); |
311 | INIT_RADIX_TREE(&inode->i_data.page_tree, GFP_ATOMIC); | 325 | address_space_init_once(&inode->i_data); |
312 | spin_lock_init(&inode->i_data.tree_lock); | ||
313 | spin_lock_init(&inode->i_data.i_mmap_lock); | ||
314 | INIT_LIST_HEAD(&inode->i_data.private_list); | ||
315 | spin_lock_init(&inode->i_data.private_lock); | ||
316 | INIT_RAW_PRIO_TREE_ROOT(&inode->i_data.i_mmap); | ||
317 | INIT_LIST_HEAD(&inode->i_data.i_mmap_nonlinear); | ||
318 | i_size_ordered_init(inode); | 326 | i_size_ordered_init(inode); |
319 | #ifdef CONFIG_FSNOTIFY | 327 | #ifdef CONFIG_FSNOTIFY |
320 | INIT_HLIST_HEAD(&inode->i_fsnotify_marks); | 328 | INIT_HLIST_HEAD(&inode->i_fsnotify_marks); |
@@ -540,11 +548,14 @@ void evict_inodes(struct super_block *sb) | |||
540 | /** | 548 | /** |
541 | * invalidate_inodes - attempt to free all inodes on a superblock | 549 | * invalidate_inodes - attempt to free all inodes on a superblock |
542 | * @sb: superblock to operate on | 550 | * @sb: superblock to operate on |
551 | * @kill_dirty: flag to guide handling of dirty inodes | ||
543 | * | 552 | * |
544 | * Attempts to free all inodes for a given superblock. If there were any | 553 | * Attempts to free all inodes for a given superblock. If there were any |
545 | * busy inodes return a non-zero value, else zero. | 554 | * busy inodes return a non-zero value, else zero. |
555 | * If @kill_dirty is set, discard dirty inodes too, otherwise treat | ||
556 | * them as busy. | ||
546 | */ | 557 | */ |
547 | int invalidate_inodes(struct super_block *sb) | 558 | int invalidate_inodes(struct super_block *sb, bool kill_dirty) |
548 | { | 559 | { |
549 | int busy = 0; | 560 | int busy = 0; |
550 | struct inode *inode, *next; | 561 | struct inode *inode, *next; |
@@ -556,6 +567,10 @@ int invalidate_inodes(struct super_block *sb) | |||
556 | list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { | 567 | list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) { |
557 | if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) | 568 | if (inode->i_state & (I_NEW | I_FREEING | I_WILL_FREE)) |
558 | continue; | 569 | continue; |
570 | if (inode->i_state & I_DIRTY && !kill_dirty) { | ||
571 | busy = 1; | ||
572 | continue; | ||
573 | } | ||
559 | if (atomic_read(&inode->i_count)) { | 574 | if (atomic_read(&inode->i_count)) { |
560 | busy = 1; | 575 | busy = 1; |
561 | continue; | 576 | continue; |
diff --git a/fs/internal.h b/fs/internal.h index 0663568b1247..f3d15de44b15 100644 --- a/fs/internal.h +++ b/fs/internal.h | |||
@@ -106,10 +106,23 @@ extern void put_super(struct super_block *sb); | |||
106 | struct nameidata; | 106 | struct nameidata; |
107 | extern struct file *nameidata_to_filp(struct nameidata *); | 107 | extern struct file *nameidata_to_filp(struct nameidata *); |
108 | extern void release_open_intent(struct nameidata *); | 108 | extern void release_open_intent(struct nameidata *); |
109 | struct open_flags { | ||
110 | int open_flag; | ||
111 | int mode; | ||
112 | int acc_mode; | ||
113 | int intent; | ||
114 | }; | ||
115 | extern struct file *do_filp_open(int dfd, const char *pathname, | ||
116 | const struct open_flags *op, int lookup_flags); | ||
117 | extern struct file *do_file_open_root(struct dentry *, struct vfsmount *, | ||
118 | const char *, const struct open_flags *, int lookup_flags); | ||
119 | |||
120 | extern long do_handle_open(int mountdirfd, | ||
121 | struct file_handle __user *ufh, int open_flag); | ||
109 | 122 | ||
110 | /* | 123 | /* |
111 | * inode.c | 124 | * inode.c |
112 | */ | 125 | */ |
113 | extern int get_nr_dirty_inodes(void); | 126 | extern int get_nr_dirty_inodes(void); |
114 | extern void evict_inodes(struct super_block *); | 127 | extern void evict_inodes(struct super_block *); |
115 | extern int invalidate_inodes(struct super_block *); | 128 | extern int invalidate_inodes(struct super_block *, bool); |
diff --git a/fs/isofs/export.c b/fs/isofs/export.c index ed752cb38474..dd4687ff30d0 100644 --- a/fs/isofs/export.c +++ b/fs/isofs/export.c | |||
@@ -124,9 +124,13 @@ isofs_export_encode_fh(struct dentry *dentry, | |||
124 | * offset of the inode and the upper 16 bits of fh32[1] to | 124 | * offset of the inode and the upper 16 bits of fh32[1] to |
125 | * hold the offset of the parent. | 125 | * hold the offset of the parent. |
126 | */ | 126 | */ |
127 | 127 | if (connectable && (len < 5)) { | |
128 | if (len < 3 || (connectable && len < 5)) | 128 | *max_len = 5; |
129 | return 255; | ||
130 | } else if (len < 3) { | ||
131 | *max_len = 3; | ||
129 | return 255; | 132 | return 255; |
133 | } | ||
130 | 134 | ||
131 | len = 3; | 135 | len = 3; |
132 | fh32[0] = ei->i_iget5_block; | 136 | fh32[0] = ei->i_iget5_block; |
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index 81ead850ddb6..3f04a1804931 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
@@ -809,9 +809,6 @@ static int jfs_link(struct dentry *old_dentry, | |||
809 | if (ip->i_nlink == JFS_LINK_MAX) | 809 | if (ip->i_nlink == JFS_LINK_MAX) |
810 | return -EMLINK; | 810 | return -EMLINK; |
811 | 811 | ||
812 | if (ip->i_nlink == 0) | ||
813 | return -ENOENT; | ||
814 | |||
815 | dquot_initialize(dir); | 812 | dquot_initialize(dir); |
816 | 813 | ||
817 | tid = txBegin(ip->i_sb, 0); | 814 | tid = txBegin(ip->i_sb, 0); |
@@ -1600,7 +1597,7 @@ out: | |||
1600 | 1597 | ||
1601 | static int jfs_ci_revalidate(struct dentry *dentry, struct nameidata *nd) | 1598 | static int jfs_ci_revalidate(struct dentry *dentry, struct nameidata *nd) |
1602 | { | 1599 | { |
1603 | if (nd->flags & LOOKUP_RCU) | 1600 | if (nd && nd->flags & LOOKUP_RCU) |
1604 | return -ECHILD; | 1601 | return -ECHILD; |
1605 | /* | 1602 | /* |
1606 | * This is not negative dentry. Always valid. | 1603 | * This is not negative dentry. Always valid. |
diff --git a/fs/minix/namei.c b/fs/minix/namei.c index ce7337ddfdbf..6e6777f1b4b2 100644 --- a/fs/minix/namei.c +++ b/fs/minix/namei.c | |||
@@ -213,7 +213,6 @@ static int minix_rename(struct inode * old_dir, struct dentry *old_dentry, | |||
213 | new_de = minix_find_entry(new_dentry, &new_page); | 213 | new_de = minix_find_entry(new_dentry, &new_page); |
214 | if (!new_de) | 214 | if (!new_de) |
215 | goto out_dir; | 215 | goto out_dir; |
216 | inode_inc_link_count(old_inode); | ||
217 | minix_set_link(new_de, new_page, old_inode); | 216 | minix_set_link(new_de, new_page, old_inode); |
218 | new_inode->i_ctime = CURRENT_TIME_SEC; | 217 | new_inode->i_ctime = CURRENT_TIME_SEC; |
219 | if (dir_de) | 218 | if (dir_de) |
@@ -225,18 +224,15 @@ static int minix_rename(struct inode * old_dir, struct dentry *old_dentry, | |||
225 | if (new_dir->i_nlink >= info->s_link_max) | 224 | if (new_dir->i_nlink >= info->s_link_max) |
226 | goto out_dir; | 225 | goto out_dir; |
227 | } | 226 | } |
228 | inode_inc_link_count(old_inode); | ||
229 | err = minix_add_link(new_dentry, old_inode); | 227 | err = minix_add_link(new_dentry, old_inode); |
230 | if (err) { | 228 | if (err) |
231 | inode_dec_link_count(old_inode); | ||
232 | goto out_dir; | 229 | goto out_dir; |
233 | } | ||
234 | if (dir_de) | 230 | if (dir_de) |
235 | inode_inc_link_count(new_dir); | 231 | inode_inc_link_count(new_dir); |
236 | } | 232 | } |
237 | 233 | ||
238 | minix_delete_entry(old_de, old_page); | 234 | minix_delete_entry(old_de, old_page); |
239 | inode_dec_link_count(old_inode); | 235 | mark_inode_dirty(old_inode); |
240 | 236 | ||
241 | if (dir_de) { | 237 | if (dir_de) { |
242 | minix_set_link(dir_de, dir_page, new_dir); | 238 | minix_set_link(dir_de, dir_page, new_dir); |
diff --git a/fs/namei.c b/fs/namei.c index 0087cf9c2c6b..0a601cae23de 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -136,7 +136,7 @@ static int do_getname(const char __user *filename, char *page) | |||
136 | return retval; | 136 | return retval; |
137 | } | 137 | } |
138 | 138 | ||
139 | char * getname(const char __user * filename) | 139 | static char *getname_flags(const char __user * filename, int flags) |
140 | { | 140 | { |
141 | char *tmp, *result; | 141 | char *tmp, *result; |
142 | 142 | ||
@@ -147,14 +147,21 @@ char * getname(const char __user * filename) | |||
147 | 147 | ||
148 | result = tmp; | 148 | result = tmp; |
149 | if (retval < 0) { | 149 | if (retval < 0) { |
150 | __putname(tmp); | 150 | if (retval != -ENOENT || !(flags & LOOKUP_EMPTY)) { |
151 | result = ERR_PTR(retval); | 151 | __putname(tmp); |
152 | result = ERR_PTR(retval); | ||
153 | } | ||
152 | } | 154 | } |
153 | } | 155 | } |
154 | audit_getname(result); | 156 | audit_getname(result); |
155 | return result; | 157 | return result; |
156 | } | 158 | } |
157 | 159 | ||
160 | char *getname(const char __user * filename) | ||
161 | { | ||
162 | return getname_flags(filename, 0); | ||
163 | } | ||
164 | |||
158 | #ifdef CONFIG_AUDITSYSCALL | 165 | #ifdef CONFIG_AUDITSYSCALL |
159 | void putname(const char *name) | 166 | void putname(const char *name) |
160 | { | 167 | { |
@@ -401,9 +408,11 @@ static int nameidata_drop_rcu(struct nameidata *nd) | |||
401 | { | 408 | { |
402 | struct fs_struct *fs = current->fs; | 409 | struct fs_struct *fs = current->fs; |
403 | struct dentry *dentry = nd->path.dentry; | 410 | struct dentry *dentry = nd->path.dentry; |
411 | int want_root = 0; | ||
404 | 412 | ||
405 | BUG_ON(!(nd->flags & LOOKUP_RCU)); | 413 | BUG_ON(!(nd->flags & LOOKUP_RCU)); |
406 | if (nd->root.mnt) { | 414 | if (nd->root.mnt && !(nd->flags & LOOKUP_ROOT)) { |
415 | want_root = 1; | ||
407 | spin_lock(&fs->lock); | 416 | spin_lock(&fs->lock); |
408 | if (nd->root.mnt != fs->root.mnt || | 417 | if (nd->root.mnt != fs->root.mnt || |
409 | nd->root.dentry != fs->root.dentry) | 418 | nd->root.dentry != fs->root.dentry) |
@@ -414,7 +423,7 @@ static int nameidata_drop_rcu(struct nameidata *nd) | |||
414 | goto err; | 423 | goto err; |
415 | BUG_ON(nd->inode != dentry->d_inode); | 424 | BUG_ON(nd->inode != dentry->d_inode); |
416 | spin_unlock(&dentry->d_lock); | 425 | spin_unlock(&dentry->d_lock); |
417 | if (nd->root.mnt) { | 426 | if (want_root) { |
418 | path_get(&nd->root); | 427 | path_get(&nd->root); |
419 | spin_unlock(&fs->lock); | 428 | spin_unlock(&fs->lock); |
420 | } | 429 | } |
@@ -427,7 +436,7 @@ static int nameidata_drop_rcu(struct nameidata *nd) | |||
427 | err: | 436 | err: |
428 | spin_unlock(&dentry->d_lock); | 437 | spin_unlock(&dentry->d_lock); |
429 | err_root: | 438 | err_root: |
430 | if (nd->root.mnt) | 439 | if (want_root) |
431 | spin_unlock(&fs->lock); | 440 | spin_unlock(&fs->lock); |
432 | return -ECHILD; | 441 | return -ECHILD; |
433 | } | 442 | } |
@@ -454,9 +463,11 @@ static int nameidata_dentry_drop_rcu(struct nameidata *nd, struct dentry *dentry | |||
454 | { | 463 | { |
455 | struct fs_struct *fs = current->fs; | 464 | struct fs_struct *fs = current->fs; |
456 | struct dentry *parent = nd->path.dentry; | 465 | struct dentry *parent = nd->path.dentry; |
466 | int want_root = 0; | ||
457 | 467 | ||
458 | BUG_ON(!(nd->flags & LOOKUP_RCU)); | 468 | BUG_ON(!(nd->flags & LOOKUP_RCU)); |
459 | if (nd->root.mnt) { | 469 | if (nd->root.mnt && !(nd->flags & LOOKUP_ROOT)) { |
470 | want_root = 1; | ||
460 | spin_lock(&fs->lock); | 471 | spin_lock(&fs->lock); |
461 | if (nd->root.mnt != fs->root.mnt || | 472 | if (nd->root.mnt != fs->root.mnt || |
462 | nd->root.dentry != fs->root.dentry) | 473 | nd->root.dentry != fs->root.dentry) |
@@ -476,7 +487,7 @@ static int nameidata_dentry_drop_rcu(struct nameidata *nd, struct dentry *dentry | |||
476 | parent->d_count++; | 487 | parent->d_count++; |
477 | spin_unlock(&dentry->d_lock); | 488 | spin_unlock(&dentry->d_lock); |
478 | spin_unlock(&parent->d_lock); | 489 | spin_unlock(&parent->d_lock); |
479 | if (nd->root.mnt) { | 490 | if (want_root) { |
480 | path_get(&nd->root); | 491 | path_get(&nd->root); |
481 | spin_unlock(&fs->lock); | 492 | spin_unlock(&fs->lock); |
482 | } | 493 | } |
@@ -490,7 +501,7 @@ err: | |||
490 | spin_unlock(&dentry->d_lock); | 501 | spin_unlock(&dentry->d_lock); |
491 | spin_unlock(&parent->d_lock); | 502 | spin_unlock(&parent->d_lock); |
492 | err_root: | 503 | err_root: |
493 | if (nd->root.mnt) | 504 | if (want_root) |
494 | spin_unlock(&fs->lock); | 505 | spin_unlock(&fs->lock); |
495 | return -ECHILD; | 506 | return -ECHILD; |
496 | } | 507 | } |
@@ -498,8 +509,16 @@ err_root: | |||
498 | /* Try to drop out of rcu-walk mode if we were in it, otherwise do nothing. */ | 509 | /* Try to drop out of rcu-walk mode if we were in it, otherwise do nothing. */ |
499 | static inline int nameidata_dentry_drop_rcu_maybe(struct nameidata *nd, struct dentry *dentry) | 510 | static inline int nameidata_dentry_drop_rcu_maybe(struct nameidata *nd, struct dentry *dentry) |
500 | { | 511 | { |
501 | if (nd->flags & LOOKUP_RCU) | 512 | if (nd->flags & LOOKUP_RCU) { |
502 | return nameidata_dentry_drop_rcu(nd, dentry); | 513 | if (unlikely(nameidata_dentry_drop_rcu(nd, dentry))) { |
514 | nd->flags &= ~LOOKUP_RCU; | ||
515 | if (!(nd->flags & LOOKUP_ROOT)) | ||
516 | nd->root.mnt = NULL; | ||
517 | rcu_read_unlock(); | ||
518 | br_read_unlock(vfsmount_lock); | ||
519 | return -ECHILD; | ||
520 | } | ||
521 | } | ||
503 | return 0; | 522 | return 0; |
504 | } | 523 | } |
505 | 524 | ||
@@ -518,7 +537,8 @@ static int nameidata_drop_rcu_last(struct nameidata *nd) | |||
518 | 537 | ||
519 | BUG_ON(!(nd->flags & LOOKUP_RCU)); | 538 | BUG_ON(!(nd->flags & LOOKUP_RCU)); |
520 | nd->flags &= ~LOOKUP_RCU; | 539 | nd->flags &= ~LOOKUP_RCU; |
521 | nd->root.mnt = NULL; | 540 | if (!(nd->flags & LOOKUP_ROOT)) |
541 | nd->root.mnt = NULL; | ||
522 | spin_lock(&dentry->d_lock); | 542 | spin_lock(&dentry->d_lock); |
523 | if (!__d_rcu_to_refcount(dentry, nd->seq)) | 543 | if (!__d_rcu_to_refcount(dentry, nd->seq)) |
524 | goto err_unlock; | 544 | goto err_unlock; |
@@ -539,14 +559,6 @@ err_unlock: | |||
539 | return -ECHILD; | 559 | return -ECHILD; |
540 | } | 560 | } |
541 | 561 | ||
542 | /* Try to drop out of rcu-walk mode if we were in it, otherwise do nothing. */ | ||
543 | static inline int nameidata_drop_rcu_last_maybe(struct nameidata *nd) | ||
544 | { | ||
545 | if (likely(nd->flags & LOOKUP_RCU)) | ||
546 | return nameidata_drop_rcu_last(nd); | ||
547 | return 0; | ||
548 | } | ||
549 | |||
550 | /** | 562 | /** |
551 | * release_open_intent - free up open intent resources | 563 | * release_open_intent - free up open intent resources |
552 | * @nd: pointer to nameidata | 564 | * @nd: pointer to nameidata |
@@ -590,42 +602,8 @@ do_revalidate(struct dentry *dentry, struct nameidata *nd) | |||
590 | return dentry; | 602 | return dentry; |
591 | } | 603 | } |
592 | 604 | ||
593 | static inline struct dentry * | ||
594 | do_revalidate_rcu(struct dentry *dentry, struct nameidata *nd) | ||
595 | { | ||
596 | int status = d_revalidate(dentry, nd); | ||
597 | if (likely(status > 0)) | ||
598 | return dentry; | ||
599 | if (status == -ECHILD) { | ||
600 | if (nameidata_dentry_drop_rcu(nd, dentry)) | ||
601 | return ERR_PTR(-ECHILD); | ||
602 | return do_revalidate(dentry, nd); | ||
603 | } | ||
604 | if (status < 0) | ||
605 | return ERR_PTR(status); | ||
606 | /* Don't d_invalidate in rcu-walk mode */ | ||
607 | if (nameidata_dentry_drop_rcu(nd, dentry)) | ||
608 | return ERR_PTR(-ECHILD); | ||
609 | if (!d_invalidate(dentry)) { | ||
610 | dput(dentry); | ||
611 | dentry = NULL; | ||
612 | } | ||
613 | return dentry; | ||
614 | } | ||
615 | |||
616 | static inline int need_reval_dot(struct dentry *dentry) | ||
617 | { | ||
618 | if (likely(!(dentry->d_flags & DCACHE_OP_REVALIDATE))) | ||
619 | return 0; | ||
620 | |||
621 | if (likely(!(dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT))) | ||
622 | return 0; | ||
623 | |||
624 | return 1; | ||
625 | } | ||
626 | |||
627 | /* | 605 | /* |
628 | * force_reval_path - force revalidation of a dentry | 606 | * handle_reval_path - force revalidation of a dentry |
629 | * | 607 | * |
630 | * In some situations the path walking code will trust dentries without | 608 | * In some situations the path walking code will trust dentries without |
631 | * revalidating them. This causes problems for filesystems that depend on | 609 | * revalidating them. This causes problems for filesystems that depend on |
@@ -639,27 +617,28 @@ static inline int need_reval_dot(struct dentry *dentry) | |||
639 | * invalidate the dentry. It's up to the caller to handle putting references | 617 | * invalidate the dentry. It's up to the caller to handle putting references |
640 | * to the path if necessary. | 618 | * to the path if necessary. |
641 | */ | 619 | */ |
642 | static int | 620 | static inline int handle_reval_path(struct nameidata *nd) |
643 | force_reval_path(struct path *path, struct nameidata *nd) | ||
644 | { | 621 | { |
622 | struct dentry *dentry = nd->path.dentry; | ||
645 | int status; | 623 | int status; |
646 | struct dentry *dentry = path->dentry; | ||
647 | 624 | ||
648 | /* | 625 | if (likely(!(nd->flags & LOOKUP_JUMPED))) |
649 | * only check on filesystems where it's possible for the dentry to | 626 | return 0; |
650 | * become stale. | 627 | |
651 | */ | 628 | if (likely(!(dentry->d_flags & DCACHE_OP_REVALIDATE))) |
652 | if (!need_reval_dot(dentry)) | 629 | return 0; |
630 | |||
631 | if (likely(!(dentry->d_sb->s_type->fs_flags & FS_REVAL_DOT))) | ||
653 | return 0; | 632 | return 0; |
654 | 633 | ||
634 | /* Note: we do not d_invalidate() */ | ||
655 | status = d_revalidate(dentry, nd); | 635 | status = d_revalidate(dentry, nd); |
656 | if (status > 0) | 636 | if (status > 0) |
657 | return 0; | 637 | return 0; |
658 | 638 | ||
659 | if (!status) { | 639 | if (!status) |
660 | d_invalidate(dentry); | ||
661 | status = -ESTALE; | 640 | status = -ESTALE; |
662 | } | 641 | |
663 | return status; | 642 | return status; |
664 | } | 643 | } |
665 | 644 | ||
@@ -728,6 +707,7 @@ static __always_inline int __vfs_follow_link(struct nameidata *nd, const char *l | |||
728 | path_put(&nd->path); | 707 | path_put(&nd->path); |
729 | nd->path = nd->root; | 708 | nd->path = nd->root; |
730 | path_get(&nd->root); | 709 | path_get(&nd->root); |
710 | nd->flags |= LOOKUP_JUMPED; | ||
731 | } | 711 | } |
732 | nd->inode = nd->path.dentry->d_inode; | 712 | nd->inode = nd->path.dentry->d_inode; |
733 | 713 | ||
@@ -757,20 +737,44 @@ static inline void path_to_nameidata(const struct path *path, | |||
757 | nd->path.dentry = path->dentry; | 737 | nd->path.dentry = path->dentry; |
758 | } | 738 | } |
759 | 739 | ||
740 | static inline void put_link(struct nameidata *nd, struct path *link, void *cookie) | ||
741 | { | ||
742 | struct inode *inode = link->dentry->d_inode; | ||
743 | if (!IS_ERR(cookie) && inode->i_op->put_link) | ||
744 | inode->i_op->put_link(link->dentry, nd, cookie); | ||
745 | path_put(link); | ||
746 | } | ||
747 | |||
760 | static __always_inline int | 748 | static __always_inline int |
761 | __do_follow_link(const struct path *link, struct nameidata *nd, void **p) | 749 | follow_link(struct path *link, struct nameidata *nd, void **p) |
762 | { | 750 | { |
763 | int error; | 751 | int error; |
764 | struct dentry *dentry = link->dentry; | 752 | struct dentry *dentry = link->dentry; |
765 | 753 | ||
766 | BUG_ON(nd->flags & LOOKUP_RCU); | 754 | BUG_ON(nd->flags & LOOKUP_RCU); |
767 | 755 | ||
756 | if (unlikely(current->total_link_count >= 40)) { | ||
757 | *p = ERR_PTR(-ELOOP); /* no ->put_link(), please */ | ||
758 | path_put_conditional(link, nd); | ||
759 | path_put(&nd->path); | ||
760 | return -ELOOP; | ||
761 | } | ||
762 | cond_resched(); | ||
763 | current->total_link_count++; | ||
764 | |||
768 | touch_atime(link->mnt, dentry); | 765 | touch_atime(link->mnt, dentry); |
769 | nd_set_link(nd, NULL); | 766 | nd_set_link(nd, NULL); |
770 | 767 | ||
771 | if (link->mnt == nd->path.mnt) | 768 | if (link->mnt == nd->path.mnt) |
772 | mntget(link->mnt); | 769 | mntget(link->mnt); |
773 | 770 | ||
771 | error = security_inode_follow_link(link->dentry, nd); | ||
772 | if (error) { | ||
773 | *p = ERR_PTR(error); /* no ->put_link(), please */ | ||
774 | path_put(&nd->path); | ||
775 | return error; | ||
776 | } | ||
777 | |||
774 | nd->last_type = LAST_BIND; | 778 | nd->last_type = LAST_BIND; |
775 | *p = dentry->d_inode->i_op->follow_link(dentry, nd); | 779 | *p = dentry->d_inode->i_op->follow_link(dentry, nd); |
776 | error = PTR_ERR(*p); | 780 | error = PTR_ERR(*p); |
@@ -780,56 +784,18 @@ __do_follow_link(const struct path *link, struct nameidata *nd, void **p) | |||
780 | if (s) | 784 | if (s) |
781 | error = __vfs_follow_link(nd, s); | 785 | error = __vfs_follow_link(nd, s); |
782 | else if (nd->last_type == LAST_BIND) { | 786 | else if (nd->last_type == LAST_BIND) { |
783 | error = force_reval_path(&nd->path, nd); | 787 | nd->flags |= LOOKUP_JUMPED; |
784 | if (error) | 788 | nd->inode = nd->path.dentry->d_inode; |
789 | if (nd->inode->i_op->follow_link) { | ||
790 | /* stepped on a _really_ weird one */ | ||
785 | path_put(&nd->path); | 791 | path_put(&nd->path); |
792 | error = -ELOOP; | ||
793 | } | ||
786 | } | 794 | } |
787 | } | 795 | } |
788 | return error; | 796 | return error; |
789 | } | 797 | } |
790 | 798 | ||
791 | /* | ||
792 | * This limits recursive symlink follows to 8, while | ||
793 | * limiting consecutive symlinks to 40. | ||
794 | * | ||
795 | * Without that kind of total limit, nasty chains of consecutive | ||
796 | * symlinks can cause almost arbitrarily long lookups. | ||
797 | */ | ||
798 | static inline int do_follow_link(struct inode *inode, struct path *path, struct nameidata *nd) | ||
799 | { | ||
800 | void *cookie; | ||
801 | int err = -ELOOP; | ||
802 | |||
803 | /* We drop rcu-walk here */ | ||
804 | if (nameidata_dentry_drop_rcu_maybe(nd, path->dentry)) | ||
805 | return -ECHILD; | ||
806 | BUG_ON(inode != path->dentry->d_inode); | ||
807 | |||
808 | if (current->link_count >= MAX_NESTED_LINKS) | ||
809 | goto loop; | ||
810 | if (current->total_link_count >= 40) | ||
811 | goto loop; | ||
812 | BUG_ON(nd->depth >= MAX_NESTED_LINKS); | ||
813 | cond_resched(); | ||
814 | err = security_inode_follow_link(path->dentry, nd); | ||
815 | if (err) | ||
816 | goto loop; | ||
817 | current->link_count++; | ||
818 | current->total_link_count++; | ||
819 | nd->depth++; | ||
820 | err = __do_follow_link(path, nd, &cookie); | ||
821 | if (!IS_ERR(cookie) && path->dentry->d_inode->i_op->put_link) | ||
822 | path->dentry->d_inode->i_op->put_link(path->dentry, nd, cookie); | ||
823 | path_put(path); | ||
824 | current->link_count--; | ||
825 | nd->depth--; | ||
826 | return err; | ||
827 | loop: | ||
828 | path_put_conditional(path, nd); | ||
829 | path_put(&nd->path); | ||
830 | return err; | ||
831 | } | ||
832 | |||
833 | static int follow_up_rcu(struct path *path) | 799 | static int follow_up_rcu(struct path *path) |
834 | { | 800 | { |
835 | struct vfsmount *parent; | 801 | struct vfsmount *parent; |
@@ -1068,7 +1034,7 @@ static int follow_dotdot_rcu(struct nameidata *nd) | |||
1068 | 1034 | ||
1069 | seq = read_seqcount_begin(&parent->d_seq); | 1035 | seq = read_seqcount_begin(&parent->d_seq); |
1070 | if (read_seqcount_retry(&old->d_seq, nd->seq)) | 1036 | if (read_seqcount_retry(&old->d_seq, nd->seq)) |
1071 | return -ECHILD; | 1037 | goto failed; |
1072 | inode = parent->d_inode; | 1038 | inode = parent->d_inode; |
1073 | nd->path.dentry = parent; | 1039 | nd->path.dentry = parent; |
1074 | nd->seq = seq; | 1040 | nd->seq = seq; |
@@ -1081,8 +1047,15 @@ static int follow_dotdot_rcu(struct nameidata *nd) | |||
1081 | } | 1047 | } |
1082 | __follow_mount_rcu(nd, &nd->path, &inode, true); | 1048 | __follow_mount_rcu(nd, &nd->path, &inode, true); |
1083 | nd->inode = inode; | 1049 | nd->inode = inode; |
1084 | |||
1085 | return 0; | 1050 | return 0; |
1051 | |||
1052 | failed: | ||
1053 | nd->flags &= ~LOOKUP_RCU; | ||
1054 | if (!(nd->flags & LOOKUP_ROOT)) | ||
1055 | nd->root.mnt = NULL; | ||
1056 | rcu_read_unlock(); | ||
1057 | br_read_unlock(vfsmount_lock); | ||
1058 | return -ECHILD; | ||
1086 | } | 1059 | } |
1087 | 1060 | ||
1088 | /* | 1061 | /* |
@@ -1216,68 +1189,85 @@ static int do_lookup(struct nameidata *nd, struct qstr *name, | |||
1216 | { | 1189 | { |
1217 | struct vfsmount *mnt = nd->path.mnt; | 1190 | struct vfsmount *mnt = nd->path.mnt; |
1218 | struct dentry *dentry, *parent = nd->path.dentry; | 1191 | struct dentry *dentry, *parent = nd->path.dentry; |
1219 | struct inode *dir; | 1192 | int need_reval = 1; |
1193 | int status = 1; | ||
1220 | int err; | 1194 | int err; |
1221 | 1195 | ||
1222 | /* | 1196 | /* |
1223 | * See if the low-level filesystem might want | ||
1224 | * to use its own hash.. | ||
1225 | */ | ||
1226 | if (unlikely(parent->d_flags & DCACHE_OP_HASH)) { | ||
1227 | err = parent->d_op->d_hash(parent, nd->inode, name); | ||
1228 | if (err < 0) | ||
1229 | return err; | ||
1230 | } | ||
1231 | |||
1232 | /* | ||
1233 | * Rename seqlock is not required here because in the off chance | 1197 | * Rename seqlock is not required here because in the off chance |
1234 | * of a false negative due to a concurrent rename, we're going to | 1198 | * of a false negative due to a concurrent rename, we're going to |
1235 | * do the non-racy lookup, below. | 1199 | * do the non-racy lookup, below. |
1236 | */ | 1200 | */ |
1237 | if (nd->flags & LOOKUP_RCU) { | 1201 | if (nd->flags & LOOKUP_RCU) { |
1238 | unsigned seq; | 1202 | unsigned seq; |
1239 | |||
1240 | *inode = nd->inode; | 1203 | *inode = nd->inode; |
1241 | dentry = __d_lookup_rcu(parent, name, &seq, inode); | 1204 | dentry = __d_lookup_rcu(parent, name, &seq, inode); |
1242 | if (!dentry) { | 1205 | if (!dentry) |
1243 | if (nameidata_drop_rcu(nd)) | 1206 | goto unlazy; |
1244 | return -ECHILD; | 1207 | |
1245 | goto need_lookup; | ||
1246 | } | ||
1247 | /* Memory barrier in read_seqcount_begin of child is enough */ | 1208 | /* Memory barrier in read_seqcount_begin of child is enough */ |
1248 | if (__read_seqcount_retry(&parent->d_seq, nd->seq)) | 1209 | if (__read_seqcount_retry(&parent->d_seq, nd->seq)) |
1249 | return -ECHILD; | 1210 | return -ECHILD; |
1250 | |||
1251 | nd->seq = seq; | 1211 | nd->seq = seq; |
1212 | |||
1252 | if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) { | 1213 | if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) { |
1253 | dentry = do_revalidate_rcu(dentry, nd); | 1214 | status = d_revalidate(dentry, nd); |
1254 | if (!dentry) | 1215 | if (unlikely(status <= 0)) { |
1255 | goto need_lookup; | 1216 | if (status != -ECHILD) |
1256 | if (IS_ERR(dentry)) | 1217 | need_reval = 0; |
1257 | goto fail; | 1218 | goto unlazy; |
1258 | if (!(nd->flags & LOOKUP_RCU)) | 1219 | } |
1259 | goto done; | ||
1260 | } | 1220 | } |
1261 | path->mnt = mnt; | 1221 | path->mnt = mnt; |
1262 | path->dentry = dentry; | 1222 | path->dentry = dentry; |
1263 | if (likely(__follow_mount_rcu(nd, path, inode, false))) | 1223 | if (likely(__follow_mount_rcu(nd, path, inode, false))) |
1264 | return 0; | 1224 | return 0; |
1265 | if (nameidata_drop_rcu(nd)) | 1225 | unlazy: |
1266 | return -ECHILD; | 1226 | if (dentry) { |
1267 | /* fallthru */ | 1227 | if (nameidata_dentry_drop_rcu(nd, dentry)) |
1228 | return -ECHILD; | ||
1229 | } else { | ||
1230 | if (nameidata_drop_rcu(nd)) | ||
1231 | return -ECHILD; | ||
1232 | } | ||
1233 | } else { | ||
1234 | dentry = __d_lookup(parent, name); | ||
1268 | } | 1235 | } |
1269 | dentry = __d_lookup(parent, name); | 1236 | |
1270 | if (!dentry) | 1237 | retry: |
1271 | goto need_lookup; | 1238 | if (unlikely(!dentry)) { |
1272 | found: | 1239 | struct inode *dir = parent->d_inode; |
1273 | if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE)) { | 1240 | BUG_ON(nd->inode != dir); |
1274 | dentry = do_revalidate(dentry, nd); | 1241 | |
1275 | if (!dentry) | 1242 | mutex_lock(&dir->i_mutex); |
1276 | goto need_lookup; | 1243 | dentry = d_lookup(parent, name); |
1277 | if (IS_ERR(dentry)) | 1244 | if (likely(!dentry)) { |
1278 | goto fail; | 1245 | dentry = d_alloc_and_lookup(parent, name, nd); |
1246 | if (IS_ERR(dentry)) { | ||
1247 | mutex_unlock(&dir->i_mutex); | ||
1248 | return PTR_ERR(dentry); | ||
1249 | } | ||
1250 | /* known good */ | ||
1251 | need_reval = 0; | ||
1252 | status = 1; | ||
1253 | } | ||
1254 | mutex_unlock(&dir->i_mutex); | ||
1279 | } | 1255 | } |
1280 | done: | 1256 | if (unlikely(dentry->d_flags & DCACHE_OP_REVALIDATE) && need_reval) |
1257 | status = d_revalidate(dentry, nd); | ||
1258 | if (unlikely(status <= 0)) { | ||
1259 | if (status < 0) { | ||
1260 | dput(dentry); | ||
1261 | return status; | ||
1262 | } | ||
1263 | if (!d_invalidate(dentry)) { | ||
1264 | dput(dentry); | ||
1265 | dentry = NULL; | ||
1266 | need_reval = 1; | ||
1267 | goto retry; | ||
1268 | } | ||
1269 | } | ||
1270 | |||
1281 | path->mnt = mnt; | 1271 | path->mnt = mnt; |
1282 | path->dentry = dentry; | 1272 | path->dentry = dentry; |
1283 | err = follow_managed(path, nd->flags); | 1273 | err = follow_managed(path, nd->flags); |
@@ -1287,39 +1277,113 @@ done: | |||
1287 | } | 1277 | } |
1288 | *inode = path->dentry->d_inode; | 1278 | *inode = path->dentry->d_inode; |
1289 | return 0; | 1279 | return 0; |
1280 | } | ||
1290 | 1281 | ||
1291 | need_lookup: | 1282 | static inline int may_lookup(struct nameidata *nd) |
1292 | dir = parent->d_inode; | 1283 | { |
1293 | BUG_ON(nd->inode != dir); | 1284 | if (nd->flags & LOOKUP_RCU) { |
1285 | int err = exec_permission(nd->inode, IPERM_FLAG_RCU); | ||
1286 | if (err != -ECHILD) | ||
1287 | return err; | ||
1288 | if (nameidata_drop_rcu(nd)) | ||
1289 | return -ECHILD; | ||
1290 | } | ||
1291 | return exec_permission(nd->inode, 0); | ||
1292 | } | ||
1294 | 1293 | ||
1295 | mutex_lock(&dir->i_mutex); | 1294 | static inline int handle_dots(struct nameidata *nd, int type) |
1296 | /* | 1295 | { |
1297 | * First re-do the cached lookup just in case it was created | 1296 | if (type == LAST_DOTDOT) { |
1298 | * while we waited for the directory semaphore, or the first | 1297 | if (nd->flags & LOOKUP_RCU) { |
1299 | * lookup failed due to an unrelated rename. | 1298 | if (follow_dotdot_rcu(nd)) |
1300 | * | 1299 | return -ECHILD; |
1301 | * This could use version numbering or similar to avoid unnecessary | 1300 | } else |
1302 | * cache lookups, but then we'd have to do the first lookup in the | 1301 | follow_dotdot(nd); |
1303 | * non-racy way. However in the common case here, everything should | 1302 | } |
1304 | * be hot in cache, so would it be a big win? | 1303 | return 0; |
1305 | */ | 1304 | } |
1306 | dentry = d_lookup(parent, name); | 1305 | |
1307 | if (likely(!dentry)) { | 1306 | static void terminate_walk(struct nameidata *nd) |
1308 | dentry = d_alloc_and_lookup(parent, name, nd); | 1307 | { |
1309 | mutex_unlock(&dir->i_mutex); | 1308 | if (!(nd->flags & LOOKUP_RCU)) { |
1310 | if (IS_ERR(dentry)) | 1309 | path_put(&nd->path); |
1311 | goto fail; | 1310 | } else { |
1312 | goto done; | 1311 | nd->flags &= ~LOOKUP_RCU; |
1312 | if (!(nd->flags & LOOKUP_ROOT)) | ||
1313 | nd->root.mnt = NULL; | ||
1314 | rcu_read_unlock(); | ||
1315 | br_read_unlock(vfsmount_lock); | ||
1313 | } | 1316 | } |
1317 | } | ||
1318 | |||
1319 | static inline int walk_component(struct nameidata *nd, struct path *path, | ||
1320 | struct qstr *name, int type, int follow) | ||
1321 | { | ||
1322 | struct inode *inode; | ||
1323 | int err; | ||
1314 | /* | 1324 | /* |
1315 | * Uhhuh! Nasty case: the cache was re-populated while | 1325 | * "." and ".." are special - ".." especially so because it has |
1316 | * we waited on the semaphore. Need to revalidate. | 1326 | * to be able to know about the current root directory and |
1327 | * parent relationships. | ||
1317 | */ | 1328 | */ |
1318 | mutex_unlock(&dir->i_mutex); | 1329 | if (unlikely(type != LAST_NORM)) |
1319 | goto found; | 1330 | return handle_dots(nd, type); |
1331 | err = do_lookup(nd, name, path, &inode); | ||
1332 | if (unlikely(err)) { | ||
1333 | terminate_walk(nd); | ||
1334 | return err; | ||
1335 | } | ||
1336 | if (!inode) { | ||
1337 | path_to_nameidata(path, nd); | ||
1338 | terminate_walk(nd); | ||
1339 | return -ENOENT; | ||
1340 | } | ||
1341 | if (unlikely(inode->i_op->follow_link) && follow) { | ||
1342 | if (nameidata_dentry_drop_rcu_maybe(nd, path->dentry)) | ||
1343 | return -ECHILD; | ||
1344 | BUG_ON(inode != path->dentry->d_inode); | ||
1345 | return 1; | ||
1346 | } | ||
1347 | path_to_nameidata(path, nd); | ||
1348 | nd->inode = inode; | ||
1349 | return 0; | ||
1350 | } | ||
1320 | 1351 | ||
1321 | fail: | 1352 | /* |
1322 | return PTR_ERR(dentry); | 1353 | * This limits recursive symlink follows to 8, while |
1354 | * limiting consecutive symlinks to 40. | ||
1355 | * | ||
1356 | * Without that kind of total limit, nasty chains of consecutive | ||
1357 | * symlinks can cause almost arbitrarily long lookups. | ||
1358 | */ | ||
1359 | static inline int nested_symlink(struct path *path, struct nameidata *nd) | ||
1360 | { | ||
1361 | int res; | ||
1362 | |||
1363 | BUG_ON(nd->depth >= MAX_NESTED_LINKS); | ||
1364 | if (unlikely(current->link_count >= MAX_NESTED_LINKS)) { | ||
1365 | path_put_conditional(path, nd); | ||
1366 | path_put(&nd->path); | ||
1367 | return -ELOOP; | ||
1368 | } | ||
1369 | |||
1370 | nd->depth++; | ||
1371 | current->link_count++; | ||
1372 | |||
1373 | do { | ||
1374 | struct path link = *path; | ||
1375 | void *cookie; | ||
1376 | |||
1377 | res = follow_link(&link, nd, &cookie); | ||
1378 | if (!res) | ||
1379 | res = walk_component(nd, path, &nd->last, | ||
1380 | nd->last_type, LOOKUP_FOLLOW); | ||
1381 | put_link(nd, &link, cookie); | ||
1382 | } while (res > 0); | ||
1383 | |||
1384 | current->link_count--; | ||
1385 | nd->depth--; | ||
1386 | return res; | ||
1323 | } | 1387 | } |
1324 | 1388 | ||
1325 | /* | 1389 | /* |
@@ -1339,30 +1403,18 @@ static int link_path_walk(const char *name, struct nameidata *nd) | |||
1339 | while (*name=='/') | 1403 | while (*name=='/') |
1340 | name++; | 1404 | name++; |
1341 | if (!*name) | 1405 | if (!*name) |
1342 | goto return_reval; | 1406 | return 0; |
1343 | |||
1344 | if (nd->depth) | ||
1345 | lookup_flags = LOOKUP_FOLLOW | (nd->flags & LOOKUP_CONTINUE); | ||
1346 | 1407 | ||
1347 | /* At this point we know we have a real path component. */ | 1408 | /* At this point we know we have a real path component. */ |
1348 | for(;;) { | 1409 | for(;;) { |
1349 | struct inode *inode; | ||
1350 | unsigned long hash; | 1410 | unsigned long hash; |
1351 | struct qstr this; | 1411 | struct qstr this; |
1352 | unsigned int c; | 1412 | unsigned int c; |
1413 | int type; | ||
1353 | 1414 | ||
1354 | nd->flags |= LOOKUP_CONTINUE; | 1415 | nd->flags |= LOOKUP_CONTINUE; |
1355 | if (nd->flags & LOOKUP_RCU) { | 1416 | |
1356 | err = exec_permission(nd->inode, IPERM_FLAG_RCU); | 1417 | err = may_lookup(nd); |
1357 | if (err == -ECHILD) { | ||
1358 | if (nameidata_drop_rcu(nd)) | ||
1359 | return -ECHILD; | ||
1360 | goto exec_again; | ||
1361 | } | ||
1362 | } else { | ||
1363 | exec_again: | ||
1364 | err = exec_permission(nd->inode, 0); | ||
1365 | } | ||
1366 | if (err) | 1418 | if (err) |
1367 | break; | 1419 | break; |
1368 | 1420 | ||
@@ -1378,52 +1430,43 @@ exec_again: | |||
1378 | this.len = name - (const char *) this.name; | 1430 | this.len = name - (const char *) this.name; |
1379 | this.hash = end_name_hash(hash); | 1431 | this.hash = end_name_hash(hash); |
1380 | 1432 | ||
1433 | type = LAST_NORM; | ||
1434 | if (this.name[0] == '.') switch (this.len) { | ||
1435 | case 2: | ||
1436 | if (this.name[1] == '.') { | ||
1437 | type = LAST_DOTDOT; | ||
1438 | nd->flags |= LOOKUP_JUMPED; | ||
1439 | } | ||
1440 | break; | ||
1441 | case 1: | ||
1442 | type = LAST_DOT; | ||
1443 | } | ||
1444 | if (likely(type == LAST_NORM)) { | ||
1445 | struct dentry *parent = nd->path.dentry; | ||
1446 | nd->flags &= ~LOOKUP_JUMPED; | ||
1447 | if (unlikely(parent->d_flags & DCACHE_OP_HASH)) { | ||
1448 | err = parent->d_op->d_hash(parent, nd->inode, | ||
1449 | &this); | ||
1450 | if (err < 0) | ||
1451 | break; | ||
1452 | } | ||
1453 | } | ||
1454 | |||
1381 | /* remove trailing slashes? */ | 1455 | /* remove trailing slashes? */ |
1382 | if (!c) | 1456 | if (!c) |
1383 | goto last_component; | 1457 | goto last_component; |
1384 | while (*++name == '/'); | 1458 | while (*++name == '/'); |
1385 | if (!*name) | 1459 | if (!*name) |
1386 | goto last_with_slashes; | 1460 | goto last_component; |
1387 | 1461 | ||
1388 | /* | 1462 | err = walk_component(nd, &next, &this, type, LOOKUP_FOLLOW); |
1389 | * "." and ".." are special - ".." especially so because it has | 1463 | if (err < 0) |
1390 | * to be able to know about the current root directory and | 1464 | return err; |
1391 | * parent relationships. | ||
1392 | */ | ||
1393 | if (this.name[0] == '.') switch (this.len) { | ||
1394 | default: | ||
1395 | break; | ||
1396 | case 2: | ||
1397 | if (this.name[1] != '.') | ||
1398 | break; | ||
1399 | if (nd->flags & LOOKUP_RCU) { | ||
1400 | if (follow_dotdot_rcu(nd)) | ||
1401 | return -ECHILD; | ||
1402 | } else | ||
1403 | follow_dotdot(nd); | ||
1404 | /* fallthrough */ | ||
1405 | case 1: | ||
1406 | continue; | ||
1407 | } | ||
1408 | /* This does the actual lookups.. */ | ||
1409 | err = do_lookup(nd, &this, &next, &inode); | ||
1410 | if (err) | ||
1411 | break; | ||
1412 | err = -ENOENT; | ||
1413 | if (!inode) | ||
1414 | goto out_dput; | ||
1415 | 1465 | ||
1416 | if (inode->i_op->follow_link) { | 1466 | if (err) { |
1417 | err = do_follow_link(inode, &next, nd); | 1467 | err = nested_symlink(&next, nd); |
1418 | if (err) | 1468 | if (err) |
1419 | goto return_err; | 1469 | return err; |
1420 | nd->inode = nd->path.dentry->d_inode; | ||
1421 | err = -ENOENT; | ||
1422 | if (!nd->inode) | ||
1423 | break; | ||
1424 | } else { | ||
1425 | path_to_nameidata(&next, nd); | ||
1426 | nd->inode = inode; | ||
1427 | } | 1470 | } |
1428 | err = -ENOTDIR; | 1471 | err = -ENOTDIR; |
1429 | if (!nd->inode->i_op->lookup) | 1472 | if (!nd->inode->i_op->lookup) |
@@ -1431,209 +1474,109 @@ exec_again: | |||
1431 | continue; | 1474 | continue; |
1432 | /* here ends the main loop */ | 1475 | /* here ends the main loop */ |
1433 | 1476 | ||
1434 | last_with_slashes: | ||
1435 | lookup_flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY; | ||
1436 | last_component: | 1477 | last_component: |
1437 | /* Clear LOOKUP_CONTINUE iff it was previously unset */ | 1478 | /* Clear LOOKUP_CONTINUE iff it was previously unset */ |
1438 | nd->flags &= lookup_flags | ~LOOKUP_CONTINUE; | 1479 | nd->flags &= lookup_flags | ~LOOKUP_CONTINUE; |
1439 | if (lookup_flags & LOOKUP_PARENT) | ||
1440 | goto lookup_parent; | ||
1441 | if (this.name[0] == '.') switch (this.len) { | ||
1442 | default: | ||
1443 | break; | ||
1444 | case 2: | ||
1445 | if (this.name[1] != '.') | ||
1446 | break; | ||
1447 | if (nd->flags & LOOKUP_RCU) { | ||
1448 | if (follow_dotdot_rcu(nd)) | ||
1449 | return -ECHILD; | ||
1450 | } else | ||
1451 | follow_dotdot(nd); | ||
1452 | /* fallthrough */ | ||
1453 | case 1: | ||
1454 | goto return_reval; | ||
1455 | } | ||
1456 | err = do_lookup(nd, &this, &next, &inode); | ||
1457 | if (err) | ||
1458 | break; | ||
1459 | if (inode && unlikely(inode->i_op->follow_link) && | ||
1460 | (lookup_flags & LOOKUP_FOLLOW)) { | ||
1461 | err = do_follow_link(inode, &next, nd); | ||
1462 | if (err) | ||
1463 | goto return_err; | ||
1464 | nd->inode = nd->path.dentry->d_inode; | ||
1465 | } else { | ||
1466 | path_to_nameidata(&next, nd); | ||
1467 | nd->inode = inode; | ||
1468 | } | ||
1469 | err = -ENOENT; | ||
1470 | if (!nd->inode) | ||
1471 | break; | ||
1472 | if (lookup_flags & LOOKUP_DIRECTORY) { | ||
1473 | err = -ENOTDIR; | ||
1474 | if (!nd->inode->i_op->lookup) | ||
1475 | break; | ||
1476 | } | ||
1477 | goto return_base; | ||
1478 | lookup_parent: | ||
1479 | nd->last = this; | 1480 | nd->last = this; |
1480 | nd->last_type = LAST_NORM; | 1481 | nd->last_type = type; |
1481 | if (this.name[0] != '.') | ||
1482 | goto return_base; | ||
1483 | if (this.len == 1) | ||
1484 | nd->last_type = LAST_DOT; | ||
1485 | else if (this.len == 2 && this.name[1] == '.') | ||
1486 | nd->last_type = LAST_DOTDOT; | ||
1487 | else | ||
1488 | goto return_base; | ||
1489 | return_reval: | ||
1490 | /* | ||
1491 | * We bypassed the ordinary revalidation routines. | ||
1492 | * We may need to check the cached dentry for staleness. | ||
1493 | */ | ||
1494 | if (need_reval_dot(nd->path.dentry)) { | ||
1495 | if (nameidata_drop_rcu_last_maybe(nd)) | ||
1496 | return -ECHILD; | ||
1497 | /* Note: we do not d_invalidate() */ | ||
1498 | err = d_revalidate(nd->path.dentry, nd); | ||
1499 | if (!err) | ||
1500 | err = -ESTALE; | ||
1501 | if (err < 0) | ||
1502 | break; | ||
1503 | return 0; | ||
1504 | } | ||
1505 | return_base: | ||
1506 | if (nameidata_drop_rcu_last_maybe(nd)) | ||
1507 | return -ECHILD; | ||
1508 | return 0; | 1482 | return 0; |
1509 | out_dput: | ||
1510 | if (!(nd->flags & LOOKUP_RCU)) | ||
1511 | path_put_conditional(&next, nd); | ||
1512 | break; | ||
1513 | } | 1483 | } |
1514 | if (!(nd->flags & LOOKUP_RCU)) | 1484 | terminate_walk(nd); |
1515 | path_put(&nd->path); | ||
1516 | return_err: | ||
1517 | return err; | 1485 | return err; |
1518 | } | 1486 | } |
1519 | 1487 | ||
1520 | static inline int path_walk_rcu(const char *name, struct nameidata *nd) | 1488 | static int path_init(int dfd, const char *name, unsigned int flags, |
1521 | { | 1489 | struct nameidata *nd, struct file **fp) |
1522 | current->total_link_count = 0; | ||
1523 | |||
1524 | return link_path_walk(name, nd); | ||
1525 | } | ||
1526 | |||
1527 | static inline int path_walk_simple(const char *name, struct nameidata *nd) | ||
1528 | { | ||
1529 | current->total_link_count = 0; | ||
1530 | |||
1531 | return link_path_walk(name, nd); | ||
1532 | } | ||
1533 | |||
1534 | static int path_walk(const char *name, struct nameidata *nd) | ||
1535 | { | ||
1536 | struct path save = nd->path; | ||
1537 | int result; | ||
1538 | |||
1539 | current->total_link_count = 0; | ||
1540 | |||
1541 | /* make sure the stuff we saved doesn't go away */ | ||
1542 | path_get(&save); | ||
1543 | |||
1544 | result = link_path_walk(name, nd); | ||
1545 | if (result == -ESTALE) { | ||
1546 | /* nd->path had been dropped */ | ||
1547 | current->total_link_count = 0; | ||
1548 | nd->path = save; | ||
1549 | path_get(&nd->path); | ||
1550 | nd->flags |= LOOKUP_REVAL; | ||
1551 | result = link_path_walk(name, nd); | ||
1552 | } | ||
1553 | |||
1554 | path_put(&save); | ||
1555 | |||
1556 | return result; | ||
1557 | } | ||
1558 | |||
1559 | static void path_finish_rcu(struct nameidata *nd) | ||
1560 | { | ||
1561 | if (nd->flags & LOOKUP_RCU) { | ||
1562 | /* RCU dangling. Cancel it. */ | ||
1563 | nd->flags &= ~LOOKUP_RCU; | ||
1564 | nd->root.mnt = NULL; | ||
1565 | rcu_read_unlock(); | ||
1566 | br_read_unlock(vfsmount_lock); | ||
1567 | } | ||
1568 | if (nd->file) | ||
1569 | fput(nd->file); | ||
1570 | } | ||
1571 | |||
1572 | static int path_init_rcu(int dfd, const char *name, unsigned int flags, struct nameidata *nd) | ||
1573 | { | 1490 | { |
1574 | int retval = 0; | 1491 | int retval = 0; |
1575 | int fput_needed; | 1492 | int fput_needed; |
1576 | struct file *file; | 1493 | struct file *file; |
1577 | 1494 | ||
1578 | nd->last_type = LAST_ROOT; /* if there are only slashes... */ | 1495 | nd->last_type = LAST_ROOT; /* if there are only slashes... */ |
1579 | nd->flags = flags | LOOKUP_RCU; | 1496 | nd->flags = flags | LOOKUP_JUMPED; |
1580 | nd->depth = 0; | 1497 | nd->depth = 0; |
1498 | if (flags & LOOKUP_ROOT) { | ||
1499 | struct inode *inode = nd->root.dentry->d_inode; | ||
1500 | if (*name) { | ||
1501 | if (!inode->i_op->lookup) | ||
1502 | return -ENOTDIR; | ||
1503 | retval = inode_permission(inode, MAY_EXEC); | ||
1504 | if (retval) | ||
1505 | return retval; | ||
1506 | } | ||
1507 | nd->path = nd->root; | ||
1508 | nd->inode = inode; | ||
1509 | if (flags & LOOKUP_RCU) { | ||
1510 | br_read_lock(vfsmount_lock); | ||
1511 | rcu_read_lock(); | ||
1512 | nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); | ||
1513 | } else { | ||
1514 | path_get(&nd->path); | ||
1515 | } | ||
1516 | return 0; | ||
1517 | } | ||
1518 | |||
1581 | nd->root.mnt = NULL; | 1519 | nd->root.mnt = NULL; |
1582 | nd->file = NULL; | ||
1583 | 1520 | ||
1584 | if (*name=='/') { | 1521 | if (*name=='/') { |
1585 | struct fs_struct *fs = current->fs; | 1522 | if (flags & LOOKUP_RCU) { |
1586 | unsigned seq; | 1523 | br_read_lock(vfsmount_lock); |
1587 | 1524 | rcu_read_lock(); | |
1588 | br_read_lock(vfsmount_lock); | 1525 | set_root_rcu(nd); |
1589 | rcu_read_lock(); | 1526 | } else { |
1590 | 1527 | set_root(nd); | |
1591 | do { | 1528 | path_get(&nd->root); |
1592 | seq = read_seqcount_begin(&fs->seq); | 1529 | } |
1593 | nd->root = fs->root; | 1530 | nd->path = nd->root; |
1594 | nd->path = nd->root; | ||
1595 | nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); | ||
1596 | } while (read_seqcount_retry(&fs->seq, seq)); | ||
1597 | |||
1598 | } else if (dfd == AT_FDCWD) { | 1531 | } else if (dfd == AT_FDCWD) { |
1599 | struct fs_struct *fs = current->fs; | 1532 | if (flags & LOOKUP_RCU) { |
1600 | unsigned seq; | 1533 | struct fs_struct *fs = current->fs; |
1601 | 1534 | unsigned seq; | |
1602 | br_read_lock(vfsmount_lock); | ||
1603 | rcu_read_lock(); | ||
1604 | 1535 | ||
1605 | do { | 1536 | br_read_lock(vfsmount_lock); |
1606 | seq = read_seqcount_begin(&fs->seq); | 1537 | rcu_read_lock(); |
1607 | nd->path = fs->pwd; | ||
1608 | nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); | ||
1609 | } while (read_seqcount_retry(&fs->seq, seq)); | ||
1610 | 1538 | ||
1539 | do { | ||
1540 | seq = read_seqcount_begin(&fs->seq); | ||
1541 | nd->path = fs->pwd; | ||
1542 | nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); | ||
1543 | } while (read_seqcount_retry(&fs->seq, seq)); | ||
1544 | } else { | ||
1545 | get_fs_pwd(current->fs, &nd->path); | ||
1546 | } | ||
1611 | } else { | 1547 | } else { |
1612 | struct dentry *dentry; | 1548 | struct dentry *dentry; |
1613 | 1549 | ||
1614 | file = fget_light(dfd, &fput_needed); | 1550 | file = fget_raw_light(dfd, &fput_needed); |
1615 | retval = -EBADF; | 1551 | retval = -EBADF; |
1616 | if (!file) | 1552 | if (!file) |
1617 | goto out_fail; | 1553 | goto out_fail; |
1618 | 1554 | ||
1619 | dentry = file->f_path.dentry; | 1555 | dentry = file->f_path.dentry; |
1620 | 1556 | ||
1621 | retval = -ENOTDIR; | 1557 | if (*name) { |
1622 | if (!S_ISDIR(dentry->d_inode->i_mode)) | 1558 | retval = -ENOTDIR; |
1623 | goto fput_fail; | 1559 | if (!S_ISDIR(dentry->d_inode->i_mode)) |
1560 | goto fput_fail; | ||
1624 | 1561 | ||
1625 | retval = file_permission(file, MAY_EXEC); | 1562 | retval = file_permission(file, MAY_EXEC); |
1626 | if (retval) | 1563 | if (retval) |
1627 | goto fput_fail; | 1564 | goto fput_fail; |
1565 | } | ||
1628 | 1566 | ||
1629 | nd->path = file->f_path; | 1567 | nd->path = file->f_path; |
1630 | if (fput_needed) | 1568 | if (flags & LOOKUP_RCU) { |
1631 | nd->file = file; | 1569 | if (fput_needed) |
1632 | 1570 | *fp = file; | |
1633 | nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); | 1571 | nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); |
1634 | br_read_lock(vfsmount_lock); | 1572 | br_read_lock(vfsmount_lock); |
1635 | rcu_read_lock(); | 1573 | rcu_read_lock(); |
1574 | } else { | ||
1575 | path_get(&file->f_path); | ||
1576 | fput_light(file, fput_needed); | ||
1577 | } | ||
1636 | } | 1578 | } |
1579 | |||
1637 | nd->inode = nd->path.dentry->d_inode; | 1580 | nd->inode = nd->path.dentry->d_inode; |
1638 | return 0; | 1581 | return 0; |
1639 | 1582 | ||
@@ -1643,60 +1586,23 @@ out_fail: | |||
1643 | return retval; | 1586 | return retval; |
1644 | } | 1587 | } |
1645 | 1588 | ||
1646 | static int path_init(int dfd, const char *name, unsigned int flags, struct nameidata *nd) | 1589 | static inline int lookup_last(struct nameidata *nd, struct path *path) |
1647 | { | 1590 | { |
1648 | int retval = 0; | 1591 | if (nd->last_type == LAST_NORM && nd->last.name[nd->last.len]) |
1649 | int fput_needed; | 1592 | nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY; |
1650 | struct file *file; | ||
1651 | 1593 | ||
1652 | nd->last_type = LAST_ROOT; /* if there are only slashes... */ | 1594 | nd->flags &= ~LOOKUP_PARENT; |
1653 | nd->flags = flags; | 1595 | return walk_component(nd, path, &nd->last, nd->last_type, |
1654 | nd->depth = 0; | 1596 | nd->flags & LOOKUP_FOLLOW); |
1655 | nd->root.mnt = NULL; | ||
1656 | |||
1657 | if (*name=='/') { | ||
1658 | set_root(nd); | ||
1659 | nd->path = nd->root; | ||
1660 | path_get(&nd->root); | ||
1661 | } else if (dfd == AT_FDCWD) { | ||
1662 | get_fs_pwd(current->fs, &nd->path); | ||
1663 | } else { | ||
1664 | struct dentry *dentry; | ||
1665 | |||
1666 | file = fget_light(dfd, &fput_needed); | ||
1667 | retval = -EBADF; | ||
1668 | if (!file) | ||
1669 | goto out_fail; | ||
1670 | |||
1671 | dentry = file->f_path.dentry; | ||
1672 | |||
1673 | retval = -ENOTDIR; | ||
1674 | if (!S_ISDIR(dentry->d_inode->i_mode)) | ||
1675 | goto fput_fail; | ||
1676 | |||
1677 | retval = file_permission(file, MAY_EXEC); | ||
1678 | if (retval) | ||
1679 | goto fput_fail; | ||
1680 | |||
1681 | nd->path = file->f_path; | ||
1682 | path_get(&file->f_path); | ||
1683 | |||
1684 | fput_light(file, fput_needed); | ||
1685 | } | ||
1686 | nd->inode = nd->path.dentry->d_inode; | ||
1687 | return 0; | ||
1688 | |||
1689 | fput_fail: | ||
1690 | fput_light(file, fput_needed); | ||
1691 | out_fail: | ||
1692 | return retval; | ||
1693 | } | 1597 | } |
1694 | 1598 | ||
1695 | /* Returns 0 and nd will be valid on success; Retuns error, otherwise. */ | 1599 | /* Returns 0 and nd will be valid on success; Retuns error, otherwise. */ |
1696 | static int do_path_lookup(int dfd, const char *name, | 1600 | static int path_lookupat(int dfd, const char *name, |
1697 | unsigned int flags, struct nameidata *nd) | 1601 | unsigned int flags, struct nameidata *nd) |
1698 | { | 1602 | { |
1699 | int retval; | 1603 | struct file *base = NULL; |
1604 | struct path path; | ||
1605 | int err; | ||
1700 | 1606 | ||
1701 | /* | 1607 | /* |
1702 | * Path walking is largely split up into 2 different synchronisation | 1608 | * Path walking is largely split up into 2 different synchronisation |
@@ -1712,44 +1618,75 @@ static int do_path_lookup(int dfd, const char *name, | |||
1712 | * be handled by restarting a traditional ref-walk (which will always | 1618 | * be handled by restarting a traditional ref-walk (which will always |
1713 | * be able to complete). | 1619 | * be able to complete). |
1714 | */ | 1620 | */ |
1715 | retval = path_init_rcu(dfd, name, flags, nd); | 1621 | err = path_init(dfd, name, flags | LOOKUP_PARENT, nd, &base); |
1716 | if (unlikely(retval)) | 1622 | |
1717 | return retval; | 1623 | if (unlikely(err)) |
1718 | retval = path_walk_rcu(name, nd); | 1624 | return err; |
1719 | path_finish_rcu(nd); | 1625 | |
1720 | if (nd->root.mnt) { | 1626 | current->total_link_count = 0; |
1721 | path_put(&nd->root); | 1627 | err = link_path_walk(name, nd); |
1722 | nd->root.mnt = NULL; | 1628 | |
1629 | if (!err && !(flags & LOOKUP_PARENT)) { | ||
1630 | err = lookup_last(nd, &path); | ||
1631 | while (err > 0) { | ||
1632 | void *cookie; | ||
1633 | struct path link = path; | ||
1634 | nd->flags |= LOOKUP_PARENT; | ||
1635 | err = follow_link(&link, nd, &cookie); | ||
1636 | if (!err) | ||
1637 | err = lookup_last(nd, &path); | ||
1638 | put_link(nd, &link, cookie); | ||
1639 | } | ||
1723 | } | 1640 | } |
1724 | 1641 | ||
1725 | if (unlikely(retval == -ECHILD || retval == -ESTALE)) { | 1642 | if (nd->flags & LOOKUP_RCU) { |
1726 | /* slower, locked walk */ | 1643 | /* went all way through without dropping RCU */ |
1727 | if (retval == -ESTALE) | 1644 | BUG_ON(err); |
1728 | flags |= LOOKUP_REVAL; | 1645 | if (nameidata_drop_rcu_last(nd)) |
1729 | retval = path_init(dfd, name, flags, nd); | 1646 | err = -ECHILD; |
1730 | if (unlikely(retval)) | 1647 | } |
1731 | return retval; | 1648 | |
1732 | retval = path_walk(name, nd); | 1649 | if (!err) |
1733 | if (nd->root.mnt) { | 1650 | err = handle_reval_path(nd); |
1734 | path_put(&nd->root); | 1651 | |
1735 | nd->root.mnt = NULL; | 1652 | if (!err && nd->flags & LOOKUP_DIRECTORY) { |
1653 | if (!nd->inode->i_op->lookup) { | ||
1654 | path_put(&nd->path); | ||
1655 | return -ENOTDIR; | ||
1736 | } | 1656 | } |
1737 | } | 1657 | } |
1738 | 1658 | ||
1659 | if (base) | ||
1660 | fput(base); | ||
1661 | |||
1662 | if (nd->root.mnt && !(nd->flags & LOOKUP_ROOT)) { | ||
1663 | path_put(&nd->root); | ||
1664 | nd->root.mnt = NULL; | ||
1665 | } | ||
1666 | return err; | ||
1667 | } | ||
1668 | |||
1669 | static int do_path_lookup(int dfd, const char *name, | ||
1670 | unsigned int flags, struct nameidata *nd) | ||
1671 | { | ||
1672 | int retval = path_lookupat(dfd, name, flags | LOOKUP_RCU, nd); | ||
1673 | if (unlikely(retval == -ECHILD)) | ||
1674 | retval = path_lookupat(dfd, name, flags, nd); | ||
1675 | if (unlikely(retval == -ESTALE)) | ||
1676 | retval = path_lookupat(dfd, name, flags | LOOKUP_REVAL, nd); | ||
1677 | |||
1739 | if (likely(!retval)) { | 1678 | if (likely(!retval)) { |
1740 | if (unlikely(!audit_dummy_context())) { | 1679 | if (unlikely(!audit_dummy_context())) { |
1741 | if (nd->path.dentry && nd->inode) | 1680 | if (nd->path.dentry && nd->inode) |
1742 | audit_inode(name, nd->path.dentry); | 1681 | audit_inode(name, nd->path.dentry); |
1743 | } | 1682 | } |
1744 | } | 1683 | } |
1745 | |||
1746 | return retval; | 1684 | return retval; |
1747 | } | 1685 | } |
1748 | 1686 | ||
1749 | int path_lookup(const char *name, unsigned int flags, | 1687 | int kern_path_parent(const char *name, struct nameidata *nd) |
1750 | struct nameidata *nd) | ||
1751 | { | 1688 | { |
1752 | return do_path_lookup(AT_FDCWD, name, flags, nd); | 1689 | return do_path_lookup(AT_FDCWD, name, LOOKUP_PARENT, nd); |
1753 | } | 1690 | } |
1754 | 1691 | ||
1755 | int kern_path(const char *name, unsigned int flags, struct path *path) | 1692 | int kern_path(const char *name, unsigned int flags, struct path *path) |
@@ -1773,29 +1710,10 @@ int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, | |||
1773 | const char *name, unsigned int flags, | 1710 | const char *name, unsigned int flags, |
1774 | struct nameidata *nd) | 1711 | struct nameidata *nd) |
1775 | { | 1712 | { |
1776 | int retval; | 1713 | nd->root.dentry = dentry; |
1777 | 1714 | nd->root.mnt = mnt; | |
1778 | /* same as do_path_lookup */ | 1715 | /* the first argument of do_path_lookup() is ignored with LOOKUP_ROOT */ |
1779 | nd->last_type = LAST_ROOT; | 1716 | return do_path_lookup(AT_FDCWD, name, flags | LOOKUP_ROOT, nd); |
1780 | nd->flags = flags; | ||
1781 | nd->depth = 0; | ||
1782 | |||
1783 | nd->path.dentry = dentry; | ||
1784 | nd->path.mnt = mnt; | ||
1785 | path_get(&nd->path); | ||
1786 | nd->root = nd->path; | ||
1787 | path_get(&nd->root); | ||
1788 | nd->inode = nd->path.dentry->d_inode; | ||
1789 | |||
1790 | retval = path_walk(name, nd); | ||
1791 | if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry && | ||
1792 | nd->inode)) | ||
1793 | audit_inode(name, nd->path.dentry); | ||
1794 | |||
1795 | path_put(&nd->root); | ||
1796 | nd->root.mnt = NULL; | ||
1797 | |||
1798 | return retval; | ||
1799 | } | 1717 | } |
1800 | 1718 | ||
1801 | static struct dentry *__lookup_hash(struct qstr *name, | 1719 | static struct dentry *__lookup_hash(struct qstr *name, |
@@ -1810,17 +1728,6 @@ static struct dentry *__lookup_hash(struct qstr *name, | |||
1810 | return ERR_PTR(err); | 1728 | return ERR_PTR(err); |
1811 | 1729 | ||
1812 | /* | 1730 | /* |
1813 | * See if the low-level filesystem might want | ||
1814 | * to use its own hash.. | ||
1815 | */ | ||
1816 | if (base->d_flags & DCACHE_OP_HASH) { | ||
1817 | err = base->d_op->d_hash(base, inode, name); | ||
1818 | dentry = ERR_PTR(err); | ||
1819 | if (err < 0) | ||
1820 | goto out; | ||
1821 | } | ||
1822 | |||
1823 | /* | ||
1824 | * Don't bother with __d_lookup: callers are for creat as | 1731 | * Don't bother with __d_lookup: callers are for creat as |
1825 | * well as unlink, so a lot of the time it would cost | 1732 | * well as unlink, so a lot of the time it would cost |
1826 | * a double lookup. | 1733 | * a double lookup. |
@@ -1832,7 +1739,7 @@ static struct dentry *__lookup_hash(struct qstr *name, | |||
1832 | 1739 | ||
1833 | if (!dentry) | 1740 | if (!dentry) |
1834 | dentry = d_alloc_and_lookup(base, name, nd); | 1741 | dentry = d_alloc_and_lookup(base, name, nd); |
1835 | out: | 1742 | |
1836 | return dentry; | 1743 | return dentry; |
1837 | } | 1744 | } |
1838 | 1745 | ||
@@ -1846,28 +1753,6 @@ static struct dentry *lookup_hash(struct nameidata *nd) | |||
1846 | return __lookup_hash(&nd->last, nd->path.dentry, nd); | 1753 | return __lookup_hash(&nd->last, nd->path.dentry, nd); |
1847 | } | 1754 | } |
1848 | 1755 | ||
1849 | static int __lookup_one_len(const char *name, struct qstr *this, | ||
1850 | struct dentry *base, int len) | ||
1851 | { | ||
1852 | unsigned long hash; | ||
1853 | unsigned int c; | ||
1854 | |||
1855 | this->name = name; | ||
1856 | this->len = len; | ||
1857 | if (!len) | ||
1858 | return -EACCES; | ||
1859 | |||
1860 | hash = init_name_hash(); | ||
1861 | while (len--) { | ||
1862 | c = *(const unsigned char *)name++; | ||
1863 | if (c == '/' || c == '\0') | ||
1864 | return -EACCES; | ||
1865 | hash = partial_name_hash(c, hash); | ||
1866 | } | ||
1867 | this->hash = end_name_hash(hash); | ||
1868 | return 0; | ||
1869 | } | ||
1870 | |||
1871 | /** | 1756 | /** |
1872 | * lookup_one_len - filesystem helper to lookup single pathname component | 1757 | * lookup_one_len - filesystem helper to lookup single pathname component |
1873 | * @name: pathname component to lookup | 1758 | * @name: pathname component to lookup |
@@ -1881,14 +1766,34 @@ static int __lookup_one_len(const char *name, struct qstr *this, | |||
1881 | */ | 1766 | */ |
1882 | struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) | 1767 | struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) |
1883 | { | 1768 | { |
1884 | int err; | ||
1885 | struct qstr this; | 1769 | struct qstr this; |
1770 | unsigned long hash; | ||
1771 | unsigned int c; | ||
1886 | 1772 | ||
1887 | WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex)); | 1773 | WARN_ON_ONCE(!mutex_is_locked(&base->d_inode->i_mutex)); |
1888 | 1774 | ||
1889 | err = __lookup_one_len(name, &this, base, len); | 1775 | this.name = name; |
1890 | if (err) | 1776 | this.len = len; |
1891 | return ERR_PTR(err); | 1777 | if (!len) |
1778 | return ERR_PTR(-EACCES); | ||
1779 | |||
1780 | hash = init_name_hash(); | ||
1781 | while (len--) { | ||
1782 | c = *(const unsigned char *)name++; | ||
1783 | if (c == '/' || c == '\0') | ||
1784 | return ERR_PTR(-EACCES); | ||
1785 | hash = partial_name_hash(c, hash); | ||
1786 | } | ||
1787 | this.hash = end_name_hash(hash); | ||
1788 | /* | ||
1789 | * See if the low-level filesystem might want | ||
1790 | * to use its own hash.. | ||
1791 | */ | ||
1792 | if (base->d_flags & DCACHE_OP_HASH) { | ||
1793 | int err = base->d_op->d_hash(base, base->d_inode, &this); | ||
1794 | if (err < 0) | ||
1795 | return ERR_PTR(err); | ||
1796 | } | ||
1892 | 1797 | ||
1893 | return __lookup_hash(&this, base, NULL); | 1798 | return __lookup_hash(&this, base, NULL); |
1894 | } | 1799 | } |
@@ -1897,7 +1802,7 @@ int user_path_at(int dfd, const char __user *name, unsigned flags, | |||
1897 | struct path *path) | 1802 | struct path *path) |
1898 | { | 1803 | { |
1899 | struct nameidata nd; | 1804 | struct nameidata nd; |
1900 | char *tmp = getname(name); | 1805 | char *tmp = getname_flags(name, flags); |
1901 | int err = PTR_ERR(tmp); | 1806 | int err = PTR_ERR(tmp); |
1902 | if (!IS_ERR(tmp)) { | 1807 | if (!IS_ERR(tmp)) { |
1903 | 1808 | ||
@@ -2077,12 +1982,16 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
2077 | return error; | 1982 | return error; |
2078 | } | 1983 | } |
2079 | 1984 | ||
2080 | int may_open(struct path *path, int acc_mode, int flag) | 1985 | static int may_open(struct path *path, int acc_mode, int flag) |
2081 | { | 1986 | { |
2082 | struct dentry *dentry = path->dentry; | 1987 | struct dentry *dentry = path->dentry; |
2083 | struct inode *inode = dentry->d_inode; | 1988 | struct inode *inode = dentry->d_inode; |
2084 | int error; | 1989 | int error; |
2085 | 1990 | ||
1991 | /* O_PATH? */ | ||
1992 | if (!acc_mode) | ||
1993 | return 0; | ||
1994 | |||
2086 | if (!inode) | 1995 | if (!inode) |
2087 | return -ENOENT; | 1996 | return -ENOENT; |
2088 | 1997 | ||
@@ -2151,34 +2060,6 @@ static int handle_truncate(struct file *filp) | |||
2151 | } | 2060 | } |
2152 | 2061 | ||
2153 | /* | 2062 | /* |
2154 | * Be careful about ever adding any more callers of this | ||
2155 | * function. Its flags must be in the namei format, not | ||
2156 | * what get passed to sys_open(). | ||
2157 | */ | ||
2158 | static int __open_namei_create(struct nameidata *nd, struct path *path, | ||
2159 | int open_flag, int mode) | ||
2160 | { | ||
2161 | int error; | ||
2162 | struct dentry *dir = nd->path.dentry; | ||
2163 | |||
2164 | if (!IS_POSIXACL(dir->d_inode)) | ||
2165 | mode &= ~current_umask(); | ||
2166 | error = security_path_mknod(&nd->path, path->dentry, mode, 0); | ||
2167 | if (error) | ||
2168 | goto out_unlock; | ||
2169 | error = vfs_create(dir->d_inode, path->dentry, mode, nd); | ||
2170 | out_unlock: | ||
2171 | mutex_unlock(&dir->d_inode->i_mutex); | ||
2172 | dput(nd->path.dentry); | ||
2173 | nd->path.dentry = path->dentry; | ||
2174 | |||
2175 | if (error) | ||
2176 | return error; | ||
2177 | /* Don't check for write permission, don't truncate */ | ||
2178 | return may_open(&nd->path, 0, open_flag & ~O_TRUNC); | ||
2179 | } | ||
2180 | |||
2181 | /* | ||
2182 | * Note that while the flag value (low two bits) for sys_open means: | 2063 | * Note that while the flag value (low two bits) for sys_open means: |
2183 | * 00 - read-only | 2064 | * 00 - read-only |
2184 | * 01 - write-only | 2065 | * 01 - write-only |
@@ -2202,126 +2083,115 @@ static inline int open_to_namei_flags(int flag) | |||
2202 | return flag; | 2083 | return flag; |
2203 | } | 2084 | } |
2204 | 2085 | ||
2205 | static int open_will_truncate(int flag, struct inode *inode) | ||
2206 | { | ||
2207 | /* | ||
2208 | * We'll never write to the fs underlying | ||
2209 | * a device file. | ||
2210 | */ | ||
2211 | if (special_file(inode->i_mode)) | ||
2212 | return 0; | ||
2213 | return (flag & O_TRUNC); | ||
2214 | } | ||
2215 | |||
2216 | static struct file *finish_open(struct nameidata *nd, | ||
2217 | int open_flag, int acc_mode) | ||
2218 | { | ||
2219 | struct file *filp; | ||
2220 | int will_truncate; | ||
2221 | int error; | ||
2222 | |||
2223 | will_truncate = open_will_truncate(open_flag, nd->path.dentry->d_inode); | ||
2224 | if (will_truncate) { | ||
2225 | error = mnt_want_write(nd->path.mnt); | ||
2226 | if (error) | ||
2227 | goto exit; | ||
2228 | } | ||
2229 | error = may_open(&nd->path, acc_mode, open_flag); | ||
2230 | if (error) { | ||
2231 | if (will_truncate) | ||
2232 | mnt_drop_write(nd->path.mnt); | ||
2233 | goto exit; | ||
2234 | } | ||
2235 | filp = nameidata_to_filp(nd); | ||
2236 | if (!IS_ERR(filp)) { | ||
2237 | error = ima_file_check(filp, acc_mode); | ||
2238 | if (error) { | ||
2239 | fput(filp); | ||
2240 | filp = ERR_PTR(error); | ||
2241 | } | ||
2242 | } | ||
2243 | if (!IS_ERR(filp)) { | ||
2244 | if (will_truncate) { | ||
2245 | error = handle_truncate(filp); | ||
2246 | if (error) { | ||
2247 | fput(filp); | ||
2248 | filp = ERR_PTR(error); | ||
2249 | } | ||
2250 | } | ||
2251 | } | ||
2252 | /* | ||
2253 | * It is now safe to drop the mnt write | ||
2254 | * because the filp has had a write taken | ||
2255 | * on its behalf. | ||
2256 | */ | ||
2257 | if (will_truncate) | ||
2258 | mnt_drop_write(nd->path.mnt); | ||
2259 | path_put(&nd->path); | ||
2260 | return filp; | ||
2261 | |||
2262 | exit: | ||
2263 | path_put(&nd->path); | ||
2264 | return ERR_PTR(error); | ||
2265 | } | ||
2266 | |||
2267 | /* | 2086 | /* |
2268 | * Handle O_CREAT case for do_filp_open | 2087 | * Handle the last step of open() |
2269 | */ | 2088 | */ |
2270 | static struct file *do_last(struct nameidata *nd, struct path *path, | 2089 | static struct file *do_last(struct nameidata *nd, struct path *path, |
2271 | int open_flag, int acc_mode, | 2090 | const struct open_flags *op, const char *pathname) |
2272 | int mode, const char *pathname) | ||
2273 | { | 2091 | { |
2274 | struct dentry *dir = nd->path.dentry; | 2092 | struct dentry *dir = nd->path.dentry; |
2093 | struct dentry *dentry; | ||
2094 | int open_flag = op->open_flag; | ||
2095 | int will_truncate = open_flag & O_TRUNC; | ||
2096 | int want_write = 0; | ||
2097 | int acc_mode = op->acc_mode; | ||
2275 | struct file *filp; | 2098 | struct file *filp; |
2276 | int error = -EISDIR; | 2099 | int error; |
2100 | |||
2101 | nd->flags &= ~LOOKUP_PARENT; | ||
2102 | nd->flags |= op->intent; | ||
2277 | 2103 | ||
2278 | switch (nd->last_type) { | 2104 | switch (nd->last_type) { |
2279 | case LAST_DOTDOT: | 2105 | case LAST_DOTDOT: |
2280 | follow_dotdot(nd); | ||
2281 | dir = nd->path.dentry; | ||
2282 | case LAST_DOT: | 2106 | case LAST_DOT: |
2283 | if (need_reval_dot(dir)) { | 2107 | error = handle_dots(nd, nd->last_type); |
2284 | int status = d_revalidate(nd->path.dentry, nd); | 2108 | if (error) |
2285 | if (!status) | 2109 | return ERR_PTR(error); |
2286 | status = -ESTALE; | ||
2287 | if (status < 0) { | ||
2288 | error = status; | ||
2289 | goto exit; | ||
2290 | } | ||
2291 | } | ||
2292 | /* fallthrough */ | 2110 | /* fallthrough */ |
2293 | case LAST_ROOT: | 2111 | case LAST_ROOT: |
2294 | goto exit; | 2112 | if (nd->flags & LOOKUP_RCU) { |
2113 | if (nameidata_drop_rcu_last(nd)) | ||
2114 | return ERR_PTR(-ECHILD); | ||
2115 | } | ||
2116 | error = handle_reval_path(nd); | ||
2117 | if (error) | ||
2118 | goto exit; | ||
2119 | audit_inode(pathname, nd->path.dentry); | ||
2120 | if (open_flag & O_CREAT) { | ||
2121 | error = -EISDIR; | ||
2122 | goto exit; | ||
2123 | } | ||
2124 | goto ok; | ||
2295 | case LAST_BIND: | 2125 | case LAST_BIND: |
2126 | /* can't be RCU mode here */ | ||
2127 | error = handle_reval_path(nd); | ||
2128 | if (error) | ||
2129 | goto exit; | ||
2296 | audit_inode(pathname, dir); | 2130 | audit_inode(pathname, dir); |
2297 | goto ok; | 2131 | goto ok; |
2298 | } | 2132 | } |
2299 | 2133 | ||
2134 | if (!(open_flag & O_CREAT)) { | ||
2135 | int symlink_ok = 0; | ||
2136 | if (nd->last.name[nd->last.len]) | ||
2137 | nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY; | ||
2138 | if (open_flag & O_PATH && !(nd->flags & LOOKUP_FOLLOW)) | ||
2139 | symlink_ok = 1; | ||
2140 | /* we _can_ be in RCU mode here */ | ||
2141 | error = walk_component(nd, path, &nd->last, LAST_NORM, | ||
2142 | !symlink_ok); | ||
2143 | if (error < 0) | ||
2144 | return ERR_PTR(error); | ||
2145 | if (error) /* symlink */ | ||
2146 | return NULL; | ||
2147 | /* sayonara */ | ||
2148 | if (nd->flags & LOOKUP_RCU) { | ||
2149 | if (nameidata_drop_rcu_last(nd)) | ||
2150 | return ERR_PTR(-ECHILD); | ||
2151 | } | ||
2152 | |||
2153 | error = -ENOTDIR; | ||
2154 | if (nd->flags & LOOKUP_DIRECTORY) { | ||
2155 | if (!nd->inode->i_op->lookup) | ||
2156 | goto exit; | ||
2157 | } | ||
2158 | audit_inode(pathname, nd->path.dentry); | ||
2159 | goto ok; | ||
2160 | } | ||
2161 | |||
2162 | /* create side of things */ | ||
2163 | |||
2164 | if (nd->flags & LOOKUP_RCU) { | ||
2165 | if (nameidata_drop_rcu_last(nd)) | ||
2166 | return ERR_PTR(-ECHILD); | ||
2167 | } | ||
2168 | |||
2169 | audit_inode(pathname, dir); | ||
2170 | error = -EISDIR; | ||
2300 | /* trailing slashes? */ | 2171 | /* trailing slashes? */ |
2301 | if (nd->last.name[nd->last.len]) | 2172 | if (nd->last.name[nd->last.len]) |
2302 | goto exit; | 2173 | goto exit; |
2303 | 2174 | ||
2304 | mutex_lock(&dir->d_inode->i_mutex); | 2175 | mutex_lock(&dir->d_inode->i_mutex); |
2305 | 2176 | ||
2306 | path->dentry = lookup_hash(nd); | 2177 | dentry = lookup_hash(nd); |
2307 | path->mnt = nd->path.mnt; | 2178 | error = PTR_ERR(dentry); |
2308 | 2179 | if (IS_ERR(dentry)) { | |
2309 | error = PTR_ERR(path->dentry); | ||
2310 | if (IS_ERR(path->dentry)) { | ||
2311 | mutex_unlock(&dir->d_inode->i_mutex); | 2180 | mutex_unlock(&dir->d_inode->i_mutex); |
2312 | goto exit; | 2181 | goto exit; |
2313 | } | 2182 | } |
2314 | 2183 | ||
2315 | if (IS_ERR(nd->intent.open.file)) { | 2184 | path->dentry = dentry; |
2316 | error = PTR_ERR(nd->intent.open.file); | 2185 | path->mnt = nd->path.mnt; |
2317 | goto exit_mutex_unlock; | ||
2318 | } | ||
2319 | 2186 | ||
2320 | /* Negative dentry, just create the file */ | 2187 | /* Negative dentry, just create the file */ |
2321 | if (!path->dentry->d_inode) { | 2188 | if (!dentry->d_inode) { |
2189 | int mode = op->mode; | ||
2190 | if (!IS_POSIXACL(dir->d_inode)) | ||
2191 | mode &= ~current_umask(); | ||
2322 | /* | 2192 | /* |
2323 | * This write is needed to ensure that a | 2193 | * This write is needed to ensure that a |
2324 | * ro->rw transition does not occur between | 2194 | * rw->ro transition does not occur between |
2325 | * the time when the file is created and when | 2195 | * the time when the file is created and when |
2326 | * a permanent write count is taken through | 2196 | * a permanent write count is taken through |
2327 | * the 'struct file' in nameidata_to_filp(). | 2197 | * the 'struct file' in nameidata_to_filp(). |
@@ -2329,22 +2199,21 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
2329 | error = mnt_want_write(nd->path.mnt); | 2199 | error = mnt_want_write(nd->path.mnt); |
2330 | if (error) | 2200 | if (error) |
2331 | goto exit_mutex_unlock; | 2201 | goto exit_mutex_unlock; |
2332 | error = __open_namei_create(nd, path, open_flag, mode); | 2202 | want_write = 1; |
2333 | if (error) { | 2203 | /* Don't check for write permission, don't truncate */ |
2334 | mnt_drop_write(nd->path.mnt); | 2204 | open_flag &= ~O_TRUNC; |
2335 | goto exit; | 2205 | will_truncate = 0; |
2336 | } | 2206 | acc_mode = MAY_OPEN; |
2337 | filp = nameidata_to_filp(nd); | 2207 | error = security_path_mknod(&nd->path, dentry, mode, 0); |
2338 | mnt_drop_write(nd->path.mnt); | 2208 | if (error) |
2339 | path_put(&nd->path); | 2209 | goto exit_mutex_unlock; |
2340 | if (!IS_ERR(filp)) { | 2210 | error = vfs_create(dir->d_inode, dentry, mode, nd); |
2341 | error = ima_file_check(filp, acc_mode); | 2211 | if (error) |
2342 | if (error) { | 2212 | goto exit_mutex_unlock; |
2343 | fput(filp); | 2213 | mutex_unlock(&dir->d_inode->i_mutex); |
2344 | filp = ERR_PTR(error); | 2214 | dput(nd->path.dentry); |
2345 | } | 2215 | nd->path.dentry = dentry; |
2346 | } | 2216 | goto common; |
2347 | return filp; | ||
2348 | } | 2217 | } |
2349 | 2218 | ||
2350 | /* | 2219 | /* |
@@ -2374,7 +2243,40 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
2374 | if (S_ISDIR(nd->inode->i_mode)) | 2243 | if (S_ISDIR(nd->inode->i_mode)) |
2375 | goto exit; | 2244 | goto exit; |
2376 | ok: | 2245 | ok: |
2377 | filp = finish_open(nd, open_flag, acc_mode); | 2246 | if (!S_ISREG(nd->inode->i_mode)) |
2247 | will_truncate = 0; | ||
2248 | |||
2249 | if (will_truncate) { | ||
2250 | error = mnt_want_write(nd->path.mnt); | ||
2251 | if (error) | ||
2252 | goto exit; | ||
2253 | want_write = 1; | ||
2254 | } | ||
2255 | common: | ||
2256 | error = may_open(&nd->path, acc_mode, open_flag); | ||
2257 | if (error) | ||
2258 | goto exit; | ||
2259 | filp = nameidata_to_filp(nd); | ||
2260 | if (!IS_ERR(filp)) { | ||
2261 | error = ima_file_check(filp, op->acc_mode); | ||
2262 | if (error) { | ||
2263 | fput(filp); | ||
2264 | filp = ERR_PTR(error); | ||
2265 | } | ||
2266 | } | ||
2267 | if (!IS_ERR(filp)) { | ||
2268 | if (will_truncate) { | ||
2269 | error = handle_truncate(filp); | ||
2270 | if (error) { | ||
2271 | fput(filp); | ||
2272 | filp = ERR_PTR(error); | ||
2273 | } | ||
2274 | } | ||
2275 | } | ||
2276 | out: | ||
2277 | if (want_write) | ||
2278 | mnt_drop_write(nd->path.mnt); | ||
2279 | path_put(&nd->path); | ||
2378 | return filp; | 2280 | return filp; |
2379 | 2281 | ||
2380 | exit_mutex_unlock: | 2282 | exit_mutex_unlock: |
@@ -2382,197 +2284,103 @@ exit_mutex_unlock: | |||
2382 | exit_dput: | 2284 | exit_dput: |
2383 | path_put_conditional(path, nd); | 2285 | path_put_conditional(path, nd); |
2384 | exit: | 2286 | exit: |
2385 | path_put(&nd->path); | 2287 | filp = ERR_PTR(error); |
2386 | return ERR_PTR(error); | 2288 | goto out; |
2387 | } | 2289 | } |
2388 | 2290 | ||
2389 | /* | 2291 | static struct file *path_openat(int dfd, const char *pathname, |
2390 | * Note that the low bits of the passed in "open_flag" | 2292 | struct nameidata *nd, const struct open_flags *op, int flags) |
2391 | * are not the same as in the local variable "flag". See | ||
2392 | * open_to_namei_flags() for more details. | ||
2393 | */ | ||
2394 | struct file *do_filp_open(int dfd, const char *pathname, | ||
2395 | int open_flag, int mode, int acc_mode) | ||
2396 | { | 2293 | { |
2294 | struct file *base = NULL; | ||
2397 | struct file *filp; | 2295 | struct file *filp; |
2398 | struct nameidata nd; | ||
2399 | int error; | ||
2400 | struct path path; | 2296 | struct path path; |
2401 | int count = 0; | 2297 | int error; |
2402 | int flag = open_to_namei_flags(open_flag); | ||
2403 | int flags; | ||
2404 | |||
2405 | if (!(open_flag & O_CREAT)) | ||
2406 | mode = 0; | ||
2407 | |||
2408 | /* Must never be set by userspace */ | ||
2409 | open_flag &= ~FMODE_NONOTIFY; | ||
2410 | |||
2411 | /* | ||
2412 | * O_SYNC is implemented as __O_SYNC|O_DSYNC. As many places only | ||
2413 | * check for O_DSYNC if the need any syncing at all we enforce it's | ||
2414 | * always set instead of having to deal with possibly weird behaviour | ||
2415 | * for malicious applications setting only __O_SYNC. | ||
2416 | */ | ||
2417 | if (open_flag & __O_SYNC) | ||
2418 | open_flag |= O_DSYNC; | ||
2419 | |||
2420 | if (!acc_mode) | ||
2421 | acc_mode = MAY_OPEN | ACC_MODE(open_flag); | ||
2422 | |||
2423 | /* O_TRUNC implies we need access checks for write permissions */ | ||
2424 | if (open_flag & O_TRUNC) | ||
2425 | acc_mode |= MAY_WRITE; | ||
2426 | |||
2427 | /* Allow the LSM permission hook to distinguish append | ||
2428 | access from general write access. */ | ||
2429 | if (open_flag & O_APPEND) | ||
2430 | acc_mode |= MAY_APPEND; | ||
2431 | |||
2432 | flags = LOOKUP_OPEN; | ||
2433 | if (open_flag & O_CREAT) { | ||
2434 | flags |= LOOKUP_CREATE; | ||
2435 | if (open_flag & O_EXCL) | ||
2436 | flags |= LOOKUP_EXCL; | ||
2437 | } | ||
2438 | if (open_flag & O_DIRECTORY) | ||
2439 | flags |= LOOKUP_DIRECTORY; | ||
2440 | if (!(open_flag & O_NOFOLLOW)) | ||
2441 | flags |= LOOKUP_FOLLOW; | ||
2442 | 2298 | ||
2443 | filp = get_empty_filp(); | 2299 | filp = get_empty_filp(); |
2444 | if (!filp) | 2300 | if (!filp) |
2445 | return ERR_PTR(-ENFILE); | 2301 | return ERR_PTR(-ENFILE); |
2446 | 2302 | ||
2447 | filp->f_flags = open_flag; | 2303 | filp->f_flags = op->open_flag; |
2448 | nd.intent.open.file = filp; | 2304 | nd->intent.open.file = filp; |
2449 | nd.intent.open.flags = flag; | 2305 | nd->intent.open.flags = open_to_namei_flags(op->open_flag); |
2450 | nd.intent.open.create_mode = mode; | 2306 | nd->intent.open.create_mode = op->mode; |
2451 | |||
2452 | if (open_flag & O_CREAT) | ||
2453 | goto creat; | ||
2454 | 2307 | ||
2455 | /* !O_CREAT, simple open */ | 2308 | error = path_init(dfd, pathname, flags | LOOKUP_PARENT, nd, &base); |
2456 | error = do_path_lookup(dfd, pathname, flags, &nd); | ||
2457 | if (unlikely(error)) | 2309 | if (unlikely(error)) |
2458 | goto out_filp; | 2310 | goto out_filp; |
2459 | error = -ELOOP; | ||
2460 | if (!(nd.flags & LOOKUP_FOLLOW)) { | ||
2461 | if (nd.inode->i_op->follow_link) | ||
2462 | goto out_path; | ||
2463 | } | ||
2464 | error = -ENOTDIR; | ||
2465 | if (nd.flags & LOOKUP_DIRECTORY) { | ||
2466 | if (!nd.inode->i_op->lookup) | ||
2467 | goto out_path; | ||
2468 | } | ||
2469 | audit_inode(pathname, nd.path.dentry); | ||
2470 | filp = finish_open(&nd, open_flag, acc_mode); | ||
2471 | release_open_intent(&nd); | ||
2472 | return filp; | ||
2473 | 2311 | ||
2474 | creat: | 2312 | current->total_link_count = 0; |
2475 | /* OK, have to create the file. Find the parent. */ | 2313 | error = link_path_walk(pathname, nd); |
2476 | error = path_init_rcu(dfd, pathname, | ||
2477 | LOOKUP_PARENT | (flags & LOOKUP_REVAL), &nd); | ||
2478 | if (error) | ||
2479 | goto out_filp; | ||
2480 | error = path_walk_rcu(pathname, &nd); | ||
2481 | path_finish_rcu(&nd); | ||
2482 | if (unlikely(error == -ECHILD || error == -ESTALE)) { | ||
2483 | /* slower, locked walk */ | ||
2484 | if (error == -ESTALE) { | ||
2485 | reval: | ||
2486 | flags |= LOOKUP_REVAL; | ||
2487 | } | ||
2488 | error = path_init(dfd, pathname, | ||
2489 | LOOKUP_PARENT | (flags & LOOKUP_REVAL), &nd); | ||
2490 | if (error) | ||
2491 | goto out_filp; | ||
2492 | |||
2493 | error = path_walk_simple(pathname, &nd); | ||
2494 | } | ||
2495 | if (unlikely(error)) | 2314 | if (unlikely(error)) |
2496 | goto out_filp; | 2315 | goto out_filp; |
2497 | if (unlikely(!audit_dummy_context())) | ||
2498 | audit_inode(pathname, nd.path.dentry); | ||
2499 | 2316 | ||
2500 | /* | 2317 | filp = do_last(nd, &path, op, pathname); |
2501 | * We have the parent and last component. | ||
2502 | */ | ||
2503 | nd.flags = flags; | ||
2504 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); | ||
2505 | while (unlikely(!filp)) { /* trailing symlink */ | 2318 | while (unlikely(!filp)) { /* trailing symlink */ |
2506 | struct path link = path; | 2319 | struct path link = path; |
2507 | struct inode *linki = link.dentry->d_inode; | ||
2508 | void *cookie; | 2320 | void *cookie; |
2509 | error = -ELOOP; | 2321 | if (!(nd->flags & LOOKUP_FOLLOW)) { |
2510 | if (!(nd.flags & LOOKUP_FOLLOW)) | 2322 | path_put_conditional(&path, nd); |
2511 | goto exit_dput; | 2323 | path_put(&nd->path); |
2512 | if (count++ == 32) | 2324 | filp = ERR_PTR(-ELOOP); |
2513 | goto exit_dput; | 2325 | break; |
2514 | /* | ||
2515 | * This is subtle. Instead of calling do_follow_link() we do | ||
2516 | * the thing by hands. The reason is that this way we have zero | ||
2517 | * link_count and path_walk() (called from ->follow_link) | ||
2518 | * honoring LOOKUP_PARENT. After that we have the parent and | ||
2519 | * last component, i.e. we are in the same situation as after | ||
2520 | * the first path_walk(). Well, almost - if the last component | ||
2521 | * is normal we get its copy stored in nd->last.name and we will | ||
2522 | * have to putname() it when we are done. Procfs-like symlinks | ||
2523 | * just set LAST_BIND. | ||
2524 | */ | ||
2525 | nd.flags |= LOOKUP_PARENT; | ||
2526 | error = security_inode_follow_link(link.dentry, &nd); | ||
2527 | if (error) | ||
2528 | goto exit_dput; | ||
2529 | error = __do_follow_link(&link, &nd, &cookie); | ||
2530 | if (unlikely(error)) { | ||
2531 | if (!IS_ERR(cookie) && linki->i_op->put_link) | ||
2532 | linki->i_op->put_link(link.dentry, &nd, cookie); | ||
2533 | /* nd.path had been dropped */ | ||
2534 | nd.path = link; | ||
2535 | goto out_path; | ||
2536 | } | 2326 | } |
2537 | nd.flags &= ~LOOKUP_PARENT; | 2327 | nd->flags |= LOOKUP_PARENT; |
2538 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); | 2328 | nd->flags &= ~(LOOKUP_OPEN|LOOKUP_CREATE|LOOKUP_EXCL); |
2539 | if (linki->i_op->put_link) | 2329 | error = follow_link(&link, nd, &cookie); |
2540 | linki->i_op->put_link(link.dentry, &nd, cookie); | 2330 | if (unlikely(error)) |
2541 | path_put(&link); | 2331 | filp = ERR_PTR(error); |
2332 | else | ||
2333 | filp = do_last(nd, &path, op, pathname); | ||
2334 | put_link(nd, &link, cookie); | ||
2542 | } | 2335 | } |
2543 | out: | 2336 | out: |
2544 | if (nd.root.mnt) | 2337 | if (nd->root.mnt && !(nd->flags & LOOKUP_ROOT)) |
2545 | path_put(&nd.root); | 2338 | path_put(&nd->root); |
2546 | if (filp == ERR_PTR(-ESTALE) && !(flags & LOOKUP_REVAL)) | 2339 | if (base) |
2547 | goto reval; | 2340 | fput(base); |
2548 | release_open_intent(&nd); | 2341 | release_open_intent(nd); |
2549 | return filp; | 2342 | return filp; |
2550 | 2343 | ||
2551 | exit_dput: | ||
2552 | path_put_conditional(&path, &nd); | ||
2553 | out_path: | ||
2554 | path_put(&nd.path); | ||
2555 | out_filp: | 2344 | out_filp: |
2556 | filp = ERR_PTR(error); | 2345 | filp = ERR_PTR(error); |
2557 | goto out; | 2346 | goto out; |
2558 | } | 2347 | } |
2559 | 2348 | ||
2560 | /** | 2349 | struct file *do_filp_open(int dfd, const char *pathname, |
2561 | * filp_open - open file and return file pointer | 2350 | const struct open_flags *op, int flags) |
2562 | * | 2351 | { |
2563 | * @filename: path to open | 2352 | struct nameidata nd; |
2564 | * @flags: open flags as per the open(2) second argument | 2353 | struct file *filp; |
2565 | * @mode: mode for the new file if O_CREAT is set, else ignored | 2354 | |
2566 | * | 2355 | filp = path_openat(dfd, pathname, &nd, op, flags | LOOKUP_RCU); |
2567 | * This is the helper to open a file from kernelspace if you really | 2356 | if (unlikely(filp == ERR_PTR(-ECHILD))) |
2568 | * have to. But in generally you should not do this, so please move | 2357 | filp = path_openat(dfd, pathname, &nd, op, flags); |
2569 | * along, nothing to see here.. | 2358 | if (unlikely(filp == ERR_PTR(-ESTALE))) |
2570 | */ | 2359 | filp = path_openat(dfd, pathname, &nd, op, flags | LOOKUP_REVAL); |
2571 | struct file *filp_open(const char *filename, int flags, int mode) | 2360 | return filp; |
2361 | } | ||
2362 | |||
2363 | struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt, | ||
2364 | const char *name, const struct open_flags *op, int flags) | ||
2572 | { | 2365 | { |
2573 | return do_filp_open(AT_FDCWD, filename, flags, mode, 0); | 2366 | struct nameidata nd; |
2367 | struct file *file; | ||
2368 | |||
2369 | nd.root.mnt = mnt; | ||
2370 | nd.root.dentry = dentry; | ||
2371 | |||
2372 | flags |= LOOKUP_ROOT; | ||
2373 | |||
2374 | if (dentry->d_inode->i_op->follow_link && op->intent & LOOKUP_OPEN) | ||
2375 | return ERR_PTR(-ELOOP); | ||
2376 | |||
2377 | file = path_openat(-1, name, &nd, op, flags | LOOKUP_RCU); | ||
2378 | if (unlikely(file == ERR_PTR(-ECHILD))) | ||
2379 | file = path_openat(-1, name, &nd, op, flags); | ||
2380 | if (unlikely(file == ERR_PTR(-ESTALE))) | ||
2381 | file = path_openat(-1, name, &nd, op, flags | LOOKUP_REVAL); | ||
2382 | return file; | ||
2574 | } | 2383 | } |
2575 | EXPORT_SYMBOL(filp_open); | ||
2576 | 2384 | ||
2577 | /** | 2385 | /** |
2578 | * lookup_create - lookup a dentry, creating it if it doesn't exist | 2386 | * lookup_create - lookup a dentry, creating it if it doesn't exist |
@@ -3111,7 +2919,11 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de | |||
3111 | return error; | 2919 | return error; |
3112 | 2920 | ||
3113 | mutex_lock(&inode->i_mutex); | 2921 | mutex_lock(&inode->i_mutex); |
3114 | error = dir->i_op->link(old_dentry, dir, new_dentry); | 2922 | /* Make sure we don't allow creating hardlink to an unlinked file */ |
2923 | if (inode->i_nlink == 0) | ||
2924 | error = -ENOENT; | ||
2925 | else | ||
2926 | error = dir->i_op->link(old_dentry, dir, new_dentry); | ||
3115 | mutex_unlock(&inode->i_mutex); | 2927 | mutex_unlock(&inode->i_mutex); |
3116 | if (!error) | 2928 | if (!error) |
3117 | fsnotify_link(dir, inode, new_dentry); | 2929 | fsnotify_link(dir, inode, new_dentry); |
@@ -3133,15 +2945,27 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname, | |||
3133 | struct dentry *new_dentry; | 2945 | struct dentry *new_dentry; |
3134 | struct nameidata nd; | 2946 | struct nameidata nd; |
3135 | struct path old_path; | 2947 | struct path old_path; |
2948 | int how = 0; | ||
3136 | int error; | 2949 | int error; |
3137 | char *to; | 2950 | char *to; |
3138 | 2951 | ||
3139 | if ((flags & ~AT_SYMLINK_FOLLOW) != 0) | 2952 | if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0) |
3140 | return -EINVAL; | 2953 | return -EINVAL; |
2954 | /* | ||
2955 | * To use null names we require CAP_DAC_READ_SEARCH | ||
2956 | * This ensures that not everyone will be able to create | ||
2957 | * handlink using the passed filedescriptor. | ||
2958 | */ | ||
2959 | if (flags & AT_EMPTY_PATH) { | ||
2960 | if (!capable(CAP_DAC_READ_SEARCH)) | ||
2961 | return -ENOENT; | ||
2962 | how = LOOKUP_EMPTY; | ||
2963 | } | ||
2964 | |||
2965 | if (flags & AT_SYMLINK_FOLLOW) | ||
2966 | how |= LOOKUP_FOLLOW; | ||
3141 | 2967 | ||
3142 | error = user_path_at(olddfd, oldname, | 2968 | error = user_path_at(olddfd, oldname, how, &old_path); |
3143 | flags & AT_SYMLINK_FOLLOW ? LOOKUP_FOLLOW : 0, | ||
3144 | &old_path); | ||
3145 | if (error) | 2969 | if (error) |
3146 | return error; | 2970 | return error; |
3147 | 2971 | ||
@@ -3578,7 +3402,7 @@ EXPORT_SYMBOL(page_readlink); | |||
3578 | EXPORT_SYMBOL(__page_symlink); | 3402 | EXPORT_SYMBOL(__page_symlink); |
3579 | EXPORT_SYMBOL(page_symlink); | 3403 | EXPORT_SYMBOL(page_symlink); |
3580 | EXPORT_SYMBOL(page_symlink_inode_operations); | 3404 | EXPORT_SYMBOL(page_symlink_inode_operations); |
3581 | EXPORT_SYMBOL(path_lookup); | 3405 | EXPORT_SYMBOL(kern_path_parent); |
3582 | EXPORT_SYMBOL(kern_path); | 3406 | EXPORT_SYMBOL(kern_path); |
3583 | EXPORT_SYMBOL(vfs_path_lookup); | 3407 | EXPORT_SYMBOL(vfs_path_lookup); |
3584 | EXPORT_SYMBOL(inode_permission); | 3408 | EXPORT_SYMBOL(inode_permission); |
diff --git a/fs/namespace.c b/fs/namespace.c index 7b0b95371696..dffe6f49ab93 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -1002,6 +1002,18 @@ const struct seq_operations mounts_op = { | |||
1002 | .show = show_vfsmnt | 1002 | .show = show_vfsmnt |
1003 | }; | 1003 | }; |
1004 | 1004 | ||
1005 | static int uuid_is_nil(u8 *uuid) | ||
1006 | { | ||
1007 | int i; | ||
1008 | u8 *cp = (u8 *)uuid; | ||
1009 | |||
1010 | for (i = 0; i < 16; i++) { | ||
1011 | if (*cp++) | ||
1012 | return 0; | ||
1013 | } | ||
1014 | return 1; | ||
1015 | } | ||
1016 | |||
1005 | static int show_mountinfo(struct seq_file *m, void *v) | 1017 | static int show_mountinfo(struct seq_file *m, void *v) |
1006 | { | 1018 | { |
1007 | struct proc_mounts *p = m->private; | 1019 | struct proc_mounts *p = m->private; |
@@ -1040,6 +1052,10 @@ static int show_mountinfo(struct seq_file *m, void *v) | |||
1040 | if (IS_MNT_UNBINDABLE(mnt)) | 1052 | if (IS_MNT_UNBINDABLE(mnt)) |
1041 | seq_puts(m, " unbindable"); | 1053 | seq_puts(m, " unbindable"); |
1042 | 1054 | ||
1055 | if (!uuid_is_nil(mnt->mnt_sb->s_uuid)) | ||
1056 | /* print the uuid */ | ||
1057 | seq_printf(m, " uuid:%pU", mnt->mnt_sb->s_uuid); | ||
1058 | |||
1043 | /* Filesystem specific data */ | 1059 | /* Filesystem specific data */ |
1044 | seq_puts(m, " - "); | 1060 | seq_puts(m, " - "); |
1045 | show_type(m, sb); | 1061 | show_type(m, sb); |
@@ -1244,7 +1260,7 @@ static int do_umount(struct vfsmount *mnt, int flags) | |||
1244 | */ | 1260 | */ |
1245 | br_write_lock(vfsmount_lock); | 1261 | br_write_lock(vfsmount_lock); |
1246 | if (mnt_get_count(mnt) != 2) { | 1262 | if (mnt_get_count(mnt) != 2) { |
1247 | br_write_lock(vfsmount_lock); | 1263 | br_write_unlock(vfsmount_lock); |
1248 | return -EBUSY; | 1264 | return -EBUSY; |
1249 | } | 1265 | } |
1250 | br_write_unlock(vfsmount_lock); | 1266 | br_write_unlock(vfsmount_lock); |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 1cc600e77bb4..2f8e61816d75 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/inet.h> | 37 | #include <linux/inet.h> |
38 | #include <linux/nfs_xdr.h> | 38 | #include <linux/nfs_xdr.h> |
39 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
40 | #include <linux/compat.h> | ||
40 | 41 | ||
41 | #include <asm/system.h> | 42 | #include <asm/system.h> |
42 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
@@ -89,7 +90,11 @@ int nfs_wait_bit_killable(void *word) | |||
89 | */ | 90 | */ |
90 | u64 nfs_compat_user_ino64(u64 fileid) | 91 | u64 nfs_compat_user_ino64(u64 fileid) |
91 | { | 92 | { |
92 | int ino; | 93 | #ifdef CONFIG_COMPAT |
94 | compat_ulong_t ino; | ||
95 | #else | ||
96 | unsigned long ino; | ||
97 | #endif | ||
93 | 98 | ||
94 | if (enable_ino64) | 99 | if (enable_ino64) |
95 | return fileid; | 100 | return fileid; |
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 7a7474073148..1be36cf65bfc 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h | |||
@@ -298,6 +298,11 @@ struct rpc_cred *nfs4_get_renew_cred_locked(struct nfs_client *clp); | |||
298 | #if defined(CONFIG_NFS_V4_1) | 298 | #if defined(CONFIG_NFS_V4_1) |
299 | struct rpc_cred *nfs4_get_machine_cred_locked(struct nfs_client *clp); | 299 | struct rpc_cred *nfs4_get_machine_cred_locked(struct nfs_client *clp); |
300 | struct rpc_cred *nfs4_get_exchange_id_cred(struct nfs_client *clp); | 300 | struct rpc_cred *nfs4_get_exchange_id_cred(struct nfs_client *clp); |
301 | extern void nfs4_schedule_session_recovery(struct nfs4_session *); | ||
302 | #else | ||
303 | static inline void nfs4_schedule_session_recovery(struct nfs4_session *session) | ||
304 | { | ||
305 | } | ||
301 | #endif /* CONFIG_NFS_V4_1 */ | 306 | #endif /* CONFIG_NFS_V4_1 */ |
302 | 307 | ||
303 | extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *); | 308 | extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struct rpc_cred *); |
@@ -307,10 +312,9 @@ extern void nfs4_put_open_state(struct nfs4_state *); | |||
307 | extern void nfs4_close_state(struct path *, struct nfs4_state *, fmode_t); | 312 | extern void nfs4_close_state(struct path *, struct nfs4_state *, fmode_t); |
308 | extern void nfs4_close_sync(struct path *, struct nfs4_state *, fmode_t); | 313 | extern void nfs4_close_sync(struct path *, struct nfs4_state *, fmode_t); |
309 | extern void nfs4_state_set_mode_locked(struct nfs4_state *, fmode_t); | 314 | extern void nfs4_state_set_mode_locked(struct nfs4_state *, fmode_t); |
310 | extern void nfs4_schedule_state_recovery(struct nfs_client *); | 315 | extern void nfs4_schedule_lease_recovery(struct nfs_client *); |
311 | extern void nfs4_schedule_state_manager(struct nfs_client *); | 316 | extern void nfs4_schedule_state_manager(struct nfs_client *); |
312 | extern int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *state); | 317 | extern void nfs4_schedule_stateid_recovery(const struct nfs_server *, struct nfs4_state *); |
313 | extern int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state); | ||
314 | extern void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags); | 318 | extern void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags); |
315 | extern void nfs41_handle_recall_slot(struct nfs_client *clp); | 319 | extern void nfs41_handle_recall_slot(struct nfs_client *clp); |
316 | extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp); | 320 | extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp); |
diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c index f5c9b125e8cc..b73c34375f60 100644 --- a/fs/nfs/nfs4filelayoutdev.c +++ b/fs/nfs/nfs4filelayoutdev.c | |||
@@ -219,6 +219,10 @@ decode_and_add_ds(__be32 **pp, struct inode *inode) | |||
219 | goto out_err; | 219 | goto out_err; |
220 | } | 220 | } |
221 | buf = kmalloc(rlen + 1, GFP_KERNEL); | 221 | buf = kmalloc(rlen + 1, GFP_KERNEL); |
222 | if (!buf) { | ||
223 | dprintk("%s: Not enough memory\n", __func__); | ||
224 | goto out_err; | ||
225 | } | ||
222 | buf[rlen] = '\0'; | 226 | buf[rlen] = '\0'; |
223 | memcpy(buf, r_addr, rlen); | 227 | memcpy(buf, r_addr, rlen); |
224 | 228 | ||
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 78936a8f40ab..0a07e353a961 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -256,12 +256,13 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, | |||
256 | case -NFS4ERR_OPENMODE: | 256 | case -NFS4ERR_OPENMODE: |
257 | if (state == NULL) | 257 | if (state == NULL) |
258 | break; | 258 | break; |
259 | nfs4_state_mark_reclaim_nograce(clp, state); | 259 | nfs4_schedule_stateid_recovery(server, state); |
260 | goto do_state_recovery; | 260 | goto wait_on_recovery; |
261 | case -NFS4ERR_STALE_STATEID: | 261 | case -NFS4ERR_STALE_STATEID: |
262 | case -NFS4ERR_STALE_CLIENTID: | 262 | case -NFS4ERR_STALE_CLIENTID: |
263 | case -NFS4ERR_EXPIRED: | 263 | case -NFS4ERR_EXPIRED: |
264 | goto do_state_recovery; | 264 | nfs4_schedule_lease_recovery(clp); |
265 | goto wait_on_recovery; | ||
265 | #if defined(CONFIG_NFS_V4_1) | 266 | #if defined(CONFIG_NFS_V4_1) |
266 | case -NFS4ERR_BADSESSION: | 267 | case -NFS4ERR_BADSESSION: |
267 | case -NFS4ERR_BADSLOT: | 268 | case -NFS4ERR_BADSLOT: |
@@ -272,7 +273,7 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, | |||
272 | case -NFS4ERR_SEQ_MISORDERED: | 273 | case -NFS4ERR_SEQ_MISORDERED: |
273 | dprintk("%s ERROR: %d Reset session\n", __func__, | 274 | dprintk("%s ERROR: %d Reset session\n", __func__, |
274 | errorcode); | 275 | errorcode); |
275 | nfs4_schedule_state_recovery(clp); | 276 | nfs4_schedule_session_recovery(clp->cl_session); |
276 | exception->retry = 1; | 277 | exception->retry = 1; |
277 | break; | 278 | break; |
278 | #endif /* defined(CONFIG_NFS_V4_1) */ | 279 | #endif /* defined(CONFIG_NFS_V4_1) */ |
@@ -295,8 +296,7 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, | |||
295 | } | 296 | } |
296 | /* We failed to handle the error */ | 297 | /* We failed to handle the error */ |
297 | return nfs4_map_errors(ret); | 298 | return nfs4_map_errors(ret); |
298 | do_state_recovery: | 299 | wait_on_recovery: |
299 | nfs4_schedule_state_recovery(clp); | ||
300 | ret = nfs4_wait_clnt_recover(clp); | 300 | ret = nfs4_wait_clnt_recover(clp); |
301 | if (ret == 0) | 301 | if (ret == 0) |
302 | exception->retry = 1; | 302 | exception->retry = 1; |
@@ -435,8 +435,8 @@ static int nfs41_sequence_done(struct rpc_task *task, struct nfs4_sequence_res * | |||
435 | clp = res->sr_session->clp; | 435 | clp = res->sr_session->clp; |
436 | do_renew_lease(clp, timestamp); | 436 | do_renew_lease(clp, timestamp); |
437 | /* Check sequence flags */ | 437 | /* Check sequence flags */ |
438 | if (atomic_read(&clp->cl_count) > 1) | 438 | if (res->sr_status_flags != 0) |
439 | nfs41_handle_sequence_flag_errors(clp, res->sr_status_flags); | 439 | nfs4_schedule_lease_recovery(clp); |
440 | break; | 440 | break; |
441 | case -NFS4ERR_DELAY: | 441 | case -NFS4ERR_DELAY: |
442 | /* The server detected a resend of the RPC call and | 442 | /* The server detected a resend of the RPC call and |
@@ -1255,14 +1255,13 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state | |||
1255 | case -NFS4ERR_BAD_HIGH_SLOT: | 1255 | case -NFS4ERR_BAD_HIGH_SLOT: |
1256 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: | 1256 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: |
1257 | case -NFS4ERR_DEADSESSION: | 1257 | case -NFS4ERR_DEADSESSION: |
1258 | nfs4_schedule_state_recovery( | 1258 | nfs4_schedule_session_recovery(server->nfs_client->cl_session); |
1259 | server->nfs_client); | ||
1260 | goto out; | 1259 | goto out; |
1261 | case -NFS4ERR_STALE_CLIENTID: | 1260 | case -NFS4ERR_STALE_CLIENTID: |
1262 | case -NFS4ERR_STALE_STATEID: | 1261 | case -NFS4ERR_STALE_STATEID: |
1263 | case -NFS4ERR_EXPIRED: | 1262 | case -NFS4ERR_EXPIRED: |
1264 | /* Don't recall a delegation if it was lost */ | 1263 | /* Don't recall a delegation if it was lost */ |
1265 | nfs4_schedule_state_recovery(server->nfs_client); | 1264 | nfs4_schedule_lease_recovery(server->nfs_client); |
1266 | goto out; | 1265 | goto out; |
1267 | case -ERESTARTSYS: | 1266 | case -ERESTARTSYS: |
1268 | /* | 1267 | /* |
@@ -1271,7 +1270,7 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state | |||
1271 | */ | 1270 | */ |
1272 | case -NFS4ERR_ADMIN_REVOKED: | 1271 | case -NFS4ERR_ADMIN_REVOKED: |
1273 | case -NFS4ERR_BAD_STATEID: | 1272 | case -NFS4ERR_BAD_STATEID: |
1274 | nfs4_state_mark_reclaim_nograce(server->nfs_client, state); | 1273 | nfs4_schedule_stateid_recovery(server, state); |
1275 | case -EKEYEXPIRED: | 1274 | case -EKEYEXPIRED: |
1276 | /* | 1275 | /* |
1277 | * User RPCSEC_GSS context has expired. | 1276 | * User RPCSEC_GSS context has expired. |
@@ -1587,7 +1586,7 @@ static int nfs4_recover_expired_lease(struct nfs_server *server) | |||
1587 | if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) && | 1586 | if (!test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) && |
1588 | !test_bit(NFS4CLNT_CHECK_LEASE,&clp->cl_state)) | 1587 | !test_bit(NFS4CLNT_CHECK_LEASE,&clp->cl_state)) |
1589 | break; | 1588 | break; |
1590 | nfs4_schedule_state_recovery(clp); | 1589 | nfs4_schedule_state_manager(clp); |
1591 | ret = -EIO; | 1590 | ret = -EIO; |
1592 | } | 1591 | } |
1593 | return ret; | 1592 | return ret; |
@@ -3178,7 +3177,7 @@ static void nfs4_renew_done(struct rpc_task *task, void *calldata) | |||
3178 | if (task->tk_status < 0) { | 3177 | if (task->tk_status < 0) { |
3179 | /* Unless we're shutting down, schedule state recovery! */ | 3178 | /* Unless we're shutting down, schedule state recovery! */ |
3180 | if (test_bit(NFS_CS_RENEWD, &clp->cl_res_state) != 0) | 3179 | if (test_bit(NFS_CS_RENEWD, &clp->cl_res_state) != 0) |
3181 | nfs4_schedule_state_recovery(clp); | 3180 | nfs4_schedule_lease_recovery(clp); |
3182 | return; | 3181 | return; |
3183 | } | 3182 | } |
3184 | do_renew_lease(clp, timestamp); | 3183 | do_renew_lease(clp, timestamp); |
@@ -3252,6 +3251,35 @@ static void buf_to_pages(const void *buf, size_t buflen, | |||
3252 | } | 3251 | } |
3253 | } | 3252 | } |
3254 | 3253 | ||
3254 | static int buf_to_pages_noslab(const void *buf, size_t buflen, | ||
3255 | struct page **pages, unsigned int *pgbase) | ||
3256 | { | ||
3257 | struct page *newpage, **spages; | ||
3258 | int rc = 0; | ||
3259 | size_t len; | ||
3260 | spages = pages; | ||
3261 | |||
3262 | do { | ||
3263 | len = min_t(size_t, PAGE_CACHE_SIZE, buflen); | ||
3264 | newpage = alloc_page(GFP_KERNEL); | ||
3265 | |||
3266 | if (newpage == NULL) | ||
3267 | goto unwind; | ||
3268 | memcpy(page_address(newpage), buf, len); | ||
3269 | buf += len; | ||
3270 | buflen -= len; | ||
3271 | *pages++ = newpage; | ||
3272 | rc++; | ||
3273 | } while (buflen != 0); | ||
3274 | |||
3275 | return rc; | ||
3276 | |||
3277 | unwind: | ||
3278 | for(; rc > 0; rc--) | ||
3279 | __free_page(spages[rc-1]); | ||
3280 | return -ENOMEM; | ||
3281 | } | ||
3282 | |||
3255 | struct nfs4_cached_acl { | 3283 | struct nfs4_cached_acl { |
3256 | int cached; | 3284 | int cached; |
3257 | size_t len; | 3285 | size_t len; |
@@ -3420,13 +3448,23 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl | |||
3420 | .rpc_argp = &arg, | 3448 | .rpc_argp = &arg, |
3421 | .rpc_resp = &res, | 3449 | .rpc_resp = &res, |
3422 | }; | 3450 | }; |
3423 | int ret; | 3451 | int ret, i; |
3424 | 3452 | ||
3425 | if (!nfs4_server_supports_acls(server)) | 3453 | if (!nfs4_server_supports_acls(server)) |
3426 | return -EOPNOTSUPP; | 3454 | return -EOPNOTSUPP; |
3455 | i = buf_to_pages_noslab(buf, buflen, arg.acl_pages, &arg.acl_pgbase); | ||
3456 | if (i < 0) | ||
3457 | return i; | ||
3427 | nfs_inode_return_delegation(inode); | 3458 | nfs_inode_return_delegation(inode); |
3428 | buf_to_pages(buf, buflen, arg.acl_pages, &arg.acl_pgbase); | ||
3429 | ret = nfs4_call_sync(server, &msg, &arg, &res, 1); | 3459 | ret = nfs4_call_sync(server, &msg, &arg, &res, 1); |
3460 | |||
3461 | /* | ||
3462 | * Free each page after tx, so the only ref left is | ||
3463 | * held by the network stack | ||
3464 | */ | ||
3465 | for (; i > 0; i--) | ||
3466 | put_page(pages[i-1]); | ||
3467 | |||
3430 | /* | 3468 | /* |
3431 | * Acl update can result in inode attribute update. | 3469 | * Acl update can result in inode attribute update. |
3432 | * so mark the attribute cache invalid. | 3470 | * so mark the attribute cache invalid. |
@@ -3464,12 +3502,13 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, | |||
3464 | case -NFS4ERR_OPENMODE: | 3502 | case -NFS4ERR_OPENMODE: |
3465 | if (state == NULL) | 3503 | if (state == NULL) |
3466 | break; | 3504 | break; |
3467 | nfs4_state_mark_reclaim_nograce(clp, state); | 3505 | nfs4_schedule_stateid_recovery(server, state); |
3468 | goto do_state_recovery; | 3506 | goto wait_on_recovery; |
3469 | case -NFS4ERR_STALE_STATEID: | 3507 | case -NFS4ERR_STALE_STATEID: |
3470 | case -NFS4ERR_STALE_CLIENTID: | 3508 | case -NFS4ERR_STALE_CLIENTID: |
3471 | case -NFS4ERR_EXPIRED: | 3509 | case -NFS4ERR_EXPIRED: |
3472 | goto do_state_recovery; | 3510 | nfs4_schedule_lease_recovery(clp); |
3511 | goto wait_on_recovery; | ||
3473 | #if defined(CONFIG_NFS_V4_1) | 3512 | #if defined(CONFIG_NFS_V4_1) |
3474 | case -NFS4ERR_BADSESSION: | 3513 | case -NFS4ERR_BADSESSION: |
3475 | case -NFS4ERR_BADSLOT: | 3514 | case -NFS4ERR_BADSLOT: |
@@ -3480,7 +3519,7 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, | |||
3480 | case -NFS4ERR_SEQ_MISORDERED: | 3519 | case -NFS4ERR_SEQ_MISORDERED: |
3481 | dprintk("%s ERROR %d, Reset session\n", __func__, | 3520 | dprintk("%s ERROR %d, Reset session\n", __func__, |
3482 | task->tk_status); | 3521 | task->tk_status); |
3483 | nfs4_schedule_state_recovery(clp); | 3522 | nfs4_schedule_session_recovery(clp->cl_session); |
3484 | task->tk_status = 0; | 3523 | task->tk_status = 0; |
3485 | return -EAGAIN; | 3524 | return -EAGAIN; |
3486 | #endif /* CONFIG_NFS_V4_1 */ | 3525 | #endif /* CONFIG_NFS_V4_1 */ |
@@ -3497,9 +3536,8 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, | |||
3497 | } | 3536 | } |
3498 | task->tk_status = nfs4_map_errors(task->tk_status); | 3537 | task->tk_status = nfs4_map_errors(task->tk_status); |
3499 | return 0; | 3538 | return 0; |
3500 | do_state_recovery: | 3539 | wait_on_recovery: |
3501 | rpc_sleep_on(&clp->cl_rpcwaitq, task, NULL); | 3540 | rpc_sleep_on(&clp->cl_rpcwaitq, task, NULL); |
3502 | nfs4_schedule_state_recovery(clp); | ||
3503 | if (test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) == 0) | 3541 | if (test_bit(NFS4CLNT_MANAGER_RUNNING, &clp->cl_state) == 0) |
3504 | rpc_wake_up_queued_task(&clp->cl_rpcwaitq, task); | 3542 | rpc_wake_up_queued_task(&clp->cl_rpcwaitq, task); |
3505 | task->tk_status = 0; | 3543 | task->tk_status = 0; |
@@ -4110,7 +4148,7 @@ static void nfs4_lock_release(void *calldata) | |||
4110 | task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp, | 4148 | task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp, |
4111 | data->arg.lock_seqid); | 4149 | data->arg.lock_seqid); |
4112 | if (!IS_ERR(task)) | 4150 | if (!IS_ERR(task)) |
4113 | rpc_put_task(task); | 4151 | rpc_put_task_async(task); |
4114 | dprintk("%s: cancelling lock!\n", __func__); | 4152 | dprintk("%s: cancelling lock!\n", __func__); |
4115 | } else | 4153 | } else |
4116 | nfs_free_seqid(data->arg.lock_seqid); | 4154 | nfs_free_seqid(data->arg.lock_seqid); |
@@ -4134,23 +4172,18 @@ static const struct rpc_call_ops nfs4_recover_lock_ops = { | |||
4134 | 4172 | ||
4135 | static void nfs4_handle_setlk_error(struct nfs_server *server, struct nfs4_lock_state *lsp, int new_lock_owner, int error) | 4173 | static void nfs4_handle_setlk_error(struct nfs_server *server, struct nfs4_lock_state *lsp, int new_lock_owner, int error) |
4136 | { | 4174 | { |
4137 | struct nfs_client *clp = server->nfs_client; | ||
4138 | struct nfs4_state *state = lsp->ls_state; | ||
4139 | |||
4140 | switch (error) { | 4175 | switch (error) { |
4141 | case -NFS4ERR_ADMIN_REVOKED: | 4176 | case -NFS4ERR_ADMIN_REVOKED: |
4142 | case -NFS4ERR_BAD_STATEID: | 4177 | case -NFS4ERR_BAD_STATEID: |
4143 | case -NFS4ERR_EXPIRED: | 4178 | lsp->ls_seqid.flags &= ~NFS_SEQID_CONFIRMED; |
4144 | if (new_lock_owner != 0 || | 4179 | if (new_lock_owner != 0 || |
4145 | (lsp->ls_flags & NFS_LOCK_INITIALIZED) != 0) | 4180 | (lsp->ls_flags & NFS_LOCK_INITIALIZED) != 0) |
4146 | nfs4_state_mark_reclaim_nograce(clp, state); | 4181 | nfs4_schedule_stateid_recovery(server, lsp->ls_state); |
4147 | lsp->ls_seqid.flags &= ~NFS_SEQID_CONFIRMED; | ||
4148 | break; | 4182 | break; |
4149 | case -NFS4ERR_STALE_STATEID: | 4183 | case -NFS4ERR_STALE_STATEID: |
4150 | if (new_lock_owner != 0 || | ||
4151 | (lsp->ls_flags & NFS_LOCK_INITIALIZED) != 0) | ||
4152 | nfs4_state_mark_reclaim_reboot(clp, state); | ||
4153 | lsp->ls_seqid.flags &= ~NFS_SEQID_CONFIRMED; | 4184 | lsp->ls_seqid.flags &= ~NFS_SEQID_CONFIRMED; |
4185 | case -NFS4ERR_EXPIRED: | ||
4186 | nfs4_schedule_lease_recovery(server->nfs_client); | ||
4154 | }; | 4187 | }; |
4155 | } | 4188 | } |
4156 | 4189 | ||
@@ -4366,12 +4399,14 @@ int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) | |||
4366 | case -NFS4ERR_EXPIRED: | 4399 | case -NFS4ERR_EXPIRED: |
4367 | case -NFS4ERR_STALE_CLIENTID: | 4400 | case -NFS4ERR_STALE_CLIENTID: |
4368 | case -NFS4ERR_STALE_STATEID: | 4401 | case -NFS4ERR_STALE_STATEID: |
4402 | nfs4_schedule_lease_recovery(server->nfs_client); | ||
4403 | goto out; | ||
4369 | case -NFS4ERR_BADSESSION: | 4404 | case -NFS4ERR_BADSESSION: |
4370 | case -NFS4ERR_BADSLOT: | 4405 | case -NFS4ERR_BADSLOT: |
4371 | case -NFS4ERR_BAD_HIGH_SLOT: | 4406 | case -NFS4ERR_BAD_HIGH_SLOT: |
4372 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: | 4407 | case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: |
4373 | case -NFS4ERR_DEADSESSION: | 4408 | case -NFS4ERR_DEADSESSION: |
4374 | nfs4_schedule_state_recovery(server->nfs_client); | 4409 | nfs4_schedule_session_recovery(server->nfs_client->cl_session); |
4375 | goto out; | 4410 | goto out; |
4376 | case -ERESTARTSYS: | 4411 | case -ERESTARTSYS: |
4377 | /* | 4412 | /* |
@@ -4381,7 +4416,7 @@ int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) | |||
4381 | case -NFS4ERR_ADMIN_REVOKED: | 4416 | case -NFS4ERR_ADMIN_REVOKED: |
4382 | case -NFS4ERR_BAD_STATEID: | 4417 | case -NFS4ERR_BAD_STATEID: |
4383 | case -NFS4ERR_OPENMODE: | 4418 | case -NFS4ERR_OPENMODE: |
4384 | nfs4_state_mark_reclaim_nograce(server->nfs_client, state); | 4419 | nfs4_schedule_stateid_recovery(server, state); |
4385 | err = 0; | 4420 | err = 0; |
4386 | goto out; | 4421 | goto out; |
4387 | case -EKEYEXPIRED: | 4422 | case -EKEYEXPIRED: |
@@ -4988,10 +5023,20 @@ int nfs4_proc_create_session(struct nfs_client *clp) | |||
4988 | int status; | 5023 | int status; |
4989 | unsigned *ptr; | 5024 | unsigned *ptr; |
4990 | struct nfs4_session *session = clp->cl_session; | 5025 | struct nfs4_session *session = clp->cl_session; |
5026 | long timeout = 0; | ||
5027 | int err; | ||
4991 | 5028 | ||
4992 | dprintk("--> %s clp=%p session=%p\n", __func__, clp, session); | 5029 | dprintk("--> %s clp=%p session=%p\n", __func__, clp, session); |
4993 | 5030 | ||
4994 | status = _nfs4_proc_create_session(clp); | 5031 | do { |
5032 | status = _nfs4_proc_create_session(clp); | ||
5033 | if (status == -NFS4ERR_DELAY) { | ||
5034 | err = nfs4_delay(clp->cl_rpcclient, &timeout); | ||
5035 | if (err) | ||
5036 | status = err; | ||
5037 | } | ||
5038 | } while (status == -NFS4ERR_DELAY); | ||
5039 | |||
4995 | if (status) | 5040 | if (status) |
4996 | goto out; | 5041 | goto out; |
4997 | 5042 | ||
@@ -5100,7 +5145,7 @@ static int nfs41_sequence_handle_errors(struct rpc_task *task, struct nfs_client | |||
5100 | rpc_delay(task, NFS4_POLL_RETRY_MAX); | 5145 | rpc_delay(task, NFS4_POLL_RETRY_MAX); |
5101 | return -EAGAIN; | 5146 | return -EAGAIN; |
5102 | default: | 5147 | default: |
5103 | nfs4_schedule_state_recovery(clp); | 5148 | nfs4_schedule_lease_recovery(clp); |
5104 | } | 5149 | } |
5105 | return 0; | 5150 | return 0; |
5106 | } | 5151 | } |
@@ -5187,7 +5232,7 @@ static int nfs41_proc_async_sequence(struct nfs_client *clp, struct rpc_cred *cr | |||
5187 | if (IS_ERR(task)) | 5232 | if (IS_ERR(task)) |
5188 | ret = PTR_ERR(task); | 5233 | ret = PTR_ERR(task); |
5189 | else | 5234 | else |
5190 | rpc_put_task(task); | 5235 | rpc_put_task_async(task); |
5191 | dprintk("<-- %s status=%d\n", __func__, ret); | 5236 | dprintk("<-- %s status=%d\n", __func__, ret); |
5192 | return ret; | 5237 | return ret; |
5193 | } | 5238 | } |
@@ -5203,8 +5248,13 @@ static int nfs4_proc_sequence(struct nfs_client *clp, struct rpc_cred *cred) | |||
5203 | goto out; | 5248 | goto out; |
5204 | } | 5249 | } |
5205 | ret = rpc_wait_for_completion_task(task); | 5250 | ret = rpc_wait_for_completion_task(task); |
5206 | if (!ret) | 5251 | if (!ret) { |
5252 | struct nfs4_sequence_res *res = task->tk_msg.rpc_resp; | ||
5253 | |||
5254 | if (task->tk_status == 0) | ||
5255 | nfs41_handle_sequence_flag_errors(clp, res->sr_status_flags); | ||
5207 | ret = task->tk_status; | 5256 | ret = task->tk_status; |
5257 | } | ||
5208 | rpc_put_task(task); | 5258 | rpc_put_task(task); |
5209 | out: | 5259 | out: |
5210 | dprintk("<-- %s status=%d\n", __func__, ret); | 5260 | dprintk("<-- %s status=%d\n", __func__, ret); |
@@ -5241,7 +5291,7 @@ static int nfs41_reclaim_complete_handle_errors(struct rpc_task *task, struct nf | |||
5241 | rpc_delay(task, NFS4_POLL_RETRY_MAX); | 5291 | rpc_delay(task, NFS4_POLL_RETRY_MAX); |
5242 | return -EAGAIN; | 5292 | return -EAGAIN; |
5243 | default: | 5293 | default: |
5244 | nfs4_schedule_state_recovery(clp); | 5294 | nfs4_schedule_lease_recovery(clp); |
5245 | } | 5295 | } |
5246 | return 0; | 5296 | return 0; |
5247 | } | 5297 | } |
@@ -5309,6 +5359,9 @@ static int nfs41_proc_reclaim_complete(struct nfs_client *clp) | |||
5309 | status = PTR_ERR(task); | 5359 | status = PTR_ERR(task); |
5310 | goto out; | 5360 | goto out; |
5311 | } | 5361 | } |
5362 | status = nfs4_wait_for_completion_rpc_task(task); | ||
5363 | if (status == 0) | ||
5364 | status = task->tk_status; | ||
5312 | rpc_put_task(task); | 5365 | rpc_put_task(task); |
5313 | return 0; | 5366 | return 0; |
5314 | out: | 5367 | out: |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index e6742b57a04c..0592288f9f06 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1007,9 +1007,9 @@ void nfs4_schedule_state_manager(struct nfs_client *clp) | |||
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | /* | 1009 | /* |
1010 | * Schedule a state recovery attempt | 1010 | * Schedule a lease recovery attempt |
1011 | */ | 1011 | */ |
1012 | void nfs4_schedule_state_recovery(struct nfs_client *clp) | 1012 | void nfs4_schedule_lease_recovery(struct nfs_client *clp) |
1013 | { | 1013 | { |
1014 | if (!clp) | 1014 | if (!clp) |
1015 | return; | 1015 | return; |
@@ -1018,7 +1018,7 @@ void nfs4_schedule_state_recovery(struct nfs_client *clp) | |||
1018 | nfs4_schedule_state_manager(clp); | 1018 | nfs4_schedule_state_manager(clp); |
1019 | } | 1019 | } |
1020 | 1020 | ||
1021 | int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state) | 1021 | static int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *state) |
1022 | { | 1022 | { |
1023 | 1023 | ||
1024 | set_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags); | 1024 | set_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags); |
@@ -1032,7 +1032,7 @@ int nfs4_state_mark_reclaim_reboot(struct nfs_client *clp, struct nfs4_state *st | |||
1032 | return 1; | 1032 | return 1; |
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *state) | 1035 | static int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *state) |
1036 | { | 1036 | { |
1037 | set_bit(NFS_STATE_RECLAIM_NOGRACE, &state->flags); | 1037 | set_bit(NFS_STATE_RECLAIM_NOGRACE, &state->flags); |
1038 | clear_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags); | 1038 | clear_bit(NFS_STATE_RECLAIM_REBOOT, &state->flags); |
@@ -1041,6 +1041,14 @@ int nfs4_state_mark_reclaim_nograce(struct nfs_client *clp, struct nfs4_state *s | |||
1041 | return 1; | 1041 | return 1; |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | void nfs4_schedule_stateid_recovery(const struct nfs_server *server, struct nfs4_state *state) | ||
1045 | { | ||
1046 | struct nfs_client *clp = server->nfs_client; | ||
1047 | |||
1048 | nfs4_state_mark_reclaim_nograce(clp, state); | ||
1049 | nfs4_schedule_state_manager(clp); | ||
1050 | } | ||
1051 | |||
1044 | static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_recovery_ops *ops) | 1052 | static int nfs4_reclaim_locks(struct nfs4_state *state, const struct nfs4_state_recovery_ops *ops) |
1045 | { | 1053 | { |
1046 | struct inode *inode = state->inode; | 1054 | struct inode *inode = state->inode; |
@@ -1436,10 +1444,15 @@ static int nfs4_reclaim_lease(struct nfs_client *clp) | |||
1436 | } | 1444 | } |
1437 | 1445 | ||
1438 | #ifdef CONFIG_NFS_V4_1 | 1446 | #ifdef CONFIG_NFS_V4_1 |
1447 | void nfs4_schedule_session_recovery(struct nfs4_session *session) | ||
1448 | { | ||
1449 | nfs4_schedule_lease_recovery(session->clp); | ||
1450 | } | ||
1451 | |||
1439 | void nfs41_handle_recall_slot(struct nfs_client *clp) | 1452 | void nfs41_handle_recall_slot(struct nfs_client *clp) |
1440 | { | 1453 | { |
1441 | set_bit(NFS4CLNT_RECALL_SLOT, &clp->cl_state); | 1454 | set_bit(NFS4CLNT_RECALL_SLOT, &clp->cl_state); |
1442 | nfs4_schedule_state_recovery(clp); | 1455 | nfs4_schedule_state_manager(clp); |
1443 | } | 1456 | } |
1444 | 1457 | ||
1445 | static void nfs4_reset_all_state(struct nfs_client *clp) | 1458 | static void nfs4_reset_all_state(struct nfs_client *clp) |
@@ -1447,7 +1460,7 @@ static void nfs4_reset_all_state(struct nfs_client *clp) | |||
1447 | if (test_and_set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0) { | 1460 | if (test_and_set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0) { |
1448 | clp->cl_boot_time = CURRENT_TIME; | 1461 | clp->cl_boot_time = CURRENT_TIME; |
1449 | nfs4_state_start_reclaim_nograce(clp); | 1462 | nfs4_state_start_reclaim_nograce(clp); |
1450 | nfs4_schedule_state_recovery(clp); | 1463 | nfs4_schedule_state_manager(clp); |
1451 | } | 1464 | } |
1452 | } | 1465 | } |
1453 | 1466 | ||
@@ -1455,7 +1468,7 @@ static void nfs41_handle_server_reboot(struct nfs_client *clp) | |||
1455 | { | 1468 | { |
1456 | if (test_and_set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0) { | 1469 | if (test_and_set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) == 0) { |
1457 | nfs4_state_start_reclaim_reboot(clp); | 1470 | nfs4_state_start_reclaim_reboot(clp); |
1458 | nfs4_schedule_state_recovery(clp); | 1471 | nfs4_schedule_state_manager(clp); |
1459 | } | 1472 | } |
1460 | } | 1473 | } |
1461 | 1474 | ||
@@ -1475,7 +1488,7 @@ static void nfs41_handle_cb_path_down(struct nfs_client *clp) | |||
1475 | { | 1488 | { |
1476 | nfs_expire_all_delegations(clp); | 1489 | nfs_expire_all_delegations(clp); |
1477 | if (test_and_set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) == 0) | 1490 | if (test_and_set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) == 0) |
1478 | nfs4_schedule_state_recovery(clp); | 1491 | nfs4_schedule_state_manager(clp); |
1479 | } | 1492 | } |
1480 | 1493 | ||
1481 | void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags) | 1494 | void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags) |
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 4e2c168b6ee9..94d50e86a124 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -1660,7 +1660,7 @@ static void encode_create_session(struct xdr_stream *xdr, | |||
1660 | 1660 | ||
1661 | p = reserve_space(xdr, 20 + 2*28 + 20 + len + 12); | 1661 | p = reserve_space(xdr, 20 + 2*28 + 20 + len + 12); |
1662 | *p++ = cpu_to_be32(OP_CREATE_SESSION); | 1662 | *p++ = cpu_to_be32(OP_CREATE_SESSION); |
1663 | p = xdr_encode_hyper(p, clp->cl_ex_clid); | 1663 | p = xdr_encode_hyper(p, clp->cl_clientid); |
1664 | *p++ = cpu_to_be32(clp->cl_seqid); /*Sequence id */ | 1664 | *p++ = cpu_to_be32(clp->cl_seqid); /*Sequence id */ |
1665 | *p++ = cpu_to_be32(args->flags); /*flags */ | 1665 | *p++ = cpu_to_be32(args->flags); /*flags */ |
1666 | 1666 | ||
@@ -4694,7 +4694,7 @@ static int decode_exchange_id(struct xdr_stream *xdr, | |||
4694 | p = xdr_inline_decode(xdr, 8); | 4694 | p = xdr_inline_decode(xdr, 8); |
4695 | if (unlikely(!p)) | 4695 | if (unlikely(!p)) |
4696 | goto out_overflow; | 4696 | goto out_overflow; |
4697 | xdr_decode_hyper(p, &clp->cl_ex_clid); | 4697 | xdr_decode_hyper(p, &clp->cl_clientid); |
4698 | p = xdr_inline_decode(xdr, 12); | 4698 | p = xdr_inline_decode(xdr, 12); |
4699 | if (unlikely(!p)) | 4699 | if (unlikely(!p)) |
4700 | goto out_overflow; | 4700 | goto out_overflow; |
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c index 903908a20023..c541093a5bf2 100644 --- a/fs/nfs/nfsroot.c +++ b/fs/nfs/nfsroot.c | |||
@@ -86,11 +86,14 @@ | |||
86 | /* Default path we try to mount. "%s" gets replaced by our IP address */ | 86 | /* Default path we try to mount. "%s" gets replaced by our IP address */ |
87 | #define NFS_ROOT "/tftpboot/%s" | 87 | #define NFS_ROOT "/tftpboot/%s" |
88 | 88 | ||
89 | /* Default NFSROOT mount options. */ | ||
90 | #define NFS_DEF_OPTIONS "udp" | ||
91 | |||
89 | /* Parameters passed from the kernel command line */ | 92 | /* Parameters passed from the kernel command line */ |
90 | static char nfs_root_parms[256] __initdata = ""; | 93 | static char nfs_root_parms[256] __initdata = ""; |
91 | 94 | ||
92 | /* Text-based mount options passed to super.c */ | 95 | /* Text-based mount options passed to super.c */ |
93 | static char nfs_root_options[256] __initdata = ""; | 96 | static char nfs_root_options[256] __initdata = NFS_DEF_OPTIONS; |
94 | 97 | ||
95 | /* Address of NFS server */ | 98 | /* Address of NFS server */ |
96 | static __be32 servaddr __initdata = htonl(INADDR_NONE); | 99 | static __be32 servaddr __initdata = htonl(INADDR_NONE); |
@@ -160,8 +163,14 @@ static int __init root_nfs_copy(char *dest, const char *src, | |||
160 | } | 163 | } |
161 | 164 | ||
162 | static int __init root_nfs_cat(char *dest, const char *src, | 165 | static int __init root_nfs_cat(char *dest, const char *src, |
163 | const size_t destlen) | 166 | const size_t destlen) |
164 | { | 167 | { |
168 | size_t len = strlen(dest); | ||
169 | |||
170 | if (len && dest[len - 1] != ',') | ||
171 | if (strlcat(dest, ",", destlen) > destlen) | ||
172 | return -1; | ||
173 | |||
165 | if (strlcat(dest, src, destlen) > destlen) | 174 | if (strlcat(dest, src, destlen) > destlen) |
166 | return -1; | 175 | return -1; |
167 | return 0; | 176 | return 0; |
@@ -194,16 +203,6 @@ static int __init root_nfs_parse_options(char *incoming, char *exppath, | |||
194 | if (root_nfs_cat(nfs_root_options, incoming, | 203 | if (root_nfs_cat(nfs_root_options, incoming, |
195 | sizeof(nfs_root_options))) | 204 | sizeof(nfs_root_options))) |
196 | return -1; | 205 | return -1; |
197 | |||
198 | /* | ||
199 | * Possibly prepare for more options to be appended | ||
200 | */ | ||
201 | if (nfs_root_options[0] != '\0' && | ||
202 | nfs_root_options[strlen(nfs_root_options)] != ',') | ||
203 | if (root_nfs_cat(nfs_root_options, ",", | ||
204 | sizeof(nfs_root_options))) | ||
205 | return -1; | ||
206 | |||
207 | return 0; | 206 | return 0; |
208 | } | 207 | } |
209 | 208 | ||
@@ -217,7 +216,7 @@ static int __init root_nfs_parse_options(char *incoming, char *exppath, | |||
217 | */ | 216 | */ |
218 | static int __init root_nfs_data(char *cmdline) | 217 | static int __init root_nfs_data(char *cmdline) |
219 | { | 218 | { |
220 | char addr_option[sizeof("nolock,addr=") + INET_ADDRSTRLEN + 1]; | 219 | char mand_options[sizeof("nolock,addr=") + INET_ADDRSTRLEN + 1]; |
221 | int len, retval = -1; | 220 | int len, retval = -1; |
222 | char *tmp = NULL; | 221 | char *tmp = NULL; |
223 | const size_t tmplen = sizeof(nfs_export_path); | 222 | const size_t tmplen = sizeof(nfs_export_path); |
@@ -244,9 +243,9 @@ static int __init root_nfs_data(char *cmdline) | |||
244 | * Append mandatory options for nfsroot so they override | 243 | * Append mandatory options for nfsroot so they override |
245 | * what has come before | 244 | * what has come before |
246 | */ | 245 | */ |
247 | snprintf(addr_option, sizeof(addr_option), "nolock,addr=%pI4", | 246 | snprintf(mand_options, sizeof(mand_options), "nolock,addr=%pI4", |
248 | &servaddr); | 247 | &servaddr); |
249 | if (root_nfs_cat(nfs_root_options, addr_option, | 248 | if (root_nfs_cat(nfs_root_options, mand_options, |
250 | sizeof(nfs_root_options))) | 249 | sizeof(nfs_root_options))) |
251 | goto out_optionstoolong; | 250 | goto out_optionstoolong; |
252 | 251 | ||
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c index e313a51acdd1..6481d537d69d 100644 --- a/fs/nfs/unlink.c +++ b/fs/nfs/unlink.c | |||
@@ -180,7 +180,7 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n | |||
180 | task_setup_data.rpc_client = NFS_CLIENT(dir); | 180 | task_setup_data.rpc_client = NFS_CLIENT(dir); |
181 | task = rpc_run_task(&task_setup_data); | 181 | task = rpc_run_task(&task_setup_data); |
182 | if (!IS_ERR(task)) | 182 | if (!IS_ERR(task)) |
183 | rpc_put_task(task); | 183 | rpc_put_task_async(task); |
184 | return 1; | 184 | return 1; |
185 | } | 185 | } |
186 | 186 | ||
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index c8278f4046cb..42b92d7a9cc4 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -1292,6 +1292,8 @@ static int nfs_commit_rpcsetup(struct list_head *head, | |||
1292 | task = rpc_run_task(&task_setup_data); | 1292 | task = rpc_run_task(&task_setup_data); |
1293 | if (IS_ERR(task)) | 1293 | if (IS_ERR(task)) |
1294 | return PTR_ERR(task); | 1294 | return PTR_ERR(task); |
1295 | if (how & FLUSH_SYNC) | ||
1296 | rpc_wait_for_completion_task(task); | ||
1295 | rpc_put_task(task); | 1297 | rpc_put_task(task); |
1296 | return 0; | 1298 | return 0; |
1297 | } | 1299 | } |
diff --git a/fs/nfsctl.c b/fs/nfsctl.c index bf9cbd242ddd..124e8fcb0dd6 100644 --- a/fs/nfsctl.c +++ b/fs/nfsctl.c | |||
@@ -22,30 +22,17 @@ | |||
22 | 22 | ||
23 | static struct file *do_open(char *name, int flags) | 23 | static struct file *do_open(char *name, int flags) |
24 | { | 24 | { |
25 | struct nameidata nd; | ||
26 | struct vfsmount *mnt; | 25 | struct vfsmount *mnt; |
27 | int error; | 26 | struct file *file; |
28 | 27 | ||
29 | mnt = do_kern_mount("nfsd", 0, "nfsd", NULL); | 28 | mnt = do_kern_mount("nfsd", 0, "nfsd", NULL); |
30 | if (IS_ERR(mnt)) | 29 | if (IS_ERR(mnt)) |
31 | return (struct file *)mnt; | 30 | return (struct file *)mnt; |
32 | 31 | ||
33 | error = vfs_path_lookup(mnt->mnt_root, mnt, name, 0, &nd); | 32 | file = file_open_root(mnt->mnt_root, mnt, name, flags); |
34 | mntput(mnt); /* drop do_kern_mount reference */ | ||
35 | if (error) | ||
36 | return ERR_PTR(error); | ||
37 | |||
38 | if (flags == O_RDWR) | ||
39 | error = may_open(&nd.path, MAY_READ|MAY_WRITE, flags); | ||
40 | else | ||
41 | error = may_open(&nd.path, MAY_WRITE, flags); | ||
42 | 33 | ||
43 | if (!error) | 34 | mntput(mnt); /* drop do_kern_mount reference */ |
44 | return dentry_open(nd.path.dentry, nd.path.mnt, flags, | 35 | return file; |
45 | current_cred()); | ||
46 | |||
47 | path_put(&nd.path); | ||
48 | return ERR_PTR(error); | ||
49 | } | 36 | } |
50 | 37 | ||
51 | static struct { | 38 | static struct { |
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index cde36cb0f348..02eb4edf0ece 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
@@ -432,7 +432,7 @@ static int decode_cb_sequence4resok(struct xdr_stream *xdr, | |||
432 | * If the server returns different values for sessionID, slotID or | 432 | * If the server returns different values for sessionID, slotID or |
433 | * sequence number, the server is looney tunes. | 433 | * sequence number, the server is looney tunes. |
434 | */ | 434 | */ |
435 | p = xdr_inline_decode(xdr, NFS4_MAX_SESSIONID_LEN + 4 + 4); | 435 | p = xdr_inline_decode(xdr, NFS4_MAX_SESSIONID_LEN + 4 + 4 + 4 + 4); |
436 | if (unlikely(p == NULL)) | 436 | if (unlikely(p == NULL)) |
437 | goto out_overflow; | 437 | goto out_overflow; |
438 | memcpy(id.data, p, NFS4_MAX_SESSIONID_LEN); | 438 | memcpy(id.data, p, NFS4_MAX_SESSIONID_LEN); |
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 54b60bfceb8d..7b566ec14e18 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -2445,15 +2445,16 @@ nfs4_check_delegmode(struct nfs4_delegation *dp, int flags) | |||
2445 | static struct nfs4_delegation * | 2445 | static struct nfs4_delegation * |
2446 | find_delegation_file(struct nfs4_file *fp, stateid_t *stid) | 2446 | find_delegation_file(struct nfs4_file *fp, stateid_t *stid) |
2447 | { | 2447 | { |
2448 | struct nfs4_delegation *dp = NULL; | 2448 | struct nfs4_delegation *dp; |
2449 | 2449 | ||
2450 | spin_lock(&recall_lock); | 2450 | spin_lock(&recall_lock); |
2451 | list_for_each_entry(dp, &fp->fi_delegations, dl_perfile) { | 2451 | list_for_each_entry(dp, &fp->fi_delegations, dl_perfile) |
2452 | if (dp->dl_stateid.si_stateownerid == stid->si_stateownerid) | 2452 | if (dp->dl_stateid.si_stateownerid == stid->si_stateownerid) { |
2453 | break; | 2453 | spin_unlock(&recall_lock); |
2454 | } | 2454 | return dp; |
2455 | } | ||
2455 | spin_unlock(&recall_lock); | 2456 | spin_unlock(&recall_lock); |
2456 | return dp; | 2457 | return NULL; |
2457 | } | 2458 | } |
2458 | 2459 | ||
2459 | int share_access_to_flags(u32 share_access) | 2460 | int share_access_to_flags(u32 share_access) |
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 1275b8655070..615f0a9f0600 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -1142,7 +1142,7 @@ nfsd4_decode_create_session(struct nfsd4_compoundargs *argp, | |||
1142 | 1142 | ||
1143 | u32 dummy; | 1143 | u32 dummy; |
1144 | char *machine_name; | 1144 | char *machine_name; |
1145 | int i; | 1145 | int i, j; |
1146 | int nr_secflavs; | 1146 | int nr_secflavs; |
1147 | 1147 | ||
1148 | READ_BUF(16); | 1148 | READ_BUF(16); |
@@ -1215,7 +1215,7 @@ nfsd4_decode_create_session(struct nfsd4_compoundargs *argp, | |||
1215 | READ_BUF(4); | 1215 | READ_BUF(4); |
1216 | READ32(dummy); | 1216 | READ32(dummy); |
1217 | READ_BUF(dummy * 4); | 1217 | READ_BUF(dummy * 4); |
1218 | for (i = 0; i < dummy; ++i) | 1218 | for (j = 0; j < dummy; ++j) |
1219 | READ32(dummy); | 1219 | READ32(dummy); |
1220 | break; | 1220 | break; |
1221 | case RPC_AUTH_GSS: | 1221 | case RPC_AUTH_GSS: |
diff --git a/fs/nilfs2/btnode.c b/fs/nilfs2/btnode.c index 388e9e8f5286..85f7baa15f5d 100644 --- a/fs/nilfs2/btnode.c +++ b/fs/nilfs2/btnode.c | |||
@@ -35,11 +35,6 @@ | |||
35 | #include "btnode.h" | 35 | #include "btnode.h" |
36 | 36 | ||
37 | 37 | ||
38 | void nilfs_btnode_cache_init_once(struct address_space *btnc) | ||
39 | { | ||
40 | nilfs_mapping_init_once(btnc); | ||
41 | } | ||
42 | |||
43 | static const struct address_space_operations def_btnode_aops = { | 38 | static const struct address_space_operations def_btnode_aops = { |
44 | .sync_page = block_sync_page, | 39 | .sync_page = block_sync_page, |
45 | }; | 40 | }; |
diff --git a/fs/nilfs2/btnode.h b/fs/nilfs2/btnode.h index 79037494f1e0..1b8ebd888c28 100644 --- a/fs/nilfs2/btnode.h +++ b/fs/nilfs2/btnode.h | |||
@@ -37,7 +37,6 @@ struct nilfs_btnode_chkey_ctxt { | |||
37 | struct buffer_head *newbh; | 37 | struct buffer_head *newbh; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | void nilfs_btnode_cache_init_once(struct address_space *); | ||
41 | void nilfs_btnode_cache_init(struct address_space *, struct backing_dev_info *); | 40 | void nilfs_btnode_cache_init(struct address_space *, struct backing_dev_info *); |
42 | void nilfs_btnode_cache_clear(struct address_space *); | 41 | void nilfs_btnode_cache_clear(struct address_space *); |
43 | struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc, | 42 | struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc, |
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index 6a0e2a189f60..a0babd2bff6a 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c | |||
@@ -454,9 +454,9 @@ int nilfs_mdt_setup_shadow_map(struct inode *inode, | |||
454 | struct backing_dev_info *bdi = inode->i_sb->s_bdi; | 454 | struct backing_dev_info *bdi = inode->i_sb->s_bdi; |
455 | 455 | ||
456 | INIT_LIST_HEAD(&shadow->frozen_buffers); | 456 | INIT_LIST_HEAD(&shadow->frozen_buffers); |
457 | nilfs_mapping_init_once(&shadow->frozen_data); | 457 | address_space_init_once(&shadow->frozen_data); |
458 | nilfs_mapping_init(&shadow->frozen_data, bdi, &shadow_map_aops); | 458 | nilfs_mapping_init(&shadow->frozen_data, bdi, &shadow_map_aops); |
459 | nilfs_mapping_init_once(&shadow->frozen_btnodes); | 459 | address_space_init_once(&shadow->frozen_btnodes); |
460 | nilfs_mapping_init(&shadow->frozen_btnodes, bdi, &shadow_map_aops); | 460 | nilfs_mapping_init(&shadow->frozen_btnodes, bdi, &shadow_map_aops); |
461 | mi->mi_shadow = shadow; | 461 | mi->mi_shadow = shadow; |
462 | return 0; | 462 | return 0; |
diff --git a/fs/nilfs2/namei.c b/fs/nilfs2/namei.c index 98034271cd02..161791d26458 100644 --- a/fs/nilfs2/namei.c +++ b/fs/nilfs2/namei.c | |||
@@ -397,7 +397,6 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
397 | new_de = nilfs_find_entry(new_dir, &new_dentry->d_name, &new_page); | 397 | new_de = nilfs_find_entry(new_dir, &new_dentry->d_name, &new_page); |
398 | if (!new_de) | 398 | if (!new_de) |
399 | goto out_dir; | 399 | goto out_dir; |
400 | inc_nlink(old_inode); | ||
401 | nilfs_set_link(new_dir, new_de, new_page, old_inode); | 400 | nilfs_set_link(new_dir, new_de, new_page, old_inode); |
402 | nilfs_mark_inode_dirty(new_dir); | 401 | nilfs_mark_inode_dirty(new_dir); |
403 | new_inode->i_ctime = CURRENT_TIME; | 402 | new_inode->i_ctime = CURRENT_TIME; |
@@ -411,13 +410,9 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
411 | if (new_dir->i_nlink >= NILFS_LINK_MAX) | 410 | if (new_dir->i_nlink >= NILFS_LINK_MAX) |
412 | goto out_dir; | 411 | goto out_dir; |
413 | } | 412 | } |
414 | inc_nlink(old_inode); | ||
415 | err = nilfs_add_link(new_dentry, old_inode); | 413 | err = nilfs_add_link(new_dentry, old_inode); |
416 | if (err) { | 414 | if (err) |
417 | drop_nlink(old_inode); | ||
418 | nilfs_mark_inode_dirty(old_inode); | ||
419 | goto out_dir; | 415 | goto out_dir; |
420 | } | ||
421 | if (dir_de) { | 416 | if (dir_de) { |
422 | inc_nlink(new_dir); | 417 | inc_nlink(new_dir); |
423 | nilfs_mark_inode_dirty(new_dir); | 418 | nilfs_mark_inode_dirty(new_dir); |
@@ -431,7 +426,6 @@ static int nilfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
431 | old_inode->i_ctime = CURRENT_TIME; | 426 | old_inode->i_ctime = CURRENT_TIME; |
432 | 427 | ||
433 | nilfs_delete_entry(old_de, old_page); | 428 | nilfs_delete_entry(old_de, old_page); |
434 | drop_nlink(old_inode); | ||
435 | 429 | ||
436 | if (dir_de) { | 430 | if (dir_de) { |
437 | nilfs_set_link(old_inode, dir_de, dir_page, new_dir); | 431 | nilfs_set_link(old_inode, dir_de, dir_page, new_dir); |
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index 0c432416cfef..a585b35fd6bc 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c | |||
@@ -492,19 +492,6 @@ unsigned nilfs_page_count_clean_buffers(struct page *page, | |||
492 | return nc; | 492 | return nc; |
493 | } | 493 | } |
494 | 494 | ||
495 | void nilfs_mapping_init_once(struct address_space *mapping) | ||
496 | { | ||
497 | memset(mapping, 0, sizeof(*mapping)); | ||
498 | INIT_RADIX_TREE(&mapping->page_tree, GFP_ATOMIC); | ||
499 | spin_lock_init(&mapping->tree_lock); | ||
500 | INIT_LIST_HEAD(&mapping->private_list); | ||
501 | spin_lock_init(&mapping->private_lock); | ||
502 | |||
503 | spin_lock_init(&mapping->i_mmap_lock); | ||
504 | INIT_RAW_PRIO_TREE_ROOT(&mapping->i_mmap); | ||
505 | INIT_LIST_HEAD(&mapping->i_mmap_nonlinear); | ||
506 | } | ||
507 | |||
508 | void nilfs_mapping_init(struct address_space *mapping, | 495 | void nilfs_mapping_init(struct address_space *mapping, |
509 | struct backing_dev_info *bdi, | 496 | struct backing_dev_info *bdi, |
510 | const struct address_space_operations *aops) | 497 | const struct address_space_operations *aops) |
diff --git a/fs/nilfs2/page.h b/fs/nilfs2/page.h index 622df27cd891..2a00953ebd5f 100644 --- a/fs/nilfs2/page.h +++ b/fs/nilfs2/page.h | |||
@@ -61,7 +61,6 @@ void nilfs_free_private_page(struct page *); | |||
61 | int nilfs_copy_dirty_pages(struct address_space *, struct address_space *); | 61 | int nilfs_copy_dirty_pages(struct address_space *, struct address_space *); |
62 | void nilfs_copy_back_pages(struct address_space *, struct address_space *); | 62 | void nilfs_copy_back_pages(struct address_space *, struct address_space *); |
63 | void nilfs_clear_dirty_pages(struct address_space *); | 63 | void nilfs_clear_dirty_pages(struct address_space *); |
64 | void nilfs_mapping_init_once(struct address_space *mapping); | ||
65 | void nilfs_mapping_init(struct address_space *mapping, | 64 | void nilfs_mapping_init(struct address_space *mapping, |
66 | struct backing_dev_info *bdi, | 65 | struct backing_dev_info *bdi, |
67 | const struct address_space_operations *aops); | 66 | const struct address_space_operations *aops); |
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 55ebae5c7f39..2de9f636792a 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
@@ -430,7 +430,8 @@ static void nilfs_segctor_begin_finfo(struct nilfs_sc_info *sci, | |||
430 | nilfs_segctor_map_segsum_entry( | 430 | nilfs_segctor_map_segsum_entry( |
431 | sci, &sci->sc_binfo_ptr, sizeof(struct nilfs_finfo)); | 431 | sci, &sci->sc_binfo_ptr, sizeof(struct nilfs_finfo)); |
432 | 432 | ||
433 | if (inode->i_sb && !test_bit(NILFS_SC_HAVE_DELTA, &sci->sc_flags)) | 433 | if (NILFS_I(inode)->i_root && |
434 | !test_bit(NILFS_SC_HAVE_DELTA, &sci->sc_flags)) | ||
434 | set_bit(NILFS_SC_HAVE_DELTA, &sci->sc_flags); | 435 | set_bit(NILFS_SC_HAVE_DELTA, &sci->sc_flags); |
435 | /* skip finfo */ | 436 | /* skip finfo */ |
436 | } | 437 | } |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 58fd707174e1..1673b3d99842 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -1279,7 +1279,7 @@ static void nilfs_inode_init_once(void *obj) | |||
1279 | #ifdef CONFIG_NILFS_XATTR | 1279 | #ifdef CONFIG_NILFS_XATTR |
1280 | init_rwsem(&ii->xattr_sem); | 1280 | init_rwsem(&ii->xattr_sem); |
1281 | #endif | 1281 | #endif |
1282 | nilfs_btnode_cache_init_once(&ii->i_btnode_cache); | 1282 | address_space_init_once(&ii->i_btnode_cache); |
1283 | ii->i_bmap = &ii->i_bmap_data; | 1283 | ii->i_bmap = &ii->i_bmap_data; |
1284 | inode_init_once(&ii->vfs_inode); | 1284 | inode_init_once(&ii->vfs_inode); |
1285 | } | 1285 | } |
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c index 704f6b1742f3..69786e3eb43c 100644 --- a/fs/ocfs2/acl.c +++ b/fs/ocfs2/acl.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/string.h> | 25 | #include <linux/string.h> |
26 | 26 | ||
27 | #define MLOG_MASK_PREFIX ML_INODE | ||
28 | #include <cluster/masklog.h> | 27 | #include <cluster/masklog.h> |
29 | 28 | ||
30 | #include "ocfs2.h" | 29 | #include "ocfs2.h" |
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index e4984e259cb6..b27a0d86f8c5 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/swap.h> | 30 | #include <linux/swap.h> |
31 | #include <linux/quotaops.h> | 31 | #include <linux/quotaops.h> |
32 | 32 | ||
33 | #define MLOG_MASK_PREFIX ML_DISK_ALLOC | ||
34 | #include <cluster/masklog.h> | 33 | #include <cluster/masklog.h> |
35 | 34 | ||
36 | #include "ocfs2.h" | 35 | #include "ocfs2.h" |
@@ -50,6 +49,7 @@ | |||
50 | #include "uptodate.h" | 49 | #include "uptodate.h" |
51 | #include "xattr.h" | 50 | #include "xattr.h" |
52 | #include "refcounttree.h" | 51 | #include "refcounttree.h" |
52 | #include "ocfs2_trace.h" | ||
53 | 53 | ||
54 | #include "buffer_head_io.h" | 54 | #include "buffer_head_io.h" |
55 | 55 | ||
@@ -886,8 +886,7 @@ static int ocfs2_validate_extent_block(struct super_block *sb, | |||
886 | struct ocfs2_extent_block *eb = | 886 | struct ocfs2_extent_block *eb = |
887 | (struct ocfs2_extent_block *)bh->b_data; | 887 | (struct ocfs2_extent_block *)bh->b_data; |
888 | 888 | ||
889 | mlog(0, "Validating extent block %llu\n", | 889 | trace_ocfs2_validate_extent_block((unsigned long long)bh->b_blocknr); |
890 | (unsigned long long)bh->b_blocknr); | ||
891 | 890 | ||
892 | BUG_ON(!buffer_uptodate(bh)); | 891 | BUG_ON(!buffer_uptodate(bh)); |
893 | 892 | ||
@@ -965,8 +964,6 @@ int ocfs2_num_free_extents(struct ocfs2_super *osb, | |||
965 | struct buffer_head *eb_bh = NULL; | 964 | struct buffer_head *eb_bh = NULL; |
966 | u64 last_eb_blk = 0; | 965 | u64 last_eb_blk = 0; |
967 | 966 | ||
968 | mlog_entry_void(); | ||
969 | |||
970 | el = et->et_root_el; | 967 | el = et->et_root_el; |
971 | last_eb_blk = ocfs2_et_get_last_eb_blk(et); | 968 | last_eb_blk = ocfs2_et_get_last_eb_blk(et); |
972 | 969 | ||
@@ -987,7 +984,7 @@ int ocfs2_num_free_extents(struct ocfs2_super *osb, | |||
987 | bail: | 984 | bail: |
988 | brelse(eb_bh); | 985 | brelse(eb_bh); |
989 | 986 | ||
990 | mlog_exit(retval); | 987 | trace_ocfs2_num_free_extents(retval); |
991 | return retval; | 988 | return retval; |
992 | } | 989 | } |
993 | 990 | ||
@@ -1010,8 +1007,6 @@ static int ocfs2_create_new_meta_bhs(handle_t *handle, | |||
1010 | OCFS2_SB(ocfs2_metadata_cache_get_super(et->et_ci)); | 1007 | OCFS2_SB(ocfs2_metadata_cache_get_super(et->et_ci)); |
1011 | struct ocfs2_extent_block *eb; | 1008 | struct ocfs2_extent_block *eb; |
1012 | 1009 | ||
1013 | mlog_entry_void(); | ||
1014 | |||
1015 | count = 0; | 1010 | count = 0; |
1016 | while (count < wanted) { | 1011 | while (count < wanted) { |
1017 | status = ocfs2_claim_metadata(handle, | 1012 | status = ocfs2_claim_metadata(handle, |
@@ -1074,8 +1069,8 @@ bail: | |||
1074 | brelse(bhs[i]); | 1069 | brelse(bhs[i]); |
1075 | bhs[i] = NULL; | 1070 | bhs[i] = NULL; |
1076 | } | 1071 | } |
1072 | mlog_errno(status); | ||
1077 | } | 1073 | } |
1078 | mlog_exit(status); | ||
1079 | return status; | 1074 | return status; |
1080 | } | 1075 | } |
1081 | 1076 | ||
@@ -1173,8 +1168,6 @@ static int ocfs2_add_branch(handle_t *handle, | |||
1173 | struct ocfs2_extent_list *el; | 1168 | struct ocfs2_extent_list *el; |
1174 | u32 new_cpos, root_end; | 1169 | u32 new_cpos, root_end; |
1175 | 1170 | ||
1176 | mlog_entry_void(); | ||
1177 | |||
1178 | BUG_ON(!last_eb_bh || !*last_eb_bh); | 1171 | BUG_ON(!last_eb_bh || !*last_eb_bh); |
1179 | 1172 | ||
1180 | if (eb_bh) { | 1173 | if (eb_bh) { |
@@ -1200,8 +1193,11 @@ static int ocfs2_add_branch(handle_t *handle, | |||
1200 | * from new_cpos). | 1193 | * from new_cpos). |
1201 | */ | 1194 | */ |
1202 | if (root_end > new_cpos) { | 1195 | if (root_end > new_cpos) { |
1203 | mlog(0, "adjust the cluster end from %u to %u\n", | 1196 | trace_ocfs2_adjust_rightmost_branch( |
1204 | root_end, new_cpos); | 1197 | (unsigned long long) |
1198 | ocfs2_metadata_cache_owner(et->et_ci), | ||
1199 | root_end, new_cpos); | ||
1200 | |||
1205 | status = ocfs2_adjust_rightmost_branch(handle, et); | 1201 | status = ocfs2_adjust_rightmost_branch(handle, et); |
1206 | if (status) { | 1202 | if (status) { |
1207 | mlog_errno(status); | 1203 | mlog_errno(status); |
@@ -1332,7 +1328,6 @@ bail: | |||
1332 | kfree(new_eb_bhs); | 1328 | kfree(new_eb_bhs); |
1333 | } | 1329 | } |
1334 | 1330 | ||
1335 | mlog_exit(status); | ||
1336 | return status; | 1331 | return status; |
1337 | } | 1332 | } |
1338 | 1333 | ||
@@ -1353,8 +1348,6 @@ static int ocfs2_shift_tree_depth(handle_t *handle, | |||
1353 | struct ocfs2_extent_list *root_el; | 1348 | struct ocfs2_extent_list *root_el; |
1354 | struct ocfs2_extent_list *eb_el; | 1349 | struct ocfs2_extent_list *eb_el; |
1355 | 1350 | ||
1356 | mlog_entry_void(); | ||
1357 | |||
1358 | status = ocfs2_create_new_meta_bhs(handle, et, 1, meta_ac, | 1351 | status = ocfs2_create_new_meta_bhs(handle, et, 1, meta_ac, |
1359 | &new_eb_bh); | 1352 | &new_eb_bh); |
1360 | if (status < 0) { | 1353 | if (status < 0) { |
@@ -1415,7 +1408,6 @@ static int ocfs2_shift_tree_depth(handle_t *handle, | |||
1415 | bail: | 1408 | bail: |
1416 | brelse(new_eb_bh); | 1409 | brelse(new_eb_bh); |
1417 | 1410 | ||
1418 | mlog_exit(status); | ||
1419 | return status; | 1411 | return status; |
1420 | } | 1412 | } |
1421 | 1413 | ||
@@ -1446,8 +1438,6 @@ static int ocfs2_find_branch_target(struct ocfs2_extent_tree *et, | |||
1446 | struct buffer_head *bh = NULL; | 1438 | struct buffer_head *bh = NULL; |
1447 | struct buffer_head *lowest_bh = NULL; | 1439 | struct buffer_head *lowest_bh = NULL; |
1448 | 1440 | ||
1449 | mlog_entry_void(); | ||
1450 | |||
1451 | *target_bh = NULL; | 1441 | *target_bh = NULL; |
1452 | 1442 | ||
1453 | el = et->et_root_el; | 1443 | el = et->et_root_el; |
@@ -1503,7 +1493,6 @@ static int ocfs2_find_branch_target(struct ocfs2_extent_tree *et, | |||
1503 | bail: | 1493 | bail: |
1504 | brelse(bh); | 1494 | brelse(bh); |
1505 | 1495 | ||
1506 | mlog_exit(status); | ||
1507 | return status; | 1496 | return status; |
1508 | } | 1497 | } |
1509 | 1498 | ||
@@ -1540,7 +1529,10 @@ static int ocfs2_grow_tree(handle_t *handle, struct ocfs2_extent_tree *et, | |||
1540 | * another tree level */ | 1529 | * another tree level */ |
1541 | if (shift) { | 1530 | if (shift) { |
1542 | BUG_ON(bh); | 1531 | BUG_ON(bh); |
1543 | mlog(0, "need to shift tree depth (current = %d)\n", depth); | 1532 | trace_ocfs2_grow_tree( |
1533 | (unsigned long long) | ||
1534 | ocfs2_metadata_cache_owner(et->et_ci), | ||
1535 | depth); | ||
1544 | 1536 | ||
1545 | /* ocfs2_shift_tree_depth will return us a buffer with | 1537 | /* ocfs2_shift_tree_depth will return us a buffer with |
1546 | * the new extent block (so we can pass that to | 1538 | * the new extent block (so we can pass that to |
@@ -1570,7 +1562,6 @@ static int ocfs2_grow_tree(handle_t *handle, struct ocfs2_extent_tree *et, | |||
1570 | 1562 | ||
1571 | /* call ocfs2_add_branch to add the final part of the tree with | 1563 | /* call ocfs2_add_branch to add the final part of the tree with |
1572 | * the new data. */ | 1564 | * the new data. */ |
1573 | mlog(0, "add branch. bh = %p\n", bh); | ||
1574 | ret = ocfs2_add_branch(handle, et, bh, last_eb_bh, | 1565 | ret = ocfs2_add_branch(handle, et, bh, last_eb_bh, |
1575 | meta_ac); | 1566 | meta_ac); |
1576 | if (ret < 0) { | 1567 | if (ret < 0) { |
@@ -1645,8 +1636,9 @@ static void ocfs2_rotate_leaf(struct ocfs2_extent_list *el, | |||
1645 | } | 1636 | } |
1646 | insert_index = i; | 1637 | insert_index = i; |
1647 | 1638 | ||
1648 | mlog(0, "ins %u: index %d, has_empty %d, next_free %d, count %d\n", | 1639 | trace_ocfs2_rotate_leaf(insert_cpos, insert_index, |
1649 | insert_cpos, insert_index, has_empty, next_free, le16_to_cpu(el->l_count)); | 1640 | has_empty, next_free, |
1641 | le16_to_cpu(el->l_count)); | ||
1650 | 1642 | ||
1651 | BUG_ON(insert_index < 0); | 1643 | BUG_ON(insert_index < 0); |
1652 | BUG_ON(insert_index >= le16_to_cpu(el->l_count)); | 1644 | BUG_ON(insert_index >= le16_to_cpu(el->l_count)); |
@@ -2059,7 +2051,7 @@ static void ocfs2_complete_edge_insert(handle_t *handle, | |||
2059 | left_el = path_leaf_el(left_path); | 2051 | left_el = path_leaf_el(left_path); |
2060 | right_el = path_leaf_el(right_path); | 2052 | right_el = path_leaf_el(right_path); |
2061 | for(i = left_path->p_tree_depth - 1; i > subtree_index; i--) { | 2053 | for(i = left_path->p_tree_depth - 1; i > subtree_index; i--) { |
2062 | mlog(0, "Adjust records at index %u\n", i); | 2054 | trace_ocfs2_complete_edge_insert(i); |
2063 | 2055 | ||
2064 | /* | 2056 | /* |
2065 | * One nice property of knowing that all of these | 2057 | * One nice property of knowing that all of these |
@@ -2389,7 +2381,9 @@ static int ocfs2_rotate_tree_right(handle_t *handle, | |||
2389 | goto out; | 2381 | goto out; |
2390 | } | 2382 | } |
2391 | 2383 | ||
2392 | mlog(0, "Insert: %u, first left path cpos: %u\n", insert_cpos, cpos); | 2384 | trace_ocfs2_rotate_tree_right( |
2385 | (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci), | ||
2386 | insert_cpos, cpos); | ||
2393 | 2387 | ||
2394 | /* | 2388 | /* |
2395 | * What we want to do here is: | 2389 | * What we want to do here is: |
@@ -2418,8 +2412,10 @@ static int ocfs2_rotate_tree_right(handle_t *handle, | |||
2418 | * rotating subtrees. | 2412 | * rotating subtrees. |
2419 | */ | 2413 | */ |
2420 | while (cpos && insert_cpos <= cpos) { | 2414 | while (cpos && insert_cpos <= cpos) { |
2421 | mlog(0, "Rotating a tree: ins. cpos: %u, left path cpos: %u\n", | 2415 | trace_ocfs2_rotate_tree_right( |
2422 | insert_cpos, cpos); | 2416 | (unsigned long long) |
2417 | ocfs2_metadata_cache_owner(et->et_ci), | ||
2418 | insert_cpos, cpos); | ||
2423 | 2419 | ||
2424 | ret = ocfs2_find_path(et->et_ci, left_path, cpos); | 2420 | ret = ocfs2_find_path(et->et_ci, left_path, cpos); |
2425 | if (ret) { | 2421 | if (ret) { |
@@ -2461,10 +2457,10 @@ static int ocfs2_rotate_tree_right(handle_t *handle, | |||
2461 | 2457 | ||
2462 | start = ocfs2_find_subtree_root(et, left_path, right_path); | 2458 | start = ocfs2_find_subtree_root(et, left_path, right_path); |
2463 | 2459 | ||
2464 | mlog(0, "Subtree root at index %d (blk %llu, depth %d)\n", | 2460 | trace_ocfs2_rotate_subtree(start, |
2465 | start, | 2461 | (unsigned long long) |
2466 | (unsigned long long) right_path->p_node[start].bh->b_blocknr, | 2462 | right_path->p_node[start].bh->b_blocknr, |
2467 | right_path->p_tree_depth); | 2463 | right_path->p_tree_depth); |
2468 | 2464 | ||
2469 | ret = ocfs2_extend_rotate_transaction(handle, start, | 2465 | ret = ocfs2_extend_rotate_transaction(handle, start, |
2470 | orig_credits, right_path); | 2466 | orig_credits, right_path); |
@@ -2964,8 +2960,7 @@ static int __ocfs2_rotate_tree_left(handle_t *handle, | |||
2964 | subtree_root = ocfs2_find_subtree_root(et, left_path, | 2960 | subtree_root = ocfs2_find_subtree_root(et, left_path, |
2965 | right_path); | 2961 | right_path); |
2966 | 2962 | ||
2967 | mlog(0, "Subtree root at index %d (blk %llu, depth %d)\n", | 2963 | trace_ocfs2_rotate_subtree(subtree_root, |
2968 | subtree_root, | ||
2969 | (unsigned long long) | 2964 | (unsigned long long) |
2970 | right_path->p_node[subtree_root].bh->b_blocknr, | 2965 | right_path->p_node[subtree_root].bh->b_blocknr, |
2971 | right_path->p_tree_depth); | 2966 | right_path->p_tree_depth); |
@@ -3989,9 +3984,11 @@ static int ocfs2_append_rec_to_path(handle_t *handle, | |||
3989 | goto out; | 3984 | goto out; |
3990 | } | 3985 | } |
3991 | 3986 | ||
3992 | mlog(0, "Append may need a left path update. cpos: %u, " | 3987 | trace_ocfs2_append_rec_to_path( |
3993 | "left_cpos: %u\n", le32_to_cpu(insert_rec->e_cpos), | 3988 | (unsigned long long) |
3994 | left_cpos); | 3989 | ocfs2_metadata_cache_owner(et->et_ci), |
3990 | le32_to_cpu(insert_rec->e_cpos), | ||
3991 | left_cpos); | ||
3995 | 3992 | ||
3996 | /* | 3993 | /* |
3997 | * No need to worry if the append is already in the | 3994 | * No need to worry if the append is already in the |
@@ -4562,7 +4559,7 @@ static int ocfs2_figure_insert_type(struct ocfs2_extent_tree *et, | |||
4562 | ocfs2_et_get_last_eb_blk(et), | 4559 | ocfs2_et_get_last_eb_blk(et), |
4563 | &bh); | 4560 | &bh); |
4564 | if (ret) { | 4561 | if (ret) { |
4565 | mlog_exit(ret); | 4562 | mlog_errno(ret); |
4566 | goto out; | 4563 | goto out; |
4567 | } | 4564 | } |
4568 | eb = (struct ocfs2_extent_block *) bh->b_data; | 4565 | eb = (struct ocfs2_extent_block *) bh->b_data; |
@@ -4678,9 +4675,9 @@ int ocfs2_insert_extent(handle_t *handle, | |||
4678 | struct ocfs2_insert_type insert = {0, }; | 4675 | struct ocfs2_insert_type insert = {0, }; |
4679 | struct ocfs2_extent_rec rec; | 4676 | struct ocfs2_extent_rec rec; |
4680 | 4677 | ||
4681 | mlog(0, "add %u clusters at position %u to owner %llu\n", | 4678 | trace_ocfs2_insert_extent_start( |
4682 | new_clusters, cpos, | 4679 | (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci), |
4683 | (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci)); | 4680 | cpos, new_clusters); |
4684 | 4681 | ||
4685 | memset(&rec, 0, sizeof(rec)); | 4682 | memset(&rec, 0, sizeof(rec)); |
4686 | rec.e_cpos = cpu_to_le32(cpos); | 4683 | rec.e_cpos = cpu_to_le32(cpos); |
@@ -4700,11 +4697,9 @@ int ocfs2_insert_extent(handle_t *handle, | |||
4700 | goto bail; | 4697 | goto bail; |
4701 | } | 4698 | } |
4702 | 4699 | ||
4703 | mlog(0, "Insert.appending: %u, Insert.Contig: %u, " | 4700 | trace_ocfs2_insert_extent(insert.ins_appending, insert.ins_contig, |
4704 | "Insert.contig_index: %d, Insert.free_records: %d, " | 4701 | insert.ins_contig_index, free_records, |
4705 | "Insert.tree_depth: %d\n", | 4702 | insert.ins_tree_depth); |
4706 | insert.ins_appending, insert.ins_contig, insert.ins_contig_index, | ||
4707 | free_records, insert.ins_tree_depth); | ||
4708 | 4703 | ||
4709 | if (insert.ins_contig == CONTIG_NONE && free_records == 0) { | 4704 | if (insert.ins_contig == CONTIG_NONE && free_records == 0) { |
4710 | status = ocfs2_grow_tree(handle, et, | 4705 | status = ocfs2_grow_tree(handle, et, |
@@ -4726,7 +4721,6 @@ int ocfs2_insert_extent(handle_t *handle, | |||
4726 | bail: | 4721 | bail: |
4727 | brelse(last_eb_bh); | 4722 | brelse(last_eb_bh); |
4728 | 4723 | ||
4729 | mlog_exit(status); | ||
4730 | return status; | 4724 | return status; |
4731 | } | 4725 | } |
4732 | 4726 | ||
@@ -4746,7 +4740,7 @@ int ocfs2_add_clusters_in_btree(handle_t *handle, | |||
4746 | struct ocfs2_alloc_context *meta_ac, | 4740 | struct ocfs2_alloc_context *meta_ac, |
4747 | enum ocfs2_alloc_restarted *reason_ret) | 4741 | enum ocfs2_alloc_restarted *reason_ret) |
4748 | { | 4742 | { |
4749 | int status = 0; | 4743 | int status = 0, err = 0; |
4750 | int free_extents; | 4744 | int free_extents; |
4751 | enum ocfs2_alloc_restarted reason = RESTART_NONE; | 4745 | enum ocfs2_alloc_restarted reason = RESTART_NONE; |
4752 | u32 bit_off, num_bits; | 4746 | u32 bit_off, num_bits; |
@@ -4773,14 +4767,14 @@ int ocfs2_add_clusters_in_btree(handle_t *handle, | |||
4773 | * 2) we are so fragmented, we've needed to add metadata too | 4767 | * 2) we are so fragmented, we've needed to add metadata too |
4774 | * many times. */ | 4768 | * many times. */ |
4775 | if (!free_extents && !meta_ac) { | 4769 | if (!free_extents && !meta_ac) { |
4776 | mlog(0, "we haven't reserved any metadata!\n"); | 4770 | err = -1; |
4777 | status = -EAGAIN; | 4771 | status = -EAGAIN; |
4778 | reason = RESTART_META; | 4772 | reason = RESTART_META; |
4779 | goto leave; | 4773 | goto leave; |
4780 | } else if ((!free_extents) | 4774 | } else if ((!free_extents) |
4781 | && (ocfs2_alloc_context_bits_left(meta_ac) | 4775 | && (ocfs2_alloc_context_bits_left(meta_ac) |
4782 | < ocfs2_extend_meta_needed(et->et_root_el))) { | 4776 | < ocfs2_extend_meta_needed(et->et_root_el))) { |
4783 | mlog(0, "filesystem is really fragmented...\n"); | 4777 | err = -2; |
4784 | status = -EAGAIN; | 4778 | status = -EAGAIN; |
4785 | reason = RESTART_META; | 4779 | reason = RESTART_META; |
4786 | goto leave; | 4780 | goto leave; |
@@ -4805,9 +4799,9 @@ int ocfs2_add_clusters_in_btree(handle_t *handle, | |||
4805 | } | 4799 | } |
4806 | 4800 | ||
4807 | block = ocfs2_clusters_to_blocks(osb->sb, bit_off); | 4801 | block = ocfs2_clusters_to_blocks(osb->sb, bit_off); |
4808 | mlog(0, "Allocating %u clusters at block %u for owner %llu\n", | 4802 | trace_ocfs2_add_clusters_in_btree( |
4809 | num_bits, bit_off, | 4803 | (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci), |
4810 | (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci)); | 4804 | bit_off, num_bits); |
4811 | status = ocfs2_insert_extent(handle, et, *logical_offset, block, | 4805 | status = ocfs2_insert_extent(handle, et, *logical_offset, block, |
4812 | num_bits, flags, meta_ac); | 4806 | num_bits, flags, meta_ac); |
4813 | if (status < 0) { | 4807 | if (status < 0) { |
@@ -4821,16 +4815,15 @@ int ocfs2_add_clusters_in_btree(handle_t *handle, | |||
4821 | *logical_offset += num_bits; | 4815 | *logical_offset += num_bits; |
4822 | 4816 | ||
4823 | if (clusters_to_add) { | 4817 | if (clusters_to_add) { |
4824 | mlog(0, "need to alloc once more, wanted = %u\n", | 4818 | err = clusters_to_add; |
4825 | clusters_to_add); | ||
4826 | status = -EAGAIN; | 4819 | status = -EAGAIN; |
4827 | reason = RESTART_TRANS; | 4820 | reason = RESTART_TRANS; |
4828 | } | 4821 | } |
4829 | 4822 | ||
4830 | leave: | 4823 | leave: |
4831 | mlog_exit(status); | ||
4832 | if (reason_ret) | 4824 | if (reason_ret) |
4833 | *reason_ret = reason; | 4825 | *reason_ret = reason; |
4826 | trace_ocfs2_add_clusters_in_btree_ret(status, reason, err); | ||
4834 | return status; | 4827 | return status; |
4835 | } | 4828 | } |
4836 | 4829 | ||
@@ -5039,7 +5032,7 @@ int ocfs2_split_extent(handle_t *handle, | |||
5039 | ocfs2_et_get_last_eb_blk(et), | 5032 | ocfs2_et_get_last_eb_blk(et), |
5040 | &last_eb_bh); | 5033 | &last_eb_bh); |
5041 | if (ret) { | 5034 | if (ret) { |
5042 | mlog_exit(ret); | 5035 | mlog_errno(ret); |
5043 | goto out; | 5036 | goto out; |
5044 | } | 5037 | } |
5045 | 5038 | ||
@@ -5056,9 +5049,9 @@ int ocfs2_split_extent(handle_t *handle, | |||
5056 | 5049 | ||
5057 | ctxt.c_has_empty_extent = ocfs2_is_empty_extent(&el->l_recs[0]); | 5050 | ctxt.c_has_empty_extent = ocfs2_is_empty_extent(&el->l_recs[0]); |
5058 | 5051 | ||
5059 | mlog(0, "index: %d, contig: %u, has_empty: %u, split_covers: %u\n", | 5052 | trace_ocfs2_split_extent(split_index, ctxt.c_contig_type, |
5060 | split_index, ctxt.c_contig_type, ctxt.c_has_empty_extent, | 5053 | ctxt.c_has_empty_extent, |
5061 | ctxt.c_split_covers_rec); | 5054 | ctxt.c_split_covers_rec); |
5062 | 5055 | ||
5063 | if (ctxt.c_contig_type == CONTIG_NONE) { | 5056 | if (ctxt.c_contig_type == CONTIG_NONE) { |
5064 | if (ctxt.c_split_covers_rec) | 5057 | if (ctxt.c_split_covers_rec) |
@@ -5192,8 +5185,9 @@ int ocfs2_mark_extent_written(struct inode *inode, | |||
5192 | { | 5185 | { |
5193 | int ret; | 5186 | int ret; |
5194 | 5187 | ||
5195 | mlog(0, "Inode %lu cpos %u, len %u, phys clusters %u\n", | 5188 | trace_ocfs2_mark_extent_written( |
5196 | inode->i_ino, cpos, len, phys); | 5189 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
5190 | cpos, len, phys); | ||
5197 | 5191 | ||
5198 | if (!ocfs2_writes_unwritten_extents(OCFS2_SB(inode->i_sb))) { | 5192 | if (!ocfs2_writes_unwritten_extents(OCFS2_SB(inode->i_sb))) { |
5199 | ocfs2_error(inode->i_sb, "Inode %llu has unwritten extents " | 5193 | ocfs2_error(inode->i_sb, "Inode %llu has unwritten extents " |
@@ -5512,11 +5506,10 @@ int ocfs2_remove_extent(handle_t *handle, | |||
5512 | 5506 | ||
5513 | BUG_ON(cpos < le32_to_cpu(rec->e_cpos) || trunc_range > rec_range); | 5507 | BUG_ON(cpos < le32_to_cpu(rec->e_cpos) || trunc_range > rec_range); |
5514 | 5508 | ||
5515 | mlog(0, "Owner %llu, remove (cpos %u, len %u). Existing index %d " | 5509 | trace_ocfs2_remove_extent( |
5516 | "(cpos %u, len %u)\n", | 5510 | (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci), |
5517 | (unsigned long long)ocfs2_metadata_cache_owner(et->et_ci), | 5511 | cpos, len, index, le32_to_cpu(rec->e_cpos), |
5518 | cpos, len, index, | 5512 | ocfs2_rec_clusters(el, rec)); |
5519 | le32_to_cpu(rec->e_cpos), ocfs2_rec_clusters(el, rec)); | ||
5520 | 5513 | ||
5521 | if (le32_to_cpu(rec->e_cpos) == cpos || rec_range == trunc_range) { | 5514 | if (le32_to_cpu(rec->e_cpos) == cpos || rec_range == trunc_range) { |
5522 | ret = ocfs2_truncate_rec(handle, et, path, index, dealloc, | 5515 | ret = ocfs2_truncate_rec(handle, et, path, index, dealloc, |
@@ -5795,9 +5788,6 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb, | |||
5795 | struct ocfs2_dinode *di; | 5788 | struct ocfs2_dinode *di; |
5796 | struct ocfs2_truncate_log *tl; | 5789 | struct ocfs2_truncate_log *tl; |
5797 | 5790 | ||
5798 | mlog_entry("start_blk = %llu, num_clusters = %u\n", | ||
5799 | (unsigned long long)start_blk, num_clusters); | ||
5800 | |||
5801 | BUG_ON(mutex_trylock(&tl_inode->i_mutex)); | 5791 | BUG_ON(mutex_trylock(&tl_inode->i_mutex)); |
5802 | 5792 | ||
5803 | start_cluster = ocfs2_blocks_to_clusters(osb->sb, start_blk); | 5793 | start_cluster = ocfs2_blocks_to_clusters(osb->sb, start_blk); |
@@ -5834,10 +5824,9 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb, | |||
5834 | goto bail; | 5824 | goto bail; |
5835 | } | 5825 | } |
5836 | 5826 | ||
5837 | mlog(0, "Log truncate of %u clusters starting at cluster %u to " | 5827 | trace_ocfs2_truncate_log_append( |
5838 | "%llu (index = %d)\n", num_clusters, start_cluster, | 5828 | (unsigned long long)OCFS2_I(tl_inode)->ip_blkno, index, |
5839 | (unsigned long long)OCFS2_I(tl_inode)->ip_blkno, index); | 5829 | start_cluster, num_clusters); |
5840 | |||
5841 | if (ocfs2_truncate_log_can_coalesce(tl, start_cluster)) { | 5830 | if (ocfs2_truncate_log_can_coalesce(tl, start_cluster)) { |
5842 | /* | 5831 | /* |
5843 | * Move index back to the record we are coalescing with. | 5832 | * Move index back to the record we are coalescing with. |
@@ -5846,9 +5835,10 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb, | |||
5846 | index--; | 5835 | index--; |
5847 | 5836 | ||
5848 | num_clusters += le32_to_cpu(tl->tl_recs[index].t_clusters); | 5837 | num_clusters += le32_to_cpu(tl->tl_recs[index].t_clusters); |
5849 | mlog(0, "Coalesce with index %u (start = %u, clusters = %u)\n", | 5838 | trace_ocfs2_truncate_log_append( |
5850 | index, le32_to_cpu(tl->tl_recs[index].t_start), | 5839 | (unsigned long long)OCFS2_I(tl_inode)->ip_blkno, |
5851 | num_clusters); | 5840 | index, le32_to_cpu(tl->tl_recs[index].t_start), |
5841 | num_clusters); | ||
5852 | } else { | 5842 | } else { |
5853 | tl->tl_recs[index].t_start = cpu_to_le32(start_cluster); | 5843 | tl->tl_recs[index].t_start = cpu_to_le32(start_cluster); |
5854 | tl->tl_used = cpu_to_le16(index + 1); | 5844 | tl->tl_used = cpu_to_le16(index + 1); |
@@ -5859,7 +5849,6 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb, | |||
5859 | 5849 | ||
5860 | osb->truncated_clusters += num_clusters; | 5850 | osb->truncated_clusters += num_clusters; |
5861 | bail: | 5851 | bail: |
5862 | mlog_exit(status); | ||
5863 | return status; | 5852 | return status; |
5864 | } | 5853 | } |
5865 | 5854 | ||
@@ -5878,8 +5867,6 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, | |||
5878 | struct inode *tl_inode = osb->osb_tl_inode; | 5867 | struct inode *tl_inode = osb->osb_tl_inode; |
5879 | struct buffer_head *tl_bh = osb->osb_tl_bh; | 5868 | struct buffer_head *tl_bh = osb->osb_tl_bh; |
5880 | 5869 | ||
5881 | mlog_entry_void(); | ||
5882 | |||
5883 | di = (struct ocfs2_dinode *) tl_bh->b_data; | 5870 | di = (struct ocfs2_dinode *) tl_bh->b_data; |
5884 | tl = &di->id2.i_dealloc; | 5871 | tl = &di->id2.i_dealloc; |
5885 | i = le16_to_cpu(tl->tl_used) - 1; | 5872 | i = le16_to_cpu(tl->tl_used) - 1; |
@@ -5915,8 +5902,9 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, | |||
5915 | /* if start_blk is not set, we ignore the record as | 5902 | /* if start_blk is not set, we ignore the record as |
5916 | * invalid. */ | 5903 | * invalid. */ |
5917 | if (start_blk) { | 5904 | if (start_blk) { |
5918 | mlog(0, "free record %d, start = %u, clusters = %u\n", | 5905 | trace_ocfs2_replay_truncate_records( |
5919 | i, le32_to_cpu(rec.t_start), num_clusters); | 5906 | (unsigned long long)OCFS2_I(tl_inode)->ip_blkno, |
5907 | i, le32_to_cpu(rec.t_start), num_clusters); | ||
5920 | 5908 | ||
5921 | status = ocfs2_free_clusters(handle, data_alloc_inode, | 5909 | status = ocfs2_free_clusters(handle, data_alloc_inode, |
5922 | data_alloc_bh, start_blk, | 5910 | data_alloc_bh, start_blk, |
@@ -5932,7 +5920,6 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb, | |||
5932 | osb->truncated_clusters = 0; | 5920 | osb->truncated_clusters = 0; |
5933 | 5921 | ||
5934 | bail: | 5922 | bail: |
5935 | mlog_exit(status); | ||
5936 | return status; | 5923 | return status; |
5937 | } | 5924 | } |
5938 | 5925 | ||
@@ -5949,8 +5936,6 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) | |||
5949 | struct ocfs2_dinode *di; | 5936 | struct ocfs2_dinode *di; |
5950 | struct ocfs2_truncate_log *tl; | 5937 | struct ocfs2_truncate_log *tl; |
5951 | 5938 | ||
5952 | mlog_entry_void(); | ||
5953 | |||
5954 | BUG_ON(mutex_trylock(&tl_inode->i_mutex)); | 5939 | BUG_ON(mutex_trylock(&tl_inode->i_mutex)); |
5955 | 5940 | ||
5956 | di = (struct ocfs2_dinode *) tl_bh->b_data; | 5941 | di = (struct ocfs2_dinode *) tl_bh->b_data; |
@@ -5962,8 +5947,9 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb) | |||
5962 | 5947 | ||
5963 | tl = &di->id2.i_dealloc; | 5948 | tl = &di->id2.i_dealloc; |
5964 | num_to_flush = le16_to_cpu(tl->tl_used); | 5949 | num_to_flush = le16_to_cpu(tl->tl_used); |
5965 | mlog(0, "Flush %u records from truncate log #%llu\n", | 5950 | trace_ocfs2_flush_truncate_log( |
5966 | num_to_flush, (unsigned long long)OCFS2_I(tl_inode)->ip_blkno); | 5951 | (unsigned long long)OCFS2_I(tl_inode)->ip_blkno, |
5952 | num_to_flush); | ||
5967 | if (!num_to_flush) { | 5953 | if (!num_to_flush) { |
5968 | status = 0; | 5954 | status = 0; |
5969 | goto out; | 5955 | goto out; |
@@ -6009,7 +5995,6 @@ out_mutex: | |||
6009 | iput(data_alloc_inode); | 5995 | iput(data_alloc_inode); |
6010 | 5996 | ||
6011 | out: | 5997 | out: |
6012 | mlog_exit(status); | ||
6013 | return status; | 5998 | return status; |
6014 | } | 5999 | } |
6015 | 6000 | ||
@@ -6032,15 +6017,11 @@ static void ocfs2_truncate_log_worker(struct work_struct *work) | |||
6032 | container_of(work, struct ocfs2_super, | 6017 | container_of(work, struct ocfs2_super, |
6033 | osb_truncate_log_wq.work); | 6018 | osb_truncate_log_wq.work); |
6034 | 6019 | ||
6035 | mlog_entry_void(); | ||
6036 | |||
6037 | status = ocfs2_flush_truncate_log(osb); | 6020 | status = ocfs2_flush_truncate_log(osb); |
6038 | if (status < 0) | 6021 | if (status < 0) |
6039 | mlog_errno(status); | 6022 | mlog_errno(status); |
6040 | else | 6023 | else |
6041 | ocfs2_init_steal_slots(osb); | 6024 | ocfs2_init_steal_slots(osb); |
6042 | |||
6043 | mlog_exit(status); | ||
6044 | } | 6025 | } |
6045 | 6026 | ||
6046 | #define OCFS2_TRUNCATE_LOG_FLUSH_INTERVAL (2 * HZ) | 6027 | #define OCFS2_TRUNCATE_LOG_FLUSH_INTERVAL (2 * HZ) |
@@ -6086,7 +6067,6 @@ static int ocfs2_get_truncate_log_info(struct ocfs2_super *osb, | |||
6086 | *tl_inode = inode; | 6067 | *tl_inode = inode; |
6087 | *tl_bh = bh; | 6068 | *tl_bh = bh; |
6088 | bail: | 6069 | bail: |
6089 | mlog_exit(status); | ||
6090 | return status; | 6070 | return status; |
6091 | } | 6071 | } |
6092 | 6072 | ||
@@ -6106,7 +6086,7 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb, | |||
6106 | 6086 | ||
6107 | *tl_copy = NULL; | 6087 | *tl_copy = NULL; |
6108 | 6088 | ||
6109 | mlog(0, "recover truncate log from slot %d\n", slot_num); | 6089 | trace_ocfs2_begin_truncate_log_recovery(slot_num); |
6110 | 6090 | ||
6111 | status = ocfs2_get_truncate_log_info(osb, slot_num, &tl_inode, &tl_bh); | 6091 | status = ocfs2_get_truncate_log_info(osb, slot_num, &tl_inode, &tl_bh); |
6112 | if (status < 0) { | 6092 | if (status < 0) { |
@@ -6123,8 +6103,7 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb, | |||
6123 | 6103 | ||
6124 | tl = &di->id2.i_dealloc; | 6104 | tl = &di->id2.i_dealloc; |
6125 | if (le16_to_cpu(tl->tl_used)) { | 6105 | if (le16_to_cpu(tl->tl_used)) { |
6126 | mlog(0, "We'll have %u logs to recover\n", | 6106 | trace_ocfs2_truncate_log_recovery_num(le16_to_cpu(tl->tl_used)); |
6127 | le16_to_cpu(tl->tl_used)); | ||
6128 | 6107 | ||
6129 | *tl_copy = kmalloc(tl_bh->b_size, GFP_KERNEL); | 6108 | *tl_copy = kmalloc(tl_bh->b_size, GFP_KERNEL); |
6130 | if (!(*tl_copy)) { | 6109 | if (!(*tl_copy)) { |
@@ -6157,9 +6136,9 @@ bail: | |||
6157 | if (status < 0 && (*tl_copy)) { | 6136 | if (status < 0 && (*tl_copy)) { |
6158 | kfree(*tl_copy); | 6137 | kfree(*tl_copy); |
6159 | *tl_copy = NULL; | 6138 | *tl_copy = NULL; |
6139 | mlog_errno(status); | ||
6160 | } | 6140 | } |
6161 | 6141 | ||
6162 | mlog_exit(status); | ||
6163 | return status; | 6142 | return status; |
6164 | } | 6143 | } |
6165 | 6144 | ||
@@ -6174,8 +6153,6 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb, | |||
6174 | struct inode *tl_inode = osb->osb_tl_inode; | 6153 | struct inode *tl_inode = osb->osb_tl_inode; |
6175 | struct ocfs2_truncate_log *tl; | 6154 | struct ocfs2_truncate_log *tl; |
6176 | 6155 | ||
6177 | mlog_entry_void(); | ||
6178 | |||
6179 | if (OCFS2_I(tl_inode)->ip_blkno == le64_to_cpu(tl_copy->i_blkno)) { | 6156 | if (OCFS2_I(tl_inode)->ip_blkno == le64_to_cpu(tl_copy->i_blkno)) { |
6180 | mlog(ML_ERROR, "Asked to recover my own truncate log!\n"); | 6157 | mlog(ML_ERROR, "Asked to recover my own truncate log!\n"); |
6181 | return -EINVAL; | 6158 | return -EINVAL; |
@@ -6183,8 +6160,9 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb, | |||
6183 | 6160 | ||
6184 | tl = &tl_copy->id2.i_dealloc; | 6161 | tl = &tl_copy->id2.i_dealloc; |
6185 | num_recs = le16_to_cpu(tl->tl_used); | 6162 | num_recs = le16_to_cpu(tl->tl_used); |
6186 | mlog(0, "cleanup %u records from %llu\n", num_recs, | 6163 | trace_ocfs2_complete_truncate_log_recovery( |
6187 | (unsigned long long)le64_to_cpu(tl_copy->i_blkno)); | 6164 | (unsigned long long)le64_to_cpu(tl_copy->i_blkno), |
6165 | num_recs); | ||
6188 | 6166 | ||
6189 | mutex_lock(&tl_inode->i_mutex); | 6167 | mutex_lock(&tl_inode->i_mutex); |
6190 | for(i = 0; i < num_recs; i++) { | 6168 | for(i = 0; i < num_recs; i++) { |
@@ -6219,7 +6197,6 @@ int ocfs2_complete_truncate_log_recovery(struct ocfs2_super *osb, | |||
6219 | bail_up: | 6197 | bail_up: |
6220 | mutex_unlock(&tl_inode->i_mutex); | 6198 | mutex_unlock(&tl_inode->i_mutex); |
6221 | 6199 | ||
6222 | mlog_exit(status); | ||
6223 | return status; | 6200 | return status; |
6224 | } | 6201 | } |
6225 | 6202 | ||
@@ -6228,8 +6205,6 @@ void ocfs2_truncate_log_shutdown(struct ocfs2_super *osb) | |||
6228 | int status; | 6205 | int status; |
6229 | struct inode *tl_inode = osb->osb_tl_inode; | 6206 | struct inode *tl_inode = osb->osb_tl_inode; |
6230 | 6207 | ||
6231 | mlog_entry_void(); | ||
6232 | |||
6233 | if (tl_inode) { | 6208 | if (tl_inode) { |
6234 | cancel_delayed_work(&osb->osb_truncate_log_wq); | 6209 | cancel_delayed_work(&osb->osb_truncate_log_wq); |
6235 | flush_workqueue(ocfs2_wq); | 6210 | flush_workqueue(ocfs2_wq); |
@@ -6241,8 +6216,6 @@ void ocfs2_truncate_log_shutdown(struct ocfs2_super *osb) | |||
6241 | brelse(osb->osb_tl_bh); | 6216 | brelse(osb->osb_tl_bh); |
6242 | iput(osb->osb_tl_inode); | 6217 | iput(osb->osb_tl_inode); |
6243 | } | 6218 | } |
6244 | |||
6245 | mlog_exit_void(); | ||
6246 | } | 6219 | } |
6247 | 6220 | ||
6248 | int ocfs2_truncate_log_init(struct ocfs2_super *osb) | 6221 | int ocfs2_truncate_log_init(struct ocfs2_super *osb) |
@@ -6251,8 +6224,6 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb) | |||
6251 | struct inode *tl_inode = NULL; | 6224 | struct inode *tl_inode = NULL; |
6252 | struct buffer_head *tl_bh = NULL; | 6225 | struct buffer_head *tl_bh = NULL; |
6253 | 6226 | ||
6254 | mlog_entry_void(); | ||
6255 | |||
6256 | status = ocfs2_get_truncate_log_info(osb, | 6227 | status = ocfs2_get_truncate_log_info(osb, |
6257 | osb->slot_num, | 6228 | osb->slot_num, |
6258 | &tl_inode, | 6229 | &tl_inode, |
@@ -6268,7 +6239,6 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb) | |||
6268 | osb->osb_tl_bh = tl_bh; | 6239 | osb->osb_tl_bh = tl_bh; |
6269 | osb->osb_tl_inode = tl_inode; | 6240 | osb->osb_tl_inode = tl_inode; |
6270 | 6241 | ||
6271 | mlog_exit(status); | ||
6272 | return status; | 6242 | return status; |
6273 | } | 6243 | } |
6274 | 6244 | ||
@@ -6350,8 +6320,8 @@ static int ocfs2_free_cached_blocks(struct ocfs2_super *osb, | |||
6350 | else | 6320 | else |
6351 | bg_blkno = ocfs2_which_suballoc_group(head->free_blk, | 6321 | bg_blkno = ocfs2_which_suballoc_group(head->free_blk, |
6352 | head->free_bit); | 6322 | head->free_bit); |
6353 | mlog(0, "Free bit: (bit %u, blkno %llu)\n", | 6323 | trace_ocfs2_free_cached_blocks( |
6354 | head->free_bit, (unsigned long long)head->free_blk); | 6324 | (unsigned long long)head->free_blk, head->free_bit); |
6355 | 6325 | ||
6356 | ret = ocfs2_free_suballoc_bits(handle, inode, di_bh, | 6326 | ret = ocfs2_free_suballoc_bits(handle, inode, di_bh, |
6357 | head->free_bit, bg_blkno, 1); | 6327 | head->free_bit, bg_blkno, 1); |
@@ -6404,8 +6374,7 @@ int ocfs2_cache_cluster_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, | |||
6404 | return ret; | 6374 | return ret; |
6405 | } | 6375 | } |
6406 | 6376 | ||
6407 | mlog(0, "Insert clusters: (bit %u, blk %llu)\n", | 6377 | trace_ocfs2_cache_cluster_dealloc((unsigned long long)blkno, bit); |
6408 | bit, (unsigned long long)blkno); | ||
6409 | 6378 | ||
6410 | item->free_blk = blkno; | 6379 | item->free_blk = blkno; |
6411 | item->free_bit = bit; | 6380 | item->free_bit = bit; |
@@ -6480,8 +6449,8 @@ int ocfs2_run_deallocs(struct ocfs2_super *osb, | |||
6480 | fl = ctxt->c_first_suballocator; | 6449 | fl = ctxt->c_first_suballocator; |
6481 | 6450 | ||
6482 | if (fl->f_first) { | 6451 | if (fl->f_first) { |
6483 | mlog(0, "Free items: (type %u, slot %d)\n", | 6452 | trace_ocfs2_run_deallocs(fl->f_inode_type, |
6484 | fl->f_inode_type, fl->f_slot); | 6453 | fl->f_slot); |
6485 | ret2 = ocfs2_free_cached_blocks(osb, | 6454 | ret2 = ocfs2_free_cached_blocks(osb, |
6486 | fl->f_inode_type, | 6455 | fl->f_inode_type, |
6487 | fl->f_slot, | 6456 | fl->f_slot, |
@@ -6558,8 +6527,9 @@ int ocfs2_cache_block_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt, | |||
6558 | goto out; | 6527 | goto out; |
6559 | } | 6528 | } |
6560 | 6529 | ||
6561 | mlog(0, "Insert: (type %d, slot %u, bit %u, blk %llu)\n", | 6530 | trace_ocfs2_cache_block_dealloc(type, slot, |
6562 | type, slot, bit, (unsigned long long)blkno); | 6531 | (unsigned long long)suballoc, |
6532 | (unsigned long long)blkno, bit); | ||
6563 | 6533 | ||
6564 | item->free_bg = suballoc; | 6534 | item->free_bg = suballoc; |
6565 | item->free_blk = blkno; | 6535 | item->free_blk = blkno; |
@@ -7005,8 +6975,6 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb, | |||
7005 | struct ocfs2_extent_tree et; | 6975 | struct ocfs2_extent_tree et; |
7006 | struct ocfs2_cached_dealloc_ctxt dealloc; | 6976 | struct ocfs2_cached_dealloc_ctxt dealloc; |
7007 | 6977 | ||
7008 | mlog_entry_void(); | ||
7009 | |||
7010 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh); | 6978 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh); |
7011 | ocfs2_init_dealloc_ctxt(&dealloc); | 6979 | ocfs2_init_dealloc_ctxt(&dealloc); |
7012 | 6980 | ||
@@ -7041,8 +7009,11 @@ start: | |||
7041 | goto bail; | 7009 | goto bail; |
7042 | } | 7010 | } |
7043 | 7011 | ||
7044 | mlog(0, "inode->ip_clusters = %u, tree_depth = %u\n", | 7012 | trace_ocfs2_commit_truncate( |
7045 | OCFS2_I(inode)->ip_clusters, path->p_tree_depth); | 7013 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
7014 | new_highest_cpos, | ||
7015 | OCFS2_I(inode)->ip_clusters, | ||
7016 | path->p_tree_depth); | ||
7046 | 7017 | ||
7047 | /* | 7018 | /* |
7048 | * By now, el will point to the extent list on the bottom most | 7019 | * By now, el will point to the extent list on the bottom most |
@@ -7136,7 +7107,6 @@ bail: | |||
7136 | 7107 | ||
7137 | ocfs2_free_path(path); | 7108 | ocfs2_free_path(path); |
7138 | 7109 | ||
7139 | mlog_exit(status); | ||
7140 | return status; | 7110 | return status; |
7141 | } | 7111 | } |
7142 | 7112 | ||
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 1fbb0e20131b..0d44b7701844 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/mpage.h> | 29 | #include <linux/mpage.h> |
30 | #include <linux/quotaops.h> | 30 | #include <linux/quotaops.h> |
31 | 31 | ||
32 | #define MLOG_MASK_PREFIX ML_FILE_IO | ||
33 | #include <cluster/masklog.h> | 32 | #include <cluster/masklog.h> |
34 | 33 | ||
35 | #include "ocfs2.h" | 34 | #include "ocfs2.h" |
@@ -45,6 +44,7 @@ | |||
45 | #include "super.h" | 44 | #include "super.h" |
46 | #include "symlink.h" | 45 | #include "symlink.h" |
47 | #include "refcounttree.h" | 46 | #include "refcounttree.h" |
47 | #include "ocfs2_trace.h" | ||
48 | 48 | ||
49 | #include "buffer_head_io.h" | 49 | #include "buffer_head_io.h" |
50 | 50 | ||
@@ -59,8 +59,9 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock, | |||
59 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 59 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
60 | void *kaddr; | 60 | void *kaddr; |
61 | 61 | ||
62 | mlog_entry("(0x%p, %llu, 0x%p, %d)\n", inode, | 62 | trace_ocfs2_symlink_get_block( |
63 | (unsigned long long)iblock, bh_result, create); | 63 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
64 | (unsigned long long)iblock, bh_result, create); | ||
64 | 65 | ||
65 | BUG_ON(ocfs2_inode_is_fast_symlink(inode)); | 66 | BUG_ON(ocfs2_inode_is_fast_symlink(inode)); |
66 | 67 | ||
@@ -123,7 +124,6 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock, | |||
123 | bail: | 124 | bail: |
124 | brelse(bh); | 125 | brelse(bh); |
125 | 126 | ||
126 | mlog_exit(err); | ||
127 | return err; | 127 | return err; |
128 | } | 128 | } |
129 | 129 | ||
@@ -136,8 +136,8 @@ int ocfs2_get_block(struct inode *inode, sector_t iblock, | |||
136 | u64 p_blkno, count, past_eof; | 136 | u64 p_blkno, count, past_eof; |
137 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 137 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
138 | 138 | ||
139 | mlog_entry("(0x%p, %llu, 0x%p, %d)\n", inode, | 139 | trace_ocfs2_get_block((unsigned long long)OCFS2_I(inode)->ip_blkno, |
140 | (unsigned long long)iblock, bh_result, create); | 140 | (unsigned long long)iblock, bh_result, create); |
141 | 141 | ||
142 | if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE) | 142 | if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SYSTEM_FILE) |
143 | mlog(ML_NOTICE, "get_block on system inode 0x%p (%lu)\n", | 143 | mlog(ML_NOTICE, "get_block on system inode 0x%p (%lu)\n", |
@@ -199,8 +199,9 @@ int ocfs2_get_block(struct inode *inode, sector_t iblock, | |||
199 | } | 199 | } |
200 | 200 | ||
201 | past_eof = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode)); | 201 | past_eof = ocfs2_blocks_for_bytes(inode->i_sb, i_size_read(inode)); |
202 | mlog(0, "Inode %lu, past_eof = %llu\n", inode->i_ino, | 202 | |
203 | (unsigned long long)past_eof); | 203 | trace_ocfs2_get_block_end((unsigned long long)OCFS2_I(inode)->ip_blkno, |
204 | (unsigned long long)past_eof); | ||
204 | if (create && (iblock >= past_eof)) | 205 | if (create && (iblock >= past_eof)) |
205 | set_buffer_new(bh_result); | 206 | set_buffer_new(bh_result); |
206 | 207 | ||
@@ -208,7 +209,6 @@ bail: | |||
208 | if (err < 0) | 209 | if (err < 0) |
209 | err = -EIO; | 210 | err = -EIO; |
210 | 211 | ||
211 | mlog_exit(err); | ||
212 | return err; | 212 | return err; |
213 | } | 213 | } |
214 | 214 | ||
@@ -278,7 +278,8 @@ static int ocfs2_readpage(struct file *file, struct page *page) | |||
278 | loff_t start = (loff_t)page->index << PAGE_CACHE_SHIFT; | 278 | loff_t start = (loff_t)page->index << PAGE_CACHE_SHIFT; |
279 | int ret, unlock = 1; | 279 | int ret, unlock = 1; |
280 | 280 | ||
281 | mlog_entry("(0x%p, %lu)\n", file, (page ? page->index : 0)); | 281 | trace_ocfs2_readpage((unsigned long long)oi->ip_blkno, |
282 | (page ? page->index : 0)); | ||
282 | 283 | ||
283 | ret = ocfs2_inode_lock_with_page(inode, NULL, 0, page); | 284 | ret = ocfs2_inode_lock_with_page(inode, NULL, 0, page); |
284 | if (ret != 0) { | 285 | if (ret != 0) { |
@@ -323,7 +324,6 @@ out_inode_unlock: | |||
323 | out: | 324 | out: |
324 | if (unlock) | 325 | if (unlock) |
325 | unlock_page(page); | 326 | unlock_page(page); |
326 | mlog_exit(ret); | ||
327 | return ret; | 327 | return ret; |
328 | } | 328 | } |
329 | 329 | ||
@@ -396,15 +396,11 @@ out_unlock: | |||
396 | */ | 396 | */ |
397 | static int ocfs2_writepage(struct page *page, struct writeback_control *wbc) | 397 | static int ocfs2_writepage(struct page *page, struct writeback_control *wbc) |
398 | { | 398 | { |
399 | int ret; | 399 | trace_ocfs2_writepage( |
400 | 400 | (unsigned long long)OCFS2_I(page->mapping->host)->ip_blkno, | |
401 | mlog_entry("(0x%p)\n", page); | 401 | page->index); |
402 | |||
403 | ret = block_write_full_page(page, ocfs2_get_block, wbc); | ||
404 | 402 | ||
405 | mlog_exit(ret); | 403 | return block_write_full_page(page, ocfs2_get_block, wbc); |
406 | |||
407 | return ret; | ||
408 | } | 404 | } |
409 | 405 | ||
410 | /* Taken from ext3. We don't necessarily need the full blown | 406 | /* Taken from ext3. We don't necessarily need the full blown |
@@ -450,7 +446,8 @@ static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block) | |||
450 | int err = 0; | 446 | int err = 0; |
451 | struct inode *inode = mapping->host; | 447 | struct inode *inode = mapping->host; |
452 | 448 | ||
453 | mlog_entry("(block = %llu)\n", (unsigned long long)block); | 449 | trace_ocfs2_bmap((unsigned long long)OCFS2_I(inode)->ip_blkno, |
450 | (unsigned long long)block); | ||
454 | 451 | ||
455 | /* We don't need to lock journal system files, since they aren't | 452 | /* We don't need to lock journal system files, since they aren't |
456 | * accessed concurrently from multiple nodes. | 453 | * accessed concurrently from multiple nodes. |
@@ -484,8 +481,6 @@ static sector_t ocfs2_bmap(struct address_space *mapping, sector_t block) | |||
484 | bail: | 481 | bail: |
485 | status = err ? 0 : p_blkno; | 482 | status = err ? 0 : p_blkno; |
486 | 483 | ||
487 | mlog_exit((int)status); | ||
488 | |||
489 | return status; | 484 | return status; |
490 | } | 485 | } |
491 | 486 | ||
@@ -616,9 +611,6 @@ static ssize_t ocfs2_direct_IO(int rw, | |||
616 | { | 611 | { |
617 | struct file *file = iocb->ki_filp; | 612 | struct file *file = iocb->ki_filp; |
618 | struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host; | 613 | struct inode *inode = file->f_path.dentry->d_inode->i_mapping->host; |
619 | int ret; | ||
620 | |||
621 | mlog_entry_void(); | ||
622 | 614 | ||
623 | /* | 615 | /* |
624 | * Fallback to buffered I/O if we see an inode without | 616 | * Fallback to buffered I/O if we see an inode without |
@@ -631,13 +623,10 @@ static ssize_t ocfs2_direct_IO(int rw, | |||
631 | if (i_size_read(inode) <= offset) | 623 | if (i_size_read(inode) <= offset) |
632 | return 0; | 624 | return 0; |
633 | 625 | ||
634 | ret = __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, | 626 | return __blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, |
635 | iov, offset, nr_segs, | 627 | iov, offset, nr_segs, |
636 | ocfs2_direct_IO_get_blocks, | 628 | ocfs2_direct_IO_get_blocks, |
637 | ocfs2_dio_end_io, NULL, 0); | 629 | ocfs2_dio_end_io, NULL, 0); |
638 | |||
639 | mlog_exit(ret); | ||
640 | return ret; | ||
641 | } | 630 | } |
642 | 631 | ||
643 | static void ocfs2_figure_cluster_boundaries(struct ocfs2_super *osb, | 632 | static void ocfs2_figure_cluster_boundaries(struct ocfs2_super *osb, |
@@ -1534,9 +1523,9 @@ static int ocfs2_try_to_write_inline_data(struct address_space *mapping, | |||
1534 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 1523 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
1535 | struct ocfs2_dinode *di = NULL; | 1524 | struct ocfs2_dinode *di = NULL; |
1536 | 1525 | ||
1537 | mlog(0, "Inode %llu, write of %u bytes at off %llu. features: 0x%x\n", | 1526 | trace_ocfs2_try_to_write_inline_data((unsigned long long)oi->ip_blkno, |
1538 | (unsigned long long)oi->ip_blkno, len, (unsigned long long)pos, | 1527 | len, (unsigned long long)pos, |
1539 | oi->ip_dyn_features); | 1528 | oi->ip_dyn_features); |
1540 | 1529 | ||
1541 | /* | 1530 | /* |
1542 | * Handle inodes which already have inline data 1st. | 1531 | * Handle inodes which already have inline data 1st. |
@@ -1739,6 +1728,13 @@ try_again: | |||
1739 | 1728 | ||
1740 | di = (struct ocfs2_dinode *)wc->w_di_bh->b_data; | 1729 | di = (struct ocfs2_dinode *)wc->w_di_bh->b_data; |
1741 | 1730 | ||
1731 | trace_ocfs2_write_begin_nolock( | ||
1732 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
1733 | (long long)i_size_read(inode), | ||
1734 | le32_to_cpu(di->i_clusters), | ||
1735 | pos, len, flags, mmap_page, | ||
1736 | clusters_to_alloc, extents_to_split); | ||
1737 | |||
1742 | /* | 1738 | /* |
1743 | * We set w_target_from, w_target_to here so that | 1739 | * We set w_target_from, w_target_to here so that |
1744 | * ocfs2_write_end() knows which range in the target page to | 1740 | * ocfs2_write_end() knows which range in the target page to |
@@ -1751,12 +1747,6 @@ try_again: | |||
1751 | * ocfs2_lock_allocators(). It greatly over-estimates | 1747 | * ocfs2_lock_allocators(). It greatly over-estimates |
1752 | * the work to be done. | 1748 | * the work to be done. |
1753 | */ | 1749 | */ |
1754 | mlog(0, "extend inode %llu, i_size = %lld, di->i_clusters = %u," | ||
1755 | " clusters_to_add = %u, extents_to_split = %u\n", | ||
1756 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
1757 | (long long)i_size_read(inode), le32_to_cpu(di->i_clusters), | ||
1758 | clusters_to_alloc, extents_to_split); | ||
1759 | |||
1760 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), | 1750 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), |
1761 | wc->w_di_bh); | 1751 | wc->w_di_bh); |
1762 | ret = ocfs2_lock_allocators(inode, &et, | 1752 | ret = ocfs2_lock_allocators(inode, &et, |
@@ -1938,8 +1928,8 @@ static void ocfs2_write_end_inline(struct inode *inode, loff_t pos, | |||
1938 | memcpy(di->id2.i_data.id_data + pos, kaddr + pos, *copied); | 1928 | memcpy(di->id2.i_data.id_data + pos, kaddr + pos, *copied); |
1939 | kunmap_atomic(kaddr, KM_USER0); | 1929 | kunmap_atomic(kaddr, KM_USER0); |
1940 | 1930 | ||
1941 | mlog(0, "Data written to inode at offset %llu. " | 1931 | trace_ocfs2_write_end_inline( |
1942 | "id_count = %u, copied = %u, i_dyn_features = 0x%x\n", | 1932 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
1943 | (unsigned long long)pos, *copied, | 1933 | (unsigned long long)pos, *copied, |
1944 | le16_to_cpu(di->id2.i_data.id_count), | 1934 | le16_to_cpu(di->id2.i_data.id_count), |
1945 | le16_to_cpu(di->i_dyn_features)); | 1935 | le16_to_cpu(di->i_dyn_features)); |
diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c index f9d5d3ffc75a..5d18ad10c27f 100644 --- a/fs/ocfs2/buffer_head_io.c +++ b/fs/ocfs2/buffer_head_io.c | |||
@@ -35,8 +35,8 @@ | |||
35 | #include "inode.h" | 35 | #include "inode.h" |
36 | #include "journal.h" | 36 | #include "journal.h" |
37 | #include "uptodate.h" | 37 | #include "uptodate.h" |
38 | |||
39 | #include "buffer_head_io.h" | 38 | #include "buffer_head_io.h" |
39 | #include "ocfs2_trace.h" | ||
40 | 40 | ||
41 | /* | 41 | /* |
42 | * Bits on bh->b_state used by ocfs2. | 42 | * Bits on bh->b_state used by ocfs2. |
@@ -55,8 +55,7 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh, | |||
55 | { | 55 | { |
56 | int ret = 0; | 56 | int ret = 0; |
57 | 57 | ||
58 | mlog_entry("(bh->b_blocknr = %llu, ci=%p)\n", | 58 | trace_ocfs2_write_block((unsigned long long)bh->b_blocknr, ci); |
59 | (unsigned long long)bh->b_blocknr, ci); | ||
60 | 59 | ||
61 | BUG_ON(bh->b_blocknr < OCFS2_SUPER_BLOCK_BLKNO); | 60 | BUG_ON(bh->b_blocknr < OCFS2_SUPER_BLOCK_BLKNO); |
62 | BUG_ON(buffer_jbd(bh)); | 61 | BUG_ON(buffer_jbd(bh)); |
@@ -66,6 +65,7 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh, | |||
66 | * can get modified during recovery even if read-only. */ | 65 | * can get modified during recovery even if read-only. */ |
67 | if (ocfs2_is_hard_readonly(osb)) { | 66 | if (ocfs2_is_hard_readonly(osb)) { |
68 | ret = -EROFS; | 67 | ret = -EROFS; |
68 | mlog_errno(ret); | ||
69 | goto out; | 69 | goto out; |
70 | } | 70 | } |
71 | 71 | ||
@@ -91,11 +91,11 @@ int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh, | |||
91 | * uptodate. */ | 91 | * uptodate. */ |
92 | ret = -EIO; | 92 | ret = -EIO; |
93 | put_bh(bh); | 93 | put_bh(bh); |
94 | mlog_errno(ret); | ||
94 | } | 95 | } |
95 | 96 | ||
96 | ocfs2_metadata_cache_io_unlock(ci); | 97 | ocfs2_metadata_cache_io_unlock(ci); |
97 | out: | 98 | out: |
98 | mlog_exit(ret); | ||
99 | return ret; | 99 | return ret; |
100 | } | 100 | } |
101 | 101 | ||
@@ -106,10 +106,10 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block, | |||
106 | unsigned int i; | 106 | unsigned int i; |
107 | struct buffer_head *bh; | 107 | struct buffer_head *bh; |
108 | 108 | ||
109 | if (!nr) { | 109 | trace_ocfs2_read_blocks_sync((unsigned long long)block, nr); |
110 | mlog(ML_BH_IO, "No buffers will be read!\n"); | 110 | |
111 | if (!nr) | ||
111 | goto bail; | 112 | goto bail; |
112 | } | ||
113 | 113 | ||
114 | for (i = 0 ; i < nr ; i++) { | 114 | for (i = 0 ; i < nr ; i++) { |
115 | if (bhs[i] == NULL) { | 115 | if (bhs[i] == NULL) { |
@@ -123,10 +123,8 @@ int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block, | |||
123 | bh = bhs[i]; | 123 | bh = bhs[i]; |
124 | 124 | ||
125 | if (buffer_jbd(bh)) { | 125 | if (buffer_jbd(bh)) { |
126 | mlog(ML_BH_IO, | 126 | trace_ocfs2_read_blocks_sync_jbd( |
127 | "trying to sync read a jbd " | 127 | (unsigned long long)bh->b_blocknr); |
128 | "managed bh (blocknr = %llu), skipping\n", | ||
129 | (unsigned long long)bh->b_blocknr); | ||
130 | continue; | 128 | continue; |
131 | } | 129 | } |
132 | 130 | ||
@@ -186,8 +184,7 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr, | |||
186 | struct buffer_head *bh; | 184 | struct buffer_head *bh; |
187 | struct super_block *sb = ocfs2_metadata_cache_get_super(ci); | 185 | struct super_block *sb = ocfs2_metadata_cache_get_super(ci); |
188 | 186 | ||
189 | mlog_entry("(ci=%p, block=(%llu), nr=(%d), flags=%d)\n", | 187 | trace_ocfs2_read_blocks_begin(ci, (unsigned long long)block, nr, flags); |
190 | ci, (unsigned long long)block, nr, flags); | ||
191 | 188 | ||
192 | BUG_ON(!ci); | 189 | BUG_ON(!ci); |
193 | BUG_ON((flags & OCFS2_BH_READAHEAD) && | 190 | BUG_ON((flags & OCFS2_BH_READAHEAD) && |
@@ -207,7 +204,6 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr, | |||
207 | } | 204 | } |
208 | 205 | ||
209 | if (nr == 0) { | 206 | if (nr == 0) { |
210 | mlog(ML_BH_IO, "No buffers will be read!\n"); | ||
211 | status = 0; | 207 | status = 0; |
212 | goto bail; | 208 | goto bail; |
213 | } | 209 | } |
@@ -251,8 +247,7 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr, | |||
251 | */ | 247 | */ |
252 | 248 | ||
253 | if (!ignore_cache && !ocfs2_buffer_uptodate(ci, bh)) { | 249 | if (!ignore_cache && !ocfs2_buffer_uptodate(ci, bh)) { |
254 | mlog(ML_UPTODATE, | 250 | trace_ocfs2_read_blocks_from_disk( |
255 | "bh (%llu), owner %llu not uptodate\n", | ||
256 | (unsigned long long)bh->b_blocknr, | 251 | (unsigned long long)bh->b_blocknr, |
257 | (unsigned long long)ocfs2_metadata_cache_owner(ci)); | 252 | (unsigned long long)ocfs2_metadata_cache_owner(ci)); |
258 | /* We're using ignore_cache here to say | 253 | /* We're using ignore_cache here to say |
@@ -260,11 +255,10 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr, | |||
260 | ignore_cache = 1; | 255 | ignore_cache = 1; |
261 | } | 256 | } |
262 | 257 | ||
258 | trace_ocfs2_read_blocks_bh((unsigned long long)bh->b_blocknr, | ||
259 | ignore_cache, buffer_jbd(bh), buffer_dirty(bh)); | ||
260 | |||
263 | if (buffer_jbd(bh)) { | 261 | if (buffer_jbd(bh)) { |
264 | if (ignore_cache) | ||
265 | mlog(ML_BH_IO, "trying to sync read a jbd " | ||
266 | "managed bh (blocknr = %llu)\n", | ||
267 | (unsigned long long)bh->b_blocknr); | ||
268 | continue; | 262 | continue; |
269 | } | 263 | } |
270 | 264 | ||
@@ -272,9 +266,6 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr, | |||
272 | if (buffer_dirty(bh)) { | 266 | if (buffer_dirty(bh)) { |
273 | /* This should probably be a BUG, or | 267 | /* This should probably be a BUG, or |
274 | * at least return an error. */ | 268 | * at least return an error. */ |
275 | mlog(ML_BH_IO, "asking me to sync read a dirty " | ||
276 | "buffer! (blocknr = %llu)\n", | ||
277 | (unsigned long long)bh->b_blocknr); | ||
278 | continue; | 269 | continue; |
279 | } | 270 | } |
280 | 271 | ||
@@ -367,14 +358,11 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr, | |||
367 | } | 358 | } |
368 | ocfs2_metadata_cache_io_unlock(ci); | 359 | ocfs2_metadata_cache_io_unlock(ci); |
369 | 360 | ||
370 | mlog(ML_BH_IO, "block=(%llu), nr=(%d), cached=%s, flags=0x%x\n", | 361 | trace_ocfs2_read_blocks_end((unsigned long long)block, nr, |
371 | (unsigned long long)block, nr, | 362 | flags, ignore_cache); |
372 | ((flags & OCFS2_BH_IGNORE_CACHE) || ignore_cache) ? "no" : "yes", | ||
373 | flags); | ||
374 | 363 | ||
375 | bail: | 364 | bail: |
376 | 365 | ||
377 | mlog_exit(status); | ||
378 | return status; | 366 | return status; |
379 | } | 367 | } |
380 | 368 | ||
@@ -408,13 +396,12 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb, | |||
408 | int ret = 0; | 396 | int ret = 0; |
409 | struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data; | 397 | struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data; |
410 | 398 | ||
411 | mlog_entry_void(); | ||
412 | |||
413 | BUG_ON(buffer_jbd(bh)); | 399 | BUG_ON(buffer_jbd(bh)); |
414 | ocfs2_check_super_or_backup(osb->sb, bh->b_blocknr); | 400 | ocfs2_check_super_or_backup(osb->sb, bh->b_blocknr); |
415 | 401 | ||
416 | if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) { | 402 | if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) { |
417 | ret = -EROFS; | 403 | ret = -EROFS; |
404 | mlog_errno(ret); | ||
418 | goto out; | 405 | goto out; |
419 | } | 406 | } |
420 | 407 | ||
@@ -434,9 +421,9 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb, | |||
434 | if (!buffer_uptodate(bh)) { | 421 | if (!buffer_uptodate(bh)) { |
435 | ret = -EIO; | 422 | ret = -EIO; |
436 | put_bh(bh); | 423 | put_bh(bh); |
424 | mlog_errno(ret); | ||
437 | } | 425 | } |
438 | 426 | ||
439 | out: | 427 | out: |
440 | mlog_exit(ret); | ||
441 | return ret; | 428 | return ret; |
442 | } | 429 | } |
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index b108e863d8f6..fc9e96a03a6b 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c | |||
@@ -1658,8 +1658,6 @@ static int o2hb_populate_slot_data(struct o2hb_region *reg) | |||
1658 | struct o2hb_disk_slot *slot; | 1658 | struct o2hb_disk_slot *slot; |
1659 | struct o2hb_disk_heartbeat_block *hb_block; | 1659 | struct o2hb_disk_heartbeat_block *hb_block; |
1660 | 1660 | ||
1661 | mlog_entry_void(); | ||
1662 | |||
1663 | ret = o2hb_read_slots(reg, reg->hr_blocks); | 1661 | ret = o2hb_read_slots(reg, reg->hr_blocks); |
1664 | if (ret) { | 1662 | if (ret) { |
1665 | mlog_errno(ret); | 1663 | mlog_errno(ret); |
@@ -1681,7 +1679,6 @@ static int o2hb_populate_slot_data(struct o2hb_region *reg) | |||
1681 | } | 1679 | } |
1682 | 1680 | ||
1683 | out: | 1681 | out: |
1684 | mlog_exit(ret); | ||
1685 | return ret; | 1682 | return ret; |
1686 | } | 1683 | } |
1687 | 1684 | ||
diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c index 6c61771469af..07ac24fd9252 100644 --- a/fs/ocfs2/cluster/masklog.c +++ b/fs/ocfs2/cluster/masklog.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | struct mlog_bits mlog_and_bits = MLOG_BITS_RHS(MLOG_INITIAL_AND_MASK); | 31 | struct mlog_bits mlog_and_bits = MLOG_BITS_RHS(MLOG_INITIAL_AND_MASK); |
32 | EXPORT_SYMBOL_GPL(mlog_and_bits); | 32 | EXPORT_SYMBOL_GPL(mlog_and_bits); |
33 | struct mlog_bits mlog_not_bits = MLOG_BITS_RHS(MLOG_INITIAL_NOT_MASK); | 33 | struct mlog_bits mlog_not_bits = MLOG_BITS_RHS(0); |
34 | EXPORT_SYMBOL_GPL(mlog_not_bits); | 34 | EXPORT_SYMBOL_GPL(mlog_not_bits); |
35 | 35 | ||
36 | static ssize_t mlog_mask_show(u64 mask, char *buf) | 36 | static ssize_t mlog_mask_show(u64 mask, char *buf) |
@@ -80,8 +80,6 @@ struct mlog_attribute { | |||
80 | } | 80 | } |
81 | 81 | ||
82 | static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = { | 82 | static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = { |
83 | define_mask(ENTRY), | ||
84 | define_mask(EXIT), | ||
85 | define_mask(TCP), | 83 | define_mask(TCP), |
86 | define_mask(MSG), | 84 | define_mask(MSG), |
87 | define_mask(SOCKET), | 85 | define_mask(SOCKET), |
@@ -93,27 +91,11 @@ static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = { | |||
93 | define_mask(DLM_THREAD), | 91 | define_mask(DLM_THREAD), |
94 | define_mask(DLM_MASTER), | 92 | define_mask(DLM_MASTER), |
95 | define_mask(DLM_RECOVERY), | 93 | define_mask(DLM_RECOVERY), |
96 | define_mask(AIO), | ||
97 | define_mask(JOURNAL), | ||
98 | define_mask(DISK_ALLOC), | ||
99 | define_mask(SUPER), | ||
100 | define_mask(FILE_IO), | ||
101 | define_mask(EXTENT_MAP), | ||
102 | define_mask(DLM_GLUE), | 94 | define_mask(DLM_GLUE), |
103 | define_mask(BH_IO), | ||
104 | define_mask(UPTODATE), | ||
105 | define_mask(NAMEI), | ||
106 | define_mask(INODE), | ||
107 | define_mask(VOTE), | 95 | define_mask(VOTE), |
108 | define_mask(DCACHE), | ||
109 | define_mask(CONN), | 96 | define_mask(CONN), |
110 | define_mask(QUORUM), | 97 | define_mask(QUORUM), |
111 | define_mask(EXPORT), | ||
112 | define_mask(XATTR), | ||
113 | define_mask(QUOTA), | ||
114 | define_mask(REFCOUNT), | ||
115 | define_mask(BASTS), | 98 | define_mask(BASTS), |
116 | define_mask(RESERVATIONS), | ||
117 | define_mask(CLUSTER), | 99 | define_mask(CLUSTER), |
118 | define_mask(ERROR), | 100 | define_mask(ERROR), |
119 | define_mask(NOTICE), | 101 | define_mask(NOTICE), |
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h index 34d6544357d9..baa2b9ef7eef 100644 --- a/fs/ocfs2/cluster/masklog.h +++ b/fs/ocfs2/cluster/masklog.h | |||
@@ -82,41 +82,23 @@ | |||
82 | 82 | ||
83 | /* bits that are frequently given and infrequently matched in the low word */ | 83 | /* bits that are frequently given and infrequently matched in the low word */ |
84 | /* NOTE: If you add a flag, you need to also update masklog.c! */ | 84 | /* NOTE: If you add a flag, you need to also update masklog.c! */ |
85 | #define ML_ENTRY 0x0000000000000001ULL /* func call entry */ | 85 | #define ML_TCP 0x0000000000000001ULL /* net cluster/tcp.c */ |
86 | #define ML_EXIT 0x0000000000000002ULL /* func call exit */ | 86 | #define ML_MSG 0x0000000000000002ULL /* net network messages */ |
87 | #define ML_TCP 0x0000000000000004ULL /* net cluster/tcp.c */ | 87 | #define ML_SOCKET 0x0000000000000004ULL /* net socket lifetime */ |
88 | #define ML_MSG 0x0000000000000008ULL /* net network messages */ | 88 | #define ML_HEARTBEAT 0x0000000000000008ULL /* hb all heartbeat tracking */ |
89 | #define ML_SOCKET 0x0000000000000010ULL /* net socket lifetime */ | 89 | #define ML_HB_BIO 0x0000000000000010ULL /* hb io tracing */ |
90 | #define ML_HEARTBEAT 0x0000000000000020ULL /* hb all heartbeat tracking */ | 90 | #define ML_DLMFS 0x0000000000000020ULL /* dlm user dlmfs */ |
91 | #define ML_HB_BIO 0x0000000000000040ULL /* hb io tracing */ | 91 | #define ML_DLM 0x0000000000000040ULL /* dlm general debugging */ |
92 | #define ML_DLMFS 0x0000000000000080ULL /* dlm user dlmfs */ | 92 | #define ML_DLM_DOMAIN 0x0000000000000080ULL /* dlm domain debugging */ |
93 | #define ML_DLM 0x0000000000000100ULL /* dlm general debugging */ | 93 | #define ML_DLM_THREAD 0x0000000000000100ULL /* dlm domain thread */ |
94 | #define ML_DLM_DOMAIN 0x0000000000000200ULL /* dlm domain debugging */ | 94 | #define ML_DLM_MASTER 0x0000000000000200ULL /* dlm master functions */ |
95 | #define ML_DLM_THREAD 0x0000000000000400ULL /* dlm domain thread */ | 95 | #define ML_DLM_RECOVERY 0x0000000000000400ULL /* dlm master functions */ |
96 | #define ML_DLM_MASTER 0x0000000000000800ULL /* dlm master functions */ | 96 | #define ML_DLM_GLUE 0x0000000000000800ULL /* ocfs2 dlm glue layer */ |
97 | #define ML_DLM_RECOVERY 0x0000000000001000ULL /* dlm master functions */ | 97 | #define ML_VOTE 0x0000000000001000ULL /* ocfs2 node messaging */ |
98 | #define ML_AIO 0x0000000000002000ULL /* ocfs2 aio read and write */ | 98 | #define ML_CONN 0x0000000000002000ULL /* net connection management */ |
99 | #define ML_JOURNAL 0x0000000000004000ULL /* ocfs2 journalling functions */ | 99 | #define ML_QUORUM 0x0000000000004000ULL /* net connection quorum */ |
100 | #define ML_DISK_ALLOC 0x0000000000008000ULL /* ocfs2 disk allocation */ | 100 | #define ML_BASTS 0x0000000000008000ULL /* dlmglue asts and basts */ |
101 | #define ML_SUPER 0x0000000000010000ULL /* ocfs2 mount / umount */ | 101 | #define ML_CLUSTER 0x0000000000010000ULL /* cluster stack */ |
102 | #define ML_FILE_IO 0x0000000000020000ULL /* ocfs2 file I/O */ | ||
103 | #define ML_EXTENT_MAP 0x0000000000040000ULL /* ocfs2 extent map caching */ | ||
104 | #define ML_DLM_GLUE 0x0000000000080000ULL /* ocfs2 dlm glue layer */ | ||
105 | #define ML_BH_IO 0x0000000000100000ULL /* ocfs2 buffer I/O */ | ||
106 | #define ML_UPTODATE 0x0000000000200000ULL /* ocfs2 caching sequence #'s */ | ||
107 | #define ML_NAMEI 0x0000000000400000ULL /* ocfs2 directory / namespace */ | ||
108 | #define ML_INODE 0x0000000000800000ULL /* ocfs2 inode manipulation */ | ||
109 | #define ML_VOTE 0x0000000001000000ULL /* ocfs2 node messaging */ | ||
110 | #define ML_DCACHE 0x0000000002000000ULL /* ocfs2 dcache operations */ | ||
111 | #define ML_CONN 0x0000000004000000ULL /* net connection management */ | ||
112 | #define ML_QUORUM 0x0000000008000000ULL /* net connection quorum */ | ||
113 | #define ML_EXPORT 0x0000000010000000ULL /* ocfs2 export operations */ | ||
114 | #define ML_XATTR 0x0000000020000000ULL /* ocfs2 extended attributes */ | ||
115 | #define ML_QUOTA 0x0000000040000000ULL /* ocfs2 quota operations */ | ||
116 | #define ML_REFCOUNT 0x0000000080000000ULL /* refcount tree operations */ | ||
117 | #define ML_BASTS 0x0000000100000000ULL /* dlmglue asts and basts */ | ||
118 | #define ML_RESERVATIONS 0x0000000200000000ULL /* ocfs2 alloc reservations */ | ||
119 | #define ML_CLUSTER 0x0000000400000000ULL /* cluster stack */ | ||
120 | 102 | ||
121 | /* bits that are infrequently given and frequently matched in the high word */ | 103 | /* bits that are infrequently given and frequently matched in the high word */ |
122 | #define ML_ERROR 0x1000000000000000ULL /* sent to KERN_ERR */ | 104 | #define ML_ERROR 0x1000000000000000ULL /* sent to KERN_ERR */ |
@@ -124,7 +106,6 @@ | |||
124 | #define ML_KTHREAD 0x4000000000000000ULL /* kernel thread activity */ | 106 | #define ML_KTHREAD 0x4000000000000000ULL /* kernel thread activity */ |
125 | 107 | ||
126 | #define MLOG_INITIAL_AND_MASK (ML_ERROR|ML_NOTICE) | 108 | #define MLOG_INITIAL_AND_MASK (ML_ERROR|ML_NOTICE) |
127 | #define MLOG_INITIAL_NOT_MASK (ML_ENTRY|ML_EXIT) | ||
128 | #ifndef MLOG_MASK_PREFIX | 109 | #ifndef MLOG_MASK_PREFIX |
129 | #define MLOG_MASK_PREFIX 0 | 110 | #define MLOG_MASK_PREFIX 0 |
130 | #endif | 111 | #endif |
@@ -222,58 +203,6 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits; | |||
222 | mlog(ML_ERROR, "status = %lld\n", (long long)_st); \ | 203 | mlog(ML_ERROR, "status = %lld\n", (long long)_st); \ |
223 | } while (0) | 204 | } while (0) |
224 | 205 | ||
225 | #if defined(CONFIG_OCFS2_DEBUG_MASKLOG) | ||
226 | #define mlog_entry(fmt, args...) do { \ | ||
227 | mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \ | ||
228 | } while (0) | ||
229 | |||
230 | #define mlog_entry_void() do { \ | ||
231 | mlog(ML_ENTRY, "ENTRY:\n"); \ | ||
232 | } while (0) | ||
233 | |||
234 | /* | ||
235 | * We disable this for sparse. | ||
236 | */ | ||
237 | #if !defined(__CHECKER__) | ||
238 | #define mlog_exit(st) do { \ | ||
239 | if (__builtin_types_compatible_p(typeof(st), unsigned long)) \ | ||
240 | mlog(ML_EXIT, "EXIT: %lu\n", (unsigned long) (st)); \ | ||
241 | else if (__builtin_types_compatible_p(typeof(st), signed long)) \ | ||
242 | mlog(ML_EXIT, "EXIT: %ld\n", (signed long) (st)); \ | ||
243 | else if (__builtin_types_compatible_p(typeof(st), unsigned int) \ | ||
244 | || __builtin_types_compatible_p(typeof(st), unsigned short) \ | ||
245 | || __builtin_types_compatible_p(typeof(st), unsigned char)) \ | ||
246 | mlog(ML_EXIT, "EXIT: %u\n", (unsigned int) (st)); \ | ||
247 | else if (__builtin_types_compatible_p(typeof(st), signed int) \ | ||
248 | || __builtin_types_compatible_p(typeof(st), signed short) \ | ||
249 | || __builtin_types_compatible_p(typeof(st), signed char)) \ | ||
250 | mlog(ML_EXIT, "EXIT: %d\n", (signed int) (st)); \ | ||
251 | else if (__builtin_types_compatible_p(typeof(st), long long)) \ | ||
252 | mlog(ML_EXIT, "EXIT: %lld\n", (long long) (st)); \ | ||
253 | else \ | ||
254 | mlog(ML_EXIT, "EXIT: %llu\n", (unsigned long long) (st)); \ | ||
255 | } while (0) | ||
256 | #else | ||
257 | #define mlog_exit(st) do { \ | ||
258 | mlog(ML_EXIT, "EXIT: %lld\n", (long long) (st)); \ | ||
259 | } while (0) | ||
260 | #endif | ||
261 | |||
262 | #define mlog_exit_ptr(ptr) do { \ | ||
263 | mlog(ML_EXIT, "EXIT: %p\n", ptr); \ | ||
264 | } while (0) | ||
265 | |||
266 | #define mlog_exit_void() do { \ | ||
267 | mlog(ML_EXIT, "EXIT\n"); \ | ||
268 | } while (0) | ||
269 | #else | ||
270 | #define mlog_entry(...) do { } while (0) | ||
271 | #define mlog_entry_void(...) do { } while (0) | ||
272 | #define mlog_exit(...) do { } while (0) | ||
273 | #define mlog_exit_ptr(...) do { } while (0) | ||
274 | #define mlog_exit_void(...) do { } while (0) | ||
275 | #endif /* defined(CONFIG_OCFS2_DEBUG_MASKLOG) */ | ||
276 | |||
277 | #define mlog_bug_on_msg(cond, fmt, args...) do { \ | 206 | #define mlog_bug_on_msg(cond, fmt, args...) do { \ |
278 | if (cond) { \ | 207 | if (cond) { \ |
279 | mlog(ML_ERROR, "bug expression: " #cond "\n"); \ | 208 | mlog(ML_ERROR, "bug expression: " #cond "\n"); \ |
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c index 6d80ecc7834f..e5ba34818332 100644 --- a/fs/ocfs2/dcache.c +++ b/fs/ocfs2/dcache.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/namei.h> | 29 | #include <linux/namei.h> |
30 | 30 | ||
31 | #define MLOG_MASK_PREFIX ML_DCACHE | ||
32 | #include <cluster/masklog.h> | 31 | #include <cluster/masklog.h> |
33 | 32 | ||
34 | #include "ocfs2.h" | 33 | #include "ocfs2.h" |
@@ -39,6 +38,7 @@ | |||
39 | #include "file.h" | 38 | #include "file.h" |
40 | #include "inode.h" | 39 | #include "inode.h" |
41 | #include "super.h" | 40 | #include "super.h" |
41 | #include "ocfs2_trace.h" | ||
42 | 42 | ||
43 | void ocfs2_dentry_attach_gen(struct dentry *dentry) | 43 | void ocfs2_dentry_attach_gen(struct dentry *dentry) |
44 | { | 44 | { |
@@ -56,14 +56,14 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry, | |||
56 | int ret = 0; /* if all else fails, just return false */ | 56 | int ret = 0; /* if all else fails, just return false */ |
57 | struct ocfs2_super *osb; | 57 | struct ocfs2_super *osb; |
58 | 58 | ||
59 | if (nd->flags & LOOKUP_RCU) | 59 | if (nd && nd->flags & LOOKUP_RCU) |
60 | return -ECHILD; | 60 | return -ECHILD; |
61 | 61 | ||
62 | inode = dentry->d_inode; | 62 | inode = dentry->d_inode; |
63 | osb = OCFS2_SB(dentry->d_sb); | 63 | osb = OCFS2_SB(dentry->d_sb); |
64 | 64 | ||
65 | mlog_entry("(0x%p, '%.*s')\n", dentry, | 65 | trace_ocfs2_dentry_revalidate(dentry, dentry->d_name.len, |
66 | dentry->d_name.len, dentry->d_name.name); | 66 | dentry->d_name.name); |
67 | 67 | ||
68 | /* For a negative dentry - | 68 | /* For a negative dentry - |
69 | * check the generation number of the parent and compare with the | 69 | * check the generation number of the parent and compare with the |
@@ -73,9 +73,10 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry, | |||
73 | unsigned long gen = (unsigned long) dentry->d_fsdata; | 73 | unsigned long gen = (unsigned long) dentry->d_fsdata; |
74 | unsigned long pgen = | 74 | unsigned long pgen = |
75 | OCFS2_I(dentry->d_parent->d_inode)->ip_dir_lock_gen; | 75 | OCFS2_I(dentry->d_parent->d_inode)->ip_dir_lock_gen; |
76 | mlog(0, "negative dentry: %.*s parent gen: %lu " | 76 | |
77 | "dentry gen: %lu\n", | 77 | trace_ocfs2_dentry_revalidate_negative(dentry->d_name.len, |
78 | dentry->d_name.len, dentry->d_name.name, pgen, gen); | 78 | dentry->d_name.name, |
79 | pgen, gen); | ||
79 | if (gen != pgen) | 80 | if (gen != pgen) |
80 | goto bail; | 81 | goto bail; |
81 | goto valid; | 82 | goto valid; |
@@ -90,8 +91,8 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry, | |||
90 | /* did we or someone else delete this inode? */ | 91 | /* did we or someone else delete this inode? */ |
91 | if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_DELETED) { | 92 | if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_DELETED) { |
92 | spin_unlock(&OCFS2_I(inode)->ip_lock); | 93 | spin_unlock(&OCFS2_I(inode)->ip_lock); |
93 | mlog(0, "inode (%llu) deleted, returning false\n", | 94 | trace_ocfs2_dentry_revalidate_delete( |
94 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | 95 | (unsigned long long)OCFS2_I(inode)->ip_blkno); |
95 | goto bail; | 96 | goto bail; |
96 | } | 97 | } |
97 | spin_unlock(&OCFS2_I(inode)->ip_lock); | 98 | spin_unlock(&OCFS2_I(inode)->ip_lock); |
@@ -101,10 +102,9 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry, | |||
101 | * inode nlink hits zero, it never goes back. | 102 | * inode nlink hits zero, it never goes back. |
102 | */ | 103 | */ |
103 | if (inode->i_nlink == 0) { | 104 | if (inode->i_nlink == 0) { |
104 | mlog(0, "Inode %llu orphaned, returning false " | 105 | trace_ocfs2_dentry_revalidate_orphaned( |
105 | "dir = %d\n", | 106 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
106 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 107 | S_ISDIR(inode->i_mode)); |
107 | S_ISDIR(inode->i_mode)); | ||
108 | goto bail; | 108 | goto bail; |
109 | } | 109 | } |
110 | 110 | ||
@@ -113,9 +113,8 @@ static int ocfs2_dentry_revalidate(struct dentry *dentry, | |||
113 | * redo it. | 113 | * redo it. |
114 | */ | 114 | */ |
115 | if (!dentry->d_fsdata) { | 115 | if (!dentry->d_fsdata) { |
116 | mlog(0, "Inode %llu doesn't have dentry lock, " | 116 | trace_ocfs2_dentry_revalidate_nofsdata( |
117 | "returning false\n", | 117 | (unsigned long long)OCFS2_I(inode)->ip_blkno); |
118 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | ||
119 | goto bail; | 118 | goto bail; |
120 | } | 119 | } |
121 | 120 | ||
@@ -123,8 +122,7 @@ valid: | |||
123 | ret = 1; | 122 | ret = 1; |
124 | 123 | ||
125 | bail: | 124 | bail: |
126 | mlog_exit(ret); | 125 | trace_ocfs2_dentry_revalidate_ret(ret); |
127 | |||
128 | return ret; | 126 | return ret; |
129 | } | 127 | } |
130 | 128 | ||
@@ -181,8 +179,8 @@ struct dentry *ocfs2_find_local_alias(struct inode *inode, | |||
181 | 179 | ||
182 | spin_lock(&dentry->d_lock); | 180 | spin_lock(&dentry->d_lock); |
183 | if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) { | 181 | if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) { |
184 | mlog(0, "dentry found: %.*s\n", | 182 | trace_ocfs2_find_local_alias(dentry->d_name.len, |
185 | dentry->d_name.len, dentry->d_name.name); | 183 | dentry->d_name.name); |
186 | 184 | ||
187 | dget_dlock(dentry); | 185 | dget_dlock(dentry); |
188 | spin_unlock(&dentry->d_lock); | 186 | spin_unlock(&dentry->d_lock); |
@@ -240,9 +238,8 @@ int ocfs2_dentry_attach_lock(struct dentry *dentry, | |||
240 | struct dentry *alias; | 238 | struct dentry *alias; |
241 | struct ocfs2_dentry_lock *dl = dentry->d_fsdata; | 239 | struct ocfs2_dentry_lock *dl = dentry->d_fsdata; |
242 | 240 | ||
243 | mlog(0, "Attach \"%.*s\", parent %llu, fsdata: %p\n", | 241 | trace_ocfs2_dentry_attach_lock(dentry->d_name.len, dentry->d_name.name, |
244 | dentry->d_name.len, dentry->d_name.name, | 242 | (unsigned long long)parent_blkno, dl); |
245 | (unsigned long long)parent_blkno, dl); | ||
246 | 243 | ||
247 | /* | 244 | /* |
248 | * Negative dentry. We ignore these for now. | 245 | * Negative dentry. We ignore these for now. |
@@ -292,7 +289,9 @@ int ocfs2_dentry_attach_lock(struct dentry *dentry, | |||
292 | (unsigned long long)parent_blkno, | 289 | (unsigned long long)parent_blkno, |
293 | (unsigned long long)dl->dl_parent_blkno); | 290 | (unsigned long long)dl->dl_parent_blkno); |
294 | 291 | ||
295 | mlog(0, "Found: %s\n", dl->dl_lockres.l_name); | 292 | trace_ocfs2_dentry_attach_lock_found(dl->dl_lockres.l_name, |
293 | (unsigned long long)parent_blkno, | ||
294 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | ||
296 | 295 | ||
297 | goto out_attach; | 296 | goto out_attach; |
298 | } | 297 | } |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 41b356fefaa5..b0c17490bbbc 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <linux/quotaops.h> | 43 | #include <linux/quotaops.h> |
44 | #include <linux/sort.h> | 44 | #include <linux/sort.h> |
45 | 45 | ||
46 | #define MLOG_MASK_PREFIX ML_NAMEI | ||
47 | #include <cluster/masklog.h> | 46 | #include <cluster/masklog.h> |
48 | 47 | ||
49 | #include "ocfs2.h" | 48 | #include "ocfs2.h" |
@@ -61,6 +60,7 @@ | |||
61 | #include "super.h" | 60 | #include "super.h" |
62 | #include "sysfile.h" | 61 | #include "sysfile.h" |
63 | #include "uptodate.h" | 62 | #include "uptodate.h" |
63 | #include "ocfs2_trace.h" | ||
64 | 64 | ||
65 | #include "buffer_head_io.h" | 65 | #include "buffer_head_io.h" |
66 | 66 | ||
@@ -369,8 +369,6 @@ static int inline ocfs2_search_dirblock(struct buffer_head *bh, | |||
369 | int de_len; | 369 | int de_len; |
370 | int ret = 0; | 370 | int ret = 0; |
371 | 371 | ||
372 | mlog_entry_void(); | ||
373 | |||
374 | de_buf = first_de; | 372 | de_buf = first_de; |
375 | dlimit = de_buf + bytes; | 373 | dlimit = de_buf + bytes; |
376 | 374 | ||
@@ -404,7 +402,7 @@ static int inline ocfs2_search_dirblock(struct buffer_head *bh, | |||
404 | } | 402 | } |
405 | 403 | ||
406 | bail: | 404 | bail: |
407 | mlog_exit(ret); | 405 | trace_ocfs2_search_dirblock(ret); |
408 | return ret; | 406 | return ret; |
409 | } | 407 | } |
410 | 408 | ||
@@ -449,8 +447,7 @@ static int ocfs2_validate_dir_block(struct super_block *sb, | |||
449 | * We don't validate dirents here, that's handled | 447 | * We don't validate dirents here, that's handled |
450 | * in-place when the code walks them. | 448 | * in-place when the code walks them. |
451 | */ | 449 | */ |
452 | mlog(0, "Validating dirblock %llu\n", | 450 | trace_ocfs2_validate_dir_block((unsigned long long)bh->b_blocknr); |
453 | (unsigned long long)bh->b_blocknr); | ||
454 | 451 | ||
455 | BUG_ON(!buffer_uptodate(bh)); | 452 | BUG_ON(!buffer_uptodate(bh)); |
456 | 453 | ||
@@ -708,8 +705,6 @@ static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen, | |||
708 | int num = 0; | 705 | int num = 0; |
709 | int nblocks, i, err; | 706 | int nblocks, i, err; |
710 | 707 | ||
711 | mlog_entry_void(); | ||
712 | |||
713 | sb = dir->i_sb; | 708 | sb = dir->i_sb; |
714 | 709 | ||
715 | nblocks = i_size_read(dir) >> sb->s_blocksize_bits; | 710 | nblocks = i_size_read(dir) >> sb->s_blocksize_bits; |
@@ -790,7 +785,7 @@ cleanup_and_exit: | |||
790 | for (; ra_ptr < ra_max; ra_ptr++) | 785 | for (; ra_ptr < ra_max; ra_ptr++) |
791 | brelse(bh_use[ra_ptr]); | 786 | brelse(bh_use[ra_ptr]); |
792 | 787 | ||
793 | mlog_exit_ptr(ret); | 788 | trace_ocfs2_find_entry_el(ret); |
794 | return ret; | 789 | return ret; |
795 | } | 790 | } |
796 | 791 | ||
@@ -952,11 +947,9 @@ static int ocfs2_dx_dir_search(const char *name, int namelen, | |||
952 | goto out; | 947 | goto out; |
953 | } | 948 | } |
954 | 949 | ||
955 | mlog(0, "Dir %llu: name: \"%.*s\", lookup of hash: %u.0x%x " | 950 | trace_ocfs2_dx_dir_search((unsigned long long)OCFS2_I(dir)->ip_blkno, |
956 | "returns: %llu\n", | 951 | namelen, name, hinfo->major_hash, |
957 | (unsigned long long)OCFS2_I(dir)->ip_blkno, | 952 | hinfo->minor_hash, (unsigned long long)phys); |
958 | namelen, name, hinfo->major_hash, hinfo->minor_hash, | ||
959 | (unsigned long long)phys); | ||
960 | 953 | ||
961 | ret = ocfs2_read_dx_leaf(dir, phys, &dx_leaf_bh); | 954 | ret = ocfs2_read_dx_leaf(dir, phys, &dx_leaf_bh); |
962 | if (ret) { | 955 | if (ret) { |
@@ -966,9 +959,9 @@ static int ocfs2_dx_dir_search(const char *name, int namelen, | |||
966 | 959 | ||
967 | dx_leaf = (struct ocfs2_dx_leaf *) dx_leaf_bh->b_data; | 960 | dx_leaf = (struct ocfs2_dx_leaf *) dx_leaf_bh->b_data; |
968 | 961 | ||
969 | mlog(0, "leaf info: num_used: %d, count: %d\n", | 962 | trace_ocfs2_dx_dir_search_leaf_info( |
970 | le16_to_cpu(dx_leaf->dl_list.de_num_used), | 963 | le16_to_cpu(dx_leaf->dl_list.de_num_used), |
971 | le16_to_cpu(dx_leaf->dl_list.de_count)); | 964 | le16_to_cpu(dx_leaf->dl_list.de_count)); |
972 | 965 | ||
973 | entry_list = &dx_leaf->dl_list; | 966 | entry_list = &dx_leaf->dl_list; |
974 | 967 | ||
@@ -1168,8 +1161,6 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir, | |||
1168 | int i, status = -ENOENT; | 1161 | int i, status = -ENOENT; |
1169 | ocfs2_journal_access_func access = ocfs2_journal_access_db; | 1162 | ocfs2_journal_access_func access = ocfs2_journal_access_db; |
1170 | 1163 | ||
1171 | mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p)\n", handle, dir, de_del, bh); | ||
1172 | |||
1173 | if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) | 1164 | if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) |
1174 | access = ocfs2_journal_access_di; | 1165 | access = ocfs2_journal_access_di; |
1175 | 1166 | ||
@@ -1204,7 +1195,6 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir, | |||
1204 | de = (struct ocfs2_dir_entry *)((char *)de + le16_to_cpu(de->rec_len)); | 1195 | de = (struct ocfs2_dir_entry *)((char *)de + le16_to_cpu(de->rec_len)); |
1205 | } | 1196 | } |
1206 | bail: | 1197 | bail: |
1207 | mlog_exit(status); | ||
1208 | return status; | 1198 | return status; |
1209 | } | 1199 | } |
1210 | 1200 | ||
@@ -1350,8 +1340,8 @@ static int ocfs2_delete_entry_dx(handle_t *handle, struct inode *dir, | |||
1350 | } | 1340 | } |
1351 | } | 1341 | } |
1352 | 1342 | ||
1353 | mlog(0, "Dir %llu: delete entry at index: %d\n", | 1343 | trace_ocfs2_delete_entry_dx((unsigned long long)OCFS2_I(dir)->ip_blkno, |
1354 | (unsigned long long)OCFS2_I(dir)->ip_blkno, index); | 1344 | index); |
1355 | 1345 | ||
1356 | ret = __ocfs2_delete_entry(handle, dir, lookup->dl_entry, | 1346 | ret = __ocfs2_delete_entry(handle, dir, lookup->dl_entry, |
1357 | leaf_bh, leaf_bh->b_data, leaf_bh->b_size); | 1347 | leaf_bh, leaf_bh->b_data, leaf_bh->b_size); |
@@ -1634,8 +1624,6 @@ int __ocfs2_add_entry(handle_t *handle, | |||
1634 | struct buffer_head *insert_bh = lookup->dl_leaf_bh; | 1624 | struct buffer_head *insert_bh = lookup->dl_leaf_bh; |
1635 | char *data_start = insert_bh->b_data; | 1625 | char *data_start = insert_bh->b_data; |
1636 | 1626 | ||
1637 | mlog_entry_void(); | ||
1638 | |||
1639 | if (!namelen) | 1627 | if (!namelen) |
1640 | return -EINVAL; | 1628 | return -EINVAL; |
1641 | 1629 | ||
@@ -1767,8 +1755,9 @@ int __ocfs2_add_entry(handle_t *handle, | |||
1767 | * from ever getting here. */ | 1755 | * from ever getting here. */ |
1768 | retval = -ENOSPC; | 1756 | retval = -ENOSPC; |
1769 | bail: | 1757 | bail: |
1758 | if (retval) | ||
1759 | mlog_errno(retval); | ||
1770 | 1760 | ||
1771 | mlog_exit(retval); | ||
1772 | return retval; | 1761 | return retval; |
1773 | } | 1762 | } |
1774 | 1763 | ||
@@ -2030,8 +2019,7 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir) | |||
2030 | struct inode *inode = filp->f_path.dentry->d_inode; | 2019 | struct inode *inode = filp->f_path.dentry->d_inode; |
2031 | int lock_level = 0; | 2020 | int lock_level = 0; |
2032 | 2021 | ||
2033 | mlog_entry("dirino=%llu\n", | 2022 | trace_ocfs2_readdir((unsigned long long)OCFS2_I(inode)->ip_blkno); |
2034 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | ||
2035 | 2023 | ||
2036 | error = ocfs2_inode_lock_atime(inode, filp->f_vfsmnt, &lock_level); | 2024 | error = ocfs2_inode_lock_atime(inode, filp->f_vfsmnt, &lock_level); |
2037 | if (lock_level && error >= 0) { | 2025 | if (lock_level && error >= 0) { |
@@ -2053,9 +2041,10 @@ int ocfs2_readdir(struct file * filp, void * dirent, filldir_t filldir) | |||
2053 | dirent, filldir, NULL); | 2041 | dirent, filldir, NULL); |
2054 | 2042 | ||
2055 | ocfs2_inode_unlock(inode, lock_level); | 2043 | ocfs2_inode_unlock(inode, lock_level); |
2044 | if (error) | ||
2045 | mlog_errno(error); | ||
2056 | 2046 | ||
2057 | bail_nolock: | 2047 | bail_nolock: |
2058 | mlog_exit(error); | ||
2059 | 2048 | ||
2060 | return error; | 2049 | return error; |
2061 | } | 2050 | } |
@@ -2071,8 +2060,8 @@ int ocfs2_find_files_on_disk(const char *name, | |||
2071 | { | 2060 | { |
2072 | int status = -ENOENT; | 2061 | int status = -ENOENT; |
2073 | 2062 | ||
2074 | mlog(0, "name=%.*s, blkno=%p, inode=%llu\n", namelen, name, blkno, | 2063 | trace_ocfs2_find_files_on_disk(namelen, name, blkno, |
2075 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | 2064 | (unsigned long long)OCFS2_I(inode)->ip_blkno); |
2076 | 2065 | ||
2077 | status = ocfs2_find_entry(name, namelen, inode, lookup); | 2066 | status = ocfs2_find_entry(name, namelen, inode, lookup); |
2078 | if (status) | 2067 | if (status) |
@@ -2116,8 +2105,8 @@ int ocfs2_check_dir_for_entry(struct inode *dir, | |||
2116 | int ret; | 2105 | int ret; |
2117 | struct ocfs2_dir_lookup_result lookup = { NULL, }; | 2106 | struct ocfs2_dir_lookup_result lookup = { NULL, }; |
2118 | 2107 | ||
2119 | mlog_entry("dir %llu, name '%.*s'\n", | 2108 | trace_ocfs2_check_dir_for_entry( |
2120 | (unsigned long long)OCFS2_I(dir)->ip_blkno, namelen, name); | 2109 | (unsigned long long)OCFS2_I(dir)->ip_blkno, namelen, name); |
2121 | 2110 | ||
2122 | ret = -EEXIST; | 2111 | ret = -EEXIST; |
2123 | if (ocfs2_find_entry(name, namelen, dir, &lookup) == 0) | 2112 | if (ocfs2_find_entry(name, namelen, dir, &lookup) == 0) |
@@ -2127,7 +2116,8 @@ int ocfs2_check_dir_for_entry(struct inode *dir, | |||
2127 | bail: | 2116 | bail: |
2128 | ocfs2_free_dir_lookup_result(&lookup); | 2117 | ocfs2_free_dir_lookup_result(&lookup); |
2129 | 2118 | ||
2130 | mlog_exit(ret); | 2119 | if (ret) |
2120 | mlog_errno(ret); | ||
2131 | return ret; | 2121 | return ret; |
2132 | } | 2122 | } |
2133 | 2123 | ||
@@ -2326,8 +2316,6 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb, | |||
2326 | struct buffer_head *new_bh = NULL; | 2316 | struct buffer_head *new_bh = NULL; |
2327 | struct ocfs2_dir_entry *de; | 2317 | struct ocfs2_dir_entry *de; |
2328 | 2318 | ||
2329 | mlog_entry_void(); | ||
2330 | |||
2331 | if (ocfs2_new_dir_wants_trailer(inode)) | 2319 | if (ocfs2_new_dir_wants_trailer(inode)) |
2332 | size = ocfs2_dir_trailer_blk_off(parent->i_sb); | 2320 | size = ocfs2_dir_trailer_blk_off(parent->i_sb); |
2333 | 2321 | ||
@@ -2382,7 +2370,6 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb, | |||
2382 | bail: | 2370 | bail: |
2383 | brelse(new_bh); | 2371 | brelse(new_bh); |
2384 | 2372 | ||
2385 | mlog_exit(status); | ||
2386 | return status; | 2373 | return status; |
2387 | } | 2374 | } |
2388 | 2375 | ||
@@ -2411,9 +2398,9 @@ static int ocfs2_dx_dir_attach_index(struct ocfs2_super *osb, | |||
2411 | goto out; | 2398 | goto out; |
2412 | } | 2399 | } |
2413 | 2400 | ||
2414 | mlog(0, "Dir %llu, attach new index block: %llu\n", | 2401 | trace_ocfs2_dx_dir_attach_index( |
2415 | (unsigned long long)OCFS2_I(dir)->ip_blkno, | 2402 | (unsigned long long)OCFS2_I(dir)->ip_blkno, |
2416 | (unsigned long long)dr_blkno); | 2403 | (unsigned long long)dr_blkno); |
2417 | 2404 | ||
2418 | dx_root_bh = sb_getblk(osb->sb, dr_blkno); | 2405 | dx_root_bh = sb_getblk(osb->sb, dr_blkno); |
2419 | if (dx_root_bh == NULL) { | 2406 | if (dx_root_bh == NULL) { |
@@ -2513,11 +2500,10 @@ static int ocfs2_dx_dir_format_cluster(struct ocfs2_super *osb, | |||
2513 | dx_leaf->dl_list.de_count = | 2500 | dx_leaf->dl_list.de_count = |
2514 | cpu_to_le16(ocfs2_dx_entries_per_leaf(osb->sb)); | 2501 | cpu_to_le16(ocfs2_dx_entries_per_leaf(osb->sb)); |
2515 | 2502 | ||
2516 | mlog(0, | 2503 | trace_ocfs2_dx_dir_format_cluster( |
2517 | "Dir %llu, format dx_leaf: %llu, entry count: %u\n", | 2504 | (unsigned long long)OCFS2_I(dir)->ip_blkno, |
2518 | (unsigned long long)OCFS2_I(dir)->ip_blkno, | 2505 | (unsigned long long)bh->b_blocknr, |
2519 | (unsigned long long)bh->b_blocknr, | 2506 | le16_to_cpu(dx_leaf->dl_list.de_count)); |
2520 | le16_to_cpu(dx_leaf->dl_list.de_count)); | ||
2521 | 2507 | ||
2522 | ocfs2_journal_dirty(handle, bh); | 2508 | ocfs2_journal_dirty(handle, bh); |
2523 | } | 2509 | } |
@@ -2761,12 +2747,11 @@ static void ocfs2_dx_dir_index_root_block(struct inode *dir, | |||
2761 | 2747 | ||
2762 | ocfs2_dx_dir_name_hash(dir, de->name, de->name_len, &hinfo); | 2748 | ocfs2_dx_dir_name_hash(dir, de->name, de->name_len, &hinfo); |
2763 | 2749 | ||
2764 | mlog(0, | 2750 | trace_ocfs2_dx_dir_index_root_block( |
2765 | "dir: %llu, major: 0x%x minor: 0x%x, index: %u, name: %.*s\n", | 2751 | (unsigned long long)dir->i_ino, |
2766 | (unsigned long long)dir->i_ino, hinfo.major_hash, | 2752 | hinfo.major_hash, hinfo.minor_hash, |
2767 | hinfo.minor_hash, | 2753 | de->name_len, de->name, |
2768 | le16_to_cpu(dx_root->dr_entries.de_num_used), | 2754 | le16_to_cpu(dx_root->dr_entries.de_num_used)); |
2769 | de->name_len, de->name); | ||
2770 | 2755 | ||
2771 | ocfs2_dx_entry_list_insert(&dx_root->dr_entries, &hinfo, | 2756 | ocfs2_dx_entry_list_insert(&dx_root->dr_entries, &hinfo, |
2772 | dirent_blk); | 2757 | dirent_blk); |
@@ -3237,7 +3222,6 @@ static int ocfs2_do_extend_dir(struct super_block *sb, | |||
3237 | bail: | 3222 | bail: |
3238 | if (did_quota && status < 0) | 3223 | if (did_quota && status < 0) |
3239 | dquot_free_space_nodirty(dir, ocfs2_clusters_to_bytes(sb, 1)); | 3224 | dquot_free_space_nodirty(dir, ocfs2_clusters_to_bytes(sb, 1)); |
3240 | mlog_exit(status); | ||
3241 | return status; | 3225 | return status; |
3242 | } | 3226 | } |
3243 | 3227 | ||
@@ -3272,8 +3256,6 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb, | |||
3272 | struct ocfs2_extent_tree et; | 3256 | struct ocfs2_extent_tree et; |
3273 | struct buffer_head *dx_root_bh = lookup->dl_dx_root_bh; | 3257 | struct buffer_head *dx_root_bh = lookup->dl_dx_root_bh; |
3274 | 3258 | ||
3275 | mlog_entry_void(); | ||
3276 | |||
3277 | if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { | 3259 | if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { |
3278 | /* | 3260 | /* |
3279 | * This would be a code error as an inline directory should | 3261 | * This would be a code error as an inline directory should |
@@ -3322,8 +3304,8 @@ static int ocfs2_extend_dir(struct ocfs2_super *osb, | |||
3322 | down_write(&OCFS2_I(dir)->ip_alloc_sem); | 3304 | down_write(&OCFS2_I(dir)->ip_alloc_sem); |
3323 | drop_alloc_sem = 1; | 3305 | drop_alloc_sem = 1; |
3324 | dir_i_size = i_size_read(dir); | 3306 | dir_i_size = i_size_read(dir); |
3325 | mlog(0, "extending dir %llu (i_size = %lld)\n", | 3307 | trace_ocfs2_extend_dir((unsigned long long)OCFS2_I(dir)->ip_blkno, |
3326 | (unsigned long long)OCFS2_I(dir)->ip_blkno, dir_i_size); | 3308 | dir_i_size); |
3327 | 3309 | ||
3328 | /* dir->i_size is always block aligned. */ | 3310 | /* dir->i_size is always block aligned. */ |
3329 | spin_lock(&OCFS2_I(dir)->ip_lock); | 3311 | spin_lock(&OCFS2_I(dir)->ip_lock); |
@@ -3438,7 +3420,6 @@ bail: | |||
3438 | 3420 | ||
3439 | brelse(new_bh); | 3421 | brelse(new_bh); |
3440 | 3422 | ||
3441 | mlog_exit(status); | ||
3442 | return status; | 3423 | return status; |
3443 | } | 3424 | } |
3444 | 3425 | ||
@@ -3585,8 +3566,9 @@ next: | |||
3585 | status = 0; | 3566 | status = 0; |
3586 | bail: | 3567 | bail: |
3587 | brelse(bh); | 3568 | brelse(bh); |
3569 | if (status) | ||
3570 | mlog_errno(status); | ||
3588 | 3571 | ||
3589 | mlog_exit(status); | ||
3590 | return status; | 3572 | return status; |
3591 | } | 3573 | } |
3592 | 3574 | ||
@@ -3817,9 +3799,9 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir, | |||
3817 | struct ocfs2_dx_root_block *dx_root; | 3799 | struct ocfs2_dx_root_block *dx_root; |
3818 | struct ocfs2_dx_leaf *tmp_dx_leaf = NULL; | 3800 | struct ocfs2_dx_leaf *tmp_dx_leaf = NULL; |
3819 | 3801 | ||
3820 | mlog(0, "DX Dir: %llu, rebalance leaf leaf_blkno: %llu insert: %u\n", | 3802 | trace_ocfs2_dx_dir_rebalance((unsigned long long)OCFS2_I(dir)->ip_blkno, |
3821 | (unsigned long long)OCFS2_I(dir)->ip_blkno, | 3803 | (unsigned long long)leaf_blkno, |
3822 | (unsigned long long)leaf_blkno, insert_hash); | 3804 | insert_hash); |
3823 | 3805 | ||
3824 | ocfs2_init_dx_root_extent_tree(&et, INODE_CACHE(dir), dx_root_bh); | 3806 | ocfs2_init_dx_root_extent_tree(&et, INODE_CACHE(dir), dx_root_bh); |
3825 | 3807 | ||
@@ -3899,8 +3881,7 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir, | |||
3899 | goto out_commit; | 3881 | goto out_commit; |
3900 | } | 3882 | } |
3901 | 3883 | ||
3902 | mlog(0, "Split leaf (%u) at %u, insert major hash is %u\n", | 3884 | trace_ocfs2_dx_dir_rebalance_split(leaf_cpos, split_hash, insert_hash); |
3903 | leaf_cpos, split_hash, insert_hash); | ||
3904 | 3885 | ||
3905 | /* | 3886 | /* |
3906 | * We have to carefully order operations here. There are items | 3887 | * We have to carefully order operations here. There are items |
@@ -4357,8 +4338,8 @@ int ocfs2_prepare_dir_for_insert(struct ocfs2_super *osb, | |||
4357 | unsigned int blocks_wanted = 1; | 4338 | unsigned int blocks_wanted = 1; |
4358 | struct buffer_head *bh = NULL; | 4339 | struct buffer_head *bh = NULL; |
4359 | 4340 | ||
4360 | mlog(0, "getting ready to insert namelen %d into dir %llu\n", | 4341 | trace_ocfs2_prepare_dir_for_insert( |
4361 | namelen, (unsigned long long)OCFS2_I(dir)->ip_blkno); | 4342 | (unsigned long long)OCFS2_I(dir)->ip_blkno, namelen); |
4362 | 4343 | ||
4363 | if (!namelen) { | 4344 | if (!namelen) { |
4364 | ret = -EINVAL; | 4345 | ret = -EINVAL; |
diff --git a/fs/ocfs2/dlm/dlmconvert.c b/fs/ocfs2/dlm/dlmconvert.c index 9f30491e5e88..29a886d1e82c 100644 --- a/fs/ocfs2/dlm/dlmconvert.c +++ b/fs/ocfs2/dlm/dlmconvert.c | |||
@@ -128,8 +128,8 @@ static enum dlm_status __dlmconvert_master(struct dlm_ctxt *dlm, | |||
128 | 128 | ||
129 | assert_spin_locked(&res->spinlock); | 129 | assert_spin_locked(&res->spinlock); |
130 | 130 | ||
131 | mlog_entry("type=%d, convert_type=%d, new convert_type=%d\n", | 131 | mlog(0, "type=%d, convert_type=%d, new convert_type=%d\n", |
132 | lock->ml.type, lock->ml.convert_type, type); | 132 | lock->ml.type, lock->ml.convert_type, type); |
133 | 133 | ||
134 | spin_lock(&lock->spinlock); | 134 | spin_lock(&lock->spinlock); |
135 | 135 | ||
@@ -353,7 +353,7 @@ static enum dlm_status dlm_send_remote_convert_request(struct dlm_ctxt *dlm, | |||
353 | struct kvec vec[2]; | 353 | struct kvec vec[2]; |
354 | size_t veclen = 1; | 354 | size_t veclen = 1; |
355 | 355 | ||
356 | mlog_entry("%.*s\n", res->lockname.len, res->lockname.name); | 356 | mlog(0, "%.*s\n", res->lockname.len, res->lockname.name); |
357 | 357 | ||
358 | memset(&convert, 0, sizeof(struct dlm_convert_lock)); | 358 | memset(&convert, 0, sizeof(struct dlm_convert_lock)); |
359 | convert.node_idx = dlm->node_num; | 359 | convert.node_idx = dlm->node_num; |
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index 99805d578ab5..7540a492eaba 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c | |||
@@ -188,7 +188,7 @@ struct dlm_lock_resource * __dlm_lookup_lockres_full(struct dlm_ctxt *dlm, | |||
188 | struct hlist_head *bucket; | 188 | struct hlist_head *bucket; |
189 | struct hlist_node *list; | 189 | struct hlist_node *list; |
190 | 190 | ||
191 | mlog_entry("%.*s\n", len, name); | 191 | mlog(0, "%.*s\n", len, name); |
192 | 192 | ||
193 | assert_spin_locked(&dlm->spinlock); | 193 | assert_spin_locked(&dlm->spinlock); |
194 | 194 | ||
@@ -222,7 +222,7 @@ struct dlm_lock_resource * __dlm_lookup_lockres(struct dlm_ctxt *dlm, | |||
222 | { | 222 | { |
223 | struct dlm_lock_resource *res = NULL; | 223 | struct dlm_lock_resource *res = NULL; |
224 | 224 | ||
225 | mlog_entry("%.*s\n", len, name); | 225 | mlog(0, "%.*s\n", len, name); |
226 | 226 | ||
227 | assert_spin_locked(&dlm->spinlock); | 227 | assert_spin_locked(&dlm->spinlock); |
228 | 228 | ||
@@ -531,7 +531,7 @@ static int dlm_exit_domain_handler(struct o2net_msg *msg, u32 len, void *data, | |||
531 | unsigned int node; | 531 | unsigned int node; |
532 | struct dlm_exit_domain *exit_msg = (struct dlm_exit_domain *) msg->buf; | 532 | struct dlm_exit_domain *exit_msg = (struct dlm_exit_domain *) msg->buf; |
533 | 533 | ||
534 | mlog_entry("%p %u %p", msg, len, data); | 534 | mlog(0, "%p %u %p", msg, len, data); |
535 | 535 | ||
536 | if (!dlm_grab(dlm)) | 536 | if (!dlm_grab(dlm)) |
537 | return 0; | 537 | return 0; |
@@ -1557,7 +1557,7 @@ static int dlm_try_to_join_domain(struct dlm_ctxt *dlm) | |||
1557 | struct domain_join_ctxt *ctxt; | 1557 | struct domain_join_ctxt *ctxt; |
1558 | enum dlm_query_join_response_code response = JOIN_DISALLOW; | 1558 | enum dlm_query_join_response_code response = JOIN_DISALLOW; |
1559 | 1559 | ||
1560 | mlog_entry("%p", dlm); | 1560 | mlog(0, "%p", dlm); |
1561 | 1561 | ||
1562 | ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL); | 1562 | ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL); |
1563 | if (!ctxt) { | 1563 | if (!ctxt) { |
diff --git a/fs/ocfs2/dlm/dlmlock.c b/fs/ocfs2/dlm/dlmlock.c index 7009292aac5a..8d39e0fd66f7 100644 --- a/fs/ocfs2/dlm/dlmlock.c +++ b/fs/ocfs2/dlm/dlmlock.c | |||
@@ -128,7 +128,7 @@ static enum dlm_status dlmlock_master(struct dlm_ctxt *dlm, | |||
128 | int call_ast = 0, kick_thread = 0; | 128 | int call_ast = 0, kick_thread = 0; |
129 | enum dlm_status status = DLM_NORMAL; | 129 | enum dlm_status status = DLM_NORMAL; |
130 | 130 | ||
131 | mlog_entry("type=%d\n", lock->ml.type); | 131 | mlog(0, "type=%d\n", lock->ml.type); |
132 | 132 | ||
133 | spin_lock(&res->spinlock); | 133 | spin_lock(&res->spinlock); |
134 | /* if called from dlm_create_lock_handler, need to | 134 | /* if called from dlm_create_lock_handler, need to |
@@ -227,8 +227,8 @@ static enum dlm_status dlmlock_remote(struct dlm_ctxt *dlm, | |||
227 | enum dlm_status status = DLM_DENIED; | 227 | enum dlm_status status = DLM_DENIED; |
228 | int lockres_changed = 1; | 228 | int lockres_changed = 1; |
229 | 229 | ||
230 | mlog_entry("type=%d\n", lock->ml.type); | 230 | mlog(0, "type=%d, lockres %.*s, flags = 0x%x\n", |
231 | mlog(0, "lockres %.*s, flags = 0x%x\n", res->lockname.len, | 231 | lock->ml.type, res->lockname.len, |
232 | res->lockname.name, flags); | 232 | res->lockname.name, flags); |
233 | 233 | ||
234 | spin_lock(&res->spinlock); | 234 | spin_lock(&res->spinlock); |
@@ -308,8 +308,6 @@ static enum dlm_status dlm_send_remote_lock_request(struct dlm_ctxt *dlm, | |||
308 | int tmpret, status = 0; | 308 | int tmpret, status = 0; |
309 | enum dlm_status ret; | 309 | enum dlm_status ret; |
310 | 310 | ||
311 | mlog_entry_void(); | ||
312 | |||
313 | memset(&create, 0, sizeof(create)); | 311 | memset(&create, 0, sizeof(create)); |
314 | create.node_idx = dlm->node_num; | 312 | create.node_idx = dlm->node_num; |
315 | create.requested_type = lock->ml.type; | 313 | create.requested_type = lock->ml.type; |
@@ -477,8 +475,6 @@ int dlm_create_lock_handler(struct o2net_msg *msg, u32 len, void *data, | |||
477 | 475 | ||
478 | BUG_ON(!dlm); | 476 | BUG_ON(!dlm); |
479 | 477 | ||
480 | mlog_entry_void(); | ||
481 | |||
482 | if (!dlm_grab(dlm)) | 478 | if (!dlm_grab(dlm)) |
483 | return DLM_REJECTED; | 479 | return DLM_REJECTED; |
484 | 480 | ||
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index 59f0f6bdfc62..9d67610dfc74 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -426,8 +426,6 @@ static void dlm_mle_release(struct kref *kref) | |||
426 | struct dlm_master_list_entry *mle; | 426 | struct dlm_master_list_entry *mle; |
427 | struct dlm_ctxt *dlm; | 427 | struct dlm_ctxt *dlm; |
428 | 428 | ||
429 | mlog_entry_void(); | ||
430 | |||
431 | mle = container_of(kref, struct dlm_master_list_entry, mle_refs); | 429 | mle = container_of(kref, struct dlm_master_list_entry, mle_refs); |
432 | dlm = mle->dlm; | 430 | dlm = mle->dlm; |
433 | 431 | ||
@@ -3120,8 +3118,6 @@ static int dlm_add_migration_mle(struct dlm_ctxt *dlm, | |||
3120 | 3118 | ||
3121 | *oldmle = NULL; | 3119 | *oldmle = NULL; |
3122 | 3120 | ||
3123 | mlog_entry_void(); | ||
3124 | |||
3125 | assert_spin_locked(&dlm->spinlock); | 3121 | assert_spin_locked(&dlm->spinlock); |
3126 | assert_spin_locked(&dlm->master_lock); | 3122 | assert_spin_locked(&dlm->master_lock); |
3127 | 3123 | ||
@@ -3261,7 +3257,7 @@ void dlm_clean_master_list(struct dlm_ctxt *dlm, u8 dead_node) | |||
3261 | struct hlist_node *list; | 3257 | struct hlist_node *list; |
3262 | unsigned int i; | 3258 | unsigned int i; |
3263 | 3259 | ||
3264 | mlog_entry("dlm=%s, dead node=%u\n", dlm->name, dead_node); | 3260 | mlog(0, "dlm=%s, dead node=%u\n", dlm->name, dead_node); |
3265 | top: | 3261 | top: |
3266 | assert_spin_locked(&dlm->spinlock); | 3262 | assert_spin_locked(&dlm->spinlock); |
3267 | 3263 | ||
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index aaaffbcbe916..f1beb6fc254d 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
@@ -727,7 +727,6 @@ static int dlm_remaster_locks(struct dlm_ctxt *dlm, u8 dead_node) | |||
727 | if (destroy) | 727 | if (destroy) |
728 | dlm_destroy_recovery_area(dlm, dead_node); | 728 | dlm_destroy_recovery_area(dlm, dead_node); |
729 | 729 | ||
730 | mlog_exit(status); | ||
731 | return status; | 730 | return status; |
732 | } | 731 | } |
733 | 732 | ||
@@ -1496,9 +1495,9 @@ leave: | |||
1496 | kfree(buf); | 1495 | kfree(buf); |
1497 | if (item) | 1496 | if (item) |
1498 | kfree(item); | 1497 | kfree(item); |
1498 | mlog_errno(ret); | ||
1499 | } | 1499 | } |
1500 | 1500 | ||
1501 | mlog_exit(ret); | ||
1502 | return ret; | 1501 | return ret; |
1503 | } | 1502 | } |
1504 | 1503 | ||
@@ -1567,7 +1566,6 @@ leave: | |||
1567 | dlm_lockres_put(res); | 1566 | dlm_lockres_put(res); |
1568 | } | 1567 | } |
1569 | kfree(data); | 1568 | kfree(data); |
1570 | mlog_exit(ret); | ||
1571 | } | 1569 | } |
1572 | 1570 | ||
1573 | 1571 | ||
@@ -1986,7 +1984,6 @@ leave: | |||
1986 | dlm_lock_put(newlock); | 1984 | dlm_lock_put(newlock); |
1987 | } | 1985 | } |
1988 | 1986 | ||
1989 | mlog_exit(ret); | ||
1990 | return ret; | 1987 | return ret; |
1991 | } | 1988 | } |
1992 | 1989 | ||
@@ -2083,8 +2080,6 @@ static void dlm_finish_local_lockres_recovery(struct dlm_ctxt *dlm, | |||
2083 | struct hlist_head *bucket; | 2080 | struct hlist_head *bucket; |
2084 | struct dlm_lock_resource *res, *next; | 2081 | struct dlm_lock_resource *res, *next; |
2085 | 2082 | ||
2086 | mlog_entry_void(); | ||
2087 | |||
2088 | assert_spin_locked(&dlm->spinlock); | 2083 | assert_spin_locked(&dlm->spinlock); |
2089 | 2084 | ||
2090 | list_for_each_entry_safe(res, next, &dlm->reco.resources, recovering) { | 2085 | list_for_each_entry_safe(res, next, &dlm->reco.resources, recovering) { |
@@ -2607,8 +2602,6 @@ static int dlm_send_begin_reco_message(struct dlm_ctxt *dlm, u8 dead_node) | |||
2607 | int nodenum; | 2602 | int nodenum; |
2608 | int status; | 2603 | int status; |
2609 | 2604 | ||
2610 | mlog_entry("%u\n", dead_node); | ||
2611 | |||
2612 | mlog(0, "%s: dead node is %u\n", dlm->name, dead_node); | 2605 | mlog(0, "%s: dead node is %u\n", dlm->name, dead_node); |
2613 | 2606 | ||
2614 | spin_lock(&dlm->spinlock); | 2607 | spin_lock(&dlm->spinlock); |
diff --git a/fs/ocfs2/dlm/dlmunlock.c b/fs/ocfs2/dlm/dlmunlock.c index 817287c6a6db..850aa7e87537 100644 --- a/fs/ocfs2/dlm/dlmunlock.c +++ b/fs/ocfs2/dlm/dlmunlock.c | |||
@@ -317,7 +317,7 @@ static enum dlm_status dlm_send_remote_unlock_request(struct dlm_ctxt *dlm, | |||
317 | struct kvec vec[2]; | 317 | struct kvec vec[2]; |
318 | size_t veclen = 1; | 318 | size_t veclen = 1; |
319 | 319 | ||
320 | mlog_entry("%.*s\n", res->lockname.len, res->lockname.name); | 320 | mlog(0, "%.*s\n", res->lockname.len, res->lockname.name); |
321 | 321 | ||
322 | if (owner == dlm->node_num) { | 322 | if (owner == dlm->node_num) { |
323 | /* ended up trying to contact ourself. this means | 323 | /* ended up trying to contact ourself. this means |
@@ -588,8 +588,6 @@ enum dlm_status dlmunlock(struct dlm_ctxt *dlm, struct dlm_lockstatus *lksb, | |||
588 | struct dlm_lock *lock = NULL; | 588 | struct dlm_lock *lock = NULL; |
589 | int call_ast, is_master; | 589 | int call_ast, is_master; |
590 | 590 | ||
591 | mlog_entry_void(); | ||
592 | |||
593 | if (!lksb) { | 591 | if (!lksb) { |
594 | dlm_error(DLM_BADARGS); | 592 | dlm_error(DLM_BADARGS); |
595 | return DLM_BADARGS; | 593 | return DLM_BADARGS; |
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 7484bb9a3438..7642d7ca73e5 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
@@ -397,8 +397,6 @@ static void ocfs2_build_lock_name(enum ocfs2_lock_type type, | |||
397 | { | 397 | { |
398 | int len; | 398 | int len; |
399 | 399 | ||
400 | mlog_entry_void(); | ||
401 | |||
402 | BUG_ON(type >= OCFS2_NUM_LOCK_TYPES); | 400 | BUG_ON(type >= OCFS2_NUM_LOCK_TYPES); |
403 | 401 | ||
404 | len = snprintf(name, OCFS2_LOCK_ID_MAX_LEN, "%c%s%016llx%08x", | 402 | len = snprintf(name, OCFS2_LOCK_ID_MAX_LEN, "%c%s%016llx%08x", |
@@ -408,8 +406,6 @@ static void ocfs2_build_lock_name(enum ocfs2_lock_type type, | |||
408 | BUG_ON(len != (OCFS2_LOCK_ID_MAX_LEN - 1)); | 406 | BUG_ON(len != (OCFS2_LOCK_ID_MAX_LEN - 1)); |
409 | 407 | ||
410 | mlog(0, "built lock resource with name: %s\n", name); | 408 | mlog(0, "built lock resource with name: %s\n", name); |
411 | |||
412 | mlog_exit_void(); | ||
413 | } | 409 | } |
414 | 410 | ||
415 | static DEFINE_SPINLOCK(ocfs2_dlm_tracking_lock); | 411 | static DEFINE_SPINLOCK(ocfs2_dlm_tracking_lock); |
@@ -725,8 +721,6 @@ void ocfs2_refcount_lock_res_init(struct ocfs2_lock_res *lockres, | |||
725 | 721 | ||
726 | void ocfs2_lock_res_free(struct ocfs2_lock_res *res) | 722 | void ocfs2_lock_res_free(struct ocfs2_lock_res *res) |
727 | { | 723 | { |
728 | mlog_entry_void(); | ||
729 | |||
730 | if (!(res->l_flags & OCFS2_LOCK_INITIALIZED)) | 724 | if (!(res->l_flags & OCFS2_LOCK_INITIALIZED)) |
731 | return; | 725 | return; |
732 | 726 | ||
@@ -752,14 +746,11 @@ void ocfs2_lock_res_free(struct ocfs2_lock_res *res) | |||
752 | memset(&res->l_lksb, 0, sizeof(res->l_lksb)); | 746 | memset(&res->l_lksb, 0, sizeof(res->l_lksb)); |
753 | 747 | ||
754 | res->l_flags = 0UL; | 748 | res->l_flags = 0UL; |
755 | mlog_exit_void(); | ||
756 | } | 749 | } |
757 | 750 | ||
758 | static inline void ocfs2_inc_holders(struct ocfs2_lock_res *lockres, | 751 | static inline void ocfs2_inc_holders(struct ocfs2_lock_res *lockres, |
759 | int level) | 752 | int level) |
760 | { | 753 | { |
761 | mlog_entry_void(); | ||
762 | |||
763 | BUG_ON(!lockres); | 754 | BUG_ON(!lockres); |
764 | 755 | ||
765 | switch(level) { | 756 | switch(level) { |
@@ -772,15 +763,11 @@ static inline void ocfs2_inc_holders(struct ocfs2_lock_res *lockres, | |||
772 | default: | 763 | default: |
773 | BUG(); | 764 | BUG(); |
774 | } | 765 | } |
775 | |||
776 | mlog_exit_void(); | ||
777 | } | 766 | } |
778 | 767 | ||
779 | static inline void ocfs2_dec_holders(struct ocfs2_lock_res *lockres, | 768 | static inline void ocfs2_dec_holders(struct ocfs2_lock_res *lockres, |
780 | int level) | 769 | int level) |
781 | { | 770 | { |
782 | mlog_entry_void(); | ||
783 | |||
784 | BUG_ON(!lockres); | 771 | BUG_ON(!lockres); |
785 | 772 | ||
786 | switch(level) { | 773 | switch(level) { |
@@ -795,7 +782,6 @@ static inline void ocfs2_dec_holders(struct ocfs2_lock_res *lockres, | |||
795 | default: | 782 | default: |
796 | BUG(); | 783 | BUG(); |
797 | } | 784 | } |
798 | mlog_exit_void(); | ||
799 | } | 785 | } |
800 | 786 | ||
801 | /* WARNING: This function lives in a world where the only three lock | 787 | /* WARNING: This function lives in a world where the only three lock |
@@ -842,8 +828,6 @@ static void lockres_clear_flags(struct ocfs2_lock_res *lockres, | |||
842 | 828 | ||
843 | static inline void ocfs2_generic_handle_downconvert_action(struct ocfs2_lock_res *lockres) | 829 | static inline void ocfs2_generic_handle_downconvert_action(struct ocfs2_lock_res *lockres) |
844 | { | 830 | { |
845 | mlog_entry_void(); | ||
846 | |||
847 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BUSY)); | 831 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BUSY)); |
848 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_ATTACHED)); | 832 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_ATTACHED)); |
849 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BLOCKED)); | 833 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BLOCKED)); |
@@ -856,14 +840,10 @@ static inline void ocfs2_generic_handle_downconvert_action(struct ocfs2_lock_res | |||
856 | lockres_clear_flags(lockres, OCFS2_LOCK_BLOCKED); | 840 | lockres_clear_flags(lockres, OCFS2_LOCK_BLOCKED); |
857 | } | 841 | } |
858 | lockres_clear_flags(lockres, OCFS2_LOCK_BUSY); | 842 | lockres_clear_flags(lockres, OCFS2_LOCK_BUSY); |
859 | |||
860 | mlog_exit_void(); | ||
861 | } | 843 | } |
862 | 844 | ||
863 | static inline void ocfs2_generic_handle_convert_action(struct ocfs2_lock_res *lockres) | 845 | static inline void ocfs2_generic_handle_convert_action(struct ocfs2_lock_res *lockres) |
864 | { | 846 | { |
865 | mlog_entry_void(); | ||
866 | |||
867 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BUSY)); | 847 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_BUSY)); |
868 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_ATTACHED)); | 848 | BUG_ON(!(lockres->l_flags & OCFS2_LOCK_ATTACHED)); |
869 | 849 | ||
@@ -885,14 +865,10 @@ static inline void ocfs2_generic_handle_convert_action(struct ocfs2_lock_res *lo | |||
885 | lockres_or_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING); | 865 | lockres_or_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING); |
886 | 866 | ||
887 | lockres_clear_flags(lockres, OCFS2_LOCK_BUSY); | 867 | lockres_clear_flags(lockres, OCFS2_LOCK_BUSY); |
888 | |||
889 | mlog_exit_void(); | ||
890 | } | 868 | } |
891 | 869 | ||
892 | static inline void ocfs2_generic_handle_attach_action(struct ocfs2_lock_res *lockres) | 870 | static inline void ocfs2_generic_handle_attach_action(struct ocfs2_lock_res *lockres) |
893 | { | 871 | { |
894 | mlog_entry_void(); | ||
895 | |||
896 | BUG_ON((!(lockres->l_flags & OCFS2_LOCK_BUSY))); | 872 | BUG_ON((!(lockres->l_flags & OCFS2_LOCK_BUSY))); |
897 | BUG_ON(lockres->l_flags & OCFS2_LOCK_ATTACHED); | 873 | BUG_ON(lockres->l_flags & OCFS2_LOCK_ATTACHED); |
898 | 874 | ||
@@ -904,15 +880,12 @@ static inline void ocfs2_generic_handle_attach_action(struct ocfs2_lock_res *loc | |||
904 | lockres->l_level = lockres->l_requested; | 880 | lockres->l_level = lockres->l_requested; |
905 | lockres_or_flags(lockres, OCFS2_LOCK_ATTACHED); | 881 | lockres_or_flags(lockres, OCFS2_LOCK_ATTACHED); |
906 | lockres_clear_flags(lockres, OCFS2_LOCK_BUSY); | 882 | lockres_clear_flags(lockres, OCFS2_LOCK_BUSY); |
907 | |||
908 | mlog_exit_void(); | ||
909 | } | 883 | } |
910 | 884 | ||
911 | static int ocfs2_generic_handle_bast(struct ocfs2_lock_res *lockres, | 885 | static int ocfs2_generic_handle_bast(struct ocfs2_lock_res *lockres, |
912 | int level) | 886 | int level) |
913 | { | 887 | { |
914 | int needs_downconvert = 0; | 888 | int needs_downconvert = 0; |
915 | mlog_entry_void(); | ||
916 | 889 | ||
917 | assert_spin_locked(&lockres->l_lock); | 890 | assert_spin_locked(&lockres->l_lock); |
918 | 891 | ||
@@ -934,8 +907,7 @@ static int ocfs2_generic_handle_bast(struct ocfs2_lock_res *lockres, | |||
934 | 907 | ||
935 | if (needs_downconvert) | 908 | if (needs_downconvert) |
936 | lockres_or_flags(lockres, OCFS2_LOCK_BLOCKED); | 909 | lockres_or_flags(lockres, OCFS2_LOCK_BLOCKED); |
937 | 910 | mlog(0, "needs_downconvert = %d\n", needs_downconvert); | |
938 | mlog_exit(needs_downconvert); | ||
939 | return needs_downconvert; | 911 | return needs_downconvert; |
940 | } | 912 | } |
941 | 913 | ||
@@ -1147,8 +1119,6 @@ static void ocfs2_unlock_ast(struct ocfs2_dlm_lksb *lksb, int error) | |||
1147 | struct ocfs2_lock_res *lockres = ocfs2_lksb_to_lock_res(lksb); | 1119 | struct ocfs2_lock_res *lockres = ocfs2_lksb_to_lock_res(lksb); |
1148 | unsigned long flags; | 1120 | unsigned long flags; |
1149 | 1121 | ||
1150 | mlog_entry_void(); | ||
1151 | |||
1152 | mlog(ML_BASTS, "UNLOCK AST fired for lockres %s, action = %d\n", | 1122 | mlog(ML_BASTS, "UNLOCK AST fired for lockres %s, action = %d\n", |
1153 | lockres->l_name, lockres->l_unlock_action); | 1123 | lockres->l_name, lockres->l_unlock_action); |
1154 | 1124 | ||
@@ -1158,7 +1128,6 @@ static void ocfs2_unlock_ast(struct ocfs2_dlm_lksb *lksb, int error) | |||
1158 | "unlock_action %d\n", error, lockres->l_name, | 1128 | "unlock_action %d\n", error, lockres->l_name, |
1159 | lockres->l_unlock_action); | 1129 | lockres->l_unlock_action); |
1160 | spin_unlock_irqrestore(&lockres->l_lock, flags); | 1130 | spin_unlock_irqrestore(&lockres->l_lock, flags); |
1161 | mlog_exit_void(); | ||
1162 | return; | 1131 | return; |
1163 | } | 1132 | } |
1164 | 1133 | ||
@@ -1182,8 +1151,6 @@ static void ocfs2_unlock_ast(struct ocfs2_dlm_lksb *lksb, int error) | |||
1182 | lockres->l_unlock_action = OCFS2_UNLOCK_INVALID; | 1151 | lockres->l_unlock_action = OCFS2_UNLOCK_INVALID; |
1183 | wake_up(&lockres->l_event); | 1152 | wake_up(&lockres->l_event); |
1184 | spin_unlock_irqrestore(&lockres->l_lock, flags); | 1153 | spin_unlock_irqrestore(&lockres->l_lock, flags); |
1185 | |||
1186 | mlog_exit_void(); | ||
1187 | } | 1154 | } |
1188 | 1155 | ||
1189 | /* | 1156 | /* |
@@ -1229,7 +1196,6 @@ static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres, | |||
1229 | { | 1196 | { |
1230 | unsigned long flags; | 1197 | unsigned long flags; |
1231 | 1198 | ||
1232 | mlog_entry_void(); | ||
1233 | spin_lock_irqsave(&lockres->l_lock, flags); | 1199 | spin_lock_irqsave(&lockres->l_lock, flags); |
1234 | lockres_clear_flags(lockres, OCFS2_LOCK_BUSY); | 1200 | lockres_clear_flags(lockres, OCFS2_LOCK_BUSY); |
1235 | lockres_clear_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING); | 1201 | lockres_clear_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING); |
@@ -1240,7 +1206,6 @@ static inline void ocfs2_recover_from_dlm_error(struct ocfs2_lock_res *lockres, | |||
1240 | spin_unlock_irqrestore(&lockres->l_lock, flags); | 1206 | spin_unlock_irqrestore(&lockres->l_lock, flags); |
1241 | 1207 | ||
1242 | wake_up(&lockres->l_event); | 1208 | wake_up(&lockres->l_event); |
1243 | mlog_exit_void(); | ||
1244 | } | 1209 | } |
1245 | 1210 | ||
1246 | /* Note: If we detect another process working on the lock (i.e., | 1211 | /* Note: If we detect another process working on the lock (i.e., |
@@ -1256,8 +1221,6 @@ static int ocfs2_lock_create(struct ocfs2_super *osb, | |||
1256 | unsigned long flags; | 1221 | unsigned long flags; |
1257 | unsigned int gen; | 1222 | unsigned int gen; |
1258 | 1223 | ||
1259 | mlog_entry_void(); | ||
1260 | |||
1261 | mlog(0, "lock %s, level = %d, flags = %u\n", lockres->l_name, level, | 1224 | mlog(0, "lock %s, level = %d, flags = %u\n", lockres->l_name, level, |
1262 | dlm_flags); | 1225 | dlm_flags); |
1263 | 1226 | ||
@@ -1289,7 +1252,6 @@ static int ocfs2_lock_create(struct ocfs2_super *osb, | |||
1289 | mlog(0, "lock %s, return from ocfs2_dlm_lock\n", lockres->l_name); | 1252 | mlog(0, "lock %s, return from ocfs2_dlm_lock\n", lockres->l_name); |
1290 | 1253 | ||
1291 | bail: | 1254 | bail: |
1292 | mlog_exit(ret); | ||
1293 | return ret; | 1255 | return ret; |
1294 | } | 1256 | } |
1295 | 1257 | ||
@@ -1412,8 +1374,6 @@ static int __ocfs2_cluster_lock(struct ocfs2_super *osb, | |||
1412 | unsigned int gen; | 1374 | unsigned int gen; |
1413 | int noqueue_attempted = 0; | 1375 | int noqueue_attempted = 0; |
1414 | 1376 | ||
1415 | mlog_entry_void(); | ||
1416 | |||
1417 | ocfs2_init_mask_waiter(&mw); | 1377 | ocfs2_init_mask_waiter(&mw); |
1418 | 1378 | ||
1419 | if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB) | 1379 | if (lockres->l_ops->flags & LOCK_TYPE_USES_LVB) |
@@ -1579,7 +1539,6 @@ out: | |||
1579 | caller_ip); | 1539 | caller_ip); |
1580 | } | 1540 | } |
1581 | #endif | 1541 | #endif |
1582 | mlog_exit(ret); | ||
1583 | return ret; | 1542 | return ret; |
1584 | } | 1543 | } |
1585 | 1544 | ||
@@ -1601,7 +1560,6 @@ static void __ocfs2_cluster_unlock(struct ocfs2_super *osb, | |||
1601 | { | 1560 | { |
1602 | unsigned long flags; | 1561 | unsigned long flags; |
1603 | 1562 | ||
1604 | mlog_entry_void(); | ||
1605 | spin_lock_irqsave(&lockres->l_lock, flags); | 1563 | spin_lock_irqsave(&lockres->l_lock, flags); |
1606 | ocfs2_dec_holders(lockres, level); | 1564 | ocfs2_dec_holders(lockres, level); |
1607 | ocfs2_downconvert_on_unlock(osb, lockres); | 1565 | ocfs2_downconvert_on_unlock(osb, lockres); |
@@ -1610,7 +1568,6 @@ static void __ocfs2_cluster_unlock(struct ocfs2_super *osb, | |||
1610 | if (lockres->l_lockdep_map.key != NULL) | 1568 | if (lockres->l_lockdep_map.key != NULL) |
1611 | rwsem_release(&lockres->l_lockdep_map, 1, caller_ip); | 1569 | rwsem_release(&lockres->l_lockdep_map, 1, caller_ip); |
1612 | #endif | 1570 | #endif |
1613 | mlog_exit_void(); | ||
1614 | } | 1571 | } |
1615 | 1572 | ||
1616 | static int ocfs2_create_new_lock(struct ocfs2_super *osb, | 1573 | static int ocfs2_create_new_lock(struct ocfs2_super *osb, |
@@ -1644,8 +1601,6 @@ int ocfs2_create_new_inode_locks(struct inode *inode) | |||
1644 | BUG_ON(!inode); | 1601 | BUG_ON(!inode); |
1645 | BUG_ON(!ocfs2_inode_is_new(inode)); | 1602 | BUG_ON(!ocfs2_inode_is_new(inode)); |
1646 | 1603 | ||
1647 | mlog_entry_void(); | ||
1648 | |||
1649 | mlog(0, "Inode %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno); | 1604 | mlog(0, "Inode %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno); |
1650 | 1605 | ||
1651 | /* NOTE: That we don't increment any of the holder counts, nor | 1606 | /* NOTE: That we don't increment any of the holder counts, nor |
@@ -1679,7 +1634,6 @@ int ocfs2_create_new_inode_locks(struct inode *inode) | |||
1679 | } | 1634 | } |
1680 | 1635 | ||
1681 | bail: | 1636 | bail: |
1682 | mlog_exit(ret); | ||
1683 | return ret; | 1637 | return ret; |
1684 | } | 1638 | } |
1685 | 1639 | ||
@@ -1691,16 +1645,12 @@ int ocfs2_rw_lock(struct inode *inode, int write) | |||
1691 | 1645 | ||
1692 | BUG_ON(!inode); | 1646 | BUG_ON(!inode); |
1693 | 1647 | ||
1694 | mlog_entry_void(); | ||
1695 | |||
1696 | mlog(0, "inode %llu take %s RW lock\n", | 1648 | mlog(0, "inode %llu take %s RW lock\n", |
1697 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 1649 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
1698 | write ? "EXMODE" : "PRMODE"); | 1650 | write ? "EXMODE" : "PRMODE"); |
1699 | 1651 | ||
1700 | if (ocfs2_mount_local(osb)) { | 1652 | if (ocfs2_mount_local(osb)) |
1701 | mlog_exit(0); | ||
1702 | return 0; | 1653 | return 0; |
1703 | } | ||
1704 | 1654 | ||
1705 | lockres = &OCFS2_I(inode)->ip_rw_lockres; | 1655 | lockres = &OCFS2_I(inode)->ip_rw_lockres; |
1706 | 1656 | ||
@@ -1711,7 +1661,6 @@ int ocfs2_rw_lock(struct inode *inode, int write) | |||
1711 | if (status < 0) | 1661 | if (status < 0) |
1712 | mlog_errno(status); | 1662 | mlog_errno(status); |
1713 | 1663 | ||
1714 | mlog_exit(status); | ||
1715 | return status; | 1664 | return status; |
1716 | } | 1665 | } |
1717 | 1666 | ||
@@ -1721,16 +1670,12 @@ void ocfs2_rw_unlock(struct inode *inode, int write) | |||
1721 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_rw_lockres; | 1670 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_rw_lockres; |
1722 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1671 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1723 | 1672 | ||
1724 | mlog_entry_void(); | ||
1725 | |||
1726 | mlog(0, "inode %llu drop %s RW lock\n", | 1673 | mlog(0, "inode %llu drop %s RW lock\n", |
1727 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 1674 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
1728 | write ? "EXMODE" : "PRMODE"); | 1675 | write ? "EXMODE" : "PRMODE"); |
1729 | 1676 | ||
1730 | if (!ocfs2_mount_local(osb)) | 1677 | if (!ocfs2_mount_local(osb)) |
1731 | ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); | 1678 | ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); |
1732 | |||
1733 | mlog_exit_void(); | ||
1734 | } | 1679 | } |
1735 | 1680 | ||
1736 | /* | 1681 | /* |
@@ -1744,8 +1689,6 @@ int ocfs2_open_lock(struct inode *inode) | |||
1744 | 1689 | ||
1745 | BUG_ON(!inode); | 1690 | BUG_ON(!inode); |
1746 | 1691 | ||
1747 | mlog_entry_void(); | ||
1748 | |||
1749 | mlog(0, "inode %llu take PRMODE open lock\n", | 1692 | mlog(0, "inode %llu take PRMODE open lock\n", |
1750 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | 1693 | (unsigned long long)OCFS2_I(inode)->ip_blkno); |
1751 | 1694 | ||
@@ -1760,7 +1703,6 @@ int ocfs2_open_lock(struct inode *inode) | |||
1760 | mlog_errno(status); | 1703 | mlog_errno(status); |
1761 | 1704 | ||
1762 | out: | 1705 | out: |
1763 | mlog_exit(status); | ||
1764 | return status; | 1706 | return status; |
1765 | } | 1707 | } |
1766 | 1708 | ||
@@ -1772,8 +1714,6 @@ int ocfs2_try_open_lock(struct inode *inode, int write) | |||
1772 | 1714 | ||
1773 | BUG_ON(!inode); | 1715 | BUG_ON(!inode); |
1774 | 1716 | ||
1775 | mlog_entry_void(); | ||
1776 | |||
1777 | mlog(0, "inode %llu try to take %s open lock\n", | 1717 | mlog(0, "inode %llu try to take %s open lock\n", |
1778 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 1718 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
1779 | write ? "EXMODE" : "PRMODE"); | 1719 | write ? "EXMODE" : "PRMODE"); |
@@ -1795,7 +1735,6 @@ int ocfs2_try_open_lock(struct inode *inode, int write) | |||
1795 | level, DLM_LKF_NOQUEUE, 0); | 1735 | level, DLM_LKF_NOQUEUE, 0); |
1796 | 1736 | ||
1797 | out: | 1737 | out: |
1798 | mlog_exit(status); | ||
1799 | return status; | 1738 | return status; |
1800 | } | 1739 | } |
1801 | 1740 | ||
@@ -1807,8 +1746,6 @@ void ocfs2_open_unlock(struct inode *inode) | |||
1807 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_open_lockres; | 1746 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_open_lockres; |
1808 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1747 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1809 | 1748 | ||
1810 | mlog_entry_void(); | ||
1811 | |||
1812 | mlog(0, "inode %llu drop open lock\n", | 1749 | mlog(0, "inode %llu drop open lock\n", |
1813 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | 1750 | (unsigned long long)OCFS2_I(inode)->ip_blkno); |
1814 | 1751 | ||
@@ -1823,7 +1760,7 @@ void ocfs2_open_unlock(struct inode *inode) | |||
1823 | DLM_LOCK_EX); | 1760 | DLM_LOCK_EX); |
1824 | 1761 | ||
1825 | out: | 1762 | out: |
1826 | mlog_exit_void(); | 1763 | return; |
1827 | } | 1764 | } |
1828 | 1765 | ||
1829 | static int ocfs2_flock_handle_signal(struct ocfs2_lock_res *lockres, | 1766 | static int ocfs2_flock_handle_signal(struct ocfs2_lock_res *lockres, |
@@ -2039,8 +1976,6 @@ static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb, | |||
2039 | { | 1976 | { |
2040 | int kick = 0; | 1977 | int kick = 0; |
2041 | 1978 | ||
2042 | mlog_entry_void(); | ||
2043 | |||
2044 | /* If we know that another node is waiting on our lock, kick | 1979 | /* If we know that another node is waiting on our lock, kick |
2045 | * the downconvert thread * pre-emptively when we reach a release | 1980 | * the downconvert thread * pre-emptively when we reach a release |
2046 | * condition. */ | 1981 | * condition. */ |
@@ -2061,8 +1996,6 @@ static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb, | |||
2061 | 1996 | ||
2062 | if (kick) | 1997 | if (kick) |
2063 | ocfs2_wake_downconvert_thread(osb); | 1998 | ocfs2_wake_downconvert_thread(osb); |
2064 | |||
2065 | mlog_exit_void(); | ||
2066 | } | 1999 | } |
2067 | 2000 | ||
2068 | #define OCFS2_SEC_BITS 34 | 2001 | #define OCFS2_SEC_BITS 34 |
@@ -2091,8 +2024,6 @@ static void __ocfs2_stuff_meta_lvb(struct inode *inode) | |||
2091 | struct ocfs2_lock_res *lockres = &oi->ip_inode_lockres; | 2024 | struct ocfs2_lock_res *lockres = &oi->ip_inode_lockres; |
2092 | struct ocfs2_meta_lvb *lvb; | 2025 | struct ocfs2_meta_lvb *lvb; |
2093 | 2026 | ||
2094 | mlog_entry_void(); | ||
2095 | |||
2096 | lvb = ocfs2_dlm_lvb(&lockres->l_lksb); | 2027 | lvb = ocfs2_dlm_lvb(&lockres->l_lksb); |
2097 | 2028 | ||
2098 | /* | 2029 | /* |
@@ -2124,8 +2055,6 @@ static void __ocfs2_stuff_meta_lvb(struct inode *inode) | |||
2124 | 2055 | ||
2125 | out: | 2056 | out: |
2126 | mlog_meta_lvb(0, lockres); | 2057 | mlog_meta_lvb(0, lockres); |
2127 | |||
2128 | mlog_exit_void(); | ||
2129 | } | 2058 | } |
2130 | 2059 | ||
2131 | static void ocfs2_unpack_timespec(struct timespec *spec, | 2060 | static void ocfs2_unpack_timespec(struct timespec *spec, |
@@ -2141,8 +2070,6 @@ static void ocfs2_refresh_inode_from_lvb(struct inode *inode) | |||
2141 | struct ocfs2_lock_res *lockres = &oi->ip_inode_lockres; | 2070 | struct ocfs2_lock_res *lockres = &oi->ip_inode_lockres; |
2142 | struct ocfs2_meta_lvb *lvb; | 2071 | struct ocfs2_meta_lvb *lvb; |
2143 | 2072 | ||
2144 | mlog_entry_void(); | ||
2145 | |||
2146 | mlog_meta_lvb(0, lockres); | 2073 | mlog_meta_lvb(0, lockres); |
2147 | 2074 | ||
2148 | lvb = ocfs2_dlm_lvb(&lockres->l_lksb); | 2075 | lvb = ocfs2_dlm_lvb(&lockres->l_lksb); |
@@ -2173,8 +2100,6 @@ static void ocfs2_refresh_inode_from_lvb(struct inode *inode) | |||
2173 | ocfs2_unpack_timespec(&inode->i_ctime, | 2100 | ocfs2_unpack_timespec(&inode->i_ctime, |
2174 | be64_to_cpu(lvb->lvb_ictime_packed)); | 2101 | be64_to_cpu(lvb->lvb_ictime_packed)); |
2175 | spin_unlock(&oi->ip_lock); | 2102 | spin_unlock(&oi->ip_lock); |
2176 | |||
2177 | mlog_exit_void(); | ||
2178 | } | 2103 | } |
2179 | 2104 | ||
2180 | static inline int ocfs2_meta_lvb_is_trustable(struct inode *inode, | 2105 | static inline int ocfs2_meta_lvb_is_trustable(struct inode *inode, |
@@ -2201,8 +2126,6 @@ static int ocfs2_should_refresh_lock_res(struct ocfs2_lock_res *lockres) | |||
2201 | unsigned long flags; | 2126 | unsigned long flags; |
2202 | int status = 0; | 2127 | int status = 0; |
2203 | 2128 | ||
2204 | mlog_entry_void(); | ||
2205 | |||
2206 | refresh_check: | 2129 | refresh_check: |
2207 | spin_lock_irqsave(&lockres->l_lock, flags); | 2130 | spin_lock_irqsave(&lockres->l_lock, flags); |
2208 | if (!(lockres->l_flags & OCFS2_LOCK_NEEDS_REFRESH)) { | 2131 | if (!(lockres->l_flags & OCFS2_LOCK_NEEDS_REFRESH)) { |
@@ -2223,7 +2146,7 @@ refresh_check: | |||
2223 | 2146 | ||
2224 | status = 1; | 2147 | status = 1; |
2225 | bail: | 2148 | bail: |
2226 | mlog_exit(status); | 2149 | mlog(0, "status %d\n", status); |
2227 | return status; | 2150 | return status; |
2228 | } | 2151 | } |
2229 | 2152 | ||
@@ -2233,7 +2156,6 @@ static inline void ocfs2_complete_lock_res_refresh(struct ocfs2_lock_res *lockre | |||
2233 | int status) | 2156 | int status) |
2234 | { | 2157 | { |
2235 | unsigned long flags; | 2158 | unsigned long flags; |
2236 | mlog_entry_void(); | ||
2237 | 2159 | ||
2238 | spin_lock_irqsave(&lockres->l_lock, flags); | 2160 | spin_lock_irqsave(&lockres->l_lock, flags); |
2239 | lockres_clear_flags(lockres, OCFS2_LOCK_REFRESHING); | 2161 | lockres_clear_flags(lockres, OCFS2_LOCK_REFRESHING); |
@@ -2242,8 +2164,6 @@ static inline void ocfs2_complete_lock_res_refresh(struct ocfs2_lock_res *lockre | |||
2242 | spin_unlock_irqrestore(&lockres->l_lock, flags); | 2164 | spin_unlock_irqrestore(&lockres->l_lock, flags); |
2243 | 2165 | ||
2244 | wake_up(&lockres->l_event); | 2166 | wake_up(&lockres->l_event); |
2245 | |||
2246 | mlog_exit_void(); | ||
2247 | } | 2167 | } |
2248 | 2168 | ||
2249 | /* may or may not return a bh if it went to disk. */ | 2169 | /* may or may not return a bh if it went to disk. */ |
@@ -2256,8 +2176,6 @@ static int ocfs2_inode_lock_update(struct inode *inode, | |||
2256 | struct ocfs2_dinode *fe; | 2176 | struct ocfs2_dinode *fe; |
2257 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 2177 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
2258 | 2178 | ||
2259 | mlog_entry_void(); | ||
2260 | |||
2261 | if (ocfs2_mount_local(osb)) | 2179 | if (ocfs2_mount_local(osb)) |
2262 | goto bail; | 2180 | goto bail; |
2263 | 2181 | ||
@@ -2326,7 +2244,6 @@ static int ocfs2_inode_lock_update(struct inode *inode, | |||
2326 | bail_refresh: | 2244 | bail_refresh: |
2327 | ocfs2_complete_lock_res_refresh(lockres, status); | 2245 | ocfs2_complete_lock_res_refresh(lockres, status); |
2328 | bail: | 2246 | bail: |
2329 | mlog_exit(status); | ||
2330 | return status; | 2247 | return status; |
2331 | } | 2248 | } |
2332 | 2249 | ||
@@ -2370,8 +2287,6 @@ int ocfs2_inode_lock_full_nested(struct inode *inode, | |||
2370 | 2287 | ||
2371 | BUG_ON(!inode); | 2288 | BUG_ON(!inode); |
2372 | 2289 | ||
2373 | mlog_entry_void(); | ||
2374 | |||
2375 | mlog(0, "inode %llu, take %s META lock\n", | 2290 | mlog(0, "inode %llu, take %s META lock\n", |
2376 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 2291 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
2377 | ex ? "EXMODE" : "PRMODE"); | 2292 | ex ? "EXMODE" : "PRMODE"); |
@@ -2463,7 +2378,6 @@ bail: | |||
2463 | if (local_bh) | 2378 | if (local_bh) |
2464 | brelse(local_bh); | 2379 | brelse(local_bh); |
2465 | 2380 | ||
2466 | mlog_exit(status); | ||
2467 | return status; | 2381 | return status; |
2468 | } | 2382 | } |
2469 | 2383 | ||
@@ -2513,7 +2427,6 @@ int ocfs2_inode_lock_atime(struct inode *inode, | |||
2513 | { | 2427 | { |
2514 | int ret; | 2428 | int ret; |
2515 | 2429 | ||
2516 | mlog_entry_void(); | ||
2517 | ret = ocfs2_inode_lock(inode, NULL, 0); | 2430 | ret = ocfs2_inode_lock(inode, NULL, 0); |
2518 | if (ret < 0) { | 2431 | if (ret < 0) { |
2519 | mlog_errno(ret); | 2432 | mlog_errno(ret); |
@@ -2541,7 +2454,6 @@ int ocfs2_inode_lock_atime(struct inode *inode, | |||
2541 | } else | 2454 | } else |
2542 | *level = 0; | 2455 | *level = 0; |
2543 | 2456 | ||
2544 | mlog_exit(ret); | ||
2545 | return ret; | 2457 | return ret; |
2546 | } | 2458 | } |
2547 | 2459 | ||
@@ -2552,8 +2464,6 @@ void ocfs2_inode_unlock(struct inode *inode, | |||
2552 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_inode_lockres; | 2464 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_inode_lockres; |
2553 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 2465 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
2554 | 2466 | ||
2555 | mlog_entry_void(); | ||
2556 | |||
2557 | mlog(0, "inode %llu drop %s META lock\n", | 2467 | mlog(0, "inode %llu drop %s META lock\n", |
2558 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 2468 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
2559 | ex ? "EXMODE" : "PRMODE"); | 2469 | ex ? "EXMODE" : "PRMODE"); |
@@ -2561,8 +2471,6 @@ void ocfs2_inode_unlock(struct inode *inode, | |||
2561 | if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb)) && | 2471 | if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb)) && |
2562 | !ocfs2_mount_local(osb)) | 2472 | !ocfs2_mount_local(osb)) |
2563 | ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); | 2473 | ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); |
2564 | |||
2565 | mlog_exit_void(); | ||
2566 | } | 2474 | } |
2567 | 2475 | ||
2568 | int ocfs2_orphan_scan_lock(struct ocfs2_super *osb, u32 *seqno) | 2476 | int ocfs2_orphan_scan_lock(struct ocfs2_super *osb, u32 *seqno) |
@@ -2613,8 +2521,6 @@ int ocfs2_super_lock(struct ocfs2_super *osb, | |||
2613 | int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR; | 2521 | int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR; |
2614 | struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; | 2522 | struct ocfs2_lock_res *lockres = &osb->osb_super_lockres; |
2615 | 2523 | ||
2616 | mlog_entry_void(); | ||
2617 | |||
2618 | if (ocfs2_is_hard_readonly(osb)) | 2524 | if (ocfs2_is_hard_readonly(osb)) |
2619 | return -EROFS; | 2525 | return -EROFS; |
2620 | 2526 | ||
@@ -2646,7 +2552,6 @@ int ocfs2_super_lock(struct ocfs2_super *osb, | |||
2646 | ocfs2_track_lock_refresh(lockres); | 2552 | ocfs2_track_lock_refresh(lockres); |
2647 | } | 2553 | } |
2648 | bail: | 2554 | bail: |
2649 | mlog_exit(status); | ||
2650 | return status; | 2555 | return status; |
2651 | } | 2556 | } |
2652 | 2557 | ||
@@ -3057,8 +2962,6 @@ int ocfs2_dlm_init(struct ocfs2_super *osb) | |||
3057 | int status = 0; | 2962 | int status = 0; |
3058 | struct ocfs2_cluster_connection *conn = NULL; | 2963 | struct ocfs2_cluster_connection *conn = NULL; |
3059 | 2964 | ||
3060 | mlog_entry_void(); | ||
3061 | |||
3062 | if (ocfs2_mount_local(osb)) { | 2965 | if (ocfs2_mount_local(osb)) { |
3063 | osb->node_num = 0; | 2966 | osb->node_num = 0; |
3064 | goto local; | 2967 | goto local; |
@@ -3115,15 +3018,12 @@ bail: | |||
3115 | kthread_stop(osb->dc_task); | 3018 | kthread_stop(osb->dc_task); |
3116 | } | 3019 | } |
3117 | 3020 | ||
3118 | mlog_exit(status); | ||
3119 | return status; | 3021 | return status; |
3120 | } | 3022 | } |
3121 | 3023 | ||
3122 | void ocfs2_dlm_shutdown(struct ocfs2_super *osb, | 3024 | void ocfs2_dlm_shutdown(struct ocfs2_super *osb, |
3123 | int hangup_pending) | 3025 | int hangup_pending) |
3124 | { | 3026 | { |
3125 | mlog_entry_void(); | ||
3126 | |||
3127 | ocfs2_drop_osb_locks(osb); | 3027 | ocfs2_drop_osb_locks(osb); |
3128 | 3028 | ||
3129 | /* | 3029 | /* |
@@ -3146,8 +3046,6 @@ void ocfs2_dlm_shutdown(struct ocfs2_super *osb, | |||
3146 | osb->cconn = NULL; | 3046 | osb->cconn = NULL; |
3147 | 3047 | ||
3148 | ocfs2_dlm_shutdown_debug(osb); | 3048 | ocfs2_dlm_shutdown_debug(osb); |
3149 | |||
3150 | mlog_exit_void(); | ||
3151 | } | 3049 | } |
3152 | 3050 | ||
3153 | static int ocfs2_drop_lock(struct ocfs2_super *osb, | 3051 | static int ocfs2_drop_lock(struct ocfs2_super *osb, |
@@ -3229,7 +3127,6 @@ static int ocfs2_drop_lock(struct ocfs2_super *osb, | |||
3229 | 3127 | ||
3230 | ocfs2_wait_on_busy_lock(lockres); | 3128 | ocfs2_wait_on_busy_lock(lockres); |
3231 | out: | 3129 | out: |
3232 | mlog_exit(0); | ||
3233 | return 0; | 3130 | return 0; |
3234 | } | 3131 | } |
3235 | 3132 | ||
@@ -3287,8 +3184,6 @@ int ocfs2_drop_inode_locks(struct inode *inode) | |||
3287 | { | 3184 | { |
3288 | int status, err; | 3185 | int status, err; |
3289 | 3186 | ||
3290 | mlog_entry_void(); | ||
3291 | |||
3292 | /* No need to call ocfs2_mark_lockres_freeing here - | 3187 | /* No need to call ocfs2_mark_lockres_freeing here - |
3293 | * ocfs2_clear_inode has done it for us. */ | 3188 | * ocfs2_clear_inode has done it for us. */ |
3294 | 3189 | ||
@@ -3313,7 +3208,6 @@ int ocfs2_drop_inode_locks(struct inode *inode) | |||
3313 | if (err < 0 && !status) | 3208 | if (err < 0 && !status) |
3314 | status = err; | 3209 | status = err; |
3315 | 3210 | ||
3316 | mlog_exit(status); | ||
3317 | return status; | 3211 | return status; |
3318 | } | 3212 | } |
3319 | 3213 | ||
@@ -3355,8 +3249,6 @@ static int ocfs2_downconvert_lock(struct ocfs2_super *osb, | |||
3355 | int ret; | 3249 | int ret; |
3356 | u32 dlm_flags = DLM_LKF_CONVERT; | 3250 | u32 dlm_flags = DLM_LKF_CONVERT; |
3357 | 3251 | ||
3358 | mlog_entry_void(); | ||
3359 | |||
3360 | mlog(ML_BASTS, "lockres %s, level %d => %d\n", lockres->l_name, | 3252 | mlog(ML_BASTS, "lockres %s, level %d => %d\n", lockres->l_name, |
3361 | lockres->l_level, new_level); | 3253 | lockres->l_level, new_level); |
3362 | 3254 | ||
@@ -3378,7 +3270,6 @@ static int ocfs2_downconvert_lock(struct ocfs2_super *osb, | |||
3378 | 3270 | ||
3379 | ret = 0; | 3271 | ret = 0; |
3380 | bail: | 3272 | bail: |
3381 | mlog_exit(ret); | ||
3382 | return ret; | 3273 | return ret; |
3383 | } | 3274 | } |
3384 | 3275 | ||
@@ -3388,8 +3279,6 @@ static int ocfs2_prepare_cancel_convert(struct ocfs2_super *osb, | |||
3388 | { | 3279 | { |
3389 | assert_spin_locked(&lockres->l_lock); | 3280 | assert_spin_locked(&lockres->l_lock); |
3390 | 3281 | ||
3391 | mlog_entry_void(); | ||
3392 | |||
3393 | if (lockres->l_unlock_action == OCFS2_UNLOCK_CANCEL_CONVERT) { | 3282 | if (lockres->l_unlock_action == OCFS2_UNLOCK_CANCEL_CONVERT) { |
3394 | /* If we're already trying to cancel a lock conversion | 3283 | /* If we're already trying to cancel a lock conversion |
3395 | * then just drop the spinlock and allow the caller to | 3284 | * then just drop the spinlock and allow the caller to |
@@ -3419,8 +3308,6 @@ static int ocfs2_cancel_convert(struct ocfs2_super *osb, | |||
3419 | { | 3308 | { |
3420 | int ret; | 3309 | int ret; |
3421 | 3310 | ||
3422 | mlog_entry_void(); | ||
3423 | |||
3424 | ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb, | 3311 | ret = ocfs2_dlm_unlock(osb->cconn, &lockres->l_lksb, |
3425 | DLM_LKF_CANCEL); | 3312 | DLM_LKF_CANCEL); |
3426 | if (ret) { | 3313 | if (ret) { |
@@ -3430,7 +3317,6 @@ static int ocfs2_cancel_convert(struct ocfs2_super *osb, | |||
3430 | 3317 | ||
3431 | mlog(ML_BASTS, "lockres %s\n", lockres->l_name); | 3318 | mlog(ML_BASTS, "lockres %s\n", lockres->l_name); |
3432 | 3319 | ||
3433 | mlog_exit(ret); | ||
3434 | return ret; | 3320 | return ret; |
3435 | } | 3321 | } |
3436 | 3322 | ||
@@ -3446,8 +3332,6 @@ static int ocfs2_unblock_lock(struct ocfs2_super *osb, | |||
3446 | int set_lvb = 0; | 3332 | int set_lvb = 0; |
3447 | unsigned int gen; | 3333 | unsigned int gen; |
3448 | 3334 | ||
3449 | mlog_entry_void(); | ||
3450 | |||
3451 | spin_lock_irqsave(&lockres->l_lock, flags); | 3335 | spin_lock_irqsave(&lockres->l_lock, flags); |
3452 | 3336 | ||
3453 | recheck: | 3337 | recheck: |
@@ -3622,14 +3506,14 @@ downconvert: | |||
3622 | gen); | 3506 | gen); |
3623 | 3507 | ||
3624 | leave: | 3508 | leave: |
3625 | mlog_exit(ret); | 3509 | if (ret) |
3510 | mlog_errno(ret); | ||
3626 | return ret; | 3511 | return ret; |
3627 | 3512 | ||
3628 | leave_requeue: | 3513 | leave_requeue: |
3629 | spin_unlock_irqrestore(&lockres->l_lock, flags); | 3514 | spin_unlock_irqrestore(&lockres->l_lock, flags); |
3630 | ctl->requeue = 1; | 3515 | ctl->requeue = 1; |
3631 | 3516 | ||
3632 | mlog_exit(0); | ||
3633 | return 0; | 3517 | return 0; |
3634 | } | 3518 | } |
3635 | 3519 | ||
@@ -3862,8 +3746,6 @@ static void ocfs2_set_qinfo_lvb(struct ocfs2_lock_res *lockres) | |||
3862 | struct mem_dqinfo *info = sb_dqinfo(oinfo->dqi_gi.dqi_sb, | 3746 | struct mem_dqinfo *info = sb_dqinfo(oinfo->dqi_gi.dqi_sb, |
3863 | oinfo->dqi_gi.dqi_type); | 3747 | oinfo->dqi_gi.dqi_type); |
3864 | 3748 | ||
3865 | mlog_entry_void(); | ||
3866 | |||
3867 | lvb = ocfs2_dlm_lvb(&lockres->l_lksb); | 3749 | lvb = ocfs2_dlm_lvb(&lockres->l_lksb); |
3868 | lvb->lvb_version = OCFS2_QINFO_LVB_VERSION; | 3750 | lvb->lvb_version = OCFS2_QINFO_LVB_VERSION; |
3869 | lvb->lvb_bgrace = cpu_to_be32(info->dqi_bgrace); | 3751 | lvb->lvb_bgrace = cpu_to_be32(info->dqi_bgrace); |
@@ -3872,8 +3754,6 @@ static void ocfs2_set_qinfo_lvb(struct ocfs2_lock_res *lockres) | |||
3872 | lvb->lvb_blocks = cpu_to_be32(oinfo->dqi_gi.dqi_blocks); | 3754 | lvb->lvb_blocks = cpu_to_be32(oinfo->dqi_gi.dqi_blocks); |
3873 | lvb->lvb_free_blk = cpu_to_be32(oinfo->dqi_gi.dqi_free_blk); | 3755 | lvb->lvb_free_blk = cpu_to_be32(oinfo->dqi_gi.dqi_free_blk); |
3874 | lvb->lvb_free_entry = cpu_to_be32(oinfo->dqi_gi.dqi_free_entry); | 3756 | lvb->lvb_free_entry = cpu_to_be32(oinfo->dqi_gi.dqi_free_entry); |
3875 | |||
3876 | mlog_exit_void(); | ||
3877 | } | 3757 | } |
3878 | 3758 | ||
3879 | void ocfs2_qinfo_unlock(struct ocfs2_mem_dqinfo *oinfo, int ex) | 3759 | void ocfs2_qinfo_unlock(struct ocfs2_mem_dqinfo *oinfo, int ex) |
@@ -3882,10 +3762,8 @@ void ocfs2_qinfo_unlock(struct ocfs2_mem_dqinfo *oinfo, int ex) | |||
3882 | struct ocfs2_super *osb = OCFS2_SB(oinfo->dqi_gi.dqi_sb); | 3762 | struct ocfs2_super *osb = OCFS2_SB(oinfo->dqi_gi.dqi_sb); |
3883 | int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR; | 3763 | int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR; |
3884 | 3764 | ||
3885 | mlog_entry_void(); | ||
3886 | if (!ocfs2_is_hard_readonly(osb) && !ocfs2_mount_local(osb)) | 3765 | if (!ocfs2_is_hard_readonly(osb) && !ocfs2_mount_local(osb)) |
3887 | ocfs2_cluster_unlock(osb, lockres, level); | 3766 | ocfs2_cluster_unlock(osb, lockres, level); |
3888 | mlog_exit_void(); | ||
3889 | } | 3767 | } |
3890 | 3768 | ||
3891 | static int ocfs2_refresh_qinfo(struct ocfs2_mem_dqinfo *oinfo) | 3769 | static int ocfs2_refresh_qinfo(struct ocfs2_mem_dqinfo *oinfo) |
@@ -3940,8 +3818,6 @@ int ocfs2_qinfo_lock(struct ocfs2_mem_dqinfo *oinfo, int ex) | |||
3940 | int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR; | 3818 | int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR; |
3941 | int status = 0; | 3819 | int status = 0; |
3942 | 3820 | ||
3943 | mlog_entry_void(); | ||
3944 | |||
3945 | /* On RO devices, locking really isn't needed... */ | 3821 | /* On RO devices, locking really isn't needed... */ |
3946 | if (ocfs2_is_hard_readonly(osb)) { | 3822 | if (ocfs2_is_hard_readonly(osb)) { |
3947 | if (ex) | 3823 | if (ex) |
@@ -3964,7 +3840,6 @@ int ocfs2_qinfo_lock(struct ocfs2_mem_dqinfo *oinfo, int ex) | |||
3964 | ocfs2_qinfo_unlock(oinfo, ex); | 3840 | ocfs2_qinfo_unlock(oinfo, ex); |
3965 | ocfs2_complete_lock_res_refresh(lockres, status); | 3841 | ocfs2_complete_lock_res_refresh(lockres, status); |
3966 | bail: | 3842 | bail: |
3967 | mlog_exit(status); | ||
3968 | return status; | 3843 | return status; |
3969 | } | 3844 | } |
3970 | 3845 | ||
@@ -4010,8 +3885,6 @@ static void ocfs2_process_blocked_lock(struct ocfs2_super *osb, | |||
4010 | * considered valid until we remove the OCFS2_LOCK_QUEUED | 3885 | * considered valid until we remove the OCFS2_LOCK_QUEUED |
4011 | * flag. */ | 3886 | * flag. */ |
4012 | 3887 | ||
4013 | mlog_entry_void(); | ||
4014 | |||
4015 | BUG_ON(!lockres); | 3888 | BUG_ON(!lockres); |
4016 | BUG_ON(!lockres->l_ops); | 3889 | BUG_ON(!lockres->l_ops); |
4017 | 3890 | ||
@@ -4045,15 +3918,11 @@ unqueue: | |||
4045 | if (ctl.unblock_action != UNBLOCK_CONTINUE | 3918 | if (ctl.unblock_action != UNBLOCK_CONTINUE |
4046 | && lockres->l_ops->post_unlock) | 3919 | && lockres->l_ops->post_unlock) |
4047 | lockres->l_ops->post_unlock(osb, lockres); | 3920 | lockres->l_ops->post_unlock(osb, lockres); |
4048 | |||
4049 | mlog_exit_void(); | ||
4050 | } | 3921 | } |
4051 | 3922 | ||
4052 | static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb, | 3923 | static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb, |
4053 | struct ocfs2_lock_res *lockres) | 3924 | struct ocfs2_lock_res *lockres) |
4054 | { | 3925 | { |
4055 | mlog_entry_void(); | ||
4056 | |||
4057 | assert_spin_locked(&lockres->l_lock); | 3926 | assert_spin_locked(&lockres->l_lock); |
4058 | 3927 | ||
4059 | if (lockres->l_flags & OCFS2_LOCK_FREEING) { | 3928 | if (lockres->l_flags & OCFS2_LOCK_FREEING) { |
@@ -4074,8 +3943,6 @@ static void ocfs2_schedule_blocked_lock(struct ocfs2_super *osb, | |||
4074 | osb->blocked_lock_count++; | 3943 | osb->blocked_lock_count++; |
4075 | } | 3944 | } |
4076 | spin_unlock(&osb->dc_task_lock); | 3945 | spin_unlock(&osb->dc_task_lock); |
4077 | |||
4078 | mlog_exit_void(); | ||
4079 | } | 3946 | } |
4080 | 3947 | ||
4081 | static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb) | 3948 | static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb) |
@@ -4083,8 +3950,6 @@ static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb) | |||
4083 | unsigned long processed; | 3950 | unsigned long processed; |
4084 | struct ocfs2_lock_res *lockres; | 3951 | struct ocfs2_lock_res *lockres; |
4085 | 3952 | ||
4086 | mlog_entry_void(); | ||
4087 | |||
4088 | spin_lock(&osb->dc_task_lock); | 3953 | spin_lock(&osb->dc_task_lock); |
4089 | /* grab this early so we know to try again if a state change and | 3954 | /* grab this early so we know to try again if a state change and |
4090 | * wake happens part-way through our work */ | 3955 | * wake happens part-way through our work */ |
@@ -4108,8 +3973,6 @@ static void ocfs2_downconvert_thread_do_work(struct ocfs2_super *osb) | |||
4108 | spin_lock(&osb->dc_task_lock); | 3973 | spin_lock(&osb->dc_task_lock); |
4109 | } | 3974 | } |
4110 | spin_unlock(&osb->dc_task_lock); | 3975 | spin_unlock(&osb->dc_task_lock); |
4111 | |||
4112 | mlog_exit_void(); | ||
4113 | } | 3976 | } |
4114 | 3977 | ||
4115 | static int ocfs2_downconvert_thread_lists_empty(struct ocfs2_super *osb) | 3978 | static int ocfs2_downconvert_thread_lists_empty(struct ocfs2_super *osb) |
diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c index 5dbc3062b4fd..745db42528d5 100644 --- a/fs/ocfs2/export.c +++ b/fs/ocfs2/export.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | 28 | ||
29 | #define MLOG_MASK_PREFIX ML_EXPORT | ||
30 | #include <cluster/masklog.h> | 29 | #include <cluster/masklog.h> |
31 | 30 | ||
32 | #include "ocfs2.h" | 31 | #include "ocfs2.h" |
@@ -40,6 +39,7 @@ | |||
40 | 39 | ||
41 | #include "buffer_head_io.h" | 40 | #include "buffer_head_io.h" |
42 | #include "suballoc.h" | 41 | #include "suballoc.h" |
42 | #include "ocfs2_trace.h" | ||
43 | 43 | ||
44 | struct ocfs2_inode_handle | 44 | struct ocfs2_inode_handle |
45 | { | 45 | { |
@@ -56,10 +56,9 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb, | |||
56 | int status, set; | 56 | int status, set; |
57 | struct dentry *result; | 57 | struct dentry *result; |
58 | 58 | ||
59 | mlog_entry("(0x%p, 0x%p)\n", sb, handle); | 59 | trace_ocfs2_get_dentry_begin(sb, handle, (unsigned long long)blkno); |
60 | 60 | ||
61 | if (blkno == 0) { | 61 | if (blkno == 0) { |
62 | mlog(0, "nfs wants inode with blkno: 0\n"); | ||
63 | result = ERR_PTR(-ESTALE); | 62 | result = ERR_PTR(-ESTALE); |
64 | goto bail; | 63 | goto bail; |
65 | } | 64 | } |
@@ -83,6 +82,7 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb, | |||
83 | } | 82 | } |
84 | 83 | ||
85 | status = ocfs2_test_inode_bit(osb, blkno, &set); | 84 | status = ocfs2_test_inode_bit(osb, blkno, &set); |
85 | trace_ocfs2_get_dentry_test_bit(status, set); | ||
86 | if (status < 0) { | 86 | if (status < 0) { |
87 | if (status == -EINVAL) { | 87 | if (status == -EINVAL) { |
88 | /* | 88 | /* |
@@ -90,18 +90,14 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb, | |||
90 | * as an inode, we return -ESTALE to be | 90 | * as an inode, we return -ESTALE to be |
91 | * nice | 91 | * nice |
92 | */ | 92 | */ |
93 | mlog(0, "test inode bit failed %d\n", status); | ||
94 | status = -ESTALE; | 93 | status = -ESTALE; |
95 | } else { | 94 | } else |
96 | mlog(ML_ERROR, "test inode bit failed %d\n", status); | 95 | mlog(ML_ERROR, "test inode bit failed %d\n", status); |
97 | } | ||
98 | goto unlock_nfs_sync; | 96 | goto unlock_nfs_sync; |
99 | } | 97 | } |
100 | 98 | ||
101 | /* If the inode allocator bit is clear, this inode must be stale */ | 99 | /* If the inode allocator bit is clear, this inode must be stale */ |
102 | if (!set) { | 100 | if (!set) { |
103 | mlog(0, "inode %llu suballoc bit is clear\n", | ||
104 | (unsigned long long)blkno); | ||
105 | status = -ESTALE; | 101 | status = -ESTALE; |
106 | goto unlock_nfs_sync; | 102 | goto unlock_nfs_sync; |
107 | } | 103 | } |
@@ -114,8 +110,8 @@ unlock_nfs_sync: | |||
114 | check_err: | 110 | check_err: |
115 | if (status < 0) { | 111 | if (status < 0) { |
116 | if (status == -ESTALE) { | 112 | if (status == -ESTALE) { |
117 | mlog(0, "stale inode ino: %llu generation: %u\n", | 113 | trace_ocfs2_get_dentry_stale((unsigned long long)blkno, |
118 | (unsigned long long)blkno, handle->ih_generation); | 114 | handle->ih_generation); |
119 | } | 115 | } |
120 | result = ERR_PTR(status); | 116 | result = ERR_PTR(status); |
121 | goto bail; | 117 | goto bail; |
@@ -130,8 +126,9 @@ check_err: | |||
130 | check_gen: | 126 | check_gen: |
131 | if (handle->ih_generation != inode->i_generation) { | 127 | if (handle->ih_generation != inode->i_generation) { |
132 | iput(inode); | 128 | iput(inode); |
133 | mlog(0, "stale inode ino: %llu generation: %u\n", | 129 | trace_ocfs2_get_dentry_generation((unsigned long long)blkno, |
134 | (unsigned long long)blkno, handle->ih_generation); | 130 | handle->ih_generation, |
131 | inode->i_generation); | ||
135 | result = ERR_PTR(-ESTALE); | 132 | result = ERR_PTR(-ESTALE); |
136 | goto bail; | 133 | goto bail; |
137 | } | 134 | } |
@@ -141,7 +138,7 @@ check_gen: | |||
141 | mlog_errno(PTR_ERR(result)); | 138 | mlog_errno(PTR_ERR(result)); |
142 | 139 | ||
143 | bail: | 140 | bail: |
144 | mlog_exit_ptr(result); | 141 | trace_ocfs2_get_dentry_end(result); |
145 | return result; | 142 | return result; |
146 | } | 143 | } |
147 | 144 | ||
@@ -152,11 +149,8 @@ static struct dentry *ocfs2_get_parent(struct dentry *child) | |||
152 | struct dentry *parent; | 149 | struct dentry *parent; |
153 | struct inode *dir = child->d_inode; | 150 | struct inode *dir = child->d_inode; |
154 | 151 | ||
155 | mlog_entry("(0x%p, '%.*s')\n", child, | 152 | trace_ocfs2_get_parent(child, child->d_name.len, child->d_name.name, |
156 | child->d_name.len, child->d_name.name); | 153 | (unsigned long long)OCFS2_I(dir)->ip_blkno); |
157 | |||
158 | mlog(0, "find parent of directory %llu\n", | ||
159 | (unsigned long long)OCFS2_I(dir)->ip_blkno); | ||
160 | 154 | ||
161 | status = ocfs2_inode_lock(dir, NULL, 0); | 155 | status = ocfs2_inode_lock(dir, NULL, 0); |
162 | if (status < 0) { | 156 | if (status < 0) { |
@@ -178,7 +172,7 @@ bail_unlock: | |||
178 | ocfs2_inode_unlock(dir, 0); | 172 | ocfs2_inode_unlock(dir, 0); |
179 | 173 | ||
180 | bail: | 174 | bail: |
181 | mlog_exit_ptr(parent); | 175 | trace_ocfs2_get_parent_end(parent); |
182 | 176 | ||
183 | return parent; | 177 | return parent; |
184 | } | 178 | } |
@@ -193,12 +187,16 @@ static int ocfs2_encode_fh(struct dentry *dentry, u32 *fh_in, int *max_len, | |||
193 | u32 generation; | 187 | u32 generation; |
194 | __le32 *fh = (__force __le32 *) fh_in; | 188 | __le32 *fh = (__force __le32 *) fh_in; |
195 | 189 | ||
196 | mlog_entry("(0x%p, '%.*s', 0x%p, %d, %d)\n", dentry, | 190 | trace_ocfs2_encode_fh_begin(dentry, dentry->d_name.len, |
197 | dentry->d_name.len, dentry->d_name.name, | 191 | dentry->d_name.name, |
198 | fh, len, connectable); | 192 | fh, len, connectable); |
199 | 193 | ||
200 | if (len < 3 || (connectable && len < 6)) { | 194 | if (connectable && (len < 6)) { |
201 | mlog(ML_ERROR, "fh buffer is too small for encoding\n"); | 195 | *max_len = 6; |
196 | type = 255; | ||
197 | goto bail; | ||
198 | } else if (len < 3) { | ||
199 | *max_len = 3; | ||
202 | type = 255; | 200 | type = 255; |
203 | goto bail; | 201 | goto bail; |
204 | } | 202 | } |
@@ -206,8 +204,7 @@ static int ocfs2_encode_fh(struct dentry *dentry, u32 *fh_in, int *max_len, | |||
206 | blkno = OCFS2_I(inode)->ip_blkno; | 204 | blkno = OCFS2_I(inode)->ip_blkno; |
207 | generation = inode->i_generation; | 205 | generation = inode->i_generation; |
208 | 206 | ||
209 | mlog(0, "Encoding fh: blkno: %llu, generation: %u\n", | 207 | trace_ocfs2_encode_fh_self((unsigned long long)blkno, generation); |
210 | (unsigned long long)blkno, generation); | ||
211 | 208 | ||
212 | len = 3; | 209 | len = 3; |
213 | fh[0] = cpu_to_le32((u32)(blkno >> 32)); | 210 | fh[0] = cpu_to_le32((u32)(blkno >> 32)); |
@@ -232,14 +229,14 @@ static int ocfs2_encode_fh(struct dentry *dentry, u32 *fh_in, int *max_len, | |||
232 | len = 6; | 229 | len = 6; |
233 | type = 2; | 230 | type = 2; |
234 | 231 | ||
235 | mlog(0, "Encoding parent: blkno: %llu, generation: %u\n", | 232 | trace_ocfs2_encode_fh_parent((unsigned long long)blkno, |
236 | (unsigned long long)blkno, generation); | 233 | generation); |
237 | } | 234 | } |
238 | 235 | ||
239 | *max_len = len; | 236 | *max_len = len; |
240 | 237 | ||
241 | bail: | 238 | bail: |
242 | mlog_exit(type); | 239 | trace_ocfs2_encode_fh_type(type); |
243 | return type; | 240 | return type; |
244 | } | 241 | } |
245 | 242 | ||
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c index 09e3fdfa6d33..23457b491e8c 100644 --- a/fs/ocfs2/extent_map.c +++ b/fs/ocfs2/extent_map.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/fiemap.h> | 29 | #include <linux/fiemap.h> |
30 | 30 | ||
31 | #define MLOG_MASK_PREFIX ML_EXTENT_MAP | ||
32 | #include <cluster/masklog.h> | 31 | #include <cluster/masklog.h> |
33 | 32 | ||
34 | #include "ocfs2.h" | 33 | #include "ocfs2.h" |
@@ -39,6 +38,7 @@ | |||
39 | #include "inode.h" | 38 | #include "inode.h" |
40 | #include "super.h" | 39 | #include "super.h" |
41 | #include "symlink.h" | 40 | #include "symlink.h" |
41 | #include "ocfs2_trace.h" | ||
42 | 42 | ||
43 | #include "buffer_head_io.h" | 43 | #include "buffer_head_io.h" |
44 | 44 | ||
@@ -841,10 +841,9 @@ int ocfs2_read_virt_blocks(struct inode *inode, u64 v_block, int nr, | |||
841 | u64 p_block, p_count; | 841 | u64 p_block, p_count; |
842 | int i, count, done = 0; | 842 | int i, count, done = 0; |
843 | 843 | ||
844 | mlog_entry("(inode = %p, v_block = %llu, nr = %d, bhs = %p, " | 844 | trace_ocfs2_read_virt_blocks( |
845 | "flags = %x, validate = %p)\n", | 845 | inode, (unsigned long long)v_block, nr, bhs, flags, |
846 | inode, (unsigned long long)v_block, nr, bhs, flags, | 846 | validate); |
847 | validate); | ||
848 | 847 | ||
849 | if (((v_block + nr - 1) << inode->i_sb->s_blocksize_bits) >= | 848 | if (((v_block + nr - 1) << inode->i_sb->s_blocksize_bits) >= |
850 | i_size_read(inode)) { | 849 | i_size_read(inode)) { |
@@ -897,7 +896,6 @@ int ocfs2_read_virt_blocks(struct inode *inode, u64 v_block, int nr, | |||
897 | } | 896 | } |
898 | 897 | ||
899 | out: | 898 | out: |
900 | mlog_exit(rc); | ||
901 | return rc; | 899 | return rc; |
902 | } | 900 | } |
903 | 901 | ||
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index a6651956482e..41565ae52856 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/quotaops.h> | 38 | #include <linux/quotaops.h> |
39 | #include <linux/blkdev.h> | 39 | #include <linux/blkdev.h> |
40 | 40 | ||
41 | #define MLOG_MASK_PREFIX ML_INODE | ||
42 | #include <cluster/masklog.h> | 41 | #include <cluster/masklog.h> |
43 | 42 | ||
44 | #include "ocfs2.h" | 43 | #include "ocfs2.h" |
@@ -61,6 +60,7 @@ | |||
61 | #include "acl.h" | 60 | #include "acl.h" |
62 | #include "quota.h" | 61 | #include "quota.h" |
63 | #include "refcounttree.h" | 62 | #include "refcounttree.h" |
63 | #include "ocfs2_trace.h" | ||
64 | 64 | ||
65 | #include "buffer_head_io.h" | 65 | #include "buffer_head_io.h" |
66 | 66 | ||
@@ -99,8 +99,10 @@ static int ocfs2_file_open(struct inode *inode, struct file *file) | |||
99 | int mode = file->f_flags; | 99 | int mode = file->f_flags; |
100 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 100 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
101 | 101 | ||
102 | mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file, | 102 | trace_ocfs2_file_open(inode, file, file->f_path.dentry, |
103 | file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name); | 103 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
104 | file->f_path.dentry->d_name.len, | ||
105 | file->f_path.dentry->d_name.name, mode); | ||
104 | 106 | ||
105 | if (file->f_mode & FMODE_WRITE) | 107 | if (file->f_mode & FMODE_WRITE) |
106 | dquot_initialize(inode); | 108 | dquot_initialize(inode); |
@@ -135,7 +137,6 @@ static int ocfs2_file_open(struct inode *inode, struct file *file) | |||
135 | } | 137 | } |
136 | 138 | ||
137 | leave: | 139 | leave: |
138 | mlog_exit(status); | ||
139 | return status; | 140 | return status; |
140 | } | 141 | } |
141 | 142 | ||
@@ -143,19 +144,19 @@ static int ocfs2_file_release(struct inode *inode, struct file *file) | |||
143 | { | 144 | { |
144 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 145 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
145 | 146 | ||
146 | mlog_entry("(0x%p, 0x%p, '%.*s')\n", inode, file, | ||
147 | file->f_path.dentry->d_name.len, | ||
148 | file->f_path.dentry->d_name.name); | ||
149 | |||
150 | spin_lock(&oi->ip_lock); | 147 | spin_lock(&oi->ip_lock); |
151 | if (!--oi->ip_open_count) | 148 | if (!--oi->ip_open_count) |
152 | oi->ip_flags &= ~OCFS2_INODE_OPEN_DIRECT; | 149 | oi->ip_flags &= ~OCFS2_INODE_OPEN_DIRECT; |
150 | |||
151 | trace_ocfs2_file_release(inode, file, file->f_path.dentry, | ||
152 | oi->ip_blkno, | ||
153 | file->f_path.dentry->d_name.len, | ||
154 | file->f_path.dentry->d_name.name, | ||
155 | oi->ip_open_count); | ||
153 | spin_unlock(&oi->ip_lock); | 156 | spin_unlock(&oi->ip_lock); |
154 | 157 | ||
155 | ocfs2_free_file_private(inode, file); | 158 | ocfs2_free_file_private(inode, file); |
156 | 159 | ||
157 | mlog_exit(0); | ||
158 | |||
159 | return 0; | 160 | return 0; |
160 | } | 161 | } |
161 | 162 | ||
@@ -177,9 +178,11 @@ static int ocfs2_sync_file(struct file *file, int datasync) | |||
177 | struct inode *inode = file->f_mapping->host; | 178 | struct inode *inode = file->f_mapping->host; |
178 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 179 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
179 | 180 | ||
180 | mlog_entry("(0x%p, %d, 0x%p, '%.*s')\n", file, datasync, | 181 | trace_ocfs2_sync_file(inode, file, file->f_path.dentry, |
181 | file->f_path.dentry, file->f_path.dentry->d_name.len, | 182 | OCFS2_I(inode)->ip_blkno, |
182 | file->f_path.dentry->d_name.name); | 183 | file->f_path.dentry->d_name.len, |
184 | file->f_path.dentry->d_name.name, | ||
185 | (unsigned long long)datasync); | ||
183 | 186 | ||
184 | if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) { | 187 | if (datasync && !(inode->i_state & I_DIRTY_DATASYNC)) { |
185 | /* | 188 | /* |
@@ -195,7 +198,8 @@ static int ocfs2_sync_file(struct file *file, int datasync) | |||
195 | err = jbd2_journal_force_commit(journal); | 198 | err = jbd2_journal_force_commit(journal); |
196 | 199 | ||
197 | bail: | 200 | bail: |
198 | mlog_exit(err); | 201 | if (err) |
202 | mlog_errno(err); | ||
199 | 203 | ||
200 | return (err < 0) ? -EIO : 0; | 204 | return (err < 0) ? -EIO : 0; |
201 | } | 205 | } |
@@ -251,8 +255,6 @@ int ocfs2_update_inode_atime(struct inode *inode, | |||
251 | handle_t *handle; | 255 | handle_t *handle; |
252 | struct ocfs2_dinode *di = (struct ocfs2_dinode *) bh->b_data; | 256 | struct ocfs2_dinode *di = (struct ocfs2_dinode *) bh->b_data; |
253 | 257 | ||
254 | mlog_entry_void(); | ||
255 | |||
256 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); | 258 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); |
257 | if (IS_ERR(handle)) { | 259 | if (IS_ERR(handle)) { |
258 | ret = PTR_ERR(handle); | 260 | ret = PTR_ERR(handle); |
@@ -280,7 +282,6 @@ int ocfs2_update_inode_atime(struct inode *inode, | |||
280 | out_commit: | 282 | out_commit: |
281 | ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); | 283 | ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle); |
282 | out: | 284 | out: |
283 | mlog_exit(ret); | ||
284 | return ret; | 285 | return ret; |
285 | } | 286 | } |
286 | 287 | ||
@@ -291,7 +292,6 @@ static int ocfs2_set_inode_size(handle_t *handle, | |||
291 | { | 292 | { |
292 | int status; | 293 | int status; |
293 | 294 | ||
294 | mlog_entry_void(); | ||
295 | i_size_write(inode, new_i_size); | 295 | i_size_write(inode, new_i_size); |
296 | inode->i_blocks = ocfs2_inode_sector_count(inode); | 296 | inode->i_blocks = ocfs2_inode_sector_count(inode); |
297 | inode->i_ctime = inode->i_mtime = CURRENT_TIME; | 297 | inode->i_ctime = inode->i_mtime = CURRENT_TIME; |
@@ -303,7 +303,6 @@ static int ocfs2_set_inode_size(handle_t *handle, | |||
303 | } | 303 | } |
304 | 304 | ||
305 | bail: | 305 | bail: |
306 | mlog_exit(status); | ||
307 | return status; | 306 | return status; |
308 | } | 307 | } |
309 | 308 | ||
@@ -375,8 +374,6 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb, | |||
375 | struct ocfs2_dinode *di; | 374 | struct ocfs2_dinode *di; |
376 | u64 cluster_bytes; | 375 | u64 cluster_bytes; |
377 | 376 | ||
378 | mlog_entry_void(); | ||
379 | |||
380 | /* | 377 | /* |
381 | * We need to CoW the cluster contains the offset if it is reflinked | 378 | * We need to CoW the cluster contains the offset if it is reflinked |
382 | * since we will call ocfs2_zero_range_for_truncate later which will | 379 | * since we will call ocfs2_zero_range_for_truncate later which will |
@@ -429,8 +426,6 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb, | |||
429 | out_commit: | 426 | out_commit: |
430 | ocfs2_commit_trans(osb, handle); | 427 | ocfs2_commit_trans(osb, handle); |
431 | out: | 428 | out: |
432 | |||
433 | mlog_exit(status); | ||
434 | return status; | 429 | return status; |
435 | } | 430 | } |
436 | 431 | ||
@@ -442,14 +437,14 @@ static int ocfs2_truncate_file(struct inode *inode, | |||
442 | struct ocfs2_dinode *fe = NULL; | 437 | struct ocfs2_dinode *fe = NULL; |
443 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 438 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
444 | 439 | ||
445 | mlog_entry("(inode = %llu, new_i_size = %llu\n", | ||
446 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
447 | (unsigned long long)new_i_size); | ||
448 | |||
449 | /* We trust di_bh because it comes from ocfs2_inode_lock(), which | 440 | /* We trust di_bh because it comes from ocfs2_inode_lock(), which |
450 | * already validated it */ | 441 | * already validated it */ |
451 | fe = (struct ocfs2_dinode *) di_bh->b_data; | 442 | fe = (struct ocfs2_dinode *) di_bh->b_data; |
452 | 443 | ||
444 | trace_ocfs2_truncate_file((unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
445 | (unsigned long long)le64_to_cpu(fe->i_size), | ||
446 | (unsigned long long)new_i_size); | ||
447 | |||
453 | mlog_bug_on_msg(le64_to_cpu(fe->i_size) != i_size_read(inode), | 448 | mlog_bug_on_msg(le64_to_cpu(fe->i_size) != i_size_read(inode), |
454 | "Inode %llu, inode i_size = %lld != di " | 449 | "Inode %llu, inode i_size = %lld != di " |
455 | "i_size = %llu, i_flags = 0x%x\n", | 450 | "i_size = %llu, i_flags = 0x%x\n", |
@@ -459,19 +454,14 @@ static int ocfs2_truncate_file(struct inode *inode, | |||
459 | le32_to_cpu(fe->i_flags)); | 454 | le32_to_cpu(fe->i_flags)); |
460 | 455 | ||
461 | if (new_i_size > le64_to_cpu(fe->i_size)) { | 456 | if (new_i_size > le64_to_cpu(fe->i_size)) { |
462 | mlog(0, "asked to truncate file with size (%llu) to size (%llu)!\n", | 457 | trace_ocfs2_truncate_file_error( |
463 | (unsigned long long)le64_to_cpu(fe->i_size), | 458 | (unsigned long long)le64_to_cpu(fe->i_size), |
464 | (unsigned long long)new_i_size); | 459 | (unsigned long long)new_i_size); |
465 | status = -EINVAL; | 460 | status = -EINVAL; |
466 | mlog_errno(status); | 461 | mlog_errno(status); |
467 | goto bail; | 462 | goto bail; |
468 | } | 463 | } |
469 | 464 | ||
470 | mlog(0, "inode %llu, i_size = %llu, new_i_size = %llu\n", | ||
471 | (unsigned long long)le64_to_cpu(fe->i_blkno), | ||
472 | (unsigned long long)le64_to_cpu(fe->i_size), | ||
473 | (unsigned long long)new_i_size); | ||
474 | |||
475 | /* lets handle the simple truncate cases before doing any more | 465 | /* lets handle the simple truncate cases before doing any more |
476 | * cluster locking. */ | 466 | * cluster locking. */ |
477 | if (new_i_size == le64_to_cpu(fe->i_size)) | 467 | if (new_i_size == le64_to_cpu(fe->i_size)) |
@@ -525,7 +515,6 @@ bail: | |||
525 | if (!status && OCFS2_I(inode)->ip_clusters == 0) | 515 | if (!status && OCFS2_I(inode)->ip_clusters == 0) |
526 | status = ocfs2_try_remove_refcount_tree(inode, di_bh); | 516 | status = ocfs2_try_remove_refcount_tree(inode, di_bh); |
527 | 517 | ||
528 | mlog_exit(status); | ||
529 | return status; | 518 | return status; |
530 | } | 519 | } |
531 | 520 | ||
@@ -578,8 +567,6 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start, | |||
578 | struct ocfs2_extent_tree et; | 567 | struct ocfs2_extent_tree et; |
579 | int did_quota = 0; | 568 | int did_quota = 0; |
580 | 569 | ||
581 | mlog_entry("(clusters_to_add = %u)\n", clusters_to_add); | ||
582 | |||
583 | /* | 570 | /* |
584 | * This function only exists for file systems which don't | 571 | * This function only exists for file systems which don't |
585 | * support holes. | 572 | * support holes. |
@@ -596,11 +583,6 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start, | |||
596 | restart_all: | 583 | restart_all: |
597 | BUG_ON(le32_to_cpu(fe->i_clusters) != OCFS2_I(inode)->ip_clusters); | 584 | BUG_ON(le32_to_cpu(fe->i_clusters) != OCFS2_I(inode)->ip_clusters); |
598 | 585 | ||
599 | mlog(0, "extend inode %llu, i_size = %lld, di->i_clusters = %u, " | ||
600 | "clusters_to_add = %u\n", | ||
601 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
602 | (long long)i_size_read(inode), le32_to_cpu(fe->i_clusters), | ||
603 | clusters_to_add); | ||
604 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), bh); | 586 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), bh); |
605 | status = ocfs2_lock_allocators(inode, &et, clusters_to_add, 0, | 587 | status = ocfs2_lock_allocators(inode, &et, clusters_to_add, 0, |
606 | &data_ac, &meta_ac); | 588 | &data_ac, &meta_ac); |
@@ -620,6 +602,12 @@ restart_all: | |||
620 | } | 602 | } |
621 | 603 | ||
622 | restarted_transaction: | 604 | restarted_transaction: |
605 | trace_ocfs2_extend_allocation( | ||
606 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
607 | (unsigned long long)i_size_read(inode), | ||
608 | le32_to_cpu(fe->i_clusters), clusters_to_add, | ||
609 | why, restart_func); | ||
610 | |||
623 | status = dquot_alloc_space_nodirty(inode, | 611 | status = dquot_alloc_space_nodirty(inode, |
624 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_add)); | 612 | ocfs2_clusters_to_bytes(osb->sb, clusters_to_add)); |
625 | if (status) | 613 | if (status) |
@@ -666,13 +654,11 @@ restarted_transaction: | |||
666 | 654 | ||
667 | if (why != RESTART_NONE && clusters_to_add) { | 655 | if (why != RESTART_NONE && clusters_to_add) { |
668 | if (why == RESTART_META) { | 656 | if (why == RESTART_META) { |
669 | mlog(0, "restarting function.\n"); | ||
670 | restart_func = 1; | 657 | restart_func = 1; |
671 | status = 0; | 658 | status = 0; |
672 | } else { | 659 | } else { |
673 | BUG_ON(why != RESTART_TRANS); | 660 | BUG_ON(why != RESTART_TRANS); |
674 | 661 | ||
675 | mlog(0, "restarting transaction.\n"); | ||
676 | /* TODO: This can be more intelligent. */ | 662 | /* TODO: This can be more intelligent. */ |
677 | credits = ocfs2_calc_extend_credits(osb->sb, | 663 | credits = ocfs2_calc_extend_credits(osb->sb, |
678 | &fe->id2.i_list, | 664 | &fe->id2.i_list, |
@@ -689,11 +675,11 @@ restarted_transaction: | |||
689 | } | 675 | } |
690 | } | 676 | } |
691 | 677 | ||
692 | mlog(0, "fe: i_clusters = %u, i_size=%llu\n", | 678 | trace_ocfs2_extend_allocation_end(OCFS2_I(inode)->ip_blkno, |
693 | le32_to_cpu(fe->i_clusters), | 679 | le32_to_cpu(fe->i_clusters), |
694 | (unsigned long long)le64_to_cpu(fe->i_size)); | 680 | (unsigned long long)le64_to_cpu(fe->i_size), |
695 | mlog(0, "inode: ip_clusters=%u, i_size=%lld\n", | 681 | OCFS2_I(inode)->ip_clusters, |
696 | OCFS2_I(inode)->ip_clusters, (long long)i_size_read(inode)); | 682 | (unsigned long long)i_size_read(inode)); |
697 | 683 | ||
698 | leave: | 684 | leave: |
699 | if (status < 0 && did_quota) | 685 | if (status < 0 && did_quota) |
@@ -718,7 +704,6 @@ leave: | |||
718 | brelse(bh); | 704 | brelse(bh); |
719 | bh = NULL; | 705 | bh = NULL; |
720 | 706 | ||
721 | mlog_exit(status); | ||
722 | return status; | 707 | return status; |
723 | } | 708 | } |
724 | 709 | ||
@@ -785,10 +770,11 @@ static int ocfs2_write_zero_page(struct inode *inode, u64 abs_from, | |||
785 | if (!zero_to) | 770 | if (!zero_to) |
786 | zero_to = PAGE_CACHE_SIZE; | 771 | zero_to = PAGE_CACHE_SIZE; |
787 | 772 | ||
788 | mlog(0, | 773 | trace_ocfs2_write_zero_page( |
789 | "abs_from = %llu, abs_to = %llu, index = %lu, zero_from = %u, zero_to = %u\n", | 774 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
790 | (unsigned long long)abs_from, (unsigned long long)abs_to, | 775 | (unsigned long long)abs_from, |
791 | index, zero_from, zero_to); | 776 | (unsigned long long)abs_to, |
777 | index, zero_from, zero_to); | ||
792 | 778 | ||
793 | /* We know that zero_from is block aligned */ | 779 | /* We know that zero_from is block aligned */ |
794 | for (block_start = zero_from; block_start < zero_to; | 780 | for (block_start = zero_from; block_start < zero_to; |
@@ -928,9 +914,10 @@ static int ocfs2_zero_extend_range(struct inode *inode, u64 range_start, | |||
928 | u64 next_pos; | 914 | u64 next_pos; |
929 | u64 zero_pos = range_start; | 915 | u64 zero_pos = range_start; |
930 | 916 | ||
931 | mlog(0, "range_start = %llu, range_end = %llu\n", | 917 | trace_ocfs2_zero_extend_range( |
932 | (unsigned long long)range_start, | 918 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
933 | (unsigned long long)range_end); | 919 | (unsigned long long)range_start, |
920 | (unsigned long long)range_end); | ||
934 | BUG_ON(range_start >= range_end); | 921 | BUG_ON(range_start >= range_end); |
935 | 922 | ||
936 | while (zero_pos < range_end) { | 923 | while (zero_pos < range_end) { |
@@ -962,9 +949,9 @@ int ocfs2_zero_extend(struct inode *inode, struct buffer_head *di_bh, | |||
962 | struct super_block *sb = inode->i_sb; | 949 | struct super_block *sb = inode->i_sb; |
963 | 950 | ||
964 | zero_start = ocfs2_align_bytes_to_blocks(sb, i_size_read(inode)); | 951 | zero_start = ocfs2_align_bytes_to_blocks(sb, i_size_read(inode)); |
965 | mlog(0, "zero_start %llu for i_size %llu\n", | 952 | trace_ocfs2_zero_extend((unsigned long long)OCFS2_I(inode)->ip_blkno, |
966 | (unsigned long long)zero_start, | 953 | (unsigned long long)zero_start, |
967 | (unsigned long long)i_size_read(inode)); | 954 | (unsigned long long)i_size_read(inode)); |
968 | while (zero_start < zero_to_size) { | 955 | while (zero_start < zero_to_size) { |
969 | ret = ocfs2_zero_extend_get_range(inode, di_bh, zero_start, | 956 | ret = ocfs2_zero_extend_get_range(inode, di_bh, zero_start, |
970 | zero_to_size, | 957 | zero_to_size, |
@@ -1113,30 +1100,20 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) | |||
1113 | struct dquot *transfer_to[MAXQUOTAS] = { }; | 1100 | struct dquot *transfer_to[MAXQUOTAS] = { }; |
1114 | int qtype; | 1101 | int qtype; |
1115 | 1102 | ||
1116 | mlog_entry("(0x%p, '%.*s')\n", dentry, | 1103 | trace_ocfs2_setattr(inode, dentry, |
1117 | dentry->d_name.len, dentry->d_name.name); | 1104 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
1105 | dentry->d_name.len, dentry->d_name.name, | ||
1106 | attr->ia_valid, attr->ia_mode, | ||
1107 | attr->ia_uid, attr->ia_gid); | ||
1118 | 1108 | ||
1119 | /* ensuring we don't even attempt to truncate a symlink */ | 1109 | /* ensuring we don't even attempt to truncate a symlink */ |
1120 | if (S_ISLNK(inode->i_mode)) | 1110 | if (S_ISLNK(inode->i_mode)) |
1121 | attr->ia_valid &= ~ATTR_SIZE; | 1111 | attr->ia_valid &= ~ATTR_SIZE; |
1122 | 1112 | ||
1123 | if (attr->ia_valid & ATTR_MODE) | ||
1124 | mlog(0, "mode change: %d\n", attr->ia_mode); | ||
1125 | if (attr->ia_valid & ATTR_UID) | ||
1126 | mlog(0, "uid change: %d\n", attr->ia_uid); | ||
1127 | if (attr->ia_valid & ATTR_GID) | ||
1128 | mlog(0, "gid change: %d\n", attr->ia_gid); | ||
1129 | if (attr->ia_valid & ATTR_SIZE) | ||
1130 | mlog(0, "size change...\n"); | ||
1131 | if (attr->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME)) | ||
1132 | mlog(0, "time change...\n"); | ||
1133 | |||
1134 | #define OCFS2_VALID_ATTRS (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_SIZE \ | 1113 | #define OCFS2_VALID_ATTRS (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_SIZE \ |
1135 | | ATTR_GID | ATTR_UID | ATTR_MODE) | 1114 | | ATTR_GID | ATTR_UID | ATTR_MODE) |
1136 | if (!(attr->ia_valid & OCFS2_VALID_ATTRS)) { | 1115 | if (!(attr->ia_valid & OCFS2_VALID_ATTRS)) |
1137 | mlog(0, "can't handle attrs: 0x%x\n", attr->ia_valid); | ||
1138 | return 0; | 1116 | return 0; |
1139 | } | ||
1140 | 1117 | ||
1141 | status = inode_change_ok(inode, attr); | 1118 | status = inode_change_ok(inode, attr); |
1142 | if (status) | 1119 | if (status) |
@@ -1274,7 +1251,6 @@ bail: | |||
1274 | mlog_errno(status); | 1251 | mlog_errno(status); |
1275 | } | 1252 | } |
1276 | 1253 | ||
1277 | mlog_exit(status); | ||
1278 | return status; | 1254 | return status; |
1279 | } | 1255 | } |
1280 | 1256 | ||
@@ -1287,8 +1263,6 @@ int ocfs2_getattr(struct vfsmount *mnt, | |||
1287 | struct ocfs2_super *osb = sb->s_fs_info; | 1263 | struct ocfs2_super *osb = sb->s_fs_info; |
1288 | int err; | 1264 | int err; |
1289 | 1265 | ||
1290 | mlog_entry_void(); | ||
1291 | |||
1292 | err = ocfs2_inode_revalidate(dentry); | 1266 | err = ocfs2_inode_revalidate(dentry); |
1293 | if (err) { | 1267 | if (err) { |
1294 | if (err != -ENOENT) | 1268 | if (err != -ENOENT) |
@@ -1302,8 +1276,6 @@ int ocfs2_getattr(struct vfsmount *mnt, | |||
1302 | stat->blksize = osb->s_clustersize; | 1276 | stat->blksize = osb->s_clustersize; |
1303 | 1277 | ||
1304 | bail: | 1278 | bail: |
1305 | mlog_exit(err); | ||
1306 | |||
1307 | return err; | 1279 | return err; |
1308 | } | 1280 | } |
1309 | 1281 | ||
@@ -1314,8 +1286,6 @@ int ocfs2_permission(struct inode *inode, int mask, unsigned int flags) | |||
1314 | if (flags & IPERM_FLAG_RCU) | 1286 | if (flags & IPERM_FLAG_RCU) |
1315 | return -ECHILD; | 1287 | return -ECHILD; |
1316 | 1288 | ||
1317 | mlog_entry_void(); | ||
1318 | |||
1319 | ret = ocfs2_inode_lock(inode, NULL, 0); | 1289 | ret = ocfs2_inode_lock(inode, NULL, 0); |
1320 | if (ret) { | 1290 | if (ret) { |
1321 | if (ret != -ENOENT) | 1291 | if (ret != -ENOENT) |
@@ -1327,7 +1297,6 @@ int ocfs2_permission(struct inode *inode, int mask, unsigned int flags) | |||
1327 | 1297 | ||
1328 | ocfs2_inode_unlock(inode, 0); | 1298 | ocfs2_inode_unlock(inode, 0); |
1329 | out: | 1299 | out: |
1330 | mlog_exit(ret); | ||
1331 | return ret; | 1300 | return ret; |
1332 | } | 1301 | } |
1333 | 1302 | ||
@@ -1339,8 +1308,9 @@ static int __ocfs2_write_remove_suid(struct inode *inode, | |||
1339 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1308 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1340 | struct ocfs2_dinode *di; | 1309 | struct ocfs2_dinode *di; |
1341 | 1310 | ||
1342 | mlog_entry("(Inode %llu, mode 0%o)\n", | 1311 | trace_ocfs2_write_remove_suid( |
1343 | (unsigned long long)OCFS2_I(inode)->ip_blkno, inode->i_mode); | 1312 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
1313 | inode->i_mode); | ||
1344 | 1314 | ||
1345 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); | 1315 | handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); |
1346 | if (IS_ERR(handle)) { | 1316 | if (IS_ERR(handle)) { |
@@ -1368,7 +1338,6 @@ static int __ocfs2_write_remove_suid(struct inode *inode, | |||
1368 | out_trans: | 1338 | out_trans: |
1369 | ocfs2_commit_trans(osb, handle); | 1339 | ocfs2_commit_trans(osb, handle); |
1370 | out: | 1340 | out: |
1371 | mlog_exit(ret); | ||
1372 | return ret; | 1341 | return ret; |
1373 | } | 1342 | } |
1374 | 1343 | ||
@@ -1547,8 +1516,9 @@ static int ocfs2_zero_partial_clusters(struct inode *inode, | |||
1547 | * partial clusters here. There's no need to worry about | 1516 | * partial clusters here. There's no need to worry about |
1548 | * physical allocation - the zeroing code knows to skip holes. | 1517 | * physical allocation - the zeroing code knows to skip holes. |
1549 | */ | 1518 | */ |
1550 | mlog(0, "byte start: %llu, end: %llu\n", | 1519 | trace_ocfs2_zero_partial_clusters( |
1551 | (unsigned long long)start, (unsigned long long)end); | 1520 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
1521 | (unsigned long long)start, (unsigned long long)end); | ||
1552 | 1522 | ||
1553 | /* | 1523 | /* |
1554 | * If both edges are on a cluster boundary then there's no | 1524 | * If both edges are on a cluster boundary then there's no |
@@ -1572,8 +1542,8 @@ static int ocfs2_zero_partial_clusters(struct inode *inode, | |||
1572 | if (tmpend > end) | 1542 | if (tmpend > end) |
1573 | tmpend = end; | 1543 | tmpend = end; |
1574 | 1544 | ||
1575 | mlog(0, "1st range: start: %llu, tmpend: %llu\n", | 1545 | trace_ocfs2_zero_partial_clusters_range1((unsigned long long)start, |
1576 | (unsigned long long)start, (unsigned long long)tmpend); | 1546 | (unsigned long long)tmpend); |
1577 | 1547 | ||
1578 | ret = ocfs2_zero_range_for_truncate(inode, handle, start, tmpend); | 1548 | ret = ocfs2_zero_range_for_truncate(inode, handle, start, tmpend); |
1579 | if (ret) | 1549 | if (ret) |
@@ -1587,8 +1557,8 @@ static int ocfs2_zero_partial_clusters(struct inode *inode, | |||
1587 | */ | 1557 | */ |
1588 | start = end & ~(osb->s_clustersize - 1); | 1558 | start = end & ~(osb->s_clustersize - 1); |
1589 | 1559 | ||
1590 | mlog(0, "2nd range: start: %llu, end: %llu\n", | 1560 | trace_ocfs2_zero_partial_clusters_range2( |
1591 | (unsigned long long)start, (unsigned long long)end); | 1561 | (unsigned long long)start, (unsigned long long)end); |
1592 | 1562 | ||
1593 | ret = ocfs2_zero_range_for_truncate(inode, handle, start, end); | 1563 | ret = ocfs2_zero_range_for_truncate(inode, handle, start, end); |
1594 | if (ret) | 1564 | if (ret) |
@@ -1688,6 +1658,11 @@ static int ocfs2_remove_inode_range(struct inode *inode, | |||
1688 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh); | 1658 | ocfs2_init_dinode_extent_tree(&et, INODE_CACHE(inode), di_bh); |
1689 | ocfs2_init_dealloc_ctxt(&dealloc); | 1659 | ocfs2_init_dealloc_ctxt(&dealloc); |
1690 | 1660 | ||
1661 | trace_ocfs2_remove_inode_range( | ||
1662 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
1663 | (unsigned long long)byte_start, | ||
1664 | (unsigned long long)byte_len); | ||
1665 | |||
1691 | if (byte_len == 0) | 1666 | if (byte_len == 0) |
1692 | return 0; | 1667 | return 0; |
1693 | 1668 | ||
@@ -1734,11 +1709,6 @@ static int ocfs2_remove_inode_range(struct inode *inode, | |||
1734 | trunc_end = (byte_start + byte_len) >> osb->s_clustersize_bits; | 1709 | trunc_end = (byte_start + byte_len) >> osb->s_clustersize_bits; |
1735 | cluster_in_el = trunc_end; | 1710 | cluster_in_el = trunc_end; |
1736 | 1711 | ||
1737 | mlog(0, "Inode: %llu, start: %llu, len: %llu, cstart: %u, cend: %u\n", | ||
1738 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
1739 | (unsigned long long)byte_start, | ||
1740 | (unsigned long long)byte_len, trunc_start, trunc_end); | ||
1741 | |||
1742 | ret = ocfs2_zero_partial_clusters(inode, byte_start, byte_len); | 1712 | ret = ocfs2_zero_partial_clusters(inode, byte_start, byte_len); |
1743 | if (ret) { | 1713 | if (ret) { |
1744 | mlog_errno(ret); | 1714 | mlog_errno(ret); |
@@ -2093,7 +2063,7 @@ static int ocfs2_prepare_inode_for_write(struct file *file, | |||
2093 | int ret = 0, meta_level = 0; | 2063 | int ret = 0, meta_level = 0; |
2094 | struct dentry *dentry = file->f_path.dentry; | 2064 | struct dentry *dentry = file->f_path.dentry; |
2095 | struct inode *inode = dentry->d_inode; | 2065 | struct inode *inode = dentry->d_inode; |
2096 | loff_t saved_pos, end; | 2066 | loff_t saved_pos = 0, end; |
2097 | 2067 | ||
2098 | /* | 2068 | /* |
2099 | * We start with a read level meta lock and only jump to an ex | 2069 | * We start with a read level meta lock and only jump to an ex |
@@ -2132,12 +2102,10 @@ static int ocfs2_prepare_inode_for_write(struct file *file, | |||
2132 | 2102 | ||
2133 | /* work on a copy of ppos until we're sure that we won't have | 2103 | /* work on a copy of ppos until we're sure that we won't have |
2134 | * to recalculate it due to relocking. */ | 2104 | * to recalculate it due to relocking. */ |
2135 | if (appending) { | 2105 | if (appending) |
2136 | saved_pos = i_size_read(inode); | 2106 | saved_pos = i_size_read(inode); |
2137 | mlog(0, "O_APPEND: inode->i_size=%llu\n", saved_pos); | 2107 | else |
2138 | } else { | ||
2139 | saved_pos = *ppos; | 2108 | saved_pos = *ppos; |
2140 | } | ||
2141 | 2109 | ||
2142 | end = saved_pos + count; | 2110 | end = saved_pos + count; |
2143 | 2111 | ||
@@ -2208,6 +2176,10 @@ static int ocfs2_prepare_inode_for_write(struct file *file, | |||
2208 | *ppos = saved_pos; | 2176 | *ppos = saved_pos; |
2209 | 2177 | ||
2210 | out_unlock: | 2178 | out_unlock: |
2179 | trace_ocfs2_prepare_inode_for_write(OCFS2_I(inode)->ip_blkno, | ||
2180 | saved_pos, appending, count, | ||
2181 | direct_io, has_refcount); | ||
2182 | |||
2211 | if (meta_level >= 0) | 2183 | if (meta_level >= 0) |
2212 | ocfs2_inode_unlock(inode, meta_level); | 2184 | ocfs2_inode_unlock(inode, meta_level); |
2213 | 2185 | ||
@@ -2233,10 +2205,11 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, | |||
2233 | int full_coherency = !(osb->s_mount_opt & | 2205 | int full_coherency = !(osb->s_mount_opt & |
2234 | OCFS2_MOUNT_COHERENCY_BUFFERED); | 2206 | OCFS2_MOUNT_COHERENCY_BUFFERED); |
2235 | 2207 | ||
2236 | mlog_entry("(0x%p, %u, '%.*s')\n", file, | 2208 | trace_ocfs2_file_aio_write(inode, file, file->f_path.dentry, |
2237 | (unsigned int)nr_segs, | 2209 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
2238 | file->f_path.dentry->d_name.len, | 2210 | file->f_path.dentry->d_name.len, |
2239 | file->f_path.dentry->d_name.name); | 2211 | file->f_path.dentry->d_name.name, |
2212 | (unsigned int)nr_segs); | ||
2240 | 2213 | ||
2241 | if (iocb->ki_left == 0) | 2214 | if (iocb->ki_left == 0) |
2242 | return 0; | 2215 | return 0; |
@@ -2402,7 +2375,6 @@ out_sems: | |||
2402 | 2375 | ||
2403 | if (written) | 2376 | if (written) |
2404 | ret = written; | 2377 | ret = written; |
2405 | mlog_exit(ret); | ||
2406 | return ret; | 2378 | return ret; |
2407 | } | 2379 | } |
2408 | 2380 | ||
@@ -2438,10 +2410,11 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe, | |||
2438 | .u.file = out, | 2410 | .u.file = out, |
2439 | }; | 2411 | }; |
2440 | 2412 | ||
2441 | mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", out, pipe, | 2413 | |
2442 | (unsigned int)len, | 2414 | trace_ocfs2_file_splice_write(inode, out, out->f_path.dentry, |
2443 | out->f_path.dentry->d_name.len, | 2415 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
2444 | out->f_path.dentry->d_name.name); | 2416 | out->f_path.dentry->d_name.len, |
2417 | out->f_path.dentry->d_name.name, len); | ||
2445 | 2418 | ||
2446 | if (pipe->inode) | 2419 | if (pipe->inode) |
2447 | mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_PARENT); | 2420 | mutex_lock_nested(&pipe->inode->i_mutex, I_MUTEX_PARENT); |
@@ -2485,7 +2458,6 @@ static ssize_t ocfs2_file_splice_write(struct pipe_inode_info *pipe, | |||
2485 | balance_dirty_pages_ratelimited_nr(mapping, nr_pages); | 2458 | balance_dirty_pages_ratelimited_nr(mapping, nr_pages); |
2486 | } | 2459 | } |
2487 | 2460 | ||
2488 | mlog_exit(ret); | ||
2489 | return ret; | 2461 | return ret; |
2490 | } | 2462 | } |
2491 | 2463 | ||
@@ -2498,10 +2470,10 @@ static ssize_t ocfs2_file_splice_read(struct file *in, | |||
2498 | int ret = 0, lock_level = 0; | 2470 | int ret = 0, lock_level = 0; |
2499 | struct inode *inode = in->f_path.dentry->d_inode; | 2471 | struct inode *inode = in->f_path.dentry->d_inode; |
2500 | 2472 | ||
2501 | mlog_entry("(0x%p, 0x%p, %u, '%.*s')\n", in, pipe, | 2473 | trace_ocfs2_file_splice_read(inode, in, in->f_path.dentry, |
2502 | (unsigned int)len, | 2474 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
2503 | in->f_path.dentry->d_name.len, | 2475 | in->f_path.dentry->d_name.len, |
2504 | in->f_path.dentry->d_name.name); | 2476 | in->f_path.dentry->d_name.name, len); |
2505 | 2477 | ||
2506 | /* | 2478 | /* |
2507 | * See the comment in ocfs2_file_aio_read() | 2479 | * See the comment in ocfs2_file_aio_read() |
@@ -2516,7 +2488,6 @@ static ssize_t ocfs2_file_splice_read(struct file *in, | |||
2516 | ret = generic_file_splice_read(in, ppos, pipe, len, flags); | 2488 | ret = generic_file_splice_read(in, ppos, pipe, len, flags); |
2517 | 2489 | ||
2518 | bail: | 2490 | bail: |
2519 | mlog_exit(ret); | ||
2520 | return ret; | 2491 | return ret; |
2521 | } | 2492 | } |
2522 | 2493 | ||
@@ -2529,10 +2500,11 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, | |||
2529 | struct file *filp = iocb->ki_filp; | 2500 | struct file *filp = iocb->ki_filp; |
2530 | struct inode *inode = filp->f_path.dentry->d_inode; | 2501 | struct inode *inode = filp->f_path.dentry->d_inode; |
2531 | 2502 | ||
2532 | mlog_entry("(0x%p, %u, '%.*s')\n", filp, | 2503 | trace_ocfs2_file_aio_read(inode, filp, filp->f_path.dentry, |
2533 | (unsigned int)nr_segs, | 2504 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
2534 | filp->f_path.dentry->d_name.len, | 2505 | filp->f_path.dentry->d_name.len, |
2535 | filp->f_path.dentry->d_name.name); | 2506 | filp->f_path.dentry->d_name.name, nr_segs); |
2507 | |||
2536 | 2508 | ||
2537 | if (!inode) { | 2509 | if (!inode) { |
2538 | ret = -EINVAL; | 2510 | ret = -EINVAL; |
@@ -2578,8 +2550,7 @@ static ssize_t ocfs2_file_aio_read(struct kiocb *iocb, | |||
2578 | ocfs2_inode_unlock(inode, lock_level); | 2550 | ocfs2_inode_unlock(inode, lock_level); |
2579 | 2551 | ||
2580 | ret = generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos); | 2552 | ret = generic_file_aio_read(iocb, iov, nr_segs, iocb->ki_pos); |
2581 | if (ret == -EINVAL) | 2553 | trace_generic_file_aio_read_ret(ret); |
2582 | mlog(0, "generic_file_aio_read returned -EINVAL\n"); | ||
2583 | 2554 | ||
2584 | /* buffered aio wouldn't have proper lock coverage today */ | 2555 | /* buffered aio wouldn't have proper lock coverage today */ |
2585 | BUG_ON(ret == -EIOCBQUEUED && !(filp->f_flags & O_DIRECT)); | 2556 | BUG_ON(ret == -EIOCBQUEUED && !(filp->f_flags & O_DIRECT)); |
@@ -2597,7 +2568,6 @@ bail: | |||
2597 | } | 2568 | } |
2598 | if (rw_level != -1) | 2569 | if (rw_level != -1) |
2599 | ocfs2_rw_unlock(inode, rw_level); | 2570 | ocfs2_rw_unlock(inode, rw_level); |
2600 | mlog_exit(ret); | ||
2601 | 2571 | ||
2602 | return ret; | 2572 | return ret; |
2603 | } | 2573 | } |
diff --git a/fs/ocfs2/heartbeat.c b/fs/ocfs2/heartbeat.c index 1aa863dd901f..d8208b20dc53 100644 --- a/fs/ocfs2/heartbeat.c +++ b/fs/ocfs2/heartbeat.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | #include <linux/highmem.h> | 29 | #include <linux/highmem.h> |
30 | 30 | ||
31 | #define MLOG_MASK_PREFIX ML_SUPER | ||
32 | #include <cluster/masklog.h> | 31 | #include <cluster/masklog.h> |
33 | 32 | ||
34 | #include "ocfs2.h" | 33 | #include "ocfs2.h" |
@@ -37,6 +36,7 @@ | |||
37 | #include "heartbeat.h" | 36 | #include "heartbeat.h" |
38 | #include "inode.h" | 37 | #include "inode.h" |
39 | #include "journal.h" | 38 | #include "journal.h" |
39 | #include "ocfs2_trace.h" | ||
40 | 40 | ||
41 | #include "buffer_head_io.h" | 41 | #include "buffer_head_io.h" |
42 | 42 | ||
@@ -66,7 +66,7 @@ void ocfs2_do_node_down(int node_num, void *data) | |||
66 | 66 | ||
67 | BUG_ON(osb->node_num == node_num); | 67 | BUG_ON(osb->node_num == node_num); |
68 | 68 | ||
69 | mlog(0, "ocfs2: node down event for %d\n", node_num); | 69 | trace_ocfs2_do_node_down(node_num); |
70 | 70 | ||
71 | if (!osb->cconn) { | 71 | if (!osb->cconn) { |
72 | /* | 72 | /* |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 4068c6c4c6f6..177d3a6c2a5f 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -31,7 +31,6 @@ | |||
31 | 31 | ||
32 | #include <asm/byteorder.h> | 32 | #include <asm/byteorder.h> |
33 | 33 | ||
34 | #define MLOG_MASK_PREFIX ML_INODE | ||
35 | #include <cluster/masklog.h> | 34 | #include <cluster/masklog.h> |
36 | 35 | ||
37 | #include "ocfs2.h" | 36 | #include "ocfs2.h" |
@@ -53,6 +52,7 @@ | |||
53 | #include "uptodate.h" | 52 | #include "uptodate.h" |
54 | #include "xattr.h" | 53 | #include "xattr.h" |
55 | #include "refcounttree.h" | 54 | #include "refcounttree.h" |
55 | #include "ocfs2_trace.h" | ||
56 | 56 | ||
57 | #include "buffer_head_io.h" | 57 | #include "buffer_head_io.h" |
58 | 58 | ||
@@ -131,7 +131,8 @@ struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags, | |||
131 | struct super_block *sb = osb->sb; | 131 | struct super_block *sb = osb->sb; |
132 | struct ocfs2_find_inode_args args; | 132 | struct ocfs2_find_inode_args args; |
133 | 133 | ||
134 | mlog_entry("(blkno = %llu)\n", (unsigned long long)blkno); | 134 | trace_ocfs2_iget_begin((unsigned long long)blkno, flags, |
135 | sysfile_type); | ||
135 | 136 | ||
136 | /* Ok. By now we've either got the offsets passed to us by the | 137 | /* Ok. By now we've either got the offsets passed to us by the |
137 | * caller, or we just pulled them off the bh. Lets do some | 138 | * caller, or we just pulled them off the bh. Lets do some |
@@ -152,16 +153,16 @@ struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags, | |||
152 | /* inode was *not* in the inode cache. 2.6.x requires | 153 | /* inode was *not* in the inode cache. 2.6.x requires |
153 | * us to do our own read_inode call and unlock it | 154 | * us to do our own read_inode call and unlock it |
154 | * afterwards. */ | 155 | * afterwards. */ |
155 | if (inode && inode->i_state & I_NEW) { | ||
156 | mlog(0, "Inode was not in inode cache, reading it.\n"); | ||
157 | ocfs2_read_locked_inode(inode, &args); | ||
158 | unlock_new_inode(inode); | ||
159 | } | ||
160 | if (inode == NULL) { | 156 | if (inode == NULL) { |
161 | inode = ERR_PTR(-ENOMEM); | 157 | inode = ERR_PTR(-ENOMEM); |
162 | mlog_errno(PTR_ERR(inode)); | 158 | mlog_errno(PTR_ERR(inode)); |
163 | goto bail; | 159 | goto bail; |
164 | } | 160 | } |
161 | trace_ocfs2_iget5_locked(inode->i_state); | ||
162 | if (inode->i_state & I_NEW) { | ||
163 | ocfs2_read_locked_inode(inode, &args); | ||
164 | unlock_new_inode(inode); | ||
165 | } | ||
165 | if (is_bad_inode(inode)) { | 166 | if (is_bad_inode(inode)) { |
166 | iput(inode); | 167 | iput(inode); |
167 | inode = ERR_PTR(-ESTALE); | 168 | inode = ERR_PTR(-ESTALE); |
@@ -170,9 +171,8 @@ struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 blkno, unsigned flags, | |||
170 | 171 | ||
171 | bail: | 172 | bail: |
172 | if (!IS_ERR(inode)) { | 173 | if (!IS_ERR(inode)) { |
173 | mlog(0, "returning inode with number %llu\n", | 174 | trace_ocfs2_iget_end(inode, |
174 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | 175 | (unsigned long long)OCFS2_I(inode)->ip_blkno); |
175 | mlog_exit_ptr(inode); | ||
176 | } | 176 | } |
177 | 177 | ||
178 | return inode; | 178 | return inode; |
@@ -192,18 +192,17 @@ static int ocfs2_find_actor(struct inode *inode, void *opaque) | |||
192 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 192 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
193 | int ret = 0; | 193 | int ret = 0; |
194 | 194 | ||
195 | mlog_entry("(0x%p, %lu, 0x%p)\n", inode, inode->i_ino, opaque); | ||
196 | |||
197 | args = opaque; | 195 | args = opaque; |
198 | 196 | ||
199 | mlog_bug_on_msg(!inode, "No inode in find actor!\n"); | 197 | mlog_bug_on_msg(!inode, "No inode in find actor!\n"); |
200 | 198 | ||
199 | trace_ocfs2_find_actor(inode, inode->i_ino, opaque, args->fi_blkno); | ||
200 | |||
201 | if (oi->ip_blkno != args->fi_blkno) | 201 | if (oi->ip_blkno != args->fi_blkno) |
202 | goto bail; | 202 | goto bail; |
203 | 203 | ||
204 | ret = 1; | 204 | ret = 1; |
205 | bail: | 205 | bail: |
206 | mlog_exit(ret); | ||
207 | return ret; | 206 | return ret; |
208 | } | 207 | } |
209 | 208 | ||
@@ -218,8 +217,6 @@ static int ocfs2_init_locked_inode(struct inode *inode, void *opaque) | |||
218 | static struct lock_class_key ocfs2_quota_ip_alloc_sem_key, | 217 | static struct lock_class_key ocfs2_quota_ip_alloc_sem_key, |
219 | ocfs2_file_ip_alloc_sem_key; | 218 | ocfs2_file_ip_alloc_sem_key; |
220 | 219 | ||
221 | mlog_entry("inode = %p, opaque = %p\n", inode, opaque); | ||
222 | |||
223 | inode->i_ino = args->fi_ino; | 220 | inode->i_ino = args->fi_ino; |
224 | OCFS2_I(inode)->ip_blkno = args->fi_blkno; | 221 | OCFS2_I(inode)->ip_blkno = args->fi_blkno; |
225 | if (args->fi_sysfile_type != 0) | 222 | if (args->fi_sysfile_type != 0) |
@@ -235,7 +232,6 @@ static int ocfs2_init_locked_inode(struct inode *inode, void *opaque) | |||
235 | lockdep_set_class(&OCFS2_I(inode)->ip_alloc_sem, | 232 | lockdep_set_class(&OCFS2_I(inode)->ip_alloc_sem, |
236 | &ocfs2_file_ip_alloc_sem_key); | 233 | &ocfs2_file_ip_alloc_sem_key); |
237 | 234 | ||
238 | mlog_exit(0); | ||
239 | return 0; | 235 | return 0; |
240 | } | 236 | } |
241 | 237 | ||
@@ -246,9 +242,6 @@ void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, | |||
246 | struct ocfs2_super *osb; | 242 | struct ocfs2_super *osb; |
247 | int use_plocks = 1; | 243 | int use_plocks = 1; |
248 | 244 | ||
249 | mlog_entry("(0x%p, size:%llu)\n", inode, | ||
250 | (unsigned long long)le64_to_cpu(fe->i_size)); | ||
251 | |||
252 | sb = inode->i_sb; | 245 | sb = inode->i_sb; |
253 | osb = OCFS2_SB(sb); | 246 | osb = OCFS2_SB(sb); |
254 | 247 | ||
@@ -300,20 +293,20 @@ void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, | |||
300 | 293 | ||
301 | inode->i_nlink = ocfs2_read_links_count(fe); | 294 | inode->i_nlink = ocfs2_read_links_count(fe); |
302 | 295 | ||
296 | trace_ocfs2_populate_inode(OCFS2_I(inode)->ip_blkno, | ||
297 | le32_to_cpu(fe->i_flags)); | ||
303 | if (fe->i_flags & cpu_to_le32(OCFS2_SYSTEM_FL)) { | 298 | if (fe->i_flags & cpu_to_le32(OCFS2_SYSTEM_FL)) { |
304 | OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SYSTEM_FILE; | 299 | OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SYSTEM_FILE; |
305 | inode->i_flags |= S_NOQUOTA; | 300 | inode->i_flags |= S_NOQUOTA; |
306 | } | 301 | } |
307 | 302 | ||
308 | if (fe->i_flags & cpu_to_le32(OCFS2_LOCAL_ALLOC_FL)) { | 303 | if (fe->i_flags & cpu_to_le32(OCFS2_LOCAL_ALLOC_FL)) { |
309 | OCFS2_I(inode)->ip_flags |= OCFS2_INODE_BITMAP; | 304 | OCFS2_I(inode)->ip_flags |= OCFS2_INODE_BITMAP; |
310 | mlog(0, "local alloc inode: i_ino=%lu\n", inode->i_ino); | ||
311 | } else if (fe->i_flags & cpu_to_le32(OCFS2_BITMAP_FL)) { | 305 | } else if (fe->i_flags & cpu_to_le32(OCFS2_BITMAP_FL)) { |
312 | OCFS2_I(inode)->ip_flags |= OCFS2_INODE_BITMAP; | 306 | OCFS2_I(inode)->ip_flags |= OCFS2_INODE_BITMAP; |
313 | } else if (fe->i_flags & cpu_to_le32(OCFS2_QUOTA_FL)) { | 307 | } else if (fe->i_flags & cpu_to_le32(OCFS2_QUOTA_FL)) { |
314 | inode->i_flags |= S_NOQUOTA; | 308 | inode->i_flags |= S_NOQUOTA; |
315 | } else if (fe->i_flags & cpu_to_le32(OCFS2_SUPER_BLOCK_FL)) { | 309 | } else if (fe->i_flags & cpu_to_le32(OCFS2_SUPER_BLOCK_FL)) { |
316 | mlog(0, "superblock inode: i_ino=%lu\n", inode->i_ino); | ||
317 | /* we can't actually hit this as read_inode can't | 310 | /* we can't actually hit this as read_inode can't |
318 | * handle superblocks today ;-) */ | 311 | * handle superblocks today ;-) */ |
319 | BUG(); | 312 | BUG(); |
@@ -381,7 +374,6 @@ void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, | |||
381 | if (S_ISDIR(inode->i_mode)) | 374 | if (S_ISDIR(inode->i_mode)) |
382 | ocfs2_resv_set_type(&OCFS2_I(inode)->ip_la_data_resv, | 375 | ocfs2_resv_set_type(&OCFS2_I(inode)->ip_la_data_resv, |
383 | OCFS2_RESV_FLAG_DIR); | 376 | OCFS2_RESV_FLAG_DIR); |
384 | mlog_exit_void(); | ||
385 | } | 377 | } |
386 | 378 | ||
387 | static int ocfs2_read_locked_inode(struct inode *inode, | 379 | static int ocfs2_read_locked_inode(struct inode *inode, |
@@ -394,8 +386,6 @@ static int ocfs2_read_locked_inode(struct inode *inode, | |||
394 | int status, can_lock; | 386 | int status, can_lock; |
395 | u32 generation = 0; | 387 | u32 generation = 0; |
396 | 388 | ||
397 | mlog_entry("(0x%p, 0x%p)\n", inode, args); | ||
398 | |||
399 | status = -EINVAL; | 389 | status = -EINVAL; |
400 | if (inode == NULL || inode->i_sb == NULL) { | 390 | if (inode == NULL || inode->i_sb == NULL) { |
401 | mlog(ML_ERROR, "bad inode\n"); | 391 | mlog(ML_ERROR, "bad inode\n"); |
@@ -443,6 +433,9 @@ static int ocfs2_read_locked_inode(struct inode *inode, | |||
443 | && !(args->fi_flags & OCFS2_FI_FLAG_ORPHAN_RECOVERY) | 433 | && !(args->fi_flags & OCFS2_FI_FLAG_ORPHAN_RECOVERY) |
444 | && !ocfs2_mount_local(osb); | 434 | && !ocfs2_mount_local(osb); |
445 | 435 | ||
436 | trace_ocfs2_read_locked_inode( | ||
437 | (unsigned long long)OCFS2_I(inode)->ip_blkno, can_lock); | ||
438 | |||
446 | /* | 439 | /* |
447 | * To maintain backwards compatibility with older versions of | 440 | * To maintain backwards compatibility with older versions of |
448 | * ocfs2-tools, we still store the generation value for system | 441 | * ocfs2-tools, we still store the generation value for system |
@@ -534,7 +527,6 @@ bail: | |||
534 | if (args && bh) | 527 | if (args && bh) |
535 | brelse(bh); | 528 | brelse(bh); |
536 | 529 | ||
537 | mlog_exit(status); | ||
538 | return status; | 530 | return status; |
539 | } | 531 | } |
540 | 532 | ||
@@ -551,8 +543,6 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb, | |||
551 | struct ocfs2_dinode *fe; | 543 | struct ocfs2_dinode *fe; |
552 | handle_t *handle = NULL; | 544 | handle_t *handle = NULL; |
553 | 545 | ||
554 | mlog_entry_void(); | ||
555 | |||
556 | fe = (struct ocfs2_dinode *) fe_bh->b_data; | 546 | fe = (struct ocfs2_dinode *) fe_bh->b_data; |
557 | 547 | ||
558 | /* | 548 | /* |
@@ -600,7 +590,6 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb, | |||
600 | out: | 590 | out: |
601 | if (handle) | 591 | if (handle) |
602 | ocfs2_commit_trans(osb, handle); | 592 | ocfs2_commit_trans(osb, handle); |
603 | mlog_exit(status); | ||
604 | return status; | 593 | return status; |
605 | } | 594 | } |
606 | 595 | ||
@@ -696,8 +685,6 @@ static int ocfs2_check_orphan_recovery_state(struct ocfs2_super *osb, | |||
696 | 685 | ||
697 | spin_lock(&osb->osb_lock); | 686 | spin_lock(&osb->osb_lock); |
698 | if (ocfs2_node_map_test_bit(osb, &osb->osb_recovering_orphan_dirs, slot)) { | 687 | if (ocfs2_node_map_test_bit(osb, &osb->osb_recovering_orphan_dirs, slot)) { |
699 | mlog(0, "Recovery is happening on orphan dir %d, will skip " | ||
700 | "this inode\n", slot); | ||
701 | ret = -EDEADLK; | 688 | ret = -EDEADLK; |
702 | goto out; | 689 | goto out; |
703 | } | 690 | } |
@@ -706,6 +693,7 @@ static int ocfs2_check_orphan_recovery_state(struct ocfs2_super *osb, | |||
706 | osb->osb_orphan_wipes[slot]++; | 693 | osb->osb_orphan_wipes[slot]++; |
707 | out: | 694 | out: |
708 | spin_unlock(&osb->osb_lock); | 695 | spin_unlock(&osb->osb_lock); |
696 | trace_ocfs2_check_orphan_recovery_state(slot, ret); | ||
709 | return ret; | 697 | return ret; |
710 | } | 698 | } |
711 | 699 | ||
@@ -816,6 +804,10 @@ static int ocfs2_inode_is_valid_to_delete(struct inode *inode) | |||
816 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 804 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
817 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 805 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
818 | 806 | ||
807 | trace_ocfs2_inode_is_valid_to_delete(current, osb->dc_task, | ||
808 | (unsigned long long)oi->ip_blkno, | ||
809 | oi->ip_flags); | ||
810 | |||
819 | /* We shouldn't be getting here for the root directory | 811 | /* We shouldn't be getting here for the root directory |
820 | * inode.. */ | 812 | * inode.. */ |
821 | if (inode == osb->root_inode) { | 813 | if (inode == osb->root_inode) { |
@@ -828,11 +820,8 @@ static int ocfs2_inode_is_valid_to_delete(struct inode *inode) | |||
828 | * have to skip deleting this guy. That's OK though because | 820 | * have to skip deleting this guy. That's OK though because |
829 | * the node who's doing the actual deleting should handle it | 821 | * the node who's doing the actual deleting should handle it |
830 | * anyway. */ | 822 | * anyway. */ |
831 | if (current == osb->dc_task) { | 823 | if (current == osb->dc_task) |
832 | mlog(0, "Skipping delete of %lu because we're currently " | ||
833 | "in downconvert\n", inode->i_ino); | ||
834 | goto bail; | 824 | goto bail; |
835 | } | ||
836 | 825 | ||
837 | spin_lock(&oi->ip_lock); | 826 | spin_lock(&oi->ip_lock); |
838 | /* OCFS2 *never* deletes system files. This should technically | 827 | /* OCFS2 *never* deletes system files. This should technically |
@@ -847,11 +836,8 @@ static int ocfs2_inode_is_valid_to_delete(struct inode *inode) | |||
847 | /* If we have allowd wipe of this inode for another node, it | 836 | /* If we have allowd wipe of this inode for another node, it |
848 | * will be marked here so we can safely skip it. Recovery will | 837 | * will be marked here so we can safely skip it. Recovery will |
849 | * cleanup any inodes we might inadvertantly skip here. */ | 838 | * cleanup any inodes we might inadvertantly skip here. */ |
850 | if (oi->ip_flags & OCFS2_INODE_SKIP_DELETE) { | 839 | if (oi->ip_flags & OCFS2_INODE_SKIP_DELETE) |
851 | mlog(0, "Skipping delete of %lu because another node " | ||
852 | "has done this for us.\n", inode->i_ino); | ||
853 | goto bail_unlock; | 840 | goto bail_unlock; |
854 | } | ||
855 | 841 | ||
856 | ret = 1; | 842 | ret = 1; |
857 | bail_unlock: | 843 | bail_unlock: |
@@ -868,28 +854,27 @@ static int ocfs2_query_inode_wipe(struct inode *inode, | |||
868 | struct buffer_head *di_bh, | 854 | struct buffer_head *di_bh, |
869 | int *wipe) | 855 | int *wipe) |
870 | { | 856 | { |
871 | int status = 0; | 857 | int status = 0, reason = 0; |
872 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 858 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
873 | struct ocfs2_dinode *di; | 859 | struct ocfs2_dinode *di; |
874 | 860 | ||
875 | *wipe = 0; | 861 | *wipe = 0; |
876 | 862 | ||
863 | trace_ocfs2_query_inode_wipe_begin((unsigned long long)oi->ip_blkno, | ||
864 | inode->i_nlink); | ||
865 | |||
877 | /* While we were waiting for the cluster lock in | 866 | /* While we were waiting for the cluster lock in |
878 | * ocfs2_delete_inode, another node might have asked to delete | 867 | * ocfs2_delete_inode, another node might have asked to delete |
879 | * the inode. Recheck our flags to catch this. */ | 868 | * the inode. Recheck our flags to catch this. */ |
880 | if (!ocfs2_inode_is_valid_to_delete(inode)) { | 869 | if (!ocfs2_inode_is_valid_to_delete(inode)) { |
881 | mlog(0, "Skipping delete of %llu because flags changed\n", | 870 | reason = 1; |
882 | (unsigned long long)oi->ip_blkno); | ||
883 | goto bail; | 871 | goto bail; |
884 | } | 872 | } |
885 | 873 | ||
886 | /* Now that we have an up to date inode, we can double check | 874 | /* Now that we have an up to date inode, we can double check |
887 | * the link count. */ | 875 | * the link count. */ |
888 | if (inode->i_nlink) { | 876 | if (inode->i_nlink) |
889 | mlog(0, "Skipping delete of %llu because nlink = %u\n", | ||
890 | (unsigned long long)oi->ip_blkno, inode->i_nlink); | ||
891 | goto bail; | 877 | goto bail; |
892 | } | ||
893 | 878 | ||
894 | /* Do some basic inode verification... */ | 879 | /* Do some basic inode verification... */ |
895 | di = (struct ocfs2_dinode *) di_bh->b_data; | 880 | di = (struct ocfs2_dinode *) di_bh->b_data; |
@@ -904,9 +889,7 @@ static int ocfs2_query_inode_wipe(struct inode *inode, | |||
904 | * ORPHANED_FL not. | 889 | * ORPHANED_FL not. |
905 | */ | 890 | */ |
906 | if (di->i_dyn_features & cpu_to_le16(OCFS2_HAS_REFCOUNT_FL)) { | 891 | if (di->i_dyn_features & cpu_to_le16(OCFS2_HAS_REFCOUNT_FL)) { |
907 | mlog(0, "Reflinked inode %llu is no longer orphaned. " | 892 | reason = 2; |
908 | "it shouldn't be deleted\n", | ||
909 | (unsigned long long)oi->ip_blkno); | ||
910 | goto bail; | 893 | goto bail; |
911 | } | 894 | } |
912 | 895 | ||
@@ -943,8 +926,7 @@ static int ocfs2_query_inode_wipe(struct inode *inode, | |||
943 | status = ocfs2_try_open_lock(inode, 1); | 926 | status = ocfs2_try_open_lock(inode, 1); |
944 | if (status == -EAGAIN) { | 927 | if (status == -EAGAIN) { |
945 | status = 0; | 928 | status = 0; |
946 | mlog(0, "Skipping delete of %llu because it is in use on " | 929 | reason = 3; |
947 | "other nodes\n", (unsigned long long)oi->ip_blkno); | ||
948 | goto bail; | 930 | goto bail; |
949 | } | 931 | } |
950 | if (status < 0) { | 932 | if (status < 0) { |
@@ -953,11 +935,10 @@ static int ocfs2_query_inode_wipe(struct inode *inode, | |||
953 | } | 935 | } |
954 | 936 | ||
955 | *wipe = 1; | 937 | *wipe = 1; |
956 | mlog(0, "Inode %llu is ok to wipe from orphan dir %u\n", | 938 | trace_ocfs2_query_inode_wipe_succ(le16_to_cpu(di->i_orphaned_slot)); |
957 | (unsigned long long)oi->ip_blkno, | ||
958 | le16_to_cpu(di->i_orphaned_slot)); | ||
959 | 939 | ||
960 | bail: | 940 | bail: |
941 | trace_ocfs2_query_inode_wipe_end(status, reason); | ||
961 | return status; | 942 | return status; |
962 | } | 943 | } |
963 | 944 | ||
@@ -967,8 +948,8 @@ bail: | |||
967 | static void ocfs2_cleanup_delete_inode(struct inode *inode, | 948 | static void ocfs2_cleanup_delete_inode(struct inode *inode, |
968 | int sync_data) | 949 | int sync_data) |
969 | { | 950 | { |
970 | mlog(0, "Cleanup inode %llu, sync = %d\n", | 951 | trace_ocfs2_cleanup_delete_inode( |
971 | (unsigned long long)OCFS2_I(inode)->ip_blkno, sync_data); | 952 | (unsigned long long)OCFS2_I(inode)->ip_blkno, sync_data); |
972 | if (sync_data) | 953 | if (sync_data) |
973 | write_inode_now(inode, 1); | 954 | write_inode_now(inode, 1); |
974 | truncate_inode_pages(&inode->i_data, 0); | 955 | truncate_inode_pages(&inode->i_data, 0); |
@@ -980,15 +961,15 @@ static void ocfs2_delete_inode(struct inode *inode) | |||
980 | sigset_t oldset; | 961 | sigset_t oldset; |
981 | struct buffer_head *di_bh = NULL; | 962 | struct buffer_head *di_bh = NULL; |
982 | 963 | ||
983 | mlog_entry("(inode->i_ino = %lu)\n", inode->i_ino); | 964 | trace_ocfs2_delete_inode(inode->i_ino, |
965 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
966 | is_bad_inode(inode)); | ||
984 | 967 | ||
985 | /* When we fail in read_inode() we mark inode as bad. The second test | 968 | /* When we fail in read_inode() we mark inode as bad. The second test |
986 | * catches the case when inode allocation fails before allocating | 969 | * catches the case when inode allocation fails before allocating |
987 | * a block for inode. */ | 970 | * a block for inode. */ |
988 | if (is_bad_inode(inode) || !OCFS2_I(inode)->ip_blkno) { | 971 | if (is_bad_inode(inode) || !OCFS2_I(inode)->ip_blkno) |
989 | mlog(0, "Skipping delete of bad inode\n"); | ||
990 | goto bail; | 972 | goto bail; |
991 | } | ||
992 | 973 | ||
993 | dquot_initialize(inode); | 974 | dquot_initialize(inode); |
994 | 975 | ||
@@ -1080,7 +1061,7 @@ bail_unlock_nfs_sync: | |||
1080 | bail_unblock: | 1061 | bail_unblock: |
1081 | ocfs2_unblock_signals(&oldset); | 1062 | ocfs2_unblock_signals(&oldset); |
1082 | bail: | 1063 | bail: |
1083 | mlog_exit_void(); | 1064 | return; |
1084 | } | 1065 | } |
1085 | 1066 | ||
1086 | static void ocfs2_clear_inode(struct inode *inode) | 1067 | static void ocfs2_clear_inode(struct inode *inode) |
@@ -1088,11 +1069,9 @@ static void ocfs2_clear_inode(struct inode *inode) | |||
1088 | int status; | 1069 | int status; |
1089 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 1070 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
1090 | 1071 | ||
1091 | mlog_entry_void(); | ||
1092 | |||
1093 | end_writeback(inode); | 1072 | end_writeback(inode); |
1094 | mlog(0, "Clearing inode: %llu, nlink = %u\n", | 1073 | trace_ocfs2_clear_inode((unsigned long long)oi->ip_blkno, |
1095 | (unsigned long long)OCFS2_I(inode)->ip_blkno, inode->i_nlink); | 1074 | inode->i_nlink); |
1096 | 1075 | ||
1097 | mlog_bug_on_msg(OCFS2_SB(inode->i_sb) == NULL, | 1076 | mlog_bug_on_msg(OCFS2_SB(inode->i_sb) == NULL, |
1098 | "Inode=%lu\n", inode->i_ino); | 1077 | "Inode=%lu\n", inode->i_ino); |
@@ -1181,8 +1160,6 @@ static void ocfs2_clear_inode(struct inode *inode) | |||
1181 | */ | 1160 | */ |
1182 | jbd2_journal_release_jbd_inode(OCFS2_SB(inode->i_sb)->journal->j_journal, | 1161 | jbd2_journal_release_jbd_inode(OCFS2_SB(inode->i_sb)->journal->j_journal, |
1183 | &oi->ip_jinode); | 1162 | &oi->ip_jinode); |
1184 | |||
1185 | mlog_exit_void(); | ||
1186 | } | 1163 | } |
1187 | 1164 | ||
1188 | void ocfs2_evict_inode(struct inode *inode) | 1165 | void ocfs2_evict_inode(struct inode *inode) |
@@ -1204,17 +1181,14 @@ int ocfs2_drop_inode(struct inode *inode) | |||
1204 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 1181 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
1205 | int res; | 1182 | int res; |
1206 | 1183 | ||
1207 | mlog_entry_void(); | 1184 | trace_ocfs2_drop_inode((unsigned long long)oi->ip_blkno, |
1208 | 1185 | inode->i_nlink, oi->ip_flags); | |
1209 | mlog(0, "Drop inode %llu, nlink = %u, ip_flags = 0x%x\n", | ||
1210 | (unsigned long long)oi->ip_blkno, inode->i_nlink, oi->ip_flags); | ||
1211 | 1186 | ||
1212 | if (oi->ip_flags & OCFS2_INODE_MAYBE_ORPHANED) | 1187 | if (oi->ip_flags & OCFS2_INODE_MAYBE_ORPHANED) |
1213 | res = 1; | 1188 | res = 1; |
1214 | else | 1189 | else |
1215 | res = generic_drop_inode(inode); | 1190 | res = generic_drop_inode(inode); |
1216 | 1191 | ||
1217 | mlog_exit_void(); | ||
1218 | return res; | 1192 | return res; |
1219 | } | 1193 | } |
1220 | 1194 | ||
@@ -1226,11 +1200,11 @@ int ocfs2_inode_revalidate(struct dentry *dentry) | |||
1226 | struct inode *inode = dentry->d_inode; | 1200 | struct inode *inode = dentry->d_inode; |
1227 | int status = 0; | 1201 | int status = 0; |
1228 | 1202 | ||
1229 | mlog_entry("(inode = 0x%p, ino = %llu)\n", inode, | 1203 | trace_ocfs2_inode_revalidate(inode, |
1230 | inode ? (unsigned long long)OCFS2_I(inode)->ip_blkno : 0ULL); | 1204 | inode ? (unsigned long long)OCFS2_I(inode)->ip_blkno : 0ULL, |
1205 | inode ? (unsigned long long)OCFS2_I(inode)->ip_flags : 0); | ||
1231 | 1206 | ||
1232 | if (!inode) { | 1207 | if (!inode) { |
1233 | mlog(0, "eep, no inode!\n"); | ||
1234 | status = -ENOENT; | 1208 | status = -ENOENT; |
1235 | goto bail; | 1209 | goto bail; |
1236 | } | 1210 | } |
@@ -1238,7 +1212,6 @@ int ocfs2_inode_revalidate(struct dentry *dentry) | |||
1238 | spin_lock(&OCFS2_I(inode)->ip_lock); | 1212 | spin_lock(&OCFS2_I(inode)->ip_lock); |
1239 | if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_DELETED) { | 1213 | if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_DELETED) { |
1240 | spin_unlock(&OCFS2_I(inode)->ip_lock); | 1214 | spin_unlock(&OCFS2_I(inode)->ip_lock); |
1241 | mlog(0, "inode deleted!\n"); | ||
1242 | status = -ENOENT; | 1215 | status = -ENOENT; |
1243 | goto bail; | 1216 | goto bail; |
1244 | } | 1217 | } |
@@ -1254,8 +1227,6 @@ int ocfs2_inode_revalidate(struct dentry *dentry) | |||
1254 | } | 1227 | } |
1255 | ocfs2_inode_unlock(inode, 0); | 1228 | ocfs2_inode_unlock(inode, 0); |
1256 | bail: | 1229 | bail: |
1257 | mlog_exit(status); | ||
1258 | |||
1259 | return status; | 1230 | return status; |
1260 | } | 1231 | } |
1261 | 1232 | ||
@@ -1271,8 +1242,7 @@ int ocfs2_mark_inode_dirty(handle_t *handle, | |||
1271 | int status; | 1242 | int status; |
1272 | struct ocfs2_dinode *fe = (struct ocfs2_dinode *) bh->b_data; | 1243 | struct ocfs2_dinode *fe = (struct ocfs2_dinode *) bh->b_data; |
1273 | 1244 | ||
1274 | mlog_entry("(inode %llu)\n", | 1245 | trace_ocfs2_mark_inode_dirty((unsigned long long)OCFS2_I(inode)->ip_blkno); |
1275 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | ||
1276 | 1246 | ||
1277 | status = ocfs2_journal_access_di(handle, INODE_CACHE(inode), bh, | 1247 | status = ocfs2_journal_access_di(handle, INODE_CACHE(inode), bh, |
1278 | OCFS2_JOURNAL_ACCESS_WRITE); | 1248 | OCFS2_JOURNAL_ACCESS_WRITE); |
@@ -1302,7 +1272,6 @@ int ocfs2_mark_inode_dirty(handle_t *handle, | |||
1302 | 1272 | ||
1303 | ocfs2_journal_dirty(handle, bh); | 1273 | ocfs2_journal_dirty(handle, bh); |
1304 | leave: | 1274 | leave: |
1305 | mlog_exit(status); | ||
1306 | return status; | 1275 | return status; |
1307 | } | 1276 | } |
1308 | 1277 | ||
@@ -1345,8 +1314,7 @@ int ocfs2_validate_inode_block(struct super_block *sb, | |||
1345 | int rc; | 1314 | int rc; |
1346 | struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data; | 1315 | struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data; |
1347 | 1316 | ||
1348 | mlog(0, "Validating dinode %llu\n", | 1317 | trace_ocfs2_validate_inode_block((unsigned long long)bh->b_blocknr); |
1349 | (unsigned long long)bh->b_blocknr); | ||
1350 | 1318 | ||
1351 | BUG_ON(!buffer_uptodate(bh)); | 1319 | BUG_ON(!buffer_uptodate(bh)); |
1352 | 1320 | ||
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index 731cf4670b97..f97a213223e8 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <linux/mount.h> | 9 | #include <linux/mount.h> |
10 | #include <linux/compat.h> | 10 | #include <linux/compat.h> |
11 | 11 | ||
12 | #define MLOG_MASK_PREFIX ML_INODE | ||
13 | #include <cluster/masklog.h> | 12 | #include <cluster/masklog.h> |
14 | 13 | ||
15 | #include "ocfs2.h" | 14 | #include "ocfs2.h" |
@@ -75,7 +74,6 @@ static int ocfs2_get_inode_attr(struct inode *inode, unsigned *flags) | |||
75 | *flags = OCFS2_I(inode)->ip_attr; | 74 | *flags = OCFS2_I(inode)->ip_attr; |
76 | ocfs2_inode_unlock(inode, 0); | 75 | ocfs2_inode_unlock(inode, 0); |
77 | 76 | ||
78 | mlog_exit(status); | ||
79 | return status; | 77 | return status; |
80 | } | 78 | } |
81 | 79 | ||
@@ -141,7 +139,6 @@ bail: | |||
141 | 139 | ||
142 | brelse(bh); | 140 | brelse(bh); |
143 | 141 | ||
144 | mlog_exit(status); | ||
145 | return status; | 142 | return status; |
146 | } | 143 | } |
147 | 144 | ||
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c index faa2303dbf0a..dcc2d9327150 100644 --- a/fs/ocfs2/journal.c +++ b/fs/ocfs2/journal.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/time.h> | 31 | #include <linux/time.h> |
32 | #include <linux/random.h> | 32 | #include <linux/random.h> |
33 | 33 | ||
34 | #define MLOG_MASK_PREFIX ML_JOURNAL | ||
35 | #include <cluster/masklog.h> | 34 | #include <cluster/masklog.h> |
36 | 35 | ||
37 | #include "ocfs2.h" | 36 | #include "ocfs2.h" |
@@ -52,6 +51,7 @@ | |||
52 | #include "quota.h" | 51 | #include "quota.h" |
53 | 52 | ||
54 | #include "buffer_head_io.h" | 53 | #include "buffer_head_io.h" |
54 | #include "ocfs2_trace.h" | ||
55 | 55 | ||
56 | DEFINE_SPINLOCK(trans_inc_lock); | 56 | DEFINE_SPINLOCK(trans_inc_lock); |
57 | 57 | ||
@@ -303,16 +303,15 @@ static int ocfs2_commit_cache(struct ocfs2_super *osb) | |||
303 | unsigned int flushed; | 303 | unsigned int flushed; |
304 | struct ocfs2_journal *journal = NULL; | 304 | struct ocfs2_journal *journal = NULL; |
305 | 305 | ||
306 | mlog_entry_void(); | ||
307 | |||
308 | journal = osb->journal; | 306 | journal = osb->journal; |
309 | 307 | ||
310 | /* Flush all pending commits and checkpoint the journal. */ | 308 | /* Flush all pending commits and checkpoint the journal. */ |
311 | down_write(&journal->j_trans_barrier); | 309 | down_write(&journal->j_trans_barrier); |
312 | 310 | ||
313 | if (atomic_read(&journal->j_num_trans) == 0) { | 311 | flushed = atomic_read(&journal->j_num_trans); |
312 | trace_ocfs2_commit_cache_begin(flushed); | ||
313 | if (flushed == 0) { | ||
314 | up_write(&journal->j_trans_barrier); | 314 | up_write(&journal->j_trans_barrier); |
315 | mlog(0, "No transactions for me to flush!\n"); | ||
316 | goto finally; | 315 | goto finally; |
317 | } | 316 | } |
318 | 317 | ||
@@ -331,13 +330,11 @@ static int ocfs2_commit_cache(struct ocfs2_super *osb) | |||
331 | atomic_set(&journal->j_num_trans, 0); | 330 | atomic_set(&journal->j_num_trans, 0); |
332 | up_write(&journal->j_trans_barrier); | 331 | up_write(&journal->j_trans_barrier); |
333 | 332 | ||
334 | mlog(0, "commit_thread: flushed transaction %lu (%u handles)\n", | 333 | trace_ocfs2_commit_cache_end(journal->j_trans_id, flushed); |
335 | journal->j_trans_id, flushed); | ||
336 | 334 | ||
337 | ocfs2_wake_downconvert_thread(osb); | 335 | ocfs2_wake_downconvert_thread(osb); |
338 | wake_up(&journal->j_checkpointed); | 336 | wake_up(&journal->j_checkpointed); |
339 | finally: | 337 | finally: |
340 | mlog_exit(status); | ||
341 | return status; | 338 | return status; |
342 | } | 339 | } |
343 | 340 | ||
@@ -425,9 +422,8 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks) | |||
425 | return 0; | 422 | return 0; |
426 | 423 | ||
427 | old_nblocks = handle->h_buffer_credits; | 424 | old_nblocks = handle->h_buffer_credits; |
428 | mlog_entry_void(); | ||
429 | 425 | ||
430 | mlog(0, "Trying to extend transaction by %d blocks\n", nblocks); | 426 | trace_ocfs2_extend_trans(old_nblocks, nblocks); |
431 | 427 | ||
432 | #ifdef CONFIG_OCFS2_DEBUG_FS | 428 | #ifdef CONFIG_OCFS2_DEBUG_FS |
433 | status = 1; | 429 | status = 1; |
@@ -440,9 +436,7 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks) | |||
440 | #endif | 436 | #endif |
441 | 437 | ||
442 | if (status > 0) { | 438 | if (status > 0) { |
443 | mlog(0, | 439 | trace_ocfs2_extend_trans_restart(old_nblocks + nblocks); |
444 | "jbd2_journal_extend failed, trying " | ||
445 | "jbd2_journal_restart\n"); | ||
446 | status = jbd2_journal_restart(handle, | 440 | status = jbd2_journal_restart(handle, |
447 | old_nblocks + nblocks); | 441 | old_nblocks + nblocks); |
448 | if (status < 0) { | 442 | if (status < 0) { |
@@ -453,8 +447,6 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks) | |||
453 | 447 | ||
454 | status = 0; | 448 | status = 0; |
455 | bail: | 449 | bail: |
456 | |||
457 | mlog_exit(status); | ||
458 | return status; | 450 | return status; |
459 | } | 451 | } |
460 | 452 | ||
@@ -622,12 +614,9 @@ static int __ocfs2_journal_access(handle_t *handle, | |||
622 | BUG_ON(!handle); | 614 | BUG_ON(!handle); |
623 | BUG_ON(!bh); | 615 | BUG_ON(!bh); |
624 | 616 | ||
625 | mlog_entry("bh->b_blocknr=%llu, type=%d (\"%s\"), bh->b_size = %zu\n", | 617 | trace_ocfs2_journal_access( |
626 | (unsigned long long)bh->b_blocknr, type, | 618 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
627 | (type == OCFS2_JOURNAL_ACCESS_CREATE) ? | 619 | (unsigned long long)bh->b_blocknr, type, bh->b_size); |
628 | "OCFS2_JOURNAL_ACCESS_CREATE" : | ||
629 | "OCFS2_JOURNAL_ACCESS_WRITE", | ||
630 | bh->b_size); | ||
631 | 620 | ||
632 | /* we can safely remove this assertion after testing. */ | 621 | /* we can safely remove this assertion after testing. */ |
633 | if (!buffer_uptodate(bh)) { | 622 | if (!buffer_uptodate(bh)) { |
@@ -668,7 +657,6 @@ static int __ocfs2_journal_access(handle_t *handle, | |||
668 | mlog(ML_ERROR, "Error %d getting %d access to buffer!\n", | 657 | mlog(ML_ERROR, "Error %d getting %d access to buffer!\n", |
669 | status, type); | 658 | status, type); |
670 | 659 | ||
671 | mlog_exit(status); | ||
672 | return status; | 660 | return status; |
673 | } | 661 | } |
674 | 662 | ||
@@ -737,13 +725,10 @@ void ocfs2_journal_dirty(handle_t *handle, struct buffer_head *bh) | |||
737 | { | 725 | { |
738 | int status; | 726 | int status; |
739 | 727 | ||
740 | mlog_entry("(bh->b_blocknr=%llu)\n", | 728 | trace_ocfs2_journal_dirty((unsigned long long)bh->b_blocknr); |
741 | (unsigned long long)bh->b_blocknr); | ||
742 | 729 | ||
743 | status = jbd2_journal_dirty_metadata(handle, bh); | 730 | status = jbd2_journal_dirty_metadata(handle, bh); |
744 | BUG_ON(status); | 731 | BUG_ON(status); |
745 | |||
746 | mlog_exit_void(); | ||
747 | } | 732 | } |
748 | 733 | ||
749 | #define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE) | 734 | #define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE) |
@@ -775,8 +760,6 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, int *dirty) | |||
775 | struct ocfs2_super *osb; | 760 | struct ocfs2_super *osb; |
776 | int inode_lock = 0; | 761 | int inode_lock = 0; |
777 | 762 | ||
778 | mlog_entry_void(); | ||
779 | |||
780 | BUG_ON(!journal); | 763 | BUG_ON(!journal); |
781 | 764 | ||
782 | osb = journal->j_osb; | 765 | osb = journal->j_osb; |
@@ -820,10 +803,9 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, int *dirty) | |||
820 | goto done; | 803 | goto done; |
821 | } | 804 | } |
822 | 805 | ||
823 | mlog(0, "inode->i_size = %lld\n", inode->i_size); | 806 | trace_ocfs2_journal_init(inode->i_size, |
824 | mlog(0, "inode->i_blocks = %llu\n", | 807 | (unsigned long long)inode->i_blocks, |
825 | (unsigned long long)inode->i_blocks); | 808 | OCFS2_I(inode)->ip_clusters); |
826 | mlog(0, "inode->ip_clusters = %u\n", OCFS2_I(inode)->ip_clusters); | ||
827 | 809 | ||
828 | /* call the kernels journal init function now */ | 810 | /* call the kernels journal init function now */ |
829 | j_journal = jbd2_journal_init_inode(inode); | 811 | j_journal = jbd2_journal_init_inode(inode); |
@@ -833,8 +815,7 @@ int ocfs2_journal_init(struct ocfs2_journal *journal, int *dirty) | |||
833 | goto done; | 815 | goto done; |
834 | } | 816 | } |
835 | 817 | ||
836 | mlog(0, "Returned from jbd2_journal_init_inode\n"); | 818 | trace_ocfs2_journal_init_maxlen(j_journal->j_maxlen); |
837 | mlog(0, "j_journal->j_maxlen = %u\n", j_journal->j_maxlen); | ||
838 | 819 | ||
839 | *dirty = (le32_to_cpu(di->id1.journal1.ij_flags) & | 820 | *dirty = (le32_to_cpu(di->id1.journal1.ij_flags) & |
840 | OCFS2_JOURNAL_DIRTY_FL); | 821 | OCFS2_JOURNAL_DIRTY_FL); |
@@ -859,7 +840,6 @@ done: | |||
859 | } | 840 | } |
860 | } | 841 | } |
861 | 842 | ||
862 | mlog_exit(status); | ||
863 | return status; | 843 | return status; |
864 | } | 844 | } |
865 | 845 | ||
@@ -882,8 +862,6 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb, | |||
882 | struct buffer_head *bh = journal->j_bh; | 862 | struct buffer_head *bh = journal->j_bh; |
883 | struct ocfs2_dinode *fe; | 863 | struct ocfs2_dinode *fe; |
884 | 864 | ||
885 | mlog_entry_void(); | ||
886 | |||
887 | fe = (struct ocfs2_dinode *)bh->b_data; | 865 | fe = (struct ocfs2_dinode *)bh->b_data; |
888 | 866 | ||
889 | /* The journal bh on the osb always comes from ocfs2_journal_init() | 867 | /* The journal bh on the osb always comes from ocfs2_journal_init() |
@@ -906,7 +884,6 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb, | |||
906 | if (status < 0) | 884 | if (status < 0) |
907 | mlog_errno(status); | 885 | mlog_errno(status); |
908 | 886 | ||
909 | mlog_exit(status); | ||
910 | return status; | 887 | return status; |
911 | } | 888 | } |
912 | 889 | ||
@@ -921,8 +898,6 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) | |||
921 | struct inode *inode = NULL; | 898 | struct inode *inode = NULL; |
922 | int num_running_trans = 0; | 899 | int num_running_trans = 0; |
923 | 900 | ||
924 | mlog_entry_void(); | ||
925 | |||
926 | BUG_ON(!osb); | 901 | BUG_ON(!osb); |
927 | 902 | ||
928 | journal = osb->journal; | 903 | journal = osb->journal; |
@@ -939,10 +914,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) | |||
939 | BUG(); | 914 | BUG(); |
940 | 915 | ||
941 | num_running_trans = atomic_read(&(osb->journal->j_num_trans)); | 916 | num_running_trans = atomic_read(&(osb->journal->j_num_trans)); |
942 | if (num_running_trans > 0) | 917 | trace_ocfs2_journal_shutdown(num_running_trans); |
943 | mlog(0, "Shutting down journal: must wait on %d " | ||
944 | "running transactions!\n", | ||
945 | num_running_trans); | ||
946 | 918 | ||
947 | /* Do a commit_cache here. It will flush our journal, *and* | 919 | /* Do a commit_cache here. It will flush our journal, *and* |
948 | * release any locks that are still held. | 920 | * release any locks that are still held. |
@@ -955,7 +927,7 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) | |||
955 | * completely destroy the journal. */ | 927 | * completely destroy the journal. */ |
956 | if (osb->commit_task) { | 928 | if (osb->commit_task) { |
957 | /* Wait for the commit thread */ | 929 | /* Wait for the commit thread */ |
958 | mlog(0, "Waiting for ocfs2commit to exit....\n"); | 930 | trace_ocfs2_journal_shutdown_wait(osb->commit_task); |
959 | kthread_stop(osb->commit_task); | 931 | kthread_stop(osb->commit_task); |
960 | osb->commit_task = NULL; | 932 | osb->commit_task = NULL; |
961 | } | 933 | } |
@@ -998,7 +970,6 @@ void ocfs2_journal_shutdown(struct ocfs2_super *osb) | |||
998 | done: | 970 | done: |
999 | if (inode) | 971 | if (inode) |
1000 | iput(inode); | 972 | iput(inode); |
1001 | mlog_exit_void(); | ||
1002 | } | 973 | } |
1003 | 974 | ||
1004 | static void ocfs2_clear_journal_error(struct super_block *sb, | 975 | static void ocfs2_clear_journal_error(struct super_block *sb, |
@@ -1024,8 +995,6 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed) | |||
1024 | int status = 0; | 995 | int status = 0; |
1025 | struct ocfs2_super *osb; | 996 | struct ocfs2_super *osb; |
1026 | 997 | ||
1027 | mlog_entry_void(); | ||
1028 | |||
1029 | BUG_ON(!journal); | 998 | BUG_ON(!journal); |
1030 | 999 | ||
1031 | osb = journal->j_osb; | 1000 | osb = journal->j_osb; |
@@ -1059,7 +1028,6 @@ int ocfs2_journal_load(struct ocfs2_journal *journal, int local, int replayed) | |||
1059 | osb->commit_task = NULL; | 1028 | osb->commit_task = NULL; |
1060 | 1029 | ||
1061 | done: | 1030 | done: |
1062 | mlog_exit(status); | ||
1063 | return status; | 1031 | return status; |
1064 | } | 1032 | } |
1065 | 1033 | ||
@@ -1070,8 +1038,6 @@ int ocfs2_journal_wipe(struct ocfs2_journal *journal, int full) | |||
1070 | { | 1038 | { |
1071 | int status; | 1039 | int status; |
1072 | 1040 | ||
1073 | mlog_entry_void(); | ||
1074 | |||
1075 | BUG_ON(!journal); | 1041 | BUG_ON(!journal); |
1076 | 1042 | ||
1077 | status = jbd2_journal_wipe(journal->j_journal, full); | 1043 | status = jbd2_journal_wipe(journal->j_journal, full); |
@@ -1085,7 +1051,6 @@ int ocfs2_journal_wipe(struct ocfs2_journal *journal, int full) | |||
1085 | mlog_errno(status); | 1051 | mlog_errno(status); |
1086 | 1052 | ||
1087 | bail: | 1053 | bail: |
1088 | mlog_exit(status); | ||
1089 | return status; | 1054 | return status; |
1090 | } | 1055 | } |
1091 | 1056 | ||
@@ -1124,8 +1089,6 @@ static int ocfs2_force_read_journal(struct inode *inode) | |||
1124 | #define CONCURRENT_JOURNAL_FILL 32ULL | 1089 | #define CONCURRENT_JOURNAL_FILL 32ULL |
1125 | struct buffer_head *bhs[CONCURRENT_JOURNAL_FILL]; | 1090 | struct buffer_head *bhs[CONCURRENT_JOURNAL_FILL]; |
1126 | 1091 | ||
1127 | mlog_entry_void(); | ||
1128 | |||
1129 | memset(bhs, 0, sizeof(struct buffer_head *) * CONCURRENT_JOURNAL_FILL); | 1092 | memset(bhs, 0, sizeof(struct buffer_head *) * CONCURRENT_JOURNAL_FILL); |
1130 | 1093 | ||
1131 | num_blocks = ocfs2_blocks_for_bytes(inode->i_sb, inode->i_size); | 1094 | num_blocks = ocfs2_blocks_for_bytes(inode->i_sb, inode->i_size); |
@@ -1161,7 +1124,6 @@ static int ocfs2_force_read_journal(struct inode *inode) | |||
1161 | bail: | 1124 | bail: |
1162 | for(i = 0; i < CONCURRENT_JOURNAL_FILL; i++) | 1125 | for(i = 0; i < CONCURRENT_JOURNAL_FILL; i++) |
1163 | brelse(bhs[i]); | 1126 | brelse(bhs[i]); |
1164 | mlog_exit(status); | ||
1165 | return status; | 1127 | return status; |
1166 | } | 1128 | } |
1167 | 1129 | ||
@@ -1185,7 +1147,7 @@ struct ocfs2_la_recovery_item { | |||
1185 | */ | 1147 | */ |
1186 | void ocfs2_complete_recovery(struct work_struct *work) | 1148 | void ocfs2_complete_recovery(struct work_struct *work) |
1187 | { | 1149 | { |
1188 | int ret; | 1150 | int ret = 0; |
1189 | struct ocfs2_journal *journal = | 1151 | struct ocfs2_journal *journal = |
1190 | container_of(work, struct ocfs2_journal, j_recovery_work); | 1152 | container_of(work, struct ocfs2_journal, j_recovery_work); |
1191 | struct ocfs2_super *osb = journal->j_osb; | 1153 | struct ocfs2_super *osb = journal->j_osb; |
@@ -1194,9 +1156,8 @@ void ocfs2_complete_recovery(struct work_struct *work) | |||
1194 | struct ocfs2_quota_recovery *qrec; | 1156 | struct ocfs2_quota_recovery *qrec; |
1195 | LIST_HEAD(tmp_la_list); | 1157 | LIST_HEAD(tmp_la_list); |
1196 | 1158 | ||
1197 | mlog_entry_void(); | 1159 | trace_ocfs2_complete_recovery( |
1198 | 1160 | (unsigned long long)OCFS2_I(journal->j_inode)->ip_blkno); | |
1199 | mlog(0, "completing recovery from keventd\n"); | ||
1200 | 1161 | ||
1201 | spin_lock(&journal->j_lock); | 1162 | spin_lock(&journal->j_lock); |
1202 | list_splice_init(&journal->j_la_cleanups, &tmp_la_list); | 1163 | list_splice_init(&journal->j_la_cleanups, &tmp_la_list); |
@@ -1205,15 +1166,18 @@ void ocfs2_complete_recovery(struct work_struct *work) | |||
1205 | list_for_each_entry_safe(item, n, &tmp_la_list, lri_list) { | 1166 | list_for_each_entry_safe(item, n, &tmp_la_list, lri_list) { |
1206 | list_del_init(&item->lri_list); | 1167 | list_del_init(&item->lri_list); |
1207 | 1168 | ||
1208 | mlog(0, "Complete recovery for slot %d\n", item->lri_slot); | ||
1209 | |||
1210 | ocfs2_wait_on_quotas(osb); | 1169 | ocfs2_wait_on_quotas(osb); |
1211 | 1170 | ||
1212 | la_dinode = item->lri_la_dinode; | 1171 | la_dinode = item->lri_la_dinode; |
1213 | if (la_dinode) { | 1172 | tl_dinode = item->lri_tl_dinode; |
1214 | mlog(0, "Clean up local alloc %llu\n", | 1173 | qrec = item->lri_qrec; |
1215 | (unsigned long long)le64_to_cpu(la_dinode->i_blkno)); | 1174 | |
1175 | trace_ocfs2_complete_recovery_slot(item->lri_slot, | ||
1176 | la_dinode ? le64_to_cpu(la_dinode->i_blkno) : 0, | ||
1177 | tl_dinode ? le64_to_cpu(tl_dinode->i_blkno) : 0, | ||
1178 | qrec); | ||
1216 | 1179 | ||
1180 | if (la_dinode) { | ||
1217 | ret = ocfs2_complete_local_alloc_recovery(osb, | 1181 | ret = ocfs2_complete_local_alloc_recovery(osb, |
1218 | la_dinode); | 1182 | la_dinode); |
1219 | if (ret < 0) | 1183 | if (ret < 0) |
@@ -1222,11 +1186,7 @@ void ocfs2_complete_recovery(struct work_struct *work) | |||
1222 | kfree(la_dinode); | 1186 | kfree(la_dinode); |
1223 | } | 1187 | } |
1224 | 1188 | ||
1225 | tl_dinode = item->lri_tl_dinode; | ||
1226 | if (tl_dinode) { | 1189 | if (tl_dinode) { |
1227 | mlog(0, "Clean up truncate log %llu\n", | ||
1228 | (unsigned long long)le64_to_cpu(tl_dinode->i_blkno)); | ||
1229 | |||
1230 | ret = ocfs2_complete_truncate_log_recovery(osb, | 1190 | ret = ocfs2_complete_truncate_log_recovery(osb, |
1231 | tl_dinode); | 1191 | tl_dinode); |
1232 | if (ret < 0) | 1192 | if (ret < 0) |
@@ -1239,9 +1199,7 @@ void ocfs2_complete_recovery(struct work_struct *work) | |||
1239 | if (ret < 0) | 1199 | if (ret < 0) |
1240 | mlog_errno(ret); | 1200 | mlog_errno(ret); |
1241 | 1201 | ||
1242 | qrec = item->lri_qrec; | ||
1243 | if (qrec) { | 1202 | if (qrec) { |
1244 | mlog(0, "Recovering quota files"); | ||
1245 | ret = ocfs2_finish_quota_recovery(osb, qrec, | 1203 | ret = ocfs2_finish_quota_recovery(osb, qrec, |
1246 | item->lri_slot); | 1204 | item->lri_slot); |
1247 | if (ret < 0) | 1205 | if (ret < 0) |
@@ -1252,8 +1210,7 @@ void ocfs2_complete_recovery(struct work_struct *work) | |||
1252 | kfree(item); | 1210 | kfree(item); |
1253 | } | 1211 | } |
1254 | 1212 | ||
1255 | mlog(0, "Recovery completion\n"); | 1213 | trace_ocfs2_complete_recovery_end(ret); |
1256 | mlog_exit_void(); | ||
1257 | } | 1214 | } |
1258 | 1215 | ||
1259 | /* NOTE: This function always eats your references to la_dinode and | 1216 | /* NOTE: This function always eats your references to la_dinode and |
@@ -1339,8 +1296,6 @@ static int __ocfs2_recovery_thread(void *arg) | |||
1339 | int rm_quota_used = 0, i; | 1296 | int rm_quota_used = 0, i; |
1340 | struct ocfs2_quota_recovery *qrec; | 1297 | struct ocfs2_quota_recovery *qrec; |
1341 | 1298 | ||
1342 | mlog_entry_void(); | ||
1343 | |||
1344 | status = ocfs2_wait_on_mount(osb); | 1299 | status = ocfs2_wait_on_mount(osb); |
1345 | if (status < 0) { | 1300 | if (status < 0) { |
1346 | goto bail; | 1301 | goto bail; |
@@ -1372,15 +1327,12 @@ restart: | |||
1372 | * clear it until ocfs2_recover_node() has succeeded. */ | 1327 | * clear it until ocfs2_recover_node() has succeeded. */ |
1373 | node_num = rm->rm_entries[0]; | 1328 | node_num = rm->rm_entries[0]; |
1374 | spin_unlock(&osb->osb_lock); | 1329 | spin_unlock(&osb->osb_lock); |
1375 | mlog(0, "checking node %d\n", node_num); | ||
1376 | slot_num = ocfs2_node_num_to_slot(osb, node_num); | 1330 | slot_num = ocfs2_node_num_to_slot(osb, node_num); |
1331 | trace_ocfs2_recovery_thread_node(node_num, slot_num); | ||
1377 | if (slot_num == -ENOENT) { | 1332 | if (slot_num == -ENOENT) { |
1378 | status = 0; | 1333 | status = 0; |
1379 | mlog(0, "no slot for this node, so no recovery" | ||
1380 | "required.\n"); | ||
1381 | goto skip_recovery; | 1334 | goto skip_recovery; |
1382 | } | 1335 | } |
1383 | mlog(0, "node %d was using slot %d\n", node_num, slot_num); | ||
1384 | 1336 | ||
1385 | /* It is a bit subtle with quota recovery. We cannot do it | 1337 | /* It is a bit subtle with quota recovery. We cannot do it |
1386 | * immediately because we have to obtain cluster locks from | 1338 | * immediately because we have to obtain cluster locks from |
@@ -1407,7 +1359,7 @@ skip_recovery: | |||
1407 | spin_lock(&osb->osb_lock); | 1359 | spin_lock(&osb->osb_lock); |
1408 | } | 1360 | } |
1409 | spin_unlock(&osb->osb_lock); | 1361 | spin_unlock(&osb->osb_lock); |
1410 | mlog(0, "All nodes recovered\n"); | 1362 | trace_ocfs2_recovery_thread_end(status); |
1411 | 1363 | ||
1412 | /* Refresh all journal recovery generations from disk */ | 1364 | /* Refresh all journal recovery generations from disk */ |
1413 | status = ocfs2_check_journals_nolocks(osb); | 1365 | status = ocfs2_check_journals_nolocks(osb); |
@@ -1451,7 +1403,6 @@ bail: | |||
1451 | if (rm_quota) | 1403 | if (rm_quota) |
1452 | kfree(rm_quota); | 1404 | kfree(rm_quota); |
1453 | 1405 | ||
1454 | mlog_exit(status); | ||
1455 | /* no one is callint kthread_stop() for us so the kthread() api | 1406 | /* no one is callint kthread_stop() for us so the kthread() api |
1456 | * requires that we call do_exit(). And it isn't exported, but | 1407 | * requires that we call do_exit(). And it isn't exported, but |
1457 | * complete_and_exit() seems to be a minimal wrapper around it. */ | 1408 | * complete_and_exit() seems to be a minimal wrapper around it. */ |
@@ -1461,19 +1412,15 @@ bail: | |||
1461 | 1412 | ||
1462 | void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num) | 1413 | void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num) |
1463 | { | 1414 | { |
1464 | mlog_entry("(node_num=%d, osb->node_num = %d)\n", | ||
1465 | node_num, osb->node_num); | ||
1466 | |||
1467 | mutex_lock(&osb->recovery_lock); | 1415 | mutex_lock(&osb->recovery_lock); |
1468 | if (osb->disable_recovery) | ||
1469 | goto out; | ||
1470 | 1416 | ||
1471 | /* People waiting on recovery will wait on | 1417 | trace_ocfs2_recovery_thread(node_num, osb->node_num, |
1472 | * the recovery map to empty. */ | 1418 | osb->disable_recovery, osb->recovery_thread_task, |
1473 | if (ocfs2_recovery_map_set(osb, node_num)) | 1419 | osb->disable_recovery ? |
1474 | mlog(0, "node %d already in recovery map.\n", node_num); | 1420 | -1 : ocfs2_recovery_map_set(osb, node_num)); |
1475 | 1421 | ||
1476 | mlog(0, "starting recovery thread...\n"); | 1422 | if (osb->disable_recovery) |
1423 | goto out; | ||
1477 | 1424 | ||
1478 | if (osb->recovery_thread_task) | 1425 | if (osb->recovery_thread_task) |
1479 | goto out; | 1426 | goto out; |
@@ -1488,8 +1435,6 @@ void ocfs2_recovery_thread(struct ocfs2_super *osb, int node_num) | |||
1488 | out: | 1435 | out: |
1489 | mutex_unlock(&osb->recovery_lock); | 1436 | mutex_unlock(&osb->recovery_lock); |
1490 | wake_up(&osb->recovery_event); | 1437 | wake_up(&osb->recovery_event); |
1491 | |||
1492 | mlog_exit_void(); | ||
1493 | } | 1438 | } |
1494 | 1439 | ||
1495 | static int ocfs2_read_journal_inode(struct ocfs2_super *osb, | 1440 | static int ocfs2_read_journal_inode(struct ocfs2_super *osb, |
@@ -1563,7 +1508,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb, | |||
1563 | * If not, it needs recovery. | 1508 | * If not, it needs recovery. |
1564 | */ | 1509 | */ |
1565 | if (osb->slot_recovery_generations[slot_num] != slot_reco_gen) { | 1510 | if (osb->slot_recovery_generations[slot_num] != slot_reco_gen) { |
1566 | mlog(0, "Slot %u already recovered (old/new=%u/%u)\n", slot_num, | 1511 | trace_ocfs2_replay_journal_recovered(slot_num, |
1567 | osb->slot_recovery_generations[slot_num], slot_reco_gen); | 1512 | osb->slot_recovery_generations[slot_num], slot_reco_gen); |
1568 | osb->slot_recovery_generations[slot_num] = slot_reco_gen; | 1513 | osb->slot_recovery_generations[slot_num] = slot_reco_gen; |
1569 | status = -EBUSY; | 1514 | status = -EBUSY; |
@@ -1574,7 +1519,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb, | |||
1574 | 1519 | ||
1575 | status = ocfs2_inode_lock_full(inode, &bh, 1, OCFS2_META_LOCK_RECOVERY); | 1520 | status = ocfs2_inode_lock_full(inode, &bh, 1, OCFS2_META_LOCK_RECOVERY); |
1576 | if (status < 0) { | 1521 | if (status < 0) { |
1577 | mlog(0, "status returned from ocfs2_inode_lock=%d\n", status); | 1522 | trace_ocfs2_replay_journal_lock_err(status); |
1578 | if (status != -ERESTARTSYS) | 1523 | if (status != -ERESTARTSYS) |
1579 | mlog(ML_ERROR, "Could not lock journal!\n"); | 1524 | mlog(ML_ERROR, "Could not lock journal!\n"); |
1580 | goto done; | 1525 | goto done; |
@@ -1587,7 +1532,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb, | |||
1587 | slot_reco_gen = ocfs2_get_recovery_generation(fe); | 1532 | slot_reco_gen = ocfs2_get_recovery_generation(fe); |
1588 | 1533 | ||
1589 | if (!(flags & OCFS2_JOURNAL_DIRTY_FL)) { | 1534 | if (!(flags & OCFS2_JOURNAL_DIRTY_FL)) { |
1590 | mlog(0, "No recovery required for node %d\n", node_num); | 1535 | trace_ocfs2_replay_journal_skip(node_num); |
1591 | /* Refresh recovery generation for the slot */ | 1536 | /* Refresh recovery generation for the slot */ |
1592 | osb->slot_recovery_generations[slot_num] = slot_reco_gen; | 1537 | osb->slot_recovery_generations[slot_num] = slot_reco_gen; |
1593 | goto done; | 1538 | goto done; |
@@ -1608,7 +1553,6 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb, | |||
1608 | goto done; | 1553 | goto done; |
1609 | } | 1554 | } |
1610 | 1555 | ||
1611 | mlog(0, "calling journal_init_inode\n"); | ||
1612 | journal = jbd2_journal_init_inode(inode); | 1556 | journal = jbd2_journal_init_inode(inode); |
1613 | if (journal == NULL) { | 1557 | if (journal == NULL) { |
1614 | mlog(ML_ERROR, "Linux journal layer error\n"); | 1558 | mlog(ML_ERROR, "Linux journal layer error\n"); |
@@ -1628,7 +1572,6 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb, | |||
1628 | ocfs2_clear_journal_error(osb->sb, journal, slot_num); | 1572 | ocfs2_clear_journal_error(osb->sb, journal, slot_num); |
1629 | 1573 | ||
1630 | /* wipe the journal */ | 1574 | /* wipe the journal */ |
1631 | mlog(0, "flushing the journal.\n"); | ||
1632 | jbd2_journal_lock_updates(journal); | 1575 | jbd2_journal_lock_updates(journal); |
1633 | status = jbd2_journal_flush(journal); | 1576 | status = jbd2_journal_flush(journal); |
1634 | jbd2_journal_unlock_updates(journal); | 1577 | jbd2_journal_unlock_updates(journal); |
@@ -1665,7 +1608,6 @@ done: | |||
1665 | 1608 | ||
1666 | brelse(bh); | 1609 | brelse(bh); |
1667 | 1610 | ||
1668 | mlog_exit(status); | ||
1669 | return status; | 1611 | return status; |
1670 | } | 1612 | } |
1671 | 1613 | ||
@@ -1688,8 +1630,7 @@ static int ocfs2_recover_node(struct ocfs2_super *osb, | |||
1688 | struct ocfs2_dinode *la_copy = NULL; | 1630 | struct ocfs2_dinode *la_copy = NULL; |
1689 | struct ocfs2_dinode *tl_copy = NULL; | 1631 | struct ocfs2_dinode *tl_copy = NULL; |
1690 | 1632 | ||
1691 | mlog_entry("(node_num=%d, slot_num=%d, osb->node_num = %d)\n", | 1633 | trace_ocfs2_recover_node(node_num, slot_num, osb->node_num); |
1692 | node_num, slot_num, osb->node_num); | ||
1693 | 1634 | ||
1694 | /* Should not ever be called to recover ourselves -- in that | 1635 | /* Should not ever be called to recover ourselves -- in that |
1695 | * case we should've called ocfs2_journal_load instead. */ | 1636 | * case we should've called ocfs2_journal_load instead. */ |
@@ -1698,9 +1639,7 @@ static int ocfs2_recover_node(struct ocfs2_super *osb, | |||
1698 | status = ocfs2_replay_journal(osb, node_num, slot_num); | 1639 | status = ocfs2_replay_journal(osb, node_num, slot_num); |
1699 | if (status < 0) { | 1640 | if (status < 0) { |
1700 | if (status == -EBUSY) { | 1641 | if (status == -EBUSY) { |
1701 | mlog(0, "Skipping recovery for slot %u (node %u) " | 1642 | trace_ocfs2_recover_node_skip(slot_num, node_num); |
1702 | "as another node has recovered it\n", slot_num, | ||
1703 | node_num); | ||
1704 | status = 0; | 1643 | status = 0; |
1705 | goto done; | 1644 | goto done; |
1706 | } | 1645 | } |
@@ -1735,7 +1674,6 @@ static int ocfs2_recover_node(struct ocfs2_super *osb, | |||
1735 | status = 0; | 1674 | status = 0; |
1736 | done: | 1675 | done: |
1737 | 1676 | ||
1738 | mlog_exit(status); | ||
1739 | return status; | 1677 | return status; |
1740 | } | 1678 | } |
1741 | 1679 | ||
@@ -1808,8 +1746,8 @@ int ocfs2_mark_dead_nodes(struct ocfs2_super *osb) | |||
1808 | spin_lock(&osb->osb_lock); | 1746 | spin_lock(&osb->osb_lock); |
1809 | osb->slot_recovery_generations[i] = gen; | 1747 | osb->slot_recovery_generations[i] = gen; |
1810 | 1748 | ||
1811 | mlog(0, "Slot %u recovery generation is %u\n", i, | 1749 | trace_ocfs2_mark_dead_nodes(i, |
1812 | osb->slot_recovery_generations[i]); | 1750 | osb->slot_recovery_generations[i]); |
1813 | 1751 | ||
1814 | if (i == osb->slot_num) { | 1752 | if (i == osb->slot_num) { |
1815 | spin_unlock(&osb->osb_lock); | 1753 | spin_unlock(&osb->osb_lock); |
@@ -1845,7 +1783,6 @@ int ocfs2_mark_dead_nodes(struct ocfs2_super *osb) | |||
1845 | 1783 | ||
1846 | status = 0; | 1784 | status = 0; |
1847 | bail: | 1785 | bail: |
1848 | mlog_exit(status); | ||
1849 | return status; | 1786 | return status; |
1850 | } | 1787 | } |
1851 | 1788 | ||
@@ -1884,11 +1821,12 @@ void ocfs2_queue_orphan_scan(struct ocfs2_super *osb) | |||
1884 | 1821 | ||
1885 | os = &osb->osb_orphan_scan; | 1822 | os = &osb->osb_orphan_scan; |
1886 | 1823 | ||
1887 | mlog(0, "Begin orphan scan\n"); | ||
1888 | |||
1889 | if (atomic_read(&os->os_state) == ORPHAN_SCAN_INACTIVE) | 1824 | if (atomic_read(&os->os_state) == ORPHAN_SCAN_INACTIVE) |
1890 | goto out; | 1825 | goto out; |
1891 | 1826 | ||
1827 | trace_ocfs2_queue_orphan_scan_begin(os->os_count, os->os_seqno, | ||
1828 | atomic_read(&os->os_state)); | ||
1829 | |||
1892 | status = ocfs2_orphan_scan_lock(osb, &seqno); | 1830 | status = ocfs2_orphan_scan_lock(osb, &seqno); |
1893 | if (status < 0) { | 1831 | if (status < 0) { |
1894 | if (status != -EAGAIN) | 1832 | if (status != -EAGAIN) |
@@ -1918,7 +1856,8 @@ void ocfs2_queue_orphan_scan(struct ocfs2_super *osb) | |||
1918 | unlock: | 1856 | unlock: |
1919 | ocfs2_orphan_scan_unlock(osb, seqno); | 1857 | ocfs2_orphan_scan_unlock(osb, seqno); |
1920 | out: | 1858 | out: |
1921 | mlog(0, "Orphan scan completed\n"); | 1859 | trace_ocfs2_queue_orphan_scan_end(os->os_count, os->os_seqno, |
1860 | atomic_read(&os->os_state)); | ||
1922 | return; | 1861 | return; |
1923 | } | 1862 | } |
1924 | 1863 | ||
@@ -2002,8 +1941,7 @@ static int ocfs2_orphan_filldir(void *priv, const char *name, int name_len, | |||
2002 | if (IS_ERR(iter)) | 1941 | if (IS_ERR(iter)) |
2003 | return 0; | 1942 | return 0; |
2004 | 1943 | ||
2005 | mlog(0, "queue orphan %llu\n", | 1944 | trace_ocfs2_orphan_filldir((unsigned long long)OCFS2_I(iter)->ip_blkno); |
2006 | (unsigned long long)OCFS2_I(iter)->ip_blkno); | ||
2007 | /* No locking is required for the next_orphan queue as there | 1945 | /* No locking is required for the next_orphan queue as there |
2008 | * is only ever a single process doing orphan recovery. */ | 1946 | * is only ever a single process doing orphan recovery. */ |
2009 | OCFS2_I(iter)->ip_next_orphan = p->head; | 1947 | OCFS2_I(iter)->ip_next_orphan = p->head; |
@@ -2119,7 +2057,7 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb, | |||
2119 | struct inode *iter; | 2057 | struct inode *iter; |
2120 | struct ocfs2_inode_info *oi; | 2058 | struct ocfs2_inode_info *oi; |
2121 | 2059 | ||
2122 | mlog(0, "Recover inodes from orphan dir in slot %d\n", slot); | 2060 | trace_ocfs2_recover_orphans(slot); |
2123 | 2061 | ||
2124 | ocfs2_mark_recovering_orphan_dir(osb, slot); | 2062 | ocfs2_mark_recovering_orphan_dir(osb, slot); |
2125 | ret = ocfs2_queue_orphans(osb, slot, &inode); | 2063 | ret = ocfs2_queue_orphans(osb, slot, &inode); |
@@ -2132,7 +2070,8 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb, | |||
2132 | 2070 | ||
2133 | while (inode) { | 2071 | while (inode) { |
2134 | oi = OCFS2_I(inode); | 2072 | oi = OCFS2_I(inode); |
2135 | mlog(0, "iput orphan %llu\n", (unsigned long long)oi->ip_blkno); | 2073 | trace_ocfs2_recover_orphans_iput( |
2074 | (unsigned long long)oi->ip_blkno); | ||
2136 | 2075 | ||
2137 | iter = oi->ip_next_orphan; | 2076 | iter = oi->ip_next_orphan; |
2138 | 2077 | ||
@@ -2170,6 +2109,7 @@ static int __ocfs2_wait_on_mount(struct ocfs2_super *osb, int quota) | |||
2170 | * MOUNTED flag, but this is set right before | 2109 | * MOUNTED flag, but this is set right before |
2171 | * dismount_volume() so we can trust it. */ | 2110 | * dismount_volume() so we can trust it. */ |
2172 | if (atomic_read(&osb->vol_state) == VOLUME_DISABLED) { | 2111 | if (atomic_read(&osb->vol_state) == VOLUME_DISABLED) { |
2112 | trace_ocfs2_wait_on_mount(VOLUME_DISABLED); | ||
2173 | mlog(0, "mount error, exiting!\n"); | 2113 | mlog(0, "mount error, exiting!\n"); |
2174 | return -EBUSY; | 2114 | return -EBUSY; |
2175 | } | 2115 | } |
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h index 43e56b97f9c0..6180da1e37e6 100644 --- a/fs/ocfs2/journal.h +++ b/fs/ocfs2/journal.h | |||
@@ -405,9 +405,9 @@ static inline int ocfs2_remove_extent_credits(struct super_block *sb) | |||
405 | ocfs2_quota_trans_credits(sb); | 405 | ocfs2_quota_trans_credits(sb); |
406 | } | 406 | } |
407 | 407 | ||
408 | /* data block for new dir/symlink, 2 for bitmap updates (bitmap fe + | 408 | /* data block for new dir/symlink, allocation of directory block, dx_root |
409 | * bitmap block for the new bit) dx_root update for free list */ | 409 | * update for free list */ |
410 | #define OCFS2_DIR_LINK_ADDITIONAL_CREDITS (1 + 2 + 1) | 410 | #define OCFS2_DIR_LINK_ADDITIONAL_CREDITS (1 + OCFS2_SUBALLOC_ALLOC + 1) |
411 | 411 | ||
412 | static inline int ocfs2_add_dir_index_credits(struct super_block *sb) | 412 | static inline int ocfs2_add_dir_index_credits(struct super_block *sb) |
413 | { | 413 | { |
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c index ec6adbf8f551..210c35237548 100644 --- a/fs/ocfs2/localalloc.c +++ b/fs/ocfs2/localalloc.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/highmem.h> | 29 | #include <linux/highmem.h> |
30 | #include <linux/bitops.h> | 30 | #include <linux/bitops.h> |
31 | 31 | ||
32 | #define MLOG_MASK_PREFIX ML_DISK_ALLOC | ||
33 | #include <cluster/masklog.h> | 32 | #include <cluster/masklog.h> |
34 | 33 | ||
35 | #include "ocfs2.h" | 34 | #include "ocfs2.h" |
@@ -43,6 +42,7 @@ | |||
43 | #include "suballoc.h" | 42 | #include "suballoc.h" |
44 | #include "super.h" | 43 | #include "super.h" |
45 | #include "sysfile.h" | 44 | #include "sysfile.h" |
45 | #include "ocfs2_trace.h" | ||
46 | 46 | ||
47 | #include "buffer_head_io.h" | 47 | #include "buffer_head_io.h" |
48 | 48 | ||
@@ -201,8 +201,7 @@ void ocfs2_la_set_sizes(struct ocfs2_super *osb, int requested_mb) | |||
201 | la_max_mb = ocfs2_clusters_to_megabytes(sb, | 201 | la_max_mb = ocfs2_clusters_to_megabytes(sb, |
202 | ocfs2_local_alloc_size(sb) * 8); | 202 | ocfs2_local_alloc_size(sb) * 8); |
203 | 203 | ||
204 | mlog(0, "requested: %dM, max: %uM, default: %uM\n", | 204 | trace_ocfs2_la_set_sizes(requested_mb, la_max_mb, la_default_mb); |
205 | requested_mb, la_max_mb, la_default_mb); | ||
206 | 205 | ||
207 | if (requested_mb == -1) { | 206 | if (requested_mb == -1) { |
208 | /* No user request - use defaults */ | 207 | /* No user request - use defaults */ |
@@ -276,8 +275,8 @@ int ocfs2_alloc_should_use_local(struct ocfs2_super *osb, u64 bits) | |||
276 | 275 | ||
277 | ret = 1; | 276 | ret = 1; |
278 | bail: | 277 | bail: |
279 | mlog(0, "state=%d, bits=%llu, la_bits=%d, ret=%d\n", | 278 | trace_ocfs2_alloc_should_use_local( |
280 | osb->local_alloc_state, (unsigned long long)bits, la_bits, ret); | 279 | (unsigned long long)bits, osb->local_alloc_state, la_bits, ret); |
281 | spin_unlock(&osb->osb_lock); | 280 | spin_unlock(&osb->osb_lock); |
282 | return ret; | 281 | return ret; |
283 | } | 282 | } |
@@ -291,8 +290,6 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb) | |||
291 | struct inode *inode = NULL; | 290 | struct inode *inode = NULL; |
292 | struct ocfs2_local_alloc *la; | 291 | struct ocfs2_local_alloc *la; |
293 | 292 | ||
294 | mlog_entry_void(); | ||
295 | |||
296 | if (osb->local_alloc_bits == 0) | 293 | if (osb->local_alloc_bits == 0) |
297 | goto bail; | 294 | goto bail; |
298 | 295 | ||
@@ -364,9 +361,10 @@ bail: | |||
364 | if (inode) | 361 | if (inode) |
365 | iput(inode); | 362 | iput(inode); |
366 | 363 | ||
367 | mlog(0, "Local alloc window bits = %d\n", osb->local_alloc_bits); | 364 | trace_ocfs2_load_local_alloc(osb->local_alloc_bits); |
368 | 365 | ||
369 | mlog_exit(status); | 366 | if (status) |
367 | mlog_errno(status); | ||
370 | return status; | 368 | return status; |
371 | } | 369 | } |
372 | 370 | ||
@@ -388,8 +386,6 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb) | |||
388 | struct ocfs2_dinode *alloc_copy = NULL; | 386 | struct ocfs2_dinode *alloc_copy = NULL; |
389 | struct ocfs2_dinode *alloc = NULL; | 387 | struct ocfs2_dinode *alloc = NULL; |
390 | 388 | ||
391 | mlog_entry_void(); | ||
392 | |||
393 | cancel_delayed_work(&osb->la_enable_wq); | 389 | cancel_delayed_work(&osb->la_enable_wq); |
394 | flush_workqueue(ocfs2_wq); | 390 | flush_workqueue(ocfs2_wq); |
395 | 391 | ||
@@ -482,8 +478,6 @@ out: | |||
482 | 478 | ||
483 | if (alloc_copy) | 479 | if (alloc_copy) |
484 | kfree(alloc_copy); | 480 | kfree(alloc_copy); |
485 | |||
486 | mlog_exit_void(); | ||
487 | } | 481 | } |
488 | 482 | ||
489 | /* | 483 | /* |
@@ -502,7 +496,7 @@ int ocfs2_begin_local_alloc_recovery(struct ocfs2_super *osb, | |||
502 | struct inode *inode = NULL; | 496 | struct inode *inode = NULL; |
503 | struct ocfs2_dinode *alloc; | 497 | struct ocfs2_dinode *alloc; |
504 | 498 | ||
505 | mlog_entry("(slot_num = %d)\n", slot_num); | 499 | trace_ocfs2_begin_local_alloc_recovery(slot_num); |
506 | 500 | ||
507 | *alloc_copy = NULL; | 501 | *alloc_copy = NULL; |
508 | 502 | ||
@@ -552,7 +546,8 @@ bail: | |||
552 | iput(inode); | 546 | iput(inode); |
553 | } | 547 | } |
554 | 548 | ||
555 | mlog_exit(status); | 549 | if (status) |
550 | mlog_errno(status); | ||
556 | return status; | 551 | return status; |
557 | } | 552 | } |
558 | 553 | ||
@@ -570,8 +565,6 @@ int ocfs2_complete_local_alloc_recovery(struct ocfs2_super *osb, | |||
570 | struct buffer_head *main_bm_bh = NULL; | 565 | struct buffer_head *main_bm_bh = NULL; |
571 | struct inode *main_bm_inode; | 566 | struct inode *main_bm_inode; |
572 | 567 | ||
573 | mlog_entry_void(); | ||
574 | |||
575 | main_bm_inode = ocfs2_get_system_file_inode(osb, | 568 | main_bm_inode = ocfs2_get_system_file_inode(osb, |
576 | GLOBAL_BITMAP_SYSTEM_INODE, | 569 | GLOBAL_BITMAP_SYSTEM_INODE, |
577 | OCFS2_INVALID_SLOT); | 570 | OCFS2_INVALID_SLOT); |
@@ -620,7 +613,8 @@ out_mutex: | |||
620 | out: | 613 | out: |
621 | if (!status) | 614 | if (!status) |
622 | ocfs2_init_steal_slots(osb); | 615 | ocfs2_init_steal_slots(osb); |
623 | mlog_exit(status); | 616 | if (status) |
617 | mlog_errno(status); | ||
624 | return status; | 618 | return status; |
625 | } | 619 | } |
626 | 620 | ||
@@ -640,8 +634,6 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, | |||
640 | struct inode *local_alloc_inode; | 634 | struct inode *local_alloc_inode; |
641 | unsigned int free_bits; | 635 | unsigned int free_bits; |
642 | 636 | ||
643 | mlog_entry_void(); | ||
644 | |||
645 | BUG_ON(!ac); | 637 | BUG_ON(!ac); |
646 | 638 | ||
647 | local_alloc_inode = | 639 | local_alloc_inode = |
@@ -712,10 +704,6 @@ int ocfs2_reserve_local_alloc_bits(struct ocfs2_super *osb, | |||
712 | goto bail; | 704 | goto bail; |
713 | } | 705 | } |
714 | 706 | ||
715 | if (ac->ac_max_block) | ||
716 | mlog(0, "Calling in_range for max block %llu\n", | ||
717 | (unsigned long long)ac->ac_max_block); | ||
718 | |||
719 | ac->ac_inode = local_alloc_inode; | 707 | ac->ac_inode = local_alloc_inode; |
720 | /* We should never use localalloc from another slot */ | 708 | /* We should never use localalloc from another slot */ |
721 | ac->ac_alloc_slot = osb->slot_num; | 709 | ac->ac_alloc_slot = osb->slot_num; |
@@ -729,10 +717,12 @@ bail: | |||
729 | iput(local_alloc_inode); | 717 | iput(local_alloc_inode); |
730 | } | 718 | } |
731 | 719 | ||
732 | mlog(0, "bits=%d, slot=%d, ret=%d\n", bits_wanted, osb->slot_num, | 720 | trace_ocfs2_reserve_local_alloc_bits( |
733 | status); | 721 | (unsigned long long)ac->ac_max_block, |
722 | bits_wanted, osb->slot_num, status); | ||
734 | 723 | ||
735 | mlog_exit(status); | 724 | if (status) |
725 | mlog_errno(status); | ||
736 | return status; | 726 | return status; |
737 | } | 727 | } |
738 | 728 | ||
@@ -749,7 +739,6 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb, | |||
749 | struct ocfs2_dinode *alloc; | 739 | struct ocfs2_dinode *alloc; |
750 | struct ocfs2_local_alloc *la; | 740 | struct ocfs2_local_alloc *la; |
751 | 741 | ||
752 | mlog_entry_void(); | ||
753 | BUG_ON(ac->ac_which != OCFS2_AC_USE_LOCAL); | 742 | BUG_ON(ac->ac_which != OCFS2_AC_USE_LOCAL); |
754 | 743 | ||
755 | local_alloc_inode = ac->ac_inode; | 744 | local_alloc_inode = ac->ac_inode; |
@@ -788,7 +777,8 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb, | |||
788 | ocfs2_journal_dirty(handle, osb->local_alloc_bh); | 777 | ocfs2_journal_dirty(handle, osb->local_alloc_bh); |
789 | 778 | ||
790 | bail: | 779 | bail: |
791 | mlog_exit(status); | 780 | if (status) |
781 | mlog_errno(status); | ||
792 | return status; | 782 | return status; |
793 | } | 783 | } |
794 | 784 | ||
@@ -799,13 +789,11 @@ static u32 ocfs2_local_alloc_count_bits(struct ocfs2_dinode *alloc) | |||
799 | u32 count = 0; | 789 | u32 count = 0; |
800 | struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc); | 790 | struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc); |
801 | 791 | ||
802 | mlog_entry_void(); | ||
803 | |||
804 | buffer = la->la_bitmap; | 792 | buffer = la->la_bitmap; |
805 | for (i = 0; i < le16_to_cpu(la->la_size); i++) | 793 | for (i = 0; i < le16_to_cpu(la->la_size); i++) |
806 | count += hweight8(buffer[i]); | 794 | count += hweight8(buffer[i]); |
807 | 795 | ||
808 | mlog_exit(count); | 796 | trace_ocfs2_local_alloc_count_bits(count); |
809 | return count; | 797 | return count; |
810 | } | 798 | } |
811 | 799 | ||
@@ -820,10 +808,7 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb, | |||
820 | void *bitmap = NULL; | 808 | void *bitmap = NULL; |
821 | struct ocfs2_reservation_map *resmap = &osb->osb_la_resmap; | 809 | struct ocfs2_reservation_map *resmap = &osb->osb_la_resmap; |
822 | 810 | ||
823 | mlog_entry("(numbits wanted = %u)\n", *numbits); | ||
824 | |||
825 | if (!alloc->id1.bitmap1.i_total) { | 811 | if (!alloc->id1.bitmap1.i_total) { |
826 | mlog(0, "No bits in my window!\n"); | ||
827 | bitoff = -1; | 812 | bitoff = -1; |
828 | goto bail; | 813 | goto bail; |
829 | } | 814 | } |
@@ -883,8 +868,7 @@ static int ocfs2_local_alloc_find_clear_bits(struct ocfs2_super *osb, | |||
883 | } | 868 | } |
884 | } | 869 | } |
885 | 870 | ||
886 | mlog(0, "Exiting loop, bitoff = %d, numfound = %d\n", bitoff, | 871 | trace_ocfs2_local_alloc_find_clear_bits_search_bitmap(bitoff, numfound); |
887 | numfound); | ||
888 | 872 | ||
889 | if (numfound == *numbits) | 873 | if (numfound == *numbits) |
890 | bitoff = startoff - numfound; | 874 | bitoff = startoff - numfound; |
@@ -895,7 +879,10 @@ bail: | |||
895 | if (local_resv) | 879 | if (local_resv) |
896 | ocfs2_resv_discard(resmap, resv); | 880 | ocfs2_resv_discard(resmap, resv); |
897 | 881 | ||
898 | mlog_exit(bitoff); | 882 | trace_ocfs2_local_alloc_find_clear_bits(*numbits, |
883 | le32_to_cpu(alloc->id1.bitmap1.i_total), | ||
884 | bitoff, numfound); | ||
885 | |||
899 | return bitoff; | 886 | return bitoff; |
900 | } | 887 | } |
901 | 888 | ||
@@ -903,15 +890,12 @@ static void ocfs2_clear_local_alloc(struct ocfs2_dinode *alloc) | |||
903 | { | 890 | { |
904 | struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc); | 891 | struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc); |
905 | int i; | 892 | int i; |
906 | mlog_entry_void(); | ||
907 | 893 | ||
908 | alloc->id1.bitmap1.i_total = 0; | 894 | alloc->id1.bitmap1.i_total = 0; |
909 | alloc->id1.bitmap1.i_used = 0; | 895 | alloc->id1.bitmap1.i_used = 0; |
910 | la->la_bm_off = 0; | 896 | la->la_bm_off = 0; |
911 | for(i = 0; i < le16_to_cpu(la->la_size); i++) | 897 | for(i = 0; i < le16_to_cpu(la->la_size); i++) |
912 | la->la_bitmap[i] = 0; | 898 | la->la_bitmap[i] = 0; |
913 | |||
914 | mlog_exit_void(); | ||
915 | } | 899 | } |
916 | 900 | ||
917 | #if 0 | 901 | #if 0 |
@@ -952,18 +936,16 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, | |||
952 | void *bitmap; | 936 | void *bitmap; |
953 | struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc); | 937 | struct ocfs2_local_alloc *la = OCFS2_LOCAL_ALLOC(alloc); |
954 | 938 | ||
955 | mlog_entry("total = %u, used = %u\n", | 939 | trace_ocfs2_sync_local_to_main( |
956 | le32_to_cpu(alloc->id1.bitmap1.i_total), | 940 | le32_to_cpu(alloc->id1.bitmap1.i_total), |
957 | le32_to_cpu(alloc->id1.bitmap1.i_used)); | 941 | le32_to_cpu(alloc->id1.bitmap1.i_used)); |
958 | 942 | ||
959 | if (!alloc->id1.bitmap1.i_total) { | 943 | if (!alloc->id1.bitmap1.i_total) { |
960 | mlog(0, "nothing to sync!\n"); | ||
961 | goto bail; | 944 | goto bail; |
962 | } | 945 | } |
963 | 946 | ||
964 | if (le32_to_cpu(alloc->id1.bitmap1.i_used) == | 947 | if (le32_to_cpu(alloc->id1.bitmap1.i_used) == |
965 | le32_to_cpu(alloc->id1.bitmap1.i_total)) { | 948 | le32_to_cpu(alloc->id1.bitmap1.i_total)) { |
966 | mlog(0, "all bits were taken!\n"); | ||
967 | goto bail; | 949 | goto bail; |
968 | } | 950 | } |
969 | 951 | ||
@@ -985,8 +967,7 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, | |||
985 | ocfs2_clusters_to_blocks(osb->sb, | 967 | ocfs2_clusters_to_blocks(osb->sb, |
986 | start - count); | 968 | start - count); |
987 | 969 | ||
988 | mlog(0, "freeing %u bits starting at local alloc bit " | 970 | trace_ocfs2_sync_local_to_main_free( |
989 | "%u (la_start_blk = %llu, blkno = %llu)\n", | ||
990 | count, start - count, | 971 | count, start - count, |
991 | (unsigned long long)la_start_blk, | 972 | (unsigned long long)la_start_blk, |
992 | (unsigned long long)blkno); | 973 | (unsigned long long)blkno); |
@@ -1007,7 +988,8 @@ static int ocfs2_sync_local_to_main(struct ocfs2_super *osb, | |||
1007 | } | 988 | } |
1008 | 989 | ||
1009 | bail: | 990 | bail: |
1010 | mlog_exit(status); | 991 | if (status) |
992 | mlog_errno(status); | ||
1011 | return status; | 993 | return status; |
1012 | } | 994 | } |
1013 | 995 | ||
@@ -1132,7 +1114,8 @@ bail: | |||
1132 | *ac = NULL; | 1114 | *ac = NULL; |
1133 | } | 1115 | } |
1134 | 1116 | ||
1135 | mlog_exit(status); | 1117 | if (status) |
1118 | mlog_errno(status); | ||
1136 | return status; | 1119 | return status; |
1137 | } | 1120 | } |
1138 | 1121 | ||
@@ -1148,17 +1131,12 @@ static int ocfs2_local_alloc_new_window(struct ocfs2_super *osb, | |||
1148 | struct ocfs2_dinode *alloc = NULL; | 1131 | struct ocfs2_dinode *alloc = NULL; |
1149 | struct ocfs2_local_alloc *la; | 1132 | struct ocfs2_local_alloc *la; |
1150 | 1133 | ||
1151 | mlog_entry_void(); | ||
1152 | |||
1153 | alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data; | 1134 | alloc = (struct ocfs2_dinode *) osb->local_alloc_bh->b_data; |
1154 | la = OCFS2_LOCAL_ALLOC(alloc); | 1135 | la = OCFS2_LOCAL_ALLOC(alloc); |
1155 | 1136 | ||
1156 | if (alloc->id1.bitmap1.i_total) | 1137 | trace_ocfs2_local_alloc_new_window( |
1157 | mlog(0, "asking me to alloc a new window over a non-empty " | 1138 | le32_to_cpu(alloc->id1.bitmap1.i_total), |
1158 | "one\n"); | 1139 | osb->local_alloc_bits); |
1159 | |||
1160 | mlog(0, "Allocating %u clusters for a new window.\n", | ||
1161 | osb->local_alloc_bits); | ||
1162 | 1140 | ||
1163 | /* Instruct the allocation code to try the most recently used | 1141 | /* Instruct the allocation code to try the most recently used |
1164 | * cluster group. We'll re-record the group used this pass | 1142 | * cluster group. We'll re-record the group used this pass |
@@ -1220,13 +1198,13 @@ retry_enospc: | |||
1220 | ocfs2_resmap_restart(&osb->osb_la_resmap, cluster_count, | 1198 | ocfs2_resmap_restart(&osb->osb_la_resmap, cluster_count, |
1221 | OCFS2_LOCAL_ALLOC(alloc)->la_bitmap); | 1199 | OCFS2_LOCAL_ALLOC(alloc)->la_bitmap); |
1222 | 1200 | ||
1223 | mlog(0, "New window allocated:\n"); | 1201 | trace_ocfs2_local_alloc_new_window_result( |
1224 | mlog(0, "window la_bm_off = %u\n", | 1202 | OCFS2_LOCAL_ALLOC(alloc)->la_bm_off, |
1225 | OCFS2_LOCAL_ALLOC(alloc)->la_bm_off); | 1203 | le32_to_cpu(alloc->id1.bitmap1.i_total)); |
1226 | mlog(0, "window bits = %u\n", le32_to_cpu(alloc->id1.bitmap1.i_total)); | ||
1227 | 1204 | ||
1228 | bail: | 1205 | bail: |
1229 | mlog_exit(status); | 1206 | if (status) |
1207 | mlog_errno(status); | ||
1230 | return status; | 1208 | return status; |
1231 | } | 1209 | } |
1232 | 1210 | ||
@@ -1243,8 +1221,6 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb, | |||
1243 | struct ocfs2_dinode *alloc_copy = NULL; | 1221 | struct ocfs2_dinode *alloc_copy = NULL; |
1244 | struct ocfs2_alloc_context *ac = NULL; | 1222 | struct ocfs2_alloc_context *ac = NULL; |
1245 | 1223 | ||
1246 | mlog_entry_void(); | ||
1247 | |||
1248 | ocfs2_recalc_la_window(osb, OCFS2_LA_EVENT_SLIDE); | 1224 | ocfs2_recalc_la_window(osb, OCFS2_LA_EVENT_SLIDE); |
1249 | 1225 | ||
1250 | /* This will lock the main bitmap for us. */ | 1226 | /* This will lock the main bitmap for us. */ |
@@ -1324,7 +1300,8 @@ bail: | |||
1324 | if (ac) | 1300 | if (ac) |
1325 | ocfs2_free_alloc_context(ac); | 1301 | ocfs2_free_alloc_context(ac); |
1326 | 1302 | ||
1327 | mlog_exit(status); | 1303 | if (status) |
1304 | mlog_errno(status); | ||
1328 | return status; | 1305 | return status; |
1329 | } | 1306 | } |
1330 | 1307 | ||
diff --git a/fs/ocfs2/locks.c b/fs/ocfs2/locks.c index b5cb3ede9408..e57c804069ea 100644 --- a/fs/ocfs2/locks.c +++ b/fs/ocfs2/locks.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
27 | #include <linux/fcntl.h> | 27 | #include <linux/fcntl.h> |
28 | 28 | ||
29 | #define MLOG_MASK_PREFIX ML_INODE | ||
30 | #include <cluster/masklog.h> | 29 | #include <cluster/masklog.h> |
31 | 30 | ||
32 | #include "ocfs2.h" | 31 | #include "ocfs2.h" |
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index 7e32db9c2c99..3e9393ca39eb 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/signal.h> | 31 | #include <linux/signal.h> |
32 | #include <linux/rbtree.h> | 32 | #include <linux/rbtree.h> |
33 | 33 | ||
34 | #define MLOG_MASK_PREFIX ML_FILE_IO | ||
35 | #include <cluster/masklog.h> | 34 | #include <cluster/masklog.h> |
36 | 35 | ||
37 | #include "ocfs2.h" | 36 | #include "ocfs2.h" |
@@ -42,6 +41,7 @@ | |||
42 | #include "inode.h" | 41 | #include "inode.h" |
43 | #include "mmap.h" | 42 | #include "mmap.h" |
44 | #include "super.h" | 43 | #include "super.h" |
44 | #include "ocfs2_trace.h" | ||
45 | 45 | ||
46 | 46 | ||
47 | static int ocfs2_fault(struct vm_area_struct *area, struct vm_fault *vmf) | 47 | static int ocfs2_fault(struct vm_area_struct *area, struct vm_fault *vmf) |
@@ -49,13 +49,12 @@ static int ocfs2_fault(struct vm_area_struct *area, struct vm_fault *vmf) | |||
49 | sigset_t oldset; | 49 | sigset_t oldset; |
50 | int ret; | 50 | int ret; |
51 | 51 | ||
52 | mlog_entry("(area=%p, page offset=%lu)\n", area, vmf->pgoff); | ||
53 | |||
54 | ocfs2_block_signals(&oldset); | 52 | ocfs2_block_signals(&oldset); |
55 | ret = filemap_fault(area, vmf); | 53 | ret = filemap_fault(area, vmf); |
56 | ocfs2_unblock_signals(&oldset); | 54 | ocfs2_unblock_signals(&oldset); |
57 | 55 | ||
58 | mlog_exit_ptr(vmf->page); | 56 | trace_ocfs2_fault(OCFS2_I(area->vm_file->f_mapping->host)->ip_blkno, |
57 | area, vmf->page, vmf->pgoff); | ||
59 | return ret; | 58 | return ret; |
60 | } | 59 | } |
61 | 60 | ||
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index 849fb4a2e814..b6fa9eb2d298 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <linux/highmem.h> | 42 | #include <linux/highmem.h> |
43 | #include <linux/quotaops.h> | 43 | #include <linux/quotaops.h> |
44 | 44 | ||
45 | #define MLOG_MASK_PREFIX ML_NAMEI | ||
46 | #include <cluster/masklog.h> | 45 | #include <cluster/masklog.h> |
47 | 46 | ||
48 | #include "ocfs2.h" | 47 | #include "ocfs2.h" |
@@ -63,6 +62,7 @@ | |||
63 | #include "uptodate.h" | 62 | #include "uptodate.h" |
64 | #include "xattr.h" | 63 | #include "xattr.h" |
65 | #include "acl.h" | 64 | #include "acl.h" |
65 | #include "ocfs2_trace.h" | ||
66 | 66 | ||
67 | #include "buffer_head_io.h" | 67 | #include "buffer_head_io.h" |
68 | 68 | ||
@@ -106,17 +106,15 @@ static struct dentry *ocfs2_lookup(struct inode *dir, struct dentry *dentry, | |||
106 | struct dentry *ret; | 106 | struct dentry *ret; |
107 | struct ocfs2_inode_info *oi; | 107 | struct ocfs2_inode_info *oi; |
108 | 108 | ||
109 | mlog_entry("(0x%p, 0x%p, '%.*s')\n", dir, dentry, | 109 | trace_ocfs2_lookup(dir, dentry, dentry->d_name.len, |
110 | dentry->d_name.len, dentry->d_name.name); | 110 | dentry->d_name.name, |
111 | (unsigned long long)OCFS2_I(dir)->ip_blkno, 0); | ||
111 | 112 | ||
112 | if (dentry->d_name.len > OCFS2_MAX_FILENAME_LEN) { | 113 | if (dentry->d_name.len > OCFS2_MAX_FILENAME_LEN) { |
113 | ret = ERR_PTR(-ENAMETOOLONG); | 114 | ret = ERR_PTR(-ENAMETOOLONG); |
114 | goto bail; | 115 | goto bail; |
115 | } | 116 | } |
116 | 117 | ||
117 | mlog(0, "find name %.*s in directory %llu\n", dentry->d_name.len, | ||
118 | dentry->d_name.name, (unsigned long long)OCFS2_I(dir)->ip_blkno); | ||
119 | |||
120 | status = ocfs2_inode_lock_nested(dir, NULL, 0, OI_LS_PARENT); | 118 | status = ocfs2_inode_lock_nested(dir, NULL, 0, OI_LS_PARENT); |
121 | if (status < 0) { | 119 | if (status < 0) { |
122 | if (status != -ENOENT) | 120 | if (status != -ENOENT) |
@@ -182,7 +180,7 @@ bail_unlock: | |||
182 | 180 | ||
183 | bail: | 181 | bail: |
184 | 182 | ||
185 | mlog_exit_ptr(ret); | 183 | trace_ocfs2_lookup_ret(ret); |
186 | 184 | ||
187 | return ret; | 185 | return ret; |
188 | } | 186 | } |
@@ -235,9 +233,9 @@ static int ocfs2_mknod(struct inode *dir, | |||
235 | sigset_t oldset; | 233 | sigset_t oldset; |
236 | int did_block_signals = 0; | 234 | int did_block_signals = 0; |
237 | 235 | ||
238 | mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, mode, | 236 | trace_ocfs2_mknod(dir, dentry, dentry->d_name.len, dentry->d_name.name, |
239 | (unsigned long)dev, dentry->d_name.len, | 237 | (unsigned long long)OCFS2_I(dir)->ip_blkno, |
240 | dentry->d_name.name); | 238 | (unsigned long)dev, mode); |
241 | 239 | ||
242 | dquot_initialize(dir); | 240 | dquot_initialize(dir); |
243 | 241 | ||
@@ -354,10 +352,6 @@ static int ocfs2_mknod(struct inode *dir, | |||
354 | goto leave; | 352 | goto leave; |
355 | did_quota_inode = 1; | 353 | did_quota_inode = 1; |
356 | 354 | ||
357 | mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, | ||
358 | inode->i_mode, (unsigned long)dev, dentry->d_name.len, | ||
359 | dentry->d_name.name); | ||
360 | |||
361 | /* do the real work now. */ | 355 | /* do the real work now. */ |
362 | status = ocfs2_mknod_locked(osb, dir, inode, dev, | 356 | status = ocfs2_mknod_locked(osb, dir, inode, dev, |
363 | &new_fe_bh, parent_fe_bh, handle, | 357 | &new_fe_bh, parent_fe_bh, handle, |
@@ -436,9 +430,6 @@ leave: | |||
436 | if (did_block_signals) | 430 | if (did_block_signals) |
437 | ocfs2_unblock_signals(&oldset); | 431 | ocfs2_unblock_signals(&oldset); |
438 | 432 | ||
439 | if (status == -ENOSPC) | ||
440 | mlog(0, "Disk is full\n"); | ||
441 | |||
442 | brelse(new_fe_bh); | 433 | brelse(new_fe_bh); |
443 | brelse(parent_fe_bh); | 434 | brelse(parent_fe_bh); |
444 | kfree(si.name); | 435 | kfree(si.name); |
@@ -466,7 +457,8 @@ leave: | |||
466 | iput(inode); | 457 | iput(inode); |
467 | } | 458 | } |
468 | 459 | ||
469 | mlog_exit(status); | 460 | if (status) |
461 | mlog_errno(status); | ||
470 | 462 | ||
471 | return status; | 463 | return status; |
472 | } | 464 | } |
@@ -577,7 +569,8 @@ leave: | |||
577 | } | 569 | } |
578 | } | 570 | } |
579 | 571 | ||
580 | mlog_exit(status); | 572 | if (status) |
573 | mlog_errno(status); | ||
581 | return status; | 574 | return status; |
582 | } | 575 | } |
583 | 576 | ||
@@ -615,10 +608,11 @@ static int ocfs2_mkdir(struct inode *dir, | |||
615 | { | 608 | { |
616 | int ret; | 609 | int ret; |
617 | 610 | ||
618 | mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry, mode, | 611 | trace_ocfs2_mkdir(dir, dentry, dentry->d_name.len, dentry->d_name.name, |
619 | dentry->d_name.len, dentry->d_name.name); | 612 | OCFS2_I(dir)->ip_blkno, mode); |
620 | ret = ocfs2_mknod(dir, dentry, mode | S_IFDIR, 0); | 613 | ret = ocfs2_mknod(dir, dentry, mode | S_IFDIR, 0); |
621 | mlog_exit(ret); | 614 | if (ret) |
615 | mlog_errno(ret); | ||
622 | 616 | ||
623 | return ret; | 617 | return ret; |
624 | } | 618 | } |
@@ -630,10 +624,11 @@ static int ocfs2_create(struct inode *dir, | |||
630 | { | 624 | { |
631 | int ret; | 625 | int ret; |
632 | 626 | ||
633 | mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry, mode, | 627 | trace_ocfs2_create(dir, dentry, dentry->d_name.len, dentry->d_name.name, |
634 | dentry->d_name.len, dentry->d_name.name); | 628 | (unsigned long long)OCFS2_I(dir)->ip_blkno, mode); |
635 | ret = ocfs2_mknod(dir, dentry, mode | S_IFREG, 0); | 629 | ret = ocfs2_mknod(dir, dentry, mode | S_IFREG, 0); |
636 | mlog_exit(ret); | 630 | if (ret) |
631 | mlog_errno(ret); | ||
637 | 632 | ||
638 | return ret; | 633 | return ret; |
639 | } | 634 | } |
@@ -652,9 +647,9 @@ static int ocfs2_link(struct dentry *old_dentry, | |||
652 | struct ocfs2_dir_lookup_result lookup = { NULL, }; | 647 | struct ocfs2_dir_lookup_result lookup = { NULL, }; |
653 | sigset_t oldset; | 648 | sigset_t oldset; |
654 | 649 | ||
655 | mlog_entry("(inode=%lu, old='%.*s' new='%.*s')\n", inode->i_ino, | 650 | trace_ocfs2_link((unsigned long long)OCFS2_I(inode)->ip_blkno, |
656 | old_dentry->d_name.len, old_dentry->d_name.name, | 651 | old_dentry->d_name.len, old_dentry->d_name.name, |
657 | dentry->d_name.len, dentry->d_name.name); | 652 | dentry->d_name.len, dentry->d_name.name); |
658 | 653 | ||
659 | if (S_ISDIR(inode->i_mode)) | 654 | if (S_ISDIR(inode->i_mode)) |
660 | return -EPERM; | 655 | return -EPERM; |
@@ -757,7 +752,8 @@ out: | |||
757 | 752 | ||
758 | ocfs2_free_dir_lookup_result(&lookup); | 753 | ocfs2_free_dir_lookup_result(&lookup); |
759 | 754 | ||
760 | mlog_exit(err); | 755 | if (err) |
756 | mlog_errno(err); | ||
761 | 757 | ||
762 | return err; | 758 | return err; |
763 | } | 759 | } |
@@ -809,19 +805,17 @@ static int ocfs2_unlink(struct inode *dir, | |||
809 | struct ocfs2_dir_lookup_result lookup = { NULL, }; | 805 | struct ocfs2_dir_lookup_result lookup = { NULL, }; |
810 | struct ocfs2_dir_lookup_result orphan_insert = { NULL, }; | 806 | struct ocfs2_dir_lookup_result orphan_insert = { NULL, }; |
811 | 807 | ||
812 | mlog_entry("(0x%p, 0x%p, '%.*s')\n", dir, dentry, | 808 | trace_ocfs2_unlink(dir, dentry, dentry->d_name.len, |
813 | dentry->d_name.len, dentry->d_name.name); | 809 | dentry->d_name.name, |
810 | (unsigned long long)OCFS2_I(dir)->ip_blkno, | ||
811 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | ||
814 | 812 | ||
815 | dquot_initialize(dir); | 813 | dquot_initialize(dir); |
816 | 814 | ||
817 | BUG_ON(dentry->d_parent->d_inode != dir); | 815 | BUG_ON(dentry->d_parent->d_inode != dir); |
818 | 816 | ||
819 | mlog(0, "ino = %llu\n", (unsigned long long)OCFS2_I(inode)->ip_blkno); | 817 | if (inode == osb->root_inode) |
820 | |||
821 | if (inode == osb->root_inode) { | ||
822 | mlog(0, "Cannot delete the root directory\n"); | ||
823 | return -EPERM; | 818 | return -EPERM; |
824 | } | ||
825 | 819 | ||
826 | status = ocfs2_inode_lock_nested(dir, &parent_node_bh, 1, | 820 | status = ocfs2_inode_lock_nested(dir, &parent_node_bh, 1, |
827 | OI_LS_PARENT); | 821 | OI_LS_PARENT); |
@@ -843,9 +837,10 @@ static int ocfs2_unlink(struct inode *dir, | |||
843 | if (OCFS2_I(inode)->ip_blkno != blkno) { | 837 | if (OCFS2_I(inode)->ip_blkno != blkno) { |
844 | status = -ENOENT; | 838 | status = -ENOENT; |
845 | 839 | ||
846 | mlog(0, "ip_blkno %llu != dirent blkno %llu ip_flags = %x\n", | 840 | trace_ocfs2_unlink_noent( |
847 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 841 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
848 | (unsigned long long)blkno, OCFS2_I(inode)->ip_flags); | 842 | (unsigned long long)blkno, |
843 | OCFS2_I(inode)->ip_flags); | ||
849 | goto leave; | 844 | goto leave; |
850 | } | 845 | } |
851 | 846 | ||
@@ -954,7 +949,8 @@ leave: | |||
954 | ocfs2_free_dir_lookup_result(&orphan_insert); | 949 | ocfs2_free_dir_lookup_result(&orphan_insert); |
955 | ocfs2_free_dir_lookup_result(&lookup); | 950 | ocfs2_free_dir_lookup_result(&lookup); |
956 | 951 | ||
957 | mlog_exit(status); | 952 | if (status) |
953 | mlog_errno(status); | ||
958 | 954 | ||
959 | return status; | 955 | return status; |
960 | } | 956 | } |
@@ -975,9 +971,8 @@ static int ocfs2_double_lock(struct ocfs2_super *osb, | |||
975 | struct buffer_head **tmpbh; | 971 | struct buffer_head **tmpbh; |
976 | struct inode *tmpinode; | 972 | struct inode *tmpinode; |
977 | 973 | ||
978 | mlog_entry("(inode1 = %llu, inode2 = %llu)\n", | 974 | trace_ocfs2_double_lock((unsigned long long)oi1->ip_blkno, |
979 | (unsigned long long)oi1->ip_blkno, | 975 | (unsigned long long)oi2->ip_blkno); |
980 | (unsigned long long)oi2->ip_blkno); | ||
981 | 976 | ||
982 | if (*bh1) | 977 | if (*bh1) |
983 | *bh1 = NULL; | 978 | *bh1 = NULL; |
@@ -988,7 +983,6 @@ static int ocfs2_double_lock(struct ocfs2_super *osb, | |||
988 | if (oi1->ip_blkno != oi2->ip_blkno) { | 983 | if (oi1->ip_blkno != oi2->ip_blkno) { |
989 | if (oi1->ip_blkno < oi2->ip_blkno) { | 984 | if (oi1->ip_blkno < oi2->ip_blkno) { |
990 | /* switch id1 and id2 around */ | 985 | /* switch id1 and id2 around */ |
991 | mlog(0, "switching them around...\n"); | ||
992 | tmpbh = bh2; | 986 | tmpbh = bh2; |
993 | bh2 = bh1; | 987 | bh2 = bh1; |
994 | bh1 = tmpbh; | 988 | bh1 = tmpbh; |
@@ -1024,8 +1018,13 @@ static int ocfs2_double_lock(struct ocfs2_super *osb, | |||
1024 | mlog_errno(status); | 1018 | mlog_errno(status); |
1025 | } | 1019 | } |
1026 | 1020 | ||
1021 | trace_ocfs2_double_lock_end( | ||
1022 | (unsigned long long)OCFS2_I(inode1)->ip_blkno, | ||
1023 | (unsigned long long)OCFS2_I(inode2)->ip_blkno); | ||
1024 | |||
1027 | bail: | 1025 | bail: |
1028 | mlog_exit(status); | 1026 | if (status) |
1027 | mlog_errno(status); | ||
1029 | return status; | 1028 | return status; |
1030 | } | 1029 | } |
1031 | 1030 | ||
@@ -1067,10 +1066,9 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1067 | /* At some point it might be nice to break this function up a | 1066 | /* At some point it might be nice to break this function up a |
1068 | * bit. */ | 1067 | * bit. */ |
1069 | 1068 | ||
1070 | mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p, from='%.*s' to='%.*s')\n", | 1069 | trace_ocfs2_rename(old_dir, old_dentry, new_dir, new_dentry, |
1071 | old_dir, old_dentry, new_dir, new_dentry, | 1070 | old_dentry->d_name.len, old_dentry->d_name.name, |
1072 | old_dentry->d_name.len, old_dentry->d_name.name, | 1071 | new_dentry->d_name.len, new_dentry->d_name.name); |
1073 | new_dentry->d_name.len, new_dentry->d_name.name); | ||
1074 | 1072 | ||
1075 | dquot_initialize(old_dir); | 1073 | dquot_initialize(old_dir); |
1076 | dquot_initialize(new_dir); | 1074 | dquot_initialize(new_dir); |
@@ -1227,16 +1225,15 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1227 | if (!new_inode) { | 1225 | if (!new_inode) { |
1228 | status = -EACCES; | 1226 | status = -EACCES; |
1229 | 1227 | ||
1230 | mlog(0, "We found an inode for name %.*s but VFS " | 1228 | trace_ocfs2_rename_target_exists(new_dentry->d_name.len, |
1231 | "didn't give us one.\n", new_dentry->d_name.len, | 1229 | new_dentry->d_name.name); |
1232 | new_dentry->d_name.name); | ||
1233 | goto bail; | 1230 | goto bail; |
1234 | } | 1231 | } |
1235 | 1232 | ||
1236 | if (OCFS2_I(new_inode)->ip_blkno != newfe_blkno) { | 1233 | if (OCFS2_I(new_inode)->ip_blkno != newfe_blkno) { |
1237 | status = -EACCES; | 1234 | status = -EACCES; |
1238 | 1235 | ||
1239 | mlog(0, "Inode %llu and dir %llu disagree. flags = %x\n", | 1236 | trace_ocfs2_rename_disagree( |
1240 | (unsigned long long)OCFS2_I(new_inode)->ip_blkno, | 1237 | (unsigned long long)OCFS2_I(new_inode)->ip_blkno, |
1241 | (unsigned long long)newfe_blkno, | 1238 | (unsigned long long)newfe_blkno, |
1242 | OCFS2_I(new_inode)->ip_flags); | 1239 | OCFS2_I(new_inode)->ip_flags); |
@@ -1259,8 +1256,7 @@ static int ocfs2_rename(struct inode *old_dir, | |||
1259 | 1256 | ||
1260 | newfe = (struct ocfs2_dinode *) newfe_bh->b_data; | 1257 | newfe = (struct ocfs2_dinode *) newfe_bh->b_data; |
1261 | 1258 | ||
1262 | mlog(0, "aha rename over existing... new_blkno=%llu " | 1259 | trace_ocfs2_rename_over_existing( |
1263 | "newfebh=%p bhblocknr=%llu\n", | ||
1264 | (unsigned long long)newfe_blkno, newfe_bh, newfe_bh ? | 1260 | (unsigned long long)newfe_blkno, newfe_bh, newfe_bh ? |
1265 | (unsigned long long)newfe_bh->b_blocknr : 0ULL); | 1261 | (unsigned long long)newfe_bh->b_blocknr : 0ULL); |
1266 | 1262 | ||
@@ -1476,7 +1472,8 @@ bail: | |||
1476 | brelse(old_dir_bh); | 1472 | brelse(old_dir_bh); |
1477 | brelse(new_dir_bh); | 1473 | brelse(new_dir_bh); |
1478 | 1474 | ||
1479 | mlog_exit(status); | 1475 | if (status) |
1476 | mlog_errno(status); | ||
1480 | 1477 | ||
1481 | return status; | 1478 | return status; |
1482 | } | 1479 | } |
@@ -1501,9 +1498,8 @@ static int ocfs2_create_symlink_data(struct ocfs2_super *osb, | |||
1501 | * write i_size + 1 bytes. */ | 1498 | * write i_size + 1 bytes. */ |
1502 | blocks = (bytes_left + sb->s_blocksize - 1) >> sb->s_blocksize_bits; | 1499 | blocks = (bytes_left + sb->s_blocksize - 1) >> sb->s_blocksize_bits; |
1503 | 1500 | ||
1504 | mlog_entry("i_blocks = %llu, i_size = %llu, blocks = %d\n", | 1501 | trace_ocfs2_create_symlink_data((unsigned long long)inode->i_blocks, |
1505 | (unsigned long long)inode->i_blocks, | 1502 | i_size_read(inode), blocks); |
1506 | i_size_read(inode), blocks); | ||
1507 | 1503 | ||
1508 | /* Sanity check -- make sure we're going to fit. */ | 1504 | /* Sanity check -- make sure we're going to fit. */ |
1509 | if (bytes_left > | 1505 | if (bytes_left > |
@@ -1579,7 +1575,8 @@ bail: | |||
1579 | kfree(bhs); | 1575 | kfree(bhs); |
1580 | } | 1576 | } |
1581 | 1577 | ||
1582 | mlog_exit(status); | 1578 | if (status) |
1579 | mlog_errno(status); | ||
1583 | return status; | 1580 | return status; |
1584 | } | 1581 | } |
1585 | 1582 | ||
@@ -1610,8 +1607,8 @@ static int ocfs2_symlink(struct inode *dir, | |||
1610 | sigset_t oldset; | 1607 | sigset_t oldset; |
1611 | int did_block_signals = 0; | 1608 | int did_block_signals = 0; |
1612 | 1609 | ||
1613 | mlog_entry("(0x%p, 0x%p, symname='%s' actual='%.*s')\n", dir, | 1610 | trace_ocfs2_symlink_begin(dir, dentry, symname, |
1614 | dentry, symname, dentry->d_name.len, dentry->d_name.name); | 1611 | dentry->d_name.len, dentry->d_name.name); |
1615 | 1612 | ||
1616 | dquot_initialize(dir); | 1613 | dquot_initialize(dir); |
1617 | 1614 | ||
@@ -1713,9 +1710,10 @@ static int ocfs2_symlink(struct inode *dir, | |||
1713 | goto bail; | 1710 | goto bail; |
1714 | did_quota_inode = 1; | 1711 | did_quota_inode = 1; |
1715 | 1712 | ||
1716 | mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", dir, dentry, | 1713 | trace_ocfs2_symlink_create(dir, dentry, dentry->d_name.len, |
1717 | inode->i_mode, dentry->d_name.len, | 1714 | dentry->d_name.name, |
1718 | dentry->d_name.name); | 1715 | (unsigned long long)OCFS2_I(dir)->ip_blkno, |
1716 | inode->i_mode); | ||
1719 | 1717 | ||
1720 | status = ocfs2_mknod_locked(osb, dir, inode, | 1718 | status = ocfs2_mknod_locked(osb, dir, inode, |
1721 | 0, &new_fe_bh, parent_fe_bh, handle, | 1719 | 0, &new_fe_bh, parent_fe_bh, handle, |
@@ -1835,7 +1833,8 @@ bail: | |||
1835 | iput(inode); | 1833 | iput(inode); |
1836 | } | 1834 | } |
1837 | 1835 | ||
1838 | mlog_exit(status); | 1836 | if (status) |
1837 | mlog_errno(status); | ||
1839 | 1838 | ||
1840 | return status; | 1839 | return status; |
1841 | } | 1840 | } |
@@ -1844,8 +1843,6 @@ static int ocfs2_blkno_stringify(u64 blkno, char *name) | |||
1844 | { | 1843 | { |
1845 | int status, namelen; | 1844 | int status, namelen; |
1846 | 1845 | ||
1847 | mlog_entry_void(); | ||
1848 | |||
1849 | namelen = snprintf(name, OCFS2_ORPHAN_NAMELEN + 1, "%016llx", | 1846 | namelen = snprintf(name, OCFS2_ORPHAN_NAMELEN + 1, "%016llx", |
1850 | (long long)blkno); | 1847 | (long long)blkno); |
1851 | if (namelen <= 0) { | 1848 | if (namelen <= 0) { |
@@ -1862,12 +1859,12 @@ static int ocfs2_blkno_stringify(u64 blkno, char *name) | |||
1862 | goto bail; | 1859 | goto bail; |
1863 | } | 1860 | } |
1864 | 1861 | ||
1865 | mlog(0, "built filename '%s' for orphan dir (len=%d)\n", name, | 1862 | trace_ocfs2_blkno_stringify(blkno, name, namelen); |
1866 | namelen); | ||
1867 | 1863 | ||
1868 | status = 0; | 1864 | status = 0; |
1869 | bail: | 1865 | bail: |
1870 | mlog_exit(status); | 1866 | if (status < 0) |
1867 | mlog_errno(status); | ||
1871 | return status; | 1868 | return status; |
1872 | } | 1869 | } |
1873 | 1870 | ||
@@ -1980,7 +1977,8 @@ out: | |||
1980 | iput(orphan_dir_inode); | 1977 | iput(orphan_dir_inode); |
1981 | } | 1978 | } |
1982 | 1979 | ||
1983 | mlog_exit(ret); | 1980 | if (ret) |
1981 | mlog_errno(ret); | ||
1984 | return ret; | 1982 | return ret; |
1985 | } | 1983 | } |
1986 | 1984 | ||
@@ -1997,7 +1995,8 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb, | |||
1997 | struct ocfs2_dinode *orphan_fe; | 1995 | struct ocfs2_dinode *orphan_fe; |
1998 | struct ocfs2_dinode *fe = (struct ocfs2_dinode *) fe_bh->b_data; | 1996 | struct ocfs2_dinode *fe = (struct ocfs2_dinode *) fe_bh->b_data; |
1999 | 1997 | ||
2000 | mlog_entry("(inode->i_ino = %lu)\n", inode->i_ino); | 1998 | trace_ocfs2_orphan_add_begin( |
1999 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | ||
2001 | 2000 | ||
2002 | status = ocfs2_read_inode_block(orphan_dir_inode, &orphan_dir_bh); | 2001 | status = ocfs2_read_inode_block(orphan_dir_inode, &orphan_dir_bh); |
2003 | if (status < 0) { | 2002 | if (status < 0) { |
@@ -2056,13 +2055,14 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb, | |||
2056 | 2055 | ||
2057 | ocfs2_journal_dirty(handle, fe_bh); | 2056 | ocfs2_journal_dirty(handle, fe_bh); |
2058 | 2057 | ||
2059 | mlog(0, "Inode %llu orphaned in slot %d\n", | 2058 | trace_ocfs2_orphan_add_end((unsigned long long)OCFS2_I(inode)->ip_blkno, |
2060 | (unsigned long long)OCFS2_I(inode)->ip_blkno, osb->slot_num); | 2059 | osb->slot_num); |
2061 | 2060 | ||
2062 | leave: | 2061 | leave: |
2063 | brelse(orphan_dir_bh); | 2062 | brelse(orphan_dir_bh); |
2064 | 2063 | ||
2065 | mlog_exit(status); | 2064 | if (status) |
2065 | mlog_errno(status); | ||
2066 | return status; | 2066 | return status; |
2067 | } | 2067 | } |
2068 | 2068 | ||
@@ -2078,17 +2078,15 @@ int ocfs2_orphan_del(struct ocfs2_super *osb, | |||
2078 | int status = 0; | 2078 | int status = 0; |
2079 | struct ocfs2_dir_lookup_result lookup = { NULL, }; | 2079 | struct ocfs2_dir_lookup_result lookup = { NULL, }; |
2080 | 2080 | ||
2081 | mlog_entry_void(); | ||
2082 | |||
2083 | status = ocfs2_blkno_stringify(OCFS2_I(inode)->ip_blkno, name); | 2081 | status = ocfs2_blkno_stringify(OCFS2_I(inode)->ip_blkno, name); |
2084 | if (status < 0) { | 2082 | if (status < 0) { |
2085 | mlog_errno(status); | 2083 | mlog_errno(status); |
2086 | goto leave; | 2084 | goto leave; |
2087 | } | 2085 | } |
2088 | 2086 | ||
2089 | mlog(0, "removing '%s' from orphan dir %llu (namelen=%d)\n", | 2087 | trace_ocfs2_orphan_del( |
2090 | name, (unsigned long long)OCFS2_I(orphan_dir_inode)->ip_blkno, | 2088 | (unsigned long long)OCFS2_I(orphan_dir_inode)->ip_blkno, |
2091 | OCFS2_ORPHAN_NAMELEN); | 2089 | name, OCFS2_ORPHAN_NAMELEN); |
2092 | 2090 | ||
2093 | /* find it's spot in the orphan directory */ | 2091 | /* find it's spot in the orphan directory */ |
2094 | status = ocfs2_find_entry(name, OCFS2_ORPHAN_NAMELEN, orphan_dir_inode, | 2092 | status = ocfs2_find_entry(name, OCFS2_ORPHAN_NAMELEN, orphan_dir_inode, |
@@ -2124,7 +2122,8 @@ int ocfs2_orphan_del(struct ocfs2_super *osb, | |||
2124 | leave: | 2122 | leave: |
2125 | ocfs2_free_dir_lookup_result(&lookup); | 2123 | ocfs2_free_dir_lookup_result(&lookup); |
2126 | 2124 | ||
2127 | mlog_exit(status); | 2125 | if (status) |
2126 | mlog_errno(status); | ||
2128 | return status; | 2127 | return status; |
2129 | } | 2128 | } |
2130 | 2129 | ||
@@ -2321,9 +2320,6 @@ leave: | |||
2321 | iput(orphan_dir); | 2320 | iput(orphan_dir); |
2322 | } | 2321 | } |
2323 | 2322 | ||
2324 | if (status == -ENOSPC) | ||
2325 | mlog(0, "Disk is full\n"); | ||
2326 | |||
2327 | if ((status < 0) && inode) { | 2323 | if ((status < 0) && inode) { |
2328 | clear_nlink(inode); | 2324 | clear_nlink(inode); |
2329 | iput(inode); | 2325 | iput(inode); |
@@ -2358,8 +2354,10 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir, | |||
2358 | struct buffer_head *di_bh = NULL; | 2354 | struct buffer_head *di_bh = NULL; |
2359 | struct ocfs2_dir_lookup_result lookup = { NULL, }; | 2355 | struct ocfs2_dir_lookup_result lookup = { NULL, }; |
2360 | 2356 | ||
2361 | mlog_entry("(0x%p, 0x%p, %.*s')\n", dir, dentry, | 2357 | trace_ocfs2_mv_orphaned_inode_to_new(dir, dentry, |
2362 | dentry->d_name.len, dentry->d_name.name); | 2358 | dentry->d_name.len, dentry->d_name.name, |
2359 | (unsigned long long)OCFS2_I(dir)->ip_blkno, | ||
2360 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | ||
2363 | 2361 | ||
2364 | status = ocfs2_inode_lock(dir, &parent_di_bh, 1); | 2362 | status = ocfs2_inode_lock(dir, &parent_di_bh, 1); |
2365 | if (status < 0) { | 2363 | if (status < 0) { |
@@ -2476,7 +2474,8 @@ leave: | |||
2476 | 2474 | ||
2477 | ocfs2_free_dir_lookup_result(&lookup); | 2475 | ocfs2_free_dir_lookup_result(&lookup); |
2478 | 2476 | ||
2479 | mlog_exit(status); | 2477 | if (status) |
2478 | mlog_errno(status); | ||
2480 | 2479 | ||
2481 | return status; | 2480 | return status; |
2482 | } | 2481 | } |
diff --git a/fs/ocfs2/ocfs2_trace.h b/fs/ocfs2/ocfs2_trace.h new file mode 100644 index 000000000000..a1dae5bb54ac --- /dev/null +++ b/fs/ocfs2/ocfs2_trace.h | |||
@@ -0,0 +1,2739 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM ocfs2 | ||
3 | |||
4 | #if !defined(_TRACE_OCFS2_H) || defined(TRACE_HEADER_MULTI_READ) | ||
5 | #define _TRACE_OCFS2_H | ||
6 | |||
7 | #include <linux/tracepoint.h> | ||
8 | |||
9 | DECLARE_EVENT_CLASS(ocfs2__int, | ||
10 | TP_PROTO(int num), | ||
11 | TP_ARGS(num), | ||
12 | TP_STRUCT__entry( | ||
13 | __field(int, num) | ||
14 | ), | ||
15 | TP_fast_assign( | ||
16 | __entry->num = num; | ||
17 | ), | ||
18 | TP_printk("%d", __entry->num) | ||
19 | ); | ||
20 | |||
21 | #define DEFINE_OCFS2_INT_EVENT(name) \ | ||
22 | DEFINE_EVENT(ocfs2__int, name, \ | ||
23 | TP_PROTO(int num), \ | ||
24 | TP_ARGS(num)) | ||
25 | |||
26 | DECLARE_EVENT_CLASS(ocfs2__uint, | ||
27 | TP_PROTO(unsigned int num), | ||
28 | TP_ARGS(num), | ||
29 | TP_STRUCT__entry( | ||
30 | __field( unsigned int, num ) | ||
31 | ), | ||
32 | TP_fast_assign( | ||
33 | __entry->num = num; | ||
34 | ), | ||
35 | TP_printk("%u", __entry->num) | ||
36 | ); | ||
37 | |||
38 | #define DEFINE_OCFS2_UINT_EVENT(name) \ | ||
39 | DEFINE_EVENT(ocfs2__uint, name, \ | ||
40 | TP_PROTO(unsigned int num), \ | ||
41 | TP_ARGS(num)) | ||
42 | |||
43 | DECLARE_EVENT_CLASS(ocfs2__ull, | ||
44 | TP_PROTO(unsigned long long blkno), | ||
45 | TP_ARGS(blkno), | ||
46 | TP_STRUCT__entry( | ||
47 | __field(unsigned long long, blkno) | ||
48 | ), | ||
49 | TP_fast_assign( | ||
50 | __entry->blkno = blkno; | ||
51 | ), | ||
52 | TP_printk("%llu", __entry->blkno) | ||
53 | ); | ||
54 | |||
55 | #define DEFINE_OCFS2_ULL_EVENT(name) \ | ||
56 | DEFINE_EVENT(ocfs2__ull, name, \ | ||
57 | TP_PROTO(unsigned long long num), \ | ||
58 | TP_ARGS(num)) | ||
59 | |||
60 | DECLARE_EVENT_CLASS(ocfs2__pointer, | ||
61 | TP_PROTO(void *pointer), | ||
62 | TP_ARGS(pointer), | ||
63 | TP_STRUCT__entry( | ||
64 | __field(void *, pointer) | ||
65 | ), | ||
66 | TP_fast_assign( | ||
67 | __entry->pointer = pointer; | ||
68 | ), | ||
69 | TP_printk("%p", __entry->pointer) | ||
70 | ); | ||
71 | |||
72 | #define DEFINE_OCFS2_POINTER_EVENT(name) \ | ||
73 | DEFINE_EVENT(ocfs2__pointer, name, \ | ||
74 | TP_PROTO(void *pointer), \ | ||
75 | TP_ARGS(pointer)) | ||
76 | |||
77 | DECLARE_EVENT_CLASS(ocfs2__string, | ||
78 | TP_PROTO(const char *name), | ||
79 | TP_ARGS(name), | ||
80 | TP_STRUCT__entry( | ||
81 | __string(name,name) | ||
82 | ), | ||
83 | TP_fast_assign( | ||
84 | __assign_str(name, name); | ||
85 | ), | ||
86 | TP_printk("%s", __get_str(name)) | ||
87 | ); | ||
88 | |||
89 | #define DEFINE_OCFS2_STRING_EVENT(name) \ | ||
90 | DEFINE_EVENT(ocfs2__string, name, \ | ||
91 | TP_PROTO(const char *name), \ | ||
92 | TP_ARGS(name)) | ||
93 | |||
94 | DECLARE_EVENT_CLASS(ocfs2__int_int, | ||
95 | TP_PROTO(int value1, int value2), | ||
96 | TP_ARGS(value1, value2), | ||
97 | TP_STRUCT__entry( | ||
98 | __field(int, value1) | ||
99 | __field(int, value2) | ||
100 | ), | ||
101 | TP_fast_assign( | ||
102 | __entry->value1 = value1; | ||
103 | __entry->value2 = value2; | ||
104 | ), | ||
105 | TP_printk("%d %d", __entry->value1, __entry->value2) | ||
106 | ); | ||
107 | |||
108 | #define DEFINE_OCFS2_INT_INT_EVENT(name) \ | ||
109 | DEFINE_EVENT(ocfs2__int_int, name, \ | ||
110 | TP_PROTO(int val1, int val2), \ | ||
111 | TP_ARGS(val1, val2)) | ||
112 | |||
113 | DECLARE_EVENT_CLASS(ocfs2__uint_int, | ||
114 | TP_PROTO(unsigned int value1, int value2), | ||
115 | TP_ARGS(value1, value2), | ||
116 | TP_STRUCT__entry( | ||
117 | __field(unsigned int, value1) | ||
118 | __field(int, value2) | ||
119 | ), | ||
120 | TP_fast_assign( | ||
121 | __entry->value1 = value1; | ||
122 | __entry->value2 = value2; | ||
123 | ), | ||
124 | TP_printk("%u %d", __entry->value1, __entry->value2) | ||
125 | ); | ||
126 | |||
127 | #define DEFINE_OCFS2_UINT_INT_EVENT(name) \ | ||
128 | DEFINE_EVENT(ocfs2__uint_int, name, \ | ||
129 | TP_PROTO(unsigned int val1, int val2), \ | ||
130 | TP_ARGS(val1, val2)) | ||
131 | |||
132 | DECLARE_EVENT_CLASS(ocfs2__uint_uint, | ||
133 | TP_PROTO(unsigned int value1, unsigned int value2), | ||
134 | TP_ARGS(value1, value2), | ||
135 | TP_STRUCT__entry( | ||
136 | __field(unsigned int, value1) | ||
137 | __field(unsigned int, value2) | ||
138 | ), | ||
139 | TP_fast_assign( | ||
140 | __entry->value1 = value1; | ||
141 | __entry->value2 = value2; | ||
142 | ), | ||
143 | TP_printk("%u %u", __entry->value1, __entry->value2) | ||
144 | ); | ||
145 | |||
146 | #define DEFINE_OCFS2_UINT_UINT_EVENT(name) \ | ||
147 | DEFINE_EVENT(ocfs2__uint_uint, name, \ | ||
148 | TP_PROTO(unsigned int val1, unsigned int val2), \ | ||
149 | TP_ARGS(val1, val2)) | ||
150 | |||
151 | DECLARE_EVENT_CLASS(ocfs2__ull_uint, | ||
152 | TP_PROTO(unsigned long long value1, unsigned int value2), | ||
153 | TP_ARGS(value1, value2), | ||
154 | TP_STRUCT__entry( | ||
155 | __field(unsigned long long, value1) | ||
156 | __field(unsigned int, value2) | ||
157 | ), | ||
158 | TP_fast_assign( | ||
159 | __entry->value1 = value1; | ||
160 | __entry->value2 = value2; | ||
161 | ), | ||
162 | TP_printk("%llu %u", __entry->value1, __entry->value2) | ||
163 | ); | ||
164 | |||
165 | #define DEFINE_OCFS2_ULL_UINT_EVENT(name) \ | ||
166 | DEFINE_EVENT(ocfs2__ull_uint, name, \ | ||
167 | TP_PROTO(unsigned long long val1, unsigned int val2), \ | ||
168 | TP_ARGS(val1, val2)) | ||
169 | |||
170 | DECLARE_EVENT_CLASS(ocfs2__ull_int, | ||
171 | TP_PROTO(unsigned long long value1, int value2), | ||
172 | TP_ARGS(value1, value2), | ||
173 | TP_STRUCT__entry( | ||
174 | __field(unsigned long long, value1) | ||
175 | __field(int, value2) | ||
176 | ), | ||
177 | TP_fast_assign( | ||
178 | __entry->value1 = value1; | ||
179 | __entry->value2 = value2; | ||
180 | ), | ||
181 | TP_printk("%llu %d", __entry->value1, __entry->value2) | ||
182 | ); | ||
183 | |||
184 | #define DEFINE_OCFS2_ULL_INT_EVENT(name) \ | ||
185 | DEFINE_EVENT(ocfs2__ull_int, name, \ | ||
186 | TP_PROTO(unsigned long long val1, int val2), \ | ||
187 | TP_ARGS(val1, val2)) | ||
188 | |||
189 | DECLARE_EVENT_CLASS(ocfs2__ull_ull, | ||
190 | TP_PROTO(unsigned long long value1, unsigned long long value2), | ||
191 | TP_ARGS(value1, value2), | ||
192 | TP_STRUCT__entry( | ||
193 | __field(unsigned long long, value1) | ||
194 | __field(unsigned long long, value2) | ||
195 | ), | ||
196 | TP_fast_assign( | ||
197 | __entry->value1 = value1; | ||
198 | __entry->value2 = value2; | ||
199 | ), | ||
200 | TP_printk("%llu %llu", __entry->value1, __entry->value2) | ||
201 | ); | ||
202 | |||
203 | #define DEFINE_OCFS2_ULL_ULL_EVENT(name) \ | ||
204 | DEFINE_EVENT(ocfs2__ull_ull, name, \ | ||
205 | TP_PROTO(unsigned long long val1, unsigned long long val2), \ | ||
206 | TP_ARGS(val1, val2)) | ||
207 | |||
208 | DECLARE_EVENT_CLASS(ocfs2__ull_ull_uint, | ||
209 | TP_PROTO(unsigned long long value1, | ||
210 | unsigned long long value2, unsigned int value3), | ||
211 | TP_ARGS(value1, value2, value3), | ||
212 | TP_STRUCT__entry( | ||
213 | __field(unsigned long long, value1) | ||
214 | __field(unsigned long long, value2) | ||
215 | __field(unsigned int, value3) | ||
216 | ), | ||
217 | TP_fast_assign( | ||
218 | __entry->value1 = value1; | ||
219 | __entry->value2 = value2; | ||
220 | __entry->value3 = value3; | ||
221 | ), | ||
222 | TP_printk("%llu %llu %u", | ||
223 | __entry->value1, __entry->value2, __entry->value3) | ||
224 | ); | ||
225 | |||
226 | #define DEFINE_OCFS2_ULL_ULL_UINT_EVENT(name) \ | ||
227 | DEFINE_EVENT(ocfs2__ull_ull_uint, name, \ | ||
228 | TP_PROTO(unsigned long long val1, \ | ||
229 | unsigned long long val2, unsigned int val3), \ | ||
230 | TP_ARGS(val1, val2, val3)) | ||
231 | |||
232 | DECLARE_EVENT_CLASS(ocfs2__ull_uint_uint, | ||
233 | TP_PROTO(unsigned long long value1, | ||
234 | unsigned int value2, unsigned int value3), | ||
235 | TP_ARGS(value1, value2, value3), | ||
236 | TP_STRUCT__entry( | ||
237 | __field(unsigned long long, value1) | ||
238 | __field(unsigned int, value2) | ||
239 | __field(unsigned int, value3) | ||
240 | ), | ||
241 | TP_fast_assign( | ||
242 | __entry->value1 = value1; | ||
243 | __entry->value2 = value2; | ||
244 | __entry->value3 = value3; | ||
245 | ), | ||
246 | TP_printk("%llu %u %u", __entry->value1, | ||
247 | __entry->value2, __entry->value3) | ||
248 | ); | ||
249 | |||
250 | #define DEFINE_OCFS2_ULL_UINT_UINT_EVENT(name) \ | ||
251 | DEFINE_EVENT(ocfs2__ull_uint_uint, name, \ | ||
252 | TP_PROTO(unsigned long long val1, \ | ||
253 | unsigned int val2, unsigned int val3), \ | ||
254 | TP_ARGS(val1, val2, val3)) | ||
255 | |||
256 | DECLARE_EVENT_CLASS(ocfs2__uint_uint_uint, | ||
257 | TP_PROTO(unsigned int value1, unsigned int value2, | ||
258 | unsigned int value3), | ||
259 | TP_ARGS(value1, value2, value3), | ||
260 | TP_STRUCT__entry( | ||
261 | __field( unsigned int, value1 ) | ||
262 | __field( unsigned int, value2 ) | ||
263 | __field( unsigned int, value3 ) | ||
264 | ), | ||
265 | TP_fast_assign( | ||
266 | __entry->value1 = value1; | ||
267 | __entry->value2 = value2; | ||
268 | __entry->value3 = value3; | ||
269 | ), | ||
270 | TP_printk("%u %u %u", __entry->value1, __entry->value2, __entry->value3) | ||
271 | ); | ||
272 | |||
273 | #define DEFINE_OCFS2_UINT_UINT_UINT_EVENT(name) \ | ||
274 | DEFINE_EVENT(ocfs2__uint_uint_uint, name, \ | ||
275 | TP_PROTO(unsigned int value1, unsigned int value2, \ | ||
276 | unsigned int value3), \ | ||
277 | TP_ARGS(value1, value2, value3)) | ||
278 | |||
279 | DECLARE_EVENT_CLASS(ocfs2__ull_ull_ull, | ||
280 | TP_PROTO(unsigned long long value1, | ||
281 | unsigned long long value2, unsigned long long value3), | ||
282 | TP_ARGS(value1, value2, value3), | ||
283 | TP_STRUCT__entry( | ||
284 | __field(unsigned long long, value1) | ||
285 | __field(unsigned long long, value2) | ||
286 | __field(unsigned long long, value3) | ||
287 | ), | ||
288 | TP_fast_assign( | ||
289 | __entry->value1 = value1; | ||
290 | __entry->value2 = value2; | ||
291 | __entry->value3 = value3; | ||
292 | ), | ||
293 | TP_printk("%llu %llu %llu", | ||
294 | __entry->value1, __entry->value2, __entry->value3) | ||
295 | ); | ||
296 | |||
297 | #define DEFINE_OCFS2_ULL_ULL_ULL_EVENT(name) \ | ||
298 | DEFINE_EVENT(ocfs2__ull_ull_ull, name, \ | ||
299 | TP_PROTO(unsigned long long value1, unsigned long long value2, \ | ||
300 | unsigned long long value3), \ | ||
301 | TP_ARGS(value1, value2, value3)) | ||
302 | |||
303 | DECLARE_EVENT_CLASS(ocfs2__ull_int_int_int, | ||
304 | TP_PROTO(unsigned long long ull, int value1, int value2, int value3), | ||
305 | TP_ARGS(ull, value1, value2, value3), | ||
306 | TP_STRUCT__entry( | ||
307 | __field( unsigned long long, ull ) | ||
308 | __field( int, value1 ) | ||
309 | __field( int, value2 ) | ||
310 | __field( int, value3 ) | ||
311 | ), | ||
312 | TP_fast_assign( | ||
313 | __entry->ull = ull; | ||
314 | __entry->value1 = value1; | ||
315 | __entry->value2 = value2; | ||
316 | __entry->value3 = value3; | ||
317 | ), | ||
318 | TP_printk("%llu %d %d %d", | ||
319 | __entry->ull, __entry->value1, | ||
320 | __entry->value2, __entry->value3) | ||
321 | ); | ||
322 | |||
323 | #define DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(name) \ | ||
324 | DEFINE_EVENT(ocfs2__ull_int_int_int, name, \ | ||
325 | TP_PROTO(unsigned long long ull, int value1, \ | ||
326 | int value2, int value3), \ | ||
327 | TP_ARGS(ull, value1, value2, value3)) | ||
328 | |||
329 | DECLARE_EVENT_CLASS(ocfs2__ull_uint_uint_uint, | ||
330 | TP_PROTO(unsigned long long ull, unsigned int value1, | ||
331 | unsigned int value2, unsigned int value3), | ||
332 | TP_ARGS(ull, value1, value2, value3), | ||
333 | TP_STRUCT__entry( | ||
334 | __field(unsigned long long, ull) | ||
335 | __field(unsigned int, value1) | ||
336 | __field(unsigned int, value2) | ||
337 | __field(unsigned int, value3) | ||
338 | ), | ||
339 | TP_fast_assign( | ||
340 | __entry->ull = ull; | ||
341 | __entry->value1 = value1; | ||
342 | __entry->value2 = value2; | ||
343 | __entry->value3 = value3; | ||
344 | ), | ||
345 | TP_printk("%llu %u %u %u", | ||
346 | __entry->ull, __entry->value1, | ||
347 | __entry->value2, __entry->value3) | ||
348 | ); | ||
349 | |||
350 | #define DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(name) \ | ||
351 | DEFINE_EVENT(ocfs2__ull_uint_uint_uint, name, \ | ||
352 | TP_PROTO(unsigned long long ull, unsigned int value1, \ | ||
353 | unsigned int value2, unsigned int value3), \ | ||
354 | TP_ARGS(ull, value1, value2, value3)) | ||
355 | |||
356 | DECLARE_EVENT_CLASS(ocfs2__ull_ull_uint_uint, | ||
357 | TP_PROTO(unsigned long long value1, unsigned long long value2, | ||
358 | unsigned int value3, unsigned int value4), | ||
359 | TP_ARGS(value1, value2, value3, value4), | ||
360 | TP_STRUCT__entry( | ||
361 | __field(unsigned long long, value1) | ||
362 | __field(unsigned long long, value2) | ||
363 | __field(unsigned int, value3) | ||
364 | __field(unsigned int, value4) | ||
365 | ), | ||
366 | TP_fast_assign( | ||
367 | __entry->value1 = value1; | ||
368 | __entry->value2 = value2; | ||
369 | __entry->value3 = value3; | ||
370 | __entry->value4 = value4; | ||
371 | ), | ||
372 | TP_printk("%llu %llu %u %u", | ||
373 | __entry->value1, __entry->value2, | ||
374 | __entry->value3, __entry->value4) | ||
375 | ); | ||
376 | |||
377 | #define DEFINE_OCFS2_ULL_ULL_UINT_UINT_EVENT(name) \ | ||
378 | DEFINE_EVENT(ocfs2__ull_ull_uint_uint, name, \ | ||
379 | TP_PROTO(unsigned long long ull, unsigned long long ull1, \ | ||
380 | unsigned int value2, unsigned int value3), \ | ||
381 | TP_ARGS(ull, ull1, value2, value3)) | ||
382 | |||
383 | /* Trace events for fs/ocfs2/alloc.c. */ | ||
384 | DECLARE_EVENT_CLASS(ocfs2__btree_ops, | ||
385 | TP_PROTO(unsigned long long owner,\ | ||
386 | unsigned int value1, unsigned int value2), | ||
387 | TP_ARGS(owner, value1, value2), | ||
388 | TP_STRUCT__entry( | ||
389 | __field(unsigned long long, owner) | ||
390 | __field(unsigned int, value1) | ||
391 | __field(unsigned int, value2) | ||
392 | ), | ||
393 | TP_fast_assign( | ||
394 | __entry->owner = owner; | ||
395 | __entry->value1 = value1; | ||
396 | __entry->value2 = value2; | ||
397 | ), | ||
398 | TP_printk("%llu %u %u", | ||
399 | __entry->owner, __entry->value1, __entry->value2) | ||
400 | ); | ||
401 | |||
402 | #define DEFINE_OCFS2_BTREE_EVENT(name) \ | ||
403 | DEFINE_EVENT(ocfs2__btree_ops, name, \ | ||
404 | TP_PROTO(unsigned long long owner, \ | ||
405 | unsigned int value1, unsigned int value2), \ | ||
406 | TP_ARGS(owner, value1, value2)) | ||
407 | |||
408 | DEFINE_OCFS2_BTREE_EVENT(ocfs2_adjust_rightmost_branch); | ||
409 | |||
410 | DEFINE_OCFS2_BTREE_EVENT(ocfs2_rotate_tree_right); | ||
411 | |||
412 | DEFINE_OCFS2_BTREE_EVENT(ocfs2_append_rec_to_path); | ||
413 | |||
414 | DEFINE_OCFS2_BTREE_EVENT(ocfs2_insert_extent_start); | ||
415 | |||
416 | DEFINE_OCFS2_BTREE_EVENT(ocfs2_add_clusters_in_btree); | ||
417 | |||
418 | DEFINE_OCFS2_INT_EVENT(ocfs2_num_free_extents); | ||
419 | |||
420 | DEFINE_OCFS2_INT_EVENT(ocfs2_complete_edge_insert); | ||
421 | |||
422 | TRACE_EVENT(ocfs2_grow_tree, | ||
423 | TP_PROTO(unsigned long long owner, int depth), | ||
424 | TP_ARGS(owner, depth), | ||
425 | TP_STRUCT__entry( | ||
426 | __field(unsigned long long, owner) | ||
427 | __field(int, depth) | ||
428 | ), | ||
429 | TP_fast_assign( | ||
430 | __entry->owner = owner; | ||
431 | __entry->depth = depth; | ||
432 | ), | ||
433 | TP_printk("%llu %d", __entry->owner, __entry->depth) | ||
434 | ); | ||
435 | |||
436 | TRACE_EVENT(ocfs2_rotate_subtree, | ||
437 | TP_PROTO(int subtree_root, unsigned long long blkno, | ||
438 | int depth), | ||
439 | TP_ARGS(subtree_root, blkno, depth), | ||
440 | TP_STRUCT__entry( | ||
441 | __field(int, subtree_root) | ||
442 | __field(unsigned long long, blkno) | ||
443 | __field(int, depth) | ||
444 | ), | ||
445 | TP_fast_assign( | ||
446 | __entry->subtree_root = subtree_root; | ||
447 | __entry->blkno = blkno; | ||
448 | __entry->depth = depth; | ||
449 | ), | ||
450 | TP_printk("%d %llu %d", __entry->subtree_root, | ||
451 | __entry->blkno, __entry->depth) | ||
452 | ); | ||
453 | |||
454 | TRACE_EVENT(ocfs2_insert_extent, | ||
455 | TP_PROTO(unsigned int ins_appending, unsigned int ins_contig, | ||
456 | int ins_contig_index, int free_records, int ins_tree_depth), | ||
457 | TP_ARGS(ins_appending, ins_contig, ins_contig_index, free_records, | ||
458 | ins_tree_depth), | ||
459 | TP_STRUCT__entry( | ||
460 | __field(unsigned int, ins_appending) | ||
461 | __field(unsigned int, ins_contig) | ||
462 | __field(int, ins_contig_index) | ||
463 | __field(int, free_records) | ||
464 | __field(int, ins_tree_depth) | ||
465 | ), | ||
466 | TP_fast_assign( | ||
467 | __entry->ins_appending = ins_appending; | ||
468 | __entry->ins_contig = ins_contig; | ||
469 | __entry->ins_contig_index = ins_contig_index; | ||
470 | __entry->free_records = free_records; | ||
471 | __entry->ins_tree_depth = ins_tree_depth; | ||
472 | ), | ||
473 | TP_printk("%u %u %d %d %d", | ||
474 | __entry->ins_appending, __entry->ins_contig, | ||
475 | __entry->ins_contig_index, __entry->free_records, | ||
476 | __entry->ins_tree_depth) | ||
477 | ); | ||
478 | |||
479 | TRACE_EVENT(ocfs2_split_extent, | ||
480 | TP_PROTO(int split_index, unsigned int c_contig_type, | ||
481 | unsigned int c_has_empty_extent, | ||
482 | unsigned int c_split_covers_rec), | ||
483 | TP_ARGS(split_index, c_contig_type, | ||
484 | c_has_empty_extent, c_split_covers_rec), | ||
485 | TP_STRUCT__entry( | ||
486 | __field(int, split_index) | ||
487 | __field(unsigned int, c_contig_type) | ||
488 | __field(unsigned int, c_has_empty_extent) | ||
489 | __field(unsigned int, c_split_covers_rec) | ||
490 | ), | ||
491 | TP_fast_assign( | ||
492 | __entry->split_index = split_index; | ||
493 | __entry->c_contig_type = c_contig_type; | ||
494 | __entry->c_has_empty_extent = c_has_empty_extent; | ||
495 | __entry->c_split_covers_rec = c_split_covers_rec; | ||
496 | ), | ||
497 | TP_printk("%d %u %u %u", __entry->split_index, __entry->c_contig_type, | ||
498 | __entry->c_has_empty_extent, __entry->c_split_covers_rec) | ||
499 | ); | ||
500 | |||
501 | TRACE_EVENT(ocfs2_remove_extent, | ||
502 | TP_PROTO(unsigned long long owner, unsigned int cpos, | ||
503 | unsigned int len, int index, | ||
504 | unsigned int e_cpos, unsigned int clusters), | ||
505 | TP_ARGS(owner, cpos, len, index, e_cpos, clusters), | ||
506 | TP_STRUCT__entry( | ||
507 | __field(unsigned long long, owner) | ||
508 | __field(unsigned int, cpos) | ||
509 | __field(unsigned int, len) | ||
510 | __field(int, index) | ||
511 | __field(unsigned int, e_cpos) | ||
512 | __field(unsigned int, clusters) | ||
513 | ), | ||
514 | TP_fast_assign( | ||
515 | __entry->owner = owner; | ||
516 | __entry->cpos = cpos; | ||
517 | __entry->len = len; | ||
518 | __entry->index = index; | ||
519 | __entry->e_cpos = e_cpos; | ||
520 | __entry->clusters = clusters; | ||
521 | ), | ||
522 | TP_printk("%llu %u %u %d %u %u", | ||
523 | __entry->owner, __entry->cpos, __entry->len, __entry->index, | ||
524 | __entry->e_cpos, __entry->clusters) | ||
525 | ); | ||
526 | |||
527 | TRACE_EVENT(ocfs2_commit_truncate, | ||
528 | TP_PROTO(unsigned long long ino, unsigned int new_cpos, | ||
529 | unsigned int clusters, unsigned int depth), | ||
530 | TP_ARGS(ino, new_cpos, clusters, depth), | ||
531 | TP_STRUCT__entry( | ||
532 | __field(unsigned long long, ino) | ||
533 | __field(unsigned int, new_cpos) | ||
534 | __field(unsigned int, clusters) | ||
535 | __field(unsigned int, depth) | ||
536 | ), | ||
537 | TP_fast_assign( | ||
538 | __entry->ino = ino; | ||
539 | __entry->new_cpos = new_cpos; | ||
540 | __entry->clusters = clusters; | ||
541 | __entry->depth = depth; | ||
542 | ), | ||
543 | TP_printk("%llu %u %u %u", | ||
544 | __entry->ino, __entry->new_cpos, | ||
545 | __entry->clusters, __entry->depth) | ||
546 | ); | ||
547 | |||
548 | TRACE_EVENT(ocfs2_validate_extent_block, | ||
549 | TP_PROTO(unsigned long long blkno), | ||
550 | TP_ARGS(blkno), | ||
551 | TP_STRUCT__entry( | ||
552 | __field(unsigned long long, blkno) | ||
553 | ), | ||
554 | TP_fast_assign( | ||
555 | __entry->blkno = blkno; | ||
556 | ), | ||
557 | TP_printk("%llu ", __entry->blkno) | ||
558 | ); | ||
559 | |||
560 | TRACE_EVENT(ocfs2_rotate_leaf, | ||
561 | TP_PROTO(unsigned int insert_cpos, int insert_index, | ||
562 | int has_empty, int next_free, | ||
563 | unsigned int l_count), | ||
564 | TP_ARGS(insert_cpos, insert_index, has_empty, | ||
565 | next_free, l_count), | ||
566 | TP_STRUCT__entry( | ||
567 | __field(unsigned int, insert_cpos) | ||
568 | __field(int, insert_index) | ||
569 | __field(int, has_empty) | ||
570 | __field(int, next_free) | ||
571 | __field(unsigned int, l_count) | ||
572 | ), | ||
573 | TP_fast_assign( | ||
574 | __entry->insert_cpos = insert_cpos; | ||
575 | __entry->insert_index = insert_index; | ||
576 | __entry->has_empty = has_empty; | ||
577 | __entry->next_free = next_free; | ||
578 | __entry->l_count = l_count; | ||
579 | ), | ||
580 | TP_printk("%u %d %d %d %u", __entry->insert_cpos, | ||
581 | __entry->insert_index, __entry->has_empty, | ||
582 | __entry->next_free, __entry->l_count) | ||
583 | ); | ||
584 | |||
585 | TRACE_EVENT(ocfs2_add_clusters_in_btree_ret, | ||
586 | TP_PROTO(int status, int reason, int err), | ||
587 | TP_ARGS(status, reason, err), | ||
588 | TP_STRUCT__entry( | ||
589 | __field(int, status) | ||
590 | __field(int, reason) | ||
591 | __field(int, err) | ||
592 | ), | ||
593 | TP_fast_assign( | ||
594 | __entry->status = status; | ||
595 | __entry->reason = reason; | ||
596 | __entry->err = err; | ||
597 | ), | ||
598 | TP_printk("%d %d %d", __entry->status, | ||
599 | __entry->reason, __entry->err) | ||
600 | ); | ||
601 | |||
602 | TRACE_EVENT(ocfs2_mark_extent_written, | ||
603 | TP_PROTO(unsigned long long owner, unsigned int cpos, | ||
604 | unsigned int len, unsigned int phys), | ||
605 | TP_ARGS(owner, cpos, len, phys), | ||
606 | TP_STRUCT__entry( | ||
607 | __field(unsigned long long, owner) | ||
608 | __field(unsigned int, cpos) | ||
609 | __field(unsigned int, len) | ||
610 | __field(unsigned int, phys) | ||
611 | ), | ||
612 | TP_fast_assign( | ||
613 | __entry->owner = owner; | ||
614 | __entry->cpos = cpos; | ||
615 | __entry->len = len; | ||
616 | __entry->phys = phys; | ||
617 | ), | ||
618 | TP_printk("%llu %u %u %u", | ||
619 | __entry->owner, __entry->cpos, | ||
620 | __entry->len, __entry->phys) | ||
621 | ); | ||
622 | |||
623 | DECLARE_EVENT_CLASS(ocfs2__truncate_log_ops, | ||
624 | TP_PROTO(unsigned long long blkno, int index, | ||
625 | unsigned int start, unsigned int num), | ||
626 | TP_ARGS(blkno, index, start, num), | ||
627 | TP_STRUCT__entry( | ||
628 | __field(unsigned long long, blkno) | ||
629 | __field(int, index) | ||
630 | __field(unsigned int, start) | ||
631 | __field(unsigned int, num) | ||
632 | ), | ||
633 | TP_fast_assign( | ||
634 | __entry->blkno = blkno; | ||
635 | __entry->index = index; | ||
636 | __entry->start = start; | ||
637 | __entry->num = num; | ||
638 | ), | ||
639 | TP_printk("%llu %d %u %u", | ||
640 | __entry->blkno, __entry->index, | ||
641 | __entry->start, __entry->num) | ||
642 | ); | ||
643 | |||
644 | #define DEFINE_OCFS2_TRUNCATE_LOG_OPS_EVENT(name) \ | ||
645 | DEFINE_EVENT(ocfs2__truncate_log_ops, name, \ | ||
646 | TP_PROTO(unsigned long long blkno, int index, \ | ||
647 | unsigned int start, unsigned int num), \ | ||
648 | TP_ARGS(blkno, index, start, num)) | ||
649 | |||
650 | DEFINE_OCFS2_TRUNCATE_LOG_OPS_EVENT(ocfs2_truncate_log_append); | ||
651 | |||
652 | DEFINE_OCFS2_TRUNCATE_LOG_OPS_EVENT(ocfs2_replay_truncate_records); | ||
653 | |||
654 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_flush_truncate_log); | ||
655 | |||
656 | DEFINE_OCFS2_INT_EVENT(ocfs2_begin_truncate_log_recovery); | ||
657 | |||
658 | DEFINE_OCFS2_INT_EVENT(ocfs2_truncate_log_recovery_num); | ||
659 | |||
660 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_complete_truncate_log_recovery); | ||
661 | |||
662 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_free_cached_blocks); | ||
663 | |||
664 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_cache_cluster_dealloc); | ||
665 | |||
666 | DEFINE_OCFS2_INT_INT_EVENT(ocfs2_run_deallocs); | ||
667 | |||
668 | TRACE_EVENT(ocfs2_cache_block_dealloc, | ||
669 | TP_PROTO(int type, int slot, unsigned long long suballoc, | ||
670 | unsigned long long blkno, unsigned int bit), | ||
671 | TP_ARGS(type, slot, suballoc, blkno, bit), | ||
672 | TP_STRUCT__entry( | ||
673 | __field(int, type) | ||
674 | __field(int, slot) | ||
675 | __field(unsigned long long, suballoc) | ||
676 | __field(unsigned long long, blkno) | ||
677 | __field(unsigned int, bit) | ||
678 | ), | ||
679 | TP_fast_assign( | ||
680 | __entry->type = type; | ||
681 | __entry->slot = slot; | ||
682 | __entry->suballoc = suballoc; | ||
683 | __entry->blkno = blkno; | ||
684 | __entry->bit = bit; | ||
685 | ), | ||
686 | TP_printk("%d %d %llu %llu %u", | ||
687 | __entry->type, __entry->slot, __entry->suballoc, | ||
688 | __entry->blkno, __entry->bit) | ||
689 | ); | ||
690 | |||
691 | /* End of trace events for fs/ocfs2/alloc.c. */ | ||
692 | |||
693 | /* Trace events for fs/ocfs2/localalloc.c. */ | ||
694 | |||
695 | DEFINE_OCFS2_UINT_UINT_UINT_EVENT(ocfs2_la_set_sizes); | ||
696 | |||
697 | DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_alloc_should_use_local); | ||
698 | |||
699 | DEFINE_OCFS2_INT_EVENT(ocfs2_load_local_alloc); | ||
700 | |||
701 | DEFINE_OCFS2_INT_EVENT(ocfs2_begin_local_alloc_recovery); | ||
702 | |||
703 | DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_reserve_local_alloc_bits); | ||
704 | |||
705 | DEFINE_OCFS2_UINT_EVENT(ocfs2_local_alloc_count_bits); | ||
706 | |||
707 | DEFINE_OCFS2_INT_INT_EVENT(ocfs2_local_alloc_find_clear_bits_search_bitmap); | ||
708 | |||
709 | DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_local_alloc_find_clear_bits); | ||
710 | |||
711 | DEFINE_OCFS2_INT_INT_EVENT(ocfs2_sync_local_to_main); | ||
712 | |||
713 | TRACE_EVENT(ocfs2_sync_local_to_main_free, | ||
714 | TP_PROTO(int count, int bit, unsigned long long start_blk, | ||
715 | unsigned long long blkno), | ||
716 | TP_ARGS(count, bit, start_blk, blkno), | ||
717 | TP_STRUCT__entry( | ||
718 | __field(int, count) | ||
719 | __field(int, bit) | ||
720 | __field(unsigned long long, start_blk) | ||
721 | __field(unsigned long long, blkno) | ||
722 | ), | ||
723 | TP_fast_assign( | ||
724 | __entry->count = count; | ||
725 | __entry->bit = bit; | ||
726 | __entry->start_blk = start_blk; | ||
727 | __entry->blkno = blkno; | ||
728 | ), | ||
729 | TP_printk("%d %d %llu %llu", | ||
730 | __entry->count, __entry->bit, __entry->start_blk, | ||
731 | __entry->blkno) | ||
732 | ); | ||
733 | |||
734 | DEFINE_OCFS2_INT_INT_EVENT(ocfs2_local_alloc_new_window); | ||
735 | |||
736 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_local_alloc_new_window_result); | ||
737 | |||
738 | /* End of trace events for fs/ocfs2/localalloc.c. */ | ||
739 | |||
740 | /* Trace events for fs/ocfs2/resize.c. */ | ||
741 | |||
742 | DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_update_last_group_and_inode); | ||
743 | |||
744 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_group_extend); | ||
745 | |||
746 | DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_group_add); | ||
747 | |||
748 | /* End of trace events for fs/ocfs2/resize.c. */ | ||
749 | |||
750 | /* Trace events for fs/ocfs2/suballoc.c. */ | ||
751 | |||
752 | DEFINE_OCFS2_ULL_EVENT(ocfs2_validate_group_descriptor); | ||
753 | |||
754 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_block_group_alloc_contig); | ||
755 | |||
756 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_block_group_alloc_discontig); | ||
757 | |||
758 | DEFINE_OCFS2_ULL_EVENT(ocfs2_block_group_alloc); | ||
759 | |||
760 | DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_reserve_suballoc_bits_nospc); | ||
761 | |||
762 | DEFINE_OCFS2_UINT_UINT_UINT_EVENT(ocfs2_reserve_suballoc_bits_no_new_group); | ||
763 | |||
764 | DEFINE_OCFS2_ULL_EVENT(ocfs2_reserve_new_inode_new_group); | ||
765 | |||
766 | DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_block_group_set_bits); | ||
767 | |||
768 | TRACE_EVENT(ocfs2_relink_block_group, | ||
769 | TP_PROTO(unsigned long long i_blkno, unsigned int chain, | ||
770 | unsigned long long bg_blkno, | ||
771 | unsigned long long prev_blkno), | ||
772 | TP_ARGS(i_blkno, chain, bg_blkno, prev_blkno), | ||
773 | TP_STRUCT__entry( | ||
774 | __field(unsigned long long, i_blkno) | ||
775 | __field(unsigned int, chain) | ||
776 | __field(unsigned long long, bg_blkno) | ||
777 | __field(unsigned long long, prev_blkno) | ||
778 | ), | ||
779 | TP_fast_assign( | ||
780 | __entry->i_blkno = i_blkno; | ||
781 | __entry->chain = chain; | ||
782 | __entry->bg_blkno = bg_blkno; | ||
783 | __entry->prev_blkno = prev_blkno; | ||
784 | ), | ||
785 | TP_printk("%llu %u %llu %llu", | ||
786 | __entry->i_blkno, __entry->chain, __entry->bg_blkno, | ||
787 | __entry->prev_blkno) | ||
788 | ); | ||
789 | |||
790 | DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_cluster_group_search_wrong_max_bits); | ||
791 | |||
792 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_cluster_group_search_max_block); | ||
793 | |||
794 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_block_group_search_max_block); | ||
795 | |||
796 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_search_chain_begin); | ||
797 | |||
798 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_search_chain_succ); | ||
799 | |||
800 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_search_chain_end); | ||
801 | |||
802 | DEFINE_OCFS2_UINT_EVENT(ocfs2_claim_suballoc_bits); | ||
803 | |||
804 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_claim_new_inode_at_loc); | ||
805 | |||
806 | DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_block_group_clear_bits); | ||
807 | |||
808 | TRACE_EVENT(ocfs2_free_suballoc_bits, | ||
809 | TP_PROTO(unsigned long long inode, unsigned long long group, | ||
810 | unsigned int start_bit, unsigned int count), | ||
811 | TP_ARGS(inode, group, start_bit, count), | ||
812 | TP_STRUCT__entry( | ||
813 | __field(unsigned long long, inode) | ||
814 | __field(unsigned long long, group) | ||
815 | __field(unsigned int, start_bit) | ||
816 | __field(unsigned int, count) | ||
817 | ), | ||
818 | TP_fast_assign( | ||
819 | __entry->inode = inode; | ||
820 | __entry->group = group; | ||
821 | __entry->start_bit = start_bit; | ||
822 | __entry->count = count; | ||
823 | ), | ||
824 | TP_printk("%llu %llu %u %u", __entry->inode, __entry->group, | ||
825 | __entry->start_bit, __entry->count) | ||
826 | ); | ||
827 | |||
828 | TRACE_EVENT(ocfs2_free_clusters, | ||
829 | TP_PROTO(unsigned long long bg_blkno, unsigned long long start_blk, | ||
830 | unsigned int start_bit, unsigned int count), | ||
831 | TP_ARGS(bg_blkno, start_blk, start_bit, count), | ||
832 | TP_STRUCT__entry( | ||
833 | __field(unsigned long long, bg_blkno) | ||
834 | __field(unsigned long long, start_blk) | ||
835 | __field(unsigned int, start_bit) | ||
836 | __field(unsigned int, count) | ||
837 | ), | ||
838 | TP_fast_assign( | ||
839 | __entry->bg_blkno = bg_blkno; | ||
840 | __entry->start_blk = start_blk; | ||
841 | __entry->start_bit = start_bit; | ||
842 | __entry->count = count; | ||
843 | ), | ||
844 | TP_printk("%llu %llu %u %u", __entry->bg_blkno, __entry->start_blk, | ||
845 | __entry->start_bit, __entry->count) | ||
846 | ); | ||
847 | |||
848 | DEFINE_OCFS2_ULL_EVENT(ocfs2_get_suballoc_slot_bit); | ||
849 | |||
850 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_test_suballoc_bit); | ||
851 | |||
852 | DEFINE_OCFS2_ULL_EVENT(ocfs2_test_inode_bit); | ||
853 | |||
854 | /* End of trace events for fs/ocfs2/suballoc.c. */ | ||
855 | |||
856 | /* Trace events for fs/ocfs2/refcounttree.c. */ | ||
857 | |||
858 | DEFINE_OCFS2_ULL_EVENT(ocfs2_validate_refcount_block); | ||
859 | |||
860 | DEFINE_OCFS2_ULL_EVENT(ocfs2_purge_refcount_trees); | ||
861 | |||
862 | DEFINE_OCFS2_ULL_EVENT(ocfs2_create_refcount_tree); | ||
863 | |||
864 | DEFINE_OCFS2_ULL_EVENT(ocfs2_create_refcount_tree_blkno); | ||
865 | |||
866 | DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_change_refcount_rec); | ||
867 | |||
868 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_expand_inline_ref_root); | ||
869 | |||
870 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_divide_leaf_refcount_block); | ||
871 | |||
872 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_new_leaf_refcount_block); | ||
873 | |||
874 | DECLARE_EVENT_CLASS(ocfs2__refcount_tree_ops, | ||
875 | TP_PROTO(unsigned long long blkno, int index, | ||
876 | unsigned long long cpos, | ||
877 | unsigned int clusters, unsigned int refcount), | ||
878 | TP_ARGS(blkno, index, cpos, clusters, refcount), | ||
879 | TP_STRUCT__entry( | ||
880 | __field(unsigned long long, blkno) | ||
881 | __field(int, index) | ||
882 | __field(unsigned long long, cpos) | ||
883 | __field(unsigned int, clusters) | ||
884 | __field(unsigned int, refcount) | ||
885 | ), | ||
886 | TP_fast_assign( | ||
887 | __entry->blkno = blkno; | ||
888 | __entry->index = index; | ||
889 | __entry->cpos = cpos; | ||
890 | __entry->clusters = clusters; | ||
891 | __entry->refcount = refcount; | ||
892 | ), | ||
893 | TP_printk("%llu %d %llu %u %u", __entry->blkno, __entry->index, | ||
894 | __entry->cpos, __entry->clusters, __entry->refcount) | ||
895 | ); | ||
896 | |||
897 | #define DEFINE_OCFS2_REFCOUNT_TREE_OPS_EVENT(name) \ | ||
898 | DEFINE_EVENT(ocfs2__refcount_tree_ops, name, \ | ||
899 | TP_PROTO(unsigned long long blkno, int index, \ | ||
900 | unsigned long long cpos, \ | ||
901 | unsigned int count, unsigned int refcount), \ | ||
902 | TP_ARGS(blkno, index, cpos, count, refcount)) | ||
903 | |||
904 | DEFINE_OCFS2_REFCOUNT_TREE_OPS_EVENT(ocfs2_insert_refcount_rec); | ||
905 | |||
906 | TRACE_EVENT(ocfs2_split_refcount_rec, | ||
907 | TP_PROTO(unsigned long long cpos, | ||
908 | unsigned int clusters, unsigned int refcount, | ||
909 | unsigned long long split_cpos, | ||
910 | unsigned int split_clusters, unsigned int split_refcount), | ||
911 | TP_ARGS(cpos, clusters, refcount, | ||
912 | split_cpos, split_clusters, split_refcount), | ||
913 | TP_STRUCT__entry( | ||
914 | __field(unsigned long long, cpos) | ||
915 | __field(unsigned int, clusters) | ||
916 | __field(unsigned int, refcount) | ||
917 | __field(unsigned long long, split_cpos) | ||
918 | __field(unsigned int, split_clusters) | ||
919 | __field(unsigned int, split_refcount) | ||
920 | ), | ||
921 | TP_fast_assign( | ||
922 | __entry->cpos = cpos; | ||
923 | __entry->clusters = clusters; | ||
924 | __entry->refcount = refcount; | ||
925 | __entry->split_cpos = split_cpos; | ||
926 | __entry->split_clusters = split_clusters; | ||
927 | __entry->split_refcount = split_refcount; | ||
928 | ), | ||
929 | TP_printk("%llu %u %u %llu %u %u", | ||
930 | __entry->cpos, __entry->clusters, __entry->refcount, | ||
931 | __entry->split_cpos, __entry->split_clusters, | ||
932 | __entry->split_refcount) | ||
933 | ); | ||
934 | |||
935 | DEFINE_OCFS2_REFCOUNT_TREE_OPS_EVENT(ocfs2_split_refcount_rec_insert); | ||
936 | |||
937 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_increase_refcount_begin); | ||
938 | |||
939 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_increase_refcount_change); | ||
940 | |||
941 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_increase_refcount_insert); | ||
942 | |||
943 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_increase_refcount_split); | ||
944 | |||
945 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_remove_refcount_extent); | ||
946 | |||
947 | DEFINE_OCFS2_ULL_EVENT(ocfs2_restore_refcount_block); | ||
948 | |||
949 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_decrease_refcount_rec); | ||
950 | |||
951 | TRACE_EVENT(ocfs2_decrease_refcount, | ||
952 | TP_PROTO(unsigned long long owner, | ||
953 | unsigned long long cpos, | ||
954 | unsigned int len, int delete), | ||
955 | TP_ARGS(owner, cpos, len, delete), | ||
956 | TP_STRUCT__entry( | ||
957 | __field(unsigned long long, owner) | ||
958 | __field(unsigned long long, cpos) | ||
959 | __field(unsigned int, len) | ||
960 | __field(int, delete) | ||
961 | ), | ||
962 | TP_fast_assign( | ||
963 | __entry->owner = owner; | ||
964 | __entry->cpos = cpos; | ||
965 | __entry->len = len; | ||
966 | __entry->delete = delete; | ||
967 | ), | ||
968 | TP_printk("%llu %llu %u %d", | ||
969 | __entry->owner, __entry->cpos, __entry->len, __entry->delete) | ||
970 | ); | ||
971 | |||
972 | DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_mark_extent_refcounted); | ||
973 | |||
974 | DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_calc_refcount_meta_credits); | ||
975 | |||
976 | TRACE_EVENT(ocfs2_calc_refcount_meta_credits_iterate, | ||
977 | TP_PROTO(int recs_add, unsigned long long cpos, | ||
978 | unsigned int clusters, unsigned long long r_cpos, | ||
979 | unsigned int r_clusters, unsigned int refcount, int index), | ||
980 | TP_ARGS(recs_add, cpos, clusters, r_cpos, r_clusters, refcount, index), | ||
981 | TP_STRUCT__entry( | ||
982 | __field(int, recs_add) | ||
983 | __field(unsigned long long, cpos) | ||
984 | __field(unsigned int, clusters) | ||
985 | __field(unsigned long long, r_cpos) | ||
986 | __field(unsigned int, r_clusters) | ||
987 | __field(unsigned int, refcount) | ||
988 | __field(int, index) | ||
989 | ), | ||
990 | TP_fast_assign( | ||
991 | __entry->recs_add = recs_add; | ||
992 | __entry->cpos = cpos; | ||
993 | __entry->clusters = clusters; | ||
994 | __entry->r_cpos = r_cpos; | ||
995 | __entry->r_clusters = r_clusters; | ||
996 | __entry->refcount = refcount; | ||
997 | __entry->index = index; | ||
998 | ), | ||
999 | TP_printk("%d %llu %u %llu %u %u %d", | ||
1000 | __entry->recs_add, __entry->cpos, __entry->clusters, | ||
1001 | __entry->r_cpos, __entry->r_clusters, | ||
1002 | __entry->refcount, __entry->index) | ||
1003 | ); | ||
1004 | |||
1005 | DEFINE_OCFS2_INT_INT_EVENT(ocfs2_add_refcount_flag); | ||
1006 | |||
1007 | DEFINE_OCFS2_INT_INT_EVENT(ocfs2_prepare_refcount_change_for_del); | ||
1008 | |||
1009 | DEFINE_OCFS2_INT_INT_EVENT(ocfs2_lock_refcount_allocators); | ||
1010 | |||
1011 | DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_duplicate_clusters_by_page); | ||
1012 | |||
1013 | DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_duplicate_clusters_by_jbd); | ||
1014 | |||
1015 | TRACE_EVENT(ocfs2_clear_ext_refcount, | ||
1016 | TP_PROTO(unsigned long long ino, unsigned int cpos, | ||
1017 | unsigned int len, unsigned int p_cluster, | ||
1018 | unsigned int ext_flags), | ||
1019 | TP_ARGS(ino, cpos, len, p_cluster, ext_flags), | ||
1020 | TP_STRUCT__entry( | ||
1021 | __field(unsigned long long, ino) | ||
1022 | __field(unsigned int, cpos) | ||
1023 | __field(unsigned int, len) | ||
1024 | __field(unsigned int, p_cluster) | ||
1025 | __field(unsigned int, ext_flags) | ||
1026 | ), | ||
1027 | TP_fast_assign( | ||
1028 | __entry->ino = ino; | ||
1029 | __entry->cpos = cpos; | ||
1030 | __entry->len = len; | ||
1031 | __entry->p_cluster = p_cluster; | ||
1032 | __entry->ext_flags = ext_flags; | ||
1033 | ), | ||
1034 | TP_printk("%llu %u %u %u %u", | ||
1035 | __entry->ino, __entry->cpos, __entry->len, | ||
1036 | __entry->p_cluster, __entry->ext_flags) | ||
1037 | ); | ||
1038 | |||
1039 | TRACE_EVENT(ocfs2_replace_clusters, | ||
1040 | TP_PROTO(unsigned long long ino, unsigned int cpos, | ||
1041 | unsigned int old, unsigned int new, unsigned int len, | ||
1042 | unsigned int ext_flags), | ||
1043 | TP_ARGS(ino, cpos, old, new, len, ext_flags), | ||
1044 | TP_STRUCT__entry( | ||
1045 | __field(unsigned long long, ino) | ||
1046 | __field(unsigned int, cpos) | ||
1047 | __field(unsigned int, old) | ||
1048 | __field(unsigned int, new) | ||
1049 | __field(unsigned int, len) | ||
1050 | __field(unsigned int, ext_flags) | ||
1051 | ), | ||
1052 | TP_fast_assign( | ||
1053 | __entry->ino = ino; | ||
1054 | __entry->cpos = cpos; | ||
1055 | __entry->old = old; | ||
1056 | __entry->new = new; | ||
1057 | __entry->len = len; | ||
1058 | __entry->ext_flags = ext_flags; | ||
1059 | ), | ||
1060 | TP_printk("%llu %u %u %u %u %u", | ||
1061 | __entry->ino, __entry->cpos, __entry->old, __entry->new, | ||
1062 | __entry->len, __entry->ext_flags) | ||
1063 | ); | ||
1064 | |||
1065 | DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_make_clusters_writable); | ||
1066 | |||
1067 | TRACE_EVENT(ocfs2_refcount_cow_hunk, | ||
1068 | TP_PROTO(unsigned long long ino, unsigned int cpos, | ||
1069 | unsigned int write_len, unsigned int max_cpos, | ||
1070 | unsigned int cow_start, unsigned int cow_len), | ||
1071 | TP_ARGS(ino, cpos, write_len, max_cpos, cow_start, cow_len), | ||
1072 | TP_STRUCT__entry( | ||
1073 | __field(unsigned long long, ino) | ||
1074 | __field(unsigned int, cpos) | ||
1075 | __field(unsigned int, write_len) | ||
1076 | __field(unsigned int, max_cpos) | ||
1077 | __field(unsigned int, cow_start) | ||
1078 | __field(unsigned int, cow_len) | ||
1079 | ), | ||
1080 | TP_fast_assign( | ||
1081 | __entry->ino = ino; | ||
1082 | __entry->cpos = cpos; | ||
1083 | __entry->write_len = write_len; | ||
1084 | __entry->max_cpos = max_cpos; | ||
1085 | __entry->cow_start = cow_start; | ||
1086 | __entry->cow_len = cow_len; | ||
1087 | ), | ||
1088 | TP_printk("%llu %u %u %u %u %u", | ||
1089 | __entry->ino, __entry->cpos, __entry->write_len, | ||
1090 | __entry->max_cpos, __entry->cow_start, __entry->cow_len) | ||
1091 | ); | ||
1092 | |||
1093 | /* End of trace events for fs/ocfs2/refcounttree.c. */ | ||
1094 | |||
1095 | /* Trace events for fs/ocfs2/aops.c. */ | ||
1096 | |||
1097 | DECLARE_EVENT_CLASS(ocfs2__get_block, | ||
1098 | TP_PROTO(unsigned long long ino, unsigned long long iblock, | ||
1099 | void *bh_result, int create), | ||
1100 | TP_ARGS(ino, iblock, bh_result, create), | ||
1101 | TP_STRUCT__entry( | ||
1102 | __field(unsigned long long, ino) | ||
1103 | __field(unsigned long long, iblock) | ||
1104 | __field(void *, bh_result) | ||
1105 | __field(int, create) | ||
1106 | ), | ||
1107 | TP_fast_assign( | ||
1108 | __entry->ino = ino; | ||
1109 | __entry->iblock = iblock; | ||
1110 | __entry->bh_result = bh_result; | ||
1111 | __entry->create = create; | ||
1112 | ), | ||
1113 | TP_printk("%llu %llu %p %d", | ||
1114 | __entry->ino, __entry->iblock, | ||
1115 | __entry->bh_result, __entry->create) | ||
1116 | ); | ||
1117 | |||
1118 | #define DEFINE_OCFS2_GET_BLOCK_EVENT(name) \ | ||
1119 | DEFINE_EVENT(ocfs2__get_block, name, \ | ||
1120 | TP_PROTO(unsigned long long ino, unsigned long long iblock, \ | ||
1121 | void *bh_result, int create), \ | ||
1122 | TP_ARGS(ino, iblock, bh_result, create)) | ||
1123 | |||
1124 | DEFINE_OCFS2_GET_BLOCK_EVENT(ocfs2_symlink_get_block); | ||
1125 | |||
1126 | DEFINE_OCFS2_GET_BLOCK_EVENT(ocfs2_get_block); | ||
1127 | |||
1128 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_get_block_end); | ||
1129 | |||
1130 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_readpage); | ||
1131 | |||
1132 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_writepage); | ||
1133 | |||
1134 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_bmap); | ||
1135 | |||
1136 | TRACE_EVENT(ocfs2_try_to_write_inline_data, | ||
1137 | TP_PROTO(unsigned long long ino, unsigned int len, | ||
1138 | unsigned long long pos, unsigned int flags), | ||
1139 | TP_ARGS(ino, len, pos, flags), | ||
1140 | TP_STRUCT__entry( | ||
1141 | __field(unsigned long long, ino) | ||
1142 | __field(unsigned int, len) | ||
1143 | __field(unsigned long long, pos) | ||
1144 | __field(unsigned int, flags) | ||
1145 | ), | ||
1146 | TP_fast_assign( | ||
1147 | __entry->ino = ino; | ||
1148 | __entry->len = len; | ||
1149 | __entry->pos = pos; | ||
1150 | __entry->flags = flags; | ||
1151 | ), | ||
1152 | TP_printk("%llu %u %llu 0x%x", | ||
1153 | __entry->ino, __entry->len, __entry->pos, __entry->flags) | ||
1154 | ); | ||
1155 | |||
1156 | TRACE_EVENT(ocfs2_write_begin_nolock, | ||
1157 | TP_PROTO(unsigned long long ino, | ||
1158 | long long i_size, unsigned int i_clusters, | ||
1159 | unsigned long long pos, unsigned int len, | ||
1160 | unsigned int flags, void *page, | ||
1161 | unsigned int clusters, unsigned int extents_to_split), | ||
1162 | TP_ARGS(ino, i_size, i_clusters, pos, len, flags, | ||
1163 | page, clusters, extents_to_split), | ||
1164 | TP_STRUCT__entry( | ||
1165 | __field(unsigned long long, ino) | ||
1166 | __field(long long, i_size) | ||
1167 | __field(unsigned int, i_clusters) | ||
1168 | __field(unsigned long long, pos) | ||
1169 | __field(unsigned int, len) | ||
1170 | __field(unsigned int, flags) | ||
1171 | __field(void *, page) | ||
1172 | __field(unsigned int, clusters) | ||
1173 | __field(unsigned int, extents_to_split) | ||
1174 | ), | ||
1175 | TP_fast_assign( | ||
1176 | __entry->ino = ino; | ||
1177 | __entry->i_size = i_size; | ||
1178 | __entry->i_clusters = i_clusters; | ||
1179 | __entry->pos = pos; | ||
1180 | __entry->len = len; | ||
1181 | __entry->flags = flags; | ||
1182 | __entry->page = page; | ||
1183 | __entry->clusters = clusters; | ||
1184 | __entry->extents_to_split = extents_to_split; | ||
1185 | ), | ||
1186 | TP_printk("%llu %lld %u %llu %u %u %p %u %u", | ||
1187 | __entry->ino, __entry->i_size, __entry->i_clusters, | ||
1188 | __entry->pos, __entry->len, | ||
1189 | __entry->flags, __entry->page, __entry->clusters, | ||
1190 | __entry->extents_to_split) | ||
1191 | ); | ||
1192 | |||
1193 | TRACE_EVENT(ocfs2_write_end_inline, | ||
1194 | TP_PROTO(unsigned long long ino, | ||
1195 | unsigned long long pos, unsigned int copied, | ||
1196 | unsigned int id_count, unsigned int features), | ||
1197 | TP_ARGS(ino, pos, copied, id_count, features), | ||
1198 | TP_STRUCT__entry( | ||
1199 | __field(unsigned long long, ino) | ||
1200 | __field(unsigned long long, pos) | ||
1201 | __field(unsigned int, copied) | ||
1202 | __field(unsigned int, id_count) | ||
1203 | __field(unsigned int, features) | ||
1204 | ), | ||
1205 | TP_fast_assign( | ||
1206 | __entry->ino = ino; | ||
1207 | __entry->pos = pos; | ||
1208 | __entry->copied = copied; | ||
1209 | __entry->id_count = id_count; | ||
1210 | __entry->features = features; | ||
1211 | ), | ||
1212 | TP_printk("%llu %llu %u %u %u", | ||
1213 | __entry->ino, __entry->pos, __entry->copied, | ||
1214 | __entry->id_count, __entry->features) | ||
1215 | ); | ||
1216 | |||
1217 | /* End of trace events for fs/ocfs2/aops.c. */ | ||
1218 | |||
1219 | /* Trace events for fs/ocfs2/mmap.c. */ | ||
1220 | |||
1221 | TRACE_EVENT(ocfs2_fault, | ||
1222 | TP_PROTO(unsigned long long ino, | ||
1223 | void *area, void *page, unsigned long pgoff), | ||
1224 | TP_ARGS(ino, area, page, pgoff), | ||
1225 | TP_STRUCT__entry( | ||
1226 | __field(unsigned long long, ino) | ||
1227 | __field(void *, area) | ||
1228 | __field(void *, page) | ||
1229 | __field(unsigned long, pgoff) | ||
1230 | ), | ||
1231 | TP_fast_assign( | ||
1232 | __entry->ino = ino; | ||
1233 | __entry->area = area; | ||
1234 | __entry->page = page; | ||
1235 | __entry->pgoff = pgoff; | ||
1236 | ), | ||
1237 | TP_printk("%llu %p %p %lu", | ||
1238 | __entry->ino, __entry->area, __entry->page, __entry->pgoff) | ||
1239 | ); | ||
1240 | |||
1241 | /* End of trace events for fs/ocfs2/mmap.c. */ | ||
1242 | |||
1243 | /* Trace events for fs/ocfs2/file.c. */ | ||
1244 | |||
1245 | DECLARE_EVENT_CLASS(ocfs2__file_ops, | ||
1246 | TP_PROTO(void *inode, void *file, void *dentry, | ||
1247 | unsigned long long ino, | ||
1248 | unsigned int d_len, const unsigned char *d_name, | ||
1249 | unsigned long long para), | ||
1250 | TP_ARGS(inode, file, dentry, ino, d_len, d_name, para), | ||
1251 | TP_STRUCT__entry( | ||
1252 | __field(void *, inode) | ||
1253 | __field(void *, file) | ||
1254 | __field(void *, dentry) | ||
1255 | __field(unsigned long long, ino) | ||
1256 | __field(unsigned int, d_len) | ||
1257 | __string(d_name, d_name) | ||
1258 | __field(unsigned long long, para) | ||
1259 | ), | ||
1260 | TP_fast_assign( | ||
1261 | __entry->inode = inode; | ||
1262 | __entry->file = file; | ||
1263 | __entry->dentry = dentry; | ||
1264 | __entry->ino = ino; | ||
1265 | __entry->d_len = d_len; | ||
1266 | __assign_str(d_name, d_name); | ||
1267 | __entry->para = para; | ||
1268 | ), | ||
1269 | TP_printk("%p %p %p %llu %llu %.*s", __entry->inode, __entry->file, | ||
1270 | __entry->dentry, __entry->ino, __entry->para, | ||
1271 | __entry->d_len, __get_str(d_name)) | ||
1272 | ); | ||
1273 | |||
1274 | #define DEFINE_OCFS2_FILE_OPS(name) \ | ||
1275 | DEFINE_EVENT(ocfs2__file_ops, name, \ | ||
1276 | TP_PROTO(void *inode, void *file, void *dentry, \ | ||
1277 | unsigned long long ino, \ | ||
1278 | unsigned int d_len, const unsigned char *d_name, \ | ||
1279 | unsigned long long mode), \ | ||
1280 | TP_ARGS(inode, file, dentry, ino, d_len, d_name, mode)) | ||
1281 | |||
1282 | DEFINE_OCFS2_FILE_OPS(ocfs2_file_open); | ||
1283 | |||
1284 | DEFINE_OCFS2_FILE_OPS(ocfs2_file_release); | ||
1285 | |||
1286 | DEFINE_OCFS2_FILE_OPS(ocfs2_sync_file); | ||
1287 | |||
1288 | DEFINE_OCFS2_FILE_OPS(ocfs2_file_aio_write); | ||
1289 | |||
1290 | DEFINE_OCFS2_FILE_OPS(ocfs2_file_splice_write); | ||
1291 | |||
1292 | DEFINE_OCFS2_FILE_OPS(ocfs2_file_splice_read); | ||
1293 | |||
1294 | DEFINE_OCFS2_FILE_OPS(ocfs2_file_aio_read); | ||
1295 | |||
1296 | DEFINE_OCFS2_ULL_ULL_ULL_EVENT(ocfs2_truncate_file); | ||
1297 | |||
1298 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_truncate_file_error); | ||
1299 | |||
1300 | TRACE_EVENT(ocfs2_extend_allocation, | ||
1301 | TP_PROTO(unsigned long long ip_blkno, unsigned long long size, | ||
1302 | unsigned int clusters, unsigned int clusters_to_add, | ||
1303 | int why, int restart_func), | ||
1304 | TP_ARGS(ip_blkno, size, clusters, clusters_to_add, why, restart_func), | ||
1305 | TP_STRUCT__entry( | ||
1306 | __field(unsigned long long, ip_blkno) | ||
1307 | __field(unsigned long long, size) | ||
1308 | __field(unsigned int, clusters) | ||
1309 | __field(unsigned int, clusters_to_add) | ||
1310 | __field(int, why) | ||
1311 | __field(int, restart_func) | ||
1312 | ), | ||
1313 | TP_fast_assign( | ||
1314 | __entry->ip_blkno = ip_blkno; | ||
1315 | __entry->size = size; | ||
1316 | __entry->clusters = clusters; | ||
1317 | __entry->clusters_to_add = clusters_to_add; | ||
1318 | __entry->why = why; | ||
1319 | __entry->restart_func = restart_func; | ||
1320 | ), | ||
1321 | TP_printk("%llu %llu %u %u %d %d", | ||
1322 | __entry->ip_blkno, __entry->size, __entry->clusters, | ||
1323 | __entry->clusters_to_add, __entry->why, __entry->restart_func) | ||
1324 | ); | ||
1325 | |||
1326 | TRACE_EVENT(ocfs2_extend_allocation_end, | ||
1327 | TP_PROTO(unsigned long long ino, | ||
1328 | unsigned int di_clusters, unsigned long long di_size, | ||
1329 | unsigned int ip_clusters, unsigned long long i_size), | ||
1330 | TP_ARGS(ino, di_clusters, di_size, ip_clusters, i_size), | ||
1331 | TP_STRUCT__entry( | ||
1332 | __field(unsigned long long, ino) | ||
1333 | __field(unsigned int, di_clusters) | ||
1334 | __field(unsigned long long, di_size) | ||
1335 | __field(unsigned int, ip_clusters) | ||
1336 | __field(unsigned long long, i_size) | ||
1337 | ), | ||
1338 | TP_fast_assign( | ||
1339 | __entry->ino = ino; | ||
1340 | __entry->di_clusters = di_clusters; | ||
1341 | __entry->di_size = di_size; | ||
1342 | __entry->ip_clusters = ip_clusters; | ||
1343 | __entry->i_size = i_size; | ||
1344 | ), | ||
1345 | TP_printk("%llu %u %llu %u %llu", __entry->ino, __entry->di_clusters, | ||
1346 | __entry->di_size, __entry->ip_clusters, __entry->i_size) | ||
1347 | ); | ||
1348 | |||
1349 | TRACE_EVENT(ocfs2_write_zero_page, | ||
1350 | TP_PROTO(unsigned long long ino, | ||
1351 | unsigned long long abs_from, unsigned long long abs_to, | ||
1352 | unsigned long index, unsigned int zero_from, | ||
1353 | unsigned int zero_to), | ||
1354 | TP_ARGS(ino, abs_from, abs_to, index, zero_from, zero_to), | ||
1355 | TP_STRUCT__entry( | ||
1356 | __field(unsigned long long, ino) | ||
1357 | __field(unsigned long long, abs_from) | ||
1358 | __field(unsigned long long, abs_to) | ||
1359 | __field(unsigned long, index) | ||
1360 | __field(unsigned int, zero_from) | ||
1361 | __field(unsigned int, zero_to) | ||
1362 | ), | ||
1363 | TP_fast_assign( | ||
1364 | __entry->ino = ino; | ||
1365 | __entry->abs_from = abs_from; | ||
1366 | __entry->abs_to = abs_to; | ||
1367 | __entry->index = index; | ||
1368 | __entry->zero_from = zero_from; | ||
1369 | __entry->zero_to = zero_to; | ||
1370 | ), | ||
1371 | TP_printk("%llu %llu %llu %lu %u %u", __entry->ino, | ||
1372 | __entry->abs_from, __entry->abs_to, | ||
1373 | __entry->index, __entry->zero_from, __entry->zero_to) | ||
1374 | ); | ||
1375 | |||
1376 | DEFINE_OCFS2_ULL_ULL_ULL_EVENT(ocfs2_zero_extend_range); | ||
1377 | |||
1378 | DEFINE_OCFS2_ULL_ULL_ULL_EVENT(ocfs2_zero_extend); | ||
1379 | |||
1380 | TRACE_EVENT(ocfs2_setattr, | ||
1381 | TP_PROTO(void *inode, void *dentry, | ||
1382 | unsigned long long ino, | ||
1383 | unsigned int d_len, const unsigned char *d_name, | ||
1384 | unsigned int ia_valid, unsigned int ia_mode, | ||
1385 | unsigned int ia_uid, unsigned int ia_gid), | ||
1386 | TP_ARGS(inode, dentry, ino, d_len, d_name, | ||
1387 | ia_valid, ia_mode, ia_uid, ia_gid), | ||
1388 | TP_STRUCT__entry( | ||
1389 | __field(void *, inode) | ||
1390 | __field(void *, dentry) | ||
1391 | __field(unsigned long long, ino) | ||
1392 | __field(unsigned int, d_len) | ||
1393 | __string(d_name, d_name) | ||
1394 | __field(unsigned int, ia_valid) | ||
1395 | __field(unsigned int, ia_mode) | ||
1396 | __field(unsigned int, ia_uid) | ||
1397 | __field(unsigned int, ia_gid) | ||
1398 | ), | ||
1399 | TP_fast_assign( | ||
1400 | __entry->inode = inode; | ||
1401 | __entry->dentry = dentry; | ||
1402 | __entry->ino = ino; | ||
1403 | __entry->d_len = d_len; | ||
1404 | __assign_str(d_name, d_name); | ||
1405 | __entry->ia_valid = ia_valid; | ||
1406 | __entry->ia_mode = ia_mode; | ||
1407 | __entry->ia_uid = ia_uid; | ||
1408 | __entry->ia_gid = ia_gid; | ||
1409 | ), | ||
1410 | TP_printk("%p %p %llu %.*s %u %u %u %u", __entry->inode, | ||
1411 | __entry->dentry, __entry->ino, __entry->d_len, | ||
1412 | __get_str(d_name), __entry->ia_valid, __entry->ia_mode, | ||
1413 | __entry->ia_uid, __entry->ia_gid) | ||
1414 | ); | ||
1415 | |||
1416 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_write_remove_suid); | ||
1417 | |||
1418 | DEFINE_OCFS2_ULL_ULL_ULL_EVENT(ocfs2_zero_partial_clusters); | ||
1419 | |||
1420 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_zero_partial_clusters_range1); | ||
1421 | |||
1422 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_zero_partial_clusters_range2); | ||
1423 | |||
1424 | DEFINE_OCFS2_ULL_ULL_ULL_EVENT(ocfs2_remove_inode_range); | ||
1425 | |||
1426 | TRACE_EVENT(ocfs2_prepare_inode_for_write, | ||
1427 | TP_PROTO(unsigned long long ino, unsigned long long saved_pos, | ||
1428 | int appending, unsigned long count, | ||
1429 | int *direct_io, int *has_refcount), | ||
1430 | TP_ARGS(ino, saved_pos, appending, count, direct_io, has_refcount), | ||
1431 | TP_STRUCT__entry( | ||
1432 | __field(unsigned long long, ino) | ||
1433 | __field(unsigned long long, saved_pos) | ||
1434 | __field(int, appending) | ||
1435 | __field(unsigned long, count) | ||
1436 | __field(int, direct_io) | ||
1437 | __field(int, has_refcount) | ||
1438 | ), | ||
1439 | TP_fast_assign( | ||
1440 | __entry->ino = ino; | ||
1441 | __entry->saved_pos = saved_pos; | ||
1442 | __entry->appending = appending; | ||
1443 | __entry->count = count; | ||
1444 | __entry->direct_io = direct_io ? *direct_io : -1; | ||
1445 | __entry->has_refcount = has_refcount ? *has_refcount : -1; | ||
1446 | ), | ||
1447 | TP_printk("%llu %llu %d %lu %d %d", __entry->ino, | ||
1448 | __entry->saved_pos, __entry->appending, __entry->count, | ||
1449 | __entry->direct_io, __entry->has_refcount) | ||
1450 | ); | ||
1451 | |||
1452 | DEFINE_OCFS2_INT_EVENT(generic_file_aio_read_ret); | ||
1453 | |||
1454 | /* End of trace events for fs/ocfs2/file.c. */ | ||
1455 | |||
1456 | /* Trace events for fs/ocfs2/inode.c. */ | ||
1457 | |||
1458 | TRACE_EVENT(ocfs2_iget_begin, | ||
1459 | TP_PROTO(unsigned long long ino, unsigned int flags, int sysfile_type), | ||
1460 | TP_ARGS(ino, flags, sysfile_type), | ||
1461 | TP_STRUCT__entry( | ||
1462 | __field(unsigned long long, ino) | ||
1463 | __field(unsigned int, flags) | ||
1464 | __field(int, sysfile_type) | ||
1465 | ), | ||
1466 | TP_fast_assign( | ||
1467 | __entry->ino = ino; | ||
1468 | __entry->flags = flags; | ||
1469 | __entry->sysfile_type = sysfile_type; | ||
1470 | ), | ||
1471 | TP_printk("%llu %u %d", __entry->ino, | ||
1472 | __entry->flags, __entry->sysfile_type) | ||
1473 | ); | ||
1474 | |||
1475 | DEFINE_OCFS2_ULL_EVENT(ocfs2_iget5_locked); | ||
1476 | |||
1477 | TRACE_EVENT(ocfs2_iget_end, | ||
1478 | TP_PROTO(void *inode, unsigned long long ino), | ||
1479 | TP_ARGS(inode, ino), | ||
1480 | TP_STRUCT__entry( | ||
1481 | __field(void *, inode) | ||
1482 | __field(unsigned long long, ino) | ||
1483 | ), | ||
1484 | TP_fast_assign( | ||
1485 | __entry->inode = inode; | ||
1486 | __entry->ino = ino; | ||
1487 | ), | ||
1488 | TP_printk("%p %llu", __entry->inode, __entry->ino) | ||
1489 | ); | ||
1490 | |||
1491 | TRACE_EVENT(ocfs2_find_actor, | ||
1492 | TP_PROTO(void *inode, unsigned long long ino, | ||
1493 | void *args, unsigned long long fi_blkno), | ||
1494 | TP_ARGS(inode, ino, args, fi_blkno), | ||
1495 | TP_STRUCT__entry( | ||
1496 | __field(void *, inode) | ||
1497 | __field(unsigned long long, ino) | ||
1498 | __field(void *, args) | ||
1499 | __field(unsigned long long, fi_blkno) | ||
1500 | ), | ||
1501 | TP_fast_assign( | ||
1502 | __entry->inode = inode; | ||
1503 | __entry->ino = ino; | ||
1504 | __entry->args = args; | ||
1505 | __entry->fi_blkno = fi_blkno; | ||
1506 | ), | ||
1507 | TP_printk("%p %llu %p %llu", __entry->inode, __entry->ino, | ||
1508 | __entry->args, __entry->fi_blkno) | ||
1509 | ); | ||
1510 | |||
1511 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_populate_inode); | ||
1512 | |||
1513 | DEFINE_OCFS2_ULL_INT_EVENT(ocfs2_read_locked_inode); | ||
1514 | |||
1515 | DEFINE_OCFS2_INT_INT_EVENT(ocfs2_check_orphan_recovery_state); | ||
1516 | |||
1517 | DEFINE_OCFS2_ULL_EVENT(ocfs2_validate_inode_block); | ||
1518 | |||
1519 | TRACE_EVENT(ocfs2_inode_is_valid_to_delete, | ||
1520 | TP_PROTO(void *task, void *dc_task, unsigned long long ino, | ||
1521 | unsigned int flags), | ||
1522 | TP_ARGS(task, dc_task, ino, flags), | ||
1523 | TP_STRUCT__entry( | ||
1524 | __field(void *, task) | ||
1525 | __field(void *, dc_task) | ||
1526 | __field(unsigned long long, ino) | ||
1527 | __field(unsigned int, flags) | ||
1528 | ), | ||
1529 | TP_fast_assign( | ||
1530 | __entry->task = task; | ||
1531 | __entry->dc_task = dc_task; | ||
1532 | __entry->ino = ino; | ||
1533 | __entry->flags = flags; | ||
1534 | ), | ||
1535 | TP_printk("%p %p %llu %u", __entry->task, __entry->dc_task, | ||
1536 | __entry->ino, __entry->flags) | ||
1537 | ); | ||
1538 | |||
1539 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_query_inode_wipe_begin); | ||
1540 | |||
1541 | DEFINE_OCFS2_UINT_EVENT(ocfs2_query_inode_wipe_succ); | ||
1542 | |||
1543 | DEFINE_OCFS2_INT_INT_EVENT(ocfs2_query_inode_wipe_end); | ||
1544 | |||
1545 | DEFINE_OCFS2_ULL_INT_EVENT(ocfs2_cleanup_delete_inode); | ||
1546 | |||
1547 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_delete_inode); | ||
1548 | |||
1549 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_clear_inode); | ||
1550 | |||
1551 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_drop_inode); | ||
1552 | |||
1553 | TRACE_EVENT(ocfs2_inode_revalidate, | ||
1554 | TP_PROTO(void *inode, unsigned long long ino, | ||
1555 | unsigned int flags), | ||
1556 | TP_ARGS(inode, ino, flags), | ||
1557 | TP_STRUCT__entry( | ||
1558 | __field(void *, inode) | ||
1559 | __field(unsigned long long, ino) | ||
1560 | __field(unsigned int, flags) | ||
1561 | ), | ||
1562 | TP_fast_assign( | ||
1563 | __entry->inode = inode; | ||
1564 | __entry->ino = ino; | ||
1565 | __entry->flags = flags; | ||
1566 | ), | ||
1567 | TP_printk("%p %llu %u", __entry->inode, __entry->ino, __entry->flags) | ||
1568 | ); | ||
1569 | |||
1570 | DEFINE_OCFS2_ULL_EVENT(ocfs2_mark_inode_dirty); | ||
1571 | |||
1572 | /* End of trace events for fs/ocfs2/inode.c. */ | ||
1573 | |||
1574 | /* Trace events for fs/ocfs2/extent_map.c. */ | ||
1575 | |||
1576 | TRACE_EVENT(ocfs2_read_virt_blocks, | ||
1577 | TP_PROTO(void *inode, unsigned long long vblock, int nr, | ||
1578 | void *bhs, unsigned int flags, void *validate), | ||
1579 | TP_ARGS(inode, vblock, nr, bhs, flags, validate), | ||
1580 | TP_STRUCT__entry( | ||
1581 | __field(void *, inode) | ||
1582 | __field(unsigned long long, vblock) | ||
1583 | __field(int, nr) | ||
1584 | __field(void *, bhs) | ||
1585 | __field(unsigned int, flags) | ||
1586 | __field(void *, validate) | ||
1587 | ), | ||
1588 | TP_fast_assign( | ||
1589 | __entry->inode = inode; | ||
1590 | __entry->vblock = vblock; | ||
1591 | __entry->nr = nr; | ||
1592 | __entry->bhs = bhs; | ||
1593 | __entry->flags = flags; | ||
1594 | __entry->validate = validate; | ||
1595 | ), | ||
1596 | TP_printk("%p %llu %d %p %x %p", __entry->inode, __entry->vblock, | ||
1597 | __entry->nr, __entry->bhs, __entry->flags, __entry->validate) | ||
1598 | ); | ||
1599 | |||
1600 | /* End of trace events for fs/ocfs2/extent_map.c. */ | ||
1601 | |||
1602 | /* Trace events for fs/ocfs2/slot_map.c. */ | ||
1603 | |||
1604 | DEFINE_OCFS2_UINT_EVENT(ocfs2_refresh_slot_info); | ||
1605 | |||
1606 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_map_slot_buffers); | ||
1607 | |||
1608 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_map_slot_buffers_block); | ||
1609 | |||
1610 | DEFINE_OCFS2_INT_EVENT(ocfs2_find_slot); | ||
1611 | |||
1612 | /* End of trace events for fs/ocfs2/slot_map.c. */ | ||
1613 | |||
1614 | /* Trace events for fs/ocfs2/heartbeat.c. */ | ||
1615 | |||
1616 | DEFINE_OCFS2_INT_EVENT(ocfs2_do_node_down); | ||
1617 | |||
1618 | /* End of trace events for fs/ocfs2/heartbeat.c. */ | ||
1619 | |||
1620 | /* Trace events for fs/ocfs2/super.c. */ | ||
1621 | |||
1622 | TRACE_EVENT(ocfs2_remount, | ||
1623 | TP_PROTO(unsigned long s_flags, unsigned long osb_flags, int flags), | ||
1624 | TP_ARGS(s_flags, osb_flags, flags), | ||
1625 | TP_STRUCT__entry( | ||
1626 | __field(unsigned long, s_flags) | ||
1627 | __field(unsigned long, osb_flags) | ||
1628 | __field(int, flags) | ||
1629 | ), | ||
1630 | TP_fast_assign( | ||
1631 | __entry->s_flags = s_flags; | ||
1632 | __entry->osb_flags = osb_flags; | ||
1633 | __entry->flags = flags; | ||
1634 | ), | ||
1635 | TP_printk("%lu %lu %d", __entry->s_flags, | ||
1636 | __entry->osb_flags, __entry->flags) | ||
1637 | ); | ||
1638 | |||
1639 | TRACE_EVENT(ocfs2_fill_super, | ||
1640 | TP_PROTO(void *sb, void *data, int silent), | ||
1641 | TP_ARGS(sb, data, silent), | ||
1642 | TP_STRUCT__entry( | ||
1643 | __field(void *, sb) | ||
1644 | __field(void *, data) | ||
1645 | __field(int, silent) | ||
1646 | ), | ||
1647 | TP_fast_assign( | ||
1648 | __entry->sb = sb; | ||
1649 | __entry->data = data; | ||
1650 | __entry->silent = silent; | ||
1651 | ), | ||
1652 | TP_printk("%p %p %d", __entry->sb, | ||
1653 | __entry->data, __entry->silent) | ||
1654 | ); | ||
1655 | |||
1656 | TRACE_EVENT(ocfs2_parse_options, | ||
1657 | TP_PROTO(int is_remount, char *options), | ||
1658 | TP_ARGS(is_remount, options), | ||
1659 | TP_STRUCT__entry( | ||
1660 | __field(int, is_remount) | ||
1661 | __string(options, options) | ||
1662 | ), | ||
1663 | TP_fast_assign( | ||
1664 | __entry->is_remount = is_remount; | ||
1665 | __assign_str(options, options); | ||
1666 | ), | ||
1667 | TP_printk("%d %s", __entry->is_remount, __get_str(options)) | ||
1668 | ); | ||
1669 | |||
1670 | DEFINE_OCFS2_POINTER_EVENT(ocfs2_put_super); | ||
1671 | |||
1672 | TRACE_EVENT(ocfs2_statfs, | ||
1673 | TP_PROTO(void *sb, void *buf), | ||
1674 | TP_ARGS(sb, buf), | ||
1675 | TP_STRUCT__entry( | ||
1676 | __field(void *, sb) | ||
1677 | __field(void *, buf) | ||
1678 | ), | ||
1679 | TP_fast_assign( | ||
1680 | __entry->sb = sb; | ||
1681 | __entry->buf = buf; | ||
1682 | ), | ||
1683 | TP_printk("%p %p", __entry->sb, __entry->buf) | ||
1684 | ); | ||
1685 | |||
1686 | DEFINE_OCFS2_POINTER_EVENT(ocfs2_dismount_volume); | ||
1687 | |||
1688 | TRACE_EVENT(ocfs2_initialize_super, | ||
1689 | TP_PROTO(char *label, char *uuid_str, unsigned long long root_dir, | ||
1690 | unsigned long long system_dir, int cluster_bits), | ||
1691 | TP_ARGS(label, uuid_str, root_dir, system_dir, cluster_bits), | ||
1692 | TP_STRUCT__entry( | ||
1693 | __string(label, label) | ||
1694 | __string(uuid_str, uuid_str) | ||
1695 | __field(unsigned long long, root_dir) | ||
1696 | __field(unsigned long long, system_dir) | ||
1697 | __field(int, cluster_bits) | ||
1698 | ), | ||
1699 | TP_fast_assign( | ||
1700 | __assign_str(label, label); | ||
1701 | __assign_str(uuid_str, uuid_str); | ||
1702 | __entry->root_dir = root_dir; | ||
1703 | __entry->system_dir = system_dir; | ||
1704 | __entry->cluster_bits = cluster_bits; | ||
1705 | ), | ||
1706 | TP_printk("%s %s %llu %llu %d", __get_str(label), __get_str(uuid_str), | ||
1707 | __entry->root_dir, __entry->system_dir, __entry->cluster_bits) | ||
1708 | ); | ||
1709 | |||
1710 | /* End of trace events for fs/ocfs2/super.c. */ | ||
1711 | |||
1712 | /* Trace events for fs/ocfs2/xattr.c. */ | ||
1713 | |||
1714 | DEFINE_OCFS2_ULL_EVENT(ocfs2_validate_xattr_block); | ||
1715 | |||
1716 | DEFINE_OCFS2_UINT_EVENT(ocfs2_xattr_extend_allocation); | ||
1717 | |||
1718 | TRACE_EVENT(ocfs2_init_xattr_set_ctxt, | ||
1719 | TP_PROTO(const char *name, int meta, int clusters, int credits), | ||
1720 | TP_ARGS(name, meta, clusters, credits), | ||
1721 | TP_STRUCT__entry( | ||
1722 | __string(name, name) | ||
1723 | __field(int, meta) | ||
1724 | __field(int, clusters) | ||
1725 | __field(int, credits) | ||
1726 | ), | ||
1727 | TP_fast_assign( | ||
1728 | __assign_str(name, name); | ||
1729 | __entry->meta = meta; | ||
1730 | __entry->clusters = clusters; | ||
1731 | __entry->credits = credits; | ||
1732 | ), | ||
1733 | TP_printk("%s %d %d %d", __get_str(name), __entry->meta, | ||
1734 | __entry->clusters, __entry->credits) | ||
1735 | ); | ||
1736 | |||
1737 | DECLARE_EVENT_CLASS(ocfs2__xattr_find, | ||
1738 | TP_PROTO(unsigned long long ino, const char *name, int name_index, | ||
1739 | unsigned int hash, unsigned long long location, | ||
1740 | int xe_index), | ||
1741 | TP_ARGS(ino, name, name_index, hash, location, xe_index), | ||
1742 | TP_STRUCT__entry( | ||
1743 | __field(unsigned long long, ino) | ||
1744 | __string(name, name) | ||
1745 | __field(int, name_index) | ||
1746 | __field(unsigned int, hash) | ||
1747 | __field(unsigned long long, location) | ||
1748 | __field(int, xe_index) | ||
1749 | ), | ||
1750 | TP_fast_assign( | ||
1751 | __entry->ino = ino; | ||
1752 | __assign_str(name, name); | ||
1753 | __entry->name_index = name_index; | ||
1754 | __entry->hash = hash; | ||
1755 | __entry->location = location; | ||
1756 | __entry->xe_index = xe_index; | ||
1757 | ), | ||
1758 | TP_printk("%llu %s %d %u %llu %d", __entry->ino, __get_str(name), | ||
1759 | __entry->name_index, __entry->hash, __entry->location, | ||
1760 | __entry->xe_index) | ||
1761 | ); | ||
1762 | |||
1763 | #define DEFINE_OCFS2_XATTR_FIND_EVENT(name) \ | ||
1764 | DEFINE_EVENT(ocfs2__xattr_find, name, \ | ||
1765 | TP_PROTO(unsigned long long ino, const char *name, int name_index, \ | ||
1766 | unsigned int hash, unsigned long long bucket, \ | ||
1767 | int xe_index), \ | ||
1768 | TP_ARGS(ino, name, name_index, hash, bucket, xe_index)) | ||
1769 | |||
1770 | DEFINE_OCFS2_XATTR_FIND_EVENT(ocfs2_xattr_bucket_find); | ||
1771 | |||
1772 | DEFINE_OCFS2_XATTR_FIND_EVENT(ocfs2_xattr_index_block_find); | ||
1773 | |||
1774 | DEFINE_OCFS2_XATTR_FIND_EVENT(ocfs2_xattr_index_block_find_rec); | ||
1775 | |||
1776 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_iterate_xattr_buckets); | ||
1777 | |||
1778 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_iterate_xattr_bucket); | ||
1779 | |||
1780 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_cp_xattr_block_to_bucket_begin); | ||
1781 | |||
1782 | DEFINE_OCFS2_UINT_UINT_UINT_EVENT(ocfs2_cp_xattr_block_to_bucket_end); | ||
1783 | |||
1784 | DEFINE_OCFS2_ULL_EVENT(ocfs2_xattr_create_index_block_begin); | ||
1785 | |||
1786 | DEFINE_OCFS2_ULL_EVENT(ocfs2_xattr_create_index_block); | ||
1787 | |||
1788 | DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_defrag_xattr_bucket); | ||
1789 | |||
1790 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_mv_xattr_bucket_cross_cluster); | ||
1791 | |||
1792 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_divide_xattr_bucket_begin); | ||
1793 | |||
1794 | DEFINE_OCFS2_UINT_UINT_UINT_EVENT(ocfs2_divide_xattr_bucket_move); | ||
1795 | |||
1796 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_cp_xattr_bucket); | ||
1797 | |||
1798 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_mv_xattr_buckets); | ||
1799 | |||
1800 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_adjust_xattr_cross_cluster); | ||
1801 | |||
1802 | DEFINE_OCFS2_ULL_ULL_UINT_UINT_EVENT(ocfs2_add_new_xattr_cluster_begin); | ||
1803 | |||
1804 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_add_new_xattr_cluster); | ||
1805 | |||
1806 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_add_new_xattr_cluster_insert); | ||
1807 | |||
1808 | DEFINE_OCFS2_ULL_ULL_UINT_UINT_EVENT(ocfs2_extend_xattr_bucket); | ||
1809 | |||
1810 | DEFINE_OCFS2_ULL_EVENT(ocfs2_add_new_xattr_bucket); | ||
1811 | |||
1812 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_xattr_bucket_value_truncate); | ||
1813 | |||
1814 | DEFINE_OCFS2_ULL_ULL_UINT_UINT_EVENT(ocfs2_rm_xattr_cluster); | ||
1815 | |||
1816 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_reflink_xattr_header); | ||
1817 | |||
1818 | DEFINE_OCFS2_ULL_INT_EVENT(ocfs2_create_empty_xattr_block); | ||
1819 | |||
1820 | DEFINE_OCFS2_STRING_EVENT(ocfs2_xattr_set_entry_bucket); | ||
1821 | |||
1822 | DEFINE_OCFS2_STRING_EVENT(ocfs2_xattr_set_entry_index_block); | ||
1823 | |||
1824 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_xattr_bucket_value_refcount); | ||
1825 | |||
1826 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_reflink_xattr_buckets); | ||
1827 | |||
1828 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_reflink_xattr_rec); | ||
1829 | |||
1830 | /* End of trace events for fs/ocfs2/xattr.c. */ | ||
1831 | |||
1832 | /* Trace events for fs/ocfs2/reservations.c. */ | ||
1833 | |||
1834 | DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_resv_insert); | ||
1835 | |||
1836 | DEFINE_OCFS2_ULL_UINT_UINT_UINT_EVENT(ocfs2_resmap_find_free_bits_begin); | ||
1837 | |||
1838 | DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_resmap_find_free_bits_end); | ||
1839 | |||
1840 | TRACE_EVENT(ocfs2_resv_find_window_begin, | ||
1841 | TP_PROTO(unsigned int r_start, unsigned int r_end, unsigned int goal, | ||
1842 | unsigned int wanted, int empty_root), | ||
1843 | TP_ARGS(r_start, r_end, goal, wanted, empty_root), | ||
1844 | TP_STRUCT__entry( | ||
1845 | __field(unsigned int, r_start) | ||
1846 | __field(unsigned int, r_end) | ||
1847 | __field(unsigned int, goal) | ||
1848 | __field(unsigned int, wanted) | ||
1849 | __field(int, empty_root) | ||
1850 | ), | ||
1851 | TP_fast_assign( | ||
1852 | __entry->r_start = r_start; | ||
1853 | __entry->r_end = r_end; | ||
1854 | __entry->goal = goal; | ||
1855 | __entry->wanted = wanted; | ||
1856 | __entry->empty_root = empty_root; | ||
1857 | ), | ||
1858 | TP_printk("%u %u %u %u %d", __entry->r_start, __entry->r_end, | ||
1859 | __entry->goal, __entry->wanted, __entry->empty_root) | ||
1860 | ); | ||
1861 | |||
1862 | DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_resv_find_window_prev); | ||
1863 | |||
1864 | DEFINE_OCFS2_INT_INT_EVENT(ocfs2_resv_find_window_next); | ||
1865 | |||
1866 | DEFINE_OCFS2_UINT_UINT_UINT_EVENT(ocfs2_cannibalize_resv_begin); | ||
1867 | |||
1868 | TRACE_EVENT(ocfs2_cannibalize_resv_end, | ||
1869 | TP_PROTO(unsigned int start, unsigned int end, unsigned int len, | ||
1870 | unsigned int last_start, unsigned int last_len), | ||
1871 | TP_ARGS(start, end, len, last_start, last_len), | ||
1872 | TP_STRUCT__entry( | ||
1873 | __field(unsigned int, start) | ||
1874 | __field(unsigned int, end) | ||
1875 | __field(unsigned int, len) | ||
1876 | __field(unsigned int, last_start) | ||
1877 | __field(unsigned int, last_len) | ||
1878 | ), | ||
1879 | TP_fast_assign( | ||
1880 | __entry->start = start; | ||
1881 | __entry->end = end; | ||
1882 | __entry->len = len; | ||
1883 | __entry->last_start = last_start; | ||
1884 | __entry->last_len = last_len; | ||
1885 | ), | ||
1886 | TP_printk("%u %u %u %u %u", __entry->start, __entry->end, | ||
1887 | __entry->len, __entry->last_start, __entry->last_len) | ||
1888 | ); | ||
1889 | |||
1890 | DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_resmap_resv_bits); | ||
1891 | |||
1892 | TRACE_EVENT(ocfs2_resmap_claimed_bits_begin, | ||
1893 | TP_PROTO(unsigned int cstart, unsigned int cend, unsigned int clen, | ||
1894 | unsigned int r_start, unsigned int r_end, unsigned int r_len, | ||
1895 | unsigned int last_start, unsigned int last_len), | ||
1896 | TP_ARGS(cstart, cend, clen, r_start, r_end, | ||
1897 | r_len, last_start, last_len), | ||
1898 | TP_STRUCT__entry( | ||
1899 | __field(unsigned int, cstart) | ||
1900 | __field(unsigned int, cend) | ||
1901 | __field(unsigned int, clen) | ||
1902 | __field(unsigned int, r_start) | ||
1903 | __field(unsigned int, r_end) | ||
1904 | __field(unsigned int, r_len) | ||
1905 | __field(unsigned int, last_start) | ||
1906 | __field(unsigned int, last_len) | ||
1907 | ), | ||
1908 | TP_fast_assign( | ||
1909 | __entry->cstart = cstart; | ||
1910 | __entry->cend = cend; | ||
1911 | __entry->clen = clen; | ||
1912 | __entry->r_start = r_start; | ||
1913 | __entry->r_end = r_end; | ||
1914 | __entry->r_len = r_len; | ||
1915 | __entry->last_start = last_start; | ||
1916 | __entry->last_len = last_len; | ||
1917 | ), | ||
1918 | TP_printk("%u %u %u %u %u %u %u %u", | ||
1919 | __entry->cstart, __entry->cend, __entry->clen, | ||
1920 | __entry->r_start, __entry->r_end, __entry->r_len, | ||
1921 | __entry->last_start, __entry->last_len) | ||
1922 | ); | ||
1923 | |||
1924 | TRACE_EVENT(ocfs2_resmap_claimed_bits_end, | ||
1925 | TP_PROTO(unsigned int start, unsigned int end, unsigned int len, | ||
1926 | unsigned int last_start, unsigned int last_len), | ||
1927 | TP_ARGS(start, end, len, last_start, last_len), | ||
1928 | TP_STRUCT__entry( | ||
1929 | __field(unsigned int, start) | ||
1930 | __field(unsigned int, end) | ||
1931 | __field(unsigned int, len) | ||
1932 | __field(unsigned int, last_start) | ||
1933 | __field(unsigned int, last_len) | ||
1934 | ), | ||
1935 | TP_fast_assign( | ||
1936 | __entry->start = start; | ||
1937 | __entry->end = end; | ||
1938 | __entry->len = len; | ||
1939 | __entry->last_start = last_start; | ||
1940 | __entry->last_len = last_len; | ||
1941 | ), | ||
1942 | TP_printk("%u %u %u %u %u", __entry->start, __entry->end, | ||
1943 | __entry->len, __entry->last_start, __entry->last_len) | ||
1944 | ); | ||
1945 | |||
1946 | /* End of trace events for fs/ocfs2/reservations.c. */ | ||
1947 | |||
1948 | /* Trace events for fs/ocfs2/quota_local.c. */ | ||
1949 | |||
1950 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_recover_local_quota_file); | ||
1951 | |||
1952 | DEFINE_OCFS2_INT_EVENT(ocfs2_finish_quota_recovery); | ||
1953 | |||
1954 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(olq_set_dquot); | ||
1955 | |||
1956 | /* End of trace events for fs/ocfs2/quota_local.c. */ | ||
1957 | |||
1958 | /* Trace events for fs/ocfs2/quota_global.c. */ | ||
1959 | |||
1960 | DEFINE_OCFS2_ULL_EVENT(ocfs2_validate_quota_block); | ||
1961 | |||
1962 | TRACE_EVENT(ocfs2_sync_dquot, | ||
1963 | TP_PROTO(unsigned int dq_id, long long dqb_curspace, | ||
1964 | long long spacechange, long long curinodes, | ||
1965 | long long inodechange), | ||
1966 | TP_ARGS(dq_id, dqb_curspace, spacechange, curinodes, inodechange), | ||
1967 | TP_STRUCT__entry( | ||
1968 | __field(unsigned int, dq_id) | ||
1969 | __field(long long, dqb_curspace) | ||
1970 | __field(long long, spacechange) | ||
1971 | __field(long long, curinodes) | ||
1972 | __field(long long, inodechange) | ||
1973 | ), | ||
1974 | TP_fast_assign( | ||
1975 | __entry->dq_id = dq_id; | ||
1976 | __entry->dqb_curspace = dqb_curspace; | ||
1977 | __entry->spacechange = spacechange; | ||
1978 | __entry->curinodes = curinodes; | ||
1979 | __entry->inodechange = inodechange; | ||
1980 | ), | ||
1981 | TP_printk("%u %lld %lld %lld %lld", __entry->dq_id, | ||
1982 | __entry->dqb_curspace, __entry->spacechange, | ||
1983 | __entry->curinodes, __entry->inodechange) | ||
1984 | ); | ||
1985 | |||
1986 | TRACE_EVENT(ocfs2_sync_dquot_helper, | ||
1987 | TP_PROTO(unsigned int dq_id, unsigned int dq_type, unsigned long type, | ||
1988 | const char *s_id), | ||
1989 | TP_ARGS(dq_id, dq_type, type, s_id), | ||
1990 | |||
1991 | TP_STRUCT__entry( | ||
1992 | __field(unsigned int, dq_id) | ||
1993 | __field(unsigned int, dq_type) | ||
1994 | __field(unsigned long, type) | ||
1995 | __string(s_id, s_id) | ||
1996 | ), | ||
1997 | TP_fast_assign( | ||
1998 | __entry->dq_id = dq_id; | ||
1999 | __entry->dq_type = dq_type; | ||
2000 | __entry->type = type; | ||
2001 | __assign_str(s_id, s_id); | ||
2002 | ), | ||
2003 | TP_printk("%u %u %lu %s", __entry->dq_id, __entry->dq_type, | ||
2004 | __entry->type, __get_str(s_id)) | ||
2005 | ); | ||
2006 | |||
2007 | DEFINE_OCFS2_UINT_INT_EVENT(ocfs2_write_dquot); | ||
2008 | |||
2009 | DEFINE_OCFS2_UINT_INT_EVENT(ocfs2_release_dquot); | ||
2010 | |||
2011 | DEFINE_OCFS2_UINT_INT_EVENT(ocfs2_acquire_dquot); | ||
2012 | |||
2013 | DEFINE_OCFS2_UINT_INT_EVENT(ocfs2_mark_dquot_dirty); | ||
2014 | |||
2015 | /* End of trace events for fs/ocfs2/quota_global.c. */ | ||
2016 | |||
2017 | /* Trace events for fs/ocfs2/dir.c. */ | ||
2018 | DEFINE_OCFS2_INT_EVENT(ocfs2_search_dirblock); | ||
2019 | |||
2020 | DEFINE_OCFS2_ULL_EVENT(ocfs2_validate_dir_block); | ||
2021 | |||
2022 | DEFINE_OCFS2_POINTER_EVENT(ocfs2_find_entry_el); | ||
2023 | |||
2024 | TRACE_EVENT(ocfs2_dx_dir_search, | ||
2025 | TP_PROTO(unsigned long long ino, int namelen, const char *name, | ||
2026 | unsigned int major_hash, unsigned int minor_hash, | ||
2027 | unsigned long long blkno), | ||
2028 | TP_ARGS(ino, namelen, name, major_hash, minor_hash, blkno), | ||
2029 | TP_STRUCT__entry( | ||
2030 | __field(unsigned long long, ino) | ||
2031 | __field(int, namelen) | ||
2032 | __string(name, name) | ||
2033 | __field(unsigned int, major_hash) | ||
2034 | __field(unsigned int,minor_hash) | ||
2035 | __field(unsigned long long, blkno) | ||
2036 | ), | ||
2037 | TP_fast_assign( | ||
2038 | __entry->ino = ino; | ||
2039 | __entry->namelen = namelen; | ||
2040 | __assign_str(name, name); | ||
2041 | __entry->major_hash = major_hash; | ||
2042 | __entry->minor_hash = minor_hash; | ||
2043 | __entry->blkno = blkno; | ||
2044 | ), | ||
2045 | TP_printk("%llu %.*s %u %u %llu", __entry->ino, | ||
2046 | __entry->namelen, __get_str(name), | ||
2047 | __entry->major_hash, __entry->minor_hash, __entry->blkno) | ||
2048 | ); | ||
2049 | |||
2050 | DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_dx_dir_search_leaf_info); | ||
2051 | |||
2052 | DEFINE_OCFS2_ULL_INT_EVENT(ocfs2_delete_entry_dx); | ||
2053 | |||
2054 | DEFINE_OCFS2_ULL_EVENT(ocfs2_readdir); | ||
2055 | |||
2056 | TRACE_EVENT(ocfs2_find_files_on_disk, | ||
2057 | TP_PROTO(int namelen, const char *name, void *blkno, | ||
2058 | unsigned long long dir), | ||
2059 | TP_ARGS(namelen, name, blkno, dir), | ||
2060 | TP_STRUCT__entry( | ||
2061 | __field(int, namelen) | ||
2062 | __string(name, name) | ||
2063 | __field(void *, blkno) | ||
2064 | __field(unsigned long long, dir) | ||
2065 | ), | ||
2066 | TP_fast_assign( | ||
2067 | __entry->namelen = namelen; | ||
2068 | __assign_str(name, name); | ||
2069 | __entry->blkno = blkno; | ||
2070 | __entry->dir = dir; | ||
2071 | ), | ||
2072 | TP_printk("%.*s %p %llu", __entry->namelen, __get_str(name), | ||
2073 | __entry->blkno, __entry->dir) | ||
2074 | ); | ||
2075 | |||
2076 | TRACE_EVENT(ocfs2_check_dir_for_entry, | ||
2077 | TP_PROTO(unsigned long long dir, int namelen, const char *name), | ||
2078 | TP_ARGS(dir, namelen, name), | ||
2079 | TP_STRUCT__entry( | ||
2080 | __field(unsigned long long, dir) | ||
2081 | __field(int, namelen) | ||
2082 | __string(name, name) | ||
2083 | ), | ||
2084 | TP_fast_assign( | ||
2085 | __entry->dir = dir; | ||
2086 | __entry->namelen = namelen; | ||
2087 | __assign_str(name, name); | ||
2088 | ), | ||
2089 | TP_printk("%llu %.*s", __entry->dir, | ||
2090 | __entry->namelen, __get_str(name)) | ||
2091 | ); | ||
2092 | |||
2093 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_dx_dir_attach_index); | ||
2094 | |||
2095 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_dx_dir_format_cluster); | ||
2096 | |||
2097 | TRACE_EVENT(ocfs2_dx_dir_index_root_block, | ||
2098 | TP_PROTO(unsigned long long dir, | ||
2099 | unsigned int major_hash, unsigned int minor_hash, | ||
2100 | int namelen, const char *name, unsigned int num_used), | ||
2101 | TP_ARGS(dir, major_hash, minor_hash, namelen, name, num_used), | ||
2102 | TP_STRUCT__entry( | ||
2103 | __field(unsigned long long, dir) | ||
2104 | __field(unsigned int, major_hash) | ||
2105 | __field(unsigned int, minor_hash) | ||
2106 | __field(int, namelen) | ||
2107 | __string(name, name) | ||
2108 | __field(unsigned int, num_used) | ||
2109 | ), | ||
2110 | TP_fast_assign( | ||
2111 | __entry->dir = dir; | ||
2112 | __entry->major_hash = major_hash; | ||
2113 | __entry->minor_hash = minor_hash; | ||
2114 | __entry->namelen = namelen; | ||
2115 | __assign_str(name, name); | ||
2116 | __entry->num_used = num_used; | ||
2117 | ), | ||
2118 | TP_printk("%llu %x %x %.*s %u", __entry->dir, | ||
2119 | __entry->major_hash, __entry->minor_hash, | ||
2120 | __entry->namelen, __get_str(name), __entry->num_used) | ||
2121 | ); | ||
2122 | |||
2123 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_extend_dir); | ||
2124 | |||
2125 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_dx_dir_rebalance); | ||
2126 | |||
2127 | DEFINE_OCFS2_UINT_UINT_UINT_EVENT(ocfs2_dx_dir_rebalance_split); | ||
2128 | |||
2129 | DEFINE_OCFS2_ULL_INT_EVENT(ocfs2_prepare_dir_for_insert); | ||
2130 | |||
2131 | /* End of trace events for fs/ocfs2/dir.c. */ | ||
2132 | |||
2133 | /* Trace events for fs/ocfs2/namei.c. */ | ||
2134 | |||
2135 | DECLARE_EVENT_CLASS(ocfs2__dentry_ops, | ||
2136 | TP_PROTO(void *dir, void *dentry, int name_len, const char *name, | ||
2137 | unsigned long long dir_blkno, unsigned long long extra), | ||
2138 | TP_ARGS(dir, dentry, name_len, name, dir_blkno, extra), | ||
2139 | TP_STRUCT__entry( | ||
2140 | __field(void *, dir) | ||
2141 | __field(void *, dentry) | ||
2142 | __field(int, name_len) | ||
2143 | __string(name, name) | ||
2144 | __field(unsigned long long, dir_blkno) | ||
2145 | __field(unsigned long long, extra) | ||
2146 | ), | ||
2147 | TP_fast_assign( | ||
2148 | __entry->dir = dir; | ||
2149 | __entry->dentry = dentry; | ||
2150 | __entry->name_len = name_len; | ||
2151 | __assign_str(name, name); | ||
2152 | __entry->dir_blkno = dir_blkno; | ||
2153 | __entry->extra = extra; | ||
2154 | ), | ||
2155 | TP_printk("%p %p %.*s %llu %llu", __entry->dir, __entry->dentry, | ||
2156 | __entry->name_len, __get_str(name), | ||
2157 | __entry->dir_blkno, __entry->extra) | ||
2158 | ); | ||
2159 | |||
2160 | #define DEFINE_OCFS2_DENTRY_OPS(name) \ | ||
2161 | DEFINE_EVENT(ocfs2__dentry_ops, name, \ | ||
2162 | TP_PROTO(void *dir, void *dentry, int name_len, const char *name, \ | ||
2163 | unsigned long long dir_blkno, unsigned long long extra), \ | ||
2164 | TP_ARGS(dir, dentry, name_len, name, dir_blkno, extra)) | ||
2165 | |||
2166 | DEFINE_OCFS2_DENTRY_OPS(ocfs2_lookup); | ||
2167 | |||
2168 | DEFINE_OCFS2_DENTRY_OPS(ocfs2_mkdir); | ||
2169 | |||
2170 | DEFINE_OCFS2_DENTRY_OPS(ocfs2_create); | ||
2171 | |||
2172 | DEFINE_OCFS2_DENTRY_OPS(ocfs2_unlink); | ||
2173 | |||
2174 | DEFINE_OCFS2_DENTRY_OPS(ocfs2_symlink_create); | ||
2175 | |||
2176 | DEFINE_OCFS2_DENTRY_OPS(ocfs2_mv_orphaned_inode_to_new); | ||
2177 | |||
2178 | DEFINE_OCFS2_POINTER_EVENT(ocfs2_lookup_ret); | ||
2179 | |||
2180 | TRACE_EVENT(ocfs2_mknod, | ||
2181 | TP_PROTO(void *dir, void *dentry, int name_len, const char *name, | ||
2182 | unsigned long long dir_blkno, unsigned long dev, int mode), | ||
2183 | TP_ARGS(dir, dentry, name_len, name, dir_blkno, dev, mode), | ||
2184 | TP_STRUCT__entry( | ||
2185 | __field(void *, dir) | ||
2186 | __field(void *, dentry) | ||
2187 | __field(int, name_len) | ||
2188 | __string(name, name) | ||
2189 | __field(unsigned long long, dir_blkno) | ||
2190 | __field(unsigned long, dev) | ||
2191 | __field(int, mode) | ||
2192 | ), | ||
2193 | TP_fast_assign( | ||
2194 | __entry->dir = dir; | ||
2195 | __entry->dentry = dentry; | ||
2196 | __entry->name_len = name_len; | ||
2197 | __assign_str(name, name); | ||
2198 | __entry->dir_blkno = dir_blkno; | ||
2199 | __entry->dev = dev; | ||
2200 | __entry->mode = mode; | ||
2201 | ), | ||
2202 | TP_printk("%p %p %.*s %llu %lu %d", __entry->dir, __entry->dentry, | ||
2203 | __entry->name_len, __get_str(name), | ||
2204 | __entry->dir_blkno, __entry->dev, __entry->mode) | ||
2205 | ); | ||
2206 | |||
2207 | TRACE_EVENT(ocfs2_link, | ||
2208 | TP_PROTO(unsigned long long ino, int old_len, const char *old_name, | ||
2209 | int name_len, const char *name), | ||
2210 | TP_ARGS(ino, old_len, old_name, name_len, name), | ||
2211 | TP_STRUCT__entry( | ||
2212 | __field(unsigned long long, ino) | ||
2213 | __field(int, old_len) | ||
2214 | __string(old_name, old_name) | ||
2215 | __field(int, name_len) | ||
2216 | __string(name, name) | ||
2217 | ), | ||
2218 | TP_fast_assign( | ||
2219 | __entry->ino = ino; | ||
2220 | __entry->old_len = old_len; | ||
2221 | __assign_str(old_name, old_name); | ||
2222 | __entry->name_len = name_len; | ||
2223 | __assign_str(name, name); | ||
2224 | ), | ||
2225 | TP_printk("%llu %.*s %.*s", __entry->ino, | ||
2226 | __entry->old_len, __get_str(old_name), | ||
2227 | __entry->name_len, __get_str(name)) | ||
2228 | ); | ||
2229 | |||
2230 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_unlink_noent); | ||
2231 | |||
2232 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_double_lock); | ||
2233 | |||
2234 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_double_lock_end); | ||
2235 | |||
2236 | TRACE_EVENT(ocfs2_rename, | ||
2237 | TP_PROTO(void *old_dir, void *old_dentry, | ||
2238 | void *new_dir, void *new_dentry, | ||
2239 | int old_len, const char *old_name, | ||
2240 | int new_len, const char *new_name), | ||
2241 | TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, | ||
2242 | old_len, old_name, new_len, new_name), | ||
2243 | TP_STRUCT__entry( | ||
2244 | __field(void *, old_dir) | ||
2245 | __field(void *, old_dentry) | ||
2246 | __field(void *, new_dir) | ||
2247 | __field(void *, new_dentry) | ||
2248 | __field(int, old_len) | ||
2249 | __string(old_name, old_name) | ||
2250 | __field(int, new_len) | ||
2251 | __string(new_name, new_name) | ||
2252 | ), | ||
2253 | TP_fast_assign( | ||
2254 | __entry->old_dir = old_dir; | ||
2255 | __entry->old_dentry = old_dentry; | ||
2256 | __entry->new_dir = new_dir; | ||
2257 | __entry->new_dentry = new_dentry; | ||
2258 | __entry->old_len = old_len; | ||
2259 | __assign_str(old_name, old_name); | ||
2260 | __entry->new_len = new_len; | ||
2261 | __assign_str(new_name, new_name); | ||
2262 | ), | ||
2263 | TP_printk("%p %p %p %p %.*s %.*s", | ||
2264 | __entry->old_dir, __entry->old_dentry, | ||
2265 | __entry->new_dir, __entry->new_dentry, | ||
2266 | __entry->old_len, __get_str(old_name), | ||
2267 | __entry->new_len, __get_str(new_name)) | ||
2268 | ); | ||
2269 | |||
2270 | TRACE_EVENT(ocfs2_rename_target_exists, | ||
2271 | TP_PROTO(int new_len, const char *new_name), | ||
2272 | TP_ARGS(new_len, new_name), | ||
2273 | TP_STRUCT__entry( | ||
2274 | __field(int, new_len) | ||
2275 | __string(new_name, new_name) | ||
2276 | ), | ||
2277 | TP_fast_assign( | ||
2278 | __entry->new_len = new_len; | ||
2279 | __assign_str(new_name, new_name); | ||
2280 | ), | ||
2281 | TP_printk("%.*s", __entry->new_len, __get_str(new_name)) | ||
2282 | ); | ||
2283 | |||
2284 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_rename_disagree); | ||
2285 | |||
2286 | TRACE_EVENT(ocfs2_rename_over_existing, | ||
2287 | TP_PROTO(unsigned long long new_blkno, void *new_bh, | ||
2288 | unsigned long long newdi_blkno), | ||
2289 | TP_ARGS(new_blkno, new_bh, newdi_blkno), | ||
2290 | TP_STRUCT__entry( | ||
2291 | __field(unsigned long long, new_blkno) | ||
2292 | __field(void *, new_bh) | ||
2293 | __field(unsigned long long, newdi_blkno) | ||
2294 | ), | ||
2295 | TP_fast_assign( | ||
2296 | __entry->new_blkno = new_blkno; | ||
2297 | __entry->new_bh = new_bh; | ||
2298 | __entry->newdi_blkno = newdi_blkno; | ||
2299 | ), | ||
2300 | TP_printk("%llu %p %llu", __entry->new_blkno, __entry->new_bh, | ||
2301 | __entry->newdi_blkno) | ||
2302 | ); | ||
2303 | |||
2304 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_create_symlink_data); | ||
2305 | |||
2306 | TRACE_EVENT(ocfs2_symlink_begin, | ||
2307 | TP_PROTO(void *dir, void *dentry, const char *symname, | ||
2308 | int len, const char *name), | ||
2309 | TP_ARGS(dir, dentry, symname, len, name), | ||
2310 | TP_STRUCT__entry( | ||
2311 | __field(void *, dir) | ||
2312 | __field(void *, dentry) | ||
2313 | __field(const char *, symname) | ||
2314 | __field(int, len) | ||
2315 | __string(name, name) | ||
2316 | ), | ||
2317 | TP_fast_assign( | ||
2318 | __entry->dir = dir; | ||
2319 | __entry->dentry = dentry; | ||
2320 | __entry->symname = symname; | ||
2321 | __entry->len = len; | ||
2322 | __assign_str(name, name); | ||
2323 | ), | ||
2324 | TP_printk("%p %p %s %.*s", __entry->dir, __entry->dentry, | ||
2325 | __entry->symname, __entry->len, __get_str(name)) | ||
2326 | ); | ||
2327 | |||
2328 | TRACE_EVENT(ocfs2_blkno_stringify, | ||
2329 | TP_PROTO(unsigned long long blkno, const char *name, int namelen), | ||
2330 | TP_ARGS(blkno, name, namelen), | ||
2331 | TP_STRUCT__entry( | ||
2332 | __field(unsigned long long, blkno) | ||
2333 | __string(name, name) | ||
2334 | __field(int, namelen) | ||
2335 | ), | ||
2336 | TP_fast_assign( | ||
2337 | __entry->blkno = blkno; | ||
2338 | __assign_str(name, name); | ||
2339 | __entry->namelen = namelen; | ||
2340 | ), | ||
2341 | TP_printk("%llu %s %d", __entry->blkno, __get_str(name), | ||
2342 | __entry->namelen) | ||
2343 | ); | ||
2344 | |||
2345 | DEFINE_OCFS2_ULL_EVENT(ocfs2_orphan_add_begin); | ||
2346 | |||
2347 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_orphan_add_end); | ||
2348 | |||
2349 | TRACE_EVENT(ocfs2_orphan_del, | ||
2350 | TP_PROTO(unsigned long long dir, const char *name, int namelen), | ||
2351 | TP_ARGS(dir, name, namelen), | ||
2352 | TP_STRUCT__entry( | ||
2353 | __field(unsigned long long, dir) | ||
2354 | __string(name, name) | ||
2355 | __field(int, namelen) | ||
2356 | ), | ||
2357 | TP_fast_assign( | ||
2358 | __entry->dir = dir; | ||
2359 | __assign_str(name, name); | ||
2360 | __entry->namelen = namelen; | ||
2361 | ), | ||
2362 | TP_printk("%llu %s %d", __entry->dir, __get_str(name), | ||
2363 | __entry->namelen) | ||
2364 | ); | ||
2365 | |||
2366 | /* End of trace events for fs/ocfs2/namei.c. */ | ||
2367 | |||
2368 | /* Trace events for fs/ocfs2/dcache.c. */ | ||
2369 | |||
2370 | TRACE_EVENT(ocfs2_dentry_revalidate, | ||
2371 | TP_PROTO(void *dentry, int len, const char *name), | ||
2372 | TP_ARGS(dentry, len, name), | ||
2373 | TP_STRUCT__entry( | ||
2374 | __field(void *, dentry) | ||
2375 | __field(int, len) | ||
2376 | __string(name, name) | ||
2377 | ), | ||
2378 | TP_fast_assign( | ||
2379 | __entry->dentry = dentry; | ||
2380 | __entry->len = len; | ||
2381 | __assign_str(name, name); | ||
2382 | ), | ||
2383 | TP_printk("%p %.*s", __entry->dentry, __entry->len, __get_str(name)) | ||
2384 | ); | ||
2385 | |||
2386 | TRACE_EVENT(ocfs2_dentry_revalidate_negative, | ||
2387 | TP_PROTO(int len, const char *name, unsigned long pgen, | ||
2388 | unsigned long gen), | ||
2389 | TP_ARGS(len, name, pgen, gen), | ||
2390 | TP_STRUCT__entry( | ||
2391 | __field(int, len) | ||
2392 | __string(name, name) | ||
2393 | __field(unsigned long, pgen) | ||
2394 | __field(unsigned long, gen) | ||
2395 | ), | ||
2396 | TP_fast_assign( | ||
2397 | __entry->len = len; | ||
2398 | __assign_str(name, name); | ||
2399 | __entry->pgen = pgen; | ||
2400 | __entry->gen = gen; | ||
2401 | ), | ||
2402 | TP_printk("%.*s %lu %lu", __entry->len, __get_str(name), | ||
2403 | __entry->pgen, __entry->gen) | ||
2404 | ); | ||
2405 | |||
2406 | DEFINE_OCFS2_ULL_EVENT(ocfs2_dentry_revalidate_delete); | ||
2407 | |||
2408 | DEFINE_OCFS2_ULL_INT_EVENT(ocfs2_dentry_revalidate_orphaned); | ||
2409 | |||
2410 | DEFINE_OCFS2_ULL_EVENT(ocfs2_dentry_revalidate_nofsdata); | ||
2411 | |||
2412 | DEFINE_OCFS2_INT_EVENT(ocfs2_dentry_revalidate_ret); | ||
2413 | |||
2414 | TRACE_EVENT(ocfs2_find_local_alias, | ||
2415 | TP_PROTO(int len, const char *name), | ||
2416 | TP_ARGS(len, name), | ||
2417 | TP_STRUCT__entry( | ||
2418 | __field(int, len) | ||
2419 | __string(name, name) | ||
2420 | ), | ||
2421 | TP_fast_assign( | ||
2422 | __entry->len = len; | ||
2423 | __assign_str(name, name); | ||
2424 | ), | ||
2425 | TP_printk("%.*s", __entry->len, __get_str(name)) | ||
2426 | ); | ||
2427 | |||
2428 | TRACE_EVENT(ocfs2_dentry_attach_lock, | ||
2429 | TP_PROTO(int len, const char *name, | ||
2430 | unsigned long long parent, void *fsdata), | ||
2431 | TP_ARGS(len, name, parent, fsdata), | ||
2432 | TP_STRUCT__entry( | ||
2433 | __field(int, len) | ||
2434 | __string(name, name) | ||
2435 | __field(unsigned long long, parent) | ||
2436 | __field(void *, fsdata) | ||
2437 | ), | ||
2438 | TP_fast_assign( | ||
2439 | __entry->len = len; | ||
2440 | __assign_str(name, name); | ||
2441 | __entry->parent = parent; | ||
2442 | __entry->fsdata = fsdata; | ||
2443 | ), | ||
2444 | TP_printk("%.*s %llu %p", __entry->len, __get_str(name), | ||
2445 | __entry->parent, __entry->fsdata) | ||
2446 | ); | ||
2447 | |||
2448 | TRACE_EVENT(ocfs2_dentry_attach_lock_found, | ||
2449 | TP_PROTO(const char *name, unsigned long long parent, | ||
2450 | unsigned long long ino), | ||
2451 | TP_ARGS(name, parent, ino), | ||
2452 | TP_STRUCT__entry( | ||
2453 | __string(name, name) | ||
2454 | __field(unsigned long long, parent) | ||
2455 | __field(unsigned long long, ino) | ||
2456 | ), | ||
2457 | TP_fast_assign( | ||
2458 | __assign_str(name, name); | ||
2459 | __entry->parent = parent; | ||
2460 | __entry->ino = ino; | ||
2461 | ), | ||
2462 | TP_printk("%s %llu %llu", __get_str(name), __entry->parent, __entry->ino) | ||
2463 | ); | ||
2464 | /* End of trace events for fs/ocfs2/dcache.c. */ | ||
2465 | |||
2466 | /* Trace events for fs/ocfs2/export.c. */ | ||
2467 | |||
2468 | TRACE_EVENT(ocfs2_get_dentry_begin, | ||
2469 | TP_PROTO(void *sb, void *handle, unsigned long long blkno), | ||
2470 | TP_ARGS(sb, handle, blkno), | ||
2471 | TP_STRUCT__entry( | ||
2472 | __field(void *, sb) | ||
2473 | __field(void *, handle) | ||
2474 | __field(unsigned long long, blkno) | ||
2475 | ), | ||
2476 | TP_fast_assign( | ||
2477 | __entry->sb = sb; | ||
2478 | __entry->handle = handle; | ||
2479 | __entry->blkno = blkno; | ||
2480 | ), | ||
2481 | TP_printk("%p %p %llu", __entry->sb, __entry->handle, __entry->blkno) | ||
2482 | ); | ||
2483 | |||
2484 | DEFINE_OCFS2_INT_INT_EVENT(ocfs2_get_dentry_test_bit); | ||
2485 | |||
2486 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_get_dentry_stale); | ||
2487 | |||
2488 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_get_dentry_generation); | ||
2489 | |||
2490 | DEFINE_OCFS2_POINTER_EVENT(ocfs2_get_dentry_end); | ||
2491 | |||
2492 | TRACE_EVENT(ocfs2_get_parent, | ||
2493 | TP_PROTO(void *child, int len, const char *name, | ||
2494 | unsigned long long ino), | ||
2495 | TP_ARGS(child, len, name, ino), | ||
2496 | TP_STRUCT__entry( | ||
2497 | __field(void *, child) | ||
2498 | __field(int, len) | ||
2499 | __string(name, name) | ||
2500 | __field(unsigned long long, ino) | ||
2501 | ), | ||
2502 | TP_fast_assign( | ||
2503 | __entry->child = child; | ||
2504 | __entry->len = len; | ||
2505 | __assign_str(name, name); | ||
2506 | __entry->ino = ino; | ||
2507 | ), | ||
2508 | TP_printk("%p %.*s %llu", __entry->child, __entry->len, | ||
2509 | __get_str(name), __entry->ino) | ||
2510 | ); | ||
2511 | |||
2512 | DEFINE_OCFS2_POINTER_EVENT(ocfs2_get_parent_end); | ||
2513 | |||
2514 | TRACE_EVENT(ocfs2_encode_fh_begin, | ||
2515 | TP_PROTO(void *dentry, int name_len, const char *name, | ||
2516 | void *fh, int len, int connectable), | ||
2517 | TP_ARGS(dentry, name_len, name, fh, len, connectable), | ||
2518 | TP_STRUCT__entry( | ||
2519 | __field(void *, dentry) | ||
2520 | __field(int, name_len) | ||
2521 | __string(name, name) | ||
2522 | __field(void *, fh) | ||
2523 | __field(int, len) | ||
2524 | __field(int, connectable) | ||
2525 | ), | ||
2526 | TP_fast_assign( | ||
2527 | __entry->dentry = dentry; | ||
2528 | __entry->name_len = name_len; | ||
2529 | __assign_str(name, name); | ||
2530 | __entry->fh = fh; | ||
2531 | __entry->len = len; | ||
2532 | __entry->connectable = connectable; | ||
2533 | ), | ||
2534 | TP_printk("%p %.*s %p %d %d", __entry->dentry, __entry->name_len, | ||
2535 | __get_str(name), __entry->fh, __entry->len, | ||
2536 | __entry->connectable) | ||
2537 | ); | ||
2538 | |||
2539 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_encode_fh_self); | ||
2540 | |||
2541 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_encode_fh_parent); | ||
2542 | |||
2543 | DEFINE_OCFS2_INT_EVENT(ocfs2_encode_fh_type); | ||
2544 | |||
2545 | /* End of trace events for fs/ocfs2/export.c. */ | ||
2546 | |||
2547 | /* Trace events for fs/ocfs2/journal.c. */ | ||
2548 | |||
2549 | DEFINE_OCFS2_UINT_EVENT(ocfs2_commit_cache_begin); | ||
2550 | |||
2551 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_commit_cache_end); | ||
2552 | |||
2553 | DEFINE_OCFS2_INT_INT_EVENT(ocfs2_extend_trans); | ||
2554 | |||
2555 | DEFINE_OCFS2_INT_EVENT(ocfs2_extend_trans_restart); | ||
2556 | |||
2557 | DEFINE_OCFS2_ULL_ULL_UINT_UINT_EVENT(ocfs2_journal_access); | ||
2558 | |||
2559 | DEFINE_OCFS2_ULL_EVENT(ocfs2_journal_dirty); | ||
2560 | |||
2561 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_journal_init); | ||
2562 | |||
2563 | DEFINE_OCFS2_UINT_EVENT(ocfs2_journal_init_maxlen); | ||
2564 | |||
2565 | DEFINE_OCFS2_INT_EVENT(ocfs2_journal_shutdown); | ||
2566 | |||
2567 | DEFINE_OCFS2_POINTER_EVENT(ocfs2_journal_shutdown_wait); | ||
2568 | |||
2569 | DEFINE_OCFS2_ULL_EVENT(ocfs2_complete_recovery); | ||
2570 | |||
2571 | DEFINE_OCFS2_INT_EVENT(ocfs2_complete_recovery_end); | ||
2572 | |||
2573 | TRACE_EVENT(ocfs2_complete_recovery_slot, | ||
2574 | TP_PROTO(int slot, unsigned long long la_ino, | ||
2575 | unsigned long long tl_ino, void *qrec), | ||
2576 | TP_ARGS(slot, la_ino, tl_ino, qrec), | ||
2577 | TP_STRUCT__entry( | ||
2578 | __field(int, slot) | ||
2579 | __field(unsigned long long, la_ino) | ||
2580 | __field(unsigned long long, tl_ino) | ||
2581 | __field(void *, qrec) | ||
2582 | ), | ||
2583 | TP_fast_assign( | ||
2584 | __entry->slot = slot; | ||
2585 | __entry->la_ino = la_ino; | ||
2586 | __entry->tl_ino = tl_ino; | ||
2587 | __entry->qrec = qrec; | ||
2588 | ), | ||
2589 | TP_printk("%d %llu %llu %p", __entry->slot, __entry->la_ino, | ||
2590 | __entry->tl_ino, __entry->qrec) | ||
2591 | ); | ||
2592 | |||
2593 | DEFINE_OCFS2_INT_INT_EVENT(ocfs2_recovery_thread_node); | ||
2594 | |||
2595 | DEFINE_OCFS2_INT_EVENT(ocfs2_recovery_thread_end); | ||
2596 | |||
2597 | TRACE_EVENT(ocfs2_recovery_thread, | ||
2598 | TP_PROTO(int node_num, int osb_node_num, int disable, | ||
2599 | void *recovery_thread, int map_set), | ||
2600 | TP_ARGS(node_num, osb_node_num, disable, recovery_thread, map_set), | ||
2601 | TP_STRUCT__entry( | ||
2602 | __field(int, node_num) | ||
2603 | __field(int, osb_node_num) | ||
2604 | __field(int,disable) | ||
2605 | __field(void *, recovery_thread) | ||
2606 | __field(int,map_set) | ||
2607 | ), | ||
2608 | TP_fast_assign( | ||
2609 | __entry->node_num = node_num; | ||
2610 | __entry->osb_node_num = osb_node_num; | ||
2611 | __entry->disable = disable; | ||
2612 | __entry->recovery_thread = recovery_thread; | ||
2613 | __entry->map_set = map_set; | ||
2614 | ), | ||
2615 | TP_printk("%d %d %d %p %d", __entry->node_num, | ||
2616 | __entry->osb_node_num, __entry->disable, | ||
2617 | __entry->recovery_thread, __entry->map_set) | ||
2618 | ); | ||
2619 | |||
2620 | DEFINE_OCFS2_UINT_UINT_UINT_EVENT(ocfs2_replay_journal_recovered); | ||
2621 | |||
2622 | DEFINE_OCFS2_INT_EVENT(ocfs2_replay_journal_lock_err); | ||
2623 | |||
2624 | DEFINE_OCFS2_INT_EVENT(ocfs2_replay_journal_skip); | ||
2625 | |||
2626 | DEFINE_OCFS2_UINT_UINT_UINT_EVENT(ocfs2_recover_node); | ||
2627 | |||
2628 | DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_recover_node_skip); | ||
2629 | |||
2630 | DEFINE_OCFS2_UINT_UINT_EVENT(ocfs2_mark_dead_nodes); | ||
2631 | |||
2632 | DEFINE_OCFS2_UINT_UINT_UINT_EVENT(ocfs2_queue_orphan_scan_begin); | ||
2633 | |||
2634 | DEFINE_OCFS2_UINT_UINT_UINT_EVENT(ocfs2_queue_orphan_scan_end); | ||
2635 | |||
2636 | DEFINE_OCFS2_ULL_EVENT(ocfs2_orphan_filldir); | ||
2637 | |||
2638 | DEFINE_OCFS2_INT_EVENT(ocfs2_recover_orphans); | ||
2639 | |||
2640 | DEFINE_OCFS2_ULL_EVENT(ocfs2_recover_orphans_iput); | ||
2641 | |||
2642 | DEFINE_OCFS2_INT_EVENT(ocfs2_wait_on_mount); | ||
2643 | |||
2644 | /* End of trace events for fs/ocfs2/journal.c. */ | ||
2645 | |||
2646 | /* Trace events for fs/ocfs2/buffer_head_io.c. */ | ||
2647 | |||
2648 | DEFINE_OCFS2_ULL_UINT_EVENT(ocfs2_read_blocks_sync); | ||
2649 | |||
2650 | DEFINE_OCFS2_ULL_EVENT(ocfs2_read_blocks_sync_jbd); | ||
2651 | |||
2652 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_read_blocks_from_disk); | ||
2653 | |||
2654 | DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_read_blocks_bh); | ||
2655 | |||
2656 | DEFINE_OCFS2_ULL_INT_INT_INT_EVENT(ocfs2_read_blocks_end); | ||
2657 | |||
2658 | TRACE_EVENT(ocfs2_write_block, | ||
2659 | TP_PROTO(unsigned long long block, void *ci), | ||
2660 | TP_ARGS(block, ci), | ||
2661 | TP_STRUCT__entry( | ||
2662 | __field(unsigned long long, block) | ||
2663 | __field(void *, ci) | ||
2664 | ), | ||
2665 | TP_fast_assign( | ||
2666 | __entry->block = block; | ||
2667 | __entry->ci = ci; | ||
2668 | ), | ||
2669 | TP_printk("%llu %p", __entry->block, __entry->ci) | ||
2670 | ); | ||
2671 | |||
2672 | TRACE_EVENT(ocfs2_read_blocks_begin, | ||
2673 | TP_PROTO(void *ci, unsigned long long block, | ||
2674 | unsigned int nr, int flags), | ||
2675 | TP_ARGS(ci, block, nr, flags), | ||
2676 | TP_STRUCT__entry( | ||
2677 | __field(void *, ci) | ||
2678 | __field(unsigned long long, block) | ||
2679 | __field(unsigned int, nr) | ||
2680 | __field(int, flags) | ||
2681 | ), | ||
2682 | TP_fast_assign( | ||
2683 | __entry->ci = ci; | ||
2684 | __entry->block = block; | ||
2685 | __entry->nr = nr; | ||
2686 | __entry->flags = flags; | ||
2687 | ), | ||
2688 | TP_printk("%p %llu %u %d", __entry->ci, __entry->block, | ||
2689 | __entry->nr, __entry->flags) | ||
2690 | ); | ||
2691 | |||
2692 | /* End of trace events for fs/ocfs2/buffer_head_io.c. */ | ||
2693 | |||
2694 | /* Trace events for fs/ocfs2/uptodate.c. */ | ||
2695 | |||
2696 | DEFINE_OCFS2_ULL_EVENT(ocfs2_purge_copied_metadata_tree); | ||
2697 | |||
2698 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_metadata_cache_purge); | ||
2699 | |||
2700 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_buffer_cached_begin); | ||
2701 | |||
2702 | TRACE_EVENT(ocfs2_buffer_cached_end, | ||
2703 | TP_PROTO(int index, void *item), | ||
2704 | TP_ARGS(index, item), | ||
2705 | TP_STRUCT__entry( | ||
2706 | __field(int, index) | ||
2707 | __field(void *, item) | ||
2708 | ), | ||
2709 | TP_fast_assign( | ||
2710 | __entry->index = index; | ||
2711 | __entry->item = item; | ||
2712 | ), | ||
2713 | TP_printk("%d %p", __entry->index, __entry->item) | ||
2714 | ); | ||
2715 | |||
2716 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_append_cache_array); | ||
2717 | |||
2718 | DEFINE_OCFS2_ULL_ULL_UINT_EVENT(ocfs2_insert_cache_tree); | ||
2719 | |||
2720 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_expand_cache); | ||
2721 | |||
2722 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_set_buffer_uptodate); | ||
2723 | |||
2724 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_set_buffer_uptodate_begin); | ||
2725 | |||
2726 | DEFINE_OCFS2_ULL_UINT_UINT_EVENT(ocfs2_remove_metadata_array); | ||
2727 | |||
2728 | DEFINE_OCFS2_ULL_ULL_EVENT(ocfs2_remove_metadata_tree); | ||
2729 | |||
2730 | DEFINE_OCFS2_ULL_ULL_UINT_UINT_EVENT(ocfs2_remove_block_from_cache); | ||
2731 | |||
2732 | /* End of trace events for fs/ocfs2/uptodate.c. */ | ||
2733 | #endif /* _TRACE_OCFS2_H */ | ||
2734 | |||
2735 | /* This part must be outside protection */ | ||
2736 | #undef TRACE_INCLUDE_PATH | ||
2737 | #define TRACE_INCLUDE_PATH . | ||
2738 | #define TRACE_INCLUDE_FILE ocfs2_trace | ||
2739 | #include <trace/define_trace.h> | ||
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index 4607923eb24c..64346f836c09 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/writeback.h> | 11 | #include <linux/writeback.h> |
12 | #include <linux/workqueue.h> | 12 | #include <linux/workqueue.h> |
13 | 13 | ||
14 | #define MLOG_MASK_PREFIX ML_QUOTA | ||
15 | #include <cluster/masklog.h> | 14 | #include <cluster/masklog.h> |
16 | 15 | ||
17 | #include "ocfs2_fs.h" | 16 | #include "ocfs2_fs.h" |
@@ -27,6 +26,7 @@ | |||
27 | #include "super.h" | 26 | #include "super.h" |
28 | #include "buffer_head_io.h" | 27 | #include "buffer_head_io.h" |
29 | #include "quota.h" | 28 | #include "quota.h" |
29 | #include "ocfs2_trace.h" | ||
30 | 30 | ||
31 | /* | 31 | /* |
32 | * Locking of quotas with OCFS2 is rather complex. Here are rules that | 32 | * Locking of quotas with OCFS2 is rather complex. Here are rules that |
@@ -132,8 +132,7 @@ int ocfs2_validate_quota_block(struct super_block *sb, struct buffer_head *bh) | |||
132 | struct ocfs2_disk_dqtrailer *dqt = | 132 | struct ocfs2_disk_dqtrailer *dqt = |
133 | ocfs2_block_dqtrailer(sb->s_blocksize, bh->b_data); | 133 | ocfs2_block_dqtrailer(sb->s_blocksize, bh->b_data); |
134 | 134 | ||
135 | mlog(0, "Validating quota block %llu\n", | 135 | trace_ocfs2_validate_quota_block((unsigned long long)bh->b_blocknr); |
136 | (unsigned long long)bh->b_blocknr); | ||
137 | 136 | ||
138 | BUG_ON(!buffer_uptodate(bh)); | 137 | BUG_ON(!buffer_uptodate(bh)); |
139 | 138 | ||
@@ -343,8 +342,6 @@ int ocfs2_global_read_info(struct super_block *sb, int type) | |||
343 | u64 pcount; | 342 | u64 pcount; |
344 | int status; | 343 | int status; |
345 | 344 | ||
346 | mlog_entry_void(); | ||
347 | |||
348 | /* Read global header */ | 345 | /* Read global header */ |
349 | gqinode = ocfs2_get_system_file_inode(OCFS2_SB(sb), ino[type], | 346 | gqinode = ocfs2_get_system_file_inode(OCFS2_SB(sb), ino[type], |
350 | OCFS2_INVALID_SLOT); | 347 | OCFS2_INVALID_SLOT); |
@@ -404,7 +401,8 @@ int ocfs2_global_read_info(struct super_block *sb, int type) | |||
404 | msecs_to_jiffies(oinfo->dqi_syncms)); | 401 | msecs_to_jiffies(oinfo->dqi_syncms)); |
405 | 402 | ||
406 | out_err: | 403 | out_err: |
407 | mlog_exit(status); | 404 | if (status) |
405 | mlog_errno(status); | ||
408 | return status; | 406 | return status; |
409 | out_unlock: | 407 | out_unlock: |
410 | ocfs2_unlock_global_qf(oinfo, 0); | 408 | ocfs2_unlock_global_qf(oinfo, 0); |
@@ -510,9 +508,10 @@ int __ocfs2_sync_dquot(struct dquot *dquot, int freeing) | |||
510 | olditime = dquot->dq_dqb.dqb_itime; | 508 | olditime = dquot->dq_dqb.dqb_itime; |
511 | oldbtime = dquot->dq_dqb.dqb_btime; | 509 | oldbtime = dquot->dq_dqb.dqb_btime; |
512 | ocfs2_global_disk2memdqb(dquot, &dqblk); | 510 | ocfs2_global_disk2memdqb(dquot, &dqblk); |
513 | mlog(0, "Syncing global dquot %u space %lld+%lld, inodes %lld+%lld\n", | 511 | trace_ocfs2_sync_dquot(dquot->dq_id, dquot->dq_dqb.dqb_curspace, |
514 | dquot->dq_id, dquot->dq_dqb.dqb_curspace, (long long)spacechange, | 512 | (long long)spacechange, |
515 | dquot->dq_dqb.dqb_curinodes, (long long)inodechange); | 513 | dquot->dq_dqb.dqb_curinodes, |
514 | (long long)inodechange); | ||
516 | if (!test_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags)) | 515 | if (!test_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags)) |
517 | dquot->dq_dqb.dqb_curspace += spacechange; | 516 | dquot->dq_dqb.dqb_curspace += spacechange; |
518 | if (!test_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags)) | 517 | if (!test_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags)) |
@@ -596,8 +595,8 @@ static int ocfs2_sync_dquot_helper(struct dquot *dquot, unsigned long type) | |||
596 | struct ocfs2_super *osb = OCFS2_SB(sb); | 595 | struct ocfs2_super *osb = OCFS2_SB(sb); |
597 | int status = 0; | 596 | int status = 0; |
598 | 597 | ||
599 | mlog_entry("id=%u qtype=%u type=%lu device=%s\n", dquot->dq_id, | 598 | trace_ocfs2_sync_dquot_helper(dquot->dq_id, dquot->dq_type, |
600 | dquot->dq_type, type, sb->s_id); | 599 | type, sb->s_id); |
601 | if (type != dquot->dq_type) | 600 | if (type != dquot->dq_type) |
602 | goto out; | 601 | goto out; |
603 | status = ocfs2_lock_global_qf(oinfo, 1); | 602 | status = ocfs2_lock_global_qf(oinfo, 1); |
@@ -623,7 +622,6 @@ static int ocfs2_sync_dquot_helper(struct dquot *dquot, unsigned long type) | |||
623 | out_ilock: | 622 | out_ilock: |
624 | ocfs2_unlock_global_qf(oinfo, 1); | 623 | ocfs2_unlock_global_qf(oinfo, 1); |
625 | out: | 624 | out: |
626 | mlog_exit(status); | ||
627 | return status; | 625 | return status; |
628 | } | 626 | } |
629 | 627 | ||
@@ -649,7 +647,7 @@ static int ocfs2_write_dquot(struct dquot *dquot) | |||
649 | struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb); | 647 | struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb); |
650 | int status = 0; | 648 | int status = 0; |
651 | 649 | ||
652 | mlog_entry("id=%u, type=%d", dquot->dq_id, dquot->dq_type); | 650 | trace_ocfs2_write_dquot(dquot->dq_id, dquot->dq_type); |
653 | 651 | ||
654 | handle = ocfs2_start_trans(osb, OCFS2_QWRITE_CREDITS); | 652 | handle = ocfs2_start_trans(osb, OCFS2_QWRITE_CREDITS); |
655 | if (IS_ERR(handle)) { | 653 | if (IS_ERR(handle)) { |
@@ -662,7 +660,6 @@ static int ocfs2_write_dquot(struct dquot *dquot) | |||
662 | mutex_unlock(&sb_dqopt(dquot->dq_sb)->dqio_mutex); | 660 | mutex_unlock(&sb_dqopt(dquot->dq_sb)->dqio_mutex); |
663 | ocfs2_commit_trans(osb, handle); | 661 | ocfs2_commit_trans(osb, handle); |
664 | out: | 662 | out: |
665 | mlog_exit(status); | ||
666 | return status; | 663 | return status; |
667 | } | 664 | } |
668 | 665 | ||
@@ -688,7 +685,7 @@ static int ocfs2_release_dquot(struct dquot *dquot) | |||
688 | struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb); | 685 | struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb); |
689 | int status = 0; | 686 | int status = 0; |
690 | 687 | ||
691 | mlog_entry("id=%u, type=%d", dquot->dq_id, dquot->dq_type); | 688 | trace_ocfs2_release_dquot(dquot->dq_id, dquot->dq_type); |
692 | 689 | ||
693 | mutex_lock(&dquot->dq_lock); | 690 | mutex_lock(&dquot->dq_lock); |
694 | /* Check whether we are not racing with some other dqget() */ | 691 | /* Check whether we are not racing with some other dqget() */ |
@@ -724,7 +721,8 @@ out_ilock: | |||
724 | ocfs2_unlock_global_qf(oinfo, 1); | 721 | ocfs2_unlock_global_qf(oinfo, 1); |
725 | out: | 722 | out: |
726 | mutex_unlock(&dquot->dq_lock); | 723 | mutex_unlock(&dquot->dq_lock); |
727 | mlog_exit(status); | 724 | if (status) |
725 | mlog_errno(status); | ||
728 | return status; | 726 | return status; |
729 | } | 727 | } |
730 | 728 | ||
@@ -745,7 +743,7 @@ static int ocfs2_acquire_dquot(struct dquot *dquot) | |||
745 | int need_alloc = ocfs2_global_qinit_alloc(sb, type); | 743 | int need_alloc = ocfs2_global_qinit_alloc(sb, type); |
746 | handle_t *handle; | 744 | handle_t *handle; |
747 | 745 | ||
748 | mlog_entry("id=%u, type=%d", dquot->dq_id, type); | 746 | trace_ocfs2_acquire_dquot(dquot->dq_id, type); |
749 | mutex_lock(&dquot->dq_lock); | 747 | mutex_lock(&dquot->dq_lock); |
750 | /* | 748 | /* |
751 | * We need an exclusive lock, because we're going to update use count | 749 | * We need an exclusive lock, because we're going to update use count |
@@ -811,7 +809,8 @@ out_dq: | |||
811 | set_bit(DQ_ACTIVE_B, &dquot->dq_flags); | 809 | set_bit(DQ_ACTIVE_B, &dquot->dq_flags); |
812 | out: | 810 | out: |
813 | mutex_unlock(&dquot->dq_lock); | 811 | mutex_unlock(&dquot->dq_lock); |
814 | mlog_exit(status); | 812 | if (status) |
813 | mlog_errno(status); | ||
815 | return status; | 814 | return status; |
816 | } | 815 | } |
817 | 816 | ||
@@ -831,7 +830,7 @@ static int ocfs2_mark_dquot_dirty(struct dquot *dquot) | |||
831 | handle_t *handle; | 830 | handle_t *handle; |
832 | struct ocfs2_super *osb = OCFS2_SB(sb); | 831 | struct ocfs2_super *osb = OCFS2_SB(sb); |
833 | 832 | ||
834 | mlog_entry("id=%u, type=%d", dquot->dq_id, type); | 833 | trace_ocfs2_mark_dquot_dirty(dquot->dq_id, type); |
835 | 834 | ||
836 | /* In case user set some limits, sync dquot immediately to global | 835 | /* In case user set some limits, sync dquot immediately to global |
837 | * quota file so that information propagates quicker */ | 836 | * quota file so that information propagates quicker */ |
@@ -868,7 +867,8 @@ out_dlock: | |||
868 | out_ilock: | 867 | out_ilock: |
869 | ocfs2_unlock_global_qf(oinfo, 1); | 868 | ocfs2_unlock_global_qf(oinfo, 1); |
870 | out: | 869 | out: |
871 | mlog_exit(status); | 870 | if (status) |
871 | mlog_errno(status); | ||
872 | return status; | 872 | return status; |
873 | } | 873 | } |
874 | 874 | ||
@@ -879,8 +879,6 @@ static int ocfs2_write_info(struct super_block *sb, int type) | |||
879 | int status = 0; | 879 | int status = 0; |
880 | struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; | 880 | struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv; |
881 | 881 | ||
882 | mlog_entry_void(); | ||
883 | |||
884 | status = ocfs2_lock_global_qf(oinfo, 1); | 882 | status = ocfs2_lock_global_qf(oinfo, 1); |
885 | if (status < 0) | 883 | if (status < 0) |
886 | goto out; | 884 | goto out; |
@@ -895,7 +893,8 @@ static int ocfs2_write_info(struct super_block *sb, int type) | |||
895 | out_ilock: | 893 | out_ilock: |
896 | ocfs2_unlock_global_qf(oinfo, 1); | 894 | ocfs2_unlock_global_qf(oinfo, 1); |
897 | out: | 895 | out: |
898 | mlog_exit(status); | 896 | if (status) |
897 | mlog_errno(status); | ||
899 | return status; | 898 | return status; |
900 | } | 899 | } |
901 | 900 | ||
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c index dc78764ccc4c..dc8007fc9247 100644 --- a/fs/ocfs2/quota_local.c +++ b/fs/ocfs2/quota_local.c | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <linux/quotaops.h> | 8 | #include <linux/quotaops.h> |
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | 10 | ||
11 | #define MLOG_MASK_PREFIX ML_QUOTA | ||
12 | #include <cluster/masklog.h> | 11 | #include <cluster/masklog.h> |
13 | 12 | ||
14 | #include "ocfs2_fs.h" | 13 | #include "ocfs2_fs.h" |
@@ -23,6 +22,7 @@ | |||
23 | #include "quota.h" | 22 | #include "quota.h" |
24 | #include "uptodate.h" | 23 | #include "uptodate.h" |
25 | #include "super.h" | 24 | #include "super.h" |
25 | #include "ocfs2_trace.h" | ||
26 | 26 | ||
27 | /* Number of local quota structures per block */ | 27 | /* Number of local quota structures per block */ |
28 | static inline unsigned int ol_quota_entries_per_block(struct super_block *sb) | 28 | static inline unsigned int ol_quota_entries_per_block(struct super_block *sb) |
@@ -475,7 +475,7 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode, | |||
475 | struct ocfs2_recovery_chunk *rchunk, *next; | 475 | struct ocfs2_recovery_chunk *rchunk, *next; |
476 | qsize_t spacechange, inodechange; | 476 | qsize_t spacechange, inodechange; |
477 | 477 | ||
478 | mlog_entry("ino=%lu type=%u", (unsigned long)lqinode->i_ino, type); | 478 | trace_ocfs2_recover_local_quota_file((unsigned long)lqinode->i_ino, type); |
479 | 479 | ||
480 | list_for_each_entry_safe(rchunk, next, &(rec->r_list[type]), rc_list) { | 480 | list_for_each_entry_safe(rchunk, next, &(rec->r_list[type]), rc_list) { |
481 | chunk = rchunk->rc_chunk; | 481 | chunk = rchunk->rc_chunk; |
@@ -575,7 +575,8 @@ out_put_bh: | |||
575 | } | 575 | } |
576 | if (status < 0) | 576 | if (status < 0) |
577 | free_recovery_list(&(rec->r_list[type])); | 577 | free_recovery_list(&(rec->r_list[type])); |
578 | mlog_exit(status); | 578 | if (status) |
579 | mlog_errno(status); | ||
579 | return status; | 580 | return status; |
580 | } | 581 | } |
581 | 582 | ||
@@ -600,7 +601,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb, | |||
600 | for (type = 0; type < MAXQUOTAS; type++) { | 601 | for (type = 0; type < MAXQUOTAS; type++) { |
601 | if (list_empty(&(rec->r_list[type]))) | 602 | if (list_empty(&(rec->r_list[type]))) |
602 | continue; | 603 | continue; |
603 | mlog(0, "Recovering quota in slot %d\n", slot_num); | 604 | trace_ocfs2_finish_quota_recovery(slot_num); |
604 | lqinode = ocfs2_get_system_file_inode(osb, ino[type], slot_num); | 605 | lqinode = ocfs2_get_system_file_inode(osb, ino[type], slot_num); |
605 | if (!lqinode) { | 606 | if (!lqinode) { |
606 | status = -ENOENT; | 607 | status = -ENOENT; |
@@ -882,9 +883,10 @@ static void olq_set_dquot(struct buffer_head *bh, void *private) | |||
882 | dqblk->dqb_inodemod = cpu_to_le64(od->dq_dquot.dq_dqb.dqb_curinodes - | 883 | dqblk->dqb_inodemod = cpu_to_le64(od->dq_dquot.dq_dqb.dqb_curinodes - |
883 | od->dq_originodes); | 884 | od->dq_originodes); |
884 | spin_unlock(&dq_data_lock); | 885 | spin_unlock(&dq_data_lock); |
885 | mlog(0, "Writing local dquot %u space %lld inodes %lld\n", | 886 | trace_olq_set_dquot( |
886 | od->dq_dquot.dq_id, (long long)le64_to_cpu(dqblk->dqb_spacemod), | 887 | (unsigned long long)le64_to_cpu(dqblk->dqb_spacemod), |
887 | (long long)le64_to_cpu(dqblk->dqb_inodemod)); | 888 | (unsigned long long)le64_to_cpu(dqblk->dqb_inodemod), |
889 | od->dq_dquot.dq_id); | ||
888 | } | 890 | } |
889 | 891 | ||
890 | /* Write dquot to local quota file */ | 892 | /* Write dquot to local quota file */ |
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index b5f9160e93e9..93a81f853e66 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -16,7 +16,6 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/sort.h> | 18 | #include <linux/sort.h> |
19 | #define MLOG_MASK_PREFIX ML_REFCOUNT | ||
20 | #include <cluster/masklog.h> | 19 | #include <cluster/masklog.h> |
21 | #include "ocfs2.h" | 20 | #include "ocfs2.h" |
22 | #include "inode.h" | 21 | #include "inode.h" |
@@ -34,6 +33,7 @@ | |||
34 | #include "aops.h" | 33 | #include "aops.h" |
35 | #include "xattr.h" | 34 | #include "xattr.h" |
36 | #include "namei.h" | 35 | #include "namei.h" |
36 | #include "ocfs2_trace.h" | ||
37 | 37 | ||
38 | #include <linux/bio.h> | 38 | #include <linux/bio.h> |
39 | #include <linux/blkdev.h> | 39 | #include <linux/blkdev.h> |
@@ -84,8 +84,7 @@ static int ocfs2_validate_refcount_block(struct super_block *sb, | |||
84 | struct ocfs2_refcount_block *rb = | 84 | struct ocfs2_refcount_block *rb = |
85 | (struct ocfs2_refcount_block *)bh->b_data; | 85 | (struct ocfs2_refcount_block *)bh->b_data; |
86 | 86 | ||
87 | mlog(0, "Validating refcount block %llu\n", | 87 | trace_ocfs2_validate_refcount_block((unsigned long long)bh->b_blocknr); |
88 | (unsigned long long)bh->b_blocknr); | ||
89 | 88 | ||
90 | BUG_ON(!buffer_uptodate(bh)); | 89 | BUG_ON(!buffer_uptodate(bh)); |
91 | 90 | ||
@@ -545,8 +544,8 @@ void ocfs2_purge_refcount_trees(struct ocfs2_super *osb) | |||
545 | while ((node = rb_last(root)) != NULL) { | 544 | while ((node = rb_last(root)) != NULL) { |
546 | tree = rb_entry(node, struct ocfs2_refcount_tree, rf_node); | 545 | tree = rb_entry(node, struct ocfs2_refcount_tree, rf_node); |
547 | 546 | ||
548 | mlog(0, "Purge tree %llu\n", | 547 | trace_ocfs2_purge_refcount_trees( |
549 | (unsigned long long) tree->rf_blkno); | 548 | (unsigned long long) tree->rf_blkno); |
550 | 549 | ||
551 | rb_erase(&tree->rf_node, root); | 550 | rb_erase(&tree->rf_node, root); |
552 | ocfs2_free_refcount_tree(tree); | 551 | ocfs2_free_refcount_tree(tree); |
@@ -575,7 +574,8 @@ static int ocfs2_create_refcount_tree(struct inode *inode, | |||
575 | 574 | ||
576 | BUG_ON(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL); | 575 | BUG_ON(oi->ip_dyn_features & OCFS2_HAS_REFCOUNT_FL); |
577 | 576 | ||
578 | mlog(0, "create tree for inode %lu\n", inode->i_ino); | 577 | trace_ocfs2_create_refcount_tree( |
578 | (unsigned long long)OCFS2_I(inode)->ip_blkno); | ||
579 | 579 | ||
580 | ret = ocfs2_reserve_new_metadata_blocks(osb, 1, &meta_ac); | 580 | ret = ocfs2_reserve_new_metadata_blocks(osb, 1, &meta_ac); |
581 | if (ret) { | 581 | if (ret) { |
@@ -646,8 +646,7 @@ static int ocfs2_create_refcount_tree(struct inode *inode, | |||
646 | di->i_refcount_loc = cpu_to_le64(first_blkno); | 646 | di->i_refcount_loc = cpu_to_le64(first_blkno); |
647 | spin_unlock(&oi->ip_lock); | 647 | spin_unlock(&oi->ip_lock); |
648 | 648 | ||
649 | mlog(0, "created tree for inode %lu, refblock %llu\n", | 649 | trace_ocfs2_create_refcount_tree_blkno((unsigned long long)first_blkno); |
650 | inode->i_ino, (unsigned long long)first_blkno); | ||
651 | 650 | ||
652 | ocfs2_journal_dirty(handle, di_bh); | 651 | ocfs2_journal_dirty(handle, di_bh); |
653 | 652 | ||
@@ -1256,8 +1255,9 @@ static int ocfs2_change_refcount_rec(handle_t *handle, | |||
1256 | goto out; | 1255 | goto out; |
1257 | } | 1256 | } |
1258 | 1257 | ||
1259 | mlog(0, "change index %d, old count %u, change %d\n", index, | 1258 | trace_ocfs2_change_refcount_rec( |
1260 | le32_to_cpu(rec->r_refcount), change); | 1259 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
1260 | index, le32_to_cpu(rec->r_refcount), change); | ||
1261 | le32_add_cpu(&rec->r_refcount, change); | 1261 | le32_add_cpu(&rec->r_refcount, change); |
1262 | 1262 | ||
1263 | if (!rec->r_refcount) { | 1263 | if (!rec->r_refcount) { |
@@ -1353,8 +1353,8 @@ static int ocfs2_expand_inline_ref_root(handle_t *handle, | |||
1353 | 1353 | ||
1354 | ocfs2_journal_dirty(handle, ref_root_bh); | 1354 | ocfs2_journal_dirty(handle, ref_root_bh); |
1355 | 1355 | ||
1356 | mlog(0, "new leaf block %llu, used %u\n", (unsigned long long)blkno, | 1356 | trace_ocfs2_expand_inline_ref_root((unsigned long long)blkno, |
1357 | le16_to_cpu(new_rb->rf_records.rl_used)); | 1357 | le16_to_cpu(new_rb->rf_records.rl_used)); |
1358 | 1358 | ||
1359 | *ref_leaf_bh = new_bh; | 1359 | *ref_leaf_bh = new_bh; |
1360 | new_bh = NULL; | 1360 | new_bh = NULL; |
@@ -1466,9 +1466,9 @@ static int ocfs2_divide_leaf_refcount_block(struct buffer_head *ref_leaf_bh, | |||
1466 | (struct ocfs2_refcount_block *)new_bh->b_data; | 1466 | (struct ocfs2_refcount_block *)new_bh->b_data; |
1467 | struct ocfs2_refcount_list *new_rl = &new_rb->rf_records; | 1467 | struct ocfs2_refcount_list *new_rl = &new_rb->rf_records; |
1468 | 1468 | ||
1469 | mlog(0, "split old leaf refcount block %llu, count = %u, used = %u\n", | 1469 | trace_ocfs2_divide_leaf_refcount_block( |
1470 | (unsigned long long)ref_leaf_bh->b_blocknr, | 1470 | (unsigned long long)ref_leaf_bh->b_blocknr, |
1471 | le32_to_cpu(rl->rl_count), le32_to_cpu(rl->rl_used)); | 1471 | le32_to_cpu(rl->rl_count), le32_to_cpu(rl->rl_used)); |
1472 | 1472 | ||
1473 | /* | 1473 | /* |
1474 | * XXX: Improvement later. | 1474 | * XXX: Improvement later. |
@@ -1601,8 +1601,8 @@ static int ocfs2_new_leaf_refcount_block(handle_t *handle, | |||
1601 | 1601 | ||
1602 | ocfs2_init_refcount_extent_tree(&ref_et, ci, ref_root_bh); | 1602 | ocfs2_init_refcount_extent_tree(&ref_et, ci, ref_root_bh); |
1603 | 1603 | ||
1604 | mlog(0, "insert new leaf block %llu at %u\n", | 1604 | trace_ocfs2_new_leaf_refcount_block( |
1605 | (unsigned long long)new_bh->b_blocknr, new_cpos); | 1605 | (unsigned long long)new_bh->b_blocknr, new_cpos); |
1606 | 1606 | ||
1607 | /* Insert the new leaf block with the specific offset cpos. */ | 1607 | /* Insert the new leaf block with the specific offset cpos. */ |
1608 | ret = ocfs2_insert_extent(handle, &ref_et, new_cpos, new_bh->b_blocknr, | 1608 | ret = ocfs2_insert_extent(handle, &ref_et, new_cpos, new_bh->b_blocknr, |
@@ -1794,11 +1794,10 @@ static int ocfs2_insert_refcount_rec(handle_t *handle, | |||
1794 | (le16_to_cpu(rf_list->rl_used) - index) * | 1794 | (le16_to_cpu(rf_list->rl_used) - index) * |
1795 | sizeof(struct ocfs2_refcount_rec)); | 1795 | sizeof(struct ocfs2_refcount_rec)); |
1796 | 1796 | ||
1797 | mlog(0, "insert refcount record start %llu, len %u, count %u " | 1797 | trace_ocfs2_insert_refcount_rec( |
1798 | "to leaf block %llu at index %d\n", | 1798 | (unsigned long long)ref_leaf_bh->b_blocknr, index, |
1799 | (unsigned long long)le64_to_cpu(rec->r_cpos), | 1799 | (unsigned long long)le64_to_cpu(rec->r_cpos), |
1800 | le32_to_cpu(rec->r_clusters), le32_to_cpu(rec->r_refcount), | 1800 | le32_to_cpu(rec->r_clusters), le32_to_cpu(rec->r_refcount)); |
1801 | (unsigned long long)ref_leaf_bh->b_blocknr, index); | ||
1802 | 1801 | ||
1803 | rf_list->rl_recs[index] = *rec; | 1802 | rf_list->rl_recs[index] = *rec; |
1804 | 1803 | ||
@@ -1850,10 +1849,12 @@ static int ocfs2_split_refcount_rec(handle_t *handle, | |||
1850 | 1849 | ||
1851 | BUG_ON(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL); | 1850 | BUG_ON(le32_to_cpu(rb->rf_flags) & OCFS2_REFCOUNT_TREE_FL); |
1852 | 1851 | ||
1853 | mlog(0, "original r_pos %llu, cluster %u, split %llu, cluster %u\n", | 1852 | trace_ocfs2_split_refcount_rec(le64_to_cpu(orig_rec->r_cpos), |
1854 | le64_to_cpu(orig_rec->r_cpos), le32_to_cpu(orig_rec->r_clusters), | 1853 | le32_to_cpu(orig_rec->r_clusters), |
1855 | le64_to_cpu(split_rec->r_cpos), | 1854 | le32_to_cpu(orig_rec->r_refcount), |
1856 | le32_to_cpu(split_rec->r_clusters)); | 1855 | le64_to_cpu(split_rec->r_cpos), |
1856 | le32_to_cpu(split_rec->r_clusters), | ||
1857 | le32_to_cpu(split_rec->r_refcount)); | ||
1857 | 1858 | ||
1858 | /* | 1859 | /* |
1859 | * If we just need to split the header or tail clusters, | 1860 | * If we just need to split the header or tail clusters, |
@@ -1967,12 +1968,11 @@ static int ocfs2_split_refcount_rec(handle_t *handle, | |||
1967 | 1968 | ||
1968 | if (split_rec->r_refcount) { | 1969 | if (split_rec->r_refcount) { |
1969 | rf_list->rl_recs[index] = *split_rec; | 1970 | rf_list->rl_recs[index] = *split_rec; |
1970 | mlog(0, "insert refcount record start %llu, len %u, count %u " | 1971 | trace_ocfs2_split_refcount_rec_insert( |
1971 | "to leaf block %llu at index %d\n", | 1972 | (unsigned long long)ref_leaf_bh->b_blocknr, index, |
1972 | (unsigned long long)le64_to_cpu(split_rec->r_cpos), | 1973 | (unsigned long long)le64_to_cpu(split_rec->r_cpos), |
1973 | le32_to_cpu(split_rec->r_clusters), | 1974 | le32_to_cpu(split_rec->r_clusters), |
1974 | le32_to_cpu(split_rec->r_refcount), | 1975 | le32_to_cpu(split_rec->r_refcount)); |
1975 | (unsigned long long)ref_leaf_bh->b_blocknr, index); | ||
1976 | 1976 | ||
1977 | if (merge) | 1977 | if (merge) |
1978 | ocfs2_refcount_rec_merge(rb, index); | 1978 | ocfs2_refcount_rec_merge(rb, index); |
@@ -1997,7 +1997,7 @@ static int __ocfs2_increase_refcount(handle_t *handle, | |||
1997 | struct ocfs2_refcount_rec rec; | 1997 | struct ocfs2_refcount_rec rec; |
1998 | unsigned int set_len = 0; | 1998 | unsigned int set_len = 0; |
1999 | 1999 | ||
2000 | mlog(0, "Tree owner %llu, add refcount start %llu, len %u\n", | 2000 | trace_ocfs2_increase_refcount_begin( |
2001 | (unsigned long long)ocfs2_metadata_cache_owner(ci), | 2001 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
2002 | (unsigned long long)cpos, len); | 2002 | (unsigned long long)cpos, len); |
2003 | 2003 | ||
@@ -2024,9 +2024,9 @@ static int __ocfs2_increase_refcount(handle_t *handle, | |||
2024 | */ | 2024 | */ |
2025 | if (rec.r_refcount && le64_to_cpu(rec.r_cpos) == cpos && | 2025 | if (rec.r_refcount && le64_to_cpu(rec.r_cpos) == cpos && |
2026 | set_len <= len) { | 2026 | set_len <= len) { |
2027 | mlog(0, "increase refcount rec, start %llu, len %u, " | 2027 | trace_ocfs2_increase_refcount_change( |
2028 | "count %u\n", (unsigned long long)cpos, set_len, | 2028 | (unsigned long long)cpos, set_len, |
2029 | le32_to_cpu(rec.r_refcount)); | 2029 | le32_to_cpu(rec.r_refcount)); |
2030 | ret = ocfs2_change_refcount_rec(handle, ci, | 2030 | ret = ocfs2_change_refcount_rec(handle, ci, |
2031 | ref_leaf_bh, index, | 2031 | ref_leaf_bh, index, |
2032 | merge, 1); | 2032 | merge, 1); |
@@ -2037,7 +2037,7 @@ static int __ocfs2_increase_refcount(handle_t *handle, | |||
2037 | } else if (!rec.r_refcount) { | 2037 | } else if (!rec.r_refcount) { |
2038 | rec.r_refcount = cpu_to_le32(1); | 2038 | rec.r_refcount = cpu_to_le32(1); |
2039 | 2039 | ||
2040 | mlog(0, "insert refcount rec, start %llu, len %u\n", | 2040 | trace_ocfs2_increase_refcount_insert( |
2041 | (unsigned long long)le64_to_cpu(rec.r_cpos), | 2041 | (unsigned long long)le64_to_cpu(rec.r_cpos), |
2042 | set_len); | 2042 | set_len); |
2043 | ret = ocfs2_insert_refcount_rec(handle, ci, ref_root_bh, | 2043 | ret = ocfs2_insert_refcount_rec(handle, ci, ref_root_bh, |
@@ -2055,8 +2055,7 @@ static int __ocfs2_increase_refcount(handle_t *handle, | |||
2055 | rec.r_clusters = cpu_to_le32(set_len); | 2055 | rec.r_clusters = cpu_to_le32(set_len); |
2056 | le32_add_cpu(&rec.r_refcount, 1); | 2056 | le32_add_cpu(&rec.r_refcount, 1); |
2057 | 2057 | ||
2058 | mlog(0, "split refcount rec, start %llu, " | 2058 | trace_ocfs2_increase_refcount_split( |
2059 | "len %u, count %u\n", | ||
2060 | (unsigned long long)le64_to_cpu(rec.r_cpos), | 2059 | (unsigned long long)le64_to_cpu(rec.r_cpos), |
2061 | set_len, le32_to_cpu(rec.r_refcount)); | 2060 | set_len, le32_to_cpu(rec.r_refcount)); |
2062 | ret = ocfs2_split_refcount_rec(handle, ci, | 2061 | ret = ocfs2_split_refcount_rec(handle, ci, |
@@ -2095,6 +2094,11 @@ static int ocfs2_remove_refcount_extent(handle_t *handle, | |||
2095 | 2094 | ||
2096 | BUG_ON(rb->rf_records.rl_used); | 2095 | BUG_ON(rb->rf_records.rl_used); |
2097 | 2096 | ||
2097 | trace_ocfs2_remove_refcount_extent( | ||
2098 | (unsigned long long)ocfs2_metadata_cache_owner(ci), | ||
2099 | (unsigned long long)ref_leaf_bh->b_blocknr, | ||
2100 | le32_to_cpu(rb->rf_cpos)); | ||
2101 | |||
2098 | ocfs2_init_refcount_extent_tree(&et, ci, ref_root_bh); | 2102 | ocfs2_init_refcount_extent_tree(&et, ci, ref_root_bh); |
2099 | ret = ocfs2_remove_extent(handle, &et, le32_to_cpu(rb->rf_cpos), | 2103 | ret = ocfs2_remove_extent(handle, &et, le32_to_cpu(rb->rf_cpos), |
2100 | 1, meta_ac, dealloc); | 2104 | 1, meta_ac, dealloc); |
@@ -2137,7 +2141,7 @@ static int ocfs2_remove_refcount_extent(handle_t *handle, | |||
2137 | if (!rb->rf_list.l_next_free_rec) { | 2141 | if (!rb->rf_list.l_next_free_rec) { |
2138 | BUG_ON(rb->rf_clusters); | 2142 | BUG_ON(rb->rf_clusters); |
2139 | 2143 | ||
2140 | mlog(0, "reset refcount tree root %llu to be a record block.\n", | 2144 | trace_ocfs2_restore_refcount_block( |
2141 | (unsigned long long)ref_root_bh->b_blocknr); | 2145 | (unsigned long long)ref_root_bh->b_blocknr); |
2142 | 2146 | ||
2143 | rb->rf_flags = 0; | 2147 | rb->rf_flags = 0; |
@@ -2184,6 +2188,10 @@ static int ocfs2_decrease_refcount_rec(handle_t *handle, | |||
2184 | BUG_ON(cpos + len > | 2188 | BUG_ON(cpos + len > |
2185 | le64_to_cpu(rec->r_cpos) + le32_to_cpu(rec->r_clusters)); | 2189 | le64_to_cpu(rec->r_cpos) + le32_to_cpu(rec->r_clusters)); |
2186 | 2190 | ||
2191 | trace_ocfs2_decrease_refcount_rec( | ||
2192 | (unsigned long long)ocfs2_metadata_cache_owner(ci), | ||
2193 | (unsigned long long)cpos, len); | ||
2194 | |||
2187 | if (cpos == le64_to_cpu(rec->r_cpos) && | 2195 | if (cpos == le64_to_cpu(rec->r_cpos) && |
2188 | len == le32_to_cpu(rec->r_clusters)) | 2196 | len == le32_to_cpu(rec->r_clusters)) |
2189 | ret = ocfs2_change_refcount_rec(handle, ci, | 2197 | ret = ocfs2_change_refcount_rec(handle, ci, |
@@ -2195,12 +2203,6 @@ static int ocfs2_decrease_refcount_rec(handle_t *handle, | |||
2195 | 2203 | ||
2196 | le32_add_cpu(&split.r_refcount, -1); | 2204 | le32_add_cpu(&split.r_refcount, -1); |
2197 | 2205 | ||
2198 | mlog(0, "split refcount rec, start %llu, " | ||
2199 | "len %u, count %u, original start %llu, len %u\n", | ||
2200 | (unsigned long long)le64_to_cpu(split.r_cpos), | ||
2201 | len, le32_to_cpu(split.r_refcount), | ||
2202 | (unsigned long long)le64_to_cpu(rec->r_cpos), | ||
2203 | le32_to_cpu(rec->r_clusters)); | ||
2204 | ret = ocfs2_split_refcount_rec(handle, ci, | 2206 | ret = ocfs2_split_refcount_rec(handle, ci, |
2205 | ref_root_bh, ref_leaf_bh, | 2207 | ref_root_bh, ref_leaf_bh, |
2206 | &split, index, 1, | 2208 | &split, index, 1, |
@@ -2239,10 +2241,9 @@ static int __ocfs2_decrease_refcount(handle_t *handle, | |||
2239 | struct super_block *sb = ocfs2_metadata_cache_get_super(ci); | 2241 | struct super_block *sb = ocfs2_metadata_cache_get_super(ci); |
2240 | struct buffer_head *ref_leaf_bh = NULL; | 2242 | struct buffer_head *ref_leaf_bh = NULL; |
2241 | 2243 | ||
2242 | mlog(0, "Tree owner %llu, decrease refcount start %llu, " | 2244 | trace_ocfs2_decrease_refcount( |
2243 | "len %u, delete %u\n", | 2245 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
2244 | (unsigned long long)ocfs2_metadata_cache_owner(ci), | 2246 | (unsigned long long)cpos, len, delete); |
2245 | (unsigned long long)cpos, len, delete); | ||
2246 | 2247 | ||
2247 | while (len) { | 2248 | while (len) { |
2248 | ret = ocfs2_get_refcount_rec(ci, ref_root_bh, | 2249 | ret = ocfs2_get_refcount_rec(ci, ref_root_bh, |
@@ -2352,8 +2353,8 @@ static int ocfs2_mark_extent_refcounted(struct inode *inode, | |||
2352 | { | 2353 | { |
2353 | int ret; | 2354 | int ret; |
2354 | 2355 | ||
2355 | mlog(0, "Inode %lu refcount tree cpos %u, len %u, phys cluster %u\n", | 2356 | trace_ocfs2_mark_extent_refcounted(OCFS2_I(inode)->ip_blkno, |
2356 | inode->i_ino, cpos, len, phys); | 2357 | cpos, len, phys); |
2357 | 2358 | ||
2358 | if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) { | 2359 | if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) { |
2359 | ocfs2_error(inode->i_sb, "Inode %lu want to use refcount " | 2360 | ocfs2_error(inode->i_sb, "Inode %lu want to use refcount " |
@@ -2392,8 +2393,6 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb, | |||
2392 | struct buffer_head *ref_leaf_bh = NULL, *prev_bh = NULL; | 2393 | struct buffer_head *ref_leaf_bh = NULL, *prev_bh = NULL; |
2393 | u32 len; | 2394 | u32 len; |
2394 | 2395 | ||
2395 | mlog(0, "start_cpos %llu, clusters %u\n", | ||
2396 | (unsigned long long)start_cpos, clusters); | ||
2397 | while (clusters) { | 2396 | while (clusters) { |
2398 | ret = ocfs2_get_refcount_rec(ci, ref_root_bh, | 2397 | ret = ocfs2_get_refcount_rec(ci, ref_root_bh, |
2399 | cpos, clusters, &rec, | 2398 | cpos, clusters, &rec, |
@@ -2427,12 +2426,11 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb, | |||
2427 | 2426 | ||
2428 | rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data; | 2427 | rb = (struct ocfs2_refcount_block *)ref_leaf_bh->b_data; |
2429 | 2428 | ||
2430 | mlog(0, "recs_add %d,cpos %llu, clusters %u, rec->r_cpos %llu," | 2429 | trace_ocfs2_calc_refcount_meta_credits_iterate( |
2431 | "rec->r_clusters %u, rec->r_refcount %u, index %d\n", | 2430 | recs_add, (unsigned long long)cpos, clusters, |
2432 | recs_add, (unsigned long long)cpos, clusters, | 2431 | (unsigned long long)le64_to_cpu(rec.r_cpos), |
2433 | (unsigned long long)le64_to_cpu(rec.r_cpos), | 2432 | le32_to_cpu(rec.r_clusters), |
2434 | le32_to_cpu(rec.r_clusters), | 2433 | le32_to_cpu(rec.r_refcount), index); |
2435 | le32_to_cpu(rec.r_refcount), index); | ||
2436 | 2434 | ||
2437 | len = min((u64)cpos + clusters, le64_to_cpu(rec.r_cpos) + | 2435 | len = min((u64)cpos + clusters, le64_to_cpu(rec.r_cpos) + |
2438 | le32_to_cpu(rec.r_clusters)) - cpos; | 2436 | le32_to_cpu(rec.r_clusters)) - cpos; |
@@ -2488,7 +2486,6 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb, | |||
2488 | if (!ref_blocks) | 2486 | if (!ref_blocks) |
2489 | goto out; | 2487 | goto out; |
2490 | 2488 | ||
2491 | mlog(0, "we need ref_blocks %d\n", ref_blocks); | ||
2492 | *meta_add += ref_blocks; | 2489 | *meta_add += ref_blocks; |
2493 | *credits += ref_blocks; | 2490 | *credits += ref_blocks; |
2494 | 2491 | ||
@@ -2514,6 +2511,10 @@ static int ocfs2_calc_refcount_meta_credits(struct super_block *sb, | |||
2514 | } | 2511 | } |
2515 | 2512 | ||
2516 | out: | 2513 | out: |
2514 | |||
2515 | trace_ocfs2_calc_refcount_meta_credits( | ||
2516 | (unsigned long long)start_cpos, clusters, | ||
2517 | *meta_add, *credits); | ||
2517 | brelse(ref_leaf_bh); | 2518 | brelse(ref_leaf_bh); |
2518 | brelse(prev_bh); | 2519 | brelse(prev_bh); |
2519 | return ret; | 2520 | return ret; |
@@ -2578,8 +2579,7 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode, | |||
2578 | goto out; | 2579 | goto out; |
2579 | } | 2580 | } |
2580 | 2581 | ||
2581 | mlog(0, "reserve new metadata %d blocks, credits = %d\n", | 2582 | trace_ocfs2_prepare_refcount_change_for_del(*ref_blocks, *credits); |
2582 | *ref_blocks, *credits); | ||
2583 | 2583 | ||
2584 | out: | 2584 | out: |
2585 | brelse(ref_root_bh); | 2585 | brelse(ref_root_bh); |
@@ -2886,8 +2886,7 @@ static int ocfs2_lock_refcount_allocators(struct super_block *sb, | |||
2886 | goto out; | 2886 | goto out; |
2887 | } | 2887 | } |
2888 | 2888 | ||
2889 | mlog(0, "reserve new metadata %d, clusters %u, credits = %d\n", | 2889 | trace_ocfs2_lock_refcount_allocators(meta_add, *credits); |
2890 | meta_add, num_clusters, *credits); | ||
2891 | ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(sb), meta_add, | 2890 | ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(sb), meta_add, |
2892 | meta_ac); | 2891 | meta_ac); |
2893 | if (ret) { | 2892 | if (ret) { |
@@ -2937,8 +2936,8 @@ static int ocfs2_duplicate_clusters_by_page(handle_t *handle, | |||
2937 | loff_t offset, end, map_end; | 2936 | loff_t offset, end, map_end; |
2938 | struct address_space *mapping = context->inode->i_mapping; | 2937 | struct address_space *mapping = context->inode->i_mapping; |
2939 | 2938 | ||
2940 | mlog(0, "old_cluster %u, new %u, len %u at offset %u\n", old_cluster, | 2939 | trace_ocfs2_duplicate_clusters_by_page(cpos, old_cluster, |
2941 | new_cluster, new_len, cpos); | 2940 | new_cluster, new_len); |
2942 | 2941 | ||
2943 | readahead_pages = | 2942 | readahead_pages = |
2944 | (ocfs2_cow_contig_clusters(sb) << | 2943 | (ocfs2_cow_contig_clusters(sb) << |
@@ -3031,8 +3030,8 @@ static int ocfs2_duplicate_clusters_by_jbd(handle_t *handle, | |||
3031 | struct buffer_head *old_bh = NULL; | 3030 | struct buffer_head *old_bh = NULL; |
3032 | struct buffer_head *new_bh = NULL; | 3031 | struct buffer_head *new_bh = NULL; |
3033 | 3032 | ||
3034 | mlog(0, "old_cluster %u, new %u, len %u\n", old_cluster, | 3033 | trace_ocfs2_duplicate_clusters_by_page(cpos, old_cluster, |
3035 | new_cluster, new_len); | 3034 | new_cluster, new_len); |
3036 | 3035 | ||
3037 | for (i = 0; i < blocks; i++, old_block++, new_block++) { | 3036 | for (i = 0; i < blocks; i++, old_block++, new_block++) { |
3038 | new_bh = sb_getblk(osb->sb, new_block); | 3037 | new_bh = sb_getblk(osb->sb, new_block); |
@@ -3085,8 +3084,8 @@ static int ocfs2_clear_ext_refcount(handle_t *handle, | |||
3085 | struct super_block *sb = ocfs2_metadata_cache_get_super(et->et_ci); | 3084 | struct super_block *sb = ocfs2_metadata_cache_get_super(et->et_ci); |
3086 | u64 ino = ocfs2_metadata_cache_owner(et->et_ci); | 3085 | u64 ino = ocfs2_metadata_cache_owner(et->et_ci); |
3087 | 3086 | ||
3088 | mlog(0, "inode %llu cpos %u, len %u, p_cluster %u, ext_flags %u\n", | 3087 | trace_ocfs2_clear_ext_refcount((unsigned long long)ino, |
3089 | (unsigned long long)ino, cpos, len, p_cluster, ext_flags); | 3088 | cpos, len, p_cluster, ext_flags); |
3090 | 3089 | ||
3091 | memset(&replace_rec, 0, sizeof(replace_rec)); | 3090 | memset(&replace_rec, 0, sizeof(replace_rec)); |
3092 | replace_rec.e_cpos = cpu_to_le32(cpos); | 3091 | replace_rec.e_cpos = cpu_to_le32(cpos); |
@@ -3141,8 +3140,8 @@ static int ocfs2_replace_clusters(handle_t *handle, | |||
3141 | struct ocfs2_caching_info *ci = context->data_et.et_ci; | 3140 | struct ocfs2_caching_info *ci = context->data_et.et_ci; |
3142 | u64 ino = ocfs2_metadata_cache_owner(ci); | 3141 | u64 ino = ocfs2_metadata_cache_owner(ci); |
3143 | 3142 | ||
3144 | mlog(0, "inode %llu, cpos %u, old %u, new %u, len %u, ext_flags %u\n", | 3143 | trace_ocfs2_replace_clusters((unsigned long long)ino, |
3145 | (unsigned long long)ino, cpos, old, new, len, ext_flags); | 3144 | cpos, old, new, len, ext_flags); |
3146 | 3145 | ||
3147 | /*If the old clusters is unwritten, no need to duplicate. */ | 3146 | /*If the old clusters is unwritten, no need to duplicate. */ |
3148 | if (!(ext_flags & OCFS2_EXT_UNWRITTEN)) { | 3147 | if (!(ext_flags & OCFS2_EXT_UNWRITTEN)) { |
@@ -3228,7 +3227,7 @@ static int ocfs2_make_clusters_writable(struct super_block *sb, | |||
3228 | u32 num_clusters, unsigned int e_flags) | 3227 | u32 num_clusters, unsigned int e_flags) |
3229 | { | 3228 | { |
3230 | int ret, delete, index, credits = 0; | 3229 | int ret, delete, index, credits = 0; |
3231 | u32 new_bit, new_len; | 3230 | u32 new_bit, new_len, orig_num_clusters; |
3232 | unsigned int set_len; | 3231 | unsigned int set_len; |
3233 | struct ocfs2_super *osb = OCFS2_SB(sb); | 3232 | struct ocfs2_super *osb = OCFS2_SB(sb); |
3234 | handle_t *handle; | 3233 | handle_t *handle; |
@@ -3236,8 +3235,8 @@ static int ocfs2_make_clusters_writable(struct super_block *sb, | |||
3236 | struct ocfs2_caching_info *ref_ci = &context->ref_tree->rf_ci; | 3235 | struct ocfs2_caching_info *ref_ci = &context->ref_tree->rf_ci; |
3237 | struct ocfs2_refcount_rec rec; | 3236 | struct ocfs2_refcount_rec rec; |
3238 | 3237 | ||
3239 | mlog(0, "cpos %u, p_cluster %u, num_clusters %u, e_flags %u\n", | 3238 | trace_ocfs2_make_clusters_writable(cpos, p_cluster, |
3240 | cpos, p_cluster, num_clusters, e_flags); | 3239 | num_clusters, e_flags); |
3241 | 3240 | ||
3242 | ret = ocfs2_lock_refcount_allocators(sb, p_cluster, num_clusters, | 3241 | ret = ocfs2_lock_refcount_allocators(sb, p_cluster, num_clusters, |
3243 | &context->data_et, | 3242 | &context->data_et, |
@@ -3261,6 +3260,8 @@ static int ocfs2_make_clusters_writable(struct super_block *sb, | |||
3261 | goto out; | 3260 | goto out; |
3262 | } | 3261 | } |
3263 | 3262 | ||
3263 | orig_num_clusters = num_clusters; | ||
3264 | |||
3264 | while (num_clusters) { | 3265 | while (num_clusters) { |
3265 | ret = ocfs2_get_refcount_rec(ref_ci, context->ref_root_bh, | 3266 | ret = ocfs2_get_refcount_rec(ref_ci, context->ref_root_bh, |
3266 | p_cluster, num_clusters, | 3267 | p_cluster, num_clusters, |
@@ -3348,7 +3349,8 @@ static int ocfs2_make_clusters_writable(struct super_block *sb, | |||
3348 | * in write-back mode. | 3349 | * in write-back mode. |
3349 | */ | 3350 | */ |
3350 | if (context->get_clusters == ocfs2_di_get_clusters) { | 3351 | if (context->get_clusters == ocfs2_di_get_clusters) { |
3351 | ret = ocfs2_cow_sync_writeback(sb, context, cpos, num_clusters); | 3352 | ret = ocfs2_cow_sync_writeback(sb, context, cpos, |
3353 | orig_num_clusters); | ||
3352 | if (ret) | 3354 | if (ret) |
3353 | mlog_errno(ret); | 3355 | mlog_errno(ret); |
3354 | } | 3356 | } |
@@ -3472,9 +3474,9 @@ static int ocfs2_refcount_cow_hunk(struct inode *inode, | |||
3472 | goto out; | 3474 | goto out; |
3473 | } | 3475 | } |
3474 | 3476 | ||
3475 | mlog(0, "CoW inode %lu, cpos %u, write_len %u, cow_start %u, " | 3477 | trace_ocfs2_refcount_cow_hunk(OCFS2_I(inode)->ip_blkno, |
3476 | "cow_len %u\n", inode->i_ino, | 3478 | cpos, write_len, max_cpos, |
3477 | cpos, write_len, cow_start, cow_len); | 3479 | cow_start, cow_len); |
3478 | 3480 | ||
3479 | BUG_ON(cow_len == 0); | 3481 | BUG_ON(cow_len == 0); |
3480 | 3482 | ||
@@ -3753,8 +3755,7 @@ int ocfs2_add_refcount_flag(struct inode *inode, | |||
3753 | goto out; | 3755 | goto out; |
3754 | } | 3756 | } |
3755 | 3757 | ||
3756 | mlog(0, "reserve new metadata %d, credits = %d\n", | 3758 | trace_ocfs2_add_refcount_flag(ref_blocks, credits); |
3757 | ref_blocks, credits); | ||
3758 | 3759 | ||
3759 | if (ref_blocks) { | 3760 | if (ref_blocks) { |
3760 | ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(inode->i_sb), | 3761 | ret = ocfs2_reserve_new_metadata_blocks(OCFS2_SB(inode->i_sb), |
@@ -4376,7 +4377,7 @@ static int ocfs2_user_path_parent(const char __user *path, | |||
4376 | if (IS_ERR(s)) | 4377 | if (IS_ERR(s)) |
4377 | return PTR_ERR(s); | 4378 | return PTR_ERR(s); |
4378 | 4379 | ||
4379 | error = path_lookup(s, LOOKUP_PARENT, nd); | 4380 | error = kern_path_parent(s, nd); |
4380 | if (error) | 4381 | if (error) |
4381 | putname(s); | 4382 | putname(s); |
4382 | else | 4383 | else |
diff --git a/fs/ocfs2/reservations.c b/fs/ocfs2/reservations.c index 3e78db361bc7..41ffd36c689c 100644 --- a/fs/ocfs2/reservations.c +++ b/fs/ocfs2/reservations.c | |||
@@ -30,10 +30,10 @@ | |||
30 | #include <linux/bitops.h> | 30 | #include <linux/bitops.h> |
31 | #include <linux/list.h> | 31 | #include <linux/list.h> |
32 | 32 | ||
33 | #define MLOG_MASK_PREFIX ML_RESERVATIONS | ||
34 | #include <cluster/masklog.h> | 33 | #include <cluster/masklog.h> |
35 | 34 | ||
36 | #include "ocfs2.h" | 35 | #include "ocfs2.h" |
36 | #include "ocfs2_trace.h" | ||
37 | 37 | ||
38 | #ifdef CONFIG_OCFS2_DEBUG_FS | 38 | #ifdef CONFIG_OCFS2_DEBUG_FS |
39 | #define OCFS2_CHECK_RESERVATIONS | 39 | #define OCFS2_CHECK_RESERVATIONS |
@@ -321,8 +321,7 @@ static void ocfs2_resv_insert(struct ocfs2_reservation_map *resmap, | |||
321 | 321 | ||
322 | assert_spin_locked(&resv_lock); | 322 | assert_spin_locked(&resv_lock); |
323 | 323 | ||
324 | mlog(0, "Insert reservation start: %u len: %u\n", new->r_start, | 324 | trace_ocfs2_resv_insert(new->r_start, new->r_len); |
325 | new->r_len); | ||
326 | 325 | ||
327 | while (*p) { | 326 | while (*p) { |
328 | parent = *p; | 327 | parent = *p; |
@@ -423,8 +422,8 @@ static int ocfs2_resmap_find_free_bits(struct ocfs2_reservation_map *resmap, | |||
423 | unsigned int best_start, best_len = 0; | 422 | unsigned int best_start, best_len = 0; |
424 | int offset, start, found; | 423 | int offset, start, found; |
425 | 424 | ||
426 | mlog(0, "Find %u bits within range (%u, len %u) resmap len: %u\n", | 425 | trace_ocfs2_resmap_find_free_bits_begin(search_start, search_len, |
427 | wanted, search_start, search_len, resmap->m_bitmap_len); | 426 | wanted, resmap->m_bitmap_len); |
428 | 427 | ||
429 | found = best_start = best_len = 0; | 428 | found = best_start = best_len = 0; |
430 | 429 | ||
@@ -463,7 +462,7 @@ static int ocfs2_resmap_find_free_bits(struct ocfs2_reservation_map *resmap, | |||
463 | *rlen = best_len; | 462 | *rlen = best_len; |
464 | *rstart = best_start; | 463 | *rstart = best_start; |
465 | 464 | ||
466 | mlog(0, "Found start: %u len: %u\n", best_start, best_len); | 465 | trace_ocfs2_resmap_find_free_bits_end(best_start, best_len); |
467 | 466 | ||
468 | return *rlen; | 467 | return *rlen; |
469 | } | 468 | } |
@@ -487,9 +486,8 @@ static void __ocfs2_resv_find_window(struct ocfs2_reservation_map *resmap, | |||
487 | * - our window should be last in all reservations | 486 | * - our window should be last in all reservations |
488 | * - need to make sure we don't go past end of bitmap | 487 | * - need to make sure we don't go past end of bitmap |
489 | */ | 488 | */ |
490 | 489 | trace_ocfs2_resv_find_window_begin(resv->r_start, ocfs2_resv_end(resv), | |
491 | mlog(0, "resv start: %u resv end: %u goal: %u wanted: %u\n", | 490 | goal, wanted, RB_EMPTY_ROOT(root)); |
492 | resv->r_start, ocfs2_resv_end(resv), goal, wanted); | ||
493 | 491 | ||
494 | assert_spin_locked(&resv_lock); | 492 | assert_spin_locked(&resv_lock); |
495 | 493 | ||
@@ -498,9 +496,6 @@ static void __ocfs2_resv_find_window(struct ocfs2_reservation_map *resmap, | |||
498 | * Easiest case - empty tree. We can just take | 496 | * Easiest case - empty tree. We can just take |
499 | * whatever window of free bits we want. | 497 | * whatever window of free bits we want. |
500 | */ | 498 | */ |
501 | |||
502 | mlog(0, "Empty root\n"); | ||
503 | |||
504 | clen = ocfs2_resmap_find_free_bits(resmap, wanted, goal, | 499 | clen = ocfs2_resmap_find_free_bits(resmap, wanted, goal, |
505 | resmap->m_bitmap_len - goal, | 500 | resmap->m_bitmap_len - goal, |
506 | &cstart, &clen); | 501 | &cstart, &clen); |
@@ -524,8 +519,6 @@ static void __ocfs2_resv_find_window(struct ocfs2_reservation_map *resmap, | |||
524 | prev_resv = ocfs2_find_resv_lhs(resmap, goal); | 519 | prev_resv = ocfs2_find_resv_lhs(resmap, goal); |
525 | 520 | ||
526 | if (prev_resv == NULL) { | 521 | if (prev_resv == NULL) { |
527 | mlog(0, "Goal on LHS of leftmost window\n"); | ||
528 | |||
529 | /* | 522 | /* |
530 | * A NULL here means that the search code couldn't | 523 | * A NULL here means that the search code couldn't |
531 | * find a window that starts before goal. | 524 | * find a window that starts before goal. |
@@ -570,13 +563,15 @@ static void __ocfs2_resv_find_window(struct ocfs2_reservation_map *resmap, | |||
570 | next_resv = NULL; | 563 | next_resv = NULL; |
571 | } | 564 | } |
572 | 565 | ||
566 | trace_ocfs2_resv_find_window_prev(prev_resv->r_start, | ||
567 | ocfs2_resv_end(prev_resv)); | ||
568 | |||
573 | prev = &prev_resv->r_node; | 569 | prev = &prev_resv->r_node; |
574 | 570 | ||
575 | /* Now we do a linear search for a window, starting at 'prev_rsv' */ | 571 | /* Now we do a linear search for a window, starting at 'prev_rsv' */ |
576 | while (1) { | 572 | while (1) { |
577 | next = rb_next(prev); | 573 | next = rb_next(prev); |
578 | if (next) { | 574 | if (next) { |
579 | mlog(0, "One more resv found in linear search\n"); | ||
580 | next_resv = rb_entry(next, | 575 | next_resv = rb_entry(next, |
581 | struct ocfs2_alloc_reservation, | 576 | struct ocfs2_alloc_reservation, |
582 | r_node); | 577 | r_node); |
@@ -585,7 +580,6 @@ static void __ocfs2_resv_find_window(struct ocfs2_reservation_map *resmap, | |||
585 | gap_end = next_resv->r_start - 1; | 580 | gap_end = next_resv->r_start - 1; |
586 | gap_len = gap_end - gap_start + 1; | 581 | gap_len = gap_end - gap_start + 1; |
587 | } else { | 582 | } else { |
588 | mlog(0, "No next node\n"); | ||
589 | /* | 583 | /* |
590 | * We're at the rightmost edge of the | 584 | * We're at the rightmost edge of the |
591 | * tree. See if a reservation between this | 585 | * tree. See if a reservation between this |
@@ -596,6 +590,8 @@ static void __ocfs2_resv_find_window(struct ocfs2_reservation_map *resmap, | |||
596 | gap_end = resmap->m_bitmap_len - 1; | 590 | gap_end = resmap->m_bitmap_len - 1; |
597 | } | 591 | } |
598 | 592 | ||
593 | trace_ocfs2_resv_find_window_next(next ? next_resv->r_start: -1, | ||
594 | next ? ocfs2_resv_end(next_resv) : -1); | ||
599 | /* | 595 | /* |
600 | * No need to check this gap if we have already found | 596 | * No need to check this gap if we have already found |
601 | * a larger region of free bits. | 597 | * a larger region of free bits. |
@@ -654,8 +650,9 @@ static void ocfs2_cannibalize_resv(struct ocfs2_reservation_map *resmap, | |||
654 | lru_resv = list_first_entry(&resmap->m_lru, | 650 | lru_resv = list_first_entry(&resmap->m_lru, |
655 | struct ocfs2_alloc_reservation, r_lru); | 651 | struct ocfs2_alloc_reservation, r_lru); |
656 | 652 | ||
657 | mlog(0, "lru resv: start: %u len: %u end: %u\n", lru_resv->r_start, | 653 | trace_ocfs2_cannibalize_resv_begin(lru_resv->r_start, |
658 | lru_resv->r_len, ocfs2_resv_end(lru_resv)); | 654 | lru_resv->r_len, |
655 | ocfs2_resv_end(lru_resv)); | ||
659 | 656 | ||
660 | /* | 657 | /* |
661 | * Cannibalize (some or all) of the target reservation and | 658 | * Cannibalize (some or all) of the target reservation and |
@@ -684,10 +681,9 @@ static void ocfs2_cannibalize_resv(struct ocfs2_reservation_map *resmap, | |||
684 | resv->r_len = shrink; | 681 | resv->r_len = shrink; |
685 | } | 682 | } |
686 | 683 | ||
687 | mlog(0, "Reservation now looks like: r_start: %u r_end: %u " | 684 | trace_ocfs2_cannibalize_resv_end(resv->r_start, ocfs2_resv_end(resv), |
688 | "r_len: %u r_last_start: %u r_last_len: %u\n", | 685 | resv->r_len, resv->r_last_start, |
689 | resv->r_start, ocfs2_resv_end(resv), resv->r_len, | 686 | resv->r_last_len); |
690 | resv->r_last_start, resv->r_last_len); | ||
691 | 687 | ||
692 | ocfs2_resv_insert(resmap, resv); | 688 | ocfs2_resv_insert(resmap, resv); |
693 | } | 689 | } |
@@ -748,7 +744,6 @@ int ocfs2_resmap_resv_bits(struct ocfs2_reservation_map *resmap, | |||
748 | if ((resv->r_flags & OCFS2_RESV_FLAG_TMP) || wanted < *clen) | 744 | if ((resv->r_flags & OCFS2_RESV_FLAG_TMP) || wanted < *clen) |
749 | wanted = *clen; | 745 | wanted = *clen; |
750 | 746 | ||
751 | mlog(0, "empty reservation, find new window\n"); | ||
752 | /* | 747 | /* |
753 | * Try to get a window here. If it works, we must fall | 748 | * Try to get a window here. If it works, we must fall |
754 | * through and test the bitmap . This avoids some | 749 | * through and test the bitmap . This avoids some |
@@ -757,6 +752,7 @@ int ocfs2_resmap_resv_bits(struct ocfs2_reservation_map *resmap, | |||
757 | * that inode. | 752 | * that inode. |
758 | */ | 753 | */ |
759 | ocfs2_resv_find_window(resmap, resv, wanted); | 754 | ocfs2_resv_find_window(resmap, resv, wanted); |
755 | trace_ocfs2_resmap_resv_bits(resv->r_start, resv->r_len); | ||
760 | } | 756 | } |
761 | 757 | ||
762 | BUG_ON(ocfs2_resv_empty(resv)); | 758 | BUG_ON(ocfs2_resv_empty(resv)); |
@@ -813,10 +809,10 @@ void ocfs2_resmap_claimed_bits(struct ocfs2_reservation_map *resmap, | |||
813 | 809 | ||
814 | spin_lock(&resv_lock); | 810 | spin_lock(&resv_lock); |
815 | 811 | ||
816 | mlog(0, "claim bits: cstart: %u cend: %u clen: %u r_start: %u " | 812 | trace_ocfs2_resmap_claimed_bits_begin(cstart, cend, clen, resv->r_start, |
817 | "r_end: %u r_len: %u, r_last_start: %u r_last_len: %u\n", | 813 | ocfs2_resv_end(resv), resv->r_len, |
818 | cstart, cend, clen, resv->r_start, ocfs2_resv_end(resv), | 814 | resv->r_last_start, |
819 | resv->r_len, resv->r_last_start, resv->r_last_len); | 815 | resv->r_last_len); |
820 | 816 | ||
821 | BUG_ON(cstart < resv->r_start); | 817 | BUG_ON(cstart < resv->r_start); |
822 | BUG_ON(cstart > ocfs2_resv_end(resv)); | 818 | BUG_ON(cstart > ocfs2_resv_end(resv)); |
@@ -833,10 +829,9 @@ void ocfs2_resmap_claimed_bits(struct ocfs2_reservation_map *resmap, | |||
833 | if (!ocfs2_resv_empty(resv)) | 829 | if (!ocfs2_resv_empty(resv)) |
834 | ocfs2_resv_mark_lru(resmap, resv); | 830 | ocfs2_resv_mark_lru(resmap, resv); |
835 | 831 | ||
836 | mlog(0, "Reservation now looks like: r_start: %u r_end: %u " | 832 | trace_ocfs2_resmap_claimed_bits_end(resv->r_start, ocfs2_resv_end(resv), |
837 | "r_len: %u r_last_start: %u r_last_len: %u\n", | 833 | resv->r_len, resv->r_last_start, |
838 | resv->r_start, ocfs2_resv_end(resv), resv->r_len, | 834 | resv->r_last_len); |
839 | resv->r_last_start, resv->r_last_len); | ||
840 | 835 | ||
841 | ocfs2_check_resmap(resmap); | 836 | ocfs2_check_resmap(resmap); |
842 | 837 | ||
diff --git a/fs/ocfs2/resize.c b/fs/ocfs2/resize.c index dacd553d8617..ec55add7604a 100644 --- a/fs/ocfs2/resize.c +++ b/fs/ocfs2/resize.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/fs.h> | 27 | #include <linux/fs.h> |
28 | #include <linux/types.h> | 28 | #include <linux/types.h> |
29 | 29 | ||
30 | #define MLOG_MASK_PREFIX ML_DISK_ALLOC | ||
31 | #include <cluster/masklog.h> | 30 | #include <cluster/masklog.h> |
32 | 31 | ||
33 | #include "ocfs2.h" | 32 | #include "ocfs2.h" |
@@ -39,6 +38,7 @@ | |||
39 | #include "super.h" | 38 | #include "super.h" |
40 | #include "sysfile.h" | 39 | #include "sysfile.h" |
41 | #include "uptodate.h" | 40 | #include "uptodate.h" |
41 | #include "ocfs2_trace.h" | ||
42 | 42 | ||
43 | #include "buffer_head_io.h" | 43 | #include "buffer_head_io.h" |
44 | #include "suballoc.h" | 44 | #include "suballoc.h" |
@@ -82,7 +82,6 @@ static u16 ocfs2_calc_new_backup_super(struct inode *inode, | |||
82 | backups++; | 82 | backups++; |
83 | } | 83 | } |
84 | 84 | ||
85 | mlog_exit_void(); | ||
86 | return backups; | 85 | return backups; |
87 | } | 86 | } |
88 | 87 | ||
@@ -103,8 +102,8 @@ static int ocfs2_update_last_group_and_inode(handle_t *handle, | |||
103 | u16 cl_bpc = le16_to_cpu(cl->cl_bpc); | 102 | u16 cl_bpc = le16_to_cpu(cl->cl_bpc); |
104 | u16 cl_cpg = le16_to_cpu(cl->cl_cpg); | 103 | u16 cl_cpg = le16_to_cpu(cl->cl_cpg); |
105 | 104 | ||
106 | mlog_entry("(new_clusters=%d, first_new_cluster = %u)\n", | 105 | trace_ocfs2_update_last_group_and_inode(new_clusters, |
107 | new_clusters, first_new_cluster); | 106 | first_new_cluster); |
108 | 107 | ||
109 | ret = ocfs2_journal_access_gd(handle, INODE_CACHE(bm_inode), | 108 | ret = ocfs2_journal_access_gd(handle, INODE_CACHE(bm_inode), |
110 | group_bh, OCFS2_JOURNAL_ACCESS_WRITE); | 109 | group_bh, OCFS2_JOURNAL_ACCESS_WRITE); |
@@ -176,7 +175,8 @@ out_rollback: | |||
176 | le16_add_cpu(&group->bg_free_bits_count, -1 * num_bits); | 175 | le16_add_cpu(&group->bg_free_bits_count, -1 * num_bits); |
177 | } | 176 | } |
178 | out: | 177 | out: |
179 | mlog_exit(ret); | 178 | if (ret) |
179 | mlog_errno(ret); | ||
180 | return ret; | 180 | return ret; |
181 | } | 181 | } |
182 | 182 | ||
@@ -281,8 +281,6 @@ int ocfs2_group_extend(struct inode * inode, int new_clusters) | |||
281 | u32 first_new_cluster; | 281 | u32 first_new_cluster; |
282 | u64 lgd_blkno; | 282 | u64 lgd_blkno; |
283 | 283 | ||
284 | mlog_entry_void(); | ||
285 | |||
286 | if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) | 284 | if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) |
287 | return -EROFS; | 285 | return -EROFS; |
288 | 286 | ||
@@ -342,7 +340,8 @@ int ocfs2_group_extend(struct inode * inode, int new_clusters) | |||
342 | goto out_unlock; | 340 | goto out_unlock; |
343 | } | 341 | } |
344 | 342 | ||
345 | mlog(0, "extend the last group at %llu, new clusters = %d\n", | 343 | |
344 | trace_ocfs2_group_extend( | ||
346 | (unsigned long long)le64_to_cpu(group->bg_blkno), new_clusters); | 345 | (unsigned long long)le64_to_cpu(group->bg_blkno), new_clusters); |
347 | 346 | ||
348 | handle = ocfs2_start_trans(osb, OCFS2_GROUP_EXTEND_CREDITS); | 347 | handle = ocfs2_start_trans(osb, OCFS2_GROUP_EXTEND_CREDITS); |
@@ -377,7 +376,6 @@ out_mutex: | |||
377 | iput(main_bm_inode); | 376 | iput(main_bm_inode); |
378 | 377 | ||
379 | out: | 378 | out: |
380 | mlog_exit_void(); | ||
381 | return ret; | 379 | return ret; |
382 | } | 380 | } |
383 | 381 | ||
@@ -472,8 +470,6 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input) | |||
472 | struct ocfs2_chain_rec *cr; | 470 | struct ocfs2_chain_rec *cr; |
473 | u16 cl_bpc; | 471 | u16 cl_bpc; |
474 | 472 | ||
475 | mlog_entry_void(); | ||
476 | |||
477 | if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) | 473 | if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) |
478 | return -EROFS; | 474 | return -EROFS; |
479 | 475 | ||
@@ -520,8 +516,8 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input) | |||
520 | goto out_unlock; | 516 | goto out_unlock; |
521 | } | 517 | } |
522 | 518 | ||
523 | mlog(0, "Add a new group %llu in chain = %u, length = %u\n", | 519 | trace_ocfs2_group_add((unsigned long long)input->group, |
524 | (unsigned long long)input->group, input->chain, input->clusters); | 520 | input->chain, input->clusters, input->frees); |
525 | 521 | ||
526 | handle = ocfs2_start_trans(osb, OCFS2_GROUP_ADD_CREDITS); | 522 | handle = ocfs2_start_trans(osb, OCFS2_GROUP_ADD_CREDITS); |
527 | if (IS_ERR(handle)) { | 523 | if (IS_ERR(handle)) { |
@@ -589,6 +585,5 @@ out_mutex: | |||
589 | iput(main_bm_inode); | 585 | iput(main_bm_inode); |
590 | 586 | ||
591 | out: | 587 | out: |
592 | mlog_exit_void(); | ||
593 | return ret; | 588 | return ret; |
594 | } | 589 | } |
diff --git a/fs/ocfs2/slot_map.c b/fs/ocfs2/slot_map.c index ab4e0172cc1d..26fc0014d509 100644 --- a/fs/ocfs2/slot_map.c +++ b/fs/ocfs2/slot_map.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/highmem.h> | 28 | #include <linux/highmem.h> |
29 | 29 | ||
30 | #define MLOG_MASK_PREFIX ML_SUPER | ||
31 | #include <cluster/masklog.h> | 30 | #include <cluster/masklog.h> |
32 | 31 | ||
33 | #include "ocfs2.h" | 32 | #include "ocfs2.h" |
@@ -39,6 +38,7 @@ | |||
39 | #include "slot_map.h" | 38 | #include "slot_map.h" |
40 | #include "super.h" | 39 | #include "super.h" |
41 | #include "sysfile.h" | 40 | #include "sysfile.h" |
41 | #include "ocfs2_trace.h" | ||
42 | 42 | ||
43 | #include "buffer_head_io.h" | 43 | #include "buffer_head_io.h" |
44 | 44 | ||
@@ -142,8 +142,7 @@ int ocfs2_refresh_slot_info(struct ocfs2_super *osb) | |||
142 | BUG_ON(si->si_blocks == 0); | 142 | BUG_ON(si->si_blocks == 0); |
143 | BUG_ON(si->si_bh == NULL); | 143 | BUG_ON(si->si_bh == NULL); |
144 | 144 | ||
145 | mlog(0, "Refreshing slot map, reading %u block(s)\n", | 145 | trace_ocfs2_refresh_slot_info(si->si_blocks); |
146 | si->si_blocks); | ||
147 | 146 | ||
148 | /* | 147 | /* |
149 | * We pass -1 as blocknr because we expect all of si->si_bh to | 148 | * We pass -1 as blocknr because we expect all of si->si_bh to |
@@ -381,8 +380,7 @@ static int ocfs2_map_slot_buffers(struct ocfs2_super *osb, | |||
381 | /* The size checks above should ensure this */ | 380 | /* The size checks above should ensure this */ |
382 | BUG_ON((osb->max_slots / si->si_slots_per_block) > blocks); | 381 | BUG_ON((osb->max_slots / si->si_slots_per_block) > blocks); |
383 | 382 | ||
384 | mlog(0, "Slot map needs %u buffers for %llu bytes\n", | 383 | trace_ocfs2_map_slot_buffers(bytes, si->si_blocks); |
385 | si->si_blocks, bytes); | ||
386 | 384 | ||
387 | si->si_bh = kzalloc(sizeof(struct buffer_head *) * si->si_blocks, | 385 | si->si_bh = kzalloc(sizeof(struct buffer_head *) * si->si_blocks, |
388 | GFP_KERNEL); | 386 | GFP_KERNEL); |
@@ -400,8 +398,7 @@ static int ocfs2_map_slot_buffers(struct ocfs2_super *osb, | |||
400 | goto bail; | 398 | goto bail; |
401 | } | 399 | } |
402 | 400 | ||
403 | mlog(0, "Reading slot map block %u at %llu\n", i, | 401 | trace_ocfs2_map_slot_buffers_block((unsigned long long)blkno, i); |
404 | (unsigned long long)blkno); | ||
405 | 402 | ||
406 | bh = NULL; /* Acquire a fresh bh */ | 403 | bh = NULL; /* Acquire a fresh bh */ |
407 | status = ocfs2_read_blocks(INODE_CACHE(si->si_inode), blkno, | 404 | status = ocfs2_read_blocks(INODE_CACHE(si->si_inode), blkno, |
@@ -475,8 +472,6 @@ int ocfs2_find_slot(struct ocfs2_super *osb) | |||
475 | int slot; | 472 | int slot; |
476 | struct ocfs2_slot_info *si; | 473 | struct ocfs2_slot_info *si; |
477 | 474 | ||
478 | mlog_entry_void(); | ||
479 | |||
480 | si = osb->slot_info; | 475 | si = osb->slot_info; |
481 | 476 | ||
482 | spin_lock(&osb->osb_lock); | 477 | spin_lock(&osb->osb_lock); |
@@ -505,14 +500,13 @@ int ocfs2_find_slot(struct ocfs2_super *osb) | |||
505 | osb->slot_num = slot; | 500 | osb->slot_num = slot; |
506 | spin_unlock(&osb->osb_lock); | 501 | spin_unlock(&osb->osb_lock); |
507 | 502 | ||
508 | mlog(0, "taking node slot %d\n", osb->slot_num); | 503 | trace_ocfs2_find_slot(osb->slot_num); |
509 | 504 | ||
510 | status = ocfs2_update_disk_slot(osb, si, osb->slot_num); | 505 | status = ocfs2_update_disk_slot(osb, si, osb->slot_num); |
511 | if (status < 0) | 506 | if (status < 0) |
512 | mlog_errno(status); | 507 | mlog_errno(status); |
513 | 508 | ||
514 | bail: | 509 | bail: |
515 | mlog_exit(status); | ||
516 | return status; | 510 | return status; |
517 | } | 511 | } |
518 | 512 | ||
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index 71998d4d61d5..ab6e2061074f 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/highmem.h> | 30 | #include <linux/highmem.h> |
31 | 31 | ||
32 | #define MLOG_MASK_PREFIX ML_DISK_ALLOC | ||
33 | #include <cluster/masklog.h> | 32 | #include <cluster/masklog.h> |
34 | 33 | ||
35 | #include "ocfs2.h" | 34 | #include "ocfs2.h" |
@@ -44,6 +43,7 @@ | |||
44 | #include "super.h" | 43 | #include "super.h" |
45 | #include "sysfile.h" | 44 | #include "sysfile.h" |
46 | #include "uptodate.h" | 45 | #include "uptodate.h" |
46 | #include "ocfs2_trace.h" | ||
47 | 47 | ||
48 | #include "buffer_head_io.h" | 48 | #include "buffer_head_io.h" |
49 | 49 | ||
@@ -308,8 +308,8 @@ static int ocfs2_validate_group_descriptor(struct super_block *sb, | |||
308 | int rc; | 308 | int rc; |
309 | struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data; | 309 | struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data; |
310 | 310 | ||
311 | mlog(0, "Validating group descriptor %llu\n", | 311 | trace_ocfs2_validate_group_descriptor( |
312 | (unsigned long long)bh->b_blocknr); | 312 | (unsigned long long)bh->b_blocknr); |
313 | 313 | ||
314 | BUG_ON(!buffer_uptodate(bh)); | 314 | BUG_ON(!buffer_uptodate(bh)); |
315 | 315 | ||
@@ -389,8 +389,6 @@ static int ocfs2_block_group_fill(handle_t *handle, | |||
389 | struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; | 389 | struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; |
390 | struct super_block * sb = alloc_inode->i_sb; | 390 | struct super_block * sb = alloc_inode->i_sb; |
391 | 391 | ||
392 | mlog_entry_void(); | ||
393 | |||
394 | if (((unsigned long long) bg_bh->b_blocknr) != group_blkno) { | 392 | if (((unsigned long long) bg_bh->b_blocknr) != group_blkno) { |
395 | ocfs2_error(alloc_inode->i_sb, "group block (%llu) != " | 393 | ocfs2_error(alloc_inode->i_sb, "group block (%llu) != " |
396 | "b_blocknr (%llu)", | 394 | "b_blocknr (%llu)", |
@@ -436,7 +434,8 @@ static int ocfs2_block_group_fill(handle_t *handle, | |||
436 | * allocation time. */ | 434 | * allocation time. */ |
437 | 435 | ||
438 | bail: | 436 | bail: |
439 | mlog_exit(status); | 437 | if (status) |
438 | mlog_errno(status); | ||
440 | return status; | 439 | return status; |
441 | } | 440 | } |
442 | 441 | ||
@@ -477,8 +476,8 @@ ocfs2_block_group_alloc_contig(struct ocfs2_super *osb, handle_t *handle, | |||
477 | 476 | ||
478 | /* setup the group */ | 477 | /* setup the group */ |
479 | bg_blkno = ocfs2_clusters_to_blocks(osb->sb, bit_off); | 478 | bg_blkno = ocfs2_clusters_to_blocks(osb->sb, bit_off); |
480 | mlog(0, "new descriptor, record %u, at block %llu\n", | 479 | trace_ocfs2_block_group_alloc_contig( |
481 | alloc_rec, (unsigned long long)bg_blkno); | 480 | (unsigned long long)bg_blkno, alloc_rec); |
482 | 481 | ||
483 | bg_bh = sb_getblk(osb->sb, bg_blkno); | 482 | bg_bh = sb_getblk(osb->sb, bg_blkno); |
484 | if (!bg_bh) { | 483 | if (!bg_bh) { |
@@ -657,8 +656,8 @@ ocfs2_block_group_alloc_discontig(handle_t *handle, | |||
657 | 656 | ||
658 | /* setup the group */ | 657 | /* setup the group */ |
659 | bg_blkno = ocfs2_clusters_to_blocks(osb->sb, bit_off); | 658 | bg_blkno = ocfs2_clusters_to_blocks(osb->sb, bit_off); |
660 | mlog(0, "new descriptor, record %u, at block %llu\n", | 659 | trace_ocfs2_block_group_alloc_discontig( |
661 | alloc_rec, (unsigned long long)bg_blkno); | 660 | (unsigned long long)bg_blkno, alloc_rec); |
662 | 661 | ||
663 | bg_bh = sb_getblk(osb->sb, bg_blkno); | 662 | bg_bh = sb_getblk(osb->sb, bg_blkno); |
664 | if (!bg_bh) { | 663 | if (!bg_bh) { |
@@ -707,8 +706,6 @@ static int ocfs2_block_group_alloc(struct ocfs2_super *osb, | |||
707 | 706 | ||
708 | BUG_ON(ocfs2_is_cluster_bitmap(alloc_inode)); | 707 | BUG_ON(ocfs2_is_cluster_bitmap(alloc_inode)); |
709 | 708 | ||
710 | mlog_entry_void(); | ||
711 | |||
712 | cl = &fe->id2.i_chain; | 709 | cl = &fe->id2.i_chain; |
713 | status = ocfs2_reserve_clusters_with_limit(osb, | 710 | status = ocfs2_reserve_clusters_with_limit(osb, |
714 | le16_to_cpu(cl->cl_cpg), | 711 | le16_to_cpu(cl->cl_cpg), |
@@ -730,8 +727,8 @@ static int ocfs2_block_group_alloc(struct ocfs2_super *osb, | |||
730 | } | 727 | } |
731 | 728 | ||
732 | if (last_alloc_group && *last_alloc_group != 0) { | 729 | if (last_alloc_group && *last_alloc_group != 0) { |
733 | mlog(0, "use old allocation group %llu for block group alloc\n", | 730 | trace_ocfs2_block_group_alloc( |
734 | (unsigned long long)*last_alloc_group); | 731 | (unsigned long long)*last_alloc_group); |
735 | ac->ac_last_group = *last_alloc_group; | 732 | ac->ac_last_group = *last_alloc_group; |
736 | } | 733 | } |
737 | 734 | ||
@@ -796,7 +793,8 @@ bail: | |||
796 | 793 | ||
797 | brelse(bg_bh); | 794 | brelse(bg_bh); |
798 | 795 | ||
799 | mlog_exit(status); | 796 | if (status) |
797 | mlog_errno(status); | ||
800 | return status; | 798 | return status; |
801 | } | 799 | } |
802 | 800 | ||
@@ -814,8 +812,6 @@ static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb, | |||
814 | struct ocfs2_dinode *fe; | 812 | struct ocfs2_dinode *fe; |
815 | u32 free_bits; | 813 | u32 free_bits; |
816 | 814 | ||
817 | mlog_entry_void(); | ||
818 | |||
819 | alloc_inode = ocfs2_get_system_file_inode(osb, type, slot); | 815 | alloc_inode = ocfs2_get_system_file_inode(osb, type, slot); |
820 | if (!alloc_inode) { | 816 | if (!alloc_inode) { |
821 | mlog_errno(-EINVAL); | 817 | mlog_errno(-EINVAL); |
@@ -855,16 +851,15 @@ static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb, | |||
855 | if (bits_wanted > free_bits) { | 851 | if (bits_wanted > free_bits) { |
856 | /* cluster bitmap never grows */ | 852 | /* cluster bitmap never grows */ |
857 | if (ocfs2_is_cluster_bitmap(alloc_inode)) { | 853 | if (ocfs2_is_cluster_bitmap(alloc_inode)) { |
858 | mlog(0, "Disk Full: wanted=%u, free_bits=%u\n", | 854 | trace_ocfs2_reserve_suballoc_bits_nospc(bits_wanted, |
859 | bits_wanted, free_bits); | 855 | free_bits); |
860 | status = -ENOSPC; | 856 | status = -ENOSPC; |
861 | goto bail; | 857 | goto bail; |
862 | } | 858 | } |
863 | 859 | ||
864 | if (!(flags & ALLOC_NEW_GROUP)) { | 860 | if (!(flags & ALLOC_NEW_GROUP)) { |
865 | mlog(0, "Alloc File %u Full: wanted=%u, free_bits=%u, " | 861 | trace_ocfs2_reserve_suballoc_bits_no_new_group( |
866 | "and we don't alloc a new group for it.\n", | 862 | slot, bits_wanted, free_bits); |
867 | slot, bits_wanted, free_bits); | ||
868 | status = -ENOSPC; | 863 | status = -ENOSPC; |
869 | goto bail; | 864 | goto bail; |
870 | } | 865 | } |
@@ -890,7 +885,8 @@ static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb, | |||
890 | bail: | 885 | bail: |
891 | brelse(bh); | 886 | brelse(bh); |
892 | 887 | ||
893 | mlog_exit(status); | 888 | if (status) |
889 | mlog_errno(status); | ||
894 | return status; | 890 | return status; |
895 | } | 891 | } |
896 | 892 | ||
@@ -1052,7 +1048,8 @@ bail: | |||
1052 | *ac = NULL; | 1048 | *ac = NULL; |
1053 | } | 1049 | } |
1054 | 1050 | ||
1055 | mlog_exit(status); | 1051 | if (status) |
1052 | mlog_errno(status); | ||
1056 | return status; | 1053 | return status; |
1057 | } | 1054 | } |
1058 | 1055 | ||
@@ -1119,8 +1116,8 @@ int ocfs2_reserve_new_inode(struct ocfs2_super *osb, | |||
1119 | spin_lock(&osb->osb_lock); | 1116 | spin_lock(&osb->osb_lock); |
1120 | osb->osb_inode_alloc_group = alloc_group; | 1117 | osb->osb_inode_alloc_group = alloc_group; |
1121 | spin_unlock(&osb->osb_lock); | 1118 | spin_unlock(&osb->osb_lock); |
1122 | mlog(0, "after reservation, new allocation group is " | 1119 | trace_ocfs2_reserve_new_inode_new_group( |
1123 | "%llu\n", (unsigned long long)alloc_group); | 1120 | (unsigned long long)alloc_group); |
1124 | 1121 | ||
1125 | /* | 1122 | /* |
1126 | * Some inodes must be freed by us, so try to allocate | 1123 | * Some inodes must be freed by us, so try to allocate |
@@ -1152,7 +1149,8 @@ bail: | |||
1152 | *ac = NULL; | 1149 | *ac = NULL; |
1153 | } | 1150 | } |
1154 | 1151 | ||
1155 | mlog_exit(status); | 1152 | if (status) |
1153 | mlog_errno(status); | ||
1156 | return status; | 1154 | return status; |
1157 | } | 1155 | } |
1158 | 1156 | ||
@@ -1189,8 +1187,6 @@ static int ocfs2_reserve_clusters_with_limit(struct ocfs2_super *osb, | |||
1189 | { | 1187 | { |
1190 | int status; | 1188 | int status; |
1191 | 1189 | ||
1192 | mlog_entry_void(); | ||
1193 | |||
1194 | *ac = kzalloc(sizeof(struct ocfs2_alloc_context), GFP_KERNEL); | 1190 | *ac = kzalloc(sizeof(struct ocfs2_alloc_context), GFP_KERNEL); |
1195 | if (!(*ac)) { | 1191 | if (!(*ac)) { |
1196 | status = -ENOMEM; | 1192 | status = -ENOMEM; |
@@ -1229,7 +1225,8 @@ bail: | |||
1229 | *ac = NULL; | 1225 | *ac = NULL; |
1230 | } | 1226 | } |
1231 | 1227 | ||
1232 | mlog_exit(status); | 1228 | if (status) |
1229 | mlog_errno(status); | ||
1233 | return status; | 1230 | return status; |
1234 | } | 1231 | } |
1235 | 1232 | ||
@@ -1357,15 +1354,12 @@ static inline int ocfs2_block_group_set_bits(handle_t *handle, | |||
1357 | void *bitmap = bg->bg_bitmap; | 1354 | void *bitmap = bg->bg_bitmap; |
1358 | int journal_type = OCFS2_JOURNAL_ACCESS_WRITE; | 1355 | int journal_type = OCFS2_JOURNAL_ACCESS_WRITE; |
1359 | 1356 | ||
1360 | mlog_entry_void(); | ||
1361 | |||
1362 | /* All callers get the descriptor via | 1357 | /* All callers get the descriptor via |
1363 | * ocfs2_read_group_descriptor(). Any corruption is a code bug. */ | 1358 | * ocfs2_read_group_descriptor(). Any corruption is a code bug. */ |
1364 | BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); | 1359 | BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); |
1365 | BUG_ON(le16_to_cpu(bg->bg_free_bits_count) < num_bits); | 1360 | BUG_ON(le16_to_cpu(bg->bg_free_bits_count) < num_bits); |
1366 | 1361 | ||
1367 | mlog(0, "block_group_set_bits: off = %u, num = %u\n", bit_off, | 1362 | trace_ocfs2_block_group_set_bits(bit_off, num_bits); |
1368 | num_bits); | ||
1369 | 1363 | ||
1370 | if (ocfs2_is_cluster_bitmap(alloc_inode)) | 1364 | if (ocfs2_is_cluster_bitmap(alloc_inode)) |
1371 | journal_type = OCFS2_JOURNAL_ACCESS_UNDO; | 1365 | journal_type = OCFS2_JOURNAL_ACCESS_UNDO; |
@@ -1394,7 +1388,8 @@ static inline int ocfs2_block_group_set_bits(handle_t *handle, | |||
1394 | ocfs2_journal_dirty(handle, group_bh); | 1388 | ocfs2_journal_dirty(handle, group_bh); |
1395 | 1389 | ||
1396 | bail: | 1390 | bail: |
1397 | mlog_exit(status); | 1391 | if (status) |
1392 | mlog_errno(status); | ||
1398 | return status; | 1393 | return status; |
1399 | } | 1394 | } |
1400 | 1395 | ||
@@ -1437,10 +1432,10 @@ static int ocfs2_relink_block_group(handle_t *handle, | |||
1437 | BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); | 1432 | BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); |
1438 | BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(prev_bg)); | 1433 | BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(prev_bg)); |
1439 | 1434 | ||
1440 | mlog(0, "Suballoc %llu, chain %u, move group %llu to top, prev = %llu\n", | 1435 | trace_ocfs2_relink_block_group( |
1441 | (unsigned long long)le64_to_cpu(fe->i_blkno), chain, | 1436 | (unsigned long long)le64_to_cpu(fe->i_blkno), chain, |
1442 | (unsigned long long)le64_to_cpu(bg->bg_blkno), | 1437 | (unsigned long long)le64_to_cpu(bg->bg_blkno), |
1443 | (unsigned long long)le64_to_cpu(prev_bg->bg_blkno)); | 1438 | (unsigned long long)le64_to_cpu(prev_bg->bg_blkno)); |
1444 | 1439 | ||
1445 | fe_ptr = le64_to_cpu(fe->id2.i_chain.cl_recs[chain].c_blkno); | 1440 | fe_ptr = le64_to_cpu(fe->id2.i_chain.cl_recs[chain].c_blkno); |
1446 | bg_ptr = le64_to_cpu(bg->bg_next_group); | 1441 | bg_ptr = le64_to_cpu(bg->bg_next_group); |
@@ -1484,7 +1479,8 @@ out_rollback: | |||
1484 | prev_bg->bg_next_group = cpu_to_le64(prev_bg_ptr); | 1479 | prev_bg->bg_next_group = cpu_to_le64(prev_bg_ptr); |
1485 | } | 1480 | } |
1486 | 1481 | ||
1487 | mlog_exit(status); | 1482 | if (status) |
1483 | mlog_errno(status); | ||
1488 | return status; | 1484 | return status; |
1489 | } | 1485 | } |
1490 | 1486 | ||
@@ -1525,10 +1521,10 @@ static int ocfs2_cluster_group_search(struct inode *inode, | |||
1525 | if ((gd_cluster_off + max_bits) > | 1521 | if ((gd_cluster_off + max_bits) > |
1526 | OCFS2_I(inode)->ip_clusters) { | 1522 | OCFS2_I(inode)->ip_clusters) { |
1527 | max_bits = OCFS2_I(inode)->ip_clusters - gd_cluster_off; | 1523 | max_bits = OCFS2_I(inode)->ip_clusters - gd_cluster_off; |
1528 | mlog(0, "Desc %llu, bg_bits %u, clusters %u, use %u\n", | 1524 | trace_ocfs2_cluster_group_search_wrong_max_bits( |
1529 | (unsigned long long)le64_to_cpu(gd->bg_blkno), | 1525 | (unsigned long long)le64_to_cpu(gd->bg_blkno), |
1530 | le16_to_cpu(gd->bg_bits), | 1526 | le16_to_cpu(gd->bg_bits), |
1531 | OCFS2_I(inode)->ip_clusters, max_bits); | 1527 | OCFS2_I(inode)->ip_clusters, max_bits); |
1532 | } | 1528 | } |
1533 | 1529 | ||
1534 | ret = ocfs2_block_group_find_clear_bits(OCFS2_SB(inode->i_sb), | 1530 | ret = ocfs2_block_group_find_clear_bits(OCFS2_SB(inode->i_sb), |
@@ -1542,9 +1538,9 @@ static int ocfs2_cluster_group_search(struct inode *inode, | |||
1542 | gd_cluster_off + | 1538 | gd_cluster_off + |
1543 | res->sr_bit_offset + | 1539 | res->sr_bit_offset + |
1544 | res->sr_bits); | 1540 | res->sr_bits); |
1545 | mlog(0, "Checking %llu against %llu\n", | 1541 | trace_ocfs2_cluster_group_search_max_block( |
1546 | (unsigned long long)blkoff, | 1542 | (unsigned long long)blkoff, |
1547 | (unsigned long long)max_block); | 1543 | (unsigned long long)max_block); |
1548 | if (blkoff > max_block) | 1544 | if (blkoff > max_block) |
1549 | return -ENOSPC; | 1545 | return -ENOSPC; |
1550 | } | 1546 | } |
@@ -1588,9 +1584,9 @@ static int ocfs2_block_group_search(struct inode *inode, | |||
1588 | if (!ret && max_block) { | 1584 | if (!ret && max_block) { |
1589 | blkoff = le64_to_cpu(bg->bg_blkno) + | 1585 | blkoff = le64_to_cpu(bg->bg_blkno) + |
1590 | res->sr_bit_offset + res->sr_bits; | 1586 | res->sr_bit_offset + res->sr_bits; |
1591 | mlog(0, "Checking %llu against %llu\n", | 1587 | trace_ocfs2_block_group_search_max_block( |
1592 | (unsigned long long)blkoff, | 1588 | (unsigned long long)blkoff, |
1593 | (unsigned long long)max_block); | 1589 | (unsigned long long)max_block); |
1594 | if (blkoff > max_block) | 1590 | if (blkoff > max_block) |
1595 | ret = -ENOSPC; | 1591 | ret = -ENOSPC; |
1596 | } | 1592 | } |
@@ -1756,9 +1752,9 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, | |||
1756 | struct ocfs2_group_desc *bg; | 1752 | struct ocfs2_group_desc *bg; |
1757 | 1753 | ||
1758 | chain = ac->ac_chain; | 1754 | chain = ac->ac_chain; |
1759 | mlog(0, "trying to alloc %u bits from chain %u, inode %llu\n", | 1755 | trace_ocfs2_search_chain_begin( |
1760 | bits_wanted, chain, | 1756 | (unsigned long long)OCFS2_I(alloc_inode)->ip_blkno, |
1761 | (unsigned long long)OCFS2_I(alloc_inode)->ip_blkno); | 1757 | bits_wanted, chain); |
1762 | 1758 | ||
1763 | status = ocfs2_read_group_descriptor(alloc_inode, fe, | 1759 | status = ocfs2_read_group_descriptor(alloc_inode, fe, |
1764 | le64_to_cpu(cl->cl_recs[chain].c_blkno), | 1760 | le64_to_cpu(cl->cl_recs[chain].c_blkno), |
@@ -1799,8 +1795,8 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, | |||
1799 | goto bail; | 1795 | goto bail; |
1800 | } | 1796 | } |
1801 | 1797 | ||
1802 | mlog(0, "alloc succeeds: we give %u bits from block group %llu\n", | 1798 | trace_ocfs2_search_chain_succ( |
1803 | res->sr_bits, (unsigned long long)le64_to_cpu(bg->bg_blkno)); | 1799 | (unsigned long long)le64_to_cpu(bg->bg_blkno), res->sr_bits); |
1804 | 1800 | ||
1805 | res->sr_bg_blkno = le64_to_cpu(bg->bg_blkno); | 1801 | res->sr_bg_blkno = le64_to_cpu(bg->bg_blkno); |
1806 | 1802 | ||
@@ -1861,8 +1857,9 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac, | |||
1861 | goto bail; | 1857 | goto bail; |
1862 | } | 1858 | } |
1863 | 1859 | ||
1864 | mlog(0, "Allocated %u bits from suballocator %llu\n", res->sr_bits, | 1860 | trace_ocfs2_search_chain_end( |
1865 | (unsigned long long)le64_to_cpu(fe->i_blkno)); | 1861 | (unsigned long long)le64_to_cpu(fe->i_blkno), |
1862 | res->sr_bits); | ||
1866 | 1863 | ||
1867 | out_loc_only: | 1864 | out_loc_only: |
1868 | *bits_left = le16_to_cpu(bg->bg_free_bits_count); | 1865 | *bits_left = le16_to_cpu(bg->bg_free_bits_count); |
@@ -1870,7 +1867,8 @@ bail: | |||
1870 | brelse(group_bh); | 1867 | brelse(group_bh); |
1871 | brelse(prev_group_bh); | 1868 | brelse(prev_group_bh); |
1872 | 1869 | ||
1873 | mlog_exit(status); | 1870 | if (status) |
1871 | mlog_errno(status); | ||
1874 | return status; | 1872 | return status; |
1875 | } | 1873 | } |
1876 | 1874 | ||
@@ -1888,8 +1886,6 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac, | |||
1888 | struct ocfs2_chain_list *cl; | 1886 | struct ocfs2_chain_list *cl; |
1889 | struct ocfs2_dinode *fe; | 1887 | struct ocfs2_dinode *fe; |
1890 | 1888 | ||
1891 | mlog_entry_void(); | ||
1892 | |||
1893 | BUG_ON(ac->ac_bits_given >= ac->ac_bits_wanted); | 1889 | BUG_ON(ac->ac_bits_given >= ac->ac_bits_wanted); |
1894 | BUG_ON(bits_wanted > (ac->ac_bits_wanted - ac->ac_bits_given)); | 1890 | BUG_ON(bits_wanted > (ac->ac_bits_wanted - ac->ac_bits_given)); |
1895 | BUG_ON(!ac->ac_bh); | 1891 | BUG_ON(!ac->ac_bh); |
@@ -1945,8 +1941,7 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac, | |||
1945 | goto bail; | 1941 | goto bail; |
1946 | } | 1942 | } |
1947 | 1943 | ||
1948 | mlog(0, "Search of victim chain %u came up with nothing, " | 1944 | trace_ocfs2_claim_suballoc_bits(victim); |
1949 | "trying all chains now.\n", victim); | ||
1950 | 1945 | ||
1951 | /* If we didn't pick a good victim, then just default to | 1946 | /* If we didn't pick a good victim, then just default to |
1952 | * searching each chain in order. Don't allow chain relinking | 1947 | * searching each chain in order. Don't allow chain relinking |
@@ -1984,7 +1979,8 @@ set_hint: | |||
1984 | } | 1979 | } |
1985 | 1980 | ||
1986 | bail: | 1981 | bail: |
1987 | mlog_exit(status); | 1982 | if (status) |
1983 | mlog_errno(status); | ||
1988 | return status; | 1984 | return status; |
1989 | } | 1985 | } |
1990 | 1986 | ||
@@ -2021,7 +2017,8 @@ int ocfs2_claim_metadata(handle_t *handle, | |||
2021 | *num_bits = res.sr_bits; | 2017 | *num_bits = res.sr_bits; |
2022 | status = 0; | 2018 | status = 0; |
2023 | bail: | 2019 | bail: |
2024 | mlog_exit(status); | 2020 | if (status) |
2021 | mlog_errno(status); | ||
2025 | return status; | 2022 | return status; |
2026 | } | 2023 | } |
2027 | 2024 | ||
@@ -2172,8 +2169,8 @@ int ocfs2_claim_new_inode_at_loc(handle_t *handle, | |||
2172 | goto out; | 2169 | goto out; |
2173 | } | 2170 | } |
2174 | 2171 | ||
2175 | mlog(0, "Allocated %u bits from suballocator %llu\n", res->sr_bits, | 2172 | trace_ocfs2_claim_new_inode_at_loc((unsigned long long)di_blkno, |
2176 | (unsigned long long)di_blkno); | 2173 | res->sr_bits); |
2177 | 2174 | ||
2178 | atomic_inc(&OCFS2_SB(ac->ac_inode->i_sb)->alloc_stats.bg_allocs); | 2175 | atomic_inc(&OCFS2_SB(ac->ac_inode->i_sb)->alloc_stats.bg_allocs); |
2179 | 2176 | ||
@@ -2201,8 +2198,6 @@ int ocfs2_claim_new_inode(handle_t *handle, | |||
2201 | int status; | 2198 | int status; |
2202 | struct ocfs2_suballoc_result res; | 2199 | struct ocfs2_suballoc_result res; |
2203 | 2200 | ||
2204 | mlog_entry_void(); | ||
2205 | |||
2206 | BUG_ON(!ac); | 2201 | BUG_ON(!ac); |
2207 | BUG_ON(ac->ac_bits_given != 0); | 2202 | BUG_ON(ac->ac_bits_given != 0); |
2208 | BUG_ON(ac->ac_bits_wanted != 1); | 2203 | BUG_ON(ac->ac_bits_wanted != 1); |
@@ -2230,7 +2225,8 @@ int ocfs2_claim_new_inode(handle_t *handle, | |||
2230 | ocfs2_save_inode_ac_group(dir, ac); | 2225 | ocfs2_save_inode_ac_group(dir, ac); |
2231 | status = 0; | 2226 | status = 0; |
2232 | bail: | 2227 | bail: |
2233 | mlog_exit(status); | 2228 | if (status) |
2229 | mlog_errno(status); | ||
2234 | return status; | 2230 | return status; |
2235 | } | 2231 | } |
2236 | 2232 | ||
@@ -2307,8 +2303,6 @@ int __ocfs2_claim_clusters(handle_t *handle, | |||
2307 | struct ocfs2_suballoc_result res = { .sr_blkno = 0, }; | 2303 | struct ocfs2_suballoc_result res = { .sr_blkno = 0, }; |
2308 | struct ocfs2_super *osb = OCFS2_SB(ac->ac_inode->i_sb); | 2304 | struct ocfs2_super *osb = OCFS2_SB(ac->ac_inode->i_sb); |
2309 | 2305 | ||
2310 | mlog_entry_void(); | ||
2311 | |||
2312 | BUG_ON(ac->ac_bits_given >= ac->ac_bits_wanted); | 2306 | BUG_ON(ac->ac_bits_given >= ac->ac_bits_wanted); |
2313 | 2307 | ||
2314 | BUG_ON(ac->ac_which != OCFS2_AC_USE_LOCAL | 2308 | BUG_ON(ac->ac_which != OCFS2_AC_USE_LOCAL |
@@ -2363,7 +2357,8 @@ int __ocfs2_claim_clusters(handle_t *handle, | |||
2363 | ac->ac_bits_given += *num_clusters; | 2357 | ac->ac_bits_given += *num_clusters; |
2364 | 2358 | ||
2365 | bail: | 2359 | bail: |
2366 | mlog_exit(status); | 2360 | if (status) |
2361 | mlog_errno(status); | ||
2367 | return status; | 2362 | return status; |
2368 | } | 2363 | } |
2369 | 2364 | ||
@@ -2392,13 +2387,11 @@ static int ocfs2_block_group_clear_bits(handle_t *handle, | |||
2392 | unsigned int tmp; | 2387 | unsigned int tmp; |
2393 | struct ocfs2_group_desc *undo_bg = NULL; | 2388 | struct ocfs2_group_desc *undo_bg = NULL; |
2394 | 2389 | ||
2395 | mlog_entry_void(); | ||
2396 | |||
2397 | /* The caller got this descriptor from | 2390 | /* The caller got this descriptor from |
2398 | * ocfs2_read_group_descriptor(). Any corruption is a code bug. */ | 2391 | * ocfs2_read_group_descriptor(). Any corruption is a code bug. */ |
2399 | BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); | 2392 | BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg)); |
2400 | 2393 | ||
2401 | mlog(0, "off = %u, num = %u\n", bit_off, num_bits); | 2394 | trace_ocfs2_block_group_clear_bits(bit_off, num_bits); |
2402 | 2395 | ||
2403 | BUG_ON(undo_fn && !ocfs2_is_cluster_bitmap(alloc_inode)); | 2396 | BUG_ON(undo_fn && !ocfs2_is_cluster_bitmap(alloc_inode)); |
2404 | status = ocfs2_journal_access_gd(handle, INODE_CACHE(alloc_inode), | 2397 | status = ocfs2_journal_access_gd(handle, INODE_CACHE(alloc_inode), |
@@ -2463,8 +2456,6 @@ static int _ocfs2_free_suballoc_bits(handle_t *handle, | |||
2463 | struct buffer_head *group_bh = NULL; | 2456 | struct buffer_head *group_bh = NULL; |
2464 | struct ocfs2_group_desc *group; | 2457 | struct ocfs2_group_desc *group; |
2465 | 2458 | ||
2466 | mlog_entry_void(); | ||
2467 | |||
2468 | /* The alloc_bh comes from ocfs2_free_dinode() or | 2459 | /* The alloc_bh comes from ocfs2_free_dinode() or |
2469 | * ocfs2_free_clusters(). The callers have all locked the | 2460 | * ocfs2_free_clusters(). The callers have all locked the |
2470 | * allocator and gotten alloc_bh from the lock call. This | 2461 | * allocator and gotten alloc_bh from the lock call. This |
@@ -2473,9 +2464,10 @@ static int _ocfs2_free_suballoc_bits(handle_t *handle, | |||
2473 | BUG_ON(!OCFS2_IS_VALID_DINODE(fe)); | 2464 | BUG_ON(!OCFS2_IS_VALID_DINODE(fe)); |
2474 | BUG_ON((count + start_bit) > ocfs2_bits_per_group(cl)); | 2465 | BUG_ON((count + start_bit) > ocfs2_bits_per_group(cl)); |
2475 | 2466 | ||
2476 | mlog(0, "%llu: freeing %u bits from group %llu, starting at %u\n", | 2467 | trace_ocfs2_free_suballoc_bits( |
2477 | (unsigned long long)OCFS2_I(alloc_inode)->ip_blkno, count, | 2468 | (unsigned long long)OCFS2_I(alloc_inode)->ip_blkno, |
2478 | (unsigned long long)bg_blkno, start_bit); | 2469 | (unsigned long long)bg_blkno, |
2470 | start_bit, count); | ||
2479 | 2471 | ||
2480 | status = ocfs2_read_group_descriptor(alloc_inode, fe, bg_blkno, | 2472 | status = ocfs2_read_group_descriptor(alloc_inode, fe, bg_blkno, |
2481 | &group_bh); | 2473 | &group_bh); |
@@ -2511,7 +2503,8 @@ static int _ocfs2_free_suballoc_bits(handle_t *handle, | |||
2511 | bail: | 2503 | bail: |
2512 | brelse(group_bh); | 2504 | brelse(group_bh); |
2513 | 2505 | ||
2514 | mlog_exit(status); | 2506 | if (status) |
2507 | mlog_errno(status); | ||
2515 | return status; | 2508 | return status; |
2516 | } | 2509 | } |
2517 | 2510 | ||
@@ -2556,11 +2549,8 @@ static int _ocfs2_free_clusters(handle_t *handle, | |||
2556 | 2549 | ||
2557 | /* You can't ever have a contiguous set of clusters | 2550 | /* You can't ever have a contiguous set of clusters |
2558 | * bigger than a block group bitmap so we never have to worry | 2551 | * bigger than a block group bitmap so we never have to worry |
2559 | * about looping on them. */ | 2552 | * about looping on them. |
2560 | 2553 | * This is expensive. We can safely remove once this stuff has | |
2561 | mlog_entry_void(); | ||
2562 | |||
2563 | /* This is expensive. We can safely remove once this stuff has | ||
2564 | * gotten tested really well. */ | 2554 | * gotten tested really well. */ |
2565 | BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb, ocfs2_blocks_to_clusters(bitmap_inode->i_sb, start_blk))); | 2555 | BUG_ON(start_blk != ocfs2_clusters_to_blocks(bitmap_inode->i_sb, ocfs2_blocks_to_clusters(bitmap_inode->i_sb, start_blk))); |
2566 | 2556 | ||
@@ -2569,10 +2559,9 @@ static int _ocfs2_free_clusters(handle_t *handle, | |||
2569 | ocfs2_block_to_cluster_group(bitmap_inode, start_blk, &bg_blkno, | 2559 | ocfs2_block_to_cluster_group(bitmap_inode, start_blk, &bg_blkno, |
2570 | &bg_start_bit); | 2560 | &bg_start_bit); |
2571 | 2561 | ||
2572 | mlog(0, "want to free %u clusters starting at block %llu\n", | 2562 | trace_ocfs2_free_clusters((unsigned long long)bg_blkno, |
2573 | num_clusters, (unsigned long long)start_blk); | 2563 | (unsigned long long)start_blk, |
2574 | mlog(0, "bg_blkno = %llu, bg_start_bit = %u\n", | 2564 | bg_start_bit, num_clusters); |
2575 | (unsigned long long)bg_blkno, bg_start_bit); | ||
2576 | 2565 | ||
2577 | status = _ocfs2_free_suballoc_bits(handle, bitmap_inode, bitmap_bh, | 2566 | status = _ocfs2_free_suballoc_bits(handle, bitmap_inode, bitmap_bh, |
2578 | bg_start_bit, bg_blkno, | 2567 | bg_start_bit, bg_blkno, |
@@ -2586,7 +2575,8 @@ static int _ocfs2_free_clusters(handle_t *handle, | |||
2586 | num_clusters); | 2575 | num_clusters); |
2587 | 2576 | ||
2588 | out: | 2577 | out: |
2589 | mlog_exit(status); | 2578 | if (status) |
2579 | mlog_errno(status); | ||
2590 | return status; | 2580 | return status; |
2591 | } | 2581 | } |
2592 | 2582 | ||
@@ -2756,7 +2746,7 @@ static int ocfs2_get_suballoc_slot_bit(struct ocfs2_super *osb, u64 blkno, | |||
2756 | struct buffer_head *inode_bh = NULL; | 2746 | struct buffer_head *inode_bh = NULL; |
2757 | struct ocfs2_dinode *inode_fe; | 2747 | struct ocfs2_dinode *inode_fe; |
2758 | 2748 | ||
2759 | mlog_entry("blkno: %llu\n", (unsigned long long)blkno); | 2749 | trace_ocfs2_get_suballoc_slot_bit((unsigned long long)blkno); |
2760 | 2750 | ||
2761 | /* dirty read disk */ | 2751 | /* dirty read disk */ |
2762 | status = ocfs2_read_blocks_sync(osb, blkno, 1, &inode_bh); | 2752 | status = ocfs2_read_blocks_sync(osb, blkno, 1, &inode_bh); |
@@ -2793,7 +2783,8 @@ static int ocfs2_get_suballoc_slot_bit(struct ocfs2_super *osb, u64 blkno, | |||
2793 | bail: | 2783 | bail: |
2794 | brelse(inode_bh); | 2784 | brelse(inode_bh); |
2795 | 2785 | ||
2796 | mlog_exit(status); | 2786 | if (status) |
2787 | mlog_errno(status); | ||
2797 | return status; | 2788 | return status; |
2798 | } | 2789 | } |
2799 | 2790 | ||
@@ -2816,8 +2807,8 @@ static int ocfs2_test_suballoc_bit(struct ocfs2_super *osb, | |||
2816 | u64 bg_blkno; | 2807 | u64 bg_blkno; |
2817 | int status; | 2808 | int status; |
2818 | 2809 | ||
2819 | mlog_entry("blkno: %llu bit: %u\n", (unsigned long long)blkno, | 2810 | trace_ocfs2_test_suballoc_bit((unsigned long long)blkno, |
2820 | (unsigned int)bit); | 2811 | (unsigned int)bit); |
2821 | 2812 | ||
2822 | alloc_di = (struct ocfs2_dinode *)alloc_bh->b_data; | 2813 | alloc_di = (struct ocfs2_dinode *)alloc_bh->b_data; |
2823 | if ((bit + 1) > ocfs2_bits_per_group(&alloc_di->id2.i_chain)) { | 2814 | if ((bit + 1) > ocfs2_bits_per_group(&alloc_di->id2.i_chain)) { |
@@ -2844,7 +2835,8 @@ static int ocfs2_test_suballoc_bit(struct ocfs2_super *osb, | |||
2844 | bail: | 2835 | bail: |
2845 | brelse(group_bh); | 2836 | brelse(group_bh); |
2846 | 2837 | ||
2847 | mlog_exit(status); | 2838 | if (status) |
2839 | mlog_errno(status); | ||
2848 | return status; | 2840 | return status; |
2849 | } | 2841 | } |
2850 | 2842 | ||
@@ -2869,7 +2861,7 @@ int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res) | |||
2869 | struct inode *inode_alloc_inode; | 2861 | struct inode *inode_alloc_inode; |
2870 | struct buffer_head *alloc_bh = NULL; | 2862 | struct buffer_head *alloc_bh = NULL; |
2871 | 2863 | ||
2872 | mlog_entry("blkno: %llu", (unsigned long long)blkno); | 2864 | trace_ocfs2_test_inode_bit((unsigned long long)blkno); |
2873 | 2865 | ||
2874 | status = ocfs2_get_suballoc_slot_bit(osb, blkno, &suballoc_slot, | 2866 | status = ocfs2_get_suballoc_slot_bit(osb, blkno, &suballoc_slot, |
2875 | &group_blkno, &suballoc_bit); | 2867 | &group_blkno, &suballoc_bit); |
@@ -2910,6 +2902,7 @@ int ocfs2_test_inode_bit(struct ocfs2_super *osb, u64 blkno, int *res) | |||
2910 | iput(inode_alloc_inode); | 2902 | iput(inode_alloc_inode); |
2911 | brelse(alloc_bh); | 2903 | brelse(alloc_bh); |
2912 | bail: | 2904 | bail: |
2913 | mlog_exit(status); | 2905 | if (status) |
2906 | mlog_errno(status); | ||
2914 | return status; | 2907 | return status; |
2915 | } | 2908 | } |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 38f986d2447e..0e4083987d2b 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -42,7 +42,9 @@ | |||
42 | #include <linux/seq_file.h> | 42 | #include <linux/seq_file.h> |
43 | #include <linux/quotaops.h> | 43 | #include <linux/quotaops.h> |
44 | 44 | ||
45 | #define MLOG_MASK_PREFIX ML_SUPER | 45 | #define CREATE_TRACE_POINTS |
46 | #include "ocfs2_trace.h" | ||
47 | |||
46 | #include <cluster/masklog.h> | 48 | #include <cluster/masklog.h> |
47 | 49 | ||
48 | #include "ocfs2.h" | 50 | #include "ocfs2.h" |
@@ -441,8 +443,6 @@ static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb) | |||
441 | int status = 0; | 443 | int status = 0; |
442 | int i; | 444 | int i; |
443 | 445 | ||
444 | mlog_entry_void(); | ||
445 | |||
446 | new = ocfs2_iget(osb, osb->root_blkno, OCFS2_FI_FLAG_SYSFILE, 0); | 446 | new = ocfs2_iget(osb, osb->root_blkno, OCFS2_FI_FLAG_SYSFILE, 0); |
447 | if (IS_ERR(new)) { | 447 | if (IS_ERR(new)) { |
448 | status = PTR_ERR(new); | 448 | status = PTR_ERR(new); |
@@ -478,7 +478,8 @@ static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb) | |||
478 | } | 478 | } |
479 | 479 | ||
480 | bail: | 480 | bail: |
481 | mlog_exit(status); | 481 | if (status) |
482 | mlog_errno(status); | ||
482 | return status; | 483 | return status; |
483 | } | 484 | } |
484 | 485 | ||
@@ -488,8 +489,6 @@ static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb) | |||
488 | int status = 0; | 489 | int status = 0; |
489 | int i; | 490 | int i; |
490 | 491 | ||
491 | mlog_entry_void(); | ||
492 | |||
493 | for (i = OCFS2_LAST_GLOBAL_SYSTEM_INODE + 1; | 492 | for (i = OCFS2_LAST_GLOBAL_SYSTEM_INODE + 1; |
494 | i < NUM_SYSTEM_INODES; | 493 | i < NUM_SYSTEM_INODES; |
495 | i++) { | 494 | i++) { |
@@ -508,7 +507,8 @@ static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb) | |||
508 | } | 507 | } |
509 | 508 | ||
510 | bail: | 509 | bail: |
511 | mlog_exit(status); | 510 | if (status) |
511 | mlog_errno(status); | ||
512 | return status; | 512 | return status; |
513 | } | 513 | } |
514 | 514 | ||
@@ -517,8 +517,6 @@ static void ocfs2_release_system_inodes(struct ocfs2_super *osb) | |||
517 | int i; | 517 | int i; |
518 | struct inode *inode; | 518 | struct inode *inode; |
519 | 519 | ||
520 | mlog_entry_void(); | ||
521 | |||
522 | for (i = 0; i < NUM_GLOBAL_SYSTEM_INODES; i++) { | 520 | for (i = 0; i < NUM_GLOBAL_SYSTEM_INODES; i++) { |
523 | inode = osb->global_system_inodes[i]; | 521 | inode = osb->global_system_inodes[i]; |
524 | if (inode) { | 522 | if (inode) { |
@@ -540,7 +538,7 @@ static void ocfs2_release_system_inodes(struct ocfs2_super *osb) | |||
540 | } | 538 | } |
541 | 539 | ||
542 | if (!osb->local_system_inodes) | 540 | if (!osb->local_system_inodes) |
543 | goto out; | 541 | return; |
544 | 542 | ||
545 | for (i = 0; i < NUM_LOCAL_SYSTEM_INODES * osb->max_slots; i++) { | 543 | for (i = 0; i < NUM_LOCAL_SYSTEM_INODES * osb->max_slots; i++) { |
546 | if (osb->local_system_inodes[i]) { | 544 | if (osb->local_system_inodes[i]) { |
@@ -551,9 +549,6 @@ static void ocfs2_release_system_inodes(struct ocfs2_super *osb) | |||
551 | 549 | ||
552 | kfree(osb->local_system_inodes); | 550 | kfree(osb->local_system_inodes); |
553 | osb->local_system_inodes = NULL; | 551 | osb->local_system_inodes = NULL; |
554 | |||
555 | out: | ||
556 | mlog_exit(0); | ||
557 | } | 552 | } |
558 | 553 | ||
559 | /* We're allocating fs objects, use GFP_NOFS */ | 554 | /* We're allocating fs objects, use GFP_NOFS */ |
@@ -684,12 +679,9 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data) | |||
684 | } | 679 | } |
685 | 680 | ||
686 | if (*flags & MS_RDONLY) { | 681 | if (*flags & MS_RDONLY) { |
687 | mlog(0, "Going to ro mode.\n"); | ||
688 | sb->s_flags |= MS_RDONLY; | 682 | sb->s_flags |= MS_RDONLY; |
689 | osb->osb_flags |= OCFS2_OSB_SOFT_RO; | 683 | osb->osb_flags |= OCFS2_OSB_SOFT_RO; |
690 | } else { | 684 | } else { |
691 | mlog(0, "Making ro filesystem writeable.\n"); | ||
692 | |||
693 | if (osb->osb_flags & OCFS2_OSB_ERROR_FS) { | 685 | if (osb->osb_flags & OCFS2_OSB_ERROR_FS) { |
694 | mlog(ML_ERROR, "Cannot remount RDWR " | 686 | mlog(ML_ERROR, "Cannot remount RDWR " |
695 | "filesystem due to previous errors.\n"); | 687 | "filesystem due to previous errors.\n"); |
@@ -707,6 +699,7 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data) | |||
707 | sb->s_flags &= ~MS_RDONLY; | 699 | sb->s_flags &= ~MS_RDONLY; |
708 | osb->osb_flags &= ~OCFS2_OSB_SOFT_RO; | 700 | osb->osb_flags &= ~OCFS2_OSB_SOFT_RO; |
709 | } | 701 | } |
702 | trace_ocfs2_remount(sb->s_flags, osb->osb_flags, *flags); | ||
710 | unlock_osb: | 703 | unlock_osb: |
711 | spin_unlock(&osb->osb_lock); | 704 | spin_unlock(&osb->osb_lock); |
712 | /* Enable quota accounting after remounting RW */ | 705 | /* Enable quota accounting after remounting RW */ |
@@ -1032,7 +1025,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
1032 | char nodestr[8]; | 1025 | char nodestr[8]; |
1033 | struct ocfs2_blockcheck_stats stats; | 1026 | struct ocfs2_blockcheck_stats stats; |
1034 | 1027 | ||
1035 | mlog_entry("%p, %p, %i", sb, data, silent); | 1028 | trace_ocfs2_fill_super(sb, data, silent); |
1036 | 1029 | ||
1037 | if (!ocfs2_parse_options(sb, data, &parsed_options, 0)) { | 1030 | if (!ocfs2_parse_options(sb, data, &parsed_options, 0)) { |
1038 | status = -EINVAL; | 1031 | status = -EINVAL; |
@@ -1208,7 +1201,6 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
1208 | mlog_errno(status); | 1201 | mlog_errno(status); |
1209 | atomic_set(&osb->vol_state, VOLUME_DISABLED); | 1202 | atomic_set(&osb->vol_state, VOLUME_DISABLED); |
1210 | wake_up(&osb->osb_mount_event); | 1203 | wake_up(&osb->osb_mount_event); |
1211 | mlog_exit(status); | ||
1212 | return status; | 1204 | return status; |
1213 | } | 1205 | } |
1214 | } | 1206 | } |
@@ -1222,7 +1214,6 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
1222 | /* Start this when the mount is almost sure of being successful */ | 1214 | /* Start this when the mount is almost sure of being successful */ |
1223 | ocfs2_orphan_scan_start(osb); | 1215 | ocfs2_orphan_scan_start(osb); |
1224 | 1216 | ||
1225 | mlog_exit(status); | ||
1226 | return status; | 1217 | return status; |
1227 | 1218 | ||
1228 | read_super_error: | 1219 | read_super_error: |
@@ -1237,7 +1228,8 @@ read_super_error: | |||
1237 | ocfs2_dismount_volume(sb, 1); | 1228 | ocfs2_dismount_volume(sb, 1); |
1238 | } | 1229 | } |
1239 | 1230 | ||
1240 | mlog_exit(status); | 1231 | if (status) |
1232 | mlog_errno(status); | ||
1241 | return status; | 1233 | return status; |
1242 | } | 1234 | } |
1243 | 1235 | ||
@@ -1316,12 +1308,11 @@ static int ocfs2_parse_options(struct super_block *sb, | |||
1316 | struct mount_options *mopt, | 1308 | struct mount_options *mopt, |
1317 | int is_remount) | 1309 | int is_remount) |
1318 | { | 1310 | { |
1319 | int status; | 1311 | int status, user_stack = 0; |
1320 | char *p; | 1312 | char *p; |
1321 | u32 tmp; | 1313 | u32 tmp; |
1322 | 1314 | ||
1323 | mlog_entry("remount: %d, options: \"%s\"\n", is_remount, | 1315 | trace_ocfs2_parse_options(is_remount, options ? options : "(none)"); |
1324 | options ? options : "(none)"); | ||
1325 | 1316 | ||
1326 | mopt->commit_interval = 0; | 1317 | mopt->commit_interval = 0; |
1327 | mopt->mount_opt = OCFS2_MOUNT_NOINTR; | 1318 | mopt->mount_opt = OCFS2_MOUNT_NOINTR; |
@@ -1459,6 +1450,15 @@ static int ocfs2_parse_options(struct super_block *sb, | |||
1459 | memcpy(mopt->cluster_stack, args[0].from, | 1450 | memcpy(mopt->cluster_stack, args[0].from, |
1460 | OCFS2_STACK_LABEL_LEN); | 1451 | OCFS2_STACK_LABEL_LEN); |
1461 | mopt->cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0'; | 1452 | mopt->cluster_stack[OCFS2_STACK_LABEL_LEN] = '\0'; |
1453 | /* | ||
1454 | * Open code the memcmp here as we don't have | ||
1455 | * an osb to pass to | ||
1456 | * ocfs2_userspace_stack(). | ||
1457 | */ | ||
1458 | if (memcmp(mopt->cluster_stack, | ||
1459 | OCFS2_CLASSIC_CLUSTER_STACK, | ||
1460 | OCFS2_STACK_LABEL_LEN)) | ||
1461 | user_stack = 1; | ||
1462 | break; | 1462 | break; |
1463 | case Opt_inode64: | 1463 | case Opt_inode64: |
1464 | mopt->mount_opt |= OCFS2_MOUNT_INODE64; | 1464 | mopt->mount_opt |= OCFS2_MOUNT_INODE64; |
@@ -1514,19 +1514,21 @@ static int ocfs2_parse_options(struct super_block *sb, | |||
1514 | } | 1514 | } |
1515 | } | 1515 | } |
1516 | 1516 | ||
1517 | /* Ensure only one heartbeat mode */ | 1517 | if (user_stack == 0) { |
1518 | tmp = mopt->mount_opt & (OCFS2_MOUNT_HB_LOCAL | OCFS2_MOUNT_HB_GLOBAL | | 1518 | /* Ensure only one heartbeat mode */ |
1519 | OCFS2_MOUNT_HB_NONE); | 1519 | tmp = mopt->mount_opt & (OCFS2_MOUNT_HB_LOCAL | |
1520 | if (hweight32(tmp) != 1) { | 1520 | OCFS2_MOUNT_HB_GLOBAL | |
1521 | mlog(ML_ERROR, "Invalid heartbeat mount options\n"); | 1521 | OCFS2_MOUNT_HB_NONE); |
1522 | status = 0; | 1522 | if (hweight32(tmp) != 1) { |
1523 | goto bail; | 1523 | mlog(ML_ERROR, "Invalid heartbeat mount options\n"); |
1524 | status = 0; | ||
1525 | goto bail; | ||
1526 | } | ||
1524 | } | 1527 | } |
1525 | 1528 | ||
1526 | status = 1; | 1529 | status = 1; |
1527 | 1530 | ||
1528 | bail: | 1531 | bail: |
1529 | mlog_exit(status); | ||
1530 | return status; | 1532 | return status; |
1531 | } | 1533 | } |
1532 | 1534 | ||
@@ -1617,8 +1619,6 @@ static int __init ocfs2_init(void) | |||
1617 | { | 1619 | { |
1618 | int status; | 1620 | int status; |
1619 | 1621 | ||
1620 | mlog_entry_void(); | ||
1621 | |||
1622 | ocfs2_print_version(); | 1622 | ocfs2_print_version(); |
1623 | 1623 | ||
1624 | status = init_ocfs2_uptodate_cache(); | 1624 | status = init_ocfs2_uptodate_cache(); |
@@ -1657,10 +1657,9 @@ leave: | |||
1657 | ocfs2_quota_shutdown(); | 1657 | ocfs2_quota_shutdown(); |
1658 | ocfs2_free_mem_caches(); | 1658 | ocfs2_free_mem_caches(); |
1659 | exit_ocfs2_uptodate_cache(); | 1659 | exit_ocfs2_uptodate_cache(); |
1660 | mlog_errno(status); | ||
1660 | } | 1661 | } |
1661 | 1662 | ||
1662 | mlog_exit(status); | ||
1663 | |||
1664 | if (status >= 0) { | 1663 | if (status >= 0) { |
1665 | return register_filesystem(&ocfs2_fs_type); | 1664 | return register_filesystem(&ocfs2_fs_type); |
1666 | } else | 1665 | } else |
@@ -1669,8 +1668,6 @@ leave: | |||
1669 | 1668 | ||
1670 | static void __exit ocfs2_exit(void) | 1669 | static void __exit ocfs2_exit(void) |
1671 | { | 1670 | { |
1672 | mlog_entry_void(); | ||
1673 | |||
1674 | ocfs2_quota_shutdown(); | 1671 | ocfs2_quota_shutdown(); |
1675 | 1672 | ||
1676 | if (ocfs2_wq) { | 1673 | if (ocfs2_wq) { |
@@ -1687,18 +1684,14 @@ static void __exit ocfs2_exit(void) | |||
1687 | unregister_filesystem(&ocfs2_fs_type); | 1684 | unregister_filesystem(&ocfs2_fs_type); |
1688 | 1685 | ||
1689 | exit_ocfs2_uptodate_cache(); | 1686 | exit_ocfs2_uptodate_cache(); |
1690 | |||
1691 | mlog_exit_void(); | ||
1692 | } | 1687 | } |
1693 | 1688 | ||
1694 | static void ocfs2_put_super(struct super_block *sb) | 1689 | static void ocfs2_put_super(struct super_block *sb) |
1695 | { | 1690 | { |
1696 | mlog_entry("(0x%p)\n", sb); | 1691 | trace_ocfs2_put_super(sb); |
1697 | 1692 | ||
1698 | ocfs2_sync_blockdev(sb); | 1693 | ocfs2_sync_blockdev(sb); |
1699 | ocfs2_dismount_volume(sb, 0); | 1694 | ocfs2_dismount_volume(sb, 0); |
1700 | |||
1701 | mlog_exit_void(); | ||
1702 | } | 1695 | } |
1703 | 1696 | ||
1704 | static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf) | 1697 | static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf) |
@@ -1710,7 +1703,7 @@ static int ocfs2_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
1710 | struct buffer_head *bh = NULL; | 1703 | struct buffer_head *bh = NULL; |
1711 | struct inode *inode = NULL; | 1704 | struct inode *inode = NULL; |
1712 | 1705 | ||
1713 | mlog_entry("(%p, %p)\n", dentry->d_sb, buf); | 1706 | trace_ocfs2_statfs(dentry->d_sb, buf); |
1714 | 1707 | ||
1715 | osb = OCFS2_SB(dentry->d_sb); | 1708 | osb = OCFS2_SB(dentry->d_sb); |
1716 | 1709 | ||
@@ -1757,7 +1750,8 @@ bail: | |||
1757 | if (inode) | 1750 | if (inode) |
1758 | iput(inode); | 1751 | iput(inode); |
1759 | 1752 | ||
1760 | mlog_exit(status); | 1753 | if (status) |
1754 | mlog_errno(status); | ||
1761 | 1755 | ||
1762 | return status; | 1756 | return status; |
1763 | } | 1757 | } |
@@ -1877,8 +1871,6 @@ static int ocfs2_mount_volume(struct super_block *sb) | |||
1877 | int unlock_super = 0; | 1871 | int unlock_super = 0; |
1878 | struct ocfs2_super *osb = OCFS2_SB(sb); | 1872 | struct ocfs2_super *osb = OCFS2_SB(sb); |
1879 | 1873 | ||
1880 | mlog_entry_void(); | ||
1881 | |||
1882 | if (ocfs2_is_hard_readonly(osb)) | 1874 | if (ocfs2_is_hard_readonly(osb)) |
1883 | goto leave; | 1875 | goto leave; |
1884 | 1876 | ||
@@ -1923,7 +1915,6 @@ leave: | |||
1923 | if (unlock_super) | 1915 | if (unlock_super) |
1924 | ocfs2_super_unlock(osb, 1); | 1916 | ocfs2_super_unlock(osb, 1); |
1925 | 1917 | ||
1926 | mlog_exit(status); | ||
1927 | return status; | 1918 | return status; |
1928 | } | 1919 | } |
1929 | 1920 | ||
@@ -1933,7 +1924,7 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err) | |||
1933 | struct ocfs2_super *osb = NULL; | 1924 | struct ocfs2_super *osb = NULL; |
1934 | char nodestr[8]; | 1925 | char nodestr[8]; |
1935 | 1926 | ||
1936 | mlog_entry("(0x%p)\n", sb); | 1927 | trace_ocfs2_dismount_volume(sb); |
1937 | 1928 | ||
1938 | BUG_ON(!sb); | 1929 | BUG_ON(!sb); |
1939 | osb = OCFS2_SB(sb); | 1930 | osb = OCFS2_SB(sb); |
@@ -2085,8 +2076,6 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
2085 | struct ocfs2_super *osb; | 2076 | struct ocfs2_super *osb; |
2086 | u64 total_blocks; | 2077 | u64 total_blocks; |
2087 | 2078 | ||
2088 | mlog_entry_void(); | ||
2089 | |||
2090 | osb = kzalloc(sizeof(struct ocfs2_super), GFP_KERNEL); | 2079 | osb = kzalloc(sizeof(struct ocfs2_super), GFP_KERNEL); |
2091 | if (!osb) { | 2080 | if (!osb) { |
2092 | status = -ENOMEM; | 2081 | status = -ENOMEM; |
@@ -2150,7 +2139,6 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
2150 | status = -EINVAL; | 2139 | status = -EINVAL; |
2151 | goto bail; | 2140 | goto bail; |
2152 | } | 2141 | } |
2153 | mlog(0, "max_slots for this device: %u\n", osb->max_slots); | ||
2154 | 2142 | ||
2155 | ocfs2_orphan_scan_init(osb); | 2143 | ocfs2_orphan_scan_init(osb); |
2156 | 2144 | ||
@@ -2289,7 +2277,6 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
2289 | osb->s_clustersize_bits = | 2277 | osb->s_clustersize_bits = |
2290 | le32_to_cpu(di->id2.i_super.s_clustersize_bits); | 2278 | le32_to_cpu(di->id2.i_super.s_clustersize_bits); |
2291 | osb->s_clustersize = 1 << osb->s_clustersize_bits; | 2279 | osb->s_clustersize = 1 << osb->s_clustersize_bits; |
2292 | mlog(0, "clusterbits=%d\n", osb->s_clustersize_bits); | ||
2293 | 2280 | ||
2294 | if (osb->s_clustersize < OCFS2_MIN_CLUSTERSIZE || | 2281 | if (osb->s_clustersize < OCFS2_MIN_CLUSTERSIZE || |
2295 | osb->s_clustersize > OCFS2_MAX_CLUSTERSIZE) { | 2282 | osb->s_clustersize > OCFS2_MAX_CLUSTERSIZE) { |
@@ -2328,11 +2315,10 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
2328 | le64_to_cpu(di->id2.i_super.s_first_cluster_group); | 2315 | le64_to_cpu(di->id2.i_super.s_first_cluster_group); |
2329 | osb->fs_generation = le32_to_cpu(di->i_fs_generation); | 2316 | osb->fs_generation = le32_to_cpu(di->i_fs_generation); |
2330 | osb->uuid_hash = le32_to_cpu(di->id2.i_super.s_uuid_hash); | 2317 | osb->uuid_hash = le32_to_cpu(di->id2.i_super.s_uuid_hash); |
2331 | mlog(0, "vol_label: %s\n", osb->vol_label); | 2318 | trace_ocfs2_initialize_super(osb->vol_label, osb->uuid_str, |
2332 | mlog(0, "uuid: %s\n", osb->uuid_str); | 2319 | (unsigned long long)osb->root_blkno, |
2333 | mlog(0, "root_blkno=%llu, system_dir_blkno=%llu\n", | 2320 | (unsigned long long)osb->system_dir_blkno, |
2334 | (unsigned long long)osb->root_blkno, | 2321 | osb->s_clustersize_bits); |
2335 | (unsigned long long)osb->system_dir_blkno); | ||
2336 | 2322 | ||
2337 | osb->osb_dlm_debug = ocfs2_new_dlm_debug(); | 2323 | osb->osb_dlm_debug = ocfs2_new_dlm_debug(); |
2338 | if (!osb->osb_dlm_debug) { | 2324 | if (!osb->osb_dlm_debug) { |
@@ -2375,7 +2361,6 @@ static int ocfs2_initialize_super(struct super_block *sb, | |||
2375 | } | 2361 | } |
2376 | 2362 | ||
2377 | bail: | 2363 | bail: |
2378 | mlog_exit(status); | ||
2379 | return status; | 2364 | return status; |
2380 | } | 2365 | } |
2381 | 2366 | ||
@@ -2391,8 +2376,6 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *di, | |||
2391 | { | 2376 | { |
2392 | int status = -EAGAIN; | 2377 | int status = -EAGAIN; |
2393 | 2378 | ||
2394 | mlog_entry_void(); | ||
2395 | |||
2396 | if (memcmp(di->i_signature, OCFS2_SUPER_BLOCK_SIGNATURE, | 2379 | if (memcmp(di->i_signature, OCFS2_SUPER_BLOCK_SIGNATURE, |
2397 | strlen(OCFS2_SUPER_BLOCK_SIGNATURE)) == 0) { | 2380 | strlen(OCFS2_SUPER_BLOCK_SIGNATURE)) == 0) { |
2398 | /* We have to do a raw check of the feature here */ | 2381 | /* We have to do a raw check of the feature here */ |
@@ -2447,7 +2430,8 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *di, | |||
2447 | } | 2430 | } |
2448 | 2431 | ||
2449 | out: | 2432 | out: |
2450 | mlog_exit(status); | 2433 | if (status && status != -EAGAIN) |
2434 | mlog_errno(status); | ||
2451 | return status; | 2435 | return status; |
2452 | } | 2436 | } |
2453 | 2437 | ||
@@ -2460,8 +2444,6 @@ static int ocfs2_check_volume(struct ocfs2_super *osb) | |||
2460 | * recover | 2444 | * recover |
2461 | * ourselves. */ | 2445 | * ourselves. */ |
2462 | 2446 | ||
2463 | mlog_entry_void(); | ||
2464 | |||
2465 | /* Init our journal object. */ | 2447 | /* Init our journal object. */ |
2466 | status = ocfs2_journal_init(osb->journal, &dirty); | 2448 | status = ocfs2_journal_init(osb->journal, &dirty); |
2467 | if (status < 0) { | 2449 | if (status < 0) { |
@@ -2511,8 +2493,6 @@ static int ocfs2_check_volume(struct ocfs2_super *osb) | |||
2511 | * ourselves as mounted. */ | 2493 | * ourselves as mounted. */ |
2512 | } | 2494 | } |
2513 | 2495 | ||
2514 | mlog(0, "Journal loaded.\n"); | ||
2515 | |||
2516 | status = ocfs2_load_local_alloc(osb); | 2496 | status = ocfs2_load_local_alloc(osb); |
2517 | if (status < 0) { | 2497 | if (status < 0) { |
2518 | mlog_errno(status); | 2498 | mlog_errno(status); |
@@ -2544,7 +2524,8 @@ finally: | |||
2544 | if (local_alloc) | 2524 | if (local_alloc) |
2545 | kfree(local_alloc); | 2525 | kfree(local_alloc); |
2546 | 2526 | ||
2547 | mlog_exit(status); | 2527 | if (status) |
2528 | mlog_errno(status); | ||
2548 | return status; | 2529 | return status; |
2549 | } | 2530 | } |
2550 | 2531 | ||
@@ -2556,8 +2537,6 @@ finally: | |||
2556 | */ | 2537 | */ |
2557 | static void ocfs2_delete_osb(struct ocfs2_super *osb) | 2538 | static void ocfs2_delete_osb(struct ocfs2_super *osb) |
2558 | { | 2539 | { |
2559 | mlog_entry_void(); | ||
2560 | |||
2561 | /* This function assumes that the caller has the main osb resource */ | 2540 | /* This function assumes that the caller has the main osb resource */ |
2562 | 2541 | ||
2563 | ocfs2_free_slot_info(osb); | 2542 | ocfs2_free_slot_info(osb); |
@@ -2575,8 +2554,6 @@ static void ocfs2_delete_osb(struct ocfs2_super *osb) | |||
2575 | kfree(osb->uuid_str); | 2554 | kfree(osb->uuid_str); |
2576 | ocfs2_put_dlm_debug(osb->osb_dlm_debug); | 2555 | ocfs2_put_dlm_debug(osb->osb_dlm_debug); |
2577 | memset(osb, 0, sizeof(struct ocfs2_super)); | 2556 | memset(osb, 0, sizeof(struct ocfs2_super)); |
2578 | |||
2579 | mlog_exit_void(); | ||
2580 | } | 2557 | } |
2581 | 2558 | ||
2582 | /* Put OCFS2 into a readonly state, or (if the user specifies it), | 2559 | /* Put OCFS2 into a readonly state, or (if the user specifies it), |
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c index 9975457c981f..5d22872e2bb3 100644 --- a/fs/ocfs2/symlink.c +++ b/fs/ocfs2/symlink.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <linux/pagemap.h> | 40 | #include <linux/pagemap.h> |
41 | #include <linux/namei.h> | 41 | #include <linux/namei.h> |
42 | 42 | ||
43 | #define MLOG_MASK_PREFIX ML_NAMEI | ||
44 | #include <cluster/masklog.h> | 43 | #include <cluster/masklog.h> |
45 | 44 | ||
46 | #include "ocfs2.h" | 45 | #include "ocfs2.h" |
@@ -62,8 +61,6 @@ static char *ocfs2_fast_symlink_getlink(struct inode *inode, | |||
62 | char *link = NULL; | 61 | char *link = NULL; |
63 | struct ocfs2_dinode *fe; | 62 | struct ocfs2_dinode *fe; |
64 | 63 | ||
65 | mlog_entry_void(); | ||
66 | |||
67 | status = ocfs2_read_inode_block(inode, bh); | 64 | status = ocfs2_read_inode_block(inode, bh); |
68 | if (status < 0) { | 65 | if (status < 0) { |
69 | mlog_errno(status); | 66 | mlog_errno(status); |
@@ -74,7 +71,6 @@ static char *ocfs2_fast_symlink_getlink(struct inode *inode, | |||
74 | fe = (struct ocfs2_dinode *) (*bh)->b_data; | 71 | fe = (struct ocfs2_dinode *) (*bh)->b_data; |
75 | link = (char *) fe->id2.i_symlink; | 72 | link = (char *) fe->id2.i_symlink; |
76 | bail: | 73 | bail: |
77 | mlog_exit(status); | ||
78 | 74 | ||
79 | return link; | 75 | return link; |
80 | } | 76 | } |
@@ -88,8 +84,6 @@ static int ocfs2_readlink(struct dentry *dentry, | |||
88 | struct buffer_head *bh = NULL; | 84 | struct buffer_head *bh = NULL; |
89 | struct inode *inode = dentry->d_inode; | 85 | struct inode *inode = dentry->d_inode; |
90 | 86 | ||
91 | mlog_entry_void(); | ||
92 | |||
93 | link = ocfs2_fast_symlink_getlink(inode, &bh); | 87 | link = ocfs2_fast_symlink_getlink(inode, &bh); |
94 | if (IS_ERR(link)) { | 88 | if (IS_ERR(link)) { |
95 | ret = PTR_ERR(link); | 89 | ret = PTR_ERR(link); |
@@ -104,7 +98,8 @@ static int ocfs2_readlink(struct dentry *dentry, | |||
104 | 98 | ||
105 | brelse(bh); | 99 | brelse(bh); |
106 | out: | 100 | out: |
107 | mlog_exit(ret); | 101 | if (ret < 0) |
102 | mlog_errno(ret); | ||
108 | return ret; | 103 | return ret; |
109 | } | 104 | } |
110 | 105 | ||
@@ -117,8 +112,6 @@ static void *ocfs2_fast_follow_link(struct dentry *dentry, | |||
117 | struct inode *inode = dentry->d_inode; | 112 | struct inode *inode = dentry->d_inode; |
118 | struct buffer_head *bh = NULL; | 113 | struct buffer_head *bh = NULL; |
119 | 114 | ||
120 | mlog_entry_void(); | ||
121 | |||
122 | BUG_ON(!ocfs2_inode_is_fast_symlink(inode)); | 115 | BUG_ON(!ocfs2_inode_is_fast_symlink(inode)); |
123 | target = ocfs2_fast_symlink_getlink(inode, &bh); | 116 | target = ocfs2_fast_symlink_getlink(inode, &bh); |
124 | if (IS_ERR(target)) { | 117 | if (IS_ERR(target)) { |
@@ -142,7 +135,8 @@ bail: | |||
142 | nd_set_link(nd, status ? ERR_PTR(status) : link); | 135 | nd_set_link(nd, status ? ERR_PTR(status) : link); |
143 | brelse(bh); | 136 | brelse(bh); |
144 | 137 | ||
145 | mlog_exit(status); | 138 | if (status) |
139 | mlog_errno(status); | ||
146 | return NULL; | 140 | return NULL; |
147 | } | 141 | } |
148 | 142 | ||
diff --git a/fs/ocfs2/sysfile.c b/fs/ocfs2/sysfile.c index 902efb23b6a6..3d635f4bbb20 100644 --- a/fs/ocfs2/sysfile.c +++ b/fs/ocfs2/sysfile.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/types.h> | 27 | #include <linux/types.h> |
28 | #include <linux/highmem.h> | 28 | #include <linux/highmem.h> |
29 | 29 | ||
30 | #define MLOG_MASK_PREFIX ML_INODE | ||
31 | #include <cluster/masklog.h> | 30 | #include <cluster/masklog.h> |
32 | 31 | ||
33 | #include "ocfs2.h" | 32 | #include "ocfs2.h" |
diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c index a0a120e82b97..52eaf33d346f 100644 --- a/fs/ocfs2/uptodate.c +++ b/fs/ocfs2/uptodate.c | |||
@@ -54,14 +54,13 @@ | |||
54 | #include <linux/buffer_head.h> | 54 | #include <linux/buffer_head.h> |
55 | #include <linux/rbtree.h> | 55 | #include <linux/rbtree.h> |
56 | 56 | ||
57 | #define MLOG_MASK_PREFIX ML_UPTODATE | ||
58 | |||
59 | #include <cluster/masklog.h> | 57 | #include <cluster/masklog.h> |
60 | 58 | ||
61 | #include "ocfs2.h" | 59 | #include "ocfs2.h" |
62 | 60 | ||
63 | #include "inode.h" | 61 | #include "inode.h" |
64 | #include "uptodate.h" | 62 | #include "uptodate.h" |
63 | #include "ocfs2_trace.h" | ||
65 | 64 | ||
66 | struct ocfs2_meta_cache_item { | 65 | struct ocfs2_meta_cache_item { |
67 | struct rb_node c_node; | 66 | struct rb_node c_node; |
@@ -152,8 +151,8 @@ static unsigned int ocfs2_purge_copied_metadata_tree(struct rb_root *root) | |||
152 | while ((node = rb_last(root)) != NULL) { | 151 | while ((node = rb_last(root)) != NULL) { |
153 | item = rb_entry(node, struct ocfs2_meta_cache_item, c_node); | 152 | item = rb_entry(node, struct ocfs2_meta_cache_item, c_node); |
154 | 153 | ||
155 | mlog(0, "Purge item %llu\n", | 154 | trace_ocfs2_purge_copied_metadata_tree( |
156 | (unsigned long long) item->c_block); | 155 | (unsigned long long) item->c_block); |
157 | 156 | ||
158 | rb_erase(&item->c_node, root); | 157 | rb_erase(&item->c_node, root); |
159 | kmem_cache_free(ocfs2_uptodate_cachep, item); | 158 | kmem_cache_free(ocfs2_uptodate_cachep, item); |
@@ -180,9 +179,9 @@ void ocfs2_metadata_cache_purge(struct ocfs2_caching_info *ci) | |||
180 | tree = !(ci->ci_flags & OCFS2_CACHE_FL_INLINE); | 179 | tree = !(ci->ci_flags & OCFS2_CACHE_FL_INLINE); |
181 | to_purge = ci->ci_num_cached; | 180 | to_purge = ci->ci_num_cached; |
182 | 181 | ||
183 | mlog(0, "Purge %u %s items from Owner %llu\n", to_purge, | 182 | trace_ocfs2_metadata_cache_purge( |
184 | tree ? "array" : "tree", | 183 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
185 | (unsigned long long)ocfs2_metadata_cache_owner(ci)); | 184 | to_purge, tree); |
186 | 185 | ||
187 | /* If we're a tree, save off the root so that we can safely | 186 | /* If we're a tree, save off the root so that we can safely |
188 | * initialize the cache. We do the work to free tree members | 187 | * initialize the cache. We do the work to free tree members |
@@ -249,10 +248,10 @@ static int ocfs2_buffer_cached(struct ocfs2_caching_info *ci, | |||
249 | 248 | ||
250 | ocfs2_metadata_cache_lock(ci); | 249 | ocfs2_metadata_cache_lock(ci); |
251 | 250 | ||
252 | mlog(0, "Owner %llu, query block %llu (inline = %u)\n", | 251 | trace_ocfs2_buffer_cached_begin( |
253 | (unsigned long long)ocfs2_metadata_cache_owner(ci), | 252 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
254 | (unsigned long long) bh->b_blocknr, | 253 | (unsigned long long) bh->b_blocknr, |
255 | !!(ci->ci_flags & OCFS2_CACHE_FL_INLINE)); | 254 | !!(ci->ci_flags & OCFS2_CACHE_FL_INLINE)); |
256 | 255 | ||
257 | if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) | 256 | if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) |
258 | index = ocfs2_search_cache_array(ci, bh->b_blocknr); | 257 | index = ocfs2_search_cache_array(ci, bh->b_blocknr); |
@@ -261,7 +260,7 @@ static int ocfs2_buffer_cached(struct ocfs2_caching_info *ci, | |||
261 | 260 | ||
262 | ocfs2_metadata_cache_unlock(ci); | 261 | ocfs2_metadata_cache_unlock(ci); |
263 | 262 | ||
264 | mlog(0, "index = %d, item = %p\n", index, item); | 263 | trace_ocfs2_buffer_cached_end(index, item); |
265 | 264 | ||
266 | return (index != -1) || (item != NULL); | 265 | return (index != -1) || (item != NULL); |
267 | } | 266 | } |
@@ -306,8 +305,9 @@ static void ocfs2_append_cache_array(struct ocfs2_caching_info *ci, | |||
306 | { | 305 | { |
307 | BUG_ON(ci->ci_num_cached >= OCFS2_CACHE_INFO_MAX_ARRAY); | 306 | BUG_ON(ci->ci_num_cached >= OCFS2_CACHE_INFO_MAX_ARRAY); |
308 | 307 | ||
309 | mlog(0, "block %llu takes position %u\n", (unsigned long long) block, | 308 | trace_ocfs2_append_cache_array( |
310 | ci->ci_num_cached); | 309 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
310 | (unsigned long long)block, ci->ci_num_cached); | ||
311 | 311 | ||
312 | ci->ci_cache.ci_array[ci->ci_num_cached] = block; | 312 | ci->ci_cache.ci_array[ci->ci_num_cached] = block; |
313 | ci->ci_num_cached++; | 313 | ci->ci_num_cached++; |
@@ -324,8 +324,9 @@ static void __ocfs2_insert_cache_tree(struct ocfs2_caching_info *ci, | |||
324 | struct rb_node **p = &ci->ci_cache.ci_tree.rb_node; | 324 | struct rb_node **p = &ci->ci_cache.ci_tree.rb_node; |
325 | struct ocfs2_meta_cache_item *tmp; | 325 | struct ocfs2_meta_cache_item *tmp; |
326 | 326 | ||
327 | mlog(0, "Insert block %llu num = %u\n", (unsigned long long) block, | 327 | trace_ocfs2_insert_cache_tree( |
328 | ci->ci_num_cached); | 328 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
329 | (unsigned long long)block, ci->ci_num_cached); | ||
329 | 330 | ||
330 | while(*p) { | 331 | while(*p) { |
331 | parent = *p; | 332 | parent = *p; |
@@ -389,9 +390,9 @@ static void ocfs2_expand_cache(struct ocfs2_caching_info *ci, | |||
389 | tree[i] = NULL; | 390 | tree[i] = NULL; |
390 | } | 391 | } |
391 | 392 | ||
392 | mlog(0, "Expanded %llu to a tree cache: flags 0x%x, num = %u\n", | 393 | trace_ocfs2_expand_cache( |
393 | (unsigned long long)ocfs2_metadata_cache_owner(ci), | 394 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
394 | ci->ci_flags, ci->ci_num_cached); | 395 | ci->ci_flags, ci->ci_num_cached); |
395 | } | 396 | } |
396 | 397 | ||
397 | /* Slow path function - memory allocation is necessary. See the | 398 | /* Slow path function - memory allocation is necessary. See the |
@@ -405,9 +406,9 @@ static void __ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci, | |||
405 | struct ocfs2_meta_cache_item *tree[OCFS2_CACHE_INFO_MAX_ARRAY] = | 406 | struct ocfs2_meta_cache_item *tree[OCFS2_CACHE_INFO_MAX_ARRAY] = |
406 | { NULL, }; | 407 | { NULL, }; |
407 | 408 | ||
408 | mlog(0, "Owner %llu, block %llu, expand = %d\n", | 409 | trace_ocfs2_set_buffer_uptodate( |
409 | (unsigned long long)ocfs2_metadata_cache_owner(ci), | 410 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
410 | (unsigned long long)block, expand_tree); | 411 | (unsigned long long)block, expand_tree); |
411 | 412 | ||
412 | new = kmem_cache_alloc(ocfs2_uptodate_cachep, GFP_NOFS); | 413 | new = kmem_cache_alloc(ocfs2_uptodate_cachep, GFP_NOFS); |
413 | if (!new) { | 414 | if (!new) { |
@@ -433,7 +434,6 @@ static void __ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci, | |||
433 | 434 | ||
434 | ocfs2_metadata_cache_lock(ci); | 435 | ocfs2_metadata_cache_lock(ci); |
435 | if (ocfs2_insert_can_use_array(ci)) { | 436 | if (ocfs2_insert_can_use_array(ci)) { |
436 | mlog(0, "Someone cleared the tree underneath us\n"); | ||
437 | /* Ok, items were removed from the cache in between | 437 | /* Ok, items were removed from the cache in between |
438 | * locks. Detect this and revert back to the fast path */ | 438 | * locks. Detect this and revert back to the fast path */ |
439 | ocfs2_append_cache_array(ci, block); | 439 | ocfs2_append_cache_array(ci, block); |
@@ -490,9 +490,9 @@ void ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci, | |||
490 | if (ocfs2_buffer_cached(ci, bh)) | 490 | if (ocfs2_buffer_cached(ci, bh)) |
491 | return; | 491 | return; |
492 | 492 | ||
493 | mlog(0, "Owner %llu, inserting block %llu\n", | 493 | trace_ocfs2_set_buffer_uptodate_begin( |
494 | (unsigned long long)ocfs2_metadata_cache_owner(ci), | 494 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
495 | (unsigned long long)bh->b_blocknr); | 495 | (unsigned long long)bh->b_blocknr); |
496 | 496 | ||
497 | /* No need to recheck under spinlock - insertion is guarded by | 497 | /* No need to recheck under spinlock - insertion is guarded by |
498 | * co_io_lock() */ | 498 | * co_io_lock() */ |
@@ -542,8 +542,9 @@ static void ocfs2_remove_metadata_array(struct ocfs2_caching_info *ci, | |||
542 | BUG_ON(index >= ci->ci_num_cached); | 542 | BUG_ON(index >= ci->ci_num_cached); |
543 | BUG_ON(!ci->ci_num_cached); | 543 | BUG_ON(!ci->ci_num_cached); |
544 | 544 | ||
545 | mlog(0, "remove index %d (num_cached = %u\n", index, | 545 | trace_ocfs2_remove_metadata_array( |
546 | ci->ci_num_cached); | 546 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
547 | index, ci->ci_num_cached); | ||
547 | 548 | ||
548 | ci->ci_num_cached--; | 549 | ci->ci_num_cached--; |
549 | 550 | ||
@@ -559,8 +560,9 @@ static void ocfs2_remove_metadata_array(struct ocfs2_caching_info *ci, | |||
559 | static void ocfs2_remove_metadata_tree(struct ocfs2_caching_info *ci, | 560 | static void ocfs2_remove_metadata_tree(struct ocfs2_caching_info *ci, |
560 | struct ocfs2_meta_cache_item *item) | 561 | struct ocfs2_meta_cache_item *item) |
561 | { | 562 | { |
562 | mlog(0, "remove block %llu from tree\n", | 563 | trace_ocfs2_remove_metadata_tree( |
563 | (unsigned long long) item->c_block); | 564 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
565 | (unsigned long long)item->c_block); | ||
564 | 566 | ||
565 | rb_erase(&item->c_node, &ci->ci_cache.ci_tree); | 567 | rb_erase(&item->c_node, &ci->ci_cache.ci_tree); |
566 | ci->ci_num_cached--; | 568 | ci->ci_num_cached--; |
@@ -573,10 +575,10 @@ static void ocfs2_remove_block_from_cache(struct ocfs2_caching_info *ci, | |||
573 | struct ocfs2_meta_cache_item *item = NULL; | 575 | struct ocfs2_meta_cache_item *item = NULL; |
574 | 576 | ||
575 | ocfs2_metadata_cache_lock(ci); | 577 | ocfs2_metadata_cache_lock(ci); |
576 | mlog(0, "Owner %llu, remove %llu, items = %u, array = %u\n", | 578 | trace_ocfs2_remove_block_from_cache( |
577 | (unsigned long long)ocfs2_metadata_cache_owner(ci), | 579 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
578 | (unsigned long long) block, ci->ci_num_cached, | 580 | (unsigned long long) block, ci->ci_num_cached, |
579 | ci->ci_flags & OCFS2_CACHE_FL_INLINE); | 581 | ci->ci_flags); |
580 | 582 | ||
581 | if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) { | 583 | if (ci->ci_flags & OCFS2_CACHE_FL_INLINE) { |
582 | index = ocfs2_search_cache_array(ci, block); | 584 | index = ocfs2_search_cache_array(ci, block); |
@@ -626,9 +628,6 @@ int __init init_ocfs2_uptodate_cache(void) | |||
626 | if (!ocfs2_uptodate_cachep) | 628 | if (!ocfs2_uptodate_cachep) |
627 | return -ENOMEM; | 629 | return -ENOMEM; |
628 | 630 | ||
629 | mlog(0, "%u inlined cache items per inode.\n", | ||
630 | OCFS2_CACHE_INFO_MAX_ARRAY); | ||
631 | |||
632 | return 0; | 631 | return 0; |
633 | } | 632 | } |
634 | 633 | ||
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 67cd43914641..52e3dadd3642 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/string.h> | 37 | #include <linux/string.h> |
38 | #include <linux/security.h> | 38 | #include <linux/security.h> |
39 | 39 | ||
40 | #define MLOG_MASK_PREFIX ML_XATTR | ||
41 | #include <cluster/masklog.h> | 40 | #include <cluster/masklog.h> |
42 | 41 | ||
43 | #include "ocfs2.h" | 42 | #include "ocfs2.h" |
@@ -57,6 +56,7 @@ | |||
57 | #include "xattr.h" | 56 | #include "xattr.h" |
58 | #include "refcounttree.h" | 57 | #include "refcounttree.h" |
59 | #include "acl.h" | 58 | #include "acl.h" |
59 | #include "ocfs2_trace.h" | ||
60 | 60 | ||
61 | struct ocfs2_xattr_def_value_root { | 61 | struct ocfs2_xattr_def_value_root { |
62 | struct ocfs2_xattr_value_root xv; | 62 | struct ocfs2_xattr_value_root xv; |
@@ -474,8 +474,7 @@ static int ocfs2_validate_xattr_block(struct super_block *sb, | |||
474 | struct ocfs2_xattr_block *xb = | 474 | struct ocfs2_xattr_block *xb = |
475 | (struct ocfs2_xattr_block *)bh->b_data; | 475 | (struct ocfs2_xattr_block *)bh->b_data; |
476 | 476 | ||
477 | mlog(0, "Validating xattr block %llu\n", | 477 | trace_ocfs2_validate_xattr_block((unsigned long long)bh->b_blocknr); |
478 | (unsigned long long)bh->b_blocknr); | ||
479 | 478 | ||
480 | BUG_ON(!buffer_uptodate(bh)); | 479 | BUG_ON(!buffer_uptodate(bh)); |
481 | 480 | ||
@@ -715,11 +714,11 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode, | |||
715 | u32 prev_clusters, logical_start = le32_to_cpu(vb->vb_xv->xr_clusters); | 714 | u32 prev_clusters, logical_start = le32_to_cpu(vb->vb_xv->xr_clusters); |
716 | struct ocfs2_extent_tree et; | 715 | struct ocfs2_extent_tree et; |
717 | 716 | ||
718 | mlog(0, "(clusters_to_add for xattr= %u)\n", clusters_to_add); | ||
719 | |||
720 | ocfs2_init_xattr_value_extent_tree(&et, INODE_CACHE(inode), vb); | 717 | ocfs2_init_xattr_value_extent_tree(&et, INODE_CACHE(inode), vb); |
721 | 718 | ||
722 | while (clusters_to_add) { | 719 | while (clusters_to_add) { |
720 | trace_ocfs2_xattr_extend_allocation(clusters_to_add); | ||
721 | |||
723 | status = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh, | 722 | status = vb->vb_access(handle, INODE_CACHE(inode), vb->vb_bh, |
724 | OCFS2_JOURNAL_ACCESS_WRITE); | 723 | OCFS2_JOURNAL_ACCESS_WRITE); |
725 | if (status < 0) { | 724 | if (status < 0) { |
@@ -754,8 +753,6 @@ static int ocfs2_xattr_extend_allocation(struct inode *inode, | |||
754 | */ | 753 | */ |
755 | BUG_ON(why == RESTART_META); | 754 | BUG_ON(why == RESTART_META); |
756 | 755 | ||
757 | mlog(0, "restarting xattr value extension for %u" | ||
758 | " clusters,.\n", clusters_to_add); | ||
759 | credits = ocfs2_calc_extend_credits(inode->i_sb, | 756 | credits = ocfs2_calc_extend_credits(inode->i_sb, |
760 | &vb->vb_xv->xr_list, | 757 | &vb->vb_xv->xr_list, |
761 | clusters_to_add); | 758 | clusters_to_add); |
@@ -3246,8 +3243,8 @@ static int ocfs2_init_xattr_set_ctxt(struct inode *inode, | |||
3246 | } | 3243 | } |
3247 | 3244 | ||
3248 | meta_add += extra_meta; | 3245 | meta_add += extra_meta; |
3249 | mlog(0, "Set xattr %s, reserve meta blocks = %d, clusters = %d, " | 3246 | trace_ocfs2_init_xattr_set_ctxt(xi->xi_name, meta_add, |
3250 | "credits = %d\n", xi->xi_name, meta_add, clusters_add, *credits); | 3247 | clusters_add, *credits); |
3251 | 3248 | ||
3252 | if (meta_add) { | 3249 | if (meta_add) { |
3253 | ret = ocfs2_reserve_new_metadata_blocks(osb, meta_add, | 3250 | ret = ocfs2_reserve_new_metadata_blocks(osb, meta_add, |
@@ -3887,8 +3884,10 @@ static int ocfs2_xattr_bucket_find(struct inode *inode, | |||
3887 | 3884 | ||
3888 | if (found) { | 3885 | if (found) { |
3889 | xs->here = &xs->header->xh_entries[index]; | 3886 | xs->here = &xs->header->xh_entries[index]; |
3890 | mlog(0, "find xattr %s in bucket %llu, entry = %u\n", name, | 3887 | trace_ocfs2_xattr_bucket_find(OCFS2_I(inode)->ip_blkno, |
3891 | (unsigned long long)bucket_blkno(xs->bucket), index); | 3888 | name, name_index, name_hash, |
3889 | (unsigned long long)bucket_blkno(xs->bucket), | ||
3890 | index); | ||
3892 | } else | 3891 | } else |
3893 | ret = -ENODATA; | 3892 | ret = -ENODATA; |
3894 | 3893 | ||
@@ -3915,8 +3914,10 @@ static int ocfs2_xattr_index_block_find(struct inode *inode, | |||
3915 | if (le16_to_cpu(el->l_next_free_rec) == 0) | 3914 | if (le16_to_cpu(el->l_next_free_rec) == 0) |
3916 | return -ENODATA; | 3915 | return -ENODATA; |
3917 | 3916 | ||
3918 | mlog(0, "find xattr %s, hash = %u, index = %d in xattr tree\n", | 3917 | trace_ocfs2_xattr_index_block_find(OCFS2_I(inode)->ip_blkno, |
3919 | name, name_hash, name_index); | 3918 | name, name_index, name_hash, |
3919 | (unsigned long long)root_bh->b_blocknr, | ||
3920 | -1); | ||
3920 | 3921 | ||
3921 | ret = ocfs2_xattr_get_rec(inode, name_hash, &p_blkno, &first_hash, | 3922 | ret = ocfs2_xattr_get_rec(inode, name_hash, &p_blkno, &first_hash, |
3922 | &num_clusters, el); | 3923 | &num_clusters, el); |
@@ -3927,9 +3928,10 @@ static int ocfs2_xattr_index_block_find(struct inode *inode, | |||
3927 | 3928 | ||
3928 | BUG_ON(p_blkno == 0 || num_clusters == 0 || first_hash > name_hash); | 3929 | BUG_ON(p_blkno == 0 || num_clusters == 0 || first_hash > name_hash); |
3929 | 3930 | ||
3930 | mlog(0, "find xattr extent rec %u clusters from %llu, the first hash " | 3931 | trace_ocfs2_xattr_index_block_find_rec(OCFS2_I(inode)->ip_blkno, |
3931 | "in the rec is %u\n", num_clusters, (unsigned long long)p_blkno, | 3932 | name, name_index, first_hash, |
3932 | first_hash); | 3933 | (unsigned long long)p_blkno, |
3934 | num_clusters); | ||
3933 | 3935 | ||
3934 | ret = ocfs2_xattr_bucket_find(inode, name_index, name, name_hash, | 3936 | ret = ocfs2_xattr_bucket_find(inode, name_index, name, name_hash, |
3935 | p_blkno, first_hash, num_clusters, xs); | 3937 | p_blkno, first_hash, num_clusters, xs); |
@@ -3955,8 +3957,9 @@ static int ocfs2_iterate_xattr_buckets(struct inode *inode, | |||
3955 | return -ENOMEM; | 3957 | return -ENOMEM; |
3956 | } | 3958 | } |
3957 | 3959 | ||
3958 | mlog(0, "iterating xattr buckets in %u clusters starting from %llu\n", | 3960 | trace_ocfs2_iterate_xattr_buckets( |
3959 | clusters, (unsigned long long)blkno); | 3961 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
3962 | (unsigned long long)blkno, clusters); | ||
3960 | 3963 | ||
3961 | for (i = 0; i < num_buckets; i++, blkno += bucket->bu_blocks) { | 3964 | for (i = 0; i < num_buckets; i++, blkno += bucket->bu_blocks) { |
3962 | ret = ocfs2_read_xattr_bucket(bucket, blkno); | 3965 | ret = ocfs2_read_xattr_bucket(bucket, blkno); |
@@ -3972,8 +3975,7 @@ static int ocfs2_iterate_xattr_buckets(struct inode *inode, | |||
3972 | if (i == 0) | 3975 | if (i == 0) |
3973 | num_buckets = le16_to_cpu(bucket_xh(bucket)->xh_num_buckets); | 3976 | num_buckets = le16_to_cpu(bucket_xh(bucket)->xh_num_buckets); |
3974 | 3977 | ||
3975 | mlog(0, "iterating xattr bucket %llu, first hash %u\n", | 3978 | trace_ocfs2_iterate_xattr_bucket((unsigned long long)blkno, |
3976 | (unsigned long long)blkno, | ||
3977 | le32_to_cpu(bucket_xh(bucket)->xh_entries[0].xe_name_hash)); | 3979 | le32_to_cpu(bucket_xh(bucket)->xh_entries[0].xe_name_hash)); |
3978 | if (func) { | 3980 | if (func) { |
3979 | ret = func(inode, bucket, para); | 3981 | ret = func(inode, bucket, para); |
@@ -4173,9 +4175,9 @@ static void ocfs2_cp_xattr_block_to_bucket(struct inode *inode, | |||
4173 | char *src = xb_bh->b_data; | 4175 | char *src = xb_bh->b_data; |
4174 | char *target = bucket_block(bucket, blks - 1); | 4176 | char *target = bucket_block(bucket, blks - 1); |
4175 | 4177 | ||
4176 | mlog(0, "cp xattr from block %llu to bucket %llu\n", | 4178 | trace_ocfs2_cp_xattr_block_to_bucket_begin( |
4177 | (unsigned long long)xb_bh->b_blocknr, | 4179 | (unsigned long long)xb_bh->b_blocknr, |
4178 | (unsigned long long)bucket_blkno(bucket)); | 4180 | (unsigned long long)bucket_blkno(bucket)); |
4179 | 4181 | ||
4180 | for (i = 0; i < blks; i++) | 4182 | for (i = 0; i < blks; i++) |
4181 | memset(bucket_block(bucket, i), 0, blocksize); | 4183 | memset(bucket_block(bucket, i), 0, blocksize); |
@@ -4211,8 +4213,7 @@ static void ocfs2_cp_xattr_block_to_bucket(struct inode *inode, | |||
4211 | for (i = 0; i < count; i++) | 4213 | for (i = 0; i < count; i++) |
4212 | le16_add_cpu(&xh->xh_entries[i].xe_name_offset, off_change); | 4214 | le16_add_cpu(&xh->xh_entries[i].xe_name_offset, off_change); |
4213 | 4215 | ||
4214 | mlog(0, "copy entry: start = %u, size = %u, offset_change = %u\n", | 4216 | trace_ocfs2_cp_xattr_block_to_bucket_end(offset, size, off_change); |
4215 | offset, size, off_change); | ||
4216 | 4217 | ||
4217 | sort(target + offset, count, sizeof(struct ocfs2_xattr_entry), | 4218 | sort(target + offset, count, sizeof(struct ocfs2_xattr_entry), |
4218 | cmp_xe, swap_xe); | 4219 | cmp_xe, swap_xe); |
@@ -4261,8 +4262,8 @@ static int ocfs2_xattr_create_index_block(struct inode *inode, | |||
4261 | struct ocfs2_xattr_tree_root *xr; | 4262 | struct ocfs2_xattr_tree_root *xr; |
4262 | u16 xb_flags = le16_to_cpu(xb->xb_flags); | 4263 | u16 xb_flags = le16_to_cpu(xb->xb_flags); |
4263 | 4264 | ||
4264 | mlog(0, "create xattr index block for %llu\n", | 4265 | trace_ocfs2_xattr_create_index_block_begin( |
4265 | (unsigned long long)xb_bh->b_blocknr); | 4266 | (unsigned long long)xb_bh->b_blocknr); |
4266 | 4267 | ||
4267 | BUG_ON(xb_flags & OCFS2_XATTR_INDEXED); | 4268 | BUG_ON(xb_flags & OCFS2_XATTR_INDEXED); |
4268 | BUG_ON(!xs->bucket); | 4269 | BUG_ON(!xs->bucket); |
@@ -4295,8 +4296,7 @@ static int ocfs2_xattr_create_index_block(struct inode *inode, | |||
4295 | */ | 4296 | */ |
4296 | blkno = ocfs2_clusters_to_blocks(inode->i_sb, bit_off); | 4297 | blkno = ocfs2_clusters_to_blocks(inode->i_sb, bit_off); |
4297 | 4298 | ||
4298 | mlog(0, "allocate 1 cluster from %llu to xattr block\n", | 4299 | trace_ocfs2_xattr_create_index_block((unsigned long long)blkno); |
4299 | (unsigned long long)blkno); | ||
4300 | 4300 | ||
4301 | ret = ocfs2_init_xattr_bucket(xs->bucket, blkno); | 4301 | ret = ocfs2_init_xattr_bucket(xs->bucket, blkno); |
4302 | if (ret) { | 4302 | if (ret) { |
@@ -4400,8 +4400,7 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode, | |||
4400 | entries = (char *)xh->xh_entries; | 4400 | entries = (char *)xh->xh_entries; |
4401 | xh_free_start = le16_to_cpu(xh->xh_free_start); | 4401 | xh_free_start = le16_to_cpu(xh->xh_free_start); |
4402 | 4402 | ||
4403 | mlog(0, "adjust xattr bucket in %llu, count = %u, " | 4403 | trace_ocfs2_defrag_xattr_bucket( |
4404 | "xh_free_start = %u, xh_name_value_len = %u.\n", | ||
4405 | (unsigned long long)blkno, le16_to_cpu(xh->xh_count), | 4404 | (unsigned long long)blkno, le16_to_cpu(xh->xh_count), |
4406 | xh_free_start, le16_to_cpu(xh->xh_name_value_len)); | 4405 | xh_free_start, le16_to_cpu(xh->xh_name_value_len)); |
4407 | 4406 | ||
@@ -4503,8 +4502,9 @@ static int ocfs2_mv_xattr_bucket_cross_cluster(struct inode *inode, | |||
4503 | BUG_ON(le16_to_cpu(bucket_xh(first)->xh_num_buckets) < num_buckets); | 4502 | BUG_ON(le16_to_cpu(bucket_xh(first)->xh_num_buckets) < num_buckets); |
4504 | BUG_ON(OCFS2_XATTR_BUCKET_SIZE == OCFS2_SB(sb)->s_clustersize); | 4503 | BUG_ON(OCFS2_XATTR_BUCKET_SIZE == OCFS2_SB(sb)->s_clustersize); |
4505 | 4504 | ||
4506 | mlog(0, "move half of xattrs in cluster %llu to %llu\n", | 4505 | trace_ocfs2_mv_xattr_bucket_cross_cluster( |
4507 | (unsigned long long)last_cluster_blkno, (unsigned long long)new_blkno); | 4506 | (unsigned long long)last_cluster_blkno, |
4507 | (unsigned long long)new_blkno); | ||
4508 | 4508 | ||
4509 | ret = ocfs2_mv_xattr_buckets(inode, handle, bucket_blkno(first), | 4509 | ret = ocfs2_mv_xattr_buckets(inode, handle, bucket_blkno(first), |
4510 | last_cluster_blkno, new_blkno, | 4510 | last_cluster_blkno, new_blkno, |
@@ -4614,8 +4614,8 @@ static int ocfs2_divide_xattr_bucket(struct inode *inode, | |||
4614 | struct ocfs2_xattr_entry *xe; | 4614 | struct ocfs2_xattr_entry *xe; |
4615 | int blocksize = inode->i_sb->s_blocksize; | 4615 | int blocksize = inode->i_sb->s_blocksize; |
4616 | 4616 | ||
4617 | mlog(0, "move some of xattrs from bucket %llu to %llu\n", | 4617 | trace_ocfs2_divide_xattr_bucket_begin((unsigned long long)blk, |
4618 | (unsigned long long)blk, (unsigned long long)new_blk); | 4618 | (unsigned long long)new_blk); |
4619 | 4619 | ||
4620 | s_bucket = ocfs2_xattr_bucket_new(inode); | 4620 | s_bucket = ocfs2_xattr_bucket_new(inode); |
4621 | t_bucket = ocfs2_xattr_bucket_new(inode); | 4621 | t_bucket = ocfs2_xattr_bucket_new(inode); |
@@ -4714,9 +4714,9 @@ static int ocfs2_divide_xattr_bucket(struct inode *inode, | |||
4714 | */ | 4714 | */ |
4715 | xe = &xh->xh_entries[start]; | 4715 | xe = &xh->xh_entries[start]; |
4716 | len = sizeof(struct ocfs2_xattr_entry) * (count - start); | 4716 | len = sizeof(struct ocfs2_xattr_entry) * (count - start); |
4717 | mlog(0, "mv xattr entry len %d from %d to %d\n", len, | 4717 | trace_ocfs2_divide_xattr_bucket_move(len, |
4718 | (int)((char *)xe - (char *)xh), | 4718 | (int)((char *)xe - (char *)xh), |
4719 | (int)((char *)xh->xh_entries - (char *)xh)); | 4719 | (int)((char *)xh->xh_entries - (char *)xh)); |
4720 | memmove((char *)xh->xh_entries, (char *)xe, len); | 4720 | memmove((char *)xh->xh_entries, (char *)xe, len); |
4721 | xe = &xh->xh_entries[count - start]; | 4721 | xe = &xh->xh_entries[count - start]; |
4722 | len = sizeof(struct ocfs2_xattr_entry) * start; | 4722 | len = sizeof(struct ocfs2_xattr_entry) * start; |
@@ -4788,9 +4788,9 @@ static int ocfs2_cp_xattr_bucket(struct inode *inode, | |||
4788 | 4788 | ||
4789 | BUG_ON(s_blkno == t_blkno); | 4789 | BUG_ON(s_blkno == t_blkno); |
4790 | 4790 | ||
4791 | mlog(0, "cp bucket %llu to %llu, target is %d\n", | 4791 | trace_ocfs2_cp_xattr_bucket((unsigned long long)s_blkno, |
4792 | (unsigned long long)s_blkno, (unsigned long long)t_blkno, | 4792 | (unsigned long long)t_blkno, |
4793 | t_is_new); | 4793 | t_is_new); |
4794 | 4794 | ||
4795 | s_bucket = ocfs2_xattr_bucket_new(inode); | 4795 | s_bucket = ocfs2_xattr_bucket_new(inode); |
4796 | t_bucket = ocfs2_xattr_bucket_new(inode); | 4796 | t_bucket = ocfs2_xattr_bucket_new(inode); |
@@ -4862,8 +4862,8 @@ static int ocfs2_mv_xattr_buckets(struct inode *inode, handle_t *handle, | |||
4862 | int num_buckets = ocfs2_xattr_buckets_per_cluster(osb); | 4862 | int num_buckets = ocfs2_xattr_buckets_per_cluster(osb); |
4863 | struct ocfs2_xattr_bucket *old_first, *new_first; | 4863 | struct ocfs2_xattr_bucket *old_first, *new_first; |
4864 | 4864 | ||
4865 | mlog(0, "mv xattrs from cluster %llu to %llu\n", | 4865 | trace_ocfs2_mv_xattr_buckets((unsigned long long)last_blk, |
4866 | (unsigned long long)last_blk, (unsigned long long)to_blk); | 4866 | (unsigned long long)to_blk); |
4867 | 4867 | ||
4868 | BUG_ON(start_bucket >= num_buckets); | 4868 | BUG_ON(start_bucket >= num_buckets); |
4869 | if (start_bucket) { | 4869 | if (start_bucket) { |
@@ -5013,9 +5013,9 @@ static int ocfs2_adjust_xattr_cross_cluster(struct inode *inode, | |||
5013 | { | 5013 | { |
5014 | int ret; | 5014 | int ret; |
5015 | 5015 | ||
5016 | mlog(0, "adjust xattrs from cluster %llu len %u to %llu\n", | 5016 | trace_ocfs2_adjust_xattr_cross_cluster( |
5017 | (unsigned long long)bucket_blkno(first), prev_clusters, | 5017 | (unsigned long long)bucket_blkno(first), |
5018 | (unsigned long long)new_blk); | 5018 | (unsigned long long)new_blk, prev_clusters); |
5019 | 5019 | ||
5020 | if (ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode->i_sb)) > 1) { | 5020 | if (ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode->i_sb)) > 1) { |
5021 | ret = ocfs2_mv_xattr_bucket_cross_cluster(inode, | 5021 | ret = ocfs2_mv_xattr_bucket_cross_cluster(inode, |
@@ -5088,10 +5088,10 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode, | |||
5088 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 5088 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
5089 | struct ocfs2_extent_tree et; | 5089 | struct ocfs2_extent_tree et; |
5090 | 5090 | ||
5091 | mlog(0, "Add new xattr cluster for %llu, previous xattr hash = %u, " | 5091 | trace_ocfs2_add_new_xattr_cluster_begin( |
5092 | "previous xattr blkno = %llu\n", | 5092 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
5093 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | 5093 | (unsigned long long)bucket_blkno(first), |
5094 | prev_cpos, (unsigned long long)bucket_blkno(first)); | 5094 | prev_cpos, prev_clusters); |
5095 | 5095 | ||
5096 | ocfs2_init_xattr_tree_extent_tree(&et, INODE_CACHE(inode), root_bh); | 5096 | ocfs2_init_xattr_tree_extent_tree(&et, INODE_CACHE(inode), root_bh); |
5097 | 5097 | ||
@@ -5113,8 +5113,7 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode, | |||
5113 | BUG_ON(num_bits > clusters_to_add); | 5113 | BUG_ON(num_bits > clusters_to_add); |
5114 | 5114 | ||
5115 | block = ocfs2_clusters_to_blocks(osb->sb, bit_off); | 5115 | block = ocfs2_clusters_to_blocks(osb->sb, bit_off); |
5116 | mlog(0, "Allocating %u clusters at block %u for xattr in inode %llu\n", | 5116 | trace_ocfs2_add_new_xattr_cluster((unsigned long long)block, num_bits); |
5117 | num_bits, bit_off, (unsigned long long)OCFS2_I(inode)->ip_blkno); | ||
5118 | 5117 | ||
5119 | if (bucket_blkno(first) + (prev_clusters * bpc) == block && | 5118 | if (bucket_blkno(first) + (prev_clusters * bpc) == block && |
5120 | (prev_clusters + num_bits) << osb->s_clustersize_bits <= | 5119 | (prev_clusters + num_bits) << osb->s_clustersize_bits <= |
@@ -5130,8 +5129,6 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode, | |||
5130 | */ | 5129 | */ |
5131 | v_start = prev_cpos + prev_clusters; | 5130 | v_start = prev_cpos + prev_clusters; |
5132 | *num_clusters = prev_clusters + num_bits; | 5131 | *num_clusters = prev_clusters + num_bits; |
5133 | mlog(0, "Add contiguous %u clusters to previous extent rec.\n", | ||
5134 | num_bits); | ||
5135 | } else { | 5132 | } else { |
5136 | ret = ocfs2_adjust_xattr_cross_cluster(inode, | 5133 | ret = ocfs2_adjust_xattr_cross_cluster(inode, |
5137 | handle, | 5134 | handle, |
@@ -5147,8 +5144,8 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode, | |||
5147 | } | 5144 | } |
5148 | } | 5145 | } |
5149 | 5146 | ||
5150 | mlog(0, "Insert %u clusters at block %llu for xattr at %u\n", | 5147 | trace_ocfs2_add_new_xattr_cluster_insert((unsigned long long)block, |
5151 | num_bits, (unsigned long long)block, v_start); | 5148 | v_start, num_bits); |
5152 | ret = ocfs2_insert_extent(handle, &et, v_start, block, | 5149 | ret = ocfs2_insert_extent(handle, &et, v_start, block, |
5153 | num_bits, 0, ctxt->meta_ac); | 5150 | num_bits, 0, ctxt->meta_ac); |
5154 | if (ret < 0) { | 5151 | if (ret < 0) { |
@@ -5183,9 +5180,9 @@ static int ocfs2_extend_xattr_bucket(struct inode *inode, | |||
5183 | u64 end_blk; | 5180 | u64 end_blk; |
5184 | u16 new_bucket = le16_to_cpu(bucket_xh(first)->xh_num_buckets); | 5181 | u16 new_bucket = le16_to_cpu(bucket_xh(first)->xh_num_buckets); |
5185 | 5182 | ||
5186 | mlog(0, "extend xattr bucket in %llu, xattr extend rec starting " | 5183 | trace_ocfs2_extend_xattr_bucket((unsigned long long)target_blk, |
5187 | "from %llu, len = %u\n", (unsigned long long)target_blk, | 5184 | (unsigned long long)bucket_blkno(first), |
5188 | (unsigned long long)bucket_blkno(first), num_clusters); | 5185 | num_clusters, new_bucket); |
5189 | 5186 | ||
5190 | /* The extent must have room for an additional bucket */ | 5187 | /* The extent must have room for an additional bucket */ |
5191 | BUG_ON(new_bucket >= | 5188 | BUG_ON(new_bucket >= |
@@ -5265,8 +5262,8 @@ static int ocfs2_add_new_xattr_bucket(struct inode *inode, | |||
5265 | /* The bucket at the front of the extent */ | 5262 | /* The bucket at the front of the extent */ |
5266 | struct ocfs2_xattr_bucket *first; | 5263 | struct ocfs2_xattr_bucket *first; |
5267 | 5264 | ||
5268 | mlog(0, "Add new xattr bucket starting from %llu\n", | 5265 | trace_ocfs2_add_new_xattr_bucket( |
5269 | (unsigned long long)bucket_blkno(target)); | 5266 | (unsigned long long)bucket_blkno(target)); |
5270 | 5267 | ||
5271 | /* The first bucket of the original extent */ | 5268 | /* The first bucket of the original extent */ |
5272 | first = ocfs2_xattr_bucket_new(inode); | 5269 | first = ocfs2_xattr_bucket_new(inode); |
@@ -5382,8 +5379,8 @@ static int ocfs2_xattr_bucket_value_truncate(struct inode *inode, | |||
5382 | * modified something. We have to assume they did, and dirty | 5379 | * modified something. We have to assume they did, and dirty |
5383 | * the whole bucket. This leaves us in a consistent state. | 5380 | * the whole bucket. This leaves us in a consistent state. |
5384 | */ | 5381 | */ |
5385 | mlog(0, "truncate %u in xattr bucket %llu to %d bytes.\n", | 5382 | trace_ocfs2_xattr_bucket_value_truncate( |
5386 | xe_off, (unsigned long long)bucket_blkno(bucket), len); | 5383 | (unsigned long long)bucket_blkno(bucket), xe_off, len); |
5387 | ret = ocfs2_xattr_value_truncate(inode, &vb, len, ctxt); | 5384 | ret = ocfs2_xattr_value_truncate(inode, &vb, len, ctxt); |
5388 | if (ret) { | 5385 | if (ret) { |
5389 | mlog_errno(ret); | 5386 | mlog_errno(ret); |
@@ -5433,8 +5430,9 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode, | |||
5433 | 5430 | ||
5434 | ocfs2_init_dealloc_ctxt(&dealloc); | 5431 | ocfs2_init_dealloc_ctxt(&dealloc); |
5435 | 5432 | ||
5436 | mlog(0, "rm xattr extent rec at %u len = %u, start from %llu\n", | 5433 | trace_ocfs2_rm_xattr_cluster( |
5437 | cpos, len, (unsigned long long)blkno); | 5434 | (unsigned long long)OCFS2_I(inode)->ip_blkno, |
5435 | (unsigned long long)blkno, cpos, len); | ||
5438 | 5436 | ||
5439 | ocfs2_remove_xattr_clusters_from_cache(INODE_CACHE(inode), blkno, | 5437 | ocfs2_remove_xattr_clusters_from_cache(INODE_CACHE(inode), blkno, |
5440 | len); | 5438 | len); |
@@ -5538,7 +5536,7 @@ static int ocfs2_xattr_set_entry_bucket(struct inode *inode, | |||
5538 | int ret; | 5536 | int ret; |
5539 | struct ocfs2_xa_loc loc; | 5537 | struct ocfs2_xa_loc loc; |
5540 | 5538 | ||
5541 | mlog_entry("Set xattr %s in xattr bucket\n", xi->xi_name); | 5539 | trace_ocfs2_xattr_set_entry_bucket(xi->xi_name); |
5542 | 5540 | ||
5543 | ocfs2_init_xattr_bucket_xa_loc(&loc, xs->bucket, | 5541 | ocfs2_init_xattr_bucket_xa_loc(&loc, xs->bucket, |
5544 | xs->not_found ? NULL : xs->here); | 5542 | xs->not_found ? NULL : xs->here); |
@@ -5570,7 +5568,6 @@ static int ocfs2_xattr_set_entry_bucket(struct inode *inode, | |||
5570 | 5568 | ||
5571 | 5569 | ||
5572 | out: | 5570 | out: |
5573 | mlog_exit(ret); | ||
5574 | return ret; | 5571 | return ret; |
5575 | } | 5572 | } |
5576 | 5573 | ||
@@ -5581,7 +5578,7 @@ static int ocfs2_xattr_set_entry_index_block(struct inode *inode, | |||
5581 | { | 5578 | { |
5582 | int ret; | 5579 | int ret; |
5583 | 5580 | ||
5584 | mlog_entry("Set xattr %s in xattr index block\n", xi->xi_name); | 5581 | trace_ocfs2_xattr_set_entry_index_block(xi->xi_name); |
5585 | 5582 | ||
5586 | ret = ocfs2_xattr_set_entry_bucket(inode, xi, xs, ctxt); | 5583 | ret = ocfs2_xattr_set_entry_bucket(inode, xi, xs, ctxt); |
5587 | if (!ret) | 5584 | if (!ret) |
@@ -5637,7 +5634,6 @@ static int ocfs2_xattr_set_entry_index_block(struct inode *inode, | |||
5637 | mlog_errno(ret); | 5634 | mlog_errno(ret); |
5638 | 5635 | ||
5639 | out: | 5636 | out: |
5640 | mlog_exit(ret); | ||
5641 | return ret; | 5637 | return ret; |
5642 | } | 5638 | } |
5643 | 5639 | ||
@@ -6041,9 +6037,9 @@ static int ocfs2_xattr_bucket_value_refcount(struct inode *inode, | |||
6041 | if (ocfs2_meta_ecc(OCFS2_SB(inode->i_sb))) | 6037 | if (ocfs2_meta_ecc(OCFS2_SB(inode->i_sb))) |
6042 | p = &refcount; | 6038 | p = &refcount; |
6043 | 6039 | ||
6044 | mlog(0, "refcount bucket %llu, count = %u\n", | 6040 | trace_ocfs2_xattr_bucket_value_refcount( |
6045 | (unsigned long long)bucket_blkno(bucket), | 6041 | (unsigned long long)bucket_blkno(bucket), |
6046 | le16_to_cpu(xh->xh_count)); | 6042 | le16_to_cpu(xh->xh_count)); |
6047 | for (i = 0; i < le16_to_cpu(xh->xh_count); i++) { | 6043 | for (i = 0; i < le16_to_cpu(xh->xh_count); i++) { |
6048 | xe = &xh->xh_entries[i]; | 6044 | xe = &xh->xh_entries[i]; |
6049 | 6045 | ||
@@ -6339,8 +6335,8 @@ static int ocfs2_reflink_xattr_header(handle_t *handle, | |||
6339 | u32 clusters, cpos, p_cluster, num_clusters; | 6335 | u32 clusters, cpos, p_cluster, num_clusters; |
6340 | unsigned int ext_flags = 0; | 6336 | unsigned int ext_flags = 0; |
6341 | 6337 | ||
6342 | mlog(0, "reflink xattr in container %llu, count = %u\n", | 6338 | trace_ocfs2_reflink_xattr_header((unsigned long long)old_bh->b_blocknr, |
6343 | (unsigned long long)old_bh->b_blocknr, le16_to_cpu(xh->xh_count)); | 6339 | le16_to_cpu(xh->xh_count)); |
6344 | 6340 | ||
6345 | last = &new_xh->xh_entries[le16_to_cpu(new_xh->xh_count)]; | 6341 | last = &new_xh->xh_entries[le16_to_cpu(new_xh->xh_count)]; |
6346 | for (i = 0, j = 0; i < le16_to_cpu(xh->xh_count); i++, j++) { | 6342 | for (i = 0, j = 0; i < le16_to_cpu(xh->xh_count); i++, j++) { |
@@ -6540,8 +6536,8 @@ static int ocfs2_create_empty_xattr_block(struct inode *inode, | |||
6540 | goto out; | 6536 | goto out; |
6541 | } | 6537 | } |
6542 | 6538 | ||
6543 | mlog(0, "create new xattr block for inode %llu, index = %d\n", | 6539 | trace_ocfs2_create_empty_xattr_block( |
6544 | (unsigned long long)fe_bh->b_blocknr, indexed); | 6540 | (unsigned long long)fe_bh->b_blocknr, indexed); |
6545 | ret = ocfs2_create_xattr_block(inode, fe_bh, &ctxt, indexed, | 6541 | ret = ocfs2_create_xattr_block(inode, fe_bh, &ctxt, indexed, |
6546 | ret_bh); | 6542 | ret_bh); |
6547 | if (ret) | 6543 | if (ret) |
@@ -6952,8 +6948,8 @@ static int ocfs2_reflink_xattr_buckets(handle_t *handle, | |||
6952 | if (ret) | 6948 | if (ret) |
6953 | mlog_errno(ret); | 6949 | mlog_errno(ret); |
6954 | 6950 | ||
6955 | mlog(0, "insert new xattr extent rec start %llu len %u to %u\n", | 6951 | trace_ocfs2_reflink_xattr_buckets((unsigned long long)new_blkno, |
6956 | (unsigned long long)new_blkno, num_clusters, reflink_cpos); | 6952 | num_clusters, reflink_cpos); |
6957 | 6953 | ||
6958 | len -= num_clusters; | 6954 | len -= num_clusters; |
6959 | blkno += ocfs2_clusters_to_blocks(inode->i_sb, num_clusters); | 6955 | blkno += ocfs2_clusters_to_blocks(inode->i_sb, num_clusters); |
@@ -6982,8 +6978,7 @@ static int ocfs2_reflink_xattr_rec(struct inode *inode, | |||
6982 | struct ocfs2_alloc_context *data_ac = NULL; | 6978 | struct ocfs2_alloc_context *data_ac = NULL; |
6983 | struct ocfs2_extent_tree et; | 6979 | struct ocfs2_extent_tree et; |
6984 | 6980 | ||
6985 | mlog(0, "reflink xattr buckets %llu len %u\n", | 6981 | trace_ocfs2_reflink_xattr_rec((unsigned long long)blkno, len); |
6986 | (unsigned long long)blkno, len); | ||
6987 | 6982 | ||
6988 | ocfs2_init_xattr_tree_extent_tree(&et, | 6983 | ocfs2_init_xattr_tree_extent_tree(&et, |
6989 | INODE_CACHE(args->reflink->new_inode), | 6984 | INODE_CACHE(args->reflink->new_inode), |
@@ -233,6 +233,14 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
233 | 233 | ||
234 | if (!(file->f_mode & FMODE_WRITE)) | 234 | if (!(file->f_mode & FMODE_WRITE)) |
235 | return -EBADF; | 235 | return -EBADF; |
236 | |||
237 | /* It's not possible punch hole on append only file */ | ||
238 | if (mode & FALLOC_FL_PUNCH_HOLE && IS_APPEND(inode)) | ||
239 | return -EPERM; | ||
240 | |||
241 | if (IS_IMMUTABLE(inode)) | ||
242 | return -EPERM; | ||
243 | |||
236 | /* | 244 | /* |
237 | * Revalidate the write permissions, in case security policy has | 245 | * Revalidate the write permissions, in case security policy has |
238 | * changed since the files were opened. | 246 | * changed since the files were opened. |
@@ -565,13 +573,15 @@ SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user, | |||
565 | { | 573 | { |
566 | struct path path; | 574 | struct path path; |
567 | int error = -EINVAL; | 575 | int error = -EINVAL; |
568 | int follow; | 576 | int lookup_flags; |
569 | 577 | ||
570 | if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) | 578 | if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_EMPTY_PATH)) != 0) |
571 | goto out; | 579 | goto out; |
572 | 580 | ||
573 | follow = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW; | 581 | lookup_flags = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW; |
574 | error = user_path_at(dfd, filename, follow, &path); | 582 | if (flag & AT_EMPTY_PATH) |
583 | lookup_flags |= LOOKUP_EMPTY; | ||
584 | error = user_path_at(dfd, filename, lookup_flags, &path); | ||
575 | if (error) | 585 | if (error) |
576 | goto out; | 586 | goto out; |
577 | error = mnt_want_write(path.mnt); | 587 | error = mnt_want_write(path.mnt); |
@@ -661,11 +671,16 @@ static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt, | |||
661 | int (*open)(struct inode *, struct file *), | 671 | int (*open)(struct inode *, struct file *), |
662 | const struct cred *cred) | 672 | const struct cred *cred) |
663 | { | 673 | { |
674 | static const struct file_operations empty_fops = {}; | ||
664 | struct inode *inode; | 675 | struct inode *inode; |
665 | int error; | 676 | int error; |
666 | 677 | ||
667 | f->f_mode = OPEN_FMODE(f->f_flags) | FMODE_LSEEK | | 678 | f->f_mode = OPEN_FMODE(f->f_flags) | FMODE_LSEEK | |
668 | FMODE_PREAD | FMODE_PWRITE; | 679 | FMODE_PREAD | FMODE_PWRITE; |
680 | |||
681 | if (unlikely(f->f_flags & O_PATH)) | ||
682 | f->f_mode = FMODE_PATH; | ||
683 | |||
669 | inode = dentry->d_inode; | 684 | inode = dentry->d_inode; |
670 | if (f->f_mode & FMODE_WRITE) { | 685 | if (f->f_mode & FMODE_WRITE) { |
671 | error = __get_file_write_access(inode, mnt); | 686 | error = __get_file_write_access(inode, mnt); |
@@ -679,9 +694,15 @@ static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt, | |||
679 | f->f_path.dentry = dentry; | 694 | f->f_path.dentry = dentry; |
680 | f->f_path.mnt = mnt; | 695 | f->f_path.mnt = mnt; |
681 | f->f_pos = 0; | 696 | f->f_pos = 0; |
682 | f->f_op = fops_get(inode->i_fop); | ||
683 | file_sb_list_add(f, inode->i_sb); | 697 | file_sb_list_add(f, inode->i_sb); |
684 | 698 | ||
699 | if (unlikely(f->f_mode & FMODE_PATH)) { | ||
700 | f->f_op = &empty_fops; | ||
701 | return f; | ||
702 | } | ||
703 | |||
704 | f->f_op = fops_get(inode->i_fop); | ||
705 | |||
685 | error = security_dentry_open(f, cred); | 706 | error = security_dentry_open(f, cred); |
686 | if (error) | 707 | if (error) |
687 | goto cleanup_all; | 708 | goto cleanup_all; |
@@ -882,15 +903,110 @@ void fd_install(unsigned int fd, struct file *file) | |||
882 | 903 | ||
883 | EXPORT_SYMBOL(fd_install); | 904 | EXPORT_SYMBOL(fd_install); |
884 | 905 | ||
906 | static inline int build_open_flags(int flags, int mode, struct open_flags *op) | ||
907 | { | ||
908 | int lookup_flags = 0; | ||
909 | int acc_mode; | ||
910 | |||
911 | if (!(flags & O_CREAT)) | ||
912 | mode = 0; | ||
913 | op->mode = mode; | ||
914 | |||
915 | /* Must never be set by userspace */ | ||
916 | flags &= ~FMODE_NONOTIFY; | ||
917 | |||
918 | /* | ||
919 | * O_SYNC is implemented as __O_SYNC|O_DSYNC. As many places only | ||
920 | * check for O_DSYNC if the need any syncing at all we enforce it's | ||
921 | * always set instead of having to deal with possibly weird behaviour | ||
922 | * for malicious applications setting only __O_SYNC. | ||
923 | */ | ||
924 | if (flags & __O_SYNC) | ||
925 | flags |= O_DSYNC; | ||
926 | |||
927 | /* | ||
928 | * If we have O_PATH in the open flag. Then we | ||
929 | * cannot have anything other than the below set of flags | ||
930 | */ | ||
931 | if (flags & O_PATH) { | ||
932 | flags &= O_DIRECTORY | O_NOFOLLOW | O_PATH; | ||
933 | acc_mode = 0; | ||
934 | } else { | ||
935 | acc_mode = MAY_OPEN | ACC_MODE(flags); | ||
936 | } | ||
937 | |||
938 | op->open_flag = flags; | ||
939 | |||
940 | /* O_TRUNC implies we need access checks for write permissions */ | ||
941 | if (flags & O_TRUNC) | ||
942 | acc_mode |= MAY_WRITE; | ||
943 | |||
944 | /* Allow the LSM permission hook to distinguish append | ||
945 | access from general write access. */ | ||
946 | if (flags & O_APPEND) | ||
947 | acc_mode |= MAY_APPEND; | ||
948 | |||
949 | op->acc_mode = acc_mode; | ||
950 | |||
951 | op->intent = flags & O_PATH ? 0 : LOOKUP_OPEN; | ||
952 | |||
953 | if (flags & O_CREAT) { | ||
954 | op->intent |= LOOKUP_CREATE; | ||
955 | if (flags & O_EXCL) | ||
956 | op->intent |= LOOKUP_EXCL; | ||
957 | } | ||
958 | |||
959 | if (flags & O_DIRECTORY) | ||
960 | lookup_flags |= LOOKUP_DIRECTORY; | ||
961 | if (!(flags & O_NOFOLLOW)) | ||
962 | lookup_flags |= LOOKUP_FOLLOW; | ||
963 | return lookup_flags; | ||
964 | } | ||
965 | |||
966 | /** | ||
967 | * filp_open - open file and return file pointer | ||
968 | * | ||
969 | * @filename: path to open | ||
970 | * @flags: open flags as per the open(2) second argument | ||
971 | * @mode: mode for the new file if O_CREAT is set, else ignored | ||
972 | * | ||
973 | * This is the helper to open a file from kernelspace if you really | ||
974 | * have to. But in generally you should not do this, so please move | ||
975 | * along, nothing to see here.. | ||
976 | */ | ||
977 | struct file *filp_open(const char *filename, int flags, int mode) | ||
978 | { | ||
979 | struct open_flags op; | ||
980 | int lookup = build_open_flags(flags, mode, &op); | ||
981 | return do_filp_open(AT_FDCWD, filename, &op, lookup); | ||
982 | } | ||
983 | EXPORT_SYMBOL(filp_open); | ||
984 | |||
985 | struct file *file_open_root(struct dentry *dentry, struct vfsmount *mnt, | ||
986 | const char *filename, int flags) | ||
987 | { | ||
988 | struct open_flags op; | ||
989 | int lookup = build_open_flags(flags, 0, &op); | ||
990 | if (flags & O_CREAT) | ||
991 | return ERR_PTR(-EINVAL); | ||
992 | if (!filename && (flags & O_DIRECTORY)) | ||
993 | if (!dentry->d_inode->i_op->lookup) | ||
994 | return ERR_PTR(-ENOTDIR); | ||
995 | return do_file_open_root(dentry, mnt, filename, &op, lookup); | ||
996 | } | ||
997 | EXPORT_SYMBOL(file_open_root); | ||
998 | |||
885 | long do_sys_open(int dfd, const char __user *filename, int flags, int mode) | 999 | long do_sys_open(int dfd, const char __user *filename, int flags, int mode) |
886 | { | 1000 | { |
1001 | struct open_flags op; | ||
1002 | int lookup = build_open_flags(flags, mode, &op); | ||
887 | char *tmp = getname(filename); | 1003 | char *tmp = getname(filename); |
888 | int fd = PTR_ERR(tmp); | 1004 | int fd = PTR_ERR(tmp); |
889 | 1005 | ||
890 | if (!IS_ERR(tmp)) { | 1006 | if (!IS_ERR(tmp)) { |
891 | fd = get_unused_fd_flags(flags); | 1007 | fd = get_unused_fd_flags(flags); |
892 | if (fd >= 0) { | 1008 | if (fd >= 0) { |
893 | struct file *f = do_filp_open(dfd, tmp, flags, mode, 0); | 1009 | struct file *f = do_filp_open(dfd, tmp, &op, lookup); |
894 | if (IS_ERR(f)) { | 1010 | if (IS_ERR(f)) { |
895 | put_unused_fd(fd); | 1011 | put_unused_fd(fd); |
896 | fd = PTR_ERR(f); | 1012 | fd = PTR_ERR(f); |
@@ -960,8 +1076,10 @@ int filp_close(struct file *filp, fl_owner_t id) | |||
960 | if (filp->f_op && filp->f_op->flush) | 1076 | if (filp->f_op && filp->f_op->flush) |
961 | retval = filp->f_op->flush(filp, id); | 1077 | retval = filp->f_op->flush(filp, id); |
962 | 1078 | ||
963 | dnotify_flush(filp, id); | 1079 | if (likely(!(filp->f_mode & FMODE_PATH))) { |
964 | locks_remove_posix(filp, id); | 1080 | dnotify_flush(filp, id); |
1081 | locks_remove_posix(filp, id); | ||
1082 | } | ||
965 | fput(filp); | 1083 | fput(filp); |
966 | return retval; | 1084 | return retval; |
967 | } | 1085 | } |
diff --git a/fs/partitions/ldm.c b/fs/partitions/ldm.c index 789c625c7aa5..b10e3540d5b7 100644 --- a/fs/partitions/ldm.c +++ b/fs/partitions/ldm.c | |||
@@ -251,6 +251,11 @@ static bool ldm_parse_vmdb (const u8 *data, struct vmdb *vm) | |||
251 | } | 251 | } |
252 | 252 | ||
253 | vm->vblk_size = get_unaligned_be32(data + 0x08); | 253 | vm->vblk_size = get_unaligned_be32(data + 0x08); |
254 | if (vm->vblk_size == 0) { | ||
255 | ldm_error ("Illegal VBLK size"); | ||
256 | return false; | ||
257 | } | ||
258 | |||
254 | vm->vblk_offset = get_unaligned_be32(data + 0x0C); | 259 | vm->vblk_offset = get_unaligned_be32(data + 0x0C); |
255 | vm->last_vblk_seq = get_unaligned_be32(data + 0x04); | 260 | vm->last_vblk_seq = get_unaligned_be32(data + 0x04); |
256 | 261 | ||
diff --git a/fs/partitions/osf.c b/fs/partitions/osf.c index 48cec7cbca17..be03a0b08b47 100644 --- a/fs/partitions/osf.c +++ b/fs/partitions/osf.c | |||
@@ -10,10 +10,13 @@ | |||
10 | #include "check.h" | 10 | #include "check.h" |
11 | #include "osf.h" | 11 | #include "osf.h" |
12 | 12 | ||
13 | #define MAX_OSF_PARTITIONS 8 | ||
14 | |||
13 | int osf_partition(struct parsed_partitions *state) | 15 | int osf_partition(struct parsed_partitions *state) |
14 | { | 16 | { |
15 | int i; | 17 | int i; |
16 | int slot = 1; | 18 | int slot = 1; |
19 | unsigned int npartitions; | ||
17 | Sector sect; | 20 | Sector sect; |
18 | unsigned char *data; | 21 | unsigned char *data; |
19 | struct disklabel { | 22 | struct disklabel { |
@@ -45,7 +48,7 @@ int osf_partition(struct parsed_partitions *state) | |||
45 | u8 p_fstype; | 48 | u8 p_fstype; |
46 | u8 p_frag; | 49 | u8 p_frag; |
47 | __le16 p_cpg; | 50 | __le16 p_cpg; |
48 | } d_partitions[8]; | 51 | } d_partitions[MAX_OSF_PARTITIONS]; |
49 | } * label; | 52 | } * label; |
50 | struct d_partition * partition; | 53 | struct d_partition * partition; |
51 | 54 | ||
@@ -63,7 +66,12 @@ int osf_partition(struct parsed_partitions *state) | |||
63 | put_dev_sector(sect); | 66 | put_dev_sector(sect); |
64 | return 0; | 67 | return 0; |
65 | } | 68 | } |
66 | for (i = 0 ; i < le16_to_cpu(label->d_npartitions); i++, partition++) { | 69 | npartitions = le16_to_cpu(label->d_npartitions); |
70 | if (npartitions > MAX_OSF_PARTITIONS) { | ||
71 | put_dev_sector(sect); | ||
72 | return 0; | ||
73 | } | ||
74 | for (i = 0 ; i < npartitions; i++, partition++) { | ||
67 | if (slot == state->limit) | 75 | if (slot == state->limit) |
68 | break; | 76 | break; |
69 | if (le32_to_cpu(partition->p_size)) | 77 | if (le32_to_cpu(partition->p_size)) |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 9d096e82b201..d49c4b5d2c3e 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -2620,35 +2620,6 @@ static const struct pid_entry proc_base_stuff[] = { | |||
2620 | &proc_self_inode_operations, NULL, {}), | 2620 | &proc_self_inode_operations, NULL, {}), |
2621 | }; | 2621 | }; |
2622 | 2622 | ||
2623 | /* | ||
2624 | * Exceptional case: normally we are not allowed to unhash a busy | ||
2625 | * directory. In this case, however, we can do it - no aliasing problems | ||
2626 | * due to the way we treat inodes. | ||
2627 | */ | ||
2628 | static int proc_base_revalidate(struct dentry *dentry, struct nameidata *nd) | ||
2629 | { | ||
2630 | struct inode *inode; | ||
2631 | struct task_struct *task; | ||
2632 | |||
2633 | if (nd->flags & LOOKUP_RCU) | ||
2634 | return -ECHILD; | ||
2635 | |||
2636 | inode = dentry->d_inode; | ||
2637 | task = get_proc_task(inode); | ||
2638 | if (task) { | ||
2639 | put_task_struct(task); | ||
2640 | return 1; | ||
2641 | } | ||
2642 | d_drop(dentry); | ||
2643 | return 0; | ||
2644 | } | ||
2645 | |||
2646 | static const struct dentry_operations proc_base_dentry_operations = | ||
2647 | { | ||
2648 | .d_revalidate = proc_base_revalidate, | ||
2649 | .d_delete = pid_delete_dentry, | ||
2650 | }; | ||
2651 | |||
2652 | static struct dentry *proc_base_instantiate(struct inode *dir, | 2623 | static struct dentry *proc_base_instantiate(struct inode *dir, |
2653 | struct dentry *dentry, struct task_struct *task, const void *ptr) | 2624 | struct dentry *dentry, struct task_struct *task, const void *ptr) |
2654 | { | 2625 | { |
@@ -2685,7 +2656,6 @@ static struct dentry *proc_base_instantiate(struct inode *dir, | |||
2685 | if (p->fop) | 2656 | if (p->fop) |
2686 | inode->i_fop = p->fop; | 2657 | inode->i_fop = p->fop; |
2687 | ei->op = p->op; | 2658 | ei->op = p->op; |
2688 | d_set_d_op(dentry, &proc_base_dentry_operations); | ||
2689 | d_add(dentry, inode); | 2659 | d_add(dentry, inode); |
2690 | error = NULL; | 2660 | error = NULL; |
2691 | out: | 2661 | out: |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 176ce4cda68a..d6a7ca1fdac5 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -27,6 +27,7 @@ | |||
27 | static void proc_evict_inode(struct inode *inode) | 27 | static void proc_evict_inode(struct inode *inode) |
28 | { | 28 | { |
29 | struct proc_dir_entry *de; | 29 | struct proc_dir_entry *de; |
30 | struct ctl_table_header *head; | ||
30 | 31 | ||
31 | truncate_inode_pages(&inode->i_data, 0); | 32 | truncate_inode_pages(&inode->i_data, 0); |
32 | end_writeback(inode); | 33 | end_writeback(inode); |
@@ -38,8 +39,11 @@ static void proc_evict_inode(struct inode *inode) | |||
38 | de = PROC_I(inode)->pde; | 39 | de = PROC_I(inode)->pde; |
39 | if (de) | 40 | if (de) |
40 | pde_put(de); | 41 | pde_put(de); |
41 | if (PROC_I(inode)->sysctl) | 42 | head = PROC_I(inode)->sysctl; |
42 | sysctl_head_put(PROC_I(inode)->sysctl); | 43 | if (head) { |
44 | rcu_assign_pointer(PROC_I(inode)->sysctl, NULL); | ||
45 | sysctl_head_put(head); | ||
46 | } | ||
43 | } | 47 | } |
44 | 48 | ||
45 | struct vfsmount *proc_mnt; | 49 | struct vfsmount *proc_mnt; |
diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c index d9396a4fc7ff..927cbd115e53 100644 --- a/fs/proc/proc_devtree.c +++ b/fs/proc/proc_devtree.c | |||
@@ -233,7 +233,7 @@ void __init proc_device_tree_init(void) | |||
233 | return; | 233 | return; |
234 | root = of_find_node_by_path("/"); | 234 | root = of_find_node_by_path("/"); |
235 | if (root == NULL) { | 235 | if (root == NULL) { |
236 | printk(KERN_ERR "/proc/device-tree: can't find root\n"); | 236 | pr_debug("/proc/device-tree: can't find root\n"); |
237 | return; | 237 | return; |
238 | } | 238 | } |
239 | proc_device_tree_add_node(root, proc_device_tree); | 239 | proc_device_tree_add_node(root, proc_device_tree); |
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 09a1f92a34ef..8eb2522111c5 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c | |||
@@ -408,15 +408,18 @@ static int proc_sys_compare(const struct dentry *parent, | |||
408 | const struct dentry *dentry, const struct inode *inode, | 408 | const struct dentry *dentry, const struct inode *inode, |
409 | unsigned int len, const char *str, const struct qstr *name) | 409 | unsigned int len, const char *str, const struct qstr *name) |
410 | { | 410 | { |
411 | struct ctl_table_header *head; | ||
411 | /* Although proc doesn't have negative dentries, rcu-walk means | 412 | /* Although proc doesn't have negative dentries, rcu-walk means |
412 | * that inode here can be NULL */ | 413 | * that inode here can be NULL */ |
414 | /* AV: can it, indeed? */ | ||
413 | if (!inode) | 415 | if (!inode) |
414 | return 0; | 416 | return 1; |
415 | if (name->len != len) | 417 | if (name->len != len) |
416 | return 1; | 418 | return 1; |
417 | if (memcmp(name->name, str, len)) | 419 | if (memcmp(name->name, str, len)) |
418 | return 1; | 420 | return 1; |
419 | return !sysctl_is_seen(PROC_I(inode)->sysctl); | 421 | head = rcu_dereference(PROC_I(inode)->sysctl); |
422 | return !head || !sysctl_is_seen(head); | ||
420 | } | 423 | } |
421 | 424 | ||
422 | static const struct dentry_operations proc_sys_dentry_operations = { | 425 | static const struct dentry_operations proc_sys_dentry_operations = { |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 0bae036831e2..1bba24bad820 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -1593,8 +1593,13 @@ int reiserfs_encode_fh(struct dentry *dentry, __u32 * data, int *lenp, | |||
1593 | struct inode *inode = dentry->d_inode; | 1593 | struct inode *inode = dentry->d_inode; |
1594 | int maxlen = *lenp; | 1594 | int maxlen = *lenp; |
1595 | 1595 | ||
1596 | if (maxlen < 3) | 1596 | if (need_parent && (maxlen < 5)) { |
1597 | *lenp = 5; | ||
1597 | return 255; | 1598 | return 255; |
1599 | } else if (maxlen < 3) { | ||
1600 | *lenp = 3; | ||
1601 | return 255; | ||
1602 | } | ||
1598 | 1603 | ||
1599 | data[0] = inode->i_ino; | 1604 | data[0] = inode->i_ino; |
1600 | data[1] = le32_to_cpu(INODE_PKEY(inode)->k_dir_id); | 1605 | data[1] = le32_to_cpu(INODE_PKEY(inode)->k_dir_id); |
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index ba5f51ec3458..4b2eb564fdad 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
@@ -771,7 +771,7 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
771 | EMPTY_DIR_SIZE_V1 : EMPTY_DIR_SIZE, | 771 | EMPTY_DIR_SIZE_V1 : EMPTY_DIR_SIZE, |
772 | dentry, inode, &security); | 772 | dentry, inode, &security); |
773 | if (retval) { | 773 | if (retval) { |
774 | dir->i_nlink--; | 774 | DEC_DIR_INODE_NLINK(dir) |
775 | goto out_failed; | 775 | goto out_failed; |
776 | } | 776 | } |
777 | 777 | ||
@@ -1122,10 +1122,6 @@ static int reiserfs_link(struct dentry *old_dentry, struct inode *dir, | |||
1122 | reiserfs_write_unlock(dir->i_sb); | 1122 | reiserfs_write_unlock(dir->i_sb); |
1123 | return -EMLINK; | 1123 | return -EMLINK; |
1124 | } | 1124 | } |
1125 | if (inode->i_nlink == 0) { | ||
1126 | reiserfs_write_unlock(dir->i_sb); | ||
1127 | return -ENOENT; | ||
1128 | } | ||
1129 | 1125 | ||
1130 | /* inc before scheduling so reiserfs_unlink knows we are here */ | 1126 | /* inc before scheduling so reiserfs_unlink knows we are here */ |
1131 | inc_nlink(inode); | 1127 | inc_nlink(inode); |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index 3cfb2e933644..5c11ca82b782 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -978,8 +978,6 @@ int reiserfs_permission(struct inode *inode, int mask, unsigned int flags) | |||
978 | 978 | ||
979 | static int xattr_hide_revalidate(struct dentry *dentry, struct nameidata *nd) | 979 | static int xattr_hide_revalidate(struct dentry *dentry, struct nameidata *nd) |
980 | { | 980 | { |
981 | if (nd->flags & LOOKUP_RCU) | ||
982 | return -ECHILD; | ||
983 | return -EPERM; | 981 | return -EPERM; |
984 | } | 982 | } |
985 | 983 | ||
@@ -75,13 +75,16 @@ int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat, | |||
75 | int error = -EINVAL; | 75 | int error = -EINVAL; |
76 | int lookup_flags = 0; | 76 | int lookup_flags = 0; |
77 | 77 | ||
78 | if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT)) != 0) | 78 | if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT | |
79 | AT_EMPTY_PATH)) != 0) | ||
79 | goto out; | 80 | goto out; |
80 | 81 | ||
81 | if (!(flag & AT_SYMLINK_NOFOLLOW)) | 82 | if (!(flag & AT_SYMLINK_NOFOLLOW)) |
82 | lookup_flags |= LOOKUP_FOLLOW; | 83 | lookup_flags |= LOOKUP_FOLLOW; |
83 | if (flag & AT_NO_AUTOMOUNT) | 84 | if (flag & AT_NO_AUTOMOUNT) |
84 | lookup_flags |= LOOKUP_NO_AUTOMOUNT; | 85 | lookup_flags |= LOOKUP_NO_AUTOMOUNT; |
86 | if (flag & AT_EMPTY_PATH) | ||
87 | lookup_flags |= LOOKUP_EMPTY; | ||
85 | 88 | ||
86 | error = user_path_at(dfd, filename, lookup_flags, &path); | 89 | error = user_path_at(dfd, filename, lookup_flags, &path); |
87 | if (error) | 90 | if (error) |
@@ -297,7 +300,7 @@ SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname, | |||
297 | if (bufsiz <= 0) | 300 | if (bufsiz <= 0) |
298 | return -EINVAL; | 301 | return -EINVAL; |
299 | 302 | ||
300 | error = user_path_at(dfd, pathname, 0, &path); | 303 | error = user_path_at(dfd, pathname, LOOKUP_EMPTY, &path); |
301 | if (!error) { | 304 | if (!error) { |
302 | struct inode *inode = path.dentry->d_inode; | 305 | struct inode *inode = path.dentry->d_inode; |
303 | 306 | ||
diff --git a/fs/statfs.c b/fs/statfs.c index 30ea8c8a996b..8244924dec55 100644 --- a/fs/statfs.c +++ b/fs/statfs.c | |||
@@ -73,149 +73,135 @@ int vfs_statfs(struct path *path, struct kstatfs *buf) | |||
73 | } | 73 | } |
74 | EXPORT_SYMBOL(vfs_statfs); | 74 | EXPORT_SYMBOL(vfs_statfs); |
75 | 75 | ||
76 | static int do_statfs_native(struct path *path, struct statfs *buf) | 76 | int user_statfs(const char __user *pathname, struct kstatfs *st) |
77 | { | 77 | { |
78 | struct kstatfs st; | 78 | struct path path; |
79 | int retval; | 79 | int error = user_path(pathname, &path); |
80 | if (!error) { | ||
81 | error = vfs_statfs(&path, st); | ||
82 | path_put(&path); | ||
83 | } | ||
84 | return error; | ||
85 | } | ||
80 | 86 | ||
81 | retval = vfs_statfs(path, &st); | 87 | int fd_statfs(int fd, struct kstatfs *st) |
82 | if (retval) | 88 | { |
83 | return retval; | 89 | struct file *file = fget(fd); |
90 | int error = -EBADF; | ||
91 | if (file) { | ||
92 | error = vfs_statfs(&file->f_path, st); | ||
93 | fput(file); | ||
94 | } | ||
95 | return error; | ||
96 | } | ||
84 | 97 | ||
85 | if (sizeof(*buf) == sizeof(st)) | 98 | static int do_statfs_native(struct kstatfs *st, struct statfs __user *p) |
86 | memcpy(buf, &st, sizeof(st)); | 99 | { |
100 | struct statfs buf; | ||
101 | |||
102 | if (sizeof(buf) == sizeof(*st)) | ||
103 | memcpy(&buf, st, sizeof(*st)); | ||
87 | else { | 104 | else { |
88 | if (sizeof buf->f_blocks == 4) { | 105 | if (sizeof buf.f_blocks == 4) { |
89 | if ((st.f_blocks | st.f_bfree | st.f_bavail | | 106 | if ((st->f_blocks | st->f_bfree | st->f_bavail | |
90 | st.f_bsize | st.f_frsize) & | 107 | st->f_bsize | st->f_frsize) & |
91 | 0xffffffff00000000ULL) | 108 | 0xffffffff00000000ULL) |
92 | return -EOVERFLOW; | 109 | return -EOVERFLOW; |
93 | /* | 110 | /* |
94 | * f_files and f_ffree may be -1; it's okay to stuff | 111 | * f_files and f_ffree may be -1; it's okay to stuff |
95 | * that into 32 bits | 112 | * that into 32 bits |
96 | */ | 113 | */ |
97 | if (st.f_files != -1 && | 114 | if (st->f_files != -1 && |
98 | (st.f_files & 0xffffffff00000000ULL)) | 115 | (st->f_files & 0xffffffff00000000ULL)) |
99 | return -EOVERFLOW; | 116 | return -EOVERFLOW; |
100 | if (st.f_ffree != -1 && | 117 | if (st->f_ffree != -1 && |
101 | (st.f_ffree & 0xffffffff00000000ULL)) | 118 | (st->f_ffree & 0xffffffff00000000ULL)) |
102 | return -EOVERFLOW; | 119 | return -EOVERFLOW; |
103 | } | 120 | } |
104 | 121 | ||
105 | buf->f_type = st.f_type; | 122 | buf.f_type = st->f_type; |
106 | buf->f_bsize = st.f_bsize; | 123 | buf.f_bsize = st->f_bsize; |
107 | buf->f_blocks = st.f_blocks; | 124 | buf.f_blocks = st->f_blocks; |
108 | buf->f_bfree = st.f_bfree; | 125 | buf.f_bfree = st->f_bfree; |
109 | buf->f_bavail = st.f_bavail; | 126 | buf.f_bavail = st->f_bavail; |
110 | buf->f_files = st.f_files; | 127 | buf.f_files = st->f_files; |
111 | buf->f_ffree = st.f_ffree; | 128 | buf.f_ffree = st->f_ffree; |
112 | buf->f_fsid = st.f_fsid; | 129 | buf.f_fsid = st->f_fsid; |
113 | buf->f_namelen = st.f_namelen; | 130 | buf.f_namelen = st->f_namelen; |
114 | buf->f_frsize = st.f_frsize; | 131 | buf.f_frsize = st->f_frsize; |
115 | buf->f_flags = st.f_flags; | 132 | buf.f_flags = st->f_flags; |
116 | memset(buf->f_spare, 0, sizeof(buf->f_spare)); | 133 | memset(buf.f_spare, 0, sizeof(buf.f_spare)); |
117 | } | 134 | } |
135 | if (copy_to_user(p, &buf, sizeof(buf))) | ||
136 | return -EFAULT; | ||
118 | return 0; | 137 | return 0; |
119 | } | 138 | } |
120 | 139 | ||
121 | static int do_statfs64(struct path *path, struct statfs64 *buf) | 140 | static int do_statfs64(struct kstatfs *st, struct statfs64 __user *p) |
122 | { | 141 | { |
123 | struct kstatfs st; | 142 | struct statfs64 buf; |
124 | int retval; | 143 | if (sizeof(buf) == sizeof(*st)) |
125 | 144 | memcpy(&buf, st, sizeof(*st)); | |
126 | retval = vfs_statfs(path, &st); | ||
127 | if (retval) | ||
128 | return retval; | ||
129 | |||
130 | if (sizeof(*buf) == sizeof(st)) | ||
131 | memcpy(buf, &st, sizeof(st)); | ||
132 | else { | 145 | else { |
133 | buf->f_type = st.f_type; | 146 | buf.f_type = st->f_type; |
134 | buf->f_bsize = st.f_bsize; | 147 | buf.f_bsize = st->f_bsize; |
135 | buf->f_blocks = st.f_blocks; | 148 | buf.f_blocks = st->f_blocks; |
136 | buf->f_bfree = st.f_bfree; | 149 | buf.f_bfree = st->f_bfree; |
137 | buf->f_bavail = st.f_bavail; | 150 | buf.f_bavail = st->f_bavail; |
138 | buf->f_files = st.f_files; | 151 | buf.f_files = st->f_files; |
139 | buf->f_ffree = st.f_ffree; | 152 | buf.f_ffree = st->f_ffree; |
140 | buf->f_fsid = st.f_fsid; | 153 | buf.f_fsid = st->f_fsid; |
141 | buf->f_namelen = st.f_namelen; | 154 | buf.f_namelen = st->f_namelen; |
142 | buf->f_frsize = st.f_frsize; | 155 | buf.f_frsize = st->f_frsize; |
143 | buf->f_flags = st.f_flags; | 156 | buf.f_flags = st->f_flags; |
144 | memset(buf->f_spare, 0, sizeof(buf->f_spare)); | 157 | memset(buf.f_spare, 0, sizeof(buf.f_spare)); |
145 | } | 158 | } |
159 | if (copy_to_user(p, &buf, sizeof(buf))) | ||
160 | return -EFAULT; | ||
146 | return 0; | 161 | return 0; |
147 | } | 162 | } |
148 | 163 | ||
149 | SYSCALL_DEFINE2(statfs, const char __user *, pathname, struct statfs __user *, buf) | 164 | SYSCALL_DEFINE2(statfs, const char __user *, pathname, struct statfs __user *, buf) |
150 | { | 165 | { |
151 | struct path path; | 166 | struct kstatfs st; |
152 | int error; | 167 | int error = user_statfs(pathname, &st); |
153 | 168 | if (!error) | |
154 | error = user_path(pathname, &path); | 169 | error = do_statfs_native(&st, buf); |
155 | if (!error) { | ||
156 | struct statfs tmp; | ||
157 | error = do_statfs_native(&path, &tmp); | ||
158 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | ||
159 | error = -EFAULT; | ||
160 | path_put(&path); | ||
161 | } | ||
162 | return error; | 170 | return error; |
163 | } | 171 | } |
164 | 172 | ||
165 | SYSCALL_DEFINE3(statfs64, const char __user *, pathname, size_t, sz, struct statfs64 __user *, buf) | 173 | SYSCALL_DEFINE3(statfs64, const char __user *, pathname, size_t, sz, struct statfs64 __user *, buf) |
166 | { | 174 | { |
167 | struct path path; | 175 | struct kstatfs st; |
168 | long error; | 176 | int error; |
169 | |||
170 | if (sz != sizeof(*buf)) | 177 | if (sz != sizeof(*buf)) |
171 | return -EINVAL; | 178 | return -EINVAL; |
172 | error = user_path(pathname, &path); | 179 | error = user_statfs(pathname, &st); |
173 | if (!error) { | 180 | if (!error) |
174 | struct statfs64 tmp; | 181 | error = do_statfs64(&st, buf); |
175 | error = do_statfs64(&path, &tmp); | ||
176 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | ||
177 | error = -EFAULT; | ||
178 | path_put(&path); | ||
179 | } | ||
180 | return error; | 182 | return error; |
181 | } | 183 | } |
182 | 184 | ||
183 | SYSCALL_DEFINE2(fstatfs, unsigned int, fd, struct statfs __user *, buf) | 185 | SYSCALL_DEFINE2(fstatfs, unsigned int, fd, struct statfs __user *, buf) |
184 | { | 186 | { |
185 | struct file *file; | 187 | struct kstatfs st; |
186 | struct statfs tmp; | 188 | int error = fd_statfs(fd, &st); |
187 | int error; | 189 | if (!error) |
188 | 190 | error = do_statfs_native(&st, buf); | |
189 | error = -EBADF; | ||
190 | file = fget(fd); | ||
191 | if (!file) | ||
192 | goto out; | ||
193 | error = do_statfs_native(&file->f_path, &tmp); | ||
194 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | ||
195 | error = -EFAULT; | ||
196 | fput(file); | ||
197 | out: | ||
198 | return error; | 191 | return error; |
199 | } | 192 | } |
200 | 193 | ||
201 | SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, size_t, sz, struct statfs64 __user *, buf) | 194 | SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, size_t, sz, struct statfs64 __user *, buf) |
202 | { | 195 | { |
203 | struct file *file; | 196 | struct kstatfs st; |
204 | struct statfs64 tmp; | ||
205 | int error; | 197 | int error; |
206 | 198 | ||
207 | if (sz != sizeof(*buf)) | 199 | if (sz != sizeof(*buf)) |
208 | return -EINVAL; | 200 | return -EINVAL; |
209 | 201 | ||
210 | error = -EBADF; | 202 | error = fd_statfs(fd, &st); |
211 | file = fget(fd); | 203 | if (!error) |
212 | if (!file) | 204 | error = do_statfs64(&st, buf); |
213 | goto out; | ||
214 | error = do_statfs64(&file->f_path, &tmp); | ||
215 | if (!error && copy_to_user(buf, &tmp, sizeof(tmp))) | ||
216 | error = -EFAULT; | ||
217 | fput(file); | ||
218 | out: | ||
219 | return error; | 205 | return error; |
220 | } | 206 | } |
221 | 207 | ||
diff --git a/fs/sysv/namei.c b/fs/sysv/namei.c index b427b1208c26..e474fbcf8bde 100644 --- a/fs/sysv/namei.c +++ b/fs/sysv/namei.c | |||
@@ -245,7 +245,6 @@ static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry, | |||
245 | new_de = sysv_find_entry(new_dentry, &new_page); | 245 | new_de = sysv_find_entry(new_dentry, &new_page); |
246 | if (!new_de) | 246 | if (!new_de) |
247 | goto out_dir; | 247 | goto out_dir; |
248 | inode_inc_link_count(old_inode); | ||
249 | sysv_set_link(new_de, new_page, old_inode); | 248 | sysv_set_link(new_de, new_page, old_inode); |
250 | new_inode->i_ctime = CURRENT_TIME_SEC; | 249 | new_inode->i_ctime = CURRENT_TIME_SEC; |
251 | if (dir_de) | 250 | if (dir_de) |
@@ -257,18 +256,15 @@ static int sysv_rename(struct inode * old_dir, struct dentry * old_dentry, | |||
257 | if (new_dir->i_nlink >= SYSV_SB(new_dir->i_sb)->s_link_max) | 256 | if (new_dir->i_nlink >= SYSV_SB(new_dir->i_sb)->s_link_max) |
258 | goto out_dir; | 257 | goto out_dir; |
259 | } | 258 | } |
260 | inode_inc_link_count(old_inode); | ||
261 | err = sysv_add_link(new_dentry, old_inode); | 259 | err = sysv_add_link(new_dentry, old_inode); |
262 | if (err) { | 260 | if (err) |
263 | inode_dec_link_count(old_inode); | ||
264 | goto out_dir; | 261 | goto out_dir; |
265 | } | ||
266 | if (dir_de) | 262 | if (dir_de) |
267 | inode_inc_link_count(new_dir); | 263 | inode_inc_link_count(new_dir); |
268 | } | 264 | } |
269 | 265 | ||
270 | sysv_delete_entry(old_de, old_page); | 266 | sysv_delete_entry(old_de, old_page); |
271 | inode_dec_link_count(old_inode); | 267 | mark_inode_dirty(old_inode); |
272 | 268 | ||
273 | if (dir_de) { | 269 | if (dir_de) { |
274 | sysv_set_link(dir_de, dir_page, new_dir); | 270 | sysv_set_link(dir_de, dir_page, new_dir); |
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 14f64b689d7f..7217d67a80a6 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
@@ -522,24 +522,6 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir, | |||
522 | ubifs_assert(mutex_is_locked(&dir->i_mutex)); | 522 | ubifs_assert(mutex_is_locked(&dir->i_mutex)); |
523 | ubifs_assert(mutex_is_locked(&inode->i_mutex)); | 523 | ubifs_assert(mutex_is_locked(&inode->i_mutex)); |
524 | 524 | ||
525 | /* | ||
526 | * Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing | ||
527 | * otherwise has the potential to corrupt the orphan inode list. | ||
528 | * | ||
529 | * Indeed, consider a scenario when 'vfs_link(dirA/fileA)' and | ||
530 | * 'vfs_unlink(dirA/fileA, dirB/fileB)' race. 'vfs_link()' does not | ||
531 | * lock 'dirA->i_mutex', so this is possible. Both of the functions | ||
532 | * lock 'fileA->i_mutex' though. Suppose 'vfs_unlink()' wins, and takes | ||
533 | * 'fileA->i_mutex' mutex first. Suppose 'fileA->i_nlink' is 1. In this | ||
534 | * case 'ubifs_unlink()' will drop the last reference, and put 'inodeA' | ||
535 | * to the list of orphans. After this, 'vfs_link()' will link | ||
536 | * 'dirB/fileB' to 'inodeA'. This is a problem because, for example, | ||
537 | * the subsequent 'vfs_unlink(dirB/fileB)' will add the same inode | ||
538 | * to the list of orphans. | ||
539 | */ | ||
540 | if (inode->i_nlink == 0) | ||
541 | return -ENOENT; | ||
542 | |||
543 | err = dbg_check_synced_i_size(inode); | 525 | err = dbg_check_synced_i_size(inode); |
544 | if (err) | 526 | if (err) |
545 | return err; | 527 | return err; |
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 2be0f9eb86d2..f1dce848ef96 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -32,6 +32,8 @@ | |||
32 | #include <linux/crc-itu-t.h> | 32 | #include <linux/crc-itu-t.h> |
33 | #include <linux/exportfs.h> | 33 | #include <linux/exportfs.h> |
34 | 34 | ||
35 | enum { UDF_MAX_LINKS = 0xffff }; | ||
36 | |||
35 | static inline int udf_match(int len1, const unsigned char *name1, int len2, | 37 | static inline int udf_match(int len1, const unsigned char *name1, int len2, |
36 | const unsigned char *name2) | 38 | const unsigned char *name2) |
37 | { | 39 | { |
@@ -650,7 +652,7 @@ static int udf_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
650 | struct udf_inode_info *iinfo; | 652 | struct udf_inode_info *iinfo; |
651 | 653 | ||
652 | err = -EMLINK; | 654 | err = -EMLINK; |
653 | if (dir->i_nlink >= (256 << sizeof(dir->i_nlink)) - 1) | 655 | if (dir->i_nlink >= UDF_MAX_LINKS) |
654 | goto out; | 656 | goto out; |
655 | 657 | ||
656 | err = -EIO; | 658 | err = -EIO; |
@@ -1034,9 +1036,8 @@ static int udf_link(struct dentry *old_dentry, struct inode *dir, | |||
1034 | struct fileIdentDesc cfi, *fi; | 1036 | struct fileIdentDesc cfi, *fi; |
1035 | int err; | 1037 | int err; |
1036 | 1038 | ||
1037 | if (inode->i_nlink >= (256 << sizeof(inode->i_nlink)) - 1) { | 1039 | if (inode->i_nlink >= UDF_MAX_LINKS) |
1038 | return -EMLINK; | 1040 | return -EMLINK; |
1039 | } | ||
1040 | 1041 | ||
1041 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); | 1042 | fi = udf_add_entry(dir, dentry, &fibh, &cfi, &err); |
1042 | if (!fi) { | 1043 | if (!fi) { |
@@ -1131,9 +1132,7 @@ static int udf_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1131 | goto end_rename; | 1132 | goto end_rename; |
1132 | 1133 | ||
1133 | retval = -EMLINK; | 1134 | retval = -EMLINK; |
1134 | if (!new_inode && | 1135 | if (!new_inode && new_dir->i_nlink >= UDF_MAX_LINKS) |
1135 | new_dir->i_nlink >= | ||
1136 | (256 << sizeof(new_dir->i_nlink)) - 1) | ||
1137 | goto end_rename; | 1136 | goto end_rename; |
1138 | } | 1137 | } |
1139 | if (!nfi) { | 1138 | if (!nfi) { |
@@ -1287,8 +1286,13 @@ static int udf_encode_fh(struct dentry *de, __u32 *fh, int *lenp, | |||
1287 | struct fid *fid = (struct fid *)fh; | 1286 | struct fid *fid = (struct fid *)fh; |
1288 | int type = FILEID_UDF_WITHOUT_PARENT; | 1287 | int type = FILEID_UDF_WITHOUT_PARENT; |
1289 | 1288 | ||
1290 | if (len < 3 || (connectable && len < 5)) | 1289 | if (connectable && (len < 5)) { |
1290 | *lenp = 5; | ||
1291 | return 255; | 1291 | return 255; |
1292 | } else if (len < 3) { | ||
1293 | *lenp = 3; | ||
1294 | return 255; | ||
1295 | } | ||
1292 | 1296 | ||
1293 | *lenp = 3; | 1297 | *lenp = 3; |
1294 | fid->udf.block = location.logicalBlockNum; | 1298 | fid->udf.block = location.logicalBlockNum; |
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c index 12f39b9e4437..d6f681535eb8 100644 --- a/fs/ufs/namei.c +++ b/fs/ufs/namei.c | |||
@@ -306,7 +306,6 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
306 | new_de = ufs_find_entry(new_dir, &new_dentry->d_name, &new_page); | 306 | new_de = ufs_find_entry(new_dir, &new_dentry->d_name, &new_page); |
307 | if (!new_de) | 307 | if (!new_de) |
308 | goto out_dir; | 308 | goto out_dir; |
309 | inode_inc_link_count(old_inode); | ||
310 | ufs_set_link(new_dir, new_de, new_page, old_inode); | 309 | ufs_set_link(new_dir, new_de, new_page, old_inode); |
311 | new_inode->i_ctime = CURRENT_TIME_SEC; | 310 | new_inode->i_ctime = CURRENT_TIME_SEC; |
312 | if (dir_de) | 311 | if (dir_de) |
@@ -318,12 +317,9 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
318 | if (new_dir->i_nlink >= UFS_LINK_MAX) | 317 | if (new_dir->i_nlink >= UFS_LINK_MAX) |
319 | goto out_dir; | 318 | goto out_dir; |
320 | } | 319 | } |
321 | inode_inc_link_count(old_inode); | ||
322 | err = ufs_add_link(new_dentry, old_inode); | 320 | err = ufs_add_link(new_dentry, old_inode); |
323 | if (err) { | 321 | if (err) |
324 | inode_dec_link_count(old_inode); | ||
325 | goto out_dir; | 322 | goto out_dir; |
326 | } | ||
327 | if (dir_de) | 323 | if (dir_de) |
328 | inode_inc_link_count(new_dir); | 324 | inode_inc_link_count(new_dir); |
329 | } | 325 | } |
@@ -331,12 +327,11 @@ static int ufs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
331 | /* | 327 | /* |
332 | * Like most other Unix systems, set the ctime for inodes on a | 328 | * Like most other Unix systems, set the ctime for inodes on a |
333 | * rename. | 329 | * rename. |
334 | * inode_dec_link_count() will mark the inode dirty. | ||
335 | */ | 330 | */ |
336 | old_inode->i_ctime = CURRENT_TIME_SEC; | 331 | old_inode->i_ctime = CURRENT_TIME_SEC; |
337 | 332 | ||
338 | ufs_delete_entry(old_dir, old_de, old_page); | 333 | ufs_delete_entry(old_dir, old_de, old_page); |
339 | inode_dec_link_count(old_inode); | 334 | mark_inode_dirty(old_inode); |
340 | 335 | ||
341 | if (dir_de) { | 336 | if (dir_de) { |
342 | ufs_set_link(old_inode, dir_de, dir_page, new_dir); | 337 | ufs_set_link(old_inode, dir_de, dir_page, new_dir); |
diff --git a/fs/xfs/linux-2.6/xfs_discard.c b/fs/xfs/linux-2.6/xfs_discard.c index 05201ae719e5..d61611c88012 100644 --- a/fs/xfs/linux-2.6/xfs_discard.c +++ b/fs/xfs/linux-2.6/xfs_discard.c | |||
@@ -152,6 +152,8 @@ xfs_ioc_trim( | |||
152 | 152 | ||
153 | if (!capable(CAP_SYS_ADMIN)) | 153 | if (!capable(CAP_SYS_ADMIN)) |
154 | return -XFS_ERROR(EPERM); | 154 | return -XFS_ERROR(EPERM); |
155 | if (!blk_queue_discard(q)) | ||
156 | return -XFS_ERROR(EOPNOTSUPP); | ||
155 | if (copy_from_user(&range, urange, sizeof(range))) | 157 | if (copy_from_user(&range, urange, sizeof(range))) |
156 | return -XFS_ERROR(EFAULT); | 158 | return -XFS_ERROR(EFAULT); |
157 | 159 | ||
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c index fc0114da7fdd..f4f878fc0083 100644 --- a/fs/xfs/linux-2.6/xfs_export.c +++ b/fs/xfs/linux-2.6/xfs_export.c | |||
@@ -89,8 +89,10 @@ xfs_fs_encode_fh( | |||
89 | * seven combinations work. The real answer is "don't use v2". | 89 | * seven combinations work. The real answer is "don't use v2". |
90 | */ | 90 | */ |
91 | len = xfs_fileid_length(fileid_type); | 91 | len = xfs_fileid_length(fileid_type); |
92 | if (*max_len < len) | 92 | if (*max_len < len) { |
93 | *max_len = len; | ||
93 | return 255; | 94 | return 255; |
95 | } | ||
94 | *max_len = len; | 96 | *max_len = len; |
95 | 97 | ||
96 | switch (fileid_type) { | 98 | switch (fileid_type) { |
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c index f5e2a19e0f8e..0ca0e3c024d7 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl.c +++ b/fs/xfs/linux-2.6/xfs_ioctl.c | |||
@@ -695,14 +695,19 @@ xfs_ioc_fsgeometry_v1( | |||
695 | xfs_mount_t *mp, | 695 | xfs_mount_t *mp, |
696 | void __user *arg) | 696 | void __user *arg) |
697 | { | 697 | { |
698 | xfs_fsop_geom_v1_t fsgeo; | 698 | xfs_fsop_geom_t fsgeo; |
699 | int error; | 699 | int error; |
700 | 700 | ||
701 | error = xfs_fs_geometry(mp, (xfs_fsop_geom_t *)&fsgeo, 3); | 701 | error = xfs_fs_geometry(mp, &fsgeo, 3); |
702 | if (error) | 702 | if (error) |
703 | return -error; | 703 | return -error; |
704 | 704 | ||
705 | if (copy_to_user(arg, &fsgeo, sizeof(fsgeo))) | 705 | /* |
706 | * Caller should have passed an argument of type | ||
707 | * xfs_fsop_geom_v1_t. This is a proper subset of the | ||
708 | * xfs_fsop_geom_t that xfs_fs_geometry() fills in. | ||
709 | */ | ||
710 | if (copy_to_user(arg, &fsgeo, sizeof(xfs_fsop_geom_v1_t))) | ||
706 | return -XFS_ERROR(EFAULT); | 711 | return -XFS_ERROR(EFAULT); |
707 | return 0; | 712 | return 0; |
708 | } | 713 | } |
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index cec89dd5d7d2..85668efb3e3e 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c | |||
@@ -53,6 +53,9 @@ xfs_fs_geometry( | |||
53 | xfs_fsop_geom_t *geo, | 53 | xfs_fsop_geom_t *geo, |
54 | int new_version) | 54 | int new_version) |
55 | { | 55 | { |
56 | |||
57 | memset(geo, 0, sizeof(*geo)); | ||
58 | |||
56 | geo->blocksize = mp->m_sb.sb_blocksize; | 59 | geo->blocksize = mp->m_sb.sb_blocksize; |
57 | geo->rtextsize = mp->m_sb.sb_rextsize; | 60 | geo->rtextsize = mp->m_sb.sb_rextsize; |
58 | geo->agblocks = mp->m_sb.sb_agblocks; | 61 | geo->agblocks = mp->m_sb.sb_agblocks; |
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h index 0fc16e3f0bfc..84793c7025e2 100644 --- a/include/asm-generic/fcntl.h +++ b/include/asm-generic/fcntl.h | |||
@@ -80,6 +80,10 @@ | |||
80 | #define O_SYNC (__O_SYNC|O_DSYNC) | 80 | #define O_SYNC (__O_SYNC|O_DSYNC) |
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | #ifndef O_PATH | ||
84 | #define O_PATH 010000000 | ||
85 | #endif | ||
86 | |||
83 | #ifndef O_NDELAY | 87 | #ifndef O_NDELAY |
84 | #define O_NDELAY O_NONBLOCK | 88 | #define O_NDELAY O_NONBLOCK |
85 | #endif | 89 | #endif |
diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h index 31b6188df221..b4bfe338ea0e 100644 --- a/include/asm-generic/pgtable.h +++ b/include/asm-generic/pgtable.h | |||
@@ -4,6 +4,8 @@ | |||
4 | #ifndef __ASSEMBLY__ | 4 | #ifndef __ASSEMBLY__ |
5 | #ifdef CONFIG_MMU | 5 | #ifdef CONFIG_MMU |
6 | 6 | ||
7 | #include <linux/mm_types.h> | ||
8 | |||
7 | #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS | 9 | #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS |
8 | extern int ptep_set_access_flags(struct vm_area_struct *vma, | 10 | extern int ptep_set_access_flags(struct vm_area_struct *vma, |
9 | unsigned long address, pte_t *ptep, | 11 | unsigned long address, pte_t *ptep, |
diff --git a/include/asm-generic/unistd.h b/include/asm-generic/unistd.h index b969770196c2..57af0338d270 100644 --- a/include/asm-generic/unistd.h +++ b/include/asm-generic/unistd.h | |||
@@ -646,9 +646,13 @@ __SYSCALL(__NR_prlimit64, sys_prlimit64) | |||
646 | __SYSCALL(__NR_fanotify_init, sys_fanotify_init) | 646 | __SYSCALL(__NR_fanotify_init, sys_fanotify_init) |
647 | #define __NR_fanotify_mark 263 | 647 | #define __NR_fanotify_mark 263 |
648 | __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) | 648 | __SYSCALL(__NR_fanotify_mark, sys_fanotify_mark) |
649 | #define __NR_name_to_handle_at 264 | ||
650 | __SYSCALL(__NR_name_to_handle_at, sys_name_to_handle_at) | ||
651 | #define __NR_open_by_handle_at 265 | ||
652 | __SYSCALL(__NR_open_by_handle_at, sys_open_by_handle_at) | ||
649 | 653 | ||
650 | #undef __NR_syscalls | 654 | #undef __NR_syscalls |
651 | #define __NR_syscalls 264 | 655 | #define __NR_syscalls 266 |
652 | 656 | ||
653 | /* | 657 | /* |
654 | * All syscalls below here should go away really, | 658 | * All syscalls below here should go away really, |
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index fe29aadb129d..348843b80150 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h | |||
@@ -1101,7 +1101,7 @@ struct drm_device { | |||
1101 | struct platform_device *platformdev; /**< Platform device struture */ | 1101 | struct platform_device *platformdev; /**< Platform device struture */ |
1102 | 1102 | ||
1103 | struct drm_sg_mem *sg; /**< Scatter gather memory */ | 1103 | struct drm_sg_mem *sg; /**< Scatter gather memory */ |
1104 | int num_crtcs; /**< Number of CRTCs on this device */ | 1104 | unsigned int num_crtcs; /**< Number of CRTCs on this device */ |
1105 | void *dev_private; /**< device private data */ | 1105 | void *dev_private; /**< device private data */ |
1106 | void *mm_private; | 1106 | void *mm_private; |
1107 | struct address_space *dev_mapping; | 1107 | struct address_space *dev_mapping; |
diff --git a/include/keys/rxrpc-type.h b/include/keys/rxrpc-type.h index 5cb86c307f5d..fc4875433817 100644 --- a/include/keys/rxrpc-type.h +++ b/include/keys/rxrpc-type.h | |||
@@ -99,7 +99,6 @@ struct rxrpc_key_token { | |||
99 | * structure of raw payloads passed to add_key() or instantiate key | 99 | * structure of raw payloads passed to add_key() or instantiate key |
100 | */ | 100 | */ |
101 | struct rxrpc_key_data_v1 { | 101 | struct rxrpc_key_data_v1 { |
102 | u32 kif_version; /* 1 */ | ||
103 | u16 security_index; | 102 | u16 security_index; |
104 | u16 ticket_length; | 103 | u16 ticket_length; |
105 | u32 expiry; /* time_t */ | 104 | u32 expiry; /* time_t */ |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 4d18ff34670a..d5063e1b5555 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -699,7 +699,7 @@ extern void blk_start_queue(struct request_queue *q); | |||
699 | extern void blk_stop_queue(struct request_queue *q); | 699 | extern void blk_stop_queue(struct request_queue *q); |
700 | extern void blk_sync_queue(struct request_queue *q); | 700 | extern void blk_sync_queue(struct request_queue *q); |
701 | extern void __blk_stop_queue(struct request_queue *q); | 701 | extern void __blk_stop_queue(struct request_queue *q); |
702 | extern void __blk_run_queue(struct request_queue *); | 702 | extern void __blk_run_queue(struct request_queue *q, bool force_kblockd); |
703 | extern void blk_run_queue(struct request_queue *); | 703 | extern void blk_run_queue(struct request_queue *); |
704 | extern int blk_rq_map_user(struct request_queue *, struct request *, | 704 | extern int blk_rq_map_user(struct request_queue *, struct request *, |
705 | struct rq_map_data *, void __user *, unsigned long, | 705 | struct rq_map_data *, void __user *, unsigned long, |
@@ -1088,7 +1088,6 @@ static inline void put_dev_sector(Sector p) | |||
1088 | 1088 | ||
1089 | struct work_struct; | 1089 | struct work_struct; |
1090 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); | 1090 | int kblockd_schedule_work(struct request_queue *q, struct work_struct *work); |
1091 | int kblockd_schedule_delayed_work(struct request_queue *q, struct delayed_work *dwork, unsigned long delay); | ||
1092 | 1091 | ||
1093 | #ifdef CONFIG_BLK_CGROUP | 1092 | #ifdef CONFIG_BLK_CGROUP |
1094 | /* | 1093 | /* |
@@ -1136,7 +1135,6 @@ static inline uint64_t rq_io_start_time_ns(struct request *req) | |||
1136 | extern int blk_throtl_init(struct request_queue *q); | 1135 | extern int blk_throtl_init(struct request_queue *q); |
1137 | extern void blk_throtl_exit(struct request_queue *q); | 1136 | extern void blk_throtl_exit(struct request_queue *q); |
1138 | extern int blk_throtl_bio(struct request_queue *q, struct bio **bio); | 1137 | extern int blk_throtl_bio(struct request_queue *q, struct bio **bio); |
1139 | extern void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay); | ||
1140 | extern void throtl_shutdown_timer_wq(struct request_queue *q); | 1138 | extern void throtl_shutdown_timer_wq(struct request_queue *q); |
1141 | #else /* CONFIG_BLK_DEV_THROTTLING */ | 1139 | #else /* CONFIG_BLK_DEV_THROTTLING */ |
1142 | static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio) | 1140 | static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio) |
@@ -1146,7 +1144,6 @@ static inline int blk_throtl_bio(struct request_queue *q, struct bio **bio) | |||
1146 | 1144 | ||
1147 | static inline int blk_throtl_init(struct request_queue *q) { return 0; } | 1145 | static inline int blk_throtl_init(struct request_queue *q) { return 0; } |
1148 | static inline int blk_throtl_exit(struct request_queue *q) { return 0; } | 1146 | static inline int blk_throtl_exit(struct request_queue *q) { return 0; } |
1149 | static inline void throtl_schedule_delayed_work(struct request_queue *q, unsigned long delay) {} | ||
1150 | static inline void throtl_shutdown_timer_wq(struct request_queue *q) {} | 1147 | static inline void throtl_shutdown_timer_wq(struct request_queue *q) {} |
1151 | #endif /* CONFIG_BLK_DEV_THROTTLING */ | 1148 | #endif /* CONFIG_BLK_DEV_THROTTLING */ |
1152 | 1149 | ||
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 3395cf7130f5..b22fb0d3db0f 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
@@ -245,7 +245,6 @@ static inline int blk_cmd_buf_len(struct request *rq) | |||
245 | 245 | ||
246 | extern void blk_dump_cmd(char *buf, struct request *rq); | 246 | extern void blk_dump_cmd(char *buf, struct request *rq); |
247 | extern void blk_fill_rwbs(char *rwbs, u32 rw, int bytes); | 247 | extern void blk_fill_rwbs(char *rwbs, u32 rw, int bytes); |
248 | extern void blk_fill_rwbs_rq(char *rwbs, struct request *rq); | ||
249 | 248 | ||
250 | #endif /* CONFIG_EVENT_TRACING && CONFIG_BLOCK */ | 249 | #endif /* CONFIG_EVENT_TRACING && CONFIG_BLOCK */ |
251 | 250 | ||
diff --git a/include/linux/ceph/messenger.h b/include/linux/ceph/messenger.h index c3011beac30d..31d91a64838b 100644 --- a/include/linux/ceph/messenger.h +++ b/include/linux/ceph/messenger.h | |||
@@ -123,6 +123,7 @@ struct ceph_msg_pos { | |||
123 | #define SOCK_CLOSED 11 /* socket state changed to closed */ | 123 | #define SOCK_CLOSED 11 /* socket state changed to closed */ |
124 | #define OPENING 13 /* open connection w/ (possibly new) peer */ | 124 | #define OPENING 13 /* open connection w/ (possibly new) peer */ |
125 | #define DEAD 14 /* dead, about to kfree */ | 125 | #define DEAD 14 /* dead, about to kfree */ |
126 | #define BACKOFF 15 | ||
126 | 127 | ||
127 | /* | 128 | /* |
128 | * A single connection with another host. | 129 | * A single connection with another host. |
@@ -160,7 +161,6 @@ struct ceph_connection { | |||
160 | struct list_head out_queue; | 161 | struct list_head out_queue; |
161 | struct list_head out_sent; /* sending or sent but unacked */ | 162 | struct list_head out_sent; /* sending or sent but unacked */ |
162 | u64 out_seq; /* last message queued for send */ | 163 | u64 out_seq; /* last message queued for send */ |
163 | bool out_keepalive_pending; | ||
164 | 164 | ||
165 | u64 in_seq, in_seq_acked; /* last message received, acked */ | 165 | u64 in_seq, in_seq_acked; /* last message received, acked */ |
166 | 166 | ||
diff --git a/include/linux/dcbnl.h b/include/linux/dcbnl.h index 68cd248f6d3e..66900e3c6eb1 100644 --- a/include/linux/dcbnl.h +++ b/include/linux/dcbnl.h | |||
@@ -101,8 +101,8 @@ struct ieee_pfc { | |||
101 | */ | 101 | */ |
102 | struct dcb_app { | 102 | struct dcb_app { |
103 | __u8 selector; | 103 | __u8 selector; |
104 | __u32 protocol; | ||
105 | __u8 priority; | 104 | __u8 priority; |
105 | __u16 protocol; | ||
106 | }; | 106 | }; |
107 | 107 | ||
108 | struct dcbmsg { | 108 | struct dcbmsg { |
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index 28028988c862..33a42f24b275 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h | |||
@@ -8,6 +8,9 @@ struct inode; | |||
8 | struct super_block; | 8 | struct super_block; |
9 | struct vfsmount; | 9 | struct vfsmount; |
10 | 10 | ||
11 | /* limit the handle size to NFSv4 handle size now */ | ||
12 | #define MAX_HANDLE_SZ 128 | ||
13 | |||
11 | /* | 14 | /* |
12 | * The fileid_type identifies how the file within the filesystem is encoded. | 15 | * The fileid_type identifies how the file within the filesystem is encoded. |
13 | * In theory this is freely set and parsed by the filesystem, but we try to | 16 | * In theory this is freely set and parsed by the filesystem, but we try to |
@@ -121,8 +124,10 @@ struct fid { | |||
121 | * set, the encode_fh() should store sufficient information so that a good | 124 | * set, the encode_fh() should store sufficient information so that a good |
122 | * attempt can be made to find not only the file but also it's place in the | 125 | * attempt can be made to find not only the file but also it's place in the |
123 | * filesystem. This typically means storing a reference to de->d_parent in | 126 | * filesystem. This typically means storing a reference to de->d_parent in |
124 | * the filehandle fragment. encode_fh() should return the number of bytes | 127 | * the filehandle fragment. encode_fh() should return the fileid_type on |
125 | * stored or a negative error code such as %-ENOSPC | 128 | * success and on error returns 255 (if the space needed to encode fh is |
129 | * greater than @max_len*4 bytes). On error @max_len contains the minimum | ||
130 | * size(in 4 byte unit) needed to encode the file handle. | ||
126 | * | 131 | * |
127 | * fh_to_dentry: | 132 | * fh_to_dentry: |
128 | * @fh_to_dentry is given a &struct super_block (@sb) and a file handle | 133 | * @fh_to_dentry is given a &struct super_block (@sb) and a file handle |
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h index a562fa5fb4e3..f550f894ba15 100644 --- a/include/linux/fcntl.h +++ b/include/linux/fcntl.h | |||
@@ -46,6 +46,7 @@ | |||
46 | unlinking file. */ | 46 | unlinking file. */ |
47 | #define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ | 47 | #define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ |
48 | #define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */ | 48 | #define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */ |
49 | #define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname */ | ||
49 | 50 | ||
50 | #ifdef __KERNEL__ | 51 | #ifdef __KERNEL__ |
51 | 52 | ||
diff --git a/include/linux/file.h b/include/linux/file.h index e85baebf6279..21a79958541c 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
@@ -29,6 +29,8 @@ static inline void fput_light(struct file *file, int fput_needed) | |||
29 | 29 | ||
30 | extern struct file *fget(unsigned int fd); | 30 | extern struct file *fget(unsigned int fd); |
31 | extern struct file *fget_light(unsigned int fd, int *fput_needed); | 31 | extern struct file *fget_light(unsigned int fd, int *fput_needed); |
32 | extern struct file *fget_raw(unsigned int fd); | ||
33 | extern struct file *fget_raw_light(unsigned int fd, int *fput_needed); | ||
32 | extern void set_close_on_exec(unsigned int fd, int flag); | 34 | extern void set_close_on_exec(unsigned int fd, int flag); |
33 | extern void put_filp(struct file *); | 35 | extern void put_filp(struct file *); |
34 | extern int alloc_fd(unsigned start, unsigned flags); | 36 | extern int alloc_fd(unsigned start, unsigned flags); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index bd3215940c37..13df14e2c42e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -102,6 +102,9 @@ struct inodes_stat_t { | |||
102 | /* File is huge (eg. /dev/kmem): treat loff_t as unsigned */ | 102 | /* File is huge (eg. /dev/kmem): treat loff_t as unsigned */ |
103 | #define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000) | 103 | #define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000) |
104 | 104 | ||
105 | /* File is opened with O_PATH; almost nothing can be done with it */ | ||
106 | #define FMODE_PATH ((__force fmode_t)0x4000) | ||
107 | |||
105 | /* File was opened by fanotify and shouldn't generate fanotify events */ | 108 | /* File was opened by fanotify and shouldn't generate fanotify events */ |
106 | #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) | 109 | #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) |
107 | 110 | ||
@@ -649,6 +652,7 @@ struct address_space { | |||
649 | spinlock_t private_lock; /* for use by the address_space */ | 652 | spinlock_t private_lock; /* for use by the address_space */ |
650 | struct list_head private_list; /* ditto */ | 653 | struct list_head private_list; /* ditto */ |
651 | struct address_space *assoc_mapping; /* ditto */ | 654 | struct address_space *assoc_mapping; /* ditto */ |
655 | struct mutex unmap_mutex; /* to protect unmapping */ | ||
652 | } __attribute__((aligned(sizeof(long)))); | 656 | } __attribute__((aligned(sizeof(long)))); |
653 | /* | 657 | /* |
654 | * On most architectures that alignment is already the case; but | 658 | * On most architectures that alignment is already the case; but |
@@ -977,6 +981,13 @@ struct file { | |||
977 | #endif | 981 | #endif |
978 | }; | 982 | }; |
979 | 983 | ||
984 | struct file_handle { | ||
985 | __u32 handle_bytes; | ||
986 | int handle_type; | ||
987 | /* file identifier */ | ||
988 | unsigned char f_handle[0]; | ||
989 | }; | ||
990 | |||
980 | #define get_file(x) atomic_long_inc(&(x)->f_count) | 991 | #define get_file(x) atomic_long_inc(&(x)->f_count) |
981 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) | 992 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) |
982 | #define file_count(x) atomic_long_read(&(x)->f_count) | 993 | #define file_count(x) atomic_long_read(&(x)->f_count) |
@@ -1400,6 +1411,7 @@ struct super_block { | |||
1400 | wait_queue_head_t s_wait_unfrozen; | 1411 | wait_queue_head_t s_wait_unfrozen; |
1401 | 1412 | ||
1402 | char s_id[32]; /* Informational name */ | 1413 | char s_id[32]; /* Informational name */ |
1414 | u8 s_uuid[16]; /* UUID */ | ||
1403 | 1415 | ||
1404 | void *s_fs_info; /* Filesystem private info */ | 1416 | void *s_fs_info; /* Filesystem private info */ |
1405 | fmode_t s_mode; | 1417 | fmode_t s_mode; |
@@ -1873,6 +1885,8 @@ extern void drop_collected_mounts(struct vfsmount *); | |||
1873 | extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, | 1885 | extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, |
1874 | struct vfsmount *); | 1886 | struct vfsmount *); |
1875 | extern int vfs_statfs(struct path *, struct kstatfs *); | 1887 | extern int vfs_statfs(struct path *, struct kstatfs *); |
1888 | extern int user_statfs(const char __user *, struct kstatfs *); | ||
1889 | extern int fd_statfs(int, struct kstatfs *); | ||
1876 | extern int statfs_by_dentry(struct dentry *, struct kstatfs *); | 1890 | extern int statfs_by_dentry(struct dentry *, struct kstatfs *); |
1877 | extern int freeze_super(struct super_block *super); | 1891 | extern int freeze_super(struct super_block *super); |
1878 | extern int thaw_super(struct super_block *super); | 1892 | extern int thaw_super(struct super_block *super); |
@@ -1989,6 +2003,8 @@ extern int do_fallocate(struct file *file, int mode, loff_t offset, | |||
1989 | extern long do_sys_open(int dfd, const char __user *filename, int flags, | 2003 | extern long do_sys_open(int dfd, const char __user *filename, int flags, |
1990 | int mode); | 2004 | int mode); |
1991 | extern struct file *filp_open(const char *, int, int); | 2005 | extern struct file *filp_open(const char *, int, int); |
2006 | extern struct file *file_open_root(struct dentry *, struct vfsmount *, | ||
2007 | const char *, int); | ||
1992 | extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, | 2008 | extern struct file * dentry_open(struct dentry *, struct vfsmount *, int, |
1993 | const struct cred *); | 2009 | const struct cred *); |
1994 | extern int filp_close(struct file *, fl_owner_t id); | 2010 | extern int filp_close(struct file *, fl_owner_t id); |
@@ -2139,7 +2155,7 @@ extern void check_disk_size_change(struct gendisk *disk, | |||
2139 | struct block_device *bdev); | 2155 | struct block_device *bdev); |
2140 | extern int revalidate_disk(struct gendisk *); | 2156 | extern int revalidate_disk(struct gendisk *); |
2141 | extern int check_disk_change(struct block_device *); | 2157 | extern int check_disk_change(struct block_device *); |
2142 | extern int __invalidate_device(struct block_device *); | 2158 | extern int __invalidate_device(struct block_device *, bool); |
2143 | extern int invalidate_partition(struct gendisk *, int); | 2159 | extern int invalidate_partition(struct gendisk *, int); |
2144 | #endif | 2160 | #endif |
2145 | unsigned long invalidate_mapping_pages(struct address_space *mapping, | 2161 | unsigned long invalidate_mapping_pages(struct address_space *mapping, |
@@ -2204,10 +2220,6 @@ extern struct file *create_read_pipe(struct file *f, int flags); | |||
2204 | extern struct file *create_write_pipe(int flags); | 2220 | extern struct file *create_write_pipe(int flags); |
2205 | extern void free_write_pipe(struct file *); | 2221 | extern void free_write_pipe(struct file *); |
2206 | 2222 | ||
2207 | extern struct file *do_filp_open(int dfd, const char *pathname, | ||
2208 | int open_flag, int mode, int acc_mode); | ||
2209 | extern int may_open(struct path *, int, int); | ||
2210 | |||
2211 | extern int kernel_read(struct file *, loff_t, char *, unsigned long); | 2223 | extern int kernel_read(struct file *, loff_t, char *, unsigned long); |
2212 | extern struct file * open_exec(const char *); | 2224 | extern struct file * open_exec(const char *); |
2213 | 2225 | ||
@@ -2225,6 +2237,7 @@ extern loff_t vfs_llseek(struct file *file, loff_t offset, int origin); | |||
2225 | 2237 | ||
2226 | extern int inode_init_always(struct super_block *, struct inode *); | 2238 | extern int inode_init_always(struct super_block *, struct inode *); |
2227 | extern void inode_init_once(struct inode *); | 2239 | extern void inode_init_once(struct inode *); |
2240 | extern void address_space_init_once(struct address_space *mapping); | ||
2228 | extern void ihold(struct inode * inode); | 2241 | extern void ihold(struct inode * inode); |
2229 | extern void iput(struct inode *); | 2242 | extern void iput(struct inode *); |
2230 | extern struct inode * igrab(struct inode *); | 2243 | extern struct inode * igrab(struct inode *); |
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 0b84c61607e8..dca31761b311 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h | |||
@@ -332,16 +332,19 @@ alloc_pages(gfp_t gfp_mask, unsigned int order) | |||
332 | return alloc_pages_current(gfp_mask, order); | 332 | return alloc_pages_current(gfp_mask, order); |
333 | } | 333 | } |
334 | extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order, | 334 | extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order, |
335 | struct vm_area_struct *vma, unsigned long addr); | 335 | struct vm_area_struct *vma, unsigned long addr, |
336 | int node); | ||
336 | #else | 337 | #else |
337 | #define alloc_pages(gfp_mask, order) \ | 338 | #define alloc_pages(gfp_mask, order) \ |
338 | alloc_pages_node(numa_node_id(), gfp_mask, order) | 339 | alloc_pages_node(numa_node_id(), gfp_mask, order) |
339 | #define alloc_pages_vma(gfp_mask, order, vma, addr) \ | 340 | #define alloc_pages_vma(gfp_mask, order, vma, addr, node) \ |
340 | alloc_pages(gfp_mask, order) | 341 | alloc_pages(gfp_mask, order) |
341 | #endif | 342 | #endif |
342 | #define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) | 343 | #define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) |
343 | #define alloc_page_vma(gfp_mask, vma, addr) \ | 344 | #define alloc_page_vma(gfp_mask, vma, addr) \ |
344 | alloc_pages_vma(gfp_mask, 0, vma, addr) | 345 | alloc_pages_vma(gfp_mask, 0, vma, addr, numa_node_id()) |
346 | #define alloc_page_vma_node(gfp_mask, vma, addr, node) \ | ||
347 | alloc_pages_vma(gfp_mask, 0, vma, addr, node) | ||
345 | 348 | ||
346 | extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); | 349 | extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); |
347 | extern unsigned long get_zeroed_page(gfp_t gfp_mask); | 350 | extern unsigned long get_zeroed_page(gfp_t gfp_mask); |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 55e0d4253e49..d746da19c6a2 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -55,7 +55,7 @@ | |||
55 | * Used by threaded interrupts which need to keep the | 55 | * Used by threaded interrupts which need to keep the |
56 | * irq line disabled until the threaded handler has been run. | 56 | * irq line disabled until the threaded handler has been run. |
57 | * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend | 57 | * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend |
58 | * | 58 | * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set |
59 | */ | 59 | */ |
60 | #define IRQF_DISABLED 0x00000020 | 60 | #define IRQF_DISABLED 0x00000020 |
61 | #define IRQF_SAMPLE_RANDOM 0x00000040 | 61 | #define IRQF_SAMPLE_RANDOM 0x00000040 |
@@ -67,6 +67,7 @@ | |||
67 | #define IRQF_IRQPOLL 0x00001000 | 67 | #define IRQF_IRQPOLL 0x00001000 |
68 | #define IRQF_ONESHOT 0x00002000 | 68 | #define IRQF_ONESHOT 0x00002000 |
69 | #define IRQF_NO_SUSPEND 0x00004000 | 69 | #define IRQF_NO_SUSPEND 0x00004000 |
70 | #define IRQF_FORCE_RESUME 0x00008000 | ||
70 | 71 | ||
71 | #define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND) | 72 | #define IRQF_TIMER (__IRQF_TIMER | IRQF_NO_SUSPEND) |
72 | 73 | ||
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h index 3fd36845ca45..ef4f0b6083a3 100644 --- a/include/linux/mfd/wm8994/core.h +++ b/include/linux/mfd/wm8994/core.h | |||
@@ -71,6 +71,7 @@ struct wm8994 { | |||
71 | u16 irq_masks_cache[WM8994_NUM_IRQ_REGS]; | 71 | u16 irq_masks_cache[WM8994_NUM_IRQ_REGS]; |
72 | 72 | ||
73 | /* Used over suspend/resume */ | 73 | /* Used over suspend/resume */ |
74 | bool suspended; | ||
74 | u16 ldo_regs[WM8994_NUM_LDO_REGS]; | 75 | u16 ldo_regs[WM8994_NUM_LDO_REGS]; |
75 | u16 gpio_regs[WM8994_NUM_GPIO_REGS]; | 76 | u16 gpio_regs[WM8994_NUM_GPIO_REGS]; |
76 | 77 | ||
diff --git a/include/linux/module.h b/include/linux/module.h index 9bdf27c7615b..5de42043dff0 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -62,7 +62,7 @@ struct module_version_attribute { | |||
62 | struct module_attribute mattr; | 62 | struct module_attribute mattr; |
63 | const char *module_name; | 63 | const char *module_name; |
64 | const char *version; | 64 | const char *version; |
65 | }; | 65 | } __attribute__ ((__aligned__(sizeof(void *)))); |
66 | 66 | ||
67 | struct module_kobject | 67 | struct module_kobject |
68 | { | 68 | { |
diff --git a/include/linux/namei.h b/include/linux/namei.h index f276d4fa01fc..9c8603872c36 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h | |||
@@ -19,7 +19,6 @@ struct nameidata { | |||
19 | struct path path; | 19 | struct path path; |
20 | struct qstr last; | 20 | struct qstr last; |
21 | struct path root; | 21 | struct path root; |
22 | struct file *file; | ||
23 | struct inode *inode; /* path.dentry.d_inode */ | 22 | struct inode *inode; /* path.dentry.d_inode */ |
24 | unsigned int flags; | 23 | unsigned int flags; |
25 | unsigned seq; | 24 | unsigned seq; |
@@ -63,6 +62,10 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; | |||
63 | #define LOOKUP_EXCL 0x0400 | 62 | #define LOOKUP_EXCL 0x0400 |
64 | #define LOOKUP_RENAME_TARGET 0x0800 | 63 | #define LOOKUP_RENAME_TARGET 0x0800 |
65 | 64 | ||
65 | #define LOOKUP_JUMPED 0x1000 | ||
66 | #define LOOKUP_ROOT 0x2000 | ||
67 | #define LOOKUP_EMPTY 0x4000 | ||
68 | |||
66 | extern int user_path_at(int, const char __user *, unsigned, struct path *); | 69 | extern int user_path_at(int, const char __user *, unsigned, struct path *); |
67 | 70 | ||
68 | #define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path) | 71 | #define user_path(name, path) user_path_at(AT_FDCWD, name, LOOKUP_FOLLOW, path) |
@@ -72,7 +75,7 @@ extern int user_path_at(int, const char __user *, unsigned, struct path *); | |||
72 | 75 | ||
73 | extern int kern_path(const char *, unsigned, struct path *); | 76 | extern int kern_path(const char *, unsigned, struct path *); |
74 | 77 | ||
75 | extern int path_lookup(const char *, unsigned, struct nameidata *); | 78 | extern int kern_path_parent(const char *, struct nameidata *); |
76 | extern int vfs_path_lookup(struct dentry *, struct vfsmount *, | 79 | extern int vfs_path_lookup(struct dentry *, struct vfsmount *, |
77 | const char *, unsigned int, struct nameidata *); | 80 | const char *, unsigned int, struct nameidata *); |
78 | 81 | ||
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index d971346b0340..71caf7a5e6c6 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h | |||
@@ -2392,6 +2392,9 @@ extern int netdev_notice(const struct net_device *dev, const char *format, ...) | |||
2392 | extern int netdev_info(const struct net_device *dev, const char *format, ...) | 2392 | extern int netdev_info(const struct net_device *dev, const char *format, ...) |
2393 | __attribute__ ((format (printf, 2, 3))); | 2393 | __attribute__ ((format (printf, 2, 3))); |
2394 | 2394 | ||
2395 | #define MODULE_ALIAS_NETDEV(device) \ | ||
2396 | MODULE_ALIAS("netdev-" device) | ||
2397 | |||
2395 | #if defined(DEBUG) | 2398 | #if defined(DEBUG) |
2396 | #define netdev_dbg(__dev, format, args...) \ | 2399 | #define netdev_dbg(__dev, format, args...) \ |
2397 | netdev_printk(KERN_DEBUG, __dev, format, ##args) | 2400 | netdev_printk(KERN_DEBUG, __dev, format, ##args) |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index b197563913bf..3e112de12d8d 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -68,11 +68,7 @@ struct nfs_client { | |||
68 | unsigned char cl_id_uniquifier; | 68 | unsigned char cl_id_uniquifier; |
69 | u32 cl_cb_ident; /* v4.0 callback identifier */ | 69 | u32 cl_cb_ident; /* v4.0 callback identifier */ |
70 | const struct nfs4_minor_version_ops *cl_mvops; | 70 | const struct nfs4_minor_version_ops *cl_mvops; |
71 | #endif /* CONFIG_NFS_V4 */ | ||
72 | 71 | ||
73 | #ifdef CONFIG_NFS_V4_1 | ||
74 | /* clientid returned from EXCHANGE_ID, used by session operations */ | ||
75 | u64 cl_ex_clid; | ||
76 | /* The sequence id to use for the next CREATE_SESSION */ | 72 | /* The sequence id to use for the next CREATE_SESSION */ |
77 | u32 cl_seqid; | 73 | u32 cl_seqid; |
78 | /* The flags used for obtaining the clientid during EXCHANGE_ID */ | 74 | /* The flags used for obtaining the clientid during EXCHANGE_ID */ |
@@ -80,7 +76,7 @@ struct nfs_client { | |||
80 | struct nfs4_session *cl_session; /* sharred session */ | 76 | struct nfs4_session *cl_session; /* sharred session */ |
81 | struct list_head cl_layouts; | 77 | struct list_head cl_layouts; |
82 | struct pnfs_deviceid_cache *cl_devid_cache; /* pNFS deviceid cache */ | 78 | struct pnfs_deviceid_cache *cl_devid_cache; /* pNFS deviceid cache */ |
83 | #endif /* CONFIG_NFS_V4_1 */ | 79 | #endif /* CONFIG_NFS_V4 */ |
84 | 80 | ||
85 | #ifdef CONFIG_NFS_FSCACHE | 81 | #ifdef CONFIG_NFS_FSCACHE |
86 | struct fscache_cookie *fscache; /* client index cache cookie */ | 82 | struct fscache_cookie *fscache; /* client index cache cookie */ |
@@ -185,7 +181,7 @@ struct nfs_server { | |||
185 | /* maximum number of slots to use */ | 181 | /* maximum number of slots to use */ |
186 | #define NFS4_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE | 182 | #define NFS4_MAX_SLOT_TABLE RPC_MAX_SLOT_TABLE |
187 | 183 | ||
188 | #if defined(CONFIG_NFS_V4_1) | 184 | #if defined(CONFIG_NFS_V4) |
189 | 185 | ||
190 | /* Sessions */ | 186 | /* Sessions */ |
191 | #define SLOT_TABLE_SZ (NFS4_MAX_SLOT_TABLE/(8*sizeof(long))) | 187 | #define SLOT_TABLE_SZ (NFS4_MAX_SLOT_TABLE/(8*sizeof(long))) |
@@ -225,5 +221,5 @@ struct nfs4_session { | |||
225 | struct nfs_client *clp; | 221 | struct nfs_client *clp; |
226 | }; | 222 | }; |
227 | 223 | ||
228 | #endif /* CONFIG_NFS_V4_1 */ | 224 | #endif /* CONFIG_NFS_V4 */ |
229 | #endif | 225 | #endif |
diff --git a/include/linux/pm.h b/include/linux/pm.h index dd9c7ab38270..21415cc91cbb 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
@@ -431,6 +431,8 @@ struct dev_pm_info { | |||
431 | struct list_head entry; | 431 | struct list_head entry; |
432 | struct completion completion; | 432 | struct completion completion; |
433 | struct wakeup_source *wakeup; | 433 | struct wakeup_source *wakeup; |
434 | #else | ||
435 | unsigned int should_wakeup:1; | ||
434 | #endif | 436 | #endif |
435 | #ifdef CONFIG_PM_RUNTIME | 437 | #ifdef CONFIG_PM_RUNTIME |
436 | struct timer_list suspend_timer; | 438 | struct timer_list suspend_timer; |
diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index 9cff00dd6b63..03a67db03d01 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h | |||
@@ -109,11 +109,6 @@ static inline bool device_can_wakeup(struct device *dev) | |||
109 | return dev->power.can_wakeup; | 109 | return dev->power.can_wakeup; |
110 | } | 110 | } |
111 | 111 | ||
112 | static inline bool device_may_wakeup(struct device *dev) | ||
113 | { | ||
114 | return false; | ||
115 | } | ||
116 | |||
117 | static inline struct wakeup_source *wakeup_source_create(const char *name) | 112 | static inline struct wakeup_source *wakeup_source_create(const char *name) |
118 | { | 113 | { |
119 | return NULL; | 114 | return NULL; |
@@ -134,24 +129,32 @@ static inline void wakeup_source_unregister(struct wakeup_source *ws) {} | |||
134 | 129 | ||
135 | static inline int device_wakeup_enable(struct device *dev) | 130 | static inline int device_wakeup_enable(struct device *dev) |
136 | { | 131 | { |
137 | return -EINVAL; | 132 | dev->power.should_wakeup = true; |
133 | return 0; | ||
138 | } | 134 | } |
139 | 135 | ||
140 | static inline int device_wakeup_disable(struct device *dev) | 136 | static inline int device_wakeup_disable(struct device *dev) |
141 | { | 137 | { |
138 | dev->power.should_wakeup = false; | ||
142 | return 0; | 139 | return 0; |
143 | } | 140 | } |
144 | 141 | ||
145 | static inline int device_init_wakeup(struct device *dev, bool val) | 142 | static inline int device_set_wakeup_enable(struct device *dev, bool enable) |
146 | { | 143 | { |
147 | dev->power.can_wakeup = val; | 144 | dev->power.should_wakeup = enable; |
148 | return val ? -EINVAL : 0; | 145 | return 0; |
149 | } | 146 | } |
150 | 147 | ||
148 | static inline int device_init_wakeup(struct device *dev, bool val) | ||
149 | { | ||
150 | device_set_wakeup_capable(dev, val); | ||
151 | device_set_wakeup_enable(dev, val); | ||
152 | return 0; | ||
153 | } | ||
151 | 154 | ||
152 | static inline int device_set_wakeup_enable(struct device *dev, bool enable) | 155 | static inline bool device_may_wakeup(struct device *dev) |
153 | { | 156 | { |
154 | return -EINVAL; | 157 | return dev->power.can_wakeup && dev->power.should_wakeup; |
155 | } | 158 | } |
156 | 159 | ||
157 | static inline void __pm_stay_awake(struct wakeup_source *ws) {} | 160 | static inline void __pm_stay_awake(struct wakeup_source *ws) {} |
diff --git a/include/linux/ptrace.h b/include/linux/ptrace.h index 092a04f874a8..a1147e5dd245 100644 --- a/include/linux/ptrace.h +++ b/include/linux/ptrace.h | |||
@@ -102,11 +102,8 @@ | |||
102 | 102 | ||
103 | extern long arch_ptrace(struct task_struct *child, long request, | 103 | extern long arch_ptrace(struct task_struct *child, long request, |
104 | unsigned long addr, unsigned long data); | 104 | unsigned long addr, unsigned long data); |
105 | extern int ptrace_traceme(void); | ||
106 | extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); | 105 | extern int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst, int len); |
107 | extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); | 106 | extern int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long dst, int len); |
108 | extern int ptrace_attach(struct task_struct *tsk); | ||
109 | extern int ptrace_detach(struct task_struct *, unsigned int); | ||
110 | extern void ptrace_disable(struct task_struct *); | 107 | extern void ptrace_disable(struct task_struct *); |
111 | extern int ptrace_check_attach(struct task_struct *task, int kill); | 108 | extern int ptrace_check_attach(struct task_struct *task, int kill); |
112 | extern int ptrace_request(struct task_struct *child, long request, | 109 | extern int ptrace_request(struct task_struct *child, long request, |
diff --git a/include/linux/rio_regs.h b/include/linux/rio_regs.h index d63dcbaea169..9026b30238f3 100644 --- a/include/linux/rio_regs.h +++ b/include/linux/rio_regs.h | |||
@@ -14,10 +14,12 @@ | |||
14 | #define LINUX_RIO_REGS_H | 14 | #define LINUX_RIO_REGS_H |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * In RapidIO, each device has a 2MB configuration space that is | 17 | * In RapidIO, each device has a 16MB configuration space that is |
18 | * accessed via maintenance transactions. Portions of configuration | 18 | * accessed via maintenance transactions. Portions of configuration |
19 | * space are standardized and/or reserved. | 19 | * space are standardized and/or reserved. |
20 | */ | 20 | */ |
21 | #define RIO_MAINT_SPACE_SZ 0x1000000 /* 16MB of RapidIO mainenance space */ | ||
22 | |||
21 | #define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */ | 23 | #define RIO_DEV_ID_CAR 0x00 /* [I] Device Identity CAR */ |
22 | #define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */ | 24 | #define RIO_DEV_INFO_CAR 0x04 /* [I] Device Information CAR */ |
23 | #define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */ | 25 | #define RIO_ASM_ID_CAR 0x08 /* [I] Assembly Identity CAR */ |
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index 88513fd8e208..d81db8012c63 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h | |||
@@ -212,6 +212,7 @@ struct rpc_task *rpc_run_task(const struct rpc_task_setup *); | |||
212 | struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req, | 212 | struct rpc_task *rpc_run_bc_task(struct rpc_rqst *req, |
213 | const struct rpc_call_ops *ops); | 213 | const struct rpc_call_ops *ops); |
214 | void rpc_put_task(struct rpc_task *); | 214 | void rpc_put_task(struct rpc_task *); |
215 | void rpc_put_task_async(struct rpc_task *); | ||
215 | void rpc_exit_task(struct rpc_task *); | 216 | void rpc_exit_task(struct rpc_task *); |
216 | void rpc_exit(struct rpc_task *, int); | 217 | void rpc_exit(struct rpc_task *, int); |
217 | void rpc_release_calldata(const struct rpc_call_ops *, void *); | 218 | void rpc_release_calldata(const struct rpc_call_ops *, void *); |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 98664db1be47..2d9b79c0f224 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -62,6 +62,7 @@ struct robust_list_head; | |||
62 | struct getcpu_cache; | 62 | struct getcpu_cache; |
63 | struct old_linux_dirent; | 63 | struct old_linux_dirent; |
64 | struct perf_event_attr; | 64 | struct perf_event_attr; |
65 | struct file_handle; | ||
65 | 66 | ||
66 | #include <linux/types.h> | 67 | #include <linux/types.h> |
67 | #include <linux/aio_abi.h> | 68 | #include <linux/aio_abi.h> |
@@ -832,5 +833,10 @@ asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len, | |||
832 | unsigned long prot, unsigned long flags, | 833 | unsigned long prot, unsigned long flags, |
833 | unsigned long fd, unsigned long pgoff); | 834 | unsigned long fd, unsigned long pgoff); |
834 | asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg); | 835 | asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg); |
835 | 836 | asmlinkage long sys_name_to_handle_at(int dfd, const char __user *name, | |
837 | struct file_handle __user *handle, | ||
838 | int __user *mnt_id, int flag); | ||
839 | asmlinkage long sys_open_by_handle_at(int mountdirfd, | ||
840 | struct file_handle __user *handle, | ||
841 | int flags); | ||
836 | #endif | 842 | #endif |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 7bb5cb64f3b8..11684d9e6bd2 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -930,6 +930,7 @@ enum | |||
930 | 930 | ||
931 | #ifdef __KERNEL__ | 931 | #ifdef __KERNEL__ |
932 | #include <linux/list.h> | 932 | #include <linux/list.h> |
933 | #include <linux/rcupdate.h> | ||
933 | 934 | ||
934 | /* For the /proc/sys support */ | 935 | /* For the /proc/sys support */ |
935 | struct ctl_table; | 936 | struct ctl_table; |
@@ -1037,10 +1038,15 @@ struct ctl_table_root { | |||
1037 | struct ctl_table trees. */ | 1038 | struct ctl_table trees. */ |
1038 | struct ctl_table_header | 1039 | struct ctl_table_header |
1039 | { | 1040 | { |
1040 | struct ctl_table *ctl_table; | 1041 | union { |
1041 | struct list_head ctl_entry; | 1042 | struct { |
1042 | int used; | 1043 | struct ctl_table *ctl_table; |
1043 | int count; | 1044 | struct list_head ctl_entry; |
1045 | int used; | ||
1046 | int count; | ||
1047 | }; | ||
1048 | struct rcu_head rcu; | ||
1049 | }; | ||
1044 | struct completion *unregistering; | 1050 | struct completion *unregistering; |
1045 | struct ctl_table *ctl_table_arg; | 1051 | struct ctl_table *ctl_table_arg; |
1046 | struct ctl_table_root *root; | 1052 | struct ctl_table_root *root; |
diff --git a/include/linux/thermal.h b/include/linux/thermal.h index 8651556dbd52..d3ec89fb4122 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h | |||
@@ -172,6 +172,14 @@ void thermal_zone_device_update(struct thermal_zone_device *); | |||
172 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, | 172 | struct thermal_cooling_device *thermal_cooling_device_register(char *, void *, |
173 | const struct thermal_cooling_device_ops *); | 173 | const struct thermal_cooling_device_ops *); |
174 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); | 174 | void thermal_cooling_device_unregister(struct thermal_cooling_device *); |
175 | |||
176 | #ifdef CONFIG_NET | ||
175 | extern int generate_netlink_event(u32 orig, enum events event); | 177 | extern int generate_netlink_event(u32 orig, enum events event); |
178 | #else | ||
179 | static inline int generate_netlink_event(u32 orig, enum events event) | ||
180 | { | ||
181 | return 0; | ||
182 | } | ||
183 | #endif | ||
176 | 184 | ||
177 | #endif /* __THERMAL_H__ */ | 185 | #endif /* __THERMAL_H__ */ |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 4a3cd2cd2f5e..96e50e0ce3ca 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -89,6 +89,18 @@ | |||
89 | #define IPV6_ADDR_SCOPE_GLOBAL 0x0e | 89 | #define IPV6_ADDR_SCOPE_GLOBAL 0x0e |
90 | 90 | ||
91 | /* | 91 | /* |
92 | * Addr flags | ||
93 | */ | ||
94 | #ifdef __KERNEL__ | ||
95 | #define IPV6_ADDR_MC_FLAG_TRANSIENT(a) \ | ||
96 | ((a)->s6_addr[1] & 0x10) | ||
97 | #define IPV6_ADDR_MC_FLAG_PREFIX(a) \ | ||
98 | ((a)->s6_addr[1] & 0x20) | ||
99 | #define IPV6_ADDR_MC_FLAG_RENDEZVOUS(a) \ | ||
100 | ((a)->s6_addr[1] & 0x40) | ||
101 | #endif | ||
102 | |||
103 | /* | ||
92 | * fragmentation header | 104 | * fragmentation header |
93 | */ | 105 | */ |
94 | 106 | ||
diff --git a/include/net/netfilter/nf_tproxy_core.h b/include/net/netfilter/nf_tproxy_core.h index cd85b3bc8327..e505358d8999 100644 --- a/include/net/netfilter/nf_tproxy_core.h +++ b/include/net/netfilter/nf_tproxy_core.h | |||
@@ -201,18 +201,8 @@ nf_tproxy_get_sock_v6(struct net *net, const u8 protocol, | |||
201 | } | 201 | } |
202 | #endif | 202 | #endif |
203 | 203 | ||
204 | static inline void | ||
205 | nf_tproxy_put_sock(struct sock *sk) | ||
206 | { | ||
207 | /* TIME_WAIT inet sockets have to be handled differently */ | ||
208 | if ((sk->sk_protocol == IPPROTO_TCP) && (sk->sk_state == TCP_TIME_WAIT)) | ||
209 | inet_twsk_put(inet_twsk(sk)); | ||
210 | else | ||
211 | sock_put(sk); | ||
212 | } | ||
213 | |||
214 | /* assign a socket to the skb -- consumes sk */ | 204 | /* assign a socket to the skb -- consumes sk */ |
215 | int | 205 | void |
216 | nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk); | 206 | nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk); |
217 | 207 | ||
218 | #endif | 208 | #endif |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 160a407c1963..04f8556313d5 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -199,7 +199,7 @@ struct tcf_proto { | |||
199 | 199 | ||
200 | struct qdisc_skb_cb { | 200 | struct qdisc_skb_cb { |
201 | unsigned int pkt_len; | 201 | unsigned int pkt_len; |
202 | char data[]; | 202 | long data[]; |
203 | }; | 203 | }; |
204 | 204 | ||
205 | static inline int qdisc_qlen(struct Qdisc *q) | 205 | static inline int qdisc_qlen(struct Qdisc *q) |
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 8479b66c067b..3fd5064dd43a 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h | |||
@@ -261,6 +261,7 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev); | |||
261 | #define CONF_ENABLE_ESR 0x0008 | 261 | #define CONF_ENABLE_ESR 0x0008 |
262 | #define CONF_ENABLE_IOCARD 0x0010 /* auto-enabled if IO resources or IRQ | 262 | #define CONF_ENABLE_IOCARD 0x0010 /* auto-enabled if IO resources or IRQ |
263 | * (CONF_ENABLE_IRQ) in use */ | 263 | * (CONF_ENABLE_IRQ) in use */ |
264 | #define CONF_ENABLE_ZVCARD 0x0020 | ||
264 | 265 | ||
265 | /* flags used by pcmcia_loop_config() autoconfiguration */ | 266 | /* flags used by pcmcia_loop_config() autoconfiguration */ |
266 | #define CONF_AUTO_CHECK_VCC 0x0100 /* check for matching Vcc? */ | 267 | #define CONF_AUTO_CHECK_VCC 0x0100 /* check for matching Vcc? */ |
diff --git a/include/sound/wm8903.h b/include/sound/wm8903.h index b4a0db2307ef..1eeebd534f7e 100644 --- a/include/sound/wm8903.h +++ b/include/sound/wm8903.h | |||
@@ -17,13 +17,9 @@ | |||
17 | /* | 17 | /* |
18 | * R6 (0x06) - Mic Bias Control 0 | 18 | * R6 (0x06) - Mic Bias Control 0 |
19 | */ | 19 | */ |
20 | #define WM8903_MICDET_HYST_ENA 0x0080 /* MICDET_HYST_ENA */ | 20 | #define WM8903_MICDET_THR_MASK 0x0030 /* MICDET_THR - [5:4] */ |
21 | #define WM8903_MICDET_HYST_ENA_MASK 0x0080 /* MICDET_HYST_ENA */ | 21 | #define WM8903_MICDET_THR_SHIFT 4 /* MICDET_THR - [5:4] */ |
22 | #define WM8903_MICDET_HYST_ENA_SHIFT 7 /* MICDET_HYST_ENA */ | 22 | #define WM8903_MICDET_THR_WIDTH 2 /* MICDET_THR - [5:4] */ |
23 | #define WM8903_MICDET_HYST_ENA_WIDTH 1 /* MICDET_HYST_ENA */ | ||
24 | #define WM8903_MICDET_THR_MASK 0x0070 /* MICDET_THR - [6:4] */ | ||
25 | #define WM8903_MICDET_THR_SHIFT 4 /* MICDET_THR - [6:4] */ | ||
26 | #define WM8903_MICDET_THR_WIDTH 3 /* MICDET_THR - [6:4] */ | ||
27 | #define WM8903_MICSHORT_THR_MASK 0x000C /* MICSHORT_THR - [3:2] */ | 23 | #define WM8903_MICSHORT_THR_MASK 0x000C /* MICSHORT_THR - [3:2] */ |
28 | #define WM8903_MICSHORT_THR_SHIFT 2 /* MICSHORT_THR - [3:2] */ | 24 | #define WM8903_MICSHORT_THR_SHIFT 2 /* MICSHORT_THR - [3:2] */ |
29 | #define WM8903_MICSHORT_THR_WIDTH 2 /* MICSHORT_THR - [3:2] */ | 25 | #define WM8903_MICSHORT_THR_WIDTH 2 /* MICSHORT_THR - [3:2] */ |
diff --git a/include/target/target_core_transport.h b/include/target/target_core_transport.h index 246940511579..2e8ec51f0615 100644 --- a/include/target/target_core_transport.h +++ b/include/target/target_core_transport.h | |||
@@ -135,6 +135,8 @@ extern void transport_complete_task(struct se_task *, int); | |||
135 | extern void transport_add_task_to_execute_queue(struct se_task *, | 135 | extern void transport_add_task_to_execute_queue(struct se_task *, |
136 | struct se_task *, | 136 | struct se_task *, |
137 | struct se_device *); | 137 | struct se_device *); |
138 | extern void transport_remove_task_from_execute_queue(struct se_task *, | ||
139 | struct se_device *); | ||
138 | unsigned char *transport_dump_cmd_direction(struct se_cmd *); | 140 | unsigned char *transport_dump_cmd_direction(struct se_cmd *); |
139 | extern void transport_dump_dev_state(struct se_device *, char *, int *); | 141 | extern void transport_dump_dev_state(struct se_device *, char *, int *); |
140 | extern void transport_dump_dev_info(struct se_device *, struct se_lun *, | 142 | extern void transport_dump_dev_info(struct se_device *, struct se_lun *, |
diff --git a/include/trace/events/block.h b/include/trace/events/block.h index aba421d68f6f..78f18adb49c8 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h | |||
@@ -31,7 +31,7 @@ DECLARE_EVENT_CLASS(block_rq_with_error, | |||
31 | 0 : blk_rq_sectors(rq); | 31 | 0 : blk_rq_sectors(rq); |
32 | __entry->errors = rq->errors; | 32 | __entry->errors = rq->errors; |
33 | 33 | ||
34 | blk_fill_rwbs_rq(__entry->rwbs, rq); | 34 | blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq)); |
35 | blk_dump_cmd(__get_str(cmd), rq); | 35 | blk_dump_cmd(__get_str(cmd), rq); |
36 | ), | 36 | ), |
37 | 37 | ||
@@ -118,7 +118,7 @@ DECLARE_EVENT_CLASS(block_rq, | |||
118 | __entry->bytes = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? | 118 | __entry->bytes = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
119 | blk_rq_bytes(rq) : 0; | 119 | blk_rq_bytes(rq) : 0; |
120 | 120 | ||
121 | blk_fill_rwbs_rq(__entry->rwbs, rq); | 121 | blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq)); |
122 | blk_dump_cmd(__get_str(cmd), rq); | 122 | blk_dump_cmd(__get_str(cmd), rq); |
123 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); | 123 | memcpy(__entry->comm, current->comm, TASK_COMM_LEN); |
124 | ), | 124 | ), |
@@ -563,7 +563,7 @@ TRACE_EVENT(block_rq_remap, | |||
563 | __entry->nr_sector = blk_rq_sectors(rq); | 563 | __entry->nr_sector = blk_rq_sectors(rq); |
564 | __entry->old_dev = dev; | 564 | __entry->old_dev = dev; |
565 | __entry->old_sector = from; | 565 | __entry->old_sector = from; |
566 | blk_fill_rwbs_rq(__entry->rwbs, rq); | 566 | blk_fill_rwbs(__entry->rwbs, rq->cmd_flags, blk_rq_bytes(rq)); |
567 | ), | 567 | ), |
568 | 568 | ||
569 | TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", | 569 | TP_printk("%d,%d %s %llu + %u <- (%d,%d) %llu", |
diff --git a/include/xen/events.h b/include/xen/events.h index 00f53ddcc062..962da2ced5b4 100644 --- a/include/xen/events.h +++ b/include/xen/events.h | |||
@@ -75,11 +75,9 @@ int xen_allocate_pirq(unsigned gsi, int shareable, char *name); | |||
75 | int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name); | 75 | int xen_map_pirq_gsi(unsigned pirq, unsigned gsi, int shareable, char *name); |
76 | 76 | ||
77 | #ifdef CONFIG_PCI_MSI | 77 | #ifdef CONFIG_PCI_MSI |
78 | /* Allocate an irq and a pirq to be used with MSIs. */ | 78 | int xen_allocate_pirq_msi(struct pci_dev *dev, struct msi_desc *msidesc); |
79 | #define XEN_ALLOC_PIRQ (1 << 0) | 79 | int xen_bind_pirq_msi_to_irq(struct pci_dev *dev, struct msi_desc *msidesc, |
80 | #define XEN_ALLOC_IRQ (1 << 1) | 80 | int pirq, int vector, const char *name); |
81 | void xen_allocate_pirq_msi(char *name, int *irq, int *pirq, int alloc_mask); | ||
82 | int xen_create_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int type); | ||
83 | #endif | 81 | #endif |
84 | 82 | ||
85 | /* De-allocates the above mentioned physical interrupt. */ | 83 | /* De-allocates the above mentioned physical interrupt. */ |
diff --git a/include/xen/interface/io/blkif.h b/include/xen/interface/io/blkif.h index c2d1fa4dc1ee..61e523af3c46 100644 --- a/include/xen/interface/io/blkif.h +++ b/include/xen/interface/io/blkif.h | |||
@@ -51,11 +51,7 @@ typedef uint64_t blkif_sector_t; | |||
51 | */ | 51 | */ |
52 | #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 | 52 | #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 |
53 | 53 | ||
54 | struct blkif_request { | 54 | struct blkif_request_rw { |
55 | uint8_t operation; /* BLKIF_OP_??? */ | ||
56 | uint8_t nr_segments; /* number of segments */ | ||
57 | blkif_vdev_t handle; /* only for read/write requests */ | ||
58 | uint64_t id; /* private guest value, echoed in resp */ | ||
59 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ | 55 | blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ |
60 | struct blkif_request_segment { | 56 | struct blkif_request_segment { |
61 | grant_ref_t gref; /* reference to I/O buffer frame */ | 57 | grant_ref_t gref; /* reference to I/O buffer frame */ |
@@ -65,6 +61,16 @@ struct blkif_request { | |||
65 | } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; | 61 | } seg[BLKIF_MAX_SEGMENTS_PER_REQUEST]; |
66 | }; | 62 | }; |
67 | 63 | ||
64 | struct blkif_request { | ||
65 | uint8_t operation; /* BLKIF_OP_??? */ | ||
66 | uint8_t nr_segments; /* number of segments */ | ||
67 | blkif_vdev_t handle; /* only for read/write requests */ | ||
68 | uint64_t id; /* private guest value, echoed in resp */ | ||
69 | union { | ||
70 | struct blkif_request_rw rw; | ||
71 | } u; | ||
72 | }; | ||
73 | |||
68 | struct blkif_response { | 74 | struct blkif_response { |
69 | uint64_t id; /* copied from request */ | 75 | uint64_t id; /* copied from request */ |
70 | uint8_t operation; /* copied from request */ | 76 | uint8_t operation; /* copied from request */ |
@@ -91,4 +97,25 @@ DEFINE_RING_TYPES(blkif, struct blkif_request, struct blkif_response); | |||
91 | #define VDISK_REMOVABLE 0x2 | 97 | #define VDISK_REMOVABLE 0x2 |
92 | #define VDISK_READONLY 0x4 | 98 | #define VDISK_READONLY 0x4 |
93 | 99 | ||
100 | /* Xen-defined major numbers for virtual disks, they look strangely | ||
101 | * familiar */ | ||
102 | #define XEN_IDE0_MAJOR 3 | ||
103 | #define XEN_IDE1_MAJOR 22 | ||
104 | #define XEN_SCSI_DISK0_MAJOR 8 | ||
105 | #define XEN_SCSI_DISK1_MAJOR 65 | ||
106 | #define XEN_SCSI_DISK2_MAJOR 66 | ||
107 | #define XEN_SCSI_DISK3_MAJOR 67 | ||
108 | #define XEN_SCSI_DISK4_MAJOR 68 | ||
109 | #define XEN_SCSI_DISK5_MAJOR 69 | ||
110 | #define XEN_SCSI_DISK6_MAJOR 70 | ||
111 | #define XEN_SCSI_DISK7_MAJOR 71 | ||
112 | #define XEN_SCSI_DISK8_MAJOR 128 | ||
113 | #define XEN_SCSI_DISK9_MAJOR 129 | ||
114 | #define XEN_SCSI_DISK10_MAJOR 130 | ||
115 | #define XEN_SCSI_DISK11_MAJOR 131 | ||
116 | #define XEN_SCSI_DISK12_MAJOR 132 | ||
117 | #define XEN_SCSI_DISK13_MAJOR 133 | ||
118 | #define XEN_SCSI_DISK14_MAJOR 134 | ||
119 | #define XEN_SCSI_DISK15_MAJOR 135 | ||
120 | |||
94 | #endif /* __XEN_PUBLIC_IO_BLKIF_H__ */ | 121 | #endif /* __XEN_PUBLIC_IO_BLKIF_H__ */ |
diff --git a/include/xen/interface/xen.h b/include/xen/interface/xen.h index 2befa3e2f1bc..b33257bc7e83 100644 --- a/include/xen/interface/xen.h +++ b/include/xen/interface/xen.h | |||
@@ -30,7 +30,7 @@ | |||
30 | #define __HYPERVISOR_stack_switch 3 | 30 | #define __HYPERVISOR_stack_switch 3 |
31 | #define __HYPERVISOR_set_callbacks 4 | 31 | #define __HYPERVISOR_set_callbacks 4 |
32 | #define __HYPERVISOR_fpu_taskswitch 5 | 32 | #define __HYPERVISOR_fpu_taskswitch 5 |
33 | #define __HYPERVISOR_sched_op 6 | 33 | #define __HYPERVISOR_sched_op_compat 6 |
34 | #define __HYPERVISOR_dom0_op 7 | 34 | #define __HYPERVISOR_dom0_op 7 |
35 | #define __HYPERVISOR_set_debugreg 8 | 35 | #define __HYPERVISOR_set_debugreg 8 |
36 | #define __HYPERVISOR_get_debugreg 9 | 36 | #define __HYPERVISOR_get_debugreg 9 |
@@ -52,7 +52,7 @@ | |||
52 | #define __HYPERVISOR_mmuext_op 26 | 52 | #define __HYPERVISOR_mmuext_op 26 |
53 | #define __HYPERVISOR_acm_op 27 | 53 | #define __HYPERVISOR_acm_op 27 |
54 | #define __HYPERVISOR_nmi_op 28 | 54 | #define __HYPERVISOR_nmi_op 28 |
55 | #define __HYPERVISOR_sched_op_new 29 | 55 | #define __HYPERVISOR_sched_op 29 |
56 | #define __HYPERVISOR_callback_op 30 | 56 | #define __HYPERVISOR_callback_op 30 |
57 | #define __HYPERVISOR_xenoprof_op 31 | 57 | #define __HYPERVISOR_xenoprof_op 31 |
58 | #define __HYPERVISOR_event_channel_op 32 | 58 | #define __HYPERVISOR_event_channel_op 32 |
diff --git a/include/xen/xen-ops.h b/include/xen/xen-ops.h index 98b92154a264..03c85d7387fb 100644 --- a/include/xen/xen-ops.h +++ b/include/xen/xen-ops.h | |||
@@ -5,9 +5,9 @@ | |||
5 | 5 | ||
6 | DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); | 6 | DECLARE_PER_CPU(struct vcpu_info *, xen_vcpu); |
7 | 7 | ||
8 | void xen_pre_suspend(void); | 8 | void xen_arch_pre_suspend(void); |
9 | void xen_post_suspend(int suspend_cancelled); | 9 | void xen_arch_post_suspend(int suspend_cancelled); |
10 | void xen_hvm_post_suspend(int suspend_cancelled); | 10 | void xen_arch_hvm_post_suspend(int suspend_cancelled); |
11 | 11 | ||
12 | void xen_mm_pin_all(void); | 12 | void xen_mm_pin_all(void); |
13 | void xen_mm_unpin_all(void); | 13 | void xen_mm_unpin_all(void); |
diff --git a/init/Kconfig b/init/Kconfig index be788c0957d4..e72fa17fe559 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -287,6 +287,18 @@ config BSD_PROCESS_ACCT_V3 | |||
287 | for processing it. A preliminary version of these tools is available | 287 | for processing it. A preliminary version of these tools is available |
288 | at <http://www.gnu.org/software/acct/>. | 288 | at <http://www.gnu.org/software/acct/>. |
289 | 289 | ||
290 | config FHANDLE | ||
291 | bool "open by fhandle syscalls" | ||
292 | select EXPORTFS | ||
293 | help | ||
294 | If you say Y here, a user level program will be able to map | ||
295 | file names to handle and then later use the handle for | ||
296 | different file system operations. This is useful in implementing | ||
297 | userspace file servers, which now track files using handles instead | ||
298 | of names. The handle would remain the same even if file names | ||
299 | get renamed. Enables open_by_handle_at(2) and name_to_handle_at(2) | ||
300 | syscalls. | ||
301 | |||
290 | config TASKSTATS | 302 | config TASKSTATS |
291 | bool "Export task/process statistics through netlink (EXPERIMENTAL)" | 303 | bool "Export task/process statistics through netlink (EXPERIMENTAL)" |
292 | depends on NET | 304 | depends on NET |
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index d2e3c7866460..e683869365d9 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c | |||
@@ -144,9 +144,9 @@ int audit_watch_compare(struct audit_watch *watch, unsigned long ino, dev_t dev) | |||
144 | } | 144 | } |
145 | 145 | ||
146 | /* Initialize a parent watch entry. */ | 146 | /* Initialize a parent watch entry. */ |
147 | static struct audit_parent *audit_init_parent(struct nameidata *ndp) | 147 | static struct audit_parent *audit_init_parent(struct path *path) |
148 | { | 148 | { |
149 | struct inode *inode = ndp->path.dentry->d_inode; | 149 | struct inode *inode = path->dentry->d_inode; |
150 | struct audit_parent *parent; | 150 | struct audit_parent *parent; |
151 | int ret; | 151 | int ret; |
152 | 152 | ||
@@ -353,53 +353,40 @@ static void audit_remove_parent_watches(struct audit_parent *parent) | |||
353 | } | 353 | } |
354 | 354 | ||
355 | /* Get path information necessary for adding watches. */ | 355 | /* Get path information necessary for adding watches. */ |
356 | static int audit_get_nd(char *path, struct nameidata **ndp, struct nameidata **ndw) | 356 | static int audit_get_nd(struct audit_watch *watch, struct path *parent) |
357 | { | 357 | { |
358 | struct nameidata *ndparent, *ndwatch; | 358 | struct nameidata nd; |
359 | struct dentry *d; | ||
359 | int err; | 360 | int err; |
360 | 361 | ||
361 | ndparent = kmalloc(sizeof(*ndparent), GFP_KERNEL); | 362 | err = kern_path_parent(watch->path, &nd); |
362 | if (unlikely(!ndparent)) | 363 | if (err) |
363 | return -ENOMEM; | 364 | return err; |
364 | 365 | ||
365 | ndwatch = kmalloc(sizeof(*ndwatch), GFP_KERNEL); | 366 | if (nd.last_type != LAST_NORM) { |
366 | if (unlikely(!ndwatch)) { | 367 | path_put(&nd.path); |
367 | kfree(ndparent); | 368 | return -EINVAL; |
368 | return -ENOMEM; | ||
369 | } | 369 | } |
370 | 370 | ||
371 | err = path_lookup(path, LOOKUP_PARENT, ndparent); | 371 | mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); |
372 | if (err) { | 372 | d = lookup_one_len(nd.last.name, nd.path.dentry, nd.last.len); |
373 | kfree(ndparent); | 373 | if (IS_ERR(d)) { |
374 | kfree(ndwatch); | 374 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); |
375 | return err; | 375 | path_put(&nd.path); |
376 | return PTR_ERR(d); | ||
376 | } | 377 | } |
377 | 378 | if (d->d_inode) { | |
378 | err = path_lookup(path, 0, ndwatch); | 379 | /* update watch filter fields */ |
379 | if (err) { | 380 | watch->dev = d->d_inode->i_sb->s_dev; |
380 | kfree(ndwatch); | 381 | watch->ino = d->d_inode->i_ino; |
381 | ndwatch = NULL; | ||
382 | } | 382 | } |
383 | mutex_unlock(&nd.path.dentry->d_inode->i_mutex); | ||
383 | 384 | ||
384 | *ndp = ndparent; | 385 | *parent = nd.path; |
385 | *ndw = ndwatch; | 386 | dput(d); |
386 | |||
387 | return 0; | 387 | return 0; |
388 | } | 388 | } |
389 | 389 | ||
390 | /* Release resources used for watch path information. */ | ||
391 | static void audit_put_nd(struct nameidata *ndp, struct nameidata *ndw) | ||
392 | { | ||
393 | if (ndp) { | ||
394 | path_put(&ndp->path); | ||
395 | kfree(ndp); | ||
396 | } | ||
397 | if (ndw) { | ||
398 | path_put(&ndw->path); | ||
399 | kfree(ndw); | ||
400 | } | ||
401 | } | ||
402 | |||
403 | /* Associate the given rule with an existing parent. | 390 | /* Associate the given rule with an existing parent. |
404 | * Caller must hold audit_filter_mutex. */ | 391 | * Caller must hold audit_filter_mutex. */ |
405 | static void audit_add_to_parent(struct audit_krule *krule, | 392 | static void audit_add_to_parent(struct audit_krule *krule, |
@@ -440,31 +427,24 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list) | |||
440 | { | 427 | { |
441 | struct audit_watch *watch = krule->watch; | 428 | struct audit_watch *watch = krule->watch; |
442 | struct audit_parent *parent; | 429 | struct audit_parent *parent; |
443 | struct nameidata *ndp = NULL, *ndw = NULL; | 430 | struct path parent_path; |
444 | int h, ret = 0; | 431 | int h, ret = 0; |
445 | 432 | ||
446 | mutex_unlock(&audit_filter_mutex); | 433 | mutex_unlock(&audit_filter_mutex); |
447 | 434 | ||
448 | /* Avoid calling path_lookup under audit_filter_mutex. */ | 435 | /* Avoid calling path_lookup under audit_filter_mutex. */ |
449 | ret = audit_get_nd(watch->path, &ndp, &ndw); | 436 | ret = audit_get_nd(watch, &parent_path); |
450 | if (ret) { | ||
451 | /* caller expects mutex locked */ | ||
452 | mutex_lock(&audit_filter_mutex); | ||
453 | goto error; | ||
454 | } | ||
455 | 437 | ||
438 | /* caller expects mutex locked */ | ||
456 | mutex_lock(&audit_filter_mutex); | 439 | mutex_lock(&audit_filter_mutex); |
457 | 440 | ||
458 | /* update watch filter fields */ | 441 | if (ret) |
459 | if (ndw) { | 442 | return ret; |
460 | watch->dev = ndw->path.dentry->d_inode->i_sb->s_dev; | ||
461 | watch->ino = ndw->path.dentry->d_inode->i_ino; | ||
462 | } | ||
463 | 443 | ||
464 | /* either find an old parent or attach a new one */ | 444 | /* either find an old parent or attach a new one */ |
465 | parent = audit_find_parent(ndp->path.dentry->d_inode); | 445 | parent = audit_find_parent(parent_path.dentry->d_inode); |
466 | if (!parent) { | 446 | if (!parent) { |
467 | parent = audit_init_parent(ndp); | 447 | parent = audit_init_parent(&parent_path); |
468 | if (IS_ERR(parent)) { | 448 | if (IS_ERR(parent)) { |
469 | ret = PTR_ERR(parent); | 449 | ret = PTR_ERR(parent); |
470 | goto error; | 450 | goto error; |
@@ -479,9 +459,8 @@ int audit_add_watch(struct audit_krule *krule, struct list_head **list) | |||
479 | h = audit_hash_ino((u32)watch->ino); | 459 | h = audit_hash_ino((u32)watch->ino); |
480 | *list = &audit_inode_hash[h]; | 460 | *list = &audit_inode_hash[h]; |
481 | error: | 461 | error: |
482 | audit_put_nd(ndp, ndw); /* NULL args OK */ | 462 | path_put(&parent_path); |
483 | return ret; | 463 | return ret; |
484 | |||
485 | } | 464 | } |
486 | 465 | ||
487 | void audit_remove_watch_rule(struct audit_krule *krule) | 466 | void audit_remove_watch_rule(struct audit_krule *krule) |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 4349935c2ad8..e92e98189032 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -1575,8 +1575,10 @@ static int cpuset_write_resmask(struct cgroup *cgrp, struct cftype *cft, | |||
1575 | return -ENODEV; | 1575 | return -ENODEV; |
1576 | 1576 | ||
1577 | trialcs = alloc_trial_cpuset(cs); | 1577 | trialcs = alloc_trial_cpuset(cs); |
1578 | if (!trialcs) | 1578 | if (!trialcs) { |
1579 | return -ENOMEM; | 1579 | retval = -ENOMEM; |
1580 | goto out; | ||
1581 | } | ||
1580 | 1582 | ||
1581 | switch (cft->private) { | 1583 | switch (cft->private) { |
1582 | case FILE_CPULIST: | 1584 | case FILE_CPULIST: |
@@ -1591,6 +1593,7 @@ static int cpuset_write_resmask(struct cgroup *cgrp, struct cftype *cft, | |||
1591 | } | 1593 | } |
1592 | 1594 | ||
1593 | free_trial_cpuset(trialcs); | 1595 | free_trial_cpuset(trialcs); |
1596 | out: | ||
1594 | cgroup_unlock(); | 1597 | cgroup_unlock(); |
1595 | return retval; | 1598 | return retval; |
1596 | } | 1599 | } |
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index 4571ae7e085a..99c3bc8a6fb4 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h | |||
@@ -3,6 +3,12 @@ | |||
3 | */ | 3 | */ |
4 | #include <linux/irqdesc.h> | 4 | #include <linux/irqdesc.h> |
5 | 5 | ||
6 | #ifdef CONFIG_SPARSE_IRQ | ||
7 | # define IRQ_BITMAP_BITS (NR_IRQS + 8196) | ||
8 | #else | ||
9 | # define IRQ_BITMAP_BITS NR_IRQS | ||
10 | #endif | ||
11 | |||
6 | extern int noirqdebug; | 12 | extern int noirqdebug; |
7 | 13 | ||
8 | #define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data) | 14 | #define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data) |
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c index 282f20230e67..2039bea31bdf 100644 --- a/kernel/irq/irqdesc.c +++ b/kernel/irq/irqdesc.c | |||
@@ -94,7 +94,7 @@ int nr_irqs = NR_IRQS; | |||
94 | EXPORT_SYMBOL_GPL(nr_irqs); | 94 | EXPORT_SYMBOL_GPL(nr_irqs); |
95 | 95 | ||
96 | static DEFINE_MUTEX(sparse_irq_lock); | 96 | static DEFINE_MUTEX(sparse_irq_lock); |
97 | static DECLARE_BITMAP(allocated_irqs, NR_IRQS); | 97 | static DECLARE_BITMAP(allocated_irqs, IRQ_BITMAP_BITS); |
98 | 98 | ||
99 | #ifdef CONFIG_SPARSE_IRQ | 99 | #ifdef CONFIG_SPARSE_IRQ |
100 | 100 | ||
@@ -217,6 +217,15 @@ int __init early_irq_init(void) | |||
217 | initcnt = arch_probe_nr_irqs(); | 217 | initcnt = arch_probe_nr_irqs(); |
218 | printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d %d\n", NR_IRQS, nr_irqs, initcnt); | 218 | printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d %d\n", NR_IRQS, nr_irqs, initcnt); |
219 | 219 | ||
220 | if (WARN_ON(nr_irqs > IRQ_BITMAP_BITS)) | ||
221 | nr_irqs = IRQ_BITMAP_BITS; | ||
222 | |||
223 | if (WARN_ON(initcnt > IRQ_BITMAP_BITS)) | ||
224 | initcnt = IRQ_BITMAP_BITS; | ||
225 | |||
226 | if (initcnt > nr_irqs) | ||
227 | nr_irqs = initcnt; | ||
228 | |||
220 | for (i = 0; i < initcnt; i++) { | 229 | for (i = 0; i < initcnt; i++) { |
221 | desc = alloc_desc(i, node); | 230 | desc = alloc_desc(i, node); |
222 | set_bit(i, allocated_irqs); | 231 | set_bit(i, allocated_irqs); |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 0caa59f747dd..2782bacdf494 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -282,8 +282,17 @@ EXPORT_SYMBOL(disable_irq); | |||
282 | 282 | ||
283 | void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume) | 283 | void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume) |
284 | { | 284 | { |
285 | if (resume) | 285 | if (resume) { |
286 | if (!(desc->status & IRQ_SUSPENDED)) { | ||
287 | if (!desc->action) | ||
288 | return; | ||
289 | if (!(desc->action->flags & IRQF_FORCE_RESUME)) | ||
290 | return; | ||
291 | /* Pretend that it got disabled ! */ | ||
292 | desc->depth++; | ||
293 | } | ||
286 | desc->status &= ~IRQ_SUSPENDED; | 294 | desc->status &= ~IRQ_SUSPENDED; |
295 | } | ||
287 | 296 | ||
288 | switch (desc->depth) { | 297 | switch (desc->depth) { |
289 | case 0: | 298 | case 0: |
@@ -1100,7 +1109,7 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler, | |||
1100 | if (retval) | 1109 | if (retval) |
1101 | kfree(action); | 1110 | kfree(action); |
1102 | 1111 | ||
1103 | #ifdef CONFIG_DEBUG_SHIRQ | 1112 | #ifdef CONFIG_DEBUG_SHIRQ_FIXME |
1104 | if (!retval && (irqflags & IRQF_SHARED)) { | 1113 | if (!retval && (irqflags & IRQF_SHARED)) { |
1105 | /* | 1114 | /* |
1106 | * It's a shared IRQ -- the driver ought to be prepared for it | 1115 | * It's a shared IRQ -- the driver ought to be prepared for it |
diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c index 0d4005d85b03..d6bfb89cce91 100644 --- a/kernel/irq/pm.c +++ b/kernel/irq/pm.c | |||
@@ -53,9 +53,6 @@ void resume_device_irqs(void) | |||
53 | for_each_irq_desc(irq, desc) { | 53 | for_each_irq_desc(irq, desc) { |
54 | unsigned long flags; | 54 | unsigned long flags; |
55 | 55 | ||
56 | if (!(desc->status & IRQ_SUSPENDED)) | ||
57 | continue; | ||
58 | |||
59 | raw_spin_lock_irqsave(&desc->lock, flags); | 56 | raw_spin_lock_irqsave(&desc->lock, flags); |
60 | __enable_irq(desc, irq, true); | 57 | __enable_irq(desc, irq, true); |
61 | raw_spin_unlock_irqrestore(&desc->lock, flags); | 58 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c index 891115a929aa..dc49358b73fa 100644 --- a/kernel/irq/resend.c +++ b/kernel/irq/resend.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #ifdef CONFIG_HARDIRQS_SW_RESEND | 23 | #ifdef CONFIG_HARDIRQS_SW_RESEND |
24 | 24 | ||
25 | /* Bitmap to handle software resend of interrupts: */ | 25 | /* Bitmap to handle software resend of interrupts: */ |
26 | static DECLARE_BITMAP(irqs_resend, NR_IRQS); | 26 | static DECLARE_BITMAP(irqs_resend, IRQ_BITMAP_BITS); |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * Run software resends of IRQ's | 29 | * Run software resends of IRQ's |
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 999835b6112b..656222fcf767 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -782,6 +782,10 @@ retry: | |||
782 | raw_spin_unlock_irq(&ctx->lock); | 782 | raw_spin_unlock_irq(&ctx->lock); |
783 | } | 783 | } |
784 | 784 | ||
785 | #define MAX_INTERRUPTS (~0ULL) | ||
786 | |||
787 | static void perf_log_throttle(struct perf_event *event, int enable); | ||
788 | |||
785 | static int | 789 | static int |
786 | event_sched_in(struct perf_event *event, | 790 | event_sched_in(struct perf_event *event, |
787 | struct perf_cpu_context *cpuctx, | 791 | struct perf_cpu_context *cpuctx, |
@@ -794,6 +798,17 @@ event_sched_in(struct perf_event *event, | |||
794 | 798 | ||
795 | event->state = PERF_EVENT_STATE_ACTIVE; | 799 | event->state = PERF_EVENT_STATE_ACTIVE; |
796 | event->oncpu = smp_processor_id(); | 800 | event->oncpu = smp_processor_id(); |
801 | |||
802 | /* | ||
803 | * Unthrottle events, since we scheduled we might have missed several | ||
804 | * ticks already, also for a heavily scheduling task there is little | ||
805 | * guarantee it'll get a tick in a timely manner. | ||
806 | */ | ||
807 | if (unlikely(event->hw.interrupts == MAX_INTERRUPTS)) { | ||
808 | perf_log_throttle(event, 1); | ||
809 | event->hw.interrupts = 0; | ||
810 | } | ||
811 | |||
797 | /* | 812 | /* |
798 | * The new state must be visible before we turn it on in the hardware: | 813 | * The new state must be visible before we turn it on in the hardware: |
799 | */ | 814 | */ |
@@ -1596,10 +1611,6 @@ void __perf_event_task_sched_in(struct task_struct *task) | |||
1596 | } | 1611 | } |
1597 | } | 1612 | } |
1598 | 1613 | ||
1599 | #define MAX_INTERRUPTS (~0ULL) | ||
1600 | |||
1601 | static void perf_log_throttle(struct perf_event *event, int enable); | ||
1602 | |||
1603 | static u64 perf_calculate_period(struct perf_event *event, u64 nsec, u64 count) | 1614 | static u64 perf_calculate_period(struct perf_event *event, u64 nsec, u64 count) |
1604 | { | 1615 | { |
1605 | u64 frequency = event->attr.sample_freq; | 1616 | u64 frequency = event->attr.sample_freq; |
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 1708b1e2972d..e2302e40b360 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -163,7 +163,7 @@ bool ptrace_may_access(struct task_struct *task, unsigned int mode) | |||
163 | return !err; | 163 | return !err; |
164 | } | 164 | } |
165 | 165 | ||
166 | int ptrace_attach(struct task_struct *task) | 166 | static int ptrace_attach(struct task_struct *task) |
167 | { | 167 | { |
168 | int retval; | 168 | int retval; |
169 | 169 | ||
@@ -219,7 +219,7 @@ out: | |||
219 | * Performs checks and sets PT_PTRACED. | 219 | * Performs checks and sets PT_PTRACED. |
220 | * Should be used by all ptrace implementations for PTRACE_TRACEME. | 220 | * Should be used by all ptrace implementations for PTRACE_TRACEME. |
221 | */ | 221 | */ |
222 | int ptrace_traceme(void) | 222 | static int ptrace_traceme(void) |
223 | { | 223 | { |
224 | int ret = -EPERM; | 224 | int ret = -EPERM; |
225 | 225 | ||
@@ -293,7 +293,7 @@ static bool __ptrace_detach(struct task_struct *tracer, struct task_struct *p) | |||
293 | return false; | 293 | return false; |
294 | } | 294 | } |
295 | 295 | ||
296 | int ptrace_detach(struct task_struct *child, unsigned int data) | 296 | static int ptrace_detach(struct task_struct *child, unsigned int data) |
297 | { | 297 | { |
298 | bool dead = false; | 298 | bool dead = false; |
299 | 299 | ||
diff --git a/kernel/sched.c b/kernel/sched.c index 18d38e4ec7ba..42eab5a8437d 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -4213,6 +4213,7 @@ void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key) | |||
4213 | { | 4213 | { |
4214 | __wake_up_common(q, mode, 1, 0, key); | 4214 | __wake_up_common(q, mode, 1, 0, key); |
4215 | } | 4215 | } |
4216 | EXPORT_SYMBOL_GPL(__wake_up_locked_key); | ||
4216 | 4217 | ||
4217 | /** | 4218 | /** |
4218 | * __wake_up_sync_key - wake up threads blocked on a waitqueue. | 4219 | * __wake_up_sync_key - wake up threads blocked on a waitqueue. |
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c index ad6267714c84..01f75a5f17af 100644 --- a/kernel/sched_rt.c +++ b/kernel/sched_rt.c | |||
@@ -210,11 +210,12 @@ static void dequeue_rt_entity(struct sched_rt_entity *rt_se); | |||
210 | 210 | ||
211 | static void sched_rt_rq_enqueue(struct rt_rq *rt_rq) | 211 | static void sched_rt_rq_enqueue(struct rt_rq *rt_rq) |
212 | { | 212 | { |
213 | int this_cpu = smp_processor_id(); | ||
214 | struct task_struct *curr = rq_of_rt_rq(rt_rq)->curr; | 213 | struct task_struct *curr = rq_of_rt_rq(rt_rq)->curr; |
215 | struct sched_rt_entity *rt_se; | 214 | struct sched_rt_entity *rt_se; |
216 | 215 | ||
217 | rt_se = rt_rq->tg->rt_se[this_cpu]; | 216 | int cpu = cpu_of(rq_of_rt_rq(rt_rq)); |
217 | |||
218 | rt_se = rt_rq->tg->rt_se[cpu]; | ||
218 | 219 | ||
219 | if (rt_rq->rt_nr_running) { | 220 | if (rt_rq->rt_nr_running) { |
220 | if (rt_se && !on_rt_rq(rt_se)) | 221 | if (rt_se && !on_rt_rq(rt_se)) |
@@ -226,10 +227,10 @@ static void sched_rt_rq_enqueue(struct rt_rq *rt_rq) | |||
226 | 227 | ||
227 | static void sched_rt_rq_dequeue(struct rt_rq *rt_rq) | 228 | static void sched_rt_rq_dequeue(struct rt_rq *rt_rq) |
228 | { | 229 | { |
229 | int this_cpu = smp_processor_id(); | ||
230 | struct sched_rt_entity *rt_se; | 230 | struct sched_rt_entity *rt_se; |
231 | int cpu = cpu_of(rq_of_rt_rq(rt_rq)); | ||
231 | 232 | ||
232 | rt_se = rt_rq->tg->rt_se[this_cpu]; | 233 | rt_se = rt_rq->tg->rt_se[cpu]; |
233 | 234 | ||
234 | if (rt_se && on_rt_rq(rt_se)) | 235 | if (rt_se && on_rt_rq(rt_se)) |
235 | dequeue_rt_entity(rt_se); | 236 | dequeue_rt_entity(rt_se); |
@@ -565,8 +566,11 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun) | |||
565 | if (rt_rq->rt_time || rt_rq->rt_nr_running) | 566 | if (rt_rq->rt_time || rt_rq->rt_nr_running) |
566 | idle = 0; | 567 | idle = 0; |
567 | raw_spin_unlock(&rt_rq->rt_runtime_lock); | 568 | raw_spin_unlock(&rt_rq->rt_runtime_lock); |
568 | } else if (rt_rq->rt_nr_running) | 569 | } else if (rt_rq->rt_nr_running) { |
569 | idle = 0; | 570 | idle = 0; |
571 | if (!rt_rq_throttled(rt_rq)) | ||
572 | enqueue = 1; | ||
573 | } | ||
570 | 574 | ||
571 | if (enqueue) | 575 | if (enqueue) |
572 | sched_rt_rq_enqueue(rt_rq); | 576 | sched_rt_rq_enqueue(rt_rq); |
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index c782fe9924c7..25cc41cd8f33 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c | |||
@@ -186,3 +186,8 @@ cond_syscall(sys_perf_event_open); | |||
186 | /* fanotify! */ | 186 | /* fanotify! */ |
187 | cond_syscall(sys_fanotify_init); | 187 | cond_syscall(sys_fanotify_init); |
188 | cond_syscall(sys_fanotify_mark); | 188 | cond_syscall(sys_fanotify_mark); |
189 | |||
190 | /* open by handle */ | ||
191 | cond_syscall(sys_name_to_handle_at); | ||
192 | cond_syscall(sys_open_by_handle_at); | ||
193 | cond_syscall(compat_sys_open_by_handle_at); | ||
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 0f1bd83db985..4eed0af5d144 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
@@ -194,9 +194,9 @@ static int sysrq_sysctl_handler(ctl_table *table, int write, | |||
194 | static struct ctl_table root_table[]; | 194 | static struct ctl_table root_table[]; |
195 | static struct ctl_table_root sysctl_table_root; | 195 | static struct ctl_table_root sysctl_table_root; |
196 | static struct ctl_table_header root_table_header = { | 196 | static struct ctl_table_header root_table_header = { |
197 | .count = 1, | 197 | {{.count = 1, |
198 | .ctl_table = root_table, | 198 | .ctl_table = root_table, |
199 | .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list), | 199 | .ctl_entry = LIST_HEAD_INIT(sysctl_table_root.default_set.list),}}, |
200 | .root = &sysctl_table_root, | 200 | .root = &sysctl_table_root, |
201 | .set = &sysctl_table_root.default_set, | 201 | .set = &sysctl_table_root.default_set, |
202 | }; | 202 | }; |
@@ -1567,11 +1567,16 @@ void sysctl_head_get(struct ctl_table_header *head) | |||
1567 | spin_unlock(&sysctl_lock); | 1567 | spin_unlock(&sysctl_lock); |
1568 | } | 1568 | } |
1569 | 1569 | ||
1570 | static void free_head(struct rcu_head *rcu) | ||
1571 | { | ||
1572 | kfree(container_of(rcu, struct ctl_table_header, rcu)); | ||
1573 | } | ||
1574 | |||
1570 | void sysctl_head_put(struct ctl_table_header *head) | 1575 | void sysctl_head_put(struct ctl_table_header *head) |
1571 | { | 1576 | { |
1572 | spin_lock(&sysctl_lock); | 1577 | spin_lock(&sysctl_lock); |
1573 | if (!--head->count) | 1578 | if (!--head->count) |
1574 | kfree(head); | 1579 | call_rcu(&head->rcu, free_head); |
1575 | spin_unlock(&sysctl_lock); | 1580 | spin_unlock(&sysctl_lock); |
1576 | } | 1581 | } |
1577 | 1582 | ||
@@ -1948,10 +1953,10 @@ void unregister_sysctl_table(struct ctl_table_header * header) | |||
1948 | start_unregistering(header); | 1953 | start_unregistering(header); |
1949 | if (!--header->parent->count) { | 1954 | if (!--header->parent->count) { |
1950 | WARN_ON(1); | 1955 | WARN_ON(1); |
1951 | kfree(header->parent); | 1956 | call_rcu(&header->parent->rcu, free_head); |
1952 | } | 1957 | } |
1953 | if (!--header->count) | 1958 | if (!--header->count) |
1954 | kfree(header); | 1959 | call_rcu(&header->rcu, free_head); |
1955 | spin_unlock(&sysctl_lock); | 1960 | spin_unlock(&sysctl_lock); |
1956 | } | 1961 | } |
1957 | 1962 | ||
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c index b875bedf7c9a..3b8e028b9601 100644 --- a/kernel/sysctl_binary.c +++ b/kernel/sysctl_binary.c | |||
@@ -1321,13 +1321,11 @@ static ssize_t binary_sysctl(const int *name, int nlen, | |||
1321 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) | 1321 | void __user *oldval, size_t oldlen, void __user *newval, size_t newlen) |
1322 | { | 1322 | { |
1323 | const struct bin_table *table = NULL; | 1323 | const struct bin_table *table = NULL; |
1324 | struct nameidata nd; | ||
1325 | struct vfsmount *mnt; | 1324 | struct vfsmount *mnt; |
1326 | struct file *file; | 1325 | struct file *file; |
1327 | ssize_t result; | 1326 | ssize_t result; |
1328 | char *pathname; | 1327 | char *pathname; |
1329 | int flags; | 1328 | int flags; |
1330 | int acc_mode; | ||
1331 | 1329 | ||
1332 | pathname = sysctl_getname(name, nlen, &table); | 1330 | pathname = sysctl_getname(name, nlen, &table); |
1333 | result = PTR_ERR(pathname); | 1331 | result = PTR_ERR(pathname); |
@@ -1337,28 +1335,17 @@ static ssize_t binary_sysctl(const int *name, int nlen, | |||
1337 | /* How should the sysctl be accessed? */ | 1335 | /* How should the sysctl be accessed? */ |
1338 | if (oldval && oldlen && newval && newlen) { | 1336 | if (oldval && oldlen && newval && newlen) { |
1339 | flags = O_RDWR; | 1337 | flags = O_RDWR; |
1340 | acc_mode = MAY_READ | MAY_WRITE; | ||
1341 | } else if (newval && newlen) { | 1338 | } else if (newval && newlen) { |
1342 | flags = O_WRONLY; | 1339 | flags = O_WRONLY; |
1343 | acc_mode = MAY_WRITE; | ||
1344 | } else if (oldval && oldlen) { | 1340 | } else if (oldval && oldlen) { |
1345 | flags = O_RDONLY; | 1341 | flags = O_RDONLY; |
1346 | acc_mode = MAY_READ; | ||
1347 | } else { | 1342 | } else { |
1348 | result = 0; | 1343 | result = 0; |
1349 | goto out_putname; | 1344 | goto out_putname; |
1350 | } | 1345 | } |
1351 | 1346 | ||
1352 | mnt = current->nsproxy->pid_ns->proc_mnt; | 1347 | mnt = current->nsproxy->pid_ns->proc_mnt; |
1353 | result = vfs_path_lookup(mnt->mnt_root, mnt, pathname, 0, &nd); | 1348 | file = file_open_root(mnt->mnt_root, mnt, pathname, flags); |
1354 | if (result) | ||
1355 | goto out_putname; | ||
1356 | |||
1357 | result = may_open(&nd.path, acc_mode, flags); | ||
1358 | if (result) | ||
1359 | goto out_putpath; | ||
1360 | |||
1361 | file = dentry_open(nd.path.dentry, nd.path.mnt, flags, current_cred()); | ||
1362 | result = PTR_ERR(file); | 1349 | result = PTR_ERR(file); |
1363 | if (IS_ERR(file)) | 1350 | if (IS_ERR(file)) |
1364 | goto out_putname; | 1351 | goto out_putname; |
@@ -1370,10 +1357,6 @@ out_putname: | |||
1370 | putname(pathname); | 1357 | putname(pathname); |
1371 | out: | 1358 | out: |
1372 | return result; | 1359 | return result; |
1373 | |||
1374 | out_putpath: | ||
1375 | path_put(&nd.path); | ||
1376 | goto out_putname; | ||
1377 | } | 1360 | } |
1378 | 1361 | ||
1379 | 1362 | ||
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 48b2761b5668..a3b5aff62606 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c | |||
@@ -600,4 +600,14 @@ int tick_broadcast_oneshot_active(void) | |||
600 | return tick_broadcast_device.mode == TICKDEV_MODE_ONESHOT; | 600 | return tick_broadcast_device.mode == TICKDEV_MODE_ONESHOT; |
601 | } | 601 | } |
602 | 602 | ||
603 | /* | ||
604 | * Check whether the broadcast device supports oneshot. | ||
605 | */ | ||
606 | bool tick_broadcast_oneshot_available(void) | ||
607 | { | ||
608 | struct clock_event_device *bc = tick_broadcast_device.evtdev; | ||
609 | |||
610 | return bc ? bc->features & CLOCK_EVT_FEAT_ONESHOT : false; | ||
611 | } | ||
612 | |||
603 | #endif | 613 | #endif |
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 051bc80a0c43..ed228ef6f6b8 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c | |||
@@ -51,7 +51,11 @@ int tick_is_oneshot_available(void) | |||
51 | { | 51 | { |
52 | struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); | 52 | struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); |
53 | 53 | ||
54 | return dev && (dev->features & CLOCK_EVT_FEAT_ONESHOT); | 54 | if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT)) |
55 | return 0; | ||
56 | if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) | ||
57 | return 1; | ||
58 | return tick_broadcast_oneshot_available(); | ||
55 | } | 59 | } |
56 | 60 | ||
57 | /* | 61 | /* |
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 290eefbc1f60..f65d3a723a64 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h | |||
@@ -36,6 +36,7 @@ extern void tick_shutdown_broadcast_oneshot(unsigned int *cpup); | |||
36 | extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); | 36 | extern int tick_resume_broadcast_oneshot(struct clock_event_device *bc); |
37 | extern int tick_broadcast_oneshot_active(void); | 37 | extern int tick_broadcast_oneshot_active(void); |
38 | extern void tick_check_oneshot_broadcast(int cpu); | 38 | extern void tick_check_oneshot_broadcast(int cpu); |
39 | bool tick_broadcast_oneshot_available(void); | ||
39 | # else /* BROADCAST */ | 40 | # else /* BROADCAST */ |
40 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) | 41 | static inline void tick_broadcast_setup_oneshot(struct clock_event_device *bc) |
41 | { | 42 | { |
@@ -46,6 +47,7 @@ static inline void tick_broadcast_switch_to_oneshot(void) { } | |||
46 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } | 47 | static inline void tick_shutdown_broadcast_oneshot(unsigned int *cpup) { } |
47 | static inline int tick_broadcast_oneshot_active(void) { return 0; } | 48 | static inline int tick_broadcast_oneshot_active(void) { return 0; } |
48 | static inline void tick_check_oneshot_broadcast(int cpu) { } | 49 | static inline void tick_check_oneshot_broadcast(int cpu) { } |
50 | static inline bool tick_broadcast_oneshot_available(void) { return true; } | ||
49 | # endif /* !BROADCAST */ | 51 | # endif /* !BROADCAST */ |
50 | 52 | ||
51 | #else /* !ONESHOT */ | 53 | #else /* !ONESHOT */ |
@@ -76,6 +78,7 @@ static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc) | |||
76 | return 0; | 78 | return 0; |
77 | } | 79 | } |
78 | static inline int tick_broadcast_oneshot_active(void) { return 0; } | 80 | static inline int tick_broadcast_oneshot_active(void) { return 0; } |
81 | static inline bool tick_broadcast_oneshot_available(void) { return false; } | ||
79 | #endif /* !TICK_ONESHOT */ | 82 | #endif /* !TICK_ONESHOT */ |
80 | 83 | ||
81 | /* | 84 | /* |
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index d95721f33702..cbafed7d4f38 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -1827,21 +1827,5 @@ void blk_fill_rwbs(char *rwbs, u32 rw, int bytes) | |||
1827 | rwbs[i] = '\0'; | 1827 | rwbs[i] = '\0'; |
1828 | } | 1828 | } |
1829 | 1829 | ||
1830 | void blk_fill_rwbs_rq(char *rwbs, struct request *rq) | ||
1831 | { | ||
1832 | int rw = rq->cmd_flags & 0x03; | ||
1833 | int bytes; | ||
1834 | |||
1835 | if (rq->cmd_flags & REQ_DISCARD) | ||
1836 | rw |= REQ_DISCARD; | ||
1837 | |||
1838 | if (rq->cmd_flags & REQ_SECURE) | ||
1839 | rw |= REQ_SECURE; | ||
1840 | |||
1841 | bytes = blk_rq_bytes(rq); | ||
1842 | |||
1843 | blk_fill_rwbs(rwbs, rw, bytes); | ||
1844 | } | ||
1845 | |||
1846 | #endif /* CONFIG_EVENT_TRACING */ | 1830 | #endif /* CONFIG_EVENT_TRACING */ |
1847 | 1831 | ||
diff --git a/lib/nlattr.c b/lib/nlattr.c index 5021cbc34411..ac09f2226dc7 100644 --- a/lib/nlattr.c +++ b/lib/nlattr.c | |||
@@ -148,7 +148,7 @@ nla_policy_len(const struct nla_policy *p, int n) | |||
148 | { | 148 | { |
149 | int i, len = 0; | 149 | int i, len = 0; |
150 | 150 | ||
151 | for (i = 0; i < n; i++) { | 151 | for (i = 0; i < n; i++, p++) { |
152 | if (p->len) | 152 | if (p->len) |
153 | len += nla_total_size(p->len); | 153 | len += nla_total_size(p->len); |
154 | else if (nla_attr_minlen[p->type]) | 154 | else if (nla_attr_minlen[p->type]) |
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index c47bbe11b804..93ca08b8a451 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -686,8 +686,10 @@ dma_addr_t swiotlb_map_page(struct device *dev, struct page *page, | |||
686 | /* | 686 | /* |
687 | * Ensure that the address returned is DMA'ble | 687 | * Ensure that the address returned is DMA'ble |
688 | */ | 688 | */ |
689 | if (!dma_capable(dev, dev_addr, size)) | 689 | if (!dma_capable(dev, dev_addr, size)) { |
690 | panic("map_single: bounce buffer is not DMA'ble"); | 690 | swiotlb_tbl_unmap_single(dev, map, size, dir); |
691 | dev_addr = swiotlb_virt_to_bus(dev, io_tlb_overflow_buffer); | ||
692 | } | ||
691 | 693 | ||
692 | return dev_addr; | 694 | return dev_addr; |
693 | } | 695 | } |
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 3e29781ee762..113e35c47502 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c | |||
@@ -650,10 +650,10 @@ static inline gfp_t alloc_hugepage_gfpmask(int defrag) | |||
650 | 650 | ||
651 | static inline struct page *alloc_hugepage_vma(int defrag, | 651 | static inline struct page *alloc_hugepage_vma(int defrag, |
652 | struct vm_area_struct *vma, | 652 | struct vm_area_struct *vma, |
653 | unsigned long haddr) | 653 | unsigned long haddr, int nd) |
654 | { | 654 | { |
655 | return alloc_pages_vma(alloc_hugepage_gfpmask(defrag), | 655 | return alloc_pages_vma(alloc_hugepage_gfpmask(defrag), |
656 | HPAGE_PMD_ORDER, vma, haddr); | 656 | HPAGE_PMD_ORDER, vma, haddr, nd); |
657 | } | 657 | } |
658 | 658 | ||
659 | #ifndef CONFIG_NUMA | 659 | #ifndef CONFIG_NUMA |
@@ -678,7 +678,7 @@ int do_huge_pmd_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
678 | if (unlikely(khugepaged_enter(vma))) | 678 | if (unlikely(khugepaged_enter(vma))) |
679 | return VM_FAULT_OOM; | 679 | return VM_FAULT_OOM; |
680 | page = alloc_hugepage_vma(transparent_hugepage_defrag(vma), | 680 | page = alloc_hugepage_vma(transparent_hugepage_defrag(vma), |
681 | vma, haddr); | 681 | vma, haddr, numa_node_id()); |
682 | if (unlikely(!page)) | 682 | if (unlikely(!page)) |
683 | goto out; | 683 | goto out; |
684 | if (unlikely(mem_cgroup_newpage_charge(page, mm, GFP_KERNEL))) { | 684 | if (unlikely(mem_cgroup_newpage_charge(page, mm, GFP_KERNEL))) { |
@@ -799,8 +799,8 @@ static int do_huge_pmd_wp_page_fallback(struct mm_struct *mm, | |||
799 | } | 799 | } |
800 | 800 | ||
801 | for (i = 0; i < HPAGE_PMD_NR; i++) { | 801 | for (i = 0; i < HPAGE_PMD_NR; i++) { |
802 | pages[i] = alloc_page_vma(GFP_HIGHUSER_MOVABLE, | 802 | pages[i] = alloc_page_vma_node(GFP_HIGHUSER_MOVABLE, |
803 | vma, address); | 803 | vma, address, page_to_nid(page)); |
804 | if (unlikely(!pages[i] || | 804 | if (unlikely(!pages[i] || |
805 | mem_cgroup_newpage_charge(pages[i], mm, | 805 | mem_cgroup_newpage_charge(pages[i], mm, |
806 | GFP_KERNEL))) { | 806 | GFP_KERNEL))) { |
@@ -902,7 +902,7 @@ int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
902 | if (transparent_hugepage_enabled(vma) && | 902 | if (transparent_hugepage_enabled(vma) && |
903 | !transparent_hugepage_debug_cow()) | 903 | !transparent_hugepage_debug_cow()) |
904 | new_page = alloc_hugepage_vma(transparent_hugepage_defrag(vma), | 904 | new_page = alloc_hugepage_vma(transparent_hugepage_defrag(vma), |
905 | vma, haddr); | 905 | vma, haddr, numa_node_id()); |
906 | else | 906 | else |
907 | new_page = NULL; | 907 | new_page = NULL; |
908 | 908 | ||
@@ -1745,7 +1745,8 @@ static void __collapse_huge_page_copy(pte_t *pte, struct page *page, | |||
1745 | static void collapse_huge_page(struct mm_struct *mm, | 1745 | static void collapse_huge_page(struct mm_struct *mm, |
1746 | unsigned long address, | 1746 | unsigned long address, |
1747 | struct page **hpage, | 1747 | struct page **hpage, |
1748 | struct vm_area_struct *vma) | 1748 | struct vm_area_struct *vma, |
1749 | int node) | ||
1749 | { | 1750 | { |
1750 | pgd_t *pgd; | 1751 | pgd_t *pgd; |
1751 | pud_t *pud; | 1752 | pud_t *pud; |
@@ -1761,6 +1762,10 @@ static void collapse_huge_page(struct mm_struct *mm, | |||
1761 | #ifndef CONFIG_NUMA | 1762 | #ifndef CONFIG_NUMA |
1762 | VM_BUG_ON(!*hpage); | 1763 | VM_BUG_ON(!*hpage); |
1763 | new_page = *hpage; | 1764 | new_page = *hpage; |
1765 | if (unlikely(mem_cgroup_newpage_charge(new_page, mm, GFP_KERNEL))) { | ||
1766 | up_read(&mm->mmap_sem); | ||
1767 | return; | ||
1768 | } | ||
1764 | #else | 1769 | #else |
1765 | VM_BUG_ON(*hpage); | 1770 | VM_BUG_ON(*hpage); |
1766 | /* | 1771 | /* |
@@ -1773,18 +1778,19 @@ static void collapse_huge_page(struct mm_struct *mm, | |||
1773 | * mmap_sem in read mode is good idea also to allow greater | 1778 | * mmap_sem in read mode is good idea also to allow greater |
1774 | * scalability. | 1779 | * scalability. |
1775 | */ | 1780 | */ |
1776 | new_page = alloc_hugepage_vma(khugepaged_defrag(), vma, address); | 1781 | new_page = alloc_hugepage_vma(khugepaged_defrag(), vma, address, |
1782 | node); | ||
1777 | if (unlikely(!new_page)) { | 1783 | if (unlikely(!new_page)) { |
1778 | up_read(&mm->mmap_sem); | 1784 | up_read(&mm->mmap_sem); |
1779 | *hpage = ERR_PTR(-ENOMEM); | 1785 | *hpage = ERR_PTR(-ENOMEM); |
1780 | return; | 1786 | return; |
1781 | } | 1787 | } |
1782 | #endif | ||
1783 | if (unlikely(mem_cgroup_newpage_charge(new_page, mm, GFP_KERNEL))) { | 1788 | if (unlikely(mem_cgroup_newpage_charge(new_page, mm, GFP_KERNEL))) { |
1784 | up_read(&mm->mmap_sem); | 1789 | up_read(&mm->mmap_sem); |
1785 | put_page(new_page); | 1790 | put_page(new_page); |
1786 | return; | 1791 | return; |
1787 | } | 1792 | } |
1793 | #endif | ||
1788 | 1794 | ||
1789 | /* after allocating the hugepage upgrade to mmap_sem write mode */ | 1795 | /* after allocating the hugepage upgrade to mmap_sem write mode */ |
1790 | up_read(&mm->mmap_sem); | 1796 | up_read(&mm->mmap_sem); |
@@ -1919,6 +1925,7 @@ static int khugepaged_scan_pmd(struct mm_struct *mm, | |||
1919 | struct page *page; | 1925 | struct page *page; |
1920 | unsigned long _address; | 1926 | unsigned long _address; |
1921 | spinlock_t *ptl; | 1927 | spinlock_t *ptl; |
1928 | int node = -1; | ||
1922 | 1929 | ||
1923 | VM_BUG_ON(address & ~HPAGE_PMD_MASK); | 1930 | VM_BUG_ON(address & ~HPAGE_PMD_MASK); |
1924 | 1931 | ||
@@ -1949,6 +1956,13 @@ static int khugepaged_scan_pmd(struct mm_struct *mm, | |||
1949 | page = vm_normal_page(vma, _address, pteval); | 1956 | page = vm_normal_page(vma, _address, pteval); |
1950 | if (unlikely(!page)) | 1957 | if (unlikely(!page)) |
1951 | goto out_unmap; | 1958 | goto out_unmap; |
1959 | /* | ||
1960 | * Chose the node of the first page. This could | ||
1961 | * be more sophisticated and look at more pages, | ||
1962 | * but isn't for now. | ||
1963 | */ | ||
1964 | if (node == -1) | ||
1965 | node = page_to_nid(page); | ||
1952 | VM_BUG_ON(PageCompound(page)); | 1966 | VM_BUG_ON(PageCompound(page)); |
1953 | if (!PageLRU(page) || PageLocked(page) || !PageAnon(page)) | 1967 | if (!PageLRU(page) || PageLocked(page) || !PageAnon(page)) |
1954 | goto out_unmap; | 1968 | goto out_unmap; |
@@ -1965,7 +1979,7 @@ out_unmap: | |||
1965 | pte_unmap_unlock(pte, ptl); | 1979 | pte_unmap_unlock(pte, ptl); |
1966 | if (ret) | 1980 | if (ret) |
1967 | /* collapse_huge_page will return with the mmap_sem released */ | 1981 | /* collapse_huge_page will return with the mmap_sem released */ |
1968 | collapse_huge_page(mm, address, hpage, vma); | 1982 | collapse_huge_page(mm, address, hpage, vma, node); |
1969 | out: | 1983 | out: |
1970 | return ret; | 1984 | return ret; |
1971 | } | 1985 | } |
diff --git a/mm/memory.c b/mm/memory.c index 8e8c18324863..5823698c2b71 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -2648,6 +2648,7 @@ void unmap_mapping_range(struct address_space *mapping, | |||
2648 | details.last_index = ULONG_MAX; | 2648 | details.last_index = ULONG_MAX; |
2649 | details.i_mmap_lock = &mapping->i_mmap_lock; | 2649 | details.i_mmap_lock = &mapping->i_mmap_lock; |
2650 | 2650 | ||
2651 | mutex_lock(&mapping->unmap_mutex); | ||
2651 | spin_lock(&mapping->i_mmap_lock); | 2652 | spin_lock(&mapping->i_mmap_lock); |
2652 | 2653 | ||
2653 | /* Protect against endless unmapping loops */ | 2654 | /* Protect against endless unmapping loops */ |
@@ -2664,6 +2665,7 @@ void unmap_mapping_range(struct address_space *mapping, | |||
2664 | if (unlikely(!list_empty(&mapping->i_mmap_nonlinear))) | 2665 | if (unlikely(!list_empty(&mapping->i_mmap_nonlinear))) |
2665 | unmap_mapping_range_list(&mapping->i_mmap_nonlinear, &details); | 2666 | unmap_mapping_range_list(&mapping->i_mmap_nonlinear, &details); |
2666 | spin_unlock(&mapping->i_mmap_lock); | 2667 | spin_unlock(&mapping->i_mmap_lock); |
2668 | mutex_unlock(&mapping->unmap_mutex); | ||
2667 | } | 2669 | } |
2668 | EXPORT_SYMBOL(unmap_mapping_range); | 2670 | EXPORT_SYMBOL(unmap_mapping_range); |
2669 | 2671 | ||
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 368fc9d23610..b53ec99f1428 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -1524,10 +1524,9 @@ static nodemask_t *policy_nodemask(gfp_t gfp, struct mempolicy *policy) | |||
1524 | } | 1524 | } |
1525 | 1525 | ||
1526 | /* Return a zonelist indicated by gfp for node representing a mempolicy */ | 1526 | /* Return a zonelist indicated by gfp for node representing a mempolicy */ |
1527 | static struct zonelist *policy_zonelist(gfp_t gfp, struct mempolicy *policy) | 1527 | static struct zonelist *policy_zonelist(gfp_t gfp, struct mempolicy *policy, |
1528 | int nd) | ||
1528 | { | 1529 | { |
1529 | int nd = numa_node_id(); | ||
1530 | |||
1531 | switch (policy->mode) { | 1530 | switch (policy->mode) { |
1532 | case MPOL_PREFERRED: | 1531 | case MPOL_PREFERRED: |
1533 | if (!(policy->flags & MPOL_F_LOCAL)) | 1532 | if (!(policy->flags & MPOL_F_LOCAL)) |
@@ -1679,7 +1678,7 @@ struct zonelist *huge_zonelist(struct vm_area_struct *vma, unsigned long addr, | |||
1679 | zl = node_zonelist(interleave_nid(*mpol, vma, addr, | 1678 | zl = node_zonelist(interleave_nid(*mpol, vma, addr, |
1680 | huge_page_shift(hstate_vma(vma))), gfp_flags); | 1679 | huge_page_shift(hstate_vma(vma))), gfp_flags); |
1681 | } else { | 1680 | } else { |
1682 | zl = policy_zonelist(gfp_flags, *mpol); | 1681 | zl = policy_zonelist(gfp_flags, *mpol, numa_node_id()); |
1683 | if ((*mpol)->mode == MPOL_BIND) | 1682 | if ((*mpol)->mode == MPOL_BIND) |
1684 | *nodemask = &(*mpol)->v.nodes; | 1683 | *nodemask = &(*mpol)->v.nodes; |
1685 | } | 1684 | } |
@@ -1820,7 +1819,7 @@ static struct page *alloc_page_interleave(gfp_t gfp, unsigned order, | |||
1820 | */ | 1819 | */ |
1821 | struct page * | 1820 | struct page * |
1822 | alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, | 1821 | alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, |
1823 | unsigned long addr) | 1822 | unsigned long addr, int node) |
1824 | { | 1823 | { |
1825 | struct mempolicy *pol = get_vma_policy(current, vma, addr); | 1824 | struct mempolicy *pol = get_vma_policy(current, vma, addr); |
1826 | struct zonelist *zl; | 1825 | struct zonelist *zl; |
@@ -1830,13 +1829,13 @@ alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, | |||
1830 | if (unlikely(pol->mode == MPOL_INTERLEAVE)) { | 1829 | if (unlikely(pol->mode == MPOL_INTERLEAVE)) { |
1831 | unsigned nid; | 1830 | unsigned nid; |
1832 | 1831 | ||
1833 | nid = interleave_nid(pol, vma, addr, PAGE_SHIFT); | 1832 | nid = interleave_nid(pol, vma, addr, PAGE_SHIFT + order); |
1834 | mpol_cond_put(pol); | 1833 | mpol_cond_put(pol); |
1835 | page = alloc_page_interleave(gfp, order, nid); | 1834 | page = alloc_page_interleave(gfp, order, nid); |
1836 | put_mems_allowed(); | 1835 | put_mems_allowed(); |
1837 | return page; | 1836 | return page; |
1838 | } | 1837 | } |
1839 | zl = policy_zonelist(gfp, pol); | 1838 | zl = policy_zonelist(gfp, pol, node); |
1840 | if (unlikely(mpol_needs_cond_ref(pol))) { | 1839 | if (unlikely(mpol_needs_cond_ref(pol))) { |
1841 | /* | 1840 | /* |
1842 | * slow path: ref counted shared policy | 1841 | * slow path: ref counted shared policy |
@@ -1892,7 +1891,8 @@ struct page *alloc_pages_current(gfp_t gfp, unsigned order) | |||
1892 | page = alloc_page_interleave(gfp, order, interleave_nodes(pol)); | 1891 | page = alloc_page_interleave(gfp, order, interleave_nodes(pol)); |
1893 | else | 1892 | else |
1894 | page = __alloc_pages_nodemask(gfp, order, | 1893 | page = __alloc_pages_nodemask(gfp, order, |
1895 | policy_zonelist(gfp, pol), policy_nodemask(gfp, pol)); | 1894 | policy_zonelist(gfp, pol, numa_node_id()), |
1895 | policy_nodemask(gfp, pol)); | ||
1896 | put_mems_allowed(); | 1896 | put_mems_allowed(); |
1897 | return page; | 1897 | return page; |
1898 | } | 1898 | } |
diff --git a/mm/migrate.c b/mm/migrate.c index 766115253807..352de555626c 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -1287,14 +1287,14 @@ SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages, | |||
1287 | return -EPERM; | 1287 | return -EPERM; |
1288 | 1288 | ||
1289 | /* Find the mm_struct */ | 1289 | /* Find the mm_struct */ |
1290 | read_lock(&tasklist_lock); | 1290 | rcu_read_lock(); |
1291 | task = pid ? find_task_by_vpid(pid) : current; | 1291 | task = pid ? find_task_by_vpid(pid) : current; |
1292 | if (!task) { | 1292 | if (!task) { |
1293 | read_unlock(&tasklist_lock); | 1293 | rcu_read_unlock(); |
1294 | return -ESRCH; | 1294 | return -ESRCH; |
1295 | } | 1295 | } |
1296 | mm = get_task_mm(task); | 1296 | mm = get_task_mm(task); |
1297 | read_unlock(&tasklist_lock); | 1297 | rcu_read_unlock(); |
1298 | 1298 | ||
1299 | if (!mm) | 1299 | if (!mm) |
1300 | return -EINVAL; | 1300 | return -EINVAL; |
diff --git a/mm/mremap.c b/mm/mremap.c index 9925b6391b80..1de98d492ddc 100644 --- a/mm/mremap.c +++ b/mm/mremap.c | |||
@@ -94,9 +94,7 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd, | |||
94 | */ | 94 | */ |
95 | mapping = vma->vm_file->f_mapping; | 95 | mapping = vma->vm_file->f_mapping; |
96 | spin_lock(&mapping->i_mmap_lock); | 96 | spin_lock(&mapping->i_mmap_lock); |
97 | if (new_vma->vm_truncate_count && | 97 | new_vma->vm_truncate_count = 0; |
98 | new_vma->vm_truncate_count != vma->vm_truncate_count) | ||
99 | new_vma->vm_truncate_count = 0; | ||
100 | } | 98 | } |
101 | 99 | ||
102 | /* | 100 | /* |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a873e61e312e..cdef1d4b4e47 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -5376,10 +5376,9 @@ __count_immobile_pages(struct zone *zone, struct page *page, int count) | |||
5376 | for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) { | 5376 | for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) { |
5377 | unsigned long check = pfn + iter; | 5377 | unsigned long check = pfn + iter; |
5378 | 5378 | ||
5379 | if (!pfn_valid_within(check)) { | 5379 | if (!pfn_valid_within(check)) |
5380 | iter++; | ||
5381 | continue; | 5380 | continue; |
5382 | } | 5381 | |
5383 | page = pfn_to_page(check); | 5382 | page = pfn_to_page(check); |
5384 | if (!page_count(page)) { | 5383 | if (!page_count(page)) { |
5385 | if (PageBuddy(page)) | 5384 | if (PageBuddy(page)) |
@@ -497,41 +497,51 @@ int page_referenced_one(struct page *page, struct vm_area_struct *vma, | |||
497 | struct mm_struct *mm = vma->vm_mm; | 497 | struct mm_struct *mm = vma->vm_mm; |
498 | int referenced = 0; | 498 | int referenced = 0; |
499 | 499 | ||
500 | /* | ||
501 | * Don't want to elevate referenced for mlocked page that gets this far, | ||
502 | * in order that it progresses to try_to_unmap and is moved to the | ||
503 | * unevictable list. | ||
504 | */ | ||
505 | if (vma->vm_flags & VM_LOCKED) { | ||
506 | *mapcount = 0; /* break early from loop */ | ||
507 | *vm_flags |= VM_LOCKED; | ||
508 | goto out; | ||
509 | } | ||
510 | |||
511 | /* Pretend the page is referenced if the task has the | ||
512 | swap token and is in the middle of a page fault. */ | ||
513 | if (mm != current->mm && has_swap_token(mm) && | ||
514 | rwsem_is_locked(&mm->mmap_sem)) | ||
515 | referenced++; | ||
516 | |||
517 | if (unlikely(PageTransHuge(page))) { | 500 | if (unlikely(PageTransHuge(page))) { |
518 | pmd_t *pmd; | 501 | pmd_t *pmd; |
519 | 502 | ||
520 | spin_lock(&mm->page_table_lock); | 503 | spin_lock(&mm->page_table_lock); |
504 | /* | ||
505 | * rmap might return false positives; we must filter | ||
506 | * these out using page_check_address_pmd(). | ||
507 | */ | ||
521 | pmd = page_check_address_pmd(page, mm, address, | 508 | pmd = page_check_address_pmd(page, mm, address, |
522 | PAGE_CHECK_ADDRESS_PMD_FLAG); | 509 | PAGE_CHECK_ADDRESS_PMD_FLAG); |
523 | if (pmd && !pmd_trans_splitting(*pmd) && | 510 | if (!pmd) { |
524 | pmdp_clear_flush_young_notify(vma, address, pmd)) | 511 | spin_unlock(&mm->page_table_lock); |
512 | goto out; | ||
513 | } | ||
514 | |||
515 | if (vma->vm_flags & VM_LOCKED) { | ||
516 | spin_unlock(&mm->page_table_lock); | ||
517 | *mapcount = 0; /* break early from loop */ | ||
518 | *vm_flags |= VM_LOCKED; | ||
519 | goto out; | ||
520 | } | ||
521 | |||
522 | /* go ahead even if the pmd is pmd_trans_splitting() */ | ||
523 | if (pmdp_clear_flush_young_notify(vma, address, pmd)) | ||
525 | referenced++; | 524 | referenced++; |
526 | spin_unlock(&mm->page_table_lock); | 525 | spin_unlock(&mm->page_table_lock); |
527 | } else { | 526 | } else { |
528 | pte_t *pte; | 527 | pte_t *pte; |
529 | spinlock_t *ptl; | 528 | spinlock_t *ptl; |
530 | 529 | ||
530 | /* | ||
531 | * rmap might return false positives; we must filter | ||
532 | * these out using page_check_address(). | ||
533 | */ | ||
531 | pte = page_check_address(page, mm, address, &ptl, 0); | 534 | pte = page_check_address(page, mm, address, &ptl, 0); |
532 | if (!pte) | 535 | if (!pte) |
533 | goto out; | 536 | goto out; |
534 | 537 | ||
538 | if (vma->vm_flags & VM_LOCKED) { | ||
539 | pte_unmap_unlock(pte, ptl); | ||
540 | *mapcount = 0; /* break early from loop */ | ||
541 | *vm_flags |= VM_LOCKED; | ||
542 | goto out; | ||
543 | } | ||
544 | |||
535 | if (ptep_clear_flush_young_notify(vma, address, pte)) { | 545 | if (ptep_clear_flush_young_notify(vma, address, pte)) { |
536 | /* | 546 | /* |
537 | * Don't treat a reference through a sequentially read | 547 | * Don't treat a reference through a sequentially read |
@@ -546,6 +556,12 @@ int page_referenced_one(struct page *page, struct vm_area_struct *vma, | |||
546 | pte_unmap_unlock(pte, ptl); | 556 | pte_unmap_unlock(pte, ptl); |
547 | } | 557 | } |
548 | 558 | ||
559 | /* Pretend the page is referenced if the task has the | ||
560 | swap token and is in the middle of a page fault. */ | ||
561 | if (mm != current->mm && has_swap_token(mm) && | ||
562 | rwsem_is_locked(&mm->mmap_sem)) | ||
563 | referenced++; | ||
564 | |||
549 | (*mapcount)--; | 565 | (*mapcount)--; |
550 | 566 | ||
551 | if (referenced) | 567 | if (referenced) |
diff --git a/mm/shmem.c b/mm/shmem.c index 5ee67c990602..3437b65d6d6e 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -2144,8 +2144,10 @@ static int shmem_encode_fh(struct dentry *dentry, __u32 *fh, int *len, | |||
2144 | { | 2144 | { |
2145 | struct inode *inode = dentry->d_inode; | 2145 | struct inode *inode = dentry->d_inode; |
2146 | 2146 | ||
2147 | if (*len < 3) | 2147 | if (*len < 3) { |
2148 | *len = 3; | ||
2148 | return 255; | 2149 | return 255; |
2150 | } | ||
2149 | 2151 | ||
2150 | if (inode_unhashed(inode)) { | 2152 | if (inode_unhashed(inode)) { |
2151 | /* Unfortunately insert_inode_hash is not idempotent, | 2153 | /* Unfortunately insert_inode_hash is not idempotent, |
diff --git a/mm/swapfile.c b/mm/swapfile.c index 07a458d72fa8..0341c5700e34 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -1940,7 +1940,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) | |||
1940 | 1940 | ||
1941 | error = -EINVAL; | 1941 | error = -EINVAL; |
1942 | if (S_ISBLK(inode->i_mode)) { | 1942 | if (S_ISBLK(inode->i_mode)) { |
1943 | bdev = I_BDEV(inode); | 1943 | bdev = bdgrab(I_BDEV(inode)); |
1944 | error = blkdev_get(bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL, | 1944 | error = blkdev_get(bdev, FMODE_READ | FMODE_WRITE | FMODE_EXCL, |
1945 | sys_swapon); | 1945 | sys_swapon); |
1946 | if (error < 0) { | 1946 | if (error < 0) { |
diff --git a/mm/truncate.c b/mm/truncate.c index 49feb46e77b8..d64296be00d3 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -225,6 +225,7 @@ void truncate_inode_pages_range(struct address_space *mapping, | |||
225 | next = start; | 225 | next = start; |
226 | while (next <= end && | 226 | while (next <= end && |
227 | pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) { | 227 | pagevec_lookup(&pvec, mapping, next, PAGEVEC_SIZE)) { |
228 | mem_cgroup_uncharge_start(); | ||
228 | for (i = 0; i < pagevec_count(&pvec); i++) { | 229 | for (i = 0; i < pagevec_count(&pvec); i++) { |
229 | struct page *page = pvec.pages[i]; | 230 | struct page *page = pvec.pages[i]; |
230 | pgoff_t page_index = page->index; | 231 | pgoff_t page_index = page->index; |
@@ -247,6 +248,7 @@ void truncate_inode_pages_range(struct address_space *mapping, | |||
247 | unlock_page(page); | 248 | unlock_page(page); |
248 | } | 249 | } |
249 | pagevec_release(&pvec); | 250 | pagevec_release(&pvec); |
251 | mem_cgroup_uncharge_end(); | ||
250 | cond_resched(); | 252 | cond_resched(); |
251 | } | 253 | } |
252 | 254 | ||
diff --git a/mm/vmscan.c b/mm/vmscan.c index 17497d0cd8b9..6771ea70bfe7 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1841,16 +1841,28 @@ static inline bool should_continue_reclaim(struct zone *zone, | |||
1841 | if (!(sc->reclaim_mode & RECLAIM_MODE_COMPACTION)) | 1841 | if (!(sc->reclaim_mode & RECLAIM_MODE_COMPACTION)) |
1842 | return false; | 1842 | return false; |
1843 | 1843 | ||
1844 | /* | 1844 | /* Consider stopping depending on scan and reclaim activity */ |
1845 | * If we failed to reclaim and have scanned the full list, stop. | 1845 | if (sc->gfp_mask & __GFP_REPEAT) { |
1846 | * NOTE: Checking just nr_reclaimed would exit reclaim/compaction far | 1846 | /* |
1847 | * faster but obviously would be less likely to succeed | 1847 | * For __GFP_REPEAT allocations, stop reclaiming if the |
1848 | * allocation. If this is desirable, use GFP_REPEAT to decide | 1848 | * full LRU list has been scanned and we are still failing |
1849 | * if both reclaimed and scanned should be checked or just | 1849 | * to reclaim pages. This full LRU scan is potentially |
1850 | * reclaimed | 1850 | * expensive but a __GFP_REPEAT caller really wants to succeed |
1851 | */ | 1851 | */ |
1852 | if (!nr_reclaimed && !nr_scanned) | 1852 | if (!nr_reclaimed && !nr_scanned) |
1853 | return false; | 1853 | return false; |
1854 | } else { | ||
1855 | /* | ||
1856 | * For non-__GFP_REPEAT allocations which can presumably | ||
1857 | * fail without consequence, stop if we failed to reclaim | ||
1858 | * any pages from the last SWAP_CLUSTER_MAX number of | ||
1859 | * pages that were scanned. This will return to the | ||
1860 | * caller faster at the risk reclaim/compaction and | ||
1861 | * the resulting allocation attempt fails | ||
1862 | */ | ||
1863 | if (!nr_reclaimed) | ||
1864 | return false; | ||
1865 | } | ||
1854 | 1866 | ||
1855 | /* | 1867 | /* |
1856 | * If we have not reclaimed enough pages for compaction and the | 1868 | * If we have not reclaimed enough pages for compaction and the |
diff --git a/net/Makefile b/net/Makefile index a3330ebe2c53..a51d9465e628 100644 --- a/net/Makefile +++ b/net/Makefile | |||
@@ -19,9 +19,7 @@ obj-$(CONFIG_NETFILTER) += netfilter/ | |||
19 | obj-$(CONFIG_INET) += ipv4/ | 19 | obj-$(CONFIG_INET) += ipv4/ |
20 | obj-$(CONFIG_XFRM) += xfrm/ | 20 | obj-$(CONFIG_XFRM) += xfrm/ |
21 | obj-$(CONFIG_UNIX) += unix/ | 21 | obj-$(CONFIG_UNIX) += unix/ |
22 | ifneq ($(CONFIG_IPV6),) | 22 | obj-$(CONFIG_NET) += ipv6/ |
23 | obj-y += ipv6/ | ||
24 | endif | ||
25 | obj-$(CONFIG_PACKET) += packet/ | 23 | obj-$(CONFIG_PACKET) += packet/ |
26 | obj-$(CONFIG_NET_KEY) += key/ | 24 | obj-$(CONFIG_NET_KEY) += key/ |
27 | obj-$(CONFIG_BRIDGE) += bridge/ | 25 | obj-$(CONFIG_BRIDGE) += bridge/ |
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 2575c2db6404..d7b9af4703d0 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -727,7 +727,9 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
727 | break; | 727 | break; |
728 | } | 728 | } |
729 | 729 | ||
730 | tty_unlock(); | ||
730 | schedule(); | 731 | schedule(); |
732 | tty_lock(); | ||
731 | } | 733 | } |
732 | set_current_state(TASK_RUNNING); | 734 | set_current_state(TASK_RUNNING); |
733 | remove_wait_queue(&dev->wait, &wait); | 735 | remove_wait_queue(&dev->wait, &wait); |
diff --git a/net/bridge/Kconfig b/net/bridge/Kconfig index 9190ae462cb4..6dee7bf648a9 100644 --- a/net/bridge/Kconfig +++ b/net/bridge/Kconfig | |||
@@ -6,6 +6,7 @@ config BRIDGE | |||
6 | tristate "802.1d Ethernet Bridging" | 6 | tristate "802.1d Ethernet Bridging" |
7 | select LLC | 7 | select LLC |
8 | select STP | 8 | select STP |
9 | depends on IPV6 || IPV6=n | ||
9 | ---help--- | 10 | ---help--- |
10 | If you say Y here, then your Linux box will be able to act as an | 11 | If you say Y here, then your Linux box will be able to act as an |
11 | Ethernet bridge, which means that the different Ethernet segments it | 12 | Ethernet bridge, which means that the different Ethernet segments it |
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 09d5c0987925..030a002ff8ee 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c | |||
@@ -37,10 +37,9 @@ | |||
37 | rcu_dereference_protected(X, lockdep_is_held(&br->multicast_lock)) | 37 | rcu_dereference_protected(X, lockdep_is_held(&br->multicast_lock)) |
38 | 38 | ||
39 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 39 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
40 | static inline int ipv6_is_local_multicast(const struct in6_addr *addr) | 40 | static inline int ipv6_is_transient_multicast(const struct in6_addr *addr) |
41 | { | 41 | { |
42 | if (ipv6_addr_is_multicast(addr) && | 42 | if (ipv6_addr_is_multicast(addr) && IPV6_ADDR_MC_FLAG_TRANSIENT(addr)) |
43 | IPV6_ADDR_MC_SCOPE(addr) <= IPV6_ADDR_SCOPE_LINKLOCAL) | ||
44 | return 1; | 43 | return 1; |
45 | return 0; | 44 | return 0; |
46 | } | 45 | } |
@@ -435,7 +434,6 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br, | |||
435 | eth = eth_hdr(skb); | 434 | eth = eth_hdr(skb); |
436 | 435 | ||
437 | memcpy(eth->h_source, br->dev->dev_addr, 6); | 436 | memcpy(eth->h_source, br->dev->dev_addr, 6); |
438 | ipv6_eth_mc_map(group, eth->h_dest); | ||
439 | eth->h_proto = htons(ETH_P_IPV6); | 437 | eth->h_proto = htons(ETH_P_IPV6); |
440 | skb_put(skb, sizeof(*eth)); | 438 | skb_put(skb, sizeof(*eth)); |
441 | 439 | ||
@@ -447,8 +445,10 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br, | |||
447 | ip6h->payload_len = htons(8 + sizeof(*mldq)); | 445 | ip6h->payload_len = htons(8 + sizeof(*mldq)); |
448 | ip6h->nexthdr = IPPROTO_HOPOPTS; | 446 | ip6h->nexthdr = IPPROTO_HOPOPTS; |
449 | ip6h->hop_limit = 1; | 447 | ip6h->hop_limit = 1; |
450 | ipv6_addr_set(&ip6h->saddr, 0, 0, 0, 0); | 448 | ipv6_dev_get_saddr(dev_net(br->dev), br->dev, &ip6h->daddr, 0, |
449 | &ip6h->saddr); | ||
451 | ipv6_addr_set(&ip6h->daddr, htonl(0xff020000), 0, 0, htonl(1)); | 450 | ipv6_addr_set(&ip6h->daddr, htonl(0xff020000), 0, 0, htonl(1)); |
451 | ipv6_eth_mc_map(&ip6h->daddr, eth->h_dest); | ||
452 | 452 | ||
453 | hopopt = (u8 *)(ip6h + 1); | 453 | hopopt = (u8 *)(ip6h + 1); |
454 | hopopt[0] = IPPROTO_ICMPV6; /* next hdr */ | 454 | hopopt[0] = IPPROTO_ICMPV6; /* next hdr */ |
@@ -780,11 +780,11 @@ static int br_ip6_multicast_add_group(struct net_bridge *br, | |||
780 | { | 780 | { |
781 | struct br_ip br_group; | 781 | struct br_ip br_group; |
782 | 782 | ||
783 | if (ipv6_is_local_multicast(group)) | 783 | if (!ipv6_is_transient_multicast(group)) |
784 | return 0; | 784 | return 0; |
785 | 785 | ||
786 | ipv6_addr_copy(&br_group.u.ip6, group); | 786 | ipv6_addr_copy(&br_group.u.ip6, group); |
787 | br_group.proto = htons(ETH_P_IP); | 787 | br_group.proto = htons(ETH_P_IPV6); |
788 | 788 | ||
789 | return br_multicast_add_group(br, port, &br_group); | 789 | return br_multicast_add_group(br, port, &br_group); |
790 | } | 790 | } |
@@ -1013,18 +1013,19 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, | |||
1013 | 1013 | ||
1014 | nsrcs = skb_header_pointer(skb, | 1014 | nsrcs = skb_header_pointer(skb, |
1015 | len + offsetof(struct mld2_grec, | 1015 | len + offsetof(struct mld2_grec, |
1016 | grec_mca), | 1016 | grec_nsrcs), |
1017 | sizeof(_nsrcs), &_nsrcs); | 1017 | sizeof(_nsrcs), &_nsrcs); |
1018 | if (!nsrcs) | 1018 | if (!nsrcs) |
1019 | return -EINVAL; | 1019 | return -EINVAL; |
1020 | 1020 | ||
1021 | if (!pskb_may_pull(skb, | 1021 | if (!pskb_may_pull(skb, |
1022 | len + sizeof(*grec) + | 1022 | len + sizeof(*grec) + |
1023 | sizeof(struct in6_addr) * (*nsrcs))) | 1023 | sizeof(struct in6_addr) * ntohs(*nsrcs))) |
1024 | return -EINVAL; | 1024 | return -EINVAL; |
1025 | 1025 | ||
1026 | grec = (struct mld2_grec *)(skb->data + len); | 1026 | grec = (struct mld2_grec *)(skb->data + len); |
1027 | len += sizeof(*grec) + sizeof(struct in6_addr) * (*nsrcs); | 1027 | len += sizeof(*grec) + |
1028 | sizeof(struct in6_addr) * ntohs(*nsrcs); | ||
1028 | 1029 | ||
1029 | /* We treat these as MLDv1 reports for now. */ | 1030 | /* We treat these as MLDv1 reports for now. */ |
1030 | switch (grec->grec_type) { | 1031 | switch (grec->grec_type) { |
@@ -1340,7 +1341,7 @@ static void br_ip6_multicast_leave_group(struct net_bridge *br, | |||
1340 | { | 1341 | { |
1341 | struct br_ip br_group; | 1342 | struct br_ip br_group; |
1342 | 1343 | ||
1343 | if (ipv6_is_local_multicast(group)) | 1344 | if (!ipv6_is_transient_multicast(group)) |
1344 | return; | 1345 | return; |
1345 | 1346 | ||
1346 | ipv6_addr_copy(&br_group.u.ip6, group); | 1347 | ipv6_addr_copy(&br_group.u.ip6, group); |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index dff633d62e5b..05f357828a2f 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -252,8 +252,12 @@ static int ceph_tcp_recvmsg(struct socket *sock, void *buf, size_t len) | |||
252 | { | 252 | { |
253 | struct kvec iov = {buf, len}; | 253 | struct kvec iov = {buf, len}; |
254 | struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL }; | 254 | struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL }; |
255 | int r; | ||
255 | 256 | ||
256 | return kernel_recvmsg(sock, &msg, &iov, 1, len, msg.msg_flags); | 257 | r = kernel_recvmsg(sock, &msg, &iov, 1, len, msg.msg_flags); |
258 | if (r == -EAGAIN) | ||
259 | r = 0; | ||
260 | return r; | ||
257 | } | 261 | } |
258 | 262 | ||
259 | /* | 263 | /* |
@@ -264,13 +268,17 @@ static int ceph_tcp_sendmsg(struct socket *sock, struct kvec *iov, | |||
264 | size_t kvlen, size_t len, int more) | 268 | size_t kvlen, size_t len, int more) |
265 | { | 269 | { |
266 | struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL }; | 270 | struct msghdr msg = { .msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL }; |
271 | int r; | ||
267 | 272 | ||
268 | if (more) | 273 | if (more) |
269 | msg.msg_flags |= MSG_MORE; | 274 | msg.msg_flags |= MSG_MORE; |
270 | else | 275 | else |
271 | msg.msg_flags |= MSG_EOR; /* superfluous, but what the hell */ | 276 | msg.msg_flags |= MSG_EOR; /* superfluous, but what the hell */ |
272 | 277 | ||
273 | return kernel_sendmsg(sock, &msg, iov, kvlen, len); | 278 | r = kernel_sendmsg(sock, &msg, iov, kvlen, len); |
279 | if (r == -EAGAIN) | ||
280 | r = 0; | ||
281 | return r; | ||
274 | } | 282 | } |
275 | 283 | ||
276 | 284 | ||
@@ -328,7 +336,6 @@ static void reset_connection(struct ceph_connection *con) | |||
328 | ceph_msg_put(con->out_msg); | 336 | ceph_msg_put(con->out_msg); |
329 | con->out_msg = NULL; | 337 | con->out_msg = NULL; |
330 | } | 338 | } |
331 | con->out_keepalive_pending = false; | ||
332 | con->in_seq = 0; | 339 | con->in_seq = 0; |
333 | con->in_seq_acked = 0; | 340 | con->in_seq_acked = 0; |
334 | } | 341 | } |
@@ -847,6 +854,8 @@ static int write_partial_msg_pages(struct ceph_connection *con) | |||
847 | (msg->pages || msg->pagelist || msg->bio || in_trail)) | 854 | (msg->pages || msg->pagelist || msg->bio || in_trail)) |
848 | kunmap(page); | 855 | kunmap(page); |
849 | 856 | ||
857 | if (ret == -EAGAIN) | ||
858 | ret = 0; | ||
850 | if (ret <= 0) | 859 | if (ret <= 0) |
851 | goto out; | 860 | goto out; |
852 | 861 | ||
@@ -1238,8 +1247,6 @@ static int process_connect(struct ceph_connection *con) | |||
1238 | con->auth_retry); | 1247 | con->auth_retry); |
1239 | if (con->auth_retry == 2) { | 1248 | if (con->auth_retry == 2) { |
1240 | con->error_msg = "connect authorization failure"; | 1249 | con->error_msg = "connect authorization failure"; |
1241 | reset_connection(con); | ||
1242 | set_bit(CLOSED, &con->state); | ||
1243 | return -1; | 1250 | return -1; |
1244 | } | 1251 | } |
1245 | con->auth_retry = 1; | 1252 | con->auth_retry = 1; |
@@ -1705,14 +1712,6 @@ more: | |||
1705 | 1712 | ||
1706 | /* open the socket first? */ | 1713 | /* open the socket first? */ |
1707 | if (con->sock == NULL) { | 1714 | if (con->sock == NULL) { |
1708 | /* | ||
1709 | * if we were STANDBY and are reconnecting _this_ | ||
1710 | * connection, bump connect_seq now. Always bump | ||
1711 | * global_seq. | ||
1712 | */ | ||
1713 | if (test_and_clear_bit(STANDBY, &con->state)) | ||
1714 | con->connect_seq++; | ||
1715 | |||
1716 | prepare_write_banner(msgr, con); | 1715 | prepare_write_banner(msgr, con); |
1717 | prepare_write_connect(msgr, con, 1); | 1716 | prepare_write_connect(msgr, con, 1); |
1718 | prepare_read_banner(con); | 1717 | prepare_read_banner(con); |
@@ -1737,16 +1736,12 @@ more_kvec: | |||
1737 | if (con->out_skip) { | 1736 | if (con->out_skip) { |
1738 | ret = write_partial_skip(con); | 1737 | ret = write_partial_skip(con); |
1739 | if (ret <= 0) | 1738 | if (ret <= 0) |
1740 | goto done; | 1739 | goto out; |
1741 | if (ret < 0) { | ||
1742 | dout("try_write write_partial_skip err %d\n", ret); | ||
1743 | goto done; | ||
1744 | } | ||
1745 | } | 1740 | } |
1746 | if (con->out_kvec_left) { | 1741 | if (con->out_kvec_left) { |
1747 | ret = write_partial_kvec(con); | 1742 | ret = write_partial_kvec(con); |
1748 | if (ret <= 0) | 1743 | if (ret <= 0) |
1749 | goto done; | 1744 | goto out; |
1750 | } | 1745 | } |
1751 | 1746 | ||
1752 | /* msg pages? */ | 1747 | /* msg pages? */ |
@@ -1761,11 +1756,11 @@ more_kvec: | |||
1761 | if (ret == 1) | 1756 | if (ret == 1) |
1762 | goto more_kvec; /* we need to send the footer, too! */ | 1757 | goto more_kvec; /* we need to send the footer, too! */ |
1763 | if (ret == 0) | 1758 | if (ret == 0) |
1764 | goto done; | 1759 | goto out; |
1765 | if (ret < 0) { | 1760 | if (ret < 0) { |
1766 | dout("try_write write_partial_msg_pages err %d\n", | 1761 | dout("try_write write_partial_msg_pages err %d\n", |
1767 | ret); | 1762 | ret); |
1768 | goto done; | 1763 | goto out; |
1769 | } | 1764 | } |
1770 | } | 1765 | } |
1771 | 1766 | ||
@@ -1789,10 +1784,9 @@ do_next: | |||
1789 | /* Nothing to do! */ | 1784 | /* Nothing to do! */ |
1790 | clear_bit(WRITE_PENDING, &con->state); | 1785 | clear_bit(WRITE_PENDING, &con->state); |
1791 | dout("try_write nothing else to write.\n"); | 1786 | dout("try_write nothing else to write.\n"); |
1792 | done: | ||
1793 | ret = 0; | 1787 | ret = 0; |
1794 | out: | 1788 | out: |
1795 | dout("try_write done on %p\n", con); | 1789 | dout("try_write done on %p ret %d\n", con, ret); |
1796 | return ret; | 1790 | return ret; |
1797 | } | 1791 | } |
1798 | 1792 | ||
@@ -1821,19 +1815,17 @@ more: | |||
1821 | dout("try_read connecting\n"); | 1815 | dout("try_read connecting\n"); |
1822 | ret = read_partial_banner(con); | 1816 | ret = read_partial_banner(con); |
1823 | if (ret <= 0) | 1817 | if (ret <= 0) |
1824 | goto done; | ||
1825 | if (process_banner(con) < 0) { | ||
1826 | ret = -1; | ||
1827 | goto out; | 1818 | goto out; |
1828 | } | 1819 | ret = process_banner(con); |
1820 | if (ret < 0) | ||
1821 | goto out; | ||
1829 | } | 1822 | } |
1830 | ret = read_partial_connect(con); | 1823 | ret = read_partial_connect(con); |
1831 | if (ret <= 0) | 1824 | if (ret <= 0) |
1832 | goto done; | ||
1833 | if (process_connect(con) < 0) { | ||
1834 | ret = -1; | ||
1835 | goto out; | 1825 | goto out; |
1836 | } | 1826 | ret = process_connect(con); |
1827 | if (ret < 0) | ||
1828 | goto out; | ||
1837 | goto more; | 1829 | goto more; |
1838 | } | 1830 | } |
1839 | 1831 | ||
@@ -1848,7 +1840,7 @@ more: | |||
1848 | dout("skipping %d / %d bytes\n", skip, -con->in_base_pos); | 1840 | dout("skipping %d / %d bytes\n", skip, -con->in_base_pos); |
1849 | ret = ceph_tcp_recvmsg(con->sock, buf, skip); | 1841 | ret = ceph_tcp_recvmsg(con->sock, buf, skip); |
1850 | if (ret <= 0) | 1842 | if (ret <= 0) |
1851 | goto done; | 1843 | goto out; |
1852 | con->in_base_pos += ret; | 1844 | con->in_base_pos += ret; |
1853 | if (con->in_base_pos) | 1845 | if (con->in_base_pos) |
1854 | goto more; | 1846 | goto more; |
@@ -1859,7 +1851,7 @@ more: | |||
1859 | */ | 1851 | */ |
1860 | ret = ceph_tcp_recvmsg(con->sock, &con->in_tag, 1); | 1852 | ret = ceph_tcp_recvmsg(con->sock, &con->in_tag, 1); |
1861 | if (ret <= 0) | 1853 | if (ret <= 0) |
1862 | goto done; | 1854 | goto out; |
1863 | dout("try_read got tag %d\n", (int)con->in_tag); | 1855 | dout("try_read got tag %d\n", (int)con->in_tag); |
1864 | switch (con->in_tag) { | 1856 | switch (con->in_tag) { |
1865 | case CEPH_MSGR_TAG_MSG: | 1857 | case CEPH_MSGR_TAG_MSG: |
@@ -1870,7 +1862,7 @@ more: | |||
1870 | break; | 1862 | break; |
1871 | case CEPH_MSGR_TAG_CLOSE: | 1863 | case CEPH_MSGR_TAG_CLOSE: |
1872 | set_bit(CLOSED, &con->state); /* fixme */ | 1864 | set_bit(CLOSED, &con->state); /* fixme */ |
1873 | goto done; | 1865 | goto out; |
1874 | default: | 1866 | default: |
1875 | goto bad_tag; | 1867 | goto bad_tag; |
1876 | } | 1868 | } |
@@ -1882,13 +1874,12 @@ more: | |||
1882 | case -EBADMSG: | 1874 | case -EBADMSG: |
1883 | con->error_msg = "bad crc"; | 1875 | con->error_msg = "bad crc"; |
1884 | ret = -EIO; | 1876 | ret = -EIO; |
1885 | goto out; | 1877 | break; |
1886 | case -EIO: | 1878 | case -EIO: |
1887 | con->error_msg = "io error"; | 1879 | con->error_msg = "io error"; |
1888 | goto out; | 1880 | break; |
1889 | default: | ||
1890 | goto done; | ||
1891 | } | 1881 | } |
1882 | goto out; | ||
1892 | } | 1883 | } |
1893 | if (con->in_tag == CEPH_MSGR_TAG_READY) | 1884 | if (con->in_tag == CEPH_MSGR_TAG_READY) |
1894 | goto more; | 1885 | goto more; |
@@ -1898,15 +1889,13 @@ more: | |||
1898 | if (con->in_tag == CEPH_MSGR_TAG_ACK) { | 1889 | if (con->in_tag == CEPH_MSGR_TAG_ACK) { |
1899 | ret = read_partial_ack(con); | 1890 | ret = read_partial_ack(con); |
1900 | if (ret <= 0) | 1891 | if (ret <= 0) |
1901 | goto done; | 1892 | goto out; |
1902 | process_ack(con); | 1893 | process_ack(con); |
1903 | goto more; | 1894 | goto more; |
1904 | } | 1895 | } |
1905 | 1896 | ||
1906 | done: | ||
1907 | ret = 0; | ||
1908 | out: | 1897 | out: |
1909 | dout("try_read done on %p\n", con); | 1898 | dout("try_read done on %p ret %d\n", con, ret); |
1910 | return ret; | 1899 | return ret; |
1911 | 1900 | ||
1912 | bad_tag: | 1901 | bad_tag: |
@@ -1951,7 +1940,24 @@ static void con_work(struct work_struct *work) | |||
1951 | work.work); | 1940 | work.work); |
1952 | 1941 | ||
1953 | mutex_lock(&con->mutex); | 1942 | mutex_lock(&con->mutex); |
1943 | if (test_and_clear_bit(BACKOFF, &con->state)) { | ||
1944 | dout("con_work %p backing off\n", con); | ||
1945 | if (queue_delayed_work(ceph_msgr_wq, &con->work, | ||
1946 | round_jiffies_relative(con->delay))) { | ||
1947 | dout("con_work %p backoff %lu\n", con, con->delay); | ||
1948 | mutex_unlock(&con->mutex); | ||
1949 | return; | ||
1950 | } else { | ||
1951 | con->ops->put(con); | ||
1952 | dout("con_work %p FAILED to back off %lu\n", con, | ||
1953 | con->delay); | ||
1954 | } | ||
1955 | } | ||
1954 | 1956 | ||
1957 | if (test_bit(STANDBY, &con->state)) { | ||
1958 | dout("con_work %p STANDBY\n", con); | ||
1959 | goto done; | ||
1960 | } | ||
1955 | if (test_bit(CLOSED, &con->state)) { /* e.g. if we are replaced */ | 1961 | if (test_bit(CLOSED, &con->state)) { /* e.g. if we are replaced */ |
1956 | dout("con_work CLOSED\n"); | 1962 | dout("con_work CLOSED\n"); |
1957 | con_close_socket(con); | 1963 | con_close_socket(con); |
@@ -2008,10 +2014,12 @@ static void ceph_fault(struct ceph_connection *con) | |||
2008 | /* Requeue anything that hasn't been acked */ | 2014 | /* Requeue anything that hasn't been acked */ |
2009 | list_splice_init(&con->out_sent, &con->out_queue); | 2015 | list_splice_init(&con->out_sent, &con->out_queue); |
2010 | 2016 | ||
2011 | /* If there are no messages in the queue, place the connection | 2017 | /* If there are no messages queued or keepalive pending, place |
2012 | * in a STANDBY state (i.e., don't try to reconnect just yet). */ | 2018 | * the connection in a STANDBY state */ |
2013 | if (list_empty(&con->out_queue) && !con->out_keepalive_pending) { | 2019 | if (list_empty(&con->out_queue) && |
2014 | dout("fault setting STANDBY\n"); | 2020 | !test_bit(KEEPALIVE_PENDING, &con->state)) { |
2021 | dout("fault %p setting STANDBY clearing WRITE_PENDING\n", con); | ||
2022 | clear_bit(WRITE_PENDING, &con->state); | ||
2015 | set_bit(STANDBY, &con->state); | 2023 | set_bit(STANDBY, &con->state); |
2016 | } else { | 2024 | } else { |
2017 | /* retry after a delay. */ | 2025 | /* retry after a delay. */ |
@@ -2019,11 +2027,24 @@ static void ceph_fault(struct ceph_connection *con) | |||
2019 | con->delay = BASE_DELAY_INTERVAL; | 2027 | con->delay = BASE_DELAY_INTERVAL; |
2020 | else if (con->delay < MAX_DELAY_INTERVAL) | 2028 | else if (con->delay < MAX_DELAY_INTERVAL) |
2021 | con->delay *= 2; | 2029 | con->delay *= 2; |
2022 | dout("fault queueing %p delay %lu\n", con, con->delay); | ||
2023 | con->ops->get(con); | 2030 | con->ops->get(con); |
2024 | if (queue_delayed_work(ceph_msgr_wq, &con->work, | 2031 | if (queue_delayed_work(ceph_msgr_wq, &con->work, |
2025 | round_jiffies_relative(con->delay)) == 0) | 2032 | round_jiffies_relative(con->delay))) { |
2033 | dout("fault queued %p delay %lu\n", con, con->delay); | ||
2034 | } else { | ||
2026 | con->ops->put(con); | 2035 | con->ops->put(con); |
2036 | dout("fault failed to queue %p delay %lu, backoff\n", | ||
2037 | con, con->delay); | ||
2038 | /* | ||
2039 | * In many cases we see a socket state change | ||
2040 | * while con_work is running and end up | ||
2041 | * queuing (non-delayed) work, such that we | ||
2042 | * can't backoff with a delay. Set a flag so | ||
2043 | * that when con_work restarts we schedule the | ||
2044 | * delay then. | ||
2045 | */ | ||
2046 | set_bit(BACKOFF, &con->state); | ||
2047 | } | ||
2027 | } | 2048 | } |
2028 | 2049 | ||
2029 | out_unlock: | 2050 | out_unlock: |
@@ -2094,6 +2115,19 @@ void ceph_messenger_destroy(struct ceph_messenger *msgr) | |||
2094 | } | 2115 | } |
2095 | EXPORT_SYMBOL(ceph_messenger_destroy); | 2116 | EXPORT_SYMBOL(ceph_messenger_destroy); |
2096 | 2117 | ||
2118 | static void clear_standby(struct ceph_connection *con) | ||
2119 | { | ||
2120 | /* come back from STANDBY? */ | ||
2121 | if (test_and_clear_bit(STANDBY, &con->state)) { | ||
2122 | mutex_lock(&con->mutex); | ||
2123 | dout("clear_standby %p and ++connect_seq\n", con); | ||
2124 | con->connect_seq++; | ||
2125 | WARN_ON(test_bit(WRITE_PENDING, &con->state)); | ||
2126 | WARN_ON(test_bit(KEEPALIVE_PENDING, &con->state)); | ||
2127 | mutex_unlock(&con->mutex); | ||
2128 | } | ||
2129 | } | ||
2130 | |||
2097 | /* | 2131 | /* |
2098 | * Queue up an outgoing message on the given connection. | 2132 | * Queue up an outgoing message on the given connection. |
2099 | */ | 2133 | */ |
@@ -2126,6 +2160,7 @@ void ceph_con_send(struct ceph_connection *con, struct ceph_msg *msg) | |||
2126 | 2160 | ||
2127 | /* if there wasn't anything waiting to send before, queue | 2161 | /* if there wasn't anything waiting to send before, queue |
2128 | * new work */ | 2162 | * new work */ |
2163 | clear_standby(con); | ||
2129 | if (test_and_set_bit(WRITE_PENDING, &con->state) == 0) | 2164 | if (test_and_set_bit(WRITE_PENDING, &con->state) == 0) |
2130 | queue_con(con); | 2165 | queue_con(con); |
2131 | } | 2166 | } |
@@ -2191,6 +2226,8 @@ void ceph_con_revoke_message(struct ceph_connection *con, struct ceph_msg *msg) | |||
2191 | */ | 2226 | */ |
2192 | void ceph_con_keepalive(struct ceph_connection *con) | 2227 | void ceph_con_keepalive(struct ceph_connection *con) |
2193 | { | 2228 | { |
2229 | dout("con_keepalive %p\n", con); | ||
2230 | clear_standby(con); | ||
2194 | if (test_and_set_bit(KEEPALIVE_PENDING, &con->state) == 0 && | 2231 | if (test_and_set_bit(KEEPALIVE_PENDING, &con->state) == 0 && |
2195 | test_and_set_bit(WRITE_PENDING, &con->state) == 0) | 2232 | test_and_set_bit(WRITE_PENDING, &con->state) == 0) |
2196 | queue_con(con); | 2233 | queue_con(con); |
diff --git a/net/ceph/pagevec.c b/net/ceph/pagevec.c index 1a040e64c69f..cd9c21df87d1 100644 --- a/net/ceph/pagevec.c +++ b/net/ceph/pagevec.c | |||
@@ -16,22 +16,30 @@ struct page **ceph_get_direct_page_vector(const char __user *data, | |||
16 | int num_pages, bool write_page) | 16 | int num_pages, bool write_page) |
17 | { | 17 | { |
18 | struct page **pages; | 18 | struct page **pages; |
19 | int rc; | 19 | int got = 0; |
20 | int rc = 0; | ||
20 | 21 | ||
21 | pages = kmalloc(sizeof(*pages) * num_pages, GFP_NOFS); | 22 | pages = kmalloc(sizeof(*pages) * num_pages, GFP_NOFS); |
22 | if (!pages) | 23 | if (!pages) |
23 | return ERR_PTR(-ENOMEM); | 24 | return ERR_PTR(-ENOMEM); |
24 | 25 | ||
25 | down_read(¤t->mm->mmap_sem); | 26 | down_read(¤t->mm->mmap_sem); |
26 | rc = get_user_pages(current, current->mm, (unsigned long)data, | 27 | while (got < num_pages) { |
27 | num_pages, write_page, 0, pages, NULL); | 28 | rc = get_user_pages(current, current->mm, |
29 | (unsigned long)data + ((unsigned long)got * PAGE_SIZE), | ||
30 | num_pages - got, write_page, 0, pages + got, NULL); | ||
31 | if (rc < 0) | ||
32 | break; | ||
33 | BUG_ON(rc == 0); | ||
34 | got += rc; | ||
35 | } | ||
28 | up_read(¤t->mm->mmap_sem); | 36 | up_read(¤t->mm->mmap_sem); |
29 | if (rc < num_pages) | 37 | if (rc < 0) |
30 | goto fail; | 38 | goto fail; |
31 | return pages; | 39 | return pages; |
32 | 40 | ||
33 | fail: | 41 | fail: |
34 | ceph_put_page_vector(pages, rc > 0 ? rc : 0, false); | 42 | ceph_put_page_vector(pages, got, false); |
35 | return ERR_PTR(rc); | 43 | return ERR_PTR(rc); |
36 | } | 44 | } |
37 | EXPORT_SYMBOL(ceph_get_direct_page_vector); | 45 | EXPORT_SYMBOL(ceph_get_direct_page_vector); |
diff --git a/net/core/dev.c b/net/core/dev.c index 8ae6631abcc2..6561021d22d1 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -1114,13 +1114,21 @@ EXPORT_SYMBOL(netdev_bonding_change); | |||
1114 | void dev_load(struct net *net, const char *name) | 1114 | void dev_load(struct net *net, const char *name) |
1115 | { | 1115 | { |
1116 | struct net_device *dev; | 1116 | struct net_device *dev; |
1117 | int no_module; | ||
1117 | 1118 | ||
1118 | rcu_read_lock(); | 1119 | rcu_read_lock(); |
1119 | dev = dev_get_by_name_rcu(net, name); | 1120 | dev = dev_get_by_name_rcu(net, name); |
1120 | rcu_read_unlock(); | 1121 | rcu_read_unlock(); |
1121 | 1122 | ||
1122 | if (!dev && capable(CAP_NET_ADMIN)) | 1123 | no_module = !dev; |
1123 | request_module("%s", name); | 1124 | if (no_module && capable(CAP_NET_ADMIN)) |
1125 | no_module = request_module("netdev-%s", name); | ||
1126 | if (no_module && capable(CAP_SYS_MODULE)) { | ||
1127 | if (!request_module("%s", name)) | ||
1128 | pr_err("Loading kernel module for a network device " | ||
1129 | "with CAP_SYS_MODULE (deprecated). Use CAP_NET_ADMIN and alias netdev-%s " | ||
1130 | "instead\n", name); | ||
1131 | } | ||
1124 | } | 1132 | } |
1125 | EXPORT_SYMBOL(dev_load); | 1133 | EXPORT_SYMBOL(dev_load); |
1126 | 1134 | ||
diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c index 508f9c18992f..133fd22ea287 100644 --- a/net/core/dev_addr_lists.c +++ b/net/core/dev_addr_lists.c | |||
@@ -144,7 +144,7 @@ void __hw_addr_del_multiple(struct netdev_hw_addr_list *to_list, | |||
144 | 144 | ||
145 | list_for_each_entry(ha, &from_list->list, list) { | 145 | list_for_each_entry(ha, &from_list->list, list) { |
146 | type = addr_type ? addr_type : ha->type; | 146 | type = addr_type ? addr_type : ha->type; |
147 | __hw_addr_del(to_list, ha->addr, addr_len, addr_type); | 147 | __hw_addr_del(to_list, ha->addr, addr_len, type); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | EXPORT_SYMBOL(__hw_addr_del_multiple); | 150 | EXPORT_SYMBOL(__hw_addr_del_multiple); |
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index a9e7fc4c461f..b5bada92f637 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c | |||
@@ -3321,7 +3321,7 @@ static void show_results(struct pktgen_dev *pkt_dev, int nr_frags) | |||
3321 | pkt_dev->started_at); | 3321 | pkt_dev->started_at); |
3322 | ktime_t idle = ns_to_ktime(pkt_dev->idle_acc); | 3322 | ktime_t idle = ns_to_ktime(pkt_dev->idle_acc); |
3323 | 3323 | ||
3324 | p += sprintf(p, "OK: %llu(c%llu+d%llu) nsec, %llu (%dbyte,%dfrags)\n", | 3324 | p += sprintf(p, "OK: %llu(c%llu+d%llu) usec, %llu (%dbyte,%dfrags)\n", |
3325 | (unsigned long long)ktime_to_us(elapsed), | 3325 | (unsigned long long)ktime_to_us(elapsed), |
3326 | (unsigned long long)ktime_to_us(ktime_sub(elapsed, idle)), | 3326 | (unsigned long long)ktime_to_us(ktime_sub(elapsed, idle)), |
3327 | (unsigned long long)ktime_to_us(idle), | 3327 | (unsigned long long)ktime_to_us(idle), |
diff --git a/net/core/scm.c b/net/core/scm.c index bbe454450801..4c1ef026d695 100644 --- a/net/core/scm.c +++ b/net/core/scm.c | |||
@@ -95,7 +95,7 @@ static int scm_fp_copy(struct cmsghdr *cmsg, struct scm_fp_list **fplp) | |||
95 | int fd = fdp[i]; | 95 | int fd = fdp[i]; |
96 | struct file *file; | 96 | struct file *file; |
97 | 97 | ||
98 | if (fd < 0 || !(file = fget(fd))) | 98 | if (fd < 0 || !(file = fget_raw(fd))) |
99 | return -EBADF; | 99 | return -EBADF; |
100 | *fpp++ = file; | 100 | *fpp++ = file; |
101 | fpl->count++; | 101 | fpl->count++; |
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c index d5074a567289..c44348adba3b 100644 --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c | |||
@@ -1193,7 +1193,7 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlattr **tb, | |||
1193 | goto err; | 1193 | goto err; |
1194 | } | 1194 | } |
1195 | 1195 | ||
1196 | if (ieee[DCB_ATTR_IEEE_PFC] && ops->ieee_setets) { | 1196 | if (ieee[DCB_ATTR_IEEE_PFC] && ops->ieee_setpfc) { |
1197 | struct ieee_pfc *pfc = nla_data(ieee[DCB_ATTR_IEEE_PFC]); | 1197 | struct ieee_pfc *pfc = nla_data(ieee[DCB_ATTR_IEEE_PFC]); |
1198 | err = ops->ieee_setpfc(netdev, pfc); | 1198 | err = ops->ieee_setpfc(netdev, pfc); |
1199 | if (err) | 1199 | if (err) |
diff --git a/net/dccp/input.c b/net/dccp/input.c index 8cde009e8b85..4222e7a654b0 100644 --- a/net/dccp/input.c +++ b/net/dccp/input.c | |||
@@ -614,6 +614,9 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
614 | /* Caller (dccp_v4_do_rcv) will send Reset */ | 614 | /* Caller (dccp_v4_do_rcv) will send Reset */ |
615 | dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION; | 615 | dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION; |
616 | return 1; | 616 | return 1; |
617 | } else if (sk->sk_state == DCCP_CLOSED) { | ||
618 | dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION; | ||
619 | return 1; | ||
617 | } | 620 | } |
618 | 621 | ||
619 | if (sk->sk_state != DCCP_REQUESTING && sk->sk_state != DCCP_RESPOND) { | 622 | if (sk->sk_state != DCCP_REQUESTING && sk->sk_state != DCCP_RESPOND) { |
@@ -668,10 +671,6 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
668 | } | 671 | } |
669 | 672 | ||
670 | switch (sk->sk_state) { | 673 | switch (sk->sk_state) { |
671 | case DCCP_CLOSED: | ||
672 | dcb->dccpd_reset_code = DCCP_RESET_CODE_NO_CONNECTION; | ||
673 | return 1; | ||
674 | |||
675 | case DCCP_REQUESTING: | 674 | case DCCP_REQUESTING: |
676 | queued = dccp_rcv_request_sent_state_process(sk, skb, dh, len); | 675 | queued = dccp_rcv_request_sent_state_process(sk, skb, dh, len); |
677 | if (queued >= 0) | 676 | if (queued >= 0) |
diff --git a/net/dns_resolver/dns_key.c b/net/dns_resolver/dns_key.c index 739435a6af39..cfa7a5e1c5c9 100644 --- a/net/dns_resolver/dns_key.c +++ b/net/dns_resolver/dns_key.c | |||
@@ -67,8 +67,9 @@ dns_resolver_instantiate(struct key *key, const void *_data, size_t datalen) | |||
67 | size_t result_len = 0; | 67 | size_t result_len = 0; |
68 | const char *data = _data, *end, *opt; | 68 | const char *data = _data, *end, *opt; |
69 | 69 | ||
70 | kenter("%%%d,%s,'%s',%zu", | 70 | kenter("%%%d,%s,'%*.*s',%zu", |
71 | key->serial, key->description, data, datalen); | 71 | key->serial, key->description, |
72 | (int)datalen, (int)datalen, data, datalen); | ||
72 | 73 | ||
73 | if (datalen <= 1 || !data || data[datalen - 1] != '\0') | 74 | if (datalen <= 1 || !data || data[datalen - 1] != '\0') |
74 | return -EINVAL; | 75 | return -EINVAL; |
@@ -217,6 +218,19 @@ static void dns_resolver_describe(const struct key *key, struct seq_file *m) | |||
217 | seq_printf(m, ": %u", key->datalen); | 218 | seq_printf(m, ": %u", key->datalen); |
218 | } | 219 | } |
219 | 220 | ||
221 | /* | ||
222 | * read the DNS data | ||
223 | * - the key's semaphore is read-locked | ||
224 | */ | ||
225 | static long dns_resolver_read(const struct key *key, | ||
226 | char __user *buffer, size_t buflen) | ||
227 | { | ||
228 | if (key->type_data.x[0]) | ||
229 | return key->type_data.x[0]; | ||
230 | |||
231 | return user_read(key, buffer, buflen); | ||
232 | } | ||
233 | |||
220 | struct key_type key_type_dns_resolver = { | 234 | struct key_type key_type_dns_resolver = { |
221 | .name = "dns_resolver", | 235 | .name = "dns_resolver", |
222 | .instantiate = dns_resolver_instantiate, | 236 | .instantiate = dns_resolver_instantiate, |
@@ -224,7 +238,7 @@ struct key_type key_type_dns_resolver = { | |||
224 | .revoke = user_revoke, | 238 | .revoke = user_revoke, |
225 | .destroy = user_destroy, | 239 | .destroy = user_destroy, |
226 | .describe = dns_resolver_describe, | 240 | .describe = dns_resolver_describe, |
227 | .read = user_read, | 241 | .read = dns_resolver_read, |
228 | }; | 242 | }; |
229 | 243 | ||
230 | static int __init init_dns_resolver(void) | 244 | static int __init init_dns_resolver(void) |
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index df4616fce929..036652c8166d 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -670,7 +670,7 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg) | |||
670 | ifap = &ifa->ifa_next) { | 670 | ifap = &ifa->ifa_next) { |
671 | if (!strcmp(ifr.ifr_name, ifa->ifa_label) && | 671 | if (!strcmp(ifr.ifr_name, ifa->ifa_label) && |
672 | sin_orig.sin_addr.s_addr == | 672 | sin_orig.sin_addr.s_addr == |
673 | ifa->ifa_address) { | 673 | ifa->ifa_local) { |
674 | break; /* found */ | 674 | break; /* found */ |
675 | } | 675 | } |
676 | } | 676 | } |
@@ -1040,8 +1040,8 @@ static void inetdev_send_gratuitous_arp(struct net_device *dev, | |||
1040 | return; | 1040 | return; |
1041 | 1041 | ||
1042 | arp_send(ARPOP_REQUEST, ETH_P_ARP, | 1042 | arp_send(ARPOP_REQUEST, ETH_P_ARP, |
1043 | ifa->ifa_address, dev, | 1043 | ifa->ifa_local, dev, |
1044 | ifa->ifa_address, NULL, | 1044 | ifa->ifa_local, NULL, |
1045 | dev->dev_addr, NULL); | 1045 | dev->dev_addr, NULL); |
1046 | } | 1046 | } |
1047 | 1047 | ||
diff --git a/net/ipv4/inet_timewait_sock.c b/net/ipv4/inet_timewait_sock.c index c5af909cf701..3c8dfa16614d 100644 --- a/net/ipv4/inet_timewait_sock.c +++ b/net/ipv4/inet_timewait_sock.c | |||
@@ -505,7 +505,9 @@ restart: | |||
505 | } | 505 | } |
506 | 506 | ||
507 | rcu_read_unlock(); | 507 | rcu_read_unlock(); |
508 | local_bh_disable(); | ||
508 | inet_twsk_deschedule(tw, twdr); | 509 | inet_twsk_deschedule(tw, twdr); |
510 | local_bh_enable(); | ||
509 | inet_twsk_put(tw); | 511 | inet_twsk_put(tw); |
510 | goto restart_rcu; | 512 | goto restart_rcu; |
511 | } | 513 | } |
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index 6613edfac28c..d1d0e2c256fc 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -1765,4 +1765,4 @@ module_exit(ipgre_fini); | |||
1765 | MODULE_LICENSE("GPL"); | 1765 | MODULE_LICENSE("GPL"); |
1766 | MODULE_ALIAS_RTNL_LINK("gre"); | 1766 | MODULE_ALIAS_RTNL_LINK("gre"); |
1767 | MODULE_ALIAS_RTNL_LINK("gretap"); | 1767 | MODULE_ALIAS_RTNL_LINK("gretap"); |
1768 | MODULE_ALIAS("gre0"); | 1768 | MODULE_ALIAS_NETDEV("gre0"); |
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 988f52fba54a..a5f58e7cbb26 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c | |||
@@ -913,4 +913,4 @@ static void __exit ipip_fini(void) | |||
913 | module_init(ipip_init); | 913 | module_init(ipip_init); |
914 | module_exit(ipip_fini); | 914 | module_exit(ipip_fini); |
915 | MODULE_LICENSE("GPL"); | 915 | MODULE_LICENSE("GPL"); |
916 | MODULE_ALIAS("tunl0"); | 916 | MODULE_ALIAS_NETDEV("tunl0"); |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index eb7f82ebf4a3..65f6c0406245 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -1222,7 +1222,7 @@ static int tcp_check_dsack(struct sock *sk, struct sk_buff *ack_skb, | |||
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | /* D-SACK for already forgotten data... Do dumb counting. */ | 1224 | /* D-SACK for already forgotten data... Do dumb counting. */ |
1225 | if (dup_sack && | 1225 | if (dup_sack && tp->undo_marker && tp->undo_retrans && |
1226 | !after(end_seq_0, prior_snd_una) && | 1226 | !after(end_seq_0, prior_snd_una) && |
1227 | after(end_seq_0, tp->undo_marker)) | 1227 | after(end_seq_0, tp->undo_marker)) |
1228 | tp->undo_retrans--; | 1228 | tp->undo_retrans--; |
@@ -1299,7 +1299,8 @@ static u8 tcp_sacktag_one(struct sk_buff *skb, struct sock *sk, | |||
1299 | 1299 | ||
1300 | /* Account D-SACK for retransmitted packet. */ | 1300 | /* Account D-SACK for retransmitted packet. */ |
1301 | if (dup_sack && (sacked & TCPCB_RETRANS)) { | 1301 | if (dup_sack && (sacked & TCPCB_RETRANS)) { |
1302 | if (after(TCP_SKB_CB(skb)->end_seq, tp->undo_marker)) | 1302 | if (tp->undo_marker && tp->undo_retrans && |
1303 | after(TCP_SKB_CB(skb)->end_seq, tp->undo_marker)) | ||
1303 | tp->undo_retrans--; | 1304 | tp->undo_retrans--; |
1304 | if (sacked & TCPCB_SACKED_ACKED) | 1305 | if (sacked & TCPCB_SACKED_ACKED) |
1305 | state->reord = min(fack_count, state->reord); | 1306 | state->reord = min(fack_count, state->reord); |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 406f320336e6..dfa5beb0c1c8 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -2162,7 +2162,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb) | |||
2162 | if (!tp->retrans_stamp) | 2162 | if (!tp->retrans_stamp) |
2163 | tp->retrans_stamp = TCP_SKB_CB(skb)->when; | 2163 | tp->retrans_stamp = TCP_SKB_CB(skb)->when; |
2164 | 2164 | ||
2165 | tp->undo_retrans++; | 2165 | tp->undo_retrans += tcp_skb_pcount(skb); |
2166 | 2166 | ||
2167 | /* snd_nxt is stored to detect loss of retransmitted segment, | 2167 | /* snd_nxt is stored to detect loss of retransmitted segment, |
2168 | * see tcp_input.c tcp_sacktag_write_queue(). | 2168 | * see tcp_input.c tcp_sacktag_write_queue(). |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 4f4483e697bd..e528a42a52be 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -57,6 +57,7 @@ | |||
57 | MODULE_AUTHOR("Ville Nuorvala"); | 57 | MODULE_AUTHOR("Ville Nuorvala"); |
58 | MODULE_DESCRIPTION("IPv6 tunneling device"); | 58 | MODULE_DESCRIPTION("IPv6 tunneling device"); |
59 | MODULE_LICENSE("GPL"); | 59 | MODULE_LICENSE("GPL"); |
60 | MODULE_ALIAS_NETDEV("ip6tnl0"); | ||
60 | 61 | ||
61 | #ifdef IP6_TNL_DEBUG | 62 | #ifdef IP6_TNL_DEBUG |
62 | #define IP6_TNL_TRACE(x...) printk(KERN_DEBUG "%s:" x "\n", __func__) | 63 | #define IP6_TNL_TRACE(x...) printk(KERN_DEBUG "%s:" x "\n", __func__) |
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c index 09c88891a753..de338037a736 100644 --- a/net/ipv6/netfilter/ip6t_LOG.c +++ b/net/ipv6/netfilter/ip6t_LOG.c | |||
@@ -410,7 +410,7 @@ fallback: | |||
410 | if (p != NULL) { | 410 | if (p != NULL) { |
411 | sb_add(m, "%02x", *p++); | 411 | sb_add(m, "%02x", *p++); |
412 | for (i = 1; i < len; i++) | 412 | for (i = 1; i < len; i++) |
413 | sb_add(m, ":%02x", p[i]); | 413 | sb_add(m, ":%02x", *p++); |
414 | } | 414 | } |
415 | sb_add(m, " "); | 415 | sb_add(m, " "); |
416 | 416 | ||
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index a998db6e7895..e7db7014e89f 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -739,8 +739,10 @@ restart: | |||
739 | 739 | ||
740 | if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) | 740 | if (!rt->rt6i_nexthop && !(rt->rt6i_flags & RTF_NONEXTHOP)) |
741 | nrt = rt6_alloc_cow(rt, &fl->fl6_dst, &fl->fl6_src); | 741 | nrt = rt6_alloc_cow(rt, &fl->fl6_dst, &fl->fl6_src); |
742 | else | 742 | else if (!(rt->dst.flags & DST_HOST)) |
743 | nrt = rt6_alloc_clone(rt, &fl->fl6_dst); | 743 | nrt = rt6_alloc_clone(rt, &fl->fl6_dst); |
744 | else | ||
745 | goto out2; | ||
744 | 746 | ||
745 | dst_release(&rt->dst); | 747 | dst_release(&rt->dst); |
746 | rt = nrt ? : net->ipv6.ip6_null_entry; | 748 | rt = nrt ? : net->ipv6.ip6_null_entry; |
@@ -2557,14 +2559,16 @@ static | |||
2557 | int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, | 2559 | int ipv6_sysctl_rtcache_flush(ctl_table *ctl, int write, |
2558 | void __user *buffer, size_t *lenp, loff_t *ppos) | 2560 | void __user *buffer, size_t *lenp, loff_t *ppos) |
2559 | { | 2561 | { |
2560 | struct net *net = current->nsproxy->net_ns; | 2562 | struct net *net; |
2561 | int delay = net->ipv6.sysctl.flush_delay; | 2563 | int delay; |
2562 | if (write) { | 2564 | if (!write) |
2563 | proc_dointvec(ctl, write, buffer, lenp, ppos); | ||
2564 | fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net); | ||
2565 | return 0; | ||
2566 | } else | ||
2567 | return -EINVAL; | 2565 | return -EINVAL; |
2566 | |||
2567 | net = (struct net *)ctl->extra1; | ||
2568 | delay = net->ipv6.sysctl.flush_delay; | ||
2569 | proc_dointvec(ctl, write, buffer, lenp, ppos); | ||
2570 | fib6_run_gc(delay <= 0 ? ~0UL : (unsigned long)delay, net); | ||
2571 | return 0; | ||
2568 | } | 2572 | } |
2569 | 2573 | ||
2570 | ctl_table ipv6_route_table_template[] = { | 2574 | ctl_table ipv6_route_table_template[] = { |
@@ -2651,6 +2655,7 @@ struct ctl_table * __net_init ipv6_route_sysctl_init(struct net *net) | |||
2651 | 2655 | ||
2652 | if (table) { | 2656 | if (table) { |
2653 | table[0].data = &net->ipv6.sysctl.flush_delay; | 2657 | table[0].data = &net->ipv6.sysctl.flush_delay; |
2658 | table[0].extra1 = net; | ||
2654 | table[1].data = &net->ipv6.ip6_dst_ops.gc_thresh; | 2659 | table[1].data = &net->ipv6.ip6_dst_ops.gc_thresh; |
2655 | table[2].data = &net->ipv6.sysctl.ip6_rt_max_size; | 2660 | table[2].data = &net->ipv6.sysctl.ip6_rt_max_size; |
2656 | table[3].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval; | 2661 | table[3].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval; |
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c index 8ce38f10a547..d2c16e10f650 100644 --- a/net/ipv6/sit.c +++ b/net/ipv6/sit.c | |||
@@ -1290,4 +1290,4 @@ static int __init sit_init(void) | |||
1290 | module_init(sit_init); | 1290 | module_init(sit_init); |
1291 | module_exit(sit_cleanup); | 1291 | module_exit(sit_cleanup); |
1292 | MODULE_LICENSE("GPL"); | 1292 | MODULE_LICENSE("GPL"); |
1293 | MODULE_ALIAS("sit0"); | 1293 | MODULE_ALIAS_NETDEV("sit0"); |
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c index 8acba456744e..7a10a8d1b2d0 100644 --- a/net/mac80211/iface.c +++ b/net/mac80211/iface.c | |||
@@ -1229,6 +1229,7 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local) | |||
1229 | } | 1229 | } |
1230 | mutex_unlock(&local->iflist_mtx); | 1230 | mutex_unlock(&local->iflist_mtx); |
1231 | unregister_netdevice_many(&unreg_list); | 1231 | unregister_netdevice_many(&unreg_list); |
1232 | list_del(&unreg_list); | ||
1232 | } | 1233 | } |
1233 | 1234 | ||
1234 | static u32 ieee80211_idle_off(struct ieee80211_local *local, | 1235 | static u32 ieee80211_idle_off(struct ieee80211_local *local, |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 45fbb9e33746..c9ceb4d57ab0 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1033,6 +1033,12 @@ void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, | |||
1033 | if (is_multicast_ether_addr(hdr->addr1)) | 1033 | if (is_multicast_ether_addr(hdr->addr1)) |
1034 | return; | 1034 | return; |
1035 | 1035 | ||
1036 | /* | ||
1037 | * In case we receive frames after disassociation. | ||
1038 | */ | ||
1039 | if (!sdata->u.mgd.associated) | ||
1040 | return; | ||
1041 | |||
1036 | ieee80211_sta_reset_conn_monitor(sdata); | 1042 | ieee80211_sta_reset_conn_monitor(sdata); |
1037 | } | 1043 | } |
1038 | 1044 | ||
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 22f7ad5101ab..ba98e1308f3c 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -808,9 +808,9 @@ __ip_vs_update_dest(struct ip_vs_service *svc, struct ip_vs_dest *dest, | |||
808 | dest->u_threshold = udest->u_threshold; | 808 | dest->u_threshold = udest->u_threshold; |
809 | dest->l_threshold = udest->l_threshold; | 809 | dest->l_threshold = udest->l_threshold; |
810 | 810 | ||
811 | spin_lock(&dest->dst_lock); | 811 | spin_lock_bh(&dest->dst_lock); |
812 | ip_vs_dst_reset(dest); | 812 | ip_vs_dst_reset(dest); |
813 | spin_unlock(&dest->dst_lock); | 813 | spin_unlock_bh(&dest->dst_lock); |
814 | 814 | ||
815 | if (add) | 815 | if (add) |
816 | ip_vs_new_estimator(&dest->stats); | 816 | ip_vs_new_estimator(&dest->stats); |
diff --git a/net/netfilter/nf_log.c b/net/netfilter/nf_log.c index b07393eab88e..91816998ed86 100644 --- a/net/netfilter/nf_log.c +++ b/net/netfilter/nf_log.c | |||
@@ -85,6 +85,8 @@ EXPORT_SYMBOL(nf_log_unregister); | |||
85 | 85 | ||
86 | int nf_log_bind_pf(u_int8_t pf, const struct nf_logger *logger) | 86 | int nf_log_bind_pf(u_int8_t pf, const struct nf_logger *logger) |
87 | { | 87 | { |
88 | if (pf >= ARRAY_SIZE(nf_loggers)) | ||
89 | return -EINVAL; | ||
88 | mutex_lock(&nf_log_mutex); | 90 | mutex_lock(&nf_log_mutex); |
89 | if (__find_logger(pf, logger->name) == NULL) { | 91 | if (__find_logger(pf, logger->name) == NULL) { |
90 | mutex_unlock(&nf_log_mutex); | 92 | mutex_unlock(&nf_log_mutex); |
@@ -98,6 +100,8 @@ EXPORT_SYMBOL(nf_log_bind_pf); | |||
98 | 100 | ||
99 | void nf_log_unbind_pf(u_int8_t pf) | 101 | void nf_log_unbind_pf(u_int8_t pf) |
100 | { | 102 | { |
103 | if (pf >= ARRAY_SIZE(nf_loggers)) | ||
104 | return; | ||
101 | mutex_lock(&nf_log_mutex); | 105 | mutex_lock(&nf_log_mutex); |
102 | rcu_assign_pointer(nf_loggers[pf], NULL); | 106 | rcu_assign_pointer(nf_loggers[pf], NULL); |
103 | mutex_unlock(&nf_log_mutex); | 107 | mutex_unlock(&nf_log_mutex); |
diff --git a/net/netfilter/nf_tproxy_core.c b/net/netfilter/nf_tproxy_core.c index 4d87befb04c0..474d621cbc2e 100644 --- a/net/netfilter/nf_tproxy_core.c +++ b/net/netfilter/nf_tproxy_core.c | |||
@@ -28,26 +28,23 @@ nf_tproxy_destructor(struct sk_buff *skb) | |||
28 | skb->destructor = NULL; | 28 | skb->destructor = NULL; |
29 | 29 | ||
30 | if (sk) | 30 | if (sk) |
31 | nf_tproxy_put_sock(sk); | 31 | sock_put(sk); |
32 | } | 32 | } |
33 | 33 | ||
34 | /* consumes sk */ | 34 | /* consumes sk */ |
35 | int | 35 | void |
36 | nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk) | 36 | nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk) |
37 | { | 37 | { |
38 | bool transparent = (sk->sk_state == TCP_TIME_WAIT) ? | 38 | /* assigning tw sockets complicates things; most |
39 | inet_twsk(sk)->tw_transparent : | 39 | * skb->sk->X checks would have to test sk->sk_state first */ |
40 | inet_sk(sk)->transparent; | 40 | if (sk->sk_state == TCP_TIME_WAIT) { |
41 | 41 | inet_twsk_put(inet_twsk(sk)); | |
42 | if (transparent) { | 42 | return; |
43 | skb_orphan(skb); | 43 | } |
44 | skb->sk = sk; | 44 | |
45 | skb->destructor = nf_tproxy_destructor; | 45 | skb_orphan(skb); |
46 | return 1; | 46 | skb->sk = sk; |
47 | } else | 47 | skb->destructor = nf_tproxy_destructor; |
48 | nf_tproxy_put_sock(sk); | ||
49 | |||
50 | return 0; | ||
51 | } | 48 | } |
52 | EXPORT_SYMBOL_GPL(nf_tproxy_assign_sock); | 49 | EXPORT_SYMBOL_GPL(nf_tproxy_assign_sock); |
53 | 50 | ||
diff --git a/net/netfilter/xt_TPROXY.c b/net/netfilter/xt_TPROXY.c index 640678f47a2a..dcfd57eb9d02 100644 --- a/net/netfilter/xt_TPROXY.c +++ b/net/netfilter/xt_TPROXY.c | |||
@@ -33,6 +33,20 @@ | |||
33 | #include <net/netfilter/nf_tproxy_core.h> | 33 | #include <net/netfilter/nf_tproxy_core.h> |
34 | #include <linux/netfilter/xt_TPROXY.h> | 34 | #include <linux/netfilter/xt_TPROXY.h> |
35 | 35 | ||
36 | static bool tproxy_sk_is_transparent(struct sock *sk) | ||
37 | { | ||
38 | if (sk->sk_state != TCP_TIME_WAIT) { | ||
39 | if (inet_sk(sk)->transparent) | ||
40 | return true; | ||
41 | sock_put(sk); | ||
42 | } else { | ||
43 | if (inet_twsk(sk)->tw_transparent) | ||
44 | return true; | ||
45 | inet_twsk_put(inet_twsk(sk)); | ||
46 | } | ||
47 | return false; | ||
48 | } | ||
49 | |||
36 | static inline __be32 | 50 | static inline __be32 |
37 | tproxy_laddr4(struct sk_buff *skb, __be32 user_laddr, __be32 daddr) | 51 | tproxy_laddr4(struct sk_buff *skb, __be32 user_laddr, __be32 daddr) |
38 | { | 52 | { |
@@ -141,7 +155,7 @@ tproxy_tg4(struct sk_buff *skb, __be32 laddr, __be16 lport, | |||
141 | skb->dev, NFT_LOOKUP_LISTENER); | 155 | skb->dev, NFT_LOOKUP_LISTENER); |
142 | 156 | ||
143 | /* NOTE: assign_sock consumes our sk reference */ | 157 | /* NOTE: assign_sock consumes our sk reference */ |
144 | if (sk && nf_tproxy_assign_sock(skb, sk)) { | 158 | if (sk && tproxy_sk_is_transparent(sk)) { |
145 | /* This should be in a separate target, but we don't do multiple | 159 | /* This should be in a separate target, but we don't do multiple |
146 | targets on the same rule yet */ | 160 | targets on the same rule yet */ |
147 | skb->mark = (skb->mark & ~mark_mask) ^ mark_value; | 161 | skb->mark = (skb->mark & ~mark_mask) ^ mark_value; |
@@ -149,6 +163,8 @@ tproxy_tg4(struct sk_buff *skb, __be32 laddr, __be16 lport, | |||
149 | pr_debug("redirecting: proto %hhu %pI4:%hu -> %pI4:%hu, mark: %x\n", | 163 | pr_debug("redirecting: proto %hhu %pI4:%hu -> %pI4:%hu, mark: %x\n", |
150 | iph->protocol, &iph->daddr, ntohs(hp->dest), | 164 | iph->protocol, &iph->daddr, ntohs(hp->dest), |
151 | &laddr, ntohs(lport), skb->mark); | 165 | &laddr, ntohs(lport), skb->mark); |
166 | |||
167 | nf_tproxy_assign_sock(skb, sk); | ||
152 | return NF_ACCEPT; | 168 | return NF_ACCEPT; |
153 | } | 169 | } |
154 | 170 | ||
@@ -306,7 +322,7 @@ tproxy_tg6_v1(struct sk_buff *skb, const struct xt_action_param *par) | |||
306 | par->in, NFT_LOOKUP_LISTENER); | 322 | par->in, NFT_LOOKUP_LISTENER); |
307 | 323 | ||
308 | /* NOTE: assign_sock consumes our sk reference */ | 324 | /* NOTE: assign_sock consumes our sk reference */ |
309 | if (sk && nf_tproxy_assign_sock(skb, sk)) { | 325 | if (sk && tproxy_sk_is_transparent(sk)) { |
310 | /* This should be in a separate target, but we don't do multiple | 326 | /* This should be in a separate target, but we don't do multiple |
311 | targets on the same rule yet */ | 327 | targets on the same rule yet */ |
312 | skb->mark = (skb->mark & ~tgi->mark_mask) ^ tgi->mark_value; | 328 | skb->mark = (skb->mark & ~tgi->mark_mask) ^ tgi->mark_value; |
@@ -314,6 +330,8 @@ tproxy_tg6_v1(struct sk_buff *skb, const struct xt_action_param *par) | |||
314 | pr_debug("redirecting: proto %hhu %pI6:%hu -> %pI6:%hu, mark: %x\n", | 330 | pr_debug("redirecting: proto %hhu %pI6:%hu -> %pI6:%hu, mark: %x\n", |
315 | tproto, &iph->saddr, ntohs(hp->source), | 331 | tproto, &iph->saddr, ntohs(hp->source), |
316 | laddr, ntohs(lport), skb->mark); | 332 | laddr, ntohs(lport), skb->mark); |
333 | |||
334 | nf_tproxy_assign_sock(skb, sk); | ||
317 | return NF_ACCEPT; | 335 | return NF_ACCEPT; |
318 | } | 336 | } |
319 | 337 | ||
diff --git a/net/netfilter/xt_socket.c b/net/netfilter/xt_socket.c index 00d6ae838303..9cc46356b577 100644 --- a/net/netfilter/xt_socket.c +++ b/net/netfilter/xt_socket.c | |||
@@ -35,6 +35,15 @@ | |||
35 | #include <net/netfilter/nf_conntrack.h> | 35 | #include <net/netfilter/nf_conntrack.h> |
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | static void | ||
39 | xt_socket_put_sk(struct sock *sk) | ||
40 | { | ||
41 | if (sk->sk_state == TCP_TIME_WAIT) | ||
42 | inet_twsk_put(inet_twsk(sk)); | ||
43 | else | ||
44 | sock_put(sk); | ||
45 | } | ||
46 | |||
38 | static int | 47 | static int |
39 | extract_icmp4_fields(const struct sk_buff *skb, | 48 | extract_icmp4_fields(const struct sk_buff *skb, |
40 | u8 *protocol, | 49 | u8 *protocol, |
@@ -164,7 +173,7 @@ socket_match(const struct sk_buff *skb, struct xt_action_param *par, | |||
164 | (sk->sk_state == TCP_TIME_WAIT && | 173 | (sk->sk_state == TCP_TIME_WAIT && |
165 | inet_twsk(sk)->tw_transparent)); | 174 | inet_twsk(sk)->tw_transparent)); |
166 | 175 | ||
167 | nf_tproxy_put_sock(sk); | 176 | xt_socket_put_sk(sk); |
168 | 177 | ||
169 | if (wildcard || !transparent) | 178 | if (wildcard || !transparent) |
170 | sk = NULL; | 179 | sk = NULL; |
@@ -298,7 +307,7 @@ socket_mt6_v1(const struct sk_buff *skb, struct xt_action_param *par) | |||
298 | (sk->sk_state == TCP_TIME_WAIT && | 307 | (sk->sk_state == TCP_TIME_WAIT && |
299 | inet_twsk(sk)->tw_transparent)); | 308 | inet_twsk(sk)->tw_transparent)); |
300 | 309 | ||
301 | nf_tproxy_put_sock(sk); | 310 | xt_socket_put_sk(sk); |
302 | 311 | ||
303 | if (wildcard || !transparent) | 312 | if (wildcard || !transparent) |
304 | sk = NULL; | 313 | sk = NULL; |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 478181d53c55..1f924595bdef 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1407,7 +1407,7 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock, | |||
1407 | int noblock = flags&MSG_DONTWAIT; | 1407 | int noblock = flags&MSG_DONTWAIT; |
1408 | size_t copied; | 1408 | size_t copied; |
1409 | struct sk_buff *skb, *data_skb; | 1409 | struct sk_buff *skb, *data_skb; |
1410 | int err; | 1410 | int err, ret; |
1411 | 1411 | ||
1412 | if (flags&MSG_OOB) | 1412 | if (flags&MSG_OOB) |
1413 | return -EOPNOTSUPP; | 1413 | return -EOPNOTSUPP; |
@@ -1470,8 +1470,13 @@ static int netlink_recvmsg(struct kiocb *kiocb, struct socket *sock, | |||
1470 | 1470 | ||
1471 | skb_free_datagram(sk, skb); | 1471 | skb_free_datagram(sk, skb); |
1472 | 1472 | ||
1473 | if (nlk->cb && atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) | 1473 | if (nlk->cb && atomic_read(&sk->sk_rmem_alloc) <= sk->sk_rcvbuf / 2) { |
1474 | netlink_dump(sk); | 1474 | ret = netlink_dump(sk); |
1475 | if (ret) { | ||
1476 | sk->sk_err = ret; | ||
1477 | sk->sk_error_report(sk); | ||
1478 | } | ||
1479 | } | ||
1475 | 1480 | ||
1476 | scm_recv(sock, msg, siocb->scm, flags); | 1481 | scm_recv(sock, msg, siocb->scm, flags); |
1477 | out: | 1482 | out: |
@@ -1736,6 +1741,7 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, | |||
1736 | struct netlink_callback *cb; | 1741 | struct netlink_callback *cb; |
1737 | struct sock *sk; | 1742 | struct sock *sk; |
1738 | struct netlink_sock *nlk; | 1743 | struct netlink_sock *nlk; |
1744 | int ret; | ||
1739 | 1745 | ||
1740 | cb = kzalloc(sizeof(*cb), GFP_KERNEL); | 1746 | cb = kzalloc(sizeof(*cb), GFP_KERNEL); |
1741 | if (cb == NULL) | 1747 | if (cb == NULL) |
@@ -1764,9 +1770,13 @@ int netlink_dump_start(struct sock *ssk, struct sk_buff *skb, | |||
1764 | nlk->cb = cb; | 1770 | nlk->cb = cb; |
1765 | mutex_unlock(nlk->cb_mutex); | 1771 | mutex_unlock(nlk->cb_mutex); |
1766 | 1772 | ||
1767 | netlink_dump(sk); | 1773 | ret = netlink_dump(sk); |
1774 | |||
1768 | sock_put(sk); | 1775 | sock_put(sk); |
1769 | 1776 | ||
1777 | if (ret) | ||
1778 | return ret; | ||
1779 | |||
1770 | /* We successfully started a dump, by returning -EINTR we | 1780 | /* We successfully started a dump, by returning -EINTR we |
1771 | * signal not to send ACK even if it was requested. | 1781 | * signal not to send ACK even if it was requested. |
1772 | */ | 1782 | */ |
diff --git a/net/rds/ib_send.c b/net/rds/ib_send.c index 71f373c421bc..c47a511f203d 100644 --- a/net/rds/ib_send.c +++ b/net/rds/ib_send.c | |||
@@ -551,7 +551,10 @@ int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, | |||
551 | if (conn->c_loopback | 551 | if (conn->c_loopback |
552 | && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) { | 552 | && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) { |
553 | rds_cong_map_updated(conn->c_fcong, ~(u64) 0); | 553 | rds_cong_map_updated(conn->c_fcong, ~(u64) 0); |
554 | return sizeof(struct rds_header) + RDS_CONG_MAP_BYTES; | 554 | scat = &rm->data.op_sg[sg]; |
555 | ret = sizeof(struct rds_header) + RDS_CONG_MAP_BYTES; | ||
556 | ret = min_t(int, ret, scat->length - conn->c_xmit_data_off); | ||
557 | return ret; | ||
555 | } | 558 | } |
556 | 559 | ||
557 | /* FIXME we may overallocate here */ | 560 | /* FIXME we may overallocate here */ |
diff --git a/net/rds/loop.c b/net/rds/loop.c index aeec1d483b17..bca6761a3ca2 100644 --- a/net/rds/loop.c +++ b/net/rds/loop.c | |||
@@ -61,10 +61,15 @@ static int rds_loop_xmit(struct rds_connection *conn, struct rds_message *rm, | |||
61 | unsigned int hdr_off, unsigned int sg, | 61 | unsigned int hdr_off, unsigned int sg, |
62 | unsigned int off) | 62 | unsigned int off) |
63 | { | 63 | { |
64 | struct scatterlist *sgp = &rm->data.op_sg[sg]; | ||
65 | int ret = sizeof(struct rds_header) + | ||
66 | be32_to_cpu(rm->m_inc.i_hdr.h_len); | ||
67 | |||
64 | /* Do not send cong updates to loopback */ | 68 | /* Do not send cong updates to loopback */ |
65 | if (rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) { | 69 | if (rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) { |
66 | rds_cong_map_updated(conn->c_fcong, ~(u64) 0); | 70 | rds_cong_map_updated(conn->c_fcong, ~(u64) 0); |
67 | return sizeof(struct rds_header) + RDS_CONG_MAP_BYTES; | 71 | ret = min_t(int, ret, sgp->length - conn->c_xmit_data_off); |
72 | goto out; | ||
68 | } | 73 | } |
69 | 74 | ||
70 | BUG_ON(hdr_off || sg || off); | 75 | BUG_ON(hdr_off || sg || off); |
@@ -80,8 +85,8 @@ static int rds_loop_xmit(struct rds_connection *conn, struct rds_message *rm, | |||
80 | NULL); | 85 | NULL); |
81 | 86 | ||
82 | rds_inc_put(&rm->m_inc); | 87 | rds_inc_put(&rm->m_inc); |
83 | 88 | out: | |
84 | return sizeof(struct rds_header) + be32_to_cpu(rm->m_inc.i_hdr.h_len); | 89 | return ret; |
85 | } | 90 | } |
86 | 91 | ||
87 | /* | 92 | /* |
diff --git a/net/rxrpc/ar-input.c b/net/rxrpc/ar-input.c index 89315009bab1..1a2b0633fece 100644 --- a/net/rxrpc/ar-input.c +++ b/net/rxrpc/ar-input.c | |||
@@ -423,6 +423,7 @@ void rxrpc_fast_process_packet(struct rxrpc_call *call, struct sk_buff *skb) | |||
423 | goto protocol_error; | 423 | goto protocol_error; |
424 | } | 424 | } |
425 | 425 | ||
426 | case RXRPC_PACKET_TYPE_ACKALL: | ||
426 | case RXRPC_PACKET_TYPE_ACK: | 427 | case RXRPC_PACKET_TYPE_ACK: |
427 | /* ACK processing is done in process context */ | 428 | /* ACK processing is done in process context */ |
428 | read_lock_bh(&call->state_lock); | 429 | read_lock_bh(&call->state_lock); |
diff --git a/net/rxrpc/ar-key.c b/net/rxrpc/ar-key.c index 5ee16f0353fe..d763793d39de 100644 --- a/net/rxrpc/ar-key.c +++ b/net/rxrpc/ar-key.c | |||
@@ -89,11 +89,11 @@ static int rxrpc_instantiate_xdr_rxkad(struct key *key, const __be32 *xdr, | |||
89 | return ret; | 89 | return ret; |
90 | 90 | ||
91 | plen -= sizeof(*token); | 91 | plen -= sizeof(*token); |
92 | token = kmalloc(sizeof(*token), GFP_KERNEL); | 92 | token = kzalloc(sizeof(*token), GFP_KERNEL); |
93 | if (!token) | 93 | if (!token) |
94 | return -ENOMEM; | 94 | return -ENOMEM; |
95 | 95 | ||
96 | token->kad = kmalloc(plen, GFP_KERNEL); | 96 | token->kad = kzalloc(plen, GFP_KERNEL); |
97 | if (!token->kad) { | 97 | if (!token->kad) { |
98 | kfree(token); | 98 | kfree(token); |
99 | return -ENOMEM; | 99 | return -ENOMEM; |
@@ -731,10 +731,10 @@ static int rxrpc_instantiate(struct key *key, const void *data, size_t datalen) | |||
731 | goto error; | 731 | goto error; |
732 | 732 | ||
733 | ret = -ENOMEM; | 733 | ret = -ENOMEM; |
734 | token = kmalloc(sizeof(*token), GFP_KERNEL); | 734 | token = kzalloc(sizeof(*token), GFP_KERNEL); |
735 | if (!token) | 735 | if (!token) |
736 | goto error; | 736 | goto error; |
737 | token->kad = kmalloc(plen, GFP_KERNEL); | 737 | token->kad = kzalloc(plen, GFP_KERNEL); |
738 | if (!token->kad) | 738 | if (!token->kad) |
739 | goto error_free; | 739 | goto error_free; |
740 | 740 | ||
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 34dc598440a2..1bc698039ae2 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -839,6 +839,7 @@ void dev_deactivate(struct net_device *dev) | |||
839 | 839 | ||
840 | list_add(&dev->unreg_list, &single); | 840 | list_add(&dev->unreg_list, &single); |
841 | dev_deactivate_many(&single); | 841 | dev_deactivate_many(&single); |
842 | list_del(&single); | ||
842 | } | 843 | } |
843 | 844 | ||
844 | static void dev_init_scheduler_queue(struct net_device *dev, | 845 | static void dev_init_scheduler_queue(struct net_device *dev, |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 2cc46f0962ca..b23428f3c0dd 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -2029,11 +2029,11 @@ static sctp_ierror_t sctp_process_unk_param(const struct sctp_association *asoc, | |||
2029 | *errp = sctp_make_op_error_fixed(asoc, chunk); | 2029 | *errp = sctp_make_op_error_fixed(asoc, chunk); |
2030 | 2030 | ||
2031 | if (*errp) { | 2031 | if (*errp) { |
2032 | sctp_init_cause_fixed(*errp, SCTP_ERROR_UNKNOWN_PARAM, | 2032 | if (!sctp_init_cause_fixed(*errp, SCTP_ERROR_UNKNOWN_PARAM, |
2033 | WORD_ROUND(ntohs(param.p->length))); | 2033 | WORD_ROUND(ntohs(param.p->length)))) |
2034 | sctp_addto_chunk_fixed(*errp, | 2034 | sctp_addto_chunk_fixed(*errp, |
2035 | WORD_ROUND(ntohs(param.p->length)), | 2035 | WORD_ROUND(ntohs(param.p->length)), |
2036 | param.v); | 2036 | param.v); |
2037 | } else { | 2037 | } else { |
2038 | /* If there is no memory for generating the ERROR | 2038 | /* If there is no memory for generating the ERROR |
2039 | * report as specified, an ABORT will be triggered | 2039 | * report as specified, an ABORT will be triggered |
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 243fc09b164e..59e599498e37 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -252,23 +252,37 @@ static void rpc_set_active(struct rpc_task *task) | |||
252 | 252 | ||
253 | /* | 253 | /* |
254 | * Mark an RPC call as having completed by clearing the 'active' bit | 254 | * Mark an RPC call as having completed by clearing the 'active' bit |
255 | * and then waking up all tasks that were sleeping. | ||
255 | */ | 256 | */ |
256 | static void rpc_mark_complete_task(struct rpc_task *task) | 257 | static int rpc_complete_task(struct rpc_task *task) |
257 | { | 258 | { |
258 | smp_mb__before_clear_bit(); | 259 | void *m = &task->tk_runstate; |
260 | wait_queue_head_t *wq = bit_waitqueue(m, RPC_TASK_ACTIVE); | ||
261 | struct wait_bit_key k = __WAIT_BIT_KEY_INITIALIZER(m, RPC_TASK_ACTIVE); | ||
262 | unsigned long flags; | ||
263 | int ret; | ||
264 | |||
265 | spin_lock_irqsave(&wq->lock, flags); | ||
259 | clear_bit(RPC_TASK_ACTIVE, &task->tk_runstate); | 266 | clear_bit(RPC_TASK_ACTIVE, &task->tk_runstate); |
260 | smp_mb__after_clear_bit(); | 267 | ret = atomic_dec_and_test(&task->tk_count); |
261 | wake_up_bit(&task->tk_runstate, RPC_TASK_ACTIVE); | 268 | if (waitqueue_active(wq)) |
269 | __wake_up_locked_key(wq, TASK_NORMAL, &k); | ||
270 | spin_unlock_irqrestore(&wq->lock, flags); | ||
271 | return ret; | ||
262 | } | 272 | } |
263 | 273 | ||
264 | /* | 274 | /* |
265 | * Allow callers to wait for completion of an RPC call | 275 | * Allow callers to wait for completion of an RPC call |
276 | * | ||
277 | * Note the use of out_of_line_wait_on_bit() rather than wait_on_bit() | ||
278 | * to enforce taking of the wq->lock and hence avoid races with | ||
279 | * rpc_complete_task(). | ||
266 | */ | 280 | */ |
267 | int __rpc_wait_for_completion_task(struct rpc_task *task, int (*action)(void *)) | 281 | int __rpc_wait_for_completion_task(struct rpc_task *task, int (*action)(void *)) |
268 | { | 282 | { |
269 | if (action == NULL) | 283 | if (action == NULL) |
270 | action = rpc_wait_bit_killable; | 284 | action = rpc_wait_bit_killable; |
271 | return wait_on_bit(&task->tk_runstate, RPC_TASK_ACTIVE, | 285 | return out_of_line_wait_on_bit(&task->tk_runstate, RPC_TASK_ACTIVE, |
272 | action, TASK_KILLABLE); | 286 | action, TASK_KILLABLE); |
273 | } | 287 | } |
274 | EXPORT_SYMBOL_GPL(__rpc_wait_for_completion_task); | 288 | EXPORT_SYMBOL_GPL(__rpc_wait_for_completion_task); |
@@ -857,34 +871,67 @@ static void rpc_async_release(struct work_struct *work) | |||
857 | rpc_free_task(container_of(work, struct rpc_task, u.tk_work)); | 871 | rpc_free_task(container_of(work, struct rpc_task, u.tk_work)); |
858 | } | 872 | } |
859 | 873 | ||
860 | void rpc_put_task(struct rpc_task *task) | 874 | static void rpc_release_resources_task(struct rpc_task *task) |
861 | { | 875 | { |
862 | if (!atomic_dec_and_test(&task->tk_count)) | ||
863 | return; | ||
864 | /* Release resources */ | ||
865 | if (task->tk_rqstp) | 876 | if (task->tk_rqstp) |
866 | xprt_release(task); | 877 | xprt_release(task); |
867 | if (task->tk_msg.rpc_cred) | 878 | if (task->tk_msg.rpc_cred) |
868 | put_rpccred(task->tk_msg.rpc_cred); | 879 | put_rpccred(task->tk_msg.rpc_cred); |
869 | rpc_task_release_client(task); | 880 | rpc_task_release_client(task); |
870 | if (task->tk_workqueue != NULL) { | 881 | } |
882 | |||
883 | static void rpc_final_put_task(struct rpc_task *task, | ||
884 | struct workqueue_struct *q) | ||
885 | { | ||
886 | if (q != NULL) { | ||
871 | INIT_WORK(&task->u.tk_work, rpc_async_release); | 887 | INIT_WORK(&task->u.tk_work, rpc_async_release); |
872 | queue_work(task->tk_workqueue, &task->u.tk_work); | 888 | queue_work(q, &task->u.tk_work); |
873 | } else | 889 | } else |
874 | rpc_free_task(task); | 890 | rpc_free_task(task); |
875 | } | 891 | } |
892 | |||
893 | static void rpc_do_put_task(struct rpc_task *task, struct workqueue_struct *q) | ||
894 | { | ||
895 | if (atomic_dec_and_test(&task->tk_count)) { | ||
896 | rpc_release_resources_task(task); | ||
897 | rpc_final_put_task(task, q); | ||
898 | } | ||
899 | } | ||
900 | |||
901 | void rpc_put_task(struct rpc_task *task) | ||
902 | { | ||
903 | rpc_do_put_task(task, NULL); | ||
904 | } | ||
876 | EXPORT_SYMBOL_GPL(rpc_put_task); | 905 | EXPORT_SYMBOL_GPL(rpc_put_task); |
877 | 906 | ||
907 | void rpc_put_task_async(struct rpc_task *task) | ||
908 | { | ||
909 | rpc_do_put_task(task, task->tk_workqueue); | ||
910 | } | ||
911 | EXPORT_SYMBOL_GPL(rpc_put_task_async); | ||
912 | |||
878 | static void rpc_release_task(struct rpc_task *task) | 913 | static void rpc_release_task(struct rpc_task *task) |
879 | { | 914 | { |
880 | dprintk("RPC: %5u release task\n", task->tk_pid); | 915 | dprintk("RPC: %5u release task\n", task->tk_pid); |
881 | 916 | ||
882 | BUG_ON (RPC_IS_QUEUED(task)); | 917 | BUG_ON (RPC_IS_QUEUED(task)); |
883 | 918 | ||
884 | /* Wake up anyone who is waiting for task completion */ | 919 | rpc_release_resources_task(task); |
885 | rpc_mark_complete_task(task); | ||
886 | 920 | ||
887 | rpc_put_task(task); | 921 | /* |
922 | * Note: at this point we have been removed from rpc_clnt->cl_tasks, | ||
923 | * so it should be safe to use task->tk_count as a test for whether | ||
924 | * or not any other processes still hold references to our rpc_task. | ||
925 | */ | ||
926 | if (atomic_read(&task->tk_count) != 1 + !RPC_IS_ASYNC(task)) { | ||
927 | /* Wake up anyone who may be waiting for task completion */ | ||
928 | if (!rpc_complete_task(task)) | ||
929 | return; | ||
930 | } else { | ||
931 | if (!atomic_dec_and_test(&task->tk_count)) | ||
932 | return; | ||
933 | } | ||
934 | rpc_final_put_task(task, task->tk_workqueue); | ||
888 | } | 935 | } |
889 | 936 | ||
890 | int rpciod_up(void) | 937 | int rpciod_up(void) |
diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c index 9df1eadc912a..1a10dcd999ea 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_transport.c +++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c | |||
@@ -1335,6 +1335,7 @@ void svc_rdma_send_error(struct svcxprt_rdma *xprt, struct rpcrdma_msg *rmsgp, | |||
1335 | p, 0, length, DMA_FROM_DEVICE); | 1335 | p, 0, length, DMA_FROM_DEVICE); |
1336 | if (ib_dma_mapping_error(xprt->sc_cm_id->device, ctxt->sge[0].addr)) { | 1336 | if (ib_dma_mapping_error(xprt->sc_cm_id->device, ctxt->sge[0].addr)) { |
1337 | put_page(p); | 1337 | put_page(p); |
1338 | svc_rdma_put_context(ctxt, 1); | ||
1338 | return; | 1339 | return; |
1339 | } | 1340 | } |
1340 | atomic_inc(&xprt->sc_dma_used); | 1341 | atomic_inc(&xprt->sc_dma_used); |
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index c431f5a57960..be96d429b475 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c | |||
@@ -1631,7 +1631,8 @@ static struct socket *xs_create_sock(struct rpc_xprt *xprt, | |||
1631 | } | 1631 | } |
1632 | xs_reclassify_socket(family, sock); | 1632 | xs_reclassify_socket(family, sock); |
1633 | 1633 | ||
1634 | if (xs_bind(transport, sock)) { | 1634 | err = xs_bind(transport, sock); |
1635 | if (err) { | ||
1635 | sock_release(sock); | 1636 | sock_release(sock); |
1636 | goto out; | 1637 | goto out; |
1637 | } | 1638 | } |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index dd419d286204..ba5b8c208498 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -850,7 +850,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
850 | * Get the parent directory, calculate the hash for last | 850 | * Get the parent directory, calculate the hash for last |
851 | * component. | 851 | * component. |
852 | */ | 852 | */ |
853 | err = path_lookup(sunaddr->sun_path, LOOKUP_PARENT, &nd); | 853 | err = kern_path_parent(sunaddr->sun_path, &nd); |
854 | if (err) | 854 | if (err) |
855 | goto out_mknod_parent; | 855 | goto out_mknod_parent; |
856 | 856 | ||
@@ -1724,7 +1724,11 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1724 | 1724 | ||
1725 | msg->msg_namelen = 0; | 1725 | msg->msg_namelen = 0; |
1726 | 1726 | ||
1727 | mutex_lock(&u->readlock); | 1727 | err = mutex_lock_interruptible(&u->readlock); |
1728 | if (err) { | ||
1729 | err = sock_intr_errno(sock_rcvtimeo(sk, noblock)); | ||
1730 | goto out; | ||
1731 | } | ||
1728 | 1732 | ||
1729 | skb = skb_recv_datagram(sk, flags, noblock, &err); | 1733 | skb = skb_recv_datagram(sk, flags, noblock, &err); |
1730 | if (!skb) { | 1734 | if (!skb) { |
@@ -1864,7 +1868,11 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1864 | memset(&tmp_scm, 0, sizeof(tmp_scm)); | 1868 | memset(&tmp_scm, 0, sizeof(tmp_scm)); |
1865 | } | 1869 | } |
1866 | 1870 | ||
1867 | mutex_lock(&u->readlock); | 1871 | err = mutex_lock_interruptible(&u->readlock); |
1872 | if (err) { | ||
1873 | err = sock_intr_errno(timeo); | ||
1874 | goto out; | ||
1875 | } | ||
1868 | 1876 | ||
1869 | do { | 1877 | do { |
1870 | int chunk; | 1878 | int chunk; |
@@ -1895,11 +1903,12 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1895 | 1903 | ||
1896 | timeo = unix_stream_data_wait(sk, timeo); | 1904 | timeo = unix_stream_data_wait(sk, timeo); |
1897 | 1905 | ||
1898 | if (signal_pending(current)) { | 1906 | if (signal_pending(current) |
1907 | || mutex_lock_interruptible(&u->readlock)) { | ||
1899 | err = sock_intr_errno(timeo); | 1908 | err = sock_intr_errno(timeo); |
1900 | goto out; | 1909 | goto out; |
1901 | } | 1910 | } |
1902 | mutex_lock(&u->readlock); | 1911 | |
1903 | continue; | 1912 | continue; |
1904 | unlock: | 1913 | unlock: |
1905 | unix_state_unlock(sk); | 1914 | unix_state_unlock(sk); |
diff --git a/net/unix/garbage.c b/net/unix/garbage.c index f89f83bf828e..b6f4b994eb35 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c | |||
@@ -104,7 +104,7 @@ struct sock *unix_get_socket(struct file *filp) | |||
104 | /* | 104 | /* |
105 | * Socket ? | 105 | * Socket ? |
106 | */ | 106 | */ |
107 | if (S_ISSOCK(inode->i_mode)) { | 107 | if (S_ISSOCK(inode->i_mode) && !(filp->f_mode & FMODE_PATH)) { |
108 | struct socket *sock = SOCKET_I(inode); | 108 | struct socket *sock = SOCKET_I(inode); |
109 | struct sock *s = sock->sk; | 109 | struct sock *s = sock->sk; |
110 | 110 | ||
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c index 3e5dbd4e4cd5..d112f038edf0 100644 --- a/net/wireless/wext-compat.c +++ b/net/wireless/wext-compat.c | |||
@@ -802,11 +802,11 @@ int cfg80211_wext_siwfreq(struct net_device *dev, | |||
802 | return freq; | 802 | return freq; |
803 | if (freq == 0) | 803 | if (freq == 0) |
804 | return -EINVAL; | 804 | return -EINVAL; |
805 | wdev_lock(wdev); | ||
806 | mutex_lock(&rdev->devlist_mtx); | 805 | mutex_lock(&rdev->devlist_mtx); |
806 | wdev_lock(wdev); | ||
807 | err = cfg80211_set_freq(rdev, wdev, freq, NL80211_CHAN_NO_HT); | 807 | err = cfg80211_set_freq(rdev, wdev, freq, NL80211_CHAN_NO_HT); |
808 | mutex_unlock(&rdev->devlist_mtx); | ||
809 | wdev_unlock(wdev); | 808 | wdev_unlock(wdev); |
809 | mutex_unlock(&rdev->devlist_mtx); | ||
810 | return err; | 810 | return err; |
811 | default: | 811 | default: |
812 | return -EOPNOTSUPP; | 812 | return -EOPNOTSUPP; |
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index c9a16abacab4..291228e25984 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c | |||
@@ -309,12 +309,18 @@ static void do_config_file(const char *filename) | |||
309 | close(fd); | 309 | close(fd); |
310 | } | 310 | } |
311 | 311 | ||
312 | /* | ||
313 | * Important: The below generated source_foo.o and deps_foo.o variable | ||
314 | * assignments are parsed not only by make, but also by the rather simple | ||
315 | * parser in scripts/mod/sumversion.c. | ||
316 | */ | ||
312 | static void parse_dep_file(void *map, size_t len) | 317 | static void parse_dep_file(void *map, size_t len) |
313 | { | 318 | { |
314 | char *m = map; | 319 | char *m = map; |
315 | char *end = m + len; | 320 | char *end = m + len; |
316 | char *p; | 321 | char *p; |
317 | char s[PATH_MAX]; | 322 | char s[PATH_MAX]; |
323 | int first; | ||
318 | 324 | ||
319 | p = strchr(m, ':'); | 325 | p = strchr(m, ':'); |
320 | if (!p) { | 326 | if (!p) { |
@@ -322,11 +328,11 @@ static void parse_dep_file(void *map, size_t len) | |||
322 | exit(1); | 328 | exit(1); |
323 | } | 329 | } |
324 | memcpy(s, m, p-m); s[p-m] = 0; | 330 | memcpy(s, m, p-m); s[p-m] = 0; |
325 | printf("deps_%s := \\\n", target); | ||
326 | m = p+1; | 331 | m = p+1; |
327 | 332 | ||
328 | clear_config(); | 333 | clear_config(); |
329 | 334 | ||
335 | first = 1; | ||
330 | while (m < end) { | 336 | while (m < end) { |
331 | while (m < end && (*m == ' ' || *m == '\\' || *m == '\n')) | 337 | while (m < end && (*m == ' ' || *m == '\\' || *m == '\n')) |
332 | m++; | 338 | m++; |
@@ -340,9 +346,20 @@ static void parse_dep_file(void *map, size_t len) | |||
340 | if (strrcmp(s, "include/generated/autoconf.h") && | 346 | if (strrcmp(s, "include/generated/autoconf.h") && |
341 | strrcmp(s, "arch/um/include/uml-config.h") && | 347 | strrcmp(s, "arch/um/include/uml-config.h") && |
342 | strrcmp(s, ".ver")) { | 348 | strrcmp(s, ".ver")) { |
343 | printf(" %s \\\n", s); | 349 | /* |
350 | * Do not list the source file as dependency, so that | ||
351 | * kbuild is not confused if a .c file is rewritten | ||
352 | * into .S or vice versa. Storing it in source_* is | ||
353 | * needed for modpost to compute srcversions. | ||
354 | */ | ||
355 | if (first) { | ||
356 | printf("source_%s := %s\n\n", target, s); | ||
357 | printf("deps_%s := \\\n", target); | ||
358 | } else | ||
359 | printf(" %s \\\n", s); | ||
344 | do_config_file(s); | 360 | do_config_file(s); |
345 | } | 361 | } |
362 | first = 0; | ||
346 | m = p + 1; | 363 | m = p + 1; |
347 | } | 364 | } |
348 | printf("\n%s: $(deps_%s)\n\n", target, target); | 365 | printf("\n%s: $(deps_%s)\n\n", target, target); |
diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index ecf9c7dc1825..9dfcd6d988da 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c | |||
@@ -300,8 +300,8 @@ static int is_static_library(const char *objfile) | |||
300 | return 0; | 300 | return 0; |
301 | } | 301 | } |
302 | 302 | ||
303 | /* We have dir/file.o. Open dir/.file.o.cmd, look for deps_ line to | 303 | /* We have dir/file.o. Open dir/.file.o.cmd, look for source_ and deps_ line |
304 | * figure out source file. */ | 304 | * to figure out source files. */ |
305 | static int parse_source_files(const char *objfile, struct md4_ctx *md) | 305 | static int parse_source_files(const char *objfile, struct md4_ctx *md) |
306 | { | 306 | { |
307 | char *cmd, *file, *line, *dir; | 307 | char *cmd, *file, *line, *dir; |
@@ -340,6 +340,21 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md) | |||
340 | */ | 340 | */ |
341 | while ((line = get_next_line(&pos, file, flen)) != NULL) { | 341 | while ((line = get_next_line(&pos, file, flen)) != NULL) { |
342 | char* p = line; | 342 | char* p = line; |
343 | |||
344 | if (strncmp(line, "source_", sizeof("source_")-1) == 0) { | ||
345 | p = strrchr(line, ' '); | ||
346 | if (!p) { | ||
347 | warn("malformed line: %s\n", line); | ||
348 | goto out_file; | ||
349 | } | ||
350 | p++; | ||
351 | if (!parse_file(p, md)) { | ||
352 | warn("could not open %s: %s\n", | ||
353 | p, strerror(errno)); | ||
354 | goto out_file; | ||
355 | } | ||
356 | continue; | ||
357 | } | ||
343 | if (strncmp(line, "deps_", sizeof("deps_")-1) == 0) { | 358 | if (strncmp(line, "deps_", sizeof("deps_")-1) == 0) { |
344 | check_files = 1; | 359 | check_files = 1; |
345 | continue; | 360 | continue; |
diff --git a/sound/core/jack.c b/sound/core/jack.c index 4902ae568730..53b53e97c896 100644 --- a/sound/core/jack.c +++ b/sound/core/jack.c | |||
@@ -141,6 +141,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type, | |||
141 | 141 | ||
142 | fail_input: | 142 | fail_input: |
143 | input_free_device(jack->input_dev); | 143 | input_free_device(jack->input_dev); |
144 | kfree(jack->id); | ||
144 | kfree(jack); | 145 | kfree(jack); |
145 | return err; | 146 | return err; |
146 | } | 147 | } |
diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c index 23f49f356e0f..16c0bdfbb164 100644 --- a/sound/pci/au88x0/au88x0_core.c +++ b/sound/pci/au88x0/au88x0_core.c | |||
@@ -1252,11 +1252,19 @@ static void vortex_adbdma_resetup(vortex_t *vortex, int adbdma) { | |||
1252 | static int inline vortex_adbdma_getlinearpos(vortex_t * vortex, int adbdma) | 1252 | static int inline vortex_adbdma_getlinearpos(vortex_t * vortex, int adbdma) |
1253 | { | 1253 | { |
1254 | stream_t *dma = &vortex->dma_adb[adbdma]; | 1254 | stream_t *dma = &vortex->dma_adb[adbdma]; |
1255 | int temp; | 1255 | int temp, page, delta; |
1256 | 1256 | ||
1257 | temp = hwread(vortex->mmio, VORTEX_ADBDMA_STAT + (adbdma << 2)); | 1257 | temp = hwread(vortex->mmio, VORTEX_ADBDMA_STAT + (adbdma << 2)); |
1258 | temp = (dma->period_virt * dma->period_bytes) + (temp & (dma->period_bytes - 1)); | 1258 | page = (temp & ADB_SUBBUF_MASK) >> ADB_SUBBUF_SHIFT; |
1259 | return temp; | 1259 | if (dma->nr_periods >= 4) |
1260 | delta = (page - dma->period_real) & 3; | ||
1261 | else { | ||
1262 | delta = (page - dma->period_real); | ||
1263 | if (delta < 0) | ||
1264 | delta += dma->nr_periods; | ||
1265 | } | ||
1266 | return (dma->period_virt + delta) * dma->period_bytes | ||
1267 | + (temp & (dma->period_bytes - 1)); | ||
1260 | } | 1268 | } |
1261 | 1269 | ||
1262 | static void vortex_adbdma_startfifo(vortex_t * vortex, int adbdma) | 1270 | static void vortex_adbdma_startfifo(vortex_t * vortex, int adbdma) |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 0baffcdee8f9..fcedad9a5fef 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -2308,6 +2308,7 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = { | |||
2308 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), | 2308 | SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), |
2309 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), | 2309 | SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), |
2310 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), | 2310 | SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), |
2311 | SND_PCI_QUIRK(0x1043, 0x8410, "ASUS", POS_FIX_LPIB), | ||
2311 | SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), | 2312 | SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), |
2312 | SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), | 2313 | SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), |
2313 | SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba A100-259", POS_FIX_LPIB), | 2314 | SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba A100-259", POS_FIX_LPIB), |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index a07b031090d8..067982f4f182 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -1039,9 +1039,11 @@ static struct hda_verb cs_errata_init_verbs[] = { | |||
1039 | {0x11, AC_VERB_SET_PROC_COEF, 0x0008}, | 1039 | {0x11, AC_VERB_SET_PROC_COEF, 0x0008}, |
1040 | {0x11, AC_VERB_SET_PROC_STATE, 0x00}, | 1040 | {0x11, AC_VERB_SET_PROC_STATE, 0x00}, |
1041 | 1041 | ||
1042 | #if 0 /* Don't to set to D3 as we are in power-up sequence */ | ||
1042 | {0x07, AC_VERB_SET_POWER_STATE, 0x03}, /* S/PDIF Rx: D3 */ | 1043 | {0x07, AC_VERB_SET_POWER_STATE, 0x03}, /* S/PDIF Rx: D3 */ |
1043 | {0x08, AC_VERB_SET_POWER_STATE, 0x03}, /* S/PDIF Tx: D3 */ | 1044 | {0x08, AC_VERB_SET_POWER_STATE, 0x03}, /* S/PDIF Tx: D3 */ |
1044 | /*{0x01, AC_VERB_SET_POWER_STATE, 0x03},*/ /* AFG: D3 This is already handled */ | 1045 | /*{0x01, AC_VERB_SET_POWER_STATE, 0x03},*/ /* AFG: D3 This is already handled */ |
1046 | #endif | ||
1045 | 1047 | ||
1046 | {} /* terminator */ | 1048 | {} /* terminator */ |
1047 | }; | 1049 | }; |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index fbe97d32140d..4d5004e693f0 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -3114,6 +3114,8 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { | |||
3114 | SND_PCI_QUIRK(0x1028, 0x0401, "Dell Vostro 1014", CXT5066_DELL_VOSTRO), | 3114 | SND_PCI_QUIRK(0x1028, 0x0401, "Dell Vostro 1014", CXT5066_DELL_VOSTRO), |
3115 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), | 3115 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTRO), |
3116 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), | 3116 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), |
3117 | SND_PCI_QUIRK(0x1028, 0x050f, "Dell Inspiron", CXT5066_IDEAPAD), | ||
3118 | SND_PCI_QUIRK(0x1028, 0x0510, "Dell Vostro", CXT5066_IDEAPAD), | ||
3117 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), | 3119 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), |
3118 | SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS), | 3120 | SND_PCI_QUIRK(0x1043, 0x13f3, "Asus A52J", CXT5066_ASUS), |
3119 | SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS), | 3121 | SND_PCI_QUIRK(0x1043, 0x1643, "Asus K52JU", CXT5066_ASUS), |
@@ -3410,7 +3412,7 @@ static void cx_auto_parse_output(struct hda_codec *codec) | |||
3410 | } | 3412 | } |
3411 | } | 3413 | } |
3412 | spec->multiout.dac_nids = spec->private_dac_nids; | 3414 | spec->multiout.dac_nids = spec->private_dac_nids; |
3413 | spec->multiout.max_channels = nums * 2; | 3415 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
3414 | 3416 | ||
3415 | if (cfg->hp_outs > 0) | 3417 | if (cfg->hp_outs > 0) |
3416 | spec->auto_mute = 1; | 3418 | spec->auto_mute = 1; |
@@ -3729,9 +3731,9 @@ static int cx_auto_init(struct hda_codec *codec) | |||
3729 | return 0; | 3731 | return 0; |
3730 | } | 3732 | } |
3731 | 3733 | ||
3732 | static int cx_auto_add_volume(struct hda_codec *codec, const char *basename, | 3734 | static int cx_auto_add_volume_idx(struct hda_codec *codec, const char *basename, |
3733 | const char *dir, int cidx, | 3735 | const char *dir, int cidx, |
3734 | hda_nid_t nid, int hda_dir) | 3736 | hda_nid_t nid, int hda_dir, int amp_idx) |
3735 | { | 3737 | { |
3736 | static char name[32]; | 3738 | static char name[32]; |
3737 | static struct snd_kcontrol_new knew[] = { | 3739 | static struct snd_kcontrol_new knew[] = { |
@@ -3743,7 +3745,8 @@ static int cx_auto_add_volume(struct hda_codec *codec, const char *basename, | |||
3743 | 3745 | ||
3744 | for (i = 0; i < 2; i++) { | 3746 | for (i = 0; i < 2; i++) { |
3745 | struct snd_kcontrol *kctl; | 3747 | struct snd_kcontrol *kctl; |
3746 | knew[i].private_value = HDA_COMPOSE_AMP_VAL(nid, 3, 0, hda_dir); | 3748 | knew[i].private_value = HDA_COMPOSE_AMP_VAL(nid, 3, amp_idx, |
3749 | hda_dir); | ||
3747 | knew[i].subdevice = HDA_SUBDEV_AMP_FLAG; | 3750 | knew[i].subdevice = HDA_SUBDEV_AMP_FLAG; |
3748 | knew[i].index = cidx; | 3751 | knew[i].index = cidx; |
3749 | snprintf(name, sizeof(name), "%s%s %s", basename, dir, sfx[i]); | 3752 | snprintf(name, sizeof(name), "%s%s %s", basename, dir, sfx[i]); |
@@ -3759,6 +3762,9 @@ static int cx_auto_add_volume(struct hda_codec *codec, const char *basename, | |||
3759 | return 0; | 3762 | return 0; |
3760 | } | 3763 | } |
3761 | 3764 | ||
3765 | #define cx_auto_add_volume(codec, str, dir, cidx, nid, hda_dir) \ | ||
3766 | cx_auto_add_volume_idx(codec, str, dir, cidx, nid, hda_dir, 0) | ||
3767 | |||
3762 | #define cx_auto_add_pb_volume(codec, nid, str, idx) \ | 3768 | #define cx_auto_add_pb_volume(codec, nid, str, idx) \ |
3763 | cx_auto_add_volume(codec, str, " Playback", idx, nid, HDA_OUTPUT) | 3769 | cx_auto_add_volume(codec, str, " Playback", idx, nid, HDA_OUTPUT) |
3764 | 3770 | ||
@@ -3808,29 +3814,60 @@ static int cx_auto_build_input_controls(struct hda_codec *codec) | |||
3808 | struct conexant_spec *spec = codec->spec; | 3814 | struct conexant_spec *spec = codec->spec; |
3809 | struct auto_pin_cfg *cfg = &spec->autocfg; | 3815 | struct auto_pin_cfg *cfg = &spec->autocfg; |
3810 | static const char *prev_label; | 3816 | static const char *prev_label; |
3811 | int i, err, cidx; | 3817 | int i, err, cidx, conn_len; |
3818 | hda_nid_t conn[HDA_MAX_CONNECTIONS]; | ||
3819 | |||
3820 | int multi_adc_volume = 0; /* If the ADC nid has several input volumes */ | ||
3821 | int adc_nid = spec->adc_nids[0]; | ||
3822 | |||
3823 | conn_len = snd_hda_get_connections(codec, adc_nid, conn, | ||
3824 | HDA_MAX_CONNECTIONS); | ||
3825 | if (conn_len < 0) | ||
3826 | return conn_len; | ||
3827 | |||
3828 | multi_adc_volume = cfg->num_inputs > 1 && conn_len > 1; | ||
3829 | if (!multi_adc_volume) { | ||
3830 | err = cx_auto_add_volume(codec, "Capture", "", 0, adc_nid, | ||
3831 | HDA_INPUT); | ||
3832 | if (err < 0) | ||
3833 | return err; | ||
3834 | } | ||
3812 | 3835 | ||
3813 | err = cx_auto_add_volume(codec, "Capture", "", 0, spec->adc_nids[0], | ||
3814 | HDA_INPUT); | ||
3815 | if (err < 0) | ||
3816 | return err; | ||
3817 | prev_label = NULL; | 3836 | prev_label = NULL; |
3818 | cidx = 0; | 3837 | cidx = 0; |
3819 | for (i = 0; i < cfg->num_inputs; i++) { | 3838 | for (i = 0; i < cfg->num_inputs; i++) { |
3820 | hda_nid_t nid = cfg->inputs[i].pin; | 3839 | hda_nid_t nid = cfg->inputs[i].pin; |
3821 | const char *label; | 3840 | const char *label; |
3822 | if (!(get_wcaps(codec, nid) & AC_WCAP_IN_AMP)) | 3841 | int j; |
3842 | int pin_amp = get_wcaps(codec, nid) & AC_WCAP_IN_AMP; | ||
3843 | if (!pin_amp && !multi_adc_volume) | ||
3823 | continue; | 3844 | continue; |
3845 | |||
3824 | label = hda_get_autocfg_input_label(codec, cfg, i); | 3846 | label = hda_get_autocfg_input_label(codec, cfg, i); |
3825 | if (label == prev_label) | 3847 | if (label == prev_label) |
3826 | cidx++; | 3848 | cidx++; |
3827 | else | 3849 | else |
3828 | cidx = 0; | 3850 | cidx = 0; |
3829 | prev_label = label; | 3851 | prev_label = label; |
3830 | err = cx_auto_add_volume(codec, label, " Capture", cidx, | 3852 | |
3831 | nid, HDA_INPUT); | 3853 | if (pin_amp) { |
3832 | if (err < 0) | 3854 | err = cx_auto_add_volume(codec, label, " Boost", cidx, |
3833 | return err; | 3855 | nid, HDA_INPUT); |
3856 | if (err < 0) | ||
3857 | return err; | ||
3858 | } | ||
3859 | |||
3860 | if (!multi_adc_volume) | ||
3861 | continue; | ||
3862 | for (j = 0; j < conn_len; j++) { | ||
3863 | if (conn[j] == nid) { | ||
3864 | err = cx_auto_add_volume_idx(codec, label, | ||
3865 | " Capture", cidx, adc_nid, HDA_INPUT, j); | ||
3866 | if (err < 0) | ||
3867 | return err; | ||
3868 | break; | ||
3869 | } | ||
3870 | } | ||
3834 | } | 3871 | } |
3835 | return 0; | 3872 | return 0; |
3836 | } | 3873 | } |
@@ -3902,6 +3939,8 @@ static struct hda_codec_preset snd_hda_preset_conexant[] = { | |||
3902 | .patch = patch_cxt5066 }, | 3939 | .patch = patch_cxt5066 }, |
3903 | { .id = 0x14f15069, .name = "CX20585", | 3940 | { .id = 0x14f15069, .name = "CX20585", |
3904 | .patch = patch_cxt5066 }, | 3941 | .patch = patch_cxt5066 }, |
3942 | { .id = 0x14f1506e, .name = "CX20590", | ||
3943 | .patch = patch_cxt5066 }, | ||
3905 | { .id = 0x14f15097, .name = "CX20631", | 3944 | { .id = 0x14f15097, .name = "CX20631", |
3906 | .patch = patch_conexant_auto }, | 3945 | .patch = patch_conexant_auto }, |
3907 | { .id = 0x14f15098, .name = "CX20632", | 3946 | { .id = 0x14f15098, .name = "CX20632", |
@@ -3928,6 +3967,7 @@ MODULE_ALIAS("snd-hda-codec-id:14f15066"); | |||
3928 | MODULE_ALIAS("snd-hda-codec-id:14f15067"); | 3967 | MODULE_ALIAS("snd-hda-codec-id:14f15067"); |
3929 | MODULE_ALIAS("snd-hda-codec-id:14f15068"); | 3968 | MODULE_ALIAS("snd-hda-codec-id:14f15068"); |
3930 | MODULE_ALIAS("snd-hda-codec-id:14f15069"); | 3969 | MODULE_ALIAS("snd-hda-codec-id:14f15069"); |
3970 | MODULE_ALIAS("snd-hda-codec-id:14f1506e"); | ||
3931 | MODULE_ALIAS("snd-hda-codec-id:14f15097"); | 3971 | MODULE_ALIAS("snd-hda-codec-id:14f15097"); |
3932 | MODULE_ALIAS("snd-hda-codec-id:14f15098"); | 3972 | MODULE_ALIAS("snd-hda-codec-id:14f15098"); |
3933 | MODULE_ALIAS("snd-hda-codec-id:14f150a1"); | 3973 | MODULE_ALIAS("snd-hda-codec-id:14f150a1"); |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index a58767736727..ec0fa2dd0a27 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -1634,6 +1634,9 @@ static struct hda_codec_preset snd_hda_preset_hdmi[] = { | |||
1634 | { .id = 0x10de0012, .name = "GPU 12 HDMI/DP", .patch = patch_nvhdmi_8ch_89 }, | 1634 | { .id = 0x10de0012, .name = "GPU 12 HDMI/DP", .patch = patch_nvhdmi_8ch_89 }, |
1635 | { .id = 0x10de0013, .name = "GPU 13 HDMI/DP", .patch = patch_nvhdmi_8ch_89 }, | 1635 | { .id = 0x10de0013, .name = "GPU 13 HDMI/DP", .patch = patch_nvhdmi_8ch_89 }, |
1636 | { .id = 0x10de0014, .name = "GPU 14 HDMI/DP", .patch = patch_nvhdmi_8ch_89 }, | 1636 | { .id = 0x10de0014, .name = "GPU 14 HDMI/DP", .patch = patch_nvhdmi_8ch_89 }, |
1637 | { .id = 0x10de0015, .name = "GPU 15 HDMI/DP", .patch = patch_nvhdmi_8ch_89 }, | ||
1638 | { .id = 0x10de0016, .name = "GPU 16 HDMI/DP", .patch = patch_nvhdmi_8ch_89 }, | ||
1639 | /* 17 is known to be absent */ | ||
1637 | { .id = 0x10de0018, .name = "GPU 18 HDMI/DP", .patch = patch_nvhdmi_8ch_89 }, | 1640 | { .id = 0x10de0018, .name = "GPU 18 HDMI/DP", .patch = patch_nvhdmi_8ch_89 }, |
1638 | { .id = 0x10de0019, .name = "GPU 19 HDMI/DP", .patch = patch_nvhdmi_8ch_89 }, | 1641 | { .id = 0x10de0019, .name = "GPU 19 HDMI/DP", .patch = patch_nvhdmi_8ch_89 }, |
1639 | { .id = 0x10de001a, .name = "GPU 1a HDMI/DP", .patch = patch_nvhdmi_8ch_89 }, | 1642 | { .id = 0x10de001a, .name = "GPU 1a HDMI/DP", .patch = patch_nvhdmi_8ch_89 }, |
@@ -1676,6 +1679,8 @@ MODULE_ALIAS("snd-hda-codec-id:10de0011"); | |||
1676 | MODULE_ALIAS("snd-hda-codec-id:10de0012"); | 1679 | MODULE_ALIAS("snd-hda-codec-id:10de0012"); |
1677 | MODULE_ALIAS("snd-hda-codec-id:10de0013"); | 1680 | MODULE_ALIAS("snd-hda-codec-id:10de0013"); |
1678 | MODULE_ALIAS("snd-hda-codec-id:10de0014"); | 1681 | MODULE_ALIAS("snd-hda-codec-id:10de0014"); |
1682 | MODULE_ALIAS("snd-hda-codec-id:10de0015"); | ||
1683 | MODULE_ALIAS("snd-hda-codec-id:10de0016"); | ||
1679 | MODULE_ALIAS("snd-hda-codec-id:10de0018"); | 1684 | MODULE_ALIAS("snd-hda-codec-id:10de0018"); |
1680 | MODULE_ALIAS("snd-hda-codec-id:10de0019"); | 1685 | MODULE_ALIAS("snd-hda-codec-id:10de0019"); |
1681 | MODULE_ALIAS("snd-hda-codec-id:10de001a"); | 1686 | MODULE_ALIAS("snd-hda-codec-id:10de001a"); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 3328a259a242..4261bb8eec1d 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -1133,11 +1133,8 @@ static void alc_automute_speaker(struct hda_codec *codec, int pinctl) | |||
1133 | nid = spec->autocfg.hp_pins[i]; | 1133 | nid = spec->autocfg.hp_pins[i]; |
1134 | if (!nid) | 1134 | if (!nid) |
1135 | break; | 1135 | break; |
1136 | if (snd_hda_jack_detect(codec, nid)) { | 1136 | alc_report_jack(codec, nid); |
1137 | spec->jack_present = 1; | 1137 | spec->jack_present |= snd_hda_jack_detect(codec, nid); |
1138 | break; | ||
1139 | } | ||
1140 | alc_report_jack(codec, spec->autocfg.hp_pins[i]); | ||
1141 | } | 1138 | } |
1142 | 1139 | ||
1143 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; | 1140 | mute = spec->jack_present ? HDA_AMP_MUTE : 0; |
@@ -15015,7 +15012,7 @@ static struct snd_pci_quirk alc269_cfg_tbl[] = { | |||
15015 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), | 15012 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), |
15016 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), | 15013 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), |
15017 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), | 15014 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), |
15018 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), | 15015 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269VB_AMIC), |
15019 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), | 15016 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), |
15020 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), | 15017 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), |
15021 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), | 15018 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 9ea48b425d0b..bd7b123f6440 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -586,7 +586,12 @@ static hda_nid_t stac92hd83xxx_pin_nids[10] = { | |||
586 | 0x0f, 0x10, 0x11, 0x1f, 0x20, | 586 | 0x0f, 0x10, 0x11, 0x1f, 0x20, |
587 | }; | 587 | }; |
588 | 588 | ||
589 | static hda_nid_t stac92hd88xxx_pin_nids[10] = { | 589 | static hda_nid_t stac92hd87xxx_pin_nids[6] = { |
590 | 0x0a, 0x0b, 0x0c, 0x0d, | ||
591 | 0x0f, 0x11, | ||
592 | }; | ||
593 | |||
594 | static hda_nid_t stac92hd88xxx_pin_nids[8] = { | ||
590 | 0x0a, 0x0b, 0x0c, 0x0d, | 595 | 0x0a, 0x0b, 0x0c, 0x0d, |
591 | 0x0f, 0x11, 0x1f, 0x20, | 596 | 0x0f, 0x11, 0x1f, 0x20, |
592 | }; | 597 | }; |
@@ -5430,12 +5435,13 @@ again: | |||
5430 | switch (codec->vendor_id) { | 5435 | switch (codec->vendor_id) { |
5431 | case 0x111d76d1: | 5436 | case 0x111d76d1: |
5432 | case 0x111d76d9: | 5437 | case 0x111d76d9: |
5438 | case 0x111d76e5: | ||
5433 | spec->dmic_nids = stac92hd87b_dmic_nids; | 5439 | spec->dmic_nids = stac92hd87b_dmic_nids; |
5434 | spec->num_dmics = stac92xx_connected_ports(codec, | 5440 | spec->num_dmics = stac92xx_connected_ports(codec, |
5435 | stac92hd87b_dmic_nids, | 5441 | stac92hd87b_dmic_nids, |
5436 | STAC92HD87B_NUM_DMICS); | 5442 | STAC92HD87B_NUM_DMICS); |
5437 | spec->num_pins = ARRAY_SIZE(stac92hd88xxx_pin_nids); | 5443 | spec->num_pins = ARRAY_SIZE(stac92hd87xxx_pin_nids); |
5438 | spec->pin_nids = stac92hd88xxx_pin_nids; | 5444 | spec->pin_nids = stac92hd87xxx_pin_nids; |
5439 | spec->mono_nid = 0; | 5445 | spec->mono_nid = 0; |
5440 | spec->num_pwrs = 0; | 5446 | spec->num_pwrs = 0; |
5441 | break; | 5447 | break; |
@@ -5443,6 +5449,7 @@ again: | |||
5443 | case 0x111d7667: | 5449 | case 0x111d7667: |
5444 | case 0x111d7668: | 5450 | case 0x111d7668: |
5445 | case 0x111d7669: | 5451 | case 0x111d7669: |
5452 | case 0x111d76e3: | ||
5446 | spec->num_dmics = stac92xx_connected_ports(codec, | 5453 | spec->num_dmics = stac92xx_connected_ports(codec, |
5447 | stac92hd88xxx_dmic_nids, | 5454 | stac92hd88xxx_dmic_nids, |
5448 | STAC92HD88XXX_NUM_DMICS); | 5455 | STAC92HD88XXX_NUM_DMICS); |
@@ -6387,6 +6394,8 @@ static struct hda_codec_preset snd_hda_preset_sigmatel[] = { | |||
6387 | { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx }, | 6394 | { .id = 0x111d76cd, .name = "92HD89F2", .patch = patch_stac92hd73xx }, |
6388 | { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx }, | 6395 | { .id = 0x111d76ce, .name = "92HD89F1", .patch = patch_stac92hd73xx }, |
6389 | { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx}, | 6396 | { .id = 0x111d76e0, .name = "92HD91BXX", .patch = patch_stac92hd83xxx}, |
6397 | { .id = 0x111d76e3, .name = "92HD98BXX", .patch = patch_stac92hd83xxx}, | ||
6398 | { .id = 0x111d76e5, .name = "92HD99BXX", .patch = patch_stac92hd83xxx}, | ||
6390 | { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx}, | 6399 | { .id = 0x111d76e7, .name = "92HD90BXX", .patch = patch_stac92hd83xxx}, |
6391 | {} /* terminator */ | 6400 | {} /* terminator */ |
6392 | }; | 6401 | }; |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index a76c3260d941..63b0054200a8 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -567,7 +567,7 @@ static void via_auto_init_analog_input(struct hda_codec *codec) | |||
567 | hda_nid_t nid = cfg->inputs[i].pin; | 567 | hda_nid_t nid = cfg->inputs[i].pin; |
568 | if (spec->smart51_enabled && is_smart51_pins(spec, nid)) | 568 | if (spec->smart51_enabled && is_smart51_pins(spec, nid)) |
569 | ctl = PIN_OUT; | 569 | ctl = PIN_OUT; |
570 | else if (i == AUTO_PIN_MIC) | 570 | else if (cfg->inputs[i].type == AUTO_PIN_MIC) |
571 | ctl = PIN_VREF50; | 571 | ctl = PIN_VREF50; |
572 | else | 572 | else |
573 | ctl = PIN_IN; | 573 | ctl = PIN_IN; |
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c index bb4bf65b9e7e..0bb424af956f 100644 --- a/sound/soc/codecs/cx20442.c +++ b/sound/soc/codecs/cx20442.c | |||
@@ -367,7 +367,7 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec) | |||
367 | return 0; | 367 | return 0; |
368 | } | 368 | } |
369 | 369 | ||
370 | static const u8 cx20442_reg = CX20442_TELOUT | CX20442_MIC; | 370 | static const u8 cx20442_reg; |
371 | 371 | ||
372 | static struct snd_soc_codec_driver cx20442_codec_dev = { | 372 | static struct snd_soc_codec_driver cx20442_codec_dev = { |
373 | .probe = cx20442_codec_probe, | 373 | .probe = cx20442_codec_probe, |
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index 987476a5895f..017d99ceb42e 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
@@ -1482,7 +1482,7 @@ int wm8903_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, | |||
1482 | WM8903_MICDET_EINT | WM8903_MICSHRT_EINT, | 1482 | WM8903_MICDET_EINT | WM8903_MICSHRT_EINT, |
1483 | irq_mask); | 1483 | irq_mask); |
1484 | 1484 | ||
1485 | if (det && shrt) { | 1485 | if (det || shrt) { |
1486 | /* Enable mic detection, this may not have been set through | 1486 | /* Enable mic detection, this may not have been set through |
1487 | * platform data (eg, if the defaults are OK). */ | 1487 | * platform data (eg, if the defaults are OK). */ |
1488 | snd_soc_update_bits(codec, WM8903_WRITE_SEQUENCER_0, | 1488 | snd_soc_update_bits(codec, WM8903_WRITE_SEQUENCER_0, |
diff --git a/sound/soc/codecs/wm8903.h b/sound/soc/codecs/wm8903.h index e8490f3edd03..e3ec2433b215 100644 --- a/sound/soc/codecs/wm8903.h +++ b/sound/soc/codecs/wm8903.h | |||
@@ -165,7 +165,7 @@ extern int wm8903_mic_detect(struct snd_soc_codec *codec, | |||
165 | 165 | ||
166 | #define WM8903_VMID_RES_50K 2 | 166 | #define WM8903_VMID_RES_50K 2 |
167 | #define WM8903_VMID_RES_250K 3 | 167 | #define WM8903_VMID_RES_250K 3 |
168 | #define WM8903_VMID_RES_5K 4 | 168 | #define WM8903_VMID_RES_5K 6 |
169 | 169 | ||
170 | /* | 170 | /* |
171 | * R8 (0x08) - Analogue DAC 0 | 171 | * R8 (0x08) - Analogue DAC 0 |
diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c index 4bbc3442703f..8dfb0a0da673 100644 --- a/sound/soc/codecs/wm8978.c +++ b/sound/soc/codecs/wm8978.c | |||
@@ -145,18 +145,18 @@ static const struct snd_kcontrol_new wm8978_snd_controls[] = { | |||
145 | SOC_SINGLE("DAC Playback Limiter Threshold", | 145 | SOC_SINGLE("DAC Playback Limiter Threshold", |
146 | WM8978_DAC_LIMITER_2, 4, 7, 0), | 146 | WM8978_DAC_LIMITER_2, 4, 7, 0), |
147 | SOC_SINGLE("DAC Playback Limiter Boost", | 147 | SOC_SINGLE("DAC Playback Limiter Boost", |
148 | WM8978_DAC_LIMITER_2, 0, 15, 0), | 148 | WM8978_DAC_LIMITER_2, 0, 12, 0), |
149 | 149 | ||
150 | SOC_ENUM("ALC Enable Switch", alc1), | 150 | SOC_ENUM("ALC Enable Switch", alc1), |
151 | SOC_SINGLE("ALC Capture Min Gain", WM8978_ALC_CONTROL_1, 0, 7, 0), | 151 | SOC_SINGLE("ALC Capture Min Gain", WM8978_ALC_CONTROL_1, 0, 7, 0), |
152 | SOC_SINGLE("ALC Capture Max Gain", WM8978_ALC_CONTROL_1, 3, 7, 0), | 152 | SOC_SINGLE("ALC Capture Max Gain", WM8978_ALC_CONTROL_1, 3, 7, 0), |
153 | 153 | ||
154 | SOC_SINGLE("ALC Capture Hold", WM8978_ALC_CONTROL_2, 4, 7, 0), | 154 | SOC_SINGLE("ALC Capture Hold", WM8978_ALC_CONTROL_2, 4, 10, 0), |
155 | SOC_SINGLE("ALC Capture Target", WM8978_ALC_CONTROL_2, 0, 15, 0), | 155 | SOC_SINGLE("ALC Capture Target", WM8978_ALC_CONTROL_2, 0, 15, 0), |
156 | 156 | ||
157 | SOC_ENUM("ALC Capture Mode", alc3), | 157 | SOC_ENUM("ALC Capture Mode", alc3), |
158 | SOC_SINGLE("ALC Capture Decay", WM8978_ALC_CONTROL_3, 4, 15, 0), | 158 | SOC_SINGLE("ALC Capture Decay", WM8978_ALC_CONTROL_3, 4, 10, 0), |
159 | SOC_SINGLE("ALC Capture Attack", WM8978_ALC_CONTROL_3, 0, 15, 0), | 159 | SOC_SINGLE("ALC Capture Attack", WM8978_ALC_CONTROL_3, 0, 10, 0), |
160 | 160 | ||
161 | SOC_SINGLE("ALC Capture Noise Gate Switch", WM8978_NOISE_GATE, 3, 1, 0), | 161 | SOC_SINGLE("ALC Capture Noise Gate Switch", WM8978_NOISE_GATE, 3, 1, 0), |
162 | SOC_SINGLE("ALC Capture Noise Gate Threshold", | 162 | SOC_SINGLE("ALC Capture Noise Gate Threshold", |
@@ -211,8 +211,10 @@ static const struct snd_kcontrol_new wm8978_snd_controls[] = { | |||
211 | WM8978_LOUT2_SPK_CONTROL, WM8978_ROUT2_SPK_CONTROL, 6, 1, 1), | 211 | WM8978_LOUT2_SPK_CONTROL, WM8978_ROUT2_SPK_CONTROL, 6, 1, 1), |
212 | 212 | ||
213 | /* DAC / ADC oversampling */ | 213 | /* DAC / ADC oversampling */ |
214 | SOC_SINGLE("DAC 128x Oversampling Switch", WM8978_DAC_CONTROL, 8, 1, 0), | 214 | SOC_SINGLE("DAC 128x Oversampling Switch", WM8978_DAC_CONTROL, |
215 | SOC_SINGLE("ADC 128x Oversampling Switch", WM8978_ADC_CONTROL, 8, 1, 0), | 215 | 5, 1, 0), |
216 | SOC_SINGLE("ADC 128x Oversampling Switch", WM8978_ADC_CONTROL, | ||
217 | 5, 1, 0), | ||
216 | }; | 218 | }; |
217 | 219 | ||
218 | /* Mixer #1: Output (OUT1, OUT2) Mixer: mix AUX, Input mixer output and DAC */ | 220 | /* Mixer #1: Output (OUT1, OUT2) Mixer: mix AUX, Input mixer output and DAC */ |
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c index 37b8aa8a680f..c6c958ee5d59 100644 --- a/sound/soc/codecs/wm8994.c +++ b/sound/soc/codecs/wm8994.c | |||
@@ -107,6 +107,12 @@ struct wm8994_priv { | |||
107 | 107 | ||
108 | int revision; | 108 | int revision; |
109 | struct wm8994_pdata *pdata; | 109 | struct wm8994_pdata *pdata; |
110 | |||
111 | unsigned int aif1clk_enable:1; | ||
112 | unsigned int aif2clk_enable:1; | ||
113 | |||
114 | unsigned int aif1clk_disable:1; | ||
115 | unsigned int aif2clk_disable:1; | ||
110 | }; | 116 | }; |
111 | 117 | ||
112 | static int wm8994_readable(unsigned int reg) | 118 | static int wm8994_readable(unsigned int reg) |
@@ -1004,6 +1010,110 @@ static void wm8994_update_class_w(struct snd_soc_codec *codec) | |||
1004 | } | 1010 | } |
1005 | } | 1011 | } |
1006 | 1012 | ||
1013 | static int late_enable_ev(struct snd_soc_dapm_widget *w, | ||
1014 | struct snd_kcontrol *kcontrol, int event) | ||
1015 | { | ||
1016 | struct snd_soc_codec *codec = w->codec; | ||
1017 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
1018 | |||
1019 | switch (event) { | ||
1020 | case SND_SOC_DAPM_PRE_PMU: | ||
1021 | if (wm8994->aif1clk_enable) { | ||
1022 | snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, | ||
1023 | WM8994_AIF1CLK_ENA_MASK, | ||
1024 | WM8994_AIF1CLK_ENA); | ||
1025 | wm8994->aif1clk_enable = 0; | ||
1026 | } | ||
1027 | if (wm8994->aif2clk_enable) { | ||
1028 | snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, | ||
1029 | WM8994_AIF2CLK_ENA_MASK, | ||
1030 | WM8994_AIF2CLK_ENA); | ||
1031 | wm8994->aif2clk_enable = 0; | ||
1032 | } | ||
1033 | break; | ||
1034 | } | ||
1035 | |||
1036 | return 0; | ||
1037 | } | ||
1038 | |||
1039 | static int late_disable_ev(struct snd_soc_dapm_widget *w, | ||
1040 | struct snd_kcontrol *kcontrol, int event) | ||
1041 | { | ||
1042 | struct snd_soc_codec *codec = w->codec; | ||
1043 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
1044 | |||
1045 | switch (event) { | ||
1046 | case SND_SOC_DAPM_POST_PMD: | ||
1047 | if (wm8994->aif1clk_disable) { | ||
1048 | snd_soc_update_bits(codec, WM8994_AIF1_CLOCKING_1, | ||
1049 | WM8994_AIF1CLK_ENA_MASK, 0); | ||
1050 | wm8994->aif1clk_disable = 0; | ||
1051 | } | ||
1052 | if (wm8994->aif2clk_disable) { | ||
1053 | snd_soc_update_bits(codec, WM8994_AIF2_CLOCKING_1, | ||
1054 | WM8994_AIF2CLK_ENA_MASK, 0); | ||
1055 | wm8994->aif2clk_disable = 0; | ||
1056 | } | ||
1057 | break; | ||
1058 | } | ||
1059 | |||
1060 | return 0; | ||
1061 | } | ||
1062 | |||
1063 | static int aif1clk_ev(struct snd_soc_dapm_widget *w, | ||
1064 | struct snd_kcontrol *kcontrol, int event) | ||
1065 | { | ||
1066 | struct snd_soc_codec *codec = w->codec; | ||
1067 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
1068 | |||
1069 | switch (event) { | ||
1070 | case SND_SOC_DAPM_PRE_PMU: | ||
1071 | wm8994->aif1clk_enable = 1; | ||
1072 | break; | ||
1073 | case SND_SOC_DAPM_POST_PMD: | ||
1074 | wm8994->aif1clk_disable = 1; | ||
1075 | break; | ||
1076 | } | ||
1077 | |||
1078 | return 0; | ||
1079 | } | ||
1080 | |||
1081 | static int aif2clk_ev(struct snd_soc_dapm_widget *w, | ||
1082 | struct snd_kcontrol *kcontrol, int event) | ||
1083 | { | ||
1084 | struct snd_soc_codec *codec = w->codec; | ||
1085 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | ||
1086 | |||
1087 | switch (event) { | ||
1088 | case SND_SOC_DAPM_PRE_PMU: | ||
1089 | wm8994->aif2clk_enable = 1; | ||
1090 | break; | ||
1091 | case SND_SOC_DAPM_POST_PMD: | ||
1092 | wm8994->aif2clk_disable = 1; | ||
1093 | break; | ||
1094 | } | ||
1095 | |||
1096 | return 0; | ||
1097 | } | ||
1098 | |||
1099 | static int adc_mux_ev(struct snd_soc_dapm_widget *w, | ||
1100 | struct snd_kcontrol *kcontrol, int event) | ||
1101 | { | ||
1102 | late_enable_ev(w, kcontrol, event); | ||
1103 | return 0; | ||
1104 | } | ||
1105 | |||
1106 | static int dac_ev(struct snd_soc_dapm_widget *w, | ||
1107 | struct snd_kcontrol *kcontrol, int event) | ||
1108 | { | ||
1109 | struct snd_soc_codec *codec = w->codec; | ||
1110 | unsigned int mask = 1 << w->shift; | ||
1111 | |||
1112 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | ||
1113 | mask, mask); | ||
1114 | return 0; | ||
1115 | } | ||
1116 | |||
1007 | static const char *hp_mux_text[] = { | 1117 | static const char *hp_mux_text[] = { |
1008 | "Mixer", | 1118 | "Mixer", |
1009 | "DAC", | 1119 | "DAC", |
@@ -1272,6 +1382,59 @@ static const struct soc_enum aif2dacr_src_enum = | |||
1272 | static const struct snd_kcontrol_new aif2dacr_src_mux = | 1382 | static const struct snd_kcontrol_new aif2dacr_src_mux = |
1273 | SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum); | 1383 | SOC_DAPM_ENUM("AIF2DACR Mux", aif2dacr_src_enum); |
1274 | 1384 | ||
1385 | static const struct snd_soc_dapm_widget wm8994_lateclk_revd_widgets[] = { | ||
1386 | SND_SOC_DAPM_SUPPLY("AIF1CLK", SND_SOC_NOPM, 0, 0, aif1clk_ev, | ||
1387 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
1388 | SND_SOC_DAPM_SUPPLY("AIF2CLK", SND_SOC_NOPM, 0, 0, aif2clk_ev, | ||
1389 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
1390 | |||
1391 | SND_SOC_DAPM_PGA_E("Late DAC1L Enable PGA", SND_SOC_NOPM, 0, 0, NULL, 0, | ||
1392 | late_enable_ev, SND_SOC_DAPM_PRE_PMU), | ||
1393 | SND_SOC_DAPM_PGA_E("Late DAC1R Enable PGA", SND_SOC_NOPM, 0, 0, NULL, 0, | ||
1394 | late_enable_ev, SND_SOC_DAPM_PRE_PMU), | ||
1395 | SND_SOC_DAPM_PGA_E("Late DAC2L Enable PGA", SND_SOC_NOPM, 0, 0, NULL, 0, | ||
1396 | late_enable_ev, SND_SOC_DAPM_PRE_PMU), | ||
1397 | SND_SOC_DAPM_PGA_E("Late DAC2R Enable PGA", SND_SOC_NOPM, 0, 0, NULL, 0, | ||
1398 | late_enable_ev, SND_SOC_DAPM_PRE_PMU), | ||
1399 | |||
1400 | SND_SOC_DAPM_POST("Late Disable PGA", late_disable_ev) | ||
1401 | }; | ||
1402 | |||
1403 | static const struct snd_soc_dapm_widget wm8994_lateclk_widgets[] = { | ||
1404 | SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, NULL, 0), | ||
1405 | SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, NULL, 0) | ||
1406 | }; | ||
1407 | |||
1408 | static const struct snd_soc_dapm_widget wm8994_dac_revd_widgets[] = { | ||
1409 | SND_SOC_DAPM_DAC_E("DAC2L", NULL, SND_SOC_NOPM, 3, 0, | ||
1410 | dac_ev, SND_SOC_DAPM_PRE_PMU), | ||
1411 | SND_SOC_DAPM_DAC_E("DAC2R", NULL, SND_SOC_NOPM, 2, 0, | ||
1412 | dac_ev, SND_SOC_DAPM_PRE_PMU), | ||
1413 | SND_SOC_DAPM_DAC_E("DAC1L", NULL, SND_SOC_NOPM, 1, 0, | ||
1414 | dac_ev, SND_SOC_DAPM_PRE_PMU), | ||
1415 | SND_SOC_DAPM_DAC_E("DAC1R", NULL, SND_SOC_NOPM, 0, 0, | ||
1416 | dac_ev, SND_SOC_DAPM_PRE_PMU), | ||
1417 | }; | ||
1418 | |||
1419 | static const struct snd_soc_dapm_widget wm8994_dac_widgets[] = { | ||
1420 | SND_SOC_DAPM_DAC("DAC2L", NULL, WM8994_POWER_MANAGEMENT_5, 3, 0), | ||
1421 | SND_SOC_DAPM_DAC("DAC2R", NULL, WM8994_POWER_MANAGEMENT_5, 2, 0), | ||
1422 | SND_SOC_DAPM_DAC("DAC1L", NULL, WM8994_POWER_MANAGEMENT_5, 1, 0), | ||
1423 | SND_SOC_DAPM_DAC("DAC1R", NULL, WM8994_POWER_MANAGEMENT_5, 0, 0), | ||
1424 | }; | ||
1425 | |||
1426 | static const struct snd_soc_dapm_widget wm8994_adc_revd_widgets[] = { | ||
1427 | SND_SOC_DAPM_MUX_E("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux, | ||
1428 | adc_mux_ev, SND_SOC_DAPM_PRE_PMU), | ||
1429 | SND_SOC_DAPM_MUX_E("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux, | ||
1430 | adc_mux_ev, SND_SOC_DAPM_PRE_PMU), | ||
1431 | }; | ||
1432 | |||
1433 | static const struct snd_soc_dapm_widget wm8994_adc_widgets[] = { | ||
1434 | SND_SOC_DAPM_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux), | ||
1435 | SND_SOC_DAPM_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux), | ||
1436 | }; | ||
1437 | |||
1275 | static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = { | 1438 | static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = { |
1276 | SND_SOC_DAPM_INPUT("DMIC1DAT"), | 1439 | SND_SOC_DAPM_INPUT("DMIC1DAT"), |
1277 | SND_SOC_DAPM_INPUT("DMIC2DAT"), | 1440 | SND_SOC_DAPM_INPUT("DMIC2DAT"), |
@@ -1284,9 +1447,6 @@ SND_SOC_DAPM_SUPPLY("DSP1CLK", WM8994_CLOCKING_1, 3, 0, NULL, 0), | |||
1284 | SND_SOC_DAPM_SUPPLY("DSP2CLK", WM8994_CLOCKING_1, 2, 0, NULL, 0), | 1447 | SND_SOC_DAPM_SUPPLY("DSP2CLK", WM8994_CLOCKING_1, 2, 0, NULL, 0), |
1285 | SND_SOC_DAPM_SUPPLY("DSPINTCLK", WM8994_CLOCKING_1, 1, 0, NULL, 0), | 1448 | SND_SOC_DAPM_SUPPLY("DSPINTCLK", WM8994_CLOCKING_1, 1, 0, NULL, 0), |
1286 | 1449 | ||
1287 | SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8994_AIF1_CLOCKING_1, 0, 0, NULL, 0), | ||
1288 | SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8994_AIF2_CLOCKING_1, 0, 0, NULL, 0), | ||
1289 | |||
1290 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1L", NULL, | 1450 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1L", NULL, |
1291 | 0, WM8994_POWER_MANAGEMENT_4, 9, 0), | 1451 | 0, WM8994_POWER_MANAGEMENT_4, 9, 0), |
1292 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1R", NULL, | 1452 | SND_SOC_DAPM_AIF_OUT("AIF1ADC1R", NULL, |
@@ -1369,14 +1529,6 @@ SND_SOC_DAPM_ADC("DMIC1R", NULL, WM8994_POWER_MANAGEMENT_4, 2, 0), | |||
1369 | SND_SOC_DAPM_ADC("ADCL", NULL, SND_SOC_NOPM, 1, 0), | 1529 | SND_SOC_DAPM_ADC("ADCL", NULL, SND_SOC_NOPM, 1, 0), |
1370 | SND_SOC_DAPM_ADC("ADCR", NULL, SND_SOC_NOPM, 0, 0), | 1530 | SND_SOC_DAPM_ADC("ADCR", NULL, SND_SOC_NOPM, 0, 0), |
1371 | 1531 | ||
1372 | SND_SOC_DAPM_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux), | ||
1373 | SND_SOC_DAPM_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux), | ||
1374 | |||
1375 | SND_SOC_DAPM_DAC("DAC2L", NULL, WM8994_POWER_MANAGEMENT_5, 3, 0), | ||
1376 | SND_SOC_DAPM_DAC("DAC2R", NULL, WM8994_POWER_MANAGEMENT_5, 2, 0), | ||
1377 | SND_SOC_DAPM_DAC("DAC1L", NULL, WM8994_POWER_MANAGEMENT_5, 1, 0), | ||
1378 | SND_SOC_DAPM_DAC("DAC1R", NULL, WM8994_POWER_MANAGEMENT_5, 0, 0), | ||
1379 | |||
1380 | SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0, &hpl_mux), | 1532 | SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0, &hpl_mux), |
1381 | SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0, &hpr_mux), | 1533 | SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0, &hpr_mux), |
1382 | 1534 | ||
@@ -1516,14 +1668,12 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
1516 | { "AIF2ADC Mux", "AIF3DACDAT", "AIF3ADCDAT" }, | 1668 | { "AIF2ADC Mux", "AIF3DACDAT", "AIF3ADCDAT" }, |
1517 | 1669 | ||
1518 | /* DAC1 inputs */ | 1670 | /* DAC1 inputs */ |
1519 | { "DAC1L", NULL, "DAC1L Mixer" }, | ||
1520 | { "DAC1L Mixer", "AIF2 Switch", "AIF2DACL" }, | 1671 | { "DAC1L Mixer", "AIF2 Switch", "AIF2DACL" }, |
1521 | { "DAC1L Mixer", "AIF1.2 Switch", "AIF1DAC2L" }, | 1672 | { "DAC1L Mixer", "AIF1.2 Switch", "AIF1DAC2L" }, |
1522 | { "DAC1L Mixer", "AIF1.1 Switch", "AIF1DAC1L" }, | 1673 | { "DAC1L Mixer", "AIF1.1 Switch", "AIF1DAC1L" }, |
1523 | { "DAC1L Mixer", "Left Sidetone Switch", "Left Sidetone" }, | 1674 | { "DAC1L Mixer", "Left Sidetone Switch", "Left Sidetone" }, |
1524 | { "DAC1L Mixer", "Right Sidetone Switch", "Right Sidetone" }, | 1675 | { "DAC1L Mixer", "Right Sidetone Switch", "Right Sidetone" }, |
1525 | 1676 | ||
1526 | { "DAC1R", NULL, "DAC1R Mixer" }, | ||
1527 | { "DAC1R Mixer", "AIF2 Switch", "AIF2DACR" }, | 1677 | { "DAC1R Mixer", "AIF2 Switch", "AIF2DACR" }, |
1528 | { "DAC1R Mixer", "AIF1.2 Switch", "AIF1DAC2R" }, | 1678 | { "DAC1R Mixer", "AIF1.2 Switch", "AIF1DAC2R" }, |
1529 | { "DAC1R Mixer", "AIF1.1 Switch", "AIF1DAC1R" }, | 1679 | { "DAC1R Mixer", "AIF1.1 Switch", "AIF1DAC1R" }, |
@@ -1532,7 +1682,6 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
1532 | 1682 | ||
1533 | /* DAC2/AIF2 outputs */ | 1683 | /* DAC2/AIF2 outputs */ |
1534 | { "AIF2ADCL", NULL, "AIF2DAC2L Mixer" }, | 1684 | { "AIF2ADCL", NULL, "AIF2DAC2L Mixer" }, |
1535 | { "DAC2L", NULL, "AIF2DAC2L Mixer" }, | ||
1536 | { "AIF2DAC2L Mixer", "AIF2 Switch", "AIF2DACL" }, | 1685 | { "AIF2DAC2L Mixer", "AIF2 Switch", "AIF2DACL" }, |
1537 | { "AIF2DAC2L Mixer", "AIF1.2 Switch", "AIF1DAC2L" }, | 1686 | { "AIF2DAC2L Mixer", "AIF1.2 Switch", "AIF1DAC2L" }, |
1538 | { "AIF2DAC2L Mixer", "AIF1.1 Switch", "AIF1DAC1L" }, | 1687 | { "AIF2DAC2L Mixer", "AIF1.1 Switch", "AIF1DAC1L" }, |
@@ -1540,7 +1689,6 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
1540 | { "AIF2DAC2L Mixer", "Right Sidetone Switch", "Right Sidetone" }, | 1689 | { "AIF2DAC2L Mixer", "Right Sidetone Switch", "Right Sidetone" }, |
1541 | 1690 | ||
1542 | { "AIF2ADCR", NULL, "AIF2DAC2R Mixer" }, | 1691 | { "AIF2ADCR", NULL, "AIF2DAC2R Mixer" }, |
1543 | { "DAC2R", NULL, "AIF2DAC2R Mixer" }, | ||
1544 | { "AIF2DAC2R Mixer", "AIF2 Switch", "AIF2DACR" }, | 1692 | { "AIF2DAC2R Mixer", "AIF2 Switch", "AIF2DACR" }, |
1545 | { "AIF2DAC2R Mixer", "AIF1.2 Switch", "AIF1DAC2R" }, | 1693 | { "AIF2DAC2R Mixer", "AIF1.2 Switch", "AIF1DAC2R" }, |
1546 | { "AIF2DAC2R Mixer", "AIF1.1 Switch", "AIF1DAC1R" }, | 1694 | { "AIF2DAC2R Mixer", "AIF1.1 Switch", "AIF1DAC1R" }, |
@@ -1584,6 +1732,24 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
1584 | { "Right Headphone Mux", "DAC", "DAC1R" }, | 1732 | { "Right Headphone Mux", "DAC", "DAC1R" }, |
1585 | }; | 1733 | }; |
1586 | 1734 | ||
1735 | static const struct snd_soc_dapm_route wm8994_lateclk_revd_intercon[] = { | ||
1736 | { "DAC1L", NULL, "Late DAC1L Enable PGA" }, | ||
1737 | { "Late DAC1L Enable PGA", NULL, "DAC1L Mixer" }, | ||
1738 | { "DAC1R", NULL, "Late DAC1R Enable PGA" }, | ||
1739 | { "Late DAC1R Enable PGA", NULL, "DAC1R Mixer" }, | ||
1740 | { "DAC2L", NULL, "Late DAC2L Enable PGA" }, | ||
1741 | { "Late DAC2L Enable PGA", NULL, "AIF2DAC2L Mixer" }, | ||
1742 | { "DAC2R", NULL, "Late DAC2R Enable PGA" }, | ||
1743 | { "Late DAC2R Enable PGA", NULL, "AIF2DAC2R Mixer" } | ||
1744 | }; | ||
1745 | |||
1746 | static const struct snd_soc_dapm_route wm8994_lateclk_intercon[] = { | ||
1747 | { "DAC1L", NULL, "DAC1L Mixer" }, | ||
1748 | { "DAC1R", NULL, "DAC1R Mixer" }, | ||
1749 | { "DAC2L", NULL, "AIF2DAC2L Mixer" }, | ||
1750 | { "DAC2R", NULL, "AIF2DAC2R Mixer" }, | ||
1751 | }; | ||
1752 | |||
1587 | static const struct snd_soc_dapm_route wm8994_revd_intercon[] = { | 1753 | static const struct snd_soc_dapm_route wm8994_revd_intercon[] = { |
1588 | { "AIF1DACDAT", NULL, "AIF2DACDAT" }, | 1754 | { "AIF1DACDAT", NULL, "AIF2DACDAT" }, |
1589 | { "AIF2DACDAT", NULL, "AIF1DACDAT" }, | 1755 | { "AIF2DACDAT", NULL, "AIF1DACDAT" }, |
@@ -2514,6 +2680,22 @@ static int wm8994_resume(struct snd_soc_codec *codec) | |||
2514 | { | 2680 | { |
2515 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 2681 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
2516 | int i, ret; | 2682 | int i, ret; |
2683 | unsigned int val, mask; | ||
2684 | |||
2685 | if (wm8994->revision < 4) { | ||
2686 | /* force a HW read */ | ||
2687 | val = wm8994_reg_read(codec->control_data, | ||
2688 | WM8994_POWER_MANAGEMENT_5); | ||
2689 | |||
2690 | /* modify the cache only */ | ||
2691 | codec->cache_only = 1; | ||
2692 | mask = WM8994_DAC1R_ENA | WM8994_DAC1L_ENA | | ||
2693 | WM8994_DAC2R_ENA | WM8994_DAC2L_ENA; | ||
2694 | val &= mask; | ||
2695 | snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_5, | ||
2696 | mask, val); | ||
2697 | codec->cache_only = 0; | ||
2698 | } | ||
2517 | 2699 | ||
2518 | /* Restore the registers */ | 2700 | /* Restore the registers */ |
2519 | ret = snd_soc_cache_sync(codec); | 2701 | ret = snd_soc_cache_sync(codec); |
@@ -2847,11 +3029,10 @@ static void wm8958_default_micdet(u16 status, void *data) | |||
2847 | report |= SND_JACK_BTN_5; | 3029 | report |= SND_JACK_BTN_5; |
2848 | 3030 | ||
2849 | done: | 3031 | done: |
2850 | snd_soc_jack_report(wm8994->micdet[0].jack, | 3032 | snd_soc_jack_report(wm8994->micdet[0].jack, report, |
2851 | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | | 3033 | SND_JACK_BTN_0 | SND_JACK_BTN_1 | SND_JACK_BTN_2 | |
2852 | SND_JACK_BTN_3 | SND_JACK_BTN_4 | SND_JACK_BTN_5 | | 3034 | SND_JACK_BTN_3 | SND_JACK_BTN_4 | SND_JACK_BTN_5 | |
2853 | SND_JACK_MICROPHONE | SND_JACK_VIDEOOUT, | 3035 | SND_JACK_MICROPHONE | SND_JACK_VIDEOOUT); |
2854 | report); | ||
2855 | } | 3036 | } |
2856 | 3037 | ||
2857 | /** | 3038 | /** |
@@ -3125,10 +3306,31 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3125 | case WM8994: | 3306 | case WM8994: |
3126 | snd_soc_dapm_new_controls(dapm, wm8994_specific_dapm_widgets, | 3307 | snd_soc_dapm_new_controls(dapm, wm8994_specific_dapm_widgets, |
3127 | ARRAY_SIZE(wm8994_specific_dapm_widgets)); | 3308 | ARRAY_SIZE(wm8994_specific_dapm_widgets)); |
3309 | if (wm8994->revision < 4) { | ||
3310 | snd_soc_dapm_new_controls(dapm, wm8994_lateclk_revd_widgets, | ||
3311 | ARRAY_SIZE(wm8994_lateclk_revd_widgets)); | ||
3312 | snd_soc_dapm_new_controls(dapm, wm8994_adc_revd_widgets, | ||
3313 | ARRAY_SIZE(wm8994_adc_revd_widgets)); | ||
3314 | snd_soc_dapm_new_controls(dapm, wm8994_dac_revd_widgets, | ||
3315 | ARRAY_SIZE(wm8994_dac_revd_widgets)); | ||
3316 | } else { | ||
3317 | snd_soc_dapm_new_controls(dapm, wm8994_lateclk_widgets, | ||
3318 | ARRAY_SIZE(wm8994_lateclk_widgets)); | ||
3319 | snd_soc_dapm_new_controls(dapm, wm8994_adc_widgets, | ||
3320 | ARRAY_SIZE(wm8994_adc_widgets)); | ||
3321 | snd_soc_dapm_new_controls(dapm, wm8994_dac_widgets, | ||
3322 | ARRAY_SIZE(wm8994_dac_widgets)); | ||
3323 | } | ||
3128 | break; | 3324 | break; |
3129 | case WM8958: | 3325 | case WM8958: |
3130 | snd_soc_add_controls(codec, wm8958_snd_controls, | 3326 | snd_soc_add_controls(codec, wm8958_snd_controls, |
3131 | ARRAY_SIZE(wm8958_snd_controls)); | 3327 | ARRAY_SIZE(wm8958_snd_controls)); |
3328 | snd_soc_dapm_new_controls(dapm, wm8994_lateclk_widgets, | ||
3329 | ARRAY_SIZE(wm8994_lateclk_widgets)); | ||
3330 | snd_soc_dapm_new_controls(dapm, wm8994_adc_widgets, | ||
3331 | ARRAY_SIZE(wm8994_adc_widgets)); | ||
3332 | snd_soc_dapm_new_controls(dapm, wm8994_dac_widgets, | ||
3333 | ARRAY_SIZE(wm8994_dac_widgets)); | ||
3132 | snd_soc_dapm_new_controls(dapm, wm8958_dapm_widgets, | 3334 | snd_soc_dapm_new_controls(dapm, wm8958_dapm_widgets, |
3133 | ARRAY_SIZE(wm8958_dapm_widgets)); | 3335 | ARRAY_SIZE(wm8958_dapm_widgets)); |
3134 | break; | 3336 | break; |
@@ -3143,12 +3345,19 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec) | |||
3143 | snd_soc_dapm_add_routes(dapm, wm8994_intercon, | 3345 | snd_soc_dapm_add_routes(dapm, wm8994_intercon, |
3144 | ARRAY_SIZE(wm8994_intercon)); | 3346 | ARRAY_SIZE(wm8994_intercon)); |
3145 | 3347 | ||
3146 | if (wm8994->revision < 4) | 3348 | if (wm8994->revision < 4) { |
3147 | snd_soc_dapm_add_routes(dapm, wm8994_revd_intercon, | 3349 | snd_soc_dapm_add_routes(dapm, wm8994_revd_intercon, |
3148 | ARRAY_SIZE(wm8994_revd_intercon)); | 3350 | ARRAY_SIZE(wm8994_revd_intercon)); |
3149 | 3351 | snd_soc_dapm_add_routes(dapm, wm8994_lateclk_revd_intercon, | |
3352 | ARRAY_SIZE(wm8994_lateclk_revd_intercon)); | ||
3353 | } else { | ||
3354 | snd_soc_dapm_add_routes(dapm, wm8994_lateclk_intercon, | ||
3355 | ARRAY_SIZE(wm8994_lateclk_intercon)); | ||
3356 | } | ||
3150 | break; | 3357 | break; |
3151 | case WM8958: | 3358 | case WM8958: |
3359 | snd_soc_dapm_add_routes(dapm, wm8994_lateclk_intercon, | ||
3360 | ARRAY_SIZE(wm8994_lateclk_intercon)); | ||
3152 | snd_soc_dapm_add_routes(dapm, wm8958_intercon, | 3361 | snd_soc_dapm_add_routes(dapm, wm8958_intercon, |
3153 | ARRAY_SIZE(wm8958_intercon)); | 3362 | ARRAY_SIZE(wm8958_intercon)); |
3154 | break; | 3363 | break; |
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index 43825b2102a5..cce704c275c6 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/moduleparam.h> | 15 | #include <linux/moduleparam.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/device.h> | ||
18 | #include <linux/pm.h> | 19 | #include <linux/pm.h> |
19 | #include <linux/i2c.h> | 20 | #include <linux/i2c.h> |
20 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
@@ -1341,6 +1342,10 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c, | |||
1341 | wm9081->control_type = SND_SOC_I2C; | 1342 | wm9081->control_type = SND_SOC_I2C; |
1342 | wm9081->control_data = i2c; | 1343 | wm9081->control_data = i2c; |
1343 | 1344 | ||
1345 | if (dev_get_platdata(&i2c->dev)) | ||
1346 | memcpy(&wm9081->retune, dev_get_platdata(&i2c->dev), | ||
1347 | sizeof(wm9081->retune)); | ||
1348 | |||
1344 | ret = snd_soc_register_codec(&i2c->dev, | 1349 | ret = snd_soc_register_codec(&i2c->dev, |
1345 | &soc_codec_dev_wm9081, &wm9081_dai, 1); | 1350 | &soc_codec_dev_wm9081, &wm9081_dai, 1); |
1346 | if (ret < 0) | 1351 | if (ret < 0) |
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c index 613df5db0b32..516892706063 100644 --- a/sound/soc/codecs/wm_hubs.c +++ b/sound/soc/codecs/wm_hubs.c | |||
@@ -674,6 +674,9 @@ SND_SOC_DAPM_OUTPUT("LINEOUT2N"), | |||
674 | }; | 674 | }; |
675 | 675 | ||
676 | static const struct snd_soc_dapm_route analogue_routes[] = { | 676 | static const struct snd_soc_dapm_route analogue_routes[] = { |
677 | { "MICBIAS1", NULL, "CLK_SYS" }, | ||
678 | { "MICBIAS2", NULL, "CLK_SYS" }, | ||
679 | |||
677 | { "IN1L PGA", "IN1LP Switch", "IN1LP" }, | 680 | { "IN1L PGA", "IN1LP Switch", "IN1LP" }, |
678 | { "IN1L PGA", "IN1LN Switch", "IN1LN" }, | 681 | { "IN1L PGA", "IN1LN Switch", "IN1LN" }, |
679 | 682 | ||
diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/imx/eukrea-tlv320.c index e20c9e1457c0..1e9bccae4e80 100644 --- a/sound/soc/imx/eukrea-tlv320.c +++ b/sound/soc/imx/eukrea-tlv320.c | |||
@@ -79,7 +79,7 @@ static struct snd_soc_dai_link eukrea_tlv320_dai = { | |||
79 | .name = "tlv320aic23", | 79 | .name = "tlv320aic23", |
80 | .stream_name = "TLV320AIC23", | 80 | .stream_name = "TLV320AIC23", |
81 | .codec_dai_name = "tlv320aic23-hifi", | 81 | .codec_dai_name = "tlv320aic23-hifi", |
82 | .platform_name = "imx-pcm-audio.0", | 82 | .platform_name = "imx-fiq-pcm-audio.0", |
83 | .codec_name = "tlv320aic23-codec.0-001a", | 83 | .codec_name = "tlv320aic23-codec.0-001a", |
84 | .cpu_dai_name = "imx-ssi.0", | 84 | .cpu_dai_name = "imx-ssi.0", |
85 | .ops = &eukrea_tlv320_snd_ops, | 85 | .ops = &eukrea_tlv320_snd_ops, |
diff --git a/sound/soc/omap/am3517evm.c b/sound/soc/omap/am3517evm.c index 161750443ebc..73dde4a1adc3 100644 --- a/sound/soc/omap/am3517evm.c +++ b/sound/soc/omap/am3517evm.c | |||
@@ -139,7 +139,7 @@ static struct snd_soc_dai_link am3517evm_dai = { | |||
139 | .cpu_dai_name ="omap-mcbsp-dai.0", | 139 | .cpu_dai_name ="omap-mcbsp-dai.0", |
140 | .codec_dai_name = "tlv320aic23-hifi", | 140 | .codec_dai_name = "tlv320aic23-hifi", |
141 | .platform_name = "omap-pcm-audio", | 141 | .platform_name = "omap-pcm-audio", |
142 | .codec_name = "tlv320aic23-codec", | 142 | .codec_name = "tlv320aic23-codec.2-001a", |
143 | .init = am3517evm_aic23_init, | 143 | .init = am3517evm_aic23_init, |
144 | .ops = &am3517evm_ops, | 144 | .ops = &am3517evm_ops, |
145 | }; | 145 | }; |
diff --git a/sound/soc/pxa/e740_wm9705.c b/sound/soc/pxa/e740_wm9705.c index 28333e7d9c50..dc65650a6fa1 100644 --- a/sound/soc/pxa/e740_wm9705.c +++ b/sound/soc/pxa/e740_wm9705.c | |||
@@ -117,7 +117,7 @@ static struct snd_soc_dai_link e740_dai[] = { | |||
117 | { | 117 | { |
118 | .name = "AC97", | 118 | .name = "AC97", |
119 | .stream_name = "AC97 HiFi", | 119 | .stream_name = "AC97 HiFi", |
120 | .cpu_dai_name = "pxa-ac97.0", | 120 | .cpu_dai_name = "pxa2xx-ac97", |
121 | .codec_dai_name = "wm9705-hifi", | 121 | .codec_dai_name = "wm9705-hifi", |
122 | .platform_name = "pxa-pcm-audio", | 122 | .platform_name = "pxa-pcm-audio", |
123 | .codec_name = "wm9705-codec", | 123 | .codec_name = "wm9705-codec", |
@@ -126,7 +126,7 @@ static struct snd_soc_dai_link e740_dai[] = { | |||
126 | { | 126 | { |
127 | .name = "AC97 Aux", | 127 | .name = "AC97 Aux", |
128 | .stream_name = "AC97 Aux", | 128 | .stream_name = "AC97 Aux", |
129 | .cpu_dai_name = "pxa-ac97.1", | 129 | .cpu_dai_name = "pxa2xx-ac97-aux", |
130 | .codec_dai_name = "wm9705-aux", | 130 | .codec_dai_name = "wm9705-aux", |
131 | .platform_name = "pxa-pcm-audio", | 131 | .platform_name = "pxa-pcm-audio", |
132 | .codec_name = "wm9705-codec", | 132 | .codec_name = "wm9705-codec", |
diff --git a/sound/soc/pxa/e750_wm9705.c b/sound/soc/pxa/e750_wm9705.c index 01bf31675c55..51897fcd911b 100644 --- a/sound/soc/pxa/e750_wm9705.c +++ b/sound/soc/pxa/e750_wm9705.c | |||
@@ -99,7 +99,7 @@ static struct snd_soc_dai_link e750_dai[] = { | |||
99 | { | 99 | { |
100 | .name = "AC97", | 100 | .name = "AC97", |
101 | .stream_name = "AC97 HiFi", | 101 | .stream_name = "AC97 HiFi", |
102 | .cpu_dai_name = "pxa-ac97.0", | 102 | .cpu_dai_name = "pxa2xx-ac97", |
103 | .codec_dai_name = "wm9705-hifi", | 103 | .codec_dai_name = "wm9705-hifi", |
104 | .platform_name = "pxa-pcm-audio", | 104 | .platform_name = "pxa-pcm-audio", |
105 | .codec_name = "wm9705-codec", | 105 | .codec_name = "wm9705-codec", |
@@ -109,7 +109,7 @@ static struct snd_soc_dai_link e750_dai[] = { | |||
109 | { | 109 | { |
110 | .name = "AC97 Aux", | 110 | .name = "AC97 Aux", |
111 | .stream_name = "AC97 Aux", | 111 | .stream_name = "AC97 Aux", |
112 | .cpu_dai_name = "pxa-ac97.1", | 112 | .cpu_dai_name = "pxa2xx-ac97-aux", |
113 | .codec_dai_name ="wm9705-aux", | 113 | .codec_dai_name ="wm9705-aux", |
114 | .platform_name = "pxa-pcm-audio", | 114 | .platform_name = "pxa-pcm-audio", |
115 | .codec_name = "wm9705-codec", | 115 | .codec_name = "wm9705-codec", |
diff --git a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c index c6a37c6ef23b..053ed208e59f 100644 --- a/sound/soc/pxa/e800_wm9712.c +++ b/sound/soc/pxa/e800_wm9712.c | |||
@@ -89,7 +89,7 @@ static struct snd_soc_dai_link e800_dai[] = { | |||
89 | { | 89 | { |
90 | .name = "AC97", | 90 | .name = "AC97", |
91 | .stream_name = "AC97 HiFi", | 91 | .stream_name = "AC97 HiFi", |
92 | .cpu_dai_name = "pxa-ac97.0", | 92 | .cpu_dai_name = "pxa2xx-ac97", |
93 | .codec_dai_name = "wm9712-hifi", | 93 | .codec_dai_name = "wm9712-hifi", |
94 | .platform_name = "pxa-pcm-audio", | 94 | .platform_name = "pxa-pcm-audio", |
95 | .codec_name = "wm9712-codec", | 95 | .codec_name = "wm9712-codec", |
@@ -98,7 +98,7 @@ static struct snd_soc_dai_link e800_dai[] = { | |||
98 | { | 98 | { |
99 | .name = "AC97 Aux", | 99 | .name = "AC97 Aux", |
100 | .stream_name = "AC97 Aux", | 100 | .stream_name = "AC97 Aux", |
101 | .cpu_dai_name = "pxa-ac97.1", | 101 | .cpu_dai_name = "pxa2xx-ac97-aux", |
102 | .codec_dai_name ="wm9712-aux", | 102 | .codec_dai_name ="wm9712-aux", |
103 | .platform_name = "pxa-pcm-audio", | 103 | .platform_name = "pxa-pcm-audio", |
104 | .codec_name = "wm9712-codec", | 104 | .codec_name = "wm9712-codec", |
diff --git a/sound/soc/pxa/em-x270.c b/sound/soc/pxa/em-x270.c index fc22e6eefc98..b13a4252812d 100644 --- a/sound/soc/pxa/em-x270.c +++ b/sound/soc/pxa/em-x270.c | |||
@@ -37,7 +37,7 @@ static struct snd_soc_dai_link em_x270_dai[] = { | |||
37 | { | 37 | { |
38 | .name = "AC97", | 38 | .name = "AC97", |
39 | .stream_name = "AC97 HiFi", | 39 | .stream_name = "AC97 HiFi", |
40 | .cpu_dai_name = "pxa-ac97.0", | 40 | .cpu_dai_name = "pxa2xx-ac97", |
41 | .codec_dai_name = "wm9712-hifi", | 41 | .codec_dai_name = "wm9712-hifi", |
42 | .platform_name = "pxa-pcm-audio", | 42 | .platform_name = "pxa-pcm-audio", |
43 | .codec_name = "wm9712-codec", | 43 | .codec_name = "wm9712-codec", |
@@ -45,7 +45,7 @@ static struct snd_soc_dai_link em_x270_dai[] = { | |||
45 | { | 45 | { |
46 | .name = "AC97 Aux", | 46 | .name = "AC97 Aux", |
47 | .stream_name = "AC97 Aux", | 47 | .stream_name = "AC97 Aux", |
48 | .cpu_dai_name = "pxa-ac97.1", | 48 | .cpu_dai_name = "pxa2xx-ac97-aux", |
49 | .codec_dai_name ="wm9712-aux", | 49 | .codec_dai_name ="wm9712-aux", |
50 | .platform_name = "pxa-pcm-audio", | 50 | .platform_name = "pxa-pcm-audio", |
51 | .codec_name = "wm9712-codec", | 51 | .codec_name = "wm9712-codec", |
diff --git a/sound/soc/pxa/mioa701_wm9713.c b/sound/soc/pxa/mioa701_wm9713.c index 0d70fc8c12bd..38ca6759907e 100644 --- a/sound/soc/pxa/mioa701_wm9713.c +++ b/sound/soc/pxa/mioa701_wm9713.c | |||
@@ -162,7 +162,7 @@ static struct snd_soc_dai_link mioa701_dai[] = { | |||
162 | { | 162 | { |
163 | .name = "AC97", | 163 | .name = "AC97", |
164 | .stream_name = "AC97 HiFi", | 164 | .stream_name = "AC97 HiFi", |
165 | .cpu_dai_name = "pxa-ac97.0", | 165 | .cpu_dai_name = "pxa2xx-ac97", |
166 | .codec_dai_name = "wm9713-hifi", | 166 | .codec_dai_name = "wm9713-hifi", |
167 | .codec_name = "wm9713-codec", | 167 | .codec_name = "wm9713-codec", |
168 | .init = mioa701_wm9713_init, | 168 | .init = mioa701_wm9713_init, |
@@ -172,7 +172,7 @@ static struct snd_soc_dai_link mioa701_dai[] = { | |||
172 | { | 172 | { |
173 | .name = "AC97 Aux", | 173 | .name = "AC97 Aux", |
174 | .stream_name = "AC97 Aux", | 174 | .stream_name = "AC97 Aux", |
175 | .cpu_dai_name = "pxa-ac97.1", | 175 | .cpu_dai_name = "pxa2xx-ac97-aux", |
176 | .codec_dai_name ="wm9713-aux", | 176 | .codec_dai_name ="wm9713-aux", |
177 | .codec_name = "wm9713-codec", | 177 | .codec_name = "wm9713-codec", |
178 | .platform_name = "pxa-pcm-audio", | 178 | .platform_name = "pxa-pcm-audio", |
diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c index 857db96d4a4f..504e4004f004 100644 --- a/sound/soc/pxa/palm27x.c +++ b/sound/soc/pxa/palm27x.c | |||
@@ -132,7 +132,7 @@ static struct snd_soc_dai_link palm27x_dai[] = { | |||
132 | { | 132 | { |
133 | .name = "AC97 HiFi", | 133 | .name = "AC97 HiFi", |
134 | .stream_name = "AC97 HiFi", | 134 | .stream_name = "AC97 HiFi", |
135 | .cpu_dai_name = "pxa-ac97.0", | 135 | .cpu_dai_name = "pxa2xx-ac97", |
136 | .codec_dai_name = "wm9712-hifi", | 136 | .codec_dai_name = "wm9712-hifi", |
137 | .codec_name = "wm9712-codec", | 137 | .codec_name = "wm9712-codec", |
138 | .platform_name = "pxa-pcm-audio", | 138 | .platform_name = "pxa-pcm-audio", |
@@ -141,7 +141,7 @@ static struct snd_soc_dai_link palm27x_dai[] = { | |||
141 | { | 141 | { |
142 | .name = "AC97 Aux", | 142 | .name = "AC97 Aux", |
143 | .stream_name = "AC97 Aux", | 143 | .stream_name = "AC97 Aux", |
144 | .cpu_dai_name = "pxa-ac97.1", | 144 | .cpu_dai_name = "pxa2xx-ac97-aux", |
145 | .codec_dai_name = "wm9712-aux", | 145 | .codec_dai_name = "wm9712-aux", |
146 | .codec_name = "wm9712-codec", | 146 | .codec_name = "wm9712-codec", |
147 | .platform_name = "pxa-pcm-audio", | 147 | .platform_name = "pxa-pcm-audio", |
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c index f75804ef0897..4b6e5d608b42 100644 --- a/sound/soc/pxa/tosa.c +++ b/sound/soc/pxa/tosa.c | |||
@@ -219,7 +219,7 @@ static struct snd_soc_dai_link tosa_dai[] = { | |||
219 | { | 219 | { |
220 | .name = "AC97", | 220 | .name = "AC97", |
221 | .stream_name = "AC97 HiFi", | 221 | .stream_name = "AC97 HiFi", |
222 | .cpu_dai_name = "pxa-ac97.0", | 222 | .cpu_dai_name = "pxa2xx-ac97", |
223 | .codec_dai_name = "wm9712-hifi", | 223 | .codec_dai_name = "wm9712-hifi", |
224 | .platform_name = "pxa-pcm-audio", | 224 | .platform_name = "pxa-pcm-audio", |
225 | .codec_name = "wm9712-codec", | 225 | .codec_name = "wm9712-codec", |
@@ -229,7 +229,7 @@ static struct snd_soc_dai_link tosa_dai[] = { | |||
229 | { | 229 | { |
230 | .name = "AC97 Aux", | 230 | .name = "AC97 Aux", |
231 | .stream_name = "AC97 Aux", | 231 | .stream_name = "AC97 Aux", |
232 | .cpu_dai_name = "pxa-ac97.1", | 232 | .cpu_dai_name = "pxa2xx-ac97-aux", |
233 | .codec_dai_name = "wm9712-aux", | 233 | .codec_dai_name = "wm9712-aux", |
234 | .platform_name = "pxa-pcm-audio", | 234 | .platform_name = "pxa-pcm-audio", |
235 | .codec_name = "wm9712-codec", | 235 | .codec_name = "wm9712-codec", |
diff --git a/sound/soc/pxa/zylonite.c b/sound/soc/pxa/zylonite.c index b222a7d72027..25bba108fea3 100644 --- a/sound/soc/pxa/zylonite.c +++ b/sound/soc/pxa/zylonite.c | |||
@@ -166,7 +166,7 @@ static struct snd_soc_dai_link zylonite_dai[] = { | |||
166 | .stream_name = "AC97 HiFi", | 166 | .stream_name = "AC97 HiFi", |
167 | .codec_name = "wm9713-codec", | 167 | .codec_name = "wm9713-codec", |
168 | .platform_name = "pxa-pcm-audio", | 168 | .platform_name = "pxa-pcm-audio", |
169 | .cpu_dai_name = "pxa-ac97.0", | 169 | .cpu_dai_name = "pxa2xx-ac97", |
170 | .codec_name = "wm9713-hifi", | 170 | .codec_name = "wm9713-hifi", |
171 | .init = zylonite_wm9713_init, | 171 | .init = zylonite_wm9713_init, |
172 | }, | 172 | }, |
@@ -175,7 +175,7 @@ static struct snd_soc_dai_link zylonite_dai[] = { | |||
175 | .stream_name = "AC97 Aux", | 175 | .stream_name = "AC97 Aux", |
176 | .codec_name = "wm9713-codec", | 176 | .codec_name = "wm9713-codec", |
177 | .platform_name = "pxa-pcm-audio", | 177 | .platform_name = "pxa-pcm-audio", |
178 | .cpu_dai_name = "pxa-ac97.1", | 178 | .cpu_dai_name = "pxa2xx-ac97-aux", |
179 | .codec_name = "wm9713-aux", | 179 | .codec_name = "wm9713-aux", |
180 | }, | 180 | }, |
181 | { | 181 | { |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 8194f150bab7..1790f83ee665 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -712,7 +712,15 @@ static int dapm_supply_check_power(struct snd_soc_dapm_widget *w) | |||
712 | !path->connected(path->source, path->sink)) | 712 | !path->connected(path->source, path->sink)) |
713 | continue; | 713 | continue; |
714 | 714 | ||
715 | if (path->sink && path->sink->power_check && | 715 | if (!path->sink) |
716 | continue; | ||
717 | |||
718 | if (path->sink->force) { | ||
719 | power = 1; | ||
720 | break; | ||
721 | } | ||
722 | |||
723 | if (path->sink->power_check && | ||
716 | path->sink->power_check(path->sink)) { | 724 | path->sink->power_check(path->sink)) { |
717 | power = 1; | 725 | power = 1; |
718 | break; | 726 | break; |
@@ -933,7 +941,7 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm, | |||
933 | } | 941 | } |
934 | 942 | ||
935 | if (!list_empty(&pending)) | 943 | if (!list_empty(&pending)) |
936 | dapm_seq_run_coalesced(dapm, &pending); | 944 | dapm_seq_run_coalesced(cur_dapm, &pending); |
937 | } | 945 | } |
938 | 946 | ||
939 | static void dapm_widget_update(struct snd_soc_dapm_context *dapm) | 947 | static void dapm_widget_update(struct snd_soc_dapm_context *dapm) |
@@ -1627,6 +1635,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_add_routes); | |||
1627 | int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) | 1635 | int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) |
1628 | { | 1636 | { |
1629 | struct snd_soc_dapm_widget *w; | 1637 | struct snd_soc_dapm_widget *w; |
1638 | unsigned int val; | ||
1630 | 1639 | ||
1631 | list_for_each_entry(w, &dapm->card->widgets, list) | 1640 | list_for_each_entry(w, &dapm->card->widgets, list) |
1632 | { | 1641 | { |
@@ -1675,6 +1684,18 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) | |||
1675 | case snd_soc_dapm_post: | 1684 | case snd_soc_dapm_post: |
1676 | break; | 1685 | break; |
1677 | } | 1686 | } |
1687 | |||
1688 | /* Read the initial power state from the device */ | ||
1689 | if (w->reg >= 0) { | ||
1690 | val = snd_soc_read(w->codec, w->reg); | ||
1691 | val &= 1 << w->shift; | ||
1692 | if (w->invert) | ||
1693 | val = !val; | ||
1694 | |||
1695 | if (val) | ||
1696 | w->power = 1; | ||
1697 | } | ||
1698 | |||
1678 | w->new = 1; | 1699 | w->new = 1; |
1679 | } | 1700 | } |
1680 | 1701 | ||
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c index 68b97477577b..66eabafb1c24 100644 --- a/sound/usb/caiaq/audio.c +++ b/sound/usb/caiaq/audio.c | |||
@@ -785,7 +785,7 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *dev) | |||
785 | } | 785 | } |
786 | 786 | ||
787 | dev->pcm->private_data = dev; | 787 | dev->pcm->private_data = dev; |
788 | strcpy(dev->pcm->name, dev->product_name); | 788 | strlcpy(dev->pcm->name, dev->product_name, sizeof(dev->pcm->name)); |
789 | 789 | ||
790 | memset(dev->sub_playback, 0, sizeof(dev->sub_playback)); | 790 | memset(dev->sub_playback, 0, sizeof(dev->sub_playback)); |
791 | memset(dev->sub_capture, 0, sizeof(dev->sub_capture)); | 791 | memset(dev->sub_capture, 0, sizeof(dev->sub_capture)); |
diff --git a/sound/usb/caiaq/midi.c b/sound/usb/caiaq/midi.c index 2f218c77fff2..a1a47088fd0c 100644 --- a/sound/usb/caiaq/midi.c +++ b/sound/usb/caiaq/midi.c | |||
@@ -136,7 +136,7 @@ int snd_usb_caiaq_midi_init(struct snd_usb_caiaqdev *device) | |||
136 | if (ret < 0) | 136 | if (ret < 0) |
137 | return ret; | 137 | return ret; |
138 | 138 | ||
139 | strcpy(rmidi->name, device->product_name); | 139 | strlcpy(rmidi->name, device->product_name, sizeof(rmidi->name)); |
140 | 140 | ||
141 | rmidi->info_flags = SNDRV_RAWMIDI_INFO_DUPLEX; | 141 | rmidi->info_flags = SNDRV_RAWMIDI_INFO_DUPLEX; |
142 | rmidi->private_data = device; | 142 | rmidi->private_data = device; |
diff --git a/sound/usb/card.c b/sound/usb/card.c index 800f7cb4f251..c0f8270bc199 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c | |||
@@ -323,6 +323,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, | |||
323 | return -ENOMEM; | 323 | return -ENOMEM; |
324 | } | 324 | } |
325 | 325 | ||
326 | mutex_init(&chip->shutdown_mutex); | ||
326 | chip->index = idx; | 327 | chip->index = idx; |
327 | chip->dev = dev; | 328 | chip->dev = dev; |
328 | chip->card = card; | 329 | chip->card = card; |
@@ -531,6 +532,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) | |||
531 | chip = ptr; | 532 | chip = ptr; |
532 | card = chip->card; | 533 | card = chip->card; |
533 | mutex_lock(®ister_mutex); | 534 | mutex_lock(®ister_mutex); |
535 | mutex_lock(&chip->shutdown_mutex); | ||
534 | chip->shutdown = 1; | 536 | chip->shutdown = 1; |
535 | chip->num_interfaces--; | 537 | chip->num_interfaces--; |
536 | if (chip->num_interfaces <= 0) { | 538 | if (chip->num_interfaces <= 0) { |
@@ -548,9 +550,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) | |||
548 | snd_usb_mixer_disconnect(p); | 550 | snd_usb_mixer_disconnect(p); |
549 | } | 551 | } |
550 | usb_chip[chip->index] = NULL; | 552 | usb_chip[chip->index] = NULL; |
553 | mutex_unlock(&chip->shutdown_mutex); | ||
551 | mutex_unlock(®ister_mutex); | 554 | mutex_unlock(®ister_mutex); |
552 | snd_card_free_when_closed(card); | 555 | snd_card_free_when_closed(card); |
553 | } else { | 556 | } else { |
557 | mutex_unlock(&chip->shutdown_mutex); | ||
554 | mutex_unlock(®ister_mutex); | 558 | mutex_unlock(®ister_mutex); |
555 | } | 559 | } |
556 | } | 560 | } |
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 4132522ac90f..e3f680526cb5 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c | |||
@@ -361,6 +361,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, | |||
361 | } | 361 | } |
362 | 362 | ||
363 | if (changed) { | 363 | if (changed) { |
364 | mutex_lock(&subs->stream->chip->shutdown_mutex); | ||
364 | /* format changed */ | 365 | /* format changed */ |
365 | snd_usb_release_substream_urbs(subs, 0); | 366 | snd_usb_release_substream_urbs(subs, 0); |
366 | /* influenced: period_bytes, channels, rate, format, */ | 367 | /* influenced: period_bytes, channels, rate, format, */ |
@@ -368,6 +369,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, | |||
368 | params_rate(hw_params), | 369 | params_rate(hw_params), |
369 | snd_pcm_format_physical_width(params_format(hw_params)) * | 370 | snd_pcm_format_physical_width(params_format(hw_params)) * |
370 | params_channels(hw_params)); | 371 | params_channels(hw_params)); |
372 | mutex_unlock(&subs->stream->chip->shutdown_mutex); | ||
371 | } | 373 | } |
372 | 374 | ||
373 | return ret; | 375 | return ret; |
@@ -385,8 +387,9 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream) | |||
385 | subs->cur_audiofmt = NULL; | 387 | subs->cur_audiofmt = NULL; |
386 | subs->cur_rate = 0; | 388 | subs->cur_rate = 0; |
387 | subs->period_bytes = 0; | 389 | subs->period_bytes = 0; |
388 | if (!subs->stream->chip->shutdown) | 390 | mutex_lock(&subs->stream->chip->shutdown_mutex); |
389 | snd_usb_release_substream_urbs(subs, 0); | 391 | snd_usb_release_substream_urbs(subs, 0); |
392 | mutex_unlock(&subs->stream->chip->shutdown_mutex); | ||
390 | return snd_pcm_lib_free_vmalloc_buffer(substream); | 393 | return snd_pcm_lib_free_vmalloc_buffer(substream); |
391 | } | 394 | } |
392 | 395 | ||
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index db3eb21627ee..6e66fffe87f5 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -36,6 +36,7 @@ struct snd_usb_audio { | |||
36 | struct snd_card *card; | 36 | struct snd_card *card; |
37 | u32 usb_id; | 37 | u32 usb_id; |
38 | int shutdown; | 38 | int shutdown; |
39 | struct mutex shutdown_mutex; | ||
39 | unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */ | 40 | unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */ |
40 | int num_interfaces; | 41 | int num_interfaces; |
41 | int num_suspended_intf; | 42 | int num_suspended_intf; |
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 746cf03cb05d..0ace786e83e0 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
@@ -264,9 +264,6 @@ pid_put_sample(int pid, int type, unsigned int cpu, u64 start, u64 end) | |||
264 | c->start_time = start; | 264 | c->start_time = start; |
265 | if (p->start_time == 0 || p->start_time > start) | 265 | if (p->start_time == 0 || p->start_time > start) |
266 | p->start_time = start; | 266 | p->start_time = start; |
267 | |||
268 | if (cpu > numcpus) | ||
269 | numcpus = cpu; | ||
270 | } | 267 | } |
271 | 268 | ||
272 | #define MAX_CPUS 4096 | 269 | #define MAX_CPUS 4096 |
@@ -511,6 +508,9 @@ static int process_sample_event(event_t *event __used, | |||
511 | if (!event_str) | 508 | if (!event_str) |
512 | return 0; | 509 | return 0; |
513 | 510 | ||
511 | if (sample->cpu > numcpus) | ||
512 | numcpus = sample->cpu; | ||
513 | |||
514 | if (strcmp(event_str, "power:cpu_idle") == 0) { | 514 | if (strcmp(event_str, "power:cpu_idle") == 0) { |
515 | struct power_processor_entry *ppe = (void *)te; | 515 | struct power_processor_entry *ppe = (void *)te; |
516 | if (ppe->state == (u32)PWR_EVENT_EXIT) | 516 | if (ppe->state == (u32)PWR_EVENT_EXIT) |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index f6a929e74981..0866bcdb5e8e 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -270,11 +270,15 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, | |||
270 | const char *name, bool is_kallsyms) | 270 | const char *name, bool is_kallsyms) |
271 | { | 271 | { |
272 | const size_t size = PATH_MAX; | 272 | const size_t size = PATH_MAX; |
273 | char *realname = realpath(name, NULL), | 273 | char *realname, *filename = malloc(size), |
274 | *filename = malloc(size), | ||
275 | *linkname = malloc(size), *targetname; | 274 | *linkname = malloc(size), *targetname; |
276 | int len, err = -1; | 275 | int len, err = -1; |
277 | 276 | ||
277 | if (is_kallsyms) | ||
278 | realname = (char *)name; | ||
279 | else | ||
280 | realname = realpath(name, NULL); | ||
281 | |||
278 | if (realname == NULL || filename == NULL || linkname == NULL) | 282 | if (realname == NULL || filename == NULL || linkname == NULL) |
279 | goto out_free; | 283 | goto out_free; |
280 | 284 | ||
@@ -306,7 +310,8 @@ int build_id_cache__add_s(const char *sbuild_id, const char *debugdir, | |||
306 | if (symlink(targetname, linkname) == 0) | 310 | if (symlink(targetname, linkname) == 0) |
307 | err = 0; | 311 | err = 0; |
308 | out_free: | 312 | out_free: |
309 | free(realname); | 313 | if (!is_kallsyms) |
314 | free(realname); | ||
310 | free(filename); | 315 | free(filename); |
311 | free(linkname); | 316 | free(linkname); |
312 | return err; | 317 | return err; |
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 32f4f1f2f6e4..df51560f16f7 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -585,6 +585,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
585 | { | 585 | { |
586 | struct sort_entry *se; | 586 | struct sort_entry *se; |
587 | u64 period, total, period_sys, period_us, period_guest_sys, period_guest_us; | 587 | u64 period, total, period_sys, period_us, period_guest_sys, period_guest_us; |
588 | u64 nr_events; | ||
588 | const char *sep = symbol_conf.field_sep; | 589 | const char *sep = symbol_conf.field_sep; |
589 | int ret; | 590 | int ret; |
590 | 591 | ||
@@ -593,6 +594,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
593 | 594 | ||
594 | if (pair_hists) { | 595 | if (pair_hists) { |
595 | period = self->pair ? self->pair->period : 0; | 596 | period = self->pair ? self->pair->period : 0; |
597 | nr_events = self->pair ? self->pair->nr_events : 0; | ||
596 | total = pair_hists->stats.total_period; | 598 | total = pair_hists->stats.total_period; |
597 | period_sys = self->pair ? self->pair->period_sys : 0; | 599 | period_sys = self->pair ? self->pair->period_sys : 0; |
598 | period_us = self->pair ? self->pair->period_us : 0; | 600 | period_us = self->pair ? self->pair->period_us : 0; |
@@ -600,6 +602,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
600 | period_guest_us = self->pair ? self->pair->period_guest_us : 0; | 602 | period_guest_us = self->pair ? self->pair->period_guest_us : 0; |
601 | } else { | 603 | } else { |
602 | period = self->period; | 604 | period = self->period; |
605 | nr_events = self->nr_events; | ||
603 | total = session_total; | 606 | total = session_total; |
604 | period_sys = self->period_sys; | 607 | period_sys = self->period_sys; |
605 | period_us = self->period_us; | 608 | period_us = self->period_us; |
@@ -640,9 +643,9 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
640 | 643 | ||
641 | if (symbol_conf.show_nr_samples) { | 644 | if (symbol_conf.show_nr_samples) { |
642 | if (sep) | 645 | if (sep) |
643 | ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period); | 646 | ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, nr_events); |
644 | else | 647 | else |
645 | ret += snprintf(s + ret, size - ret, "%11" PRIu64, period); | 648 | ret += snprintf(s + ret, size - ret, "%11" PRIu64, nr_events); |
646 | } | 649 | } |
647 | 650 | ||
648 | if (pair_hists) { | 651 | if (pair_hists) { |
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c index fb737fe9be91..96c866045d60 100644 --- a/tools/perf/util/svghelper.c +++ b/tools/perf/util/svghelper.c | |||
@@ -456,9 +456,9 @@ void svg_legenda(void) | |||
456 | return; | 456 | return; |
457 | 457 | ||
458 | svg_legenda_box(0, "Running", "sample"); | 458 | svg_legenda_box(0, "Running", "sample"); |
459 | svg_legenda_box(100, "Idle","rect.c1"); | 459 | svg_legenda_box(100, "Idle","c1"); |
460 | svg_legenda_box(200, "Deeper Idle", "rect.c3"); | 460 | svg_legenda_box(200, "Deeper Idle", "c3"); |
461 | svg_legenda_box(350, "Deepest Idle", "rect.c6"); | 461 | svg_legenda_box(350, "Deepest Idle", "c6"); |
462 | svg_legenda_box(550, "Sleeping", "process2"); | 462 | svg_legenda_box(550, "Sleeping", "process2"); |
463 | svg_legenda_box(650, "Waiting for cpu", "waiting"); | 463 | svg_legenda_box(650, "Waiting for cpu", "waiting"); |
464 | svg_legenda_box(800, "Blocked on IO", "blocked"); | 464 | svg_legenda_box(800, "Blocked on IO", "blocked"); |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 7821d0e6866f..b1bf490aff88 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -1836,7 +1836,7 @@ int dso__load_vmlinux(struct dso *self, struct map *map, | |||
1836 | int err = -1, fd; | 1836 | int err = -1, fd; |
1837 | char symfs_vmlinux[PATH_MAX]; | 1837 | char symfs_vmlinux[PATH_MAX]; |
1838 | 1838 | ||
1839 | snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s/%s", | 1839 | snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s%s", |
1840 | symbol_conf.symfs, vmlinux); | 1840 | symbol_conf.symfs, vmlinux); |
1841 | fd = open(symfs_vmlinux, O_RDONLY); | 1841 | fd = open(symfs_vmlinux, O_RDONLY); |
1842 | if (fd < 0) | 1842 | if (fd < 0) |