diff options
204 files changed, 1730 insertions, 1068 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking index 61c98f03baa1..96d4293607ec 100644 --- a/Documentation/filesystems/Locking +++ b/Documentation/filesystems/Locking | |||
@@ -380,7 +380,7 @@ prototypes: | |||
380 | int (*open) (struct inode *, struct file *); | 380 | int (*open) (struct inode *, struct file *); |
381 | int (*flush) (struct file *); | 381 | int (*flush) (struct file *); |
382 | int (*release) (struct inode *, struct file *); | 382 | int (*release) (struct inode *, struct file *); |
383 | int (*fsync) (struct file *, struct dentry *, int datasync); | 383 | int (*fsync) (struct file *, int datasync); |
384 | int (*aio_fsync) (struct kiocb *, int datasync); | 384 | int (*aio_fsync) (struct kiocb *, int datasync); |
385 | int (*fasync) (int, struct file *, int); | 385 | int (*fasync) (int, struct file *, int); |
386 | int (*lock) (struct file *, int, struct file_lock *); | 386 | int (*lock) (struct file *, int, struct file_lock *); |
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index b66858538df5..94677e7dcb13 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -401,11 +401,16 @@ otherwise noted. | |||
401 | started might not be in the page cache at the end of the | 401 | started might not be in the page cache at the end of the |
402 | walk). | 402 | walk). |
403 | 403 | ||
404 | truncate: called by the VFS to change the size of a file. The | 404 | truncate: Deprecated. This will not be called if ->setsize is defined. |
405 | Called by the VFS to change the size of a file. The | ||
405 | i_size field of the inode is set to the desired size by the | 406 | i_size field of the inode is set to the desired size by the |
406 | VFS before this method is called. This method is called by | 407 | VFS before this method is called. This method is called by |
407 | the truncate(2) system call and related functionality. | 408 | the truncate(2) system call and related functionality. |
408 | 409 | ||
410 | Note: ->truncate and vmtruncate are deprecated. Do not add new | ||
411 | instances/calls of these. Filesystems should be converted to do their | ||
412 | truncate sequence via ->setattr(). | ||
413 | |||
409 | permission: called by the VFS to check for access rights on a POSIX-like | 414 | permission: called by the VFS to check for access rights on a POSIX-like |
410 | filesystem. | 415 | filesystem. |
411 | 416 | ||
@@ -729,7 +734,7 @@ struct file_operations { | |||
729 | int (*open) (struct inode *, struct file *); | 734 | int (*open) (struct inode *, struct file *); |
730 | int (*flush) (struct file *); | 735 | int (*flush) (struct file *); |
731 | int (*release) (struct inode *, struct file *); | 736 | int (*release) (struct inode *, struct file *); |
732 | int (*fsync) (struct file *, struct dentry *, int datasync); | 737 | int (*fsync) (struct file *, int datasync); |
733 | int (*aio_fsync) (struct kiocb *, int datasync); | 738 | int (*aio_fsync) (struct kiocb *, int datasync); |
734 | int (*fasync) (int, struct file *, int); | 739 | int (*fasync) (int, struct file *, int); |
735 | int (*lock) (struct file *, int, struct file_lock *); | 740 | int (*lock) (struct file *, int, struct file_lock *); |
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index b56ea860da21..a5c055066764 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -1252,6 +1252,8 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1252 | * nohrst, nosrst, norst: suppress hard, soft | 1252 | * nohrst, nosrst, norst: suppress hard, soft |
1253 | and both resets. | 1253 | and both resets. |
1254 | 1254 | ||
1255 | * dump_id: dump IDENTIFY data. | ||
1256 | |||
1255 | If there are multiple matching configurations changing | 1257 | If there are multiple matching configurations changing |
1256 | the same attribute, the last one is used. | 1258 | the same attribute, the last one is used. |
1257 | 1259 | ||
diff --git a/arch/frv/include/asm/cache.h b/arch/frv/include/asm/cache.h index 7dc0f0f85b7c..2797163b8f4f 100644 --- a/arch/frv/include/asm/cache.h +++ b/arch/frv/include/asm/cache.h | |||
@@ -17,8 +17,6 @@ | |||
17 | #define L1_CACHE_SHIFT (CONFIG_FRV_L1_CACHE_SHIFT) | 17 | #define L1_CACHE_SHIFT (CONFIG_FRV_L1_CACHE_SHIFT) |
18 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) | 18 | #define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT) |
19 | 19 | ||
20 | #define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES | ||
21 | |||
22 | #define __cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES))) | 20 | #define __cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES))) |
23 | #define ____cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES))) | 21 | #define ____cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES))) |
24 | 22 | ||
diff --git a/arch/frv/include/asm/mem-layout.h b/arch/frv/include/asm/mem-layout.h index 2947764fc0e0..ccae981876fa 100644 --- a/arch/frv/include/asm/mem-layout.h +++ b/arch/frv/include/asm/mem-layout.h | |||
@@ -35,8 +35,8 @@ | |||
35 | * the slab must be aligned such that load- and store-double instructions don't | 35 | * the slab must be aligned such that load- and store-double instructions don't |
36 | * fault if used | 36 | * fault if used |
37 | */ | 37 | */ |
38 | #define ARCH_KMALLOC_MINALIGN 8 | 38 | #define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES |
39 | #define ARCH_SLAB_MINALIGN 8 | 39 | #define ARCH_SLAB_MINALIGN L1_CACHE_BYTES |
40 | 40 | ||
41 | /*****************************************************************************/ | 41 | /*****************************************************************************/ |
42 | /* | 42 | /* |
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c index 5c2808252516..1a40da92154c 100644 --- a/arch/powerpc/platforms/cell/spufs/file.c +++ b/arch/powerpc/platforms/cell/spufs/file.c | |||
@@ -1849,8 +1849,7 @@ out: | |||
1849 | return ret; | 1849 | return ret; |
1850 | } | 1850 | } |
1851 | 1851 | ||
1852 | static int spufs_mfc_fsync(struct file *file, struct dentry *dentry, | 1852 | static int spufs_mfc_fsync(struct file *file, int datasync) |
1853 | int datasync) | ||
1854 | { | 1853 | { |
1855 | return spufs_mfc_flush(file, NULL); | 1854 | return spufs_mfc_flush(file, NULL); |
1856 | } | 1855 | } |
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index fc1b1c42b1dc..e5e5f823d687 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c | |||
@@ -251,7 +251,7 @@ const struct file_operations spufs_context_fops = { | |||
251 | .llseek = dcache_dir_lseek, | 251 | .llseek = dcache_dir_lseek, |
252 | .read = generic_read_dir, | 252 | .read = generic_read_dir, |
253 | .readdir = dcache_readdir, | 253 | .readdir = dcache_readdir, |
254 | .fsync = simple_sync_file, | 254 | .fsync = noop_fsync, |
255 | }; | 255 | }; |
256 | EXPORT_SYMBOL_GPL(spufs_context_fops); | 256 | EXPORT_SYMBOL_GPL(spufs_context_fops); |
257 | 257 | ||
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index e68541f662b9..73f883333a0d 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -57,6 +57,8 @@ config SATA_PMP | |||
57 | This option adds support for SATA Port Multipliers | 57 | This option adds support for SATA Port Multipliers |
58 | (the SATA version of an ethernet hub, or SAS expander). | 58 | (the SATA version of an ethernet hub, or SAS expander). |
59 | 59 | ||
60 | comment "Controllers with non-SFF native interface" | ||
61 | |||
60 | config SATA_AHCI | 62 | config SATA_AHCI |
61 | tristate "AHCI SATA support" | 63 | tristate "AHCI SATA support" |
62 | depends on PCI | 64 | depends on PCI |
@@ -73,11 +75,12 @@ config SATA_AHCI_PLATFORM | |||
73 | 75 | ||
74 | If unsure, say N. | 76 | If unsure, say N. |
75 | 77 | ||
76 | config SATA_SIL24 | 78 | config SATA_FSL |
77 | tristate "Silicon Image 3124/3132 SATA support" | 79 | tristate "Freescale 3.0Gbps SATA support" |
78 | depends on PCI | 80 | depends on FSL_SOC |
79 | help | 81 | help |
80 | This option enables support for Silicon Image 3124/3132 Serial ATA. | 82 | This option enables support for Freescale 3.0Gbps SATA controller. |
83 | It can be found on MPC837x and MPC8315. | ||
81 | 84 | ||
82 | If unsure, say N. | 85 | If unsure, say N. |
83 | 86 | ||
@@ -87,12 +90,11 @@ config SATA_INIC162X | |||
87 | help | 90 | help |
88 | This option enables support for Initio 162x Serial ATA. | 91 | This option enables support for Initio 162x Serial ATA. |
89 | 92 | ||
90 | config SATA_FSL | 93 | config SATA_SIL24 |
91 | tristate "Freescale 3.0Gbps SATA support" | 94 | tristate "Silicon Image 3124/3132 SATA support" |
92 | depends on FSL_SOC | 95 | depends on PCI |
93 | help | 96 | help |
94 | This option enables support for Freescale 3.0Gbps SATA controller. | 97 | This option enables support for Silicon Image 3124/3132 Serial ATA. |
95 | It can be found on MPC837x and MPC8315. | ||
96 | 98 | ||
97 | If unsure, say N. | 99 | If unsure, say N. |
98 | 100 | ||
@@ -116,15 +118,65 @@ config ATA_SFF | |||
116 | 118 | ||
117 | if ATA_SFF | 119 | if ATA_SFF |
118 | 120 | ||
119 | config SATA_SVW | 121 | comment "SFF controllers with custom DMA interface" |
120 | tristate "ServerWorks Frodo / Apple K2 SATA support" | 122 | |
123 | config PDC_ADMA | ||
124 | tristate "Pacific Digital ADMA support" | ||
121 | depends on PCI | 125 | depends on PCI |
122 | help | 126 | help |
123 | This option enables support for Broadcom/Serverworks/Apple K2 | 127 | This option enables support for Pacific Digital ADMA controllers |
124 | SATA support. | 128 | |
129 | If unsure, say N. | ||
130 | |||
131 | config PATA_MPC52xx | ||
132 | tristate "Freescale MPC52xx SoC internal IDE" | ||
133 | depends on PPC_MPC52xx && PPC_BESTCOMM | ||
134 | select PPC_BESTCOMM_ATA | ||
135 | help | ||
136 | This option enables support for integrated IDE controller | ||
137 | of the Freescale MPC52xx SoC. | ||
138 | |||
139 | If unsure, say N. | ||
140 | |||
141 | config PATA_OCTEON_CF | ||
142 | tristate "OCTEON Boot Bus Compact Flash support" | ||
143 | depends on CPU_CAVIUM_OCTEON | ||
144 | help | ||
145 | This option enables a polled compact flash driver for use with | ||
146 | compact flash cards attached to the OCTEON boot bus. | ||
147 | |||
148 | If unsure, say N. | ||
149 | |||
150 | config SATA_QSTOR | ||
151 | tristate "Pacific Digital SATA QStor support" | ||
152 | depends on PCI | ||
153 | help | ||
154 | This option enables support for Pacific Digital Serial ATA QStor. | ||
155 | |||
156 | If unsure, say N. | ||
157 | |||
158 | config SATA_SX4 | ||
159 | tristate "Promise SATA SX4 support (Experimental)" | ||
160 | depends on PCI && EXPERIMENTAL | ||
161 | help | ||
162 | This option enables support for Promise Serial ATA SX4. | ||
125 | 163 | ||
126 | If unsure, say N. | 164 | If unsure, say N. |
127 | 165 | ||
166 | config ATA_BMDMA | ||
167 | bool "ATA BMDMA support" | ||
168 | default y | ||
169 | help | ||
170 | This option adds support for SFF ATA controllers with BMDMA | ||
171 | capability. BMDMA stands for bus-master DMA and the | ||
172 | de-facto DMA interface for SFF controllers. | ||
173 | |||
174 | If unuser, say Y. | ||
175 | |||
176 | if ATA_BMDMA | ||
177 | |||
178 | comment "SATA SFF controllers with BMDMA" | ||
179 | |||
128 | config ATA_PIIX | 180 | config ATA_PIIX |
129 | tristate "Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support" | 181 | tristate "Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support" |
130 | depends on PCI | 182 | depends on PCI |
@@ -152,22 +204,6 @@ config SATA_NV | |||
152 | 204 | ||
153 | If unsure, say N. | 205 | If unsure, say N. |
154 | 206 | ||
155 | config PDC_ADMA | ||
156 | tristate "Pacific Digital ADMA support" | ||
157 | depends on PCI | ||
158 | help | ||
159 | This option enables support for Pacific Digital ADMA controllers | ||
160 | |||
161 | If unsure, say N. | ||
162 | |||
163 | config SATA_QSTOR | ||
164 | tristate "Pacific Digital SATA QStor support" | ||
165 | depends on PCI | ||
166 | help | ||
167 | This option enables support for Pacific Digital Serial ATA QStor. | ||
168 | |||
169 | If unsure, say N. | ||
170 | |||
171 | config SATA_PROMISE | 207 | config SATA_PROMISE |
172 | tristate "Promise SATA TX2/TX4 support" | 208 | tristate "Promise SATA TX2/TX4 support" |
173 | depends on PCI | 209 | depends on PCI |
@@ -176,14 +212,6 @@ config SATA_PROMISE | |||
176 | 212 | ||
177 | If unsure, say N. | 213 | If unsure, say N. |
178 | 214 | ||
179 | config SATA_SX4 | ||
180 | tristate "Promise SATA SX4 support (Experimental)" | ||
181 | depends on PCI && EXPERIMENTAL | ||
182 | help | ||
183 | This option enables support for Promise Serial ATA SX4. | ||
184 | |||
185 | If unsure, say N. | ||
186 | |||
187 | config SATA_SIL | 215 | config SATA_SIL |
188 | tristate "Silicon Image SATA support" | 216 | tristate "Silicon Image SATA support" |
189 | depends on PCI | 217 | depends on PCI |
@@ -203,6 +231,15 @@ config SATA_SIS | |||
203 | enable the PATA_SIS driver in the config. | 231 | enable the PATA_SIS driver in the config. |
204 | If unsure, say N. | 232 | If unsure, say N. |
205 | 233 | ||
234 | config SATA_SVW | ||
235 | tristate "ServerWorks Frodo / Apple K2 SATA support" | ||
236 | depends on PCI | ||
237 | help | ||
238 | This option enables support for Broadcom/Serverworks/Apple K2 | ||
239 | SATA support. | ||
240 | |||
241 | If unsure, say N. | ||
242 | |||
206 | config SATA_ULI | 243 | config SATA_ULI |
207 | tristate "ULi Electronics SATA support" | 244 | tristate "ULi Electronics SATA support" |
208 | depends on PCI | 245 | depends on PCI |
@@ -227,14 +264,7 @@ config SATA_VITESSE | |||
227 | 264 | ||
228 | If unsure, say N. | 265 | If unsure, say N. |
229 | 266 | ||
230 | config PATA_ACPI | 267 | comment "PATA SFF controllers with BMDMA" |
231 | tristate "ACPI firmware driver for PATA" | ||
232 | depends on ATA_ACPI | ||
233 | help | ||
234 | This option enables an ACPI method driver which drives | ||
235 | motherboard PATA controller interfaces through the ACPI | ||
236 | firmware in the BIOS. This driver can sometimes handle | ||
237 | otherwise unsupported hardware. | ||
238 | 268 | ||
239 | config PATA_ALI | 269 | config PATA_ALI |
240 | tristate "ALi PATA support" | 270 | tristate "ALi PATA support" |
@@ -262,40 +292,30 @@ config PATA_ARTOP | |||
262 | 292 | ||
263 | If unsure, say N. | 293 | If unsure, say N. |
264 | 294 | ||
265 | config PATA_ATP867X | 295 | config PATA_ATIIXP |
266 | tristate "ARTOP/Acard ATP867X PATA support" | 296 | tristate "ATI PATA support" |
267 | depends on PCI | 297 | depends on PCI |
268 | help | 298 | help |
269 | This option enables support for ARTOP/Acard ATP867X PATA | 299 | This option enables support for the ATI ATA interfaces |
270 | controllers. | 300 | found on the many ATI chipsets. |
271 | |||
272 | If unsure, say N. | ||
273 | |||
274 | config PATA_AT32 | ||
275 | tristate "Atmel AVR32 PATA support (Experimental)" | ||
276 | depends on AVR32 && PLATFORM_AT32AP && EXPERIMENTAL | ||
277 | help | ||
278 | This option enables support for the IDE devices on the | ||
279 | Atmel AT32AP platform. | ||
280 | 301 | ||
281 | If unsure, say N. | 302 | If unsure, say N. |
282 | 303 | ||
283 | config PATA_ATIIXP | 304 | config PATA_ATP867X |
284 | tristate "ATI PATA support" | 305 | tristate "ARTOP/Acard ATP867X PATA support" |
285 | depends on PCI | 306 | depends on PCI |
286 | help | 307 | help |
287 | This option enables support for the ATI ATA interfaces | 308 | This option enables support for ARTOP/Acard ATP867X PATA |
288 | found on the many ATI chipsets. | 309 | controllers. |
289 | 310 | ||
290 | If unsure, say N. | 311 | If unsure, say N. |
291 | 312 | ||
292 | config PATA_CMD640_PCI | 313 | config PATA_BF54X |
293 | tristate "CMD640 PCI PATA support (Experimental)" | 314 | tristate "Blackfin 54x ATAPI support" |
294 | depends on PCI && EXPERIMENTAL | 315 | depends on BF542 || BF548 || BF549 |
295 | help | 316 | help |
296 | This option enables support for the CMD640 PCI IDE | 317 | This option enables support for the built-in ATAPI controller on |
297 | interface chip. Only the primary channel is currently | 318 | Blackfin 54x family chips. |
298 | supported. | ||
299 | 319 | ||
300 | If unsure, say N. | 320 | If unsure, say N. |
301 | 321 | ||
@@ -362,15 +382,6 @@ config PATA_EFAR | |||
362 | 382 | ||
363 | If unsure, say N. | 383 | If unsure, say N. |
364 | 384 | ||
365 | config ATA_GENERIC | ||
366 | tristate "Generic ATA support" | ||
367 | depends on PCI | ||
368 | help | ||
369 | This option enables support for generic BIOS configured | ||
370 | ATA controllers via the new ATA layer | ||
371 | |||
372 | If unsure, say N. | ||
373 | |||
374 | config PATA_HPT366 | 385 | config PATA_HPT366 |
375 | tristate "HPT 366/368 PATA support" | 386 | tristate "HPT 366/368 PATA support" |
376 | depends on PCI | 387 | depends on PCI |
@@ -415,12 +426,20 @@ config PATA_HPT3X3_DMA | |||
415 | controllers. Enable with care as there are still some | 426 | controllers. Enable with care as there are still some |
416 | problems with DMA on this chipset. | 427 | problems with DMA on this chipset. |
417 | 428 | ||
418 | config PATA_ISAPNP | 429 | config PATA_ICSIDE |
419 | tristate "ISA Plug and Play PATA support" | 430 | tristate "Acorn ICS PATA support" |
420 | depends on ISAPNP | 431 | depends on ARM && ARCH_ACORN |
421 | help | 432 | help |
422 | This option enables support for ISA plug & play ATA | 433 | On Acorn systems, say Y here if you wish to use the ICS PATA |
423 | controllers such as those found on old soundcards. | 434 | interface card. This is not required for ICS partition support. |
435 | If you are unsure, say N to this. | ||
436 | |||
437 | config PATA_IT8213 | ||
438 | tristate "IT8213 PATA support (Experimental)" | ||
439 | depends on PCI && EXPERIMENTAL | ||
440 | help | ||
441 | This option enables support for the ITE 821 PATA | ||
442 | controllers via the new ATA layer. | ||
424 | 443 | ||
425 | If unsure, say N. | 444 | If unsure, say N. |
426 | 445 | ||
@@ -434,15 +453,6 @@ config PATA_IT821X | |||
434 | 453 | ||
435 | If unsure, say N. | 454 | If unsure, say N. |
436 | 455 | ||
437 | config PATA_IT8213 | ||
438 | tristate "IT8213 PATA support (Experimental)" | ||
439 | depends on PCI && EXPERIMENTAL | ||
440 | help | ||
441 | This option enables support for the ITE 821 PATA | ||
442 | controllers via the new ATA layer. | ||
443 | |||
444 | If unsure, say N. | ||
445 | |||
446 | config PATA_JMICRON | 456 | config PATA_JMICRON |
447 | tristate "JMicron PATA support" | 457 | tristate "JMicron PATA support" |
448 | depends on PCI | 458 | depends on PCI |
@@ -452,23 +462,14 @@ config PATA_JMICRON | |||
452 | 462 | ||
453 | If unsure, say N. | 463 | If unsure, say N. |
454 | 464 | ||
455 | config PATA_LEGACY | 465 | config PATA_MACIO |
456 | tristate "Legacy ISA PATA support (Experimental)" | 466 | tristate "Apple PowerMac/PowerBook internal 'MacIO' IDE" |
457 | depends on (ISA || PCI) && EXPERIMENTAL | 467 | depends on PPC_PMAC |
458 | help | ||
459 | This option enables support for ISA/VLB/PCI bus legacy PATA | ||
460 | ports and allows them to be accessed via the new ATA layer. | ||
461 | |||
462 | If unsure, say N. | ||
463 | |||
464 | config PATA_TRIFLEX | ||
465 | tristate "Compaq Triflex PATA support" | ||
466 | depends on PCI | ||
467 | help | 468 | help |
468 | Enable support for the Compaq 'Triflex' IDE controller as found | 469 | Most IDE capable PowerMacs have IDE busses driven by a variant |
469 | on many Compaq Pentium-Pro systems, via the new ATA layer. | 470 | of this controller which is part of the Apple chipset used on |
470 | 471 | most PowerMac models. Some models have multiple busses using | |
471 | If unsure, say N. | 472 | different chipsets, though generally, MacIO is one of them. |
472 | 473 | ||
473 | config PATA_MARVELL | 474 | config PATA_MARVELL |
474 | tristate "Marvell PATA support via legacy mode" | 475 | tristate "Marvell PATA support via legacy mode" |
@@ -481,32 +482,6 @@ config PATA_MARVELL | |||
481 | 482 | ||
482 | If unsure, say N. | 483 | If unsure, say N. |
483 | 484 | ||
484 | config PATA_MPC52xx | ||
485 | tristate "Freescale MPC52xx SoC internal IDE" | ||
486 | depends on PPC_MPC52xx && PPC_BESTCOMM | ||
487 | select PPC_BESTCOMM_ATA | ||
488 | help | ||
489 | This option enables support for integrated IDE controller | ||
490 | of the Freescale MPC52xx SoC. | ||
491 | |||
492 | If unsure, say N. | ||
493 | |||
494 | config PATA_MPIIX | ||
495 | tristate "Intel PATA MPIIX support" | ||
496 | depends on PCI | ||
497 | help | ||
498 | This option enables support for MPIIX PATA support. | ||
499 | |||
500 | If unsure, say N. | ||
501 | |||
502 | config PATA_OLDPIIX | ||
503 | tristate "Intel PATA old PIIX support" | ||
504 | depends on PCI | ||
505 | help | ||
506 | This option enables support for early PIIX PATA support. | ||
507 | |||
508 | If unsure, say N. | ||
509 | |||
510 | config PATA_NETCELL | 485 | config PATA_NETCELL |
511 | tristate "NETCELL Revolution RAID support" | 486 | tristate "NETCELL Revolution RAID support" |
512 | depends on PCI | 487 | depends on PCI |
@@ -525,15 +500,6 @@ config PATA_NINJA32 | |||
525 | 500 | ||
526 | If unsure, say N. | 501 | If unsure, say N. |
527 | 502 | ||
528 | config PATA_NS87410 | ||
529 | tristate "Nat Semi NS87410 PATA support" | ||
530 | depends on PCI | ||
531 | help | ||
532 | This option enables support for the National Semiconductor | ||
533 | NS87410 PCI-IDE controller. | ||
534 | |||
535 | If unsure, say N. | ||
536 | |||
537 | config PATA_NS87415 | 503 | config PATA_NS87415 |
538 | tristate "Nat Semi NS87415 PATA support" | 504 | tristate "Nat Semi NS87415 PATA support" |
539 | depends on PCI | 505 | depends on PCI |
@@ -543,12 +509,11 @@ config PATA_NS87415 | |||
543 | 509 | ||
544 | If unsure, say N. | 510 | If unsure, say N. |
545 | 511 | ||
546 | config PATA_OPTI | 512 | config PATA_OLDPIIX |
547 | tristate "OPTI621/6215 PATA support (Very Experimental)" | 513 | tristate "Intel PATA old PIIX support" |
548 | depends on PCI && EXPERIMENTAL | 514 | depends on PCI |
549 | help | 515 | help |
550 | This option enables full PIO support for the early Opti ATA | 516 | This option enables support for early PIIX PATA support. |
551 | controllers found on some old motherboards. | ||
552 | 517 | ||
553 | If unsure, say N. | 518 | If unsure, say N. |
554 | 519 | ||
@@ -562,24 +527,6 @@ config PATA_OPTIDMA | |||
562 | 527 | ||
563 | If unsure, say N. | 528 | If unsure, say N. |
564 | 529 | ||
565 | config PATA_PALMLD | ||
566 | tristate "Palm LifeDrive PATA support" | ||
567 | depends on MACH_PALMLD | ||
568 | help | ||
569 | This option enables support for Palm LifeDrive's internal ATA | ||
570 | port via the new ATA layer. | ||
571 | |||
572 | If unsure, say N. | ||
573 | |||
574 | config PATA_PCMCIA | ||
575 | tristate "PCMCIA PATA support" | ||
576 | depends on PCMCIA | ||
577 | help | ||
578 | This option enables support for PCMCIA ATA interfaces, including | ||
579 | compact flash card adapters via the new ATA layer. | ||
580 | |||
581 | If unsure, say N. | ||
582 | |||
583 | config PATA_PDC2027X | 530 | config PATA_PDC2027X |
584 | tristate "Promise PATA 2027x support" | 531 | tristate "Promise PATA 2027x support" |
585 | depends on PCI | 532 | depends on PCI |
@@ -597,12 +544,6 @@ config PATA_PDC_OLD | |||
597 | 544 | ||
598 | If unsure, say N. | 545 | If unsure, say N. |
599 | 546 | ||
600 | config PATA_QDI | ||
601 | tristate "QDI VLB PATA support" | ||
602 | depends on ISA | ||
603 | help | ||
604 | Support for QDI 6500 and 6580 PATA controllers on VESA local bus. | ||
605 | |||
606 | config PATA_RADISYS | 547 | config PATA_RADISYS |
607 | tristate "RADISYS 82600 PATA support (Experimental)" | 548 | tristate "RADISYS 82600 PATA support (Experimental)" |
608 | depends on PCI && EXPERIMENTAL | 549 | depends on PCI && EXPERIMENTAL |
@@ -612,15 +553,6 @@ config PATA_RADISYS | |||
612 | 553 | ||
613 | If unsure, say N. | 554 | If unsure, say N. |
614 | 555 | ||
615 | config PATA_RB532 | ||
616 | tristate "RouterBoard 532 PATA CompactFlash support" | ||
617 | depends on MIKROTIK_RB532 | ||
618 | help | ||
619 | This option enables support for the RouterBoard 532 | ||
620 | PATA CompactFlash controller. | ||
621 | |||
622 | If unsure, say N. | ||
623 | |||
624 | config PATA_RDC | 556 | config PATA_RDC |
625 | tristate "RDC PATA support" | 557 | tristate "RDC PATA support" |
626 | depends on PCI | 558 | depends on PCI |
@@ -631,21 +563,30 @@ config PATA_RDC | |||
631 | 563 | ||
632 | If unsure, say N. | 564 | If unsure, say N. |
633 | 565 | ||
634 | config PATA_RZ1000 | 566 | config PATA_SC1200 |
635 | tristate "PC Tech RZ1000 PATA support" | 567 | tristate "SC1200 PATA support" |
636 | depends on PCI | 568 | depends on PCI |
637 | help | 569 | help |
638 | This option enables basic support for the PC Tech RZ1000/1 | 570 | This option enables support for the NatSemi/AMD SC1200 SoC |
639 | PATA controllers via the new ATA layer | 571 | companion chip used with the Geode processor family. |
640 | 572 | ||
641 | If unsure, say N. | 573 | If unsure, say N. |
642 | 574 | ||
643 | config PATA_SC1200 | 575 | config PATA_SCC |
644 | tristate "SC1200 PATA support" | 576 | tristate "Toshiba's Cell Reference Set IDE support" |
577 | depends on PCI && PPC_CELLEB | ||
578 | help | ||
579 | This option enables support for the built-in IDE controller on | ||
580 | Toshiba Cell Reference Board. | ||
581 | |||
582 | If unsure, say N. | ||
583 | |||
584 | config PATA_SCH | ||
585 | tristate "Intel SCH PATA support" | ||
645 | depends on PCI | 586 | depends on PCI |
646 | help | 587 | help |
647 | This option enables support for the NatSemi/AMD SC1200 SoC | 588 | This option enables support for Intel SCH PATA on the Intel |
648 | companion chip used with the Geode processor family. | 589 | SCH (US15W, US15L, UL11L) series host controllers. |
649 | 590 | ||
650 | If unsure, say N. | 591 | If unsure, say N. |
651 | 592 | ||
@@ -683,6 +624,15 @@ config PATA_TOSHIBA | |||
683 | 624 | ||
684 | If unsure, say N. | 625 | If unsure, say N. |
685 | 626 | ||
627 | config PATA_TRIFLEX | ||
628 | tristate "Compaq Triflex PATA support" | ||
629 | depends on PCI | ||
630 | help | ||
631 | Enable support for the Compaq 'Triflex' IDE controller as found | ||
632 | on many Compaq Pentium-Pro systems, via the new ATA layer. | ||
633 | |||
634 | If unsure, say N. | ||
635 | |||
686 | config PATA_VIA | 636 | config PATA_VIA |
687 | tristate "VIA PATA support" | 637 | tristate "VIA PATA support" |
688 | depends on PCI | 638 | depends on PCI |
@@ -701,12 +651,99 @@ config PATA_WINBOND | |||
701 | 651 | ||
702 | If unsure, say N. | 652 | If unsure, say N. |
703 | 653 | ||
704 | config PATA_WINBOND_VLB | 654 | endif # ATA_BMDMA |
705 | tristate "Winbond W83759A VLB PATA support (Experimental)" | 655 | |
706 | depends on ISA && EXPERIMENTAL | 656 | comment "PIO-only SFF controllers" |
657 | |||
658 | config PATA_AT32 | ||
659 | tristate "Atmel AVR32 PATA support (Experimental)" | ||
660 | depends on AVR32 && PLATFORM_AT32AP && EXPERIMENTAL | ||
707 | help | 661 | help |
708 | Support for the Winbond W83759A controller on Vesa Local Bus | 662 | This option enables support for the IDE devices on the |
709 | systems. | 663 | Atmel AT32AP platform. |
664 | |||
665 | If unsure, say N. | ||
666 | |||
667 | config PATA_AT91 | ||
668 | tristate "PATA support for AT91SAM9260" | ||
669 | depends on ARM && ARCH_AT91 | ||
670 | help | ||
671 | This option enables support for IDE devices on the Atmel AT91SAM9260 SoC. | ||
672 | |||
673 | If unsure, say N. | ||
674 | |||
675 | config PATA_CMD640_PCI | ||
676 | tristate "CMD640 PCI PATA support (Experimental)" | ||
677 | depends on PCI && EXPERIMENTAL | ||
678 | help | ||
679 | This option enables support for the CMD640 PCI IDE | ||
680 | interface chip. Only the primary channel is currently | ||
681 | supported. | ||
682 | |||
683 | If unsure, say N. | ||
684 | |||
685 | config PATA_ISAPNP | ||
686 | tristate "ISA Plug and Play PATA support" | ||
687 | depends on ISAPNP | ||
688 | help | ||
689 | This option enables support for ISA plug & play ATA | ||
690 | controllers such as those found on old soundcards. | ||
691 | |||
692 | If unsure, say N. | ||
693 | |||
694 | config PATA_IXP4XX_CF | ||
695 | tristate "IXP4XX Compact Flash support" | ||
696 | depends on ARCH_IXP4XX | ||
697 | help | ||
698 | This option enables support for a Compact Flash connected on | ||
699 | the ixp4xx expansion bus. This driver had been written for | ||
700 | Loft/Avila boards in mind but can work with others. | ||
701 | |||
702 | If unsure, say N. | ||
703 | |||
704 | config PATA_MPIIX | ||
705 | tristate "Intel PATA MPIIX support" | ||
706 | depends on PCI | ||
707 | help | ||
708 | This option enables support for MPIIX PATA support. | ||
709 | |||
710 | If unsure, say N. | ||
711 | |||
712 | config PATA_NS87410 | ||
713 | tristate "Nat Semi NS87410 PATA support" | ||
714 | depends on PCI | ||
715 | help | ||
716 | This option enables support for the National Semiconductor | ||
717 | NS87410 PCI-IDE controller. | ||
718 | |||
719 | If unsure, say N. | ||
720 | |||
721 | config PATA_OPTI | ||
722 | tristate "OPTI621/6215 PATA support (Very Experimental)" | ||
723 | depends on PCI && EXPERIMENTAL | ||
724 | help | ||
725 | This option enables full PIO support for the early Opti ATA | ||
726 | controllers found on some old motherboards. | ||
727 | |||
728 | If unsure, say N. | ||
729 | |||
730 | config PATA_PALMLD | ||
731 | tristate "Palm LifeDrive PATA support" | ||
732 | depends on MACH_PALMLD | ||
733 | help | ||
734 | This option enables support for Palm LifeDrive's internal ATA | ||
735 | port via the new ATA layer. | ||
736 | |||
737 | If unsure, say N. | ||
738 | |||
739 | config PATA_PCMCIA | ||
740 | tristate "PCMCIA PATA support" | ||
741 | depends on PCMCIA | ||
742 | help | ||
743 | This option enables support for PCMCIA ATA interfaces, including | ||
744 | compact flash card adapters via the new ATA layer. | ||
745 | |||
746 | If unsure, say N. | ||
710 | 747 | ||
711 | config HAVE_PATA_PLATFORM | 748 | config HAVE_PATA_PLATFORM |
712 | bool | 749 | bool |
@@ -725,14 +762,6 @@ config PATA_PLATFORM | |||
725 | 762 | ||
726 | If unsure, say N. | 763 | If unsure, say N. |
727 | 764 | ||
728 | config PATA_AT91 | ||
729 | tristate "PATA support for AT91SAM9260" | ||
730 | depends on ARM && ARCH_AT91 | ||
731 | help | ||
732 | This option enables support for IDE devices on the Atmel AT91SAM9260 SoC. | ||
733 | |||
734 | If unsure, say N. | ||
735 | |||
736 | config PATA_OF_PLATFORM | 765 | config PATA_OF_PLATFORM |
737 | tristate "OpenFirmware platform device PATA support" | 766 | tristate "OpenFirmware platform device PATA support" |
738 | depends on PATA_PLATFORM && PPC_OF | 767 | depends on PATA_PLATFORM && PPC_OF |
@@ -743,69 +772,65 @@ config PATA_OF_PLATFORM | |||
743 | 772 | ||
744 | If unsure, say N. | 773 | If unsure, say N. |
745 | 774 | ||
746 | config PATA_ICSIDE | 775 | config PATA_QDI |
747 | tristate "Acorn ICS PATA support" | 776 | tristate "QDI VLB PATA support" |
748 | depends on ARM && ARCH_ACORN | 777 | depends on ISA |
749 | help | 778 | help |
750 | On Acorn systems, say Y here if you wish to use the ICS PATA | 779 | Support for QDI 6500 and 6580 PATA controllers on VESA local bus. |
751 | interface card. This is not required for ICS partition support. | ||
752 | If you are unsure, say N to this. | ||
753 | 780 | ||
754 | config PATA_IXP4XX_CF | 781 | config PATA_RB532 |
755 | tristate "IXP4XX Compact Flash support" | 782 | tristate "RouterBoard 532 PATA CompactFlash support" |
756 | depends on ARCH_IXP4XX | 783 | depends on MIKROTIK_RB532 |
757 | help | 784 | help |
758 | This option enables support for a Compact Flash connected on | 785 | This option enables support for the RouterBoard 532 |
759 | the ixp4xx expansion bus. This driver had been written for | 786 | PATA CompactFlash controller. |
760 | Loft/Avila boards in mind but can work with others. | ||
761 | 787 | ||
762 | If unsure, say N. | 788 | If unsure, say N. |
763 | 789 | ||
764 | config PATA_OCTEON_CF | 790 | config PATA_RZ1000 |
765 | tristate "OCTEON Boot Bus Compact Flash support" | 791 | tristate "PC Tech RZ1000 PATA support" |
766 | depends on CPU_CAVIUM_OCTEON | 792 | depends on PCI |
767 | help | 793 | help |
768 | This option enables a polled compact flash driver for use with | 794 | This option enables basic support for the PC Tech RZ1000/1 |
769 | compact flash cards attached to the OCTEON boot bus. | 795 | PATA controllers via the new ATA layer |
770 | 796 | ||
771 | If unsure, say N. | 797 | If unsure, say N. |
772 | 798 | ||
773 | config PATA_SCC | 799 | config PATA_WINBOND_VLB |
774 | tristate "Toshiba's Cell Reference Set IDE support" | 800 | tristate "Winbond W83759A VLB PATA support (Experimental)" |
775 | depends on PCI && PPC_CELLEB | 801 | depends on ISA && EXPERIMENTAL |
776 | help | 802 | help |
777 | This option enables support for the built-in IDE controller on | 803 | Support for the Winbond W83759A controller on Vesa Local Bus |
778 | Toshiba Cell Reference Board. | 804 | systems. |
779 | 805 | ||
780 | If unsure, say N. | 806 | comment "Generic fallback / legacy drivers" |
781 | 807 | ||
782 | config PATA_SCH | 808 | config PATA_ACPI |
783 | tristate "Intel SCH PATA support" | 809 | tristate "ACPI firmware driver for PATA" |
784 | depends on PCI | 810 | depends on ATA_ACPI && ATA_BMDMA |
785 | help | 811 | help |
786 | This option enables support for Intel SCH PATA on the Intel | 812 | This option enables an ACPI method driver which drives |
787 | SCH (US15W, US15L, UL11L) series host controllers. | 813 | motherboard PATA controller interfaces through the ACPI |
788 | 814 | firmware in the BIOS. This driver can sometimes handle | |
789 | If unsure, say N. | 815 | otherwise unsupported hardware. |
790 | 816 | ||
791 | config PATA_BF54X | 817 | config ATA_GENERIC |
792 | tristate "Blackfin 54x ATAPI support" | 818 | tristate "Generic ATA support" |
793 | depends on BF542 || BF548 || BF549 | 819 | depends on PCI && ATA_BMDMA |
794 | help | 820 | help |
795 | This option enables support for the built-in ATAPI controller on | 821 | This option enables support for generic BIOS configured |
796 | Blackfin 54x family chips. | 822 | ATA controllers via the new ATA layer |
797 | 823 | ||
798 | If unsure, say N. | 824 | If unsure, say N. |
799 | 825 | ||
800 | config PATA_MACIO | 826 | config PATA_LEGACY |
801 | tristate "Apple PowerMac/PowerBook internal 'MacIO' IDE" | 827 | tristate "Legacy ISA PATA support (Experimental)" |
802 | depends on PPC_PMAC | 828 | depends on (ISA || PCI) && EXPERIMENTAL |
803 | help | 829 | help |
804 | Most IDE capable PowerMacs have IDE busses driven by a variant | 830 | This option enables support for ISA/VLB/PCI bus legacy PATA |
805 | of this controller which is part of the Apple chipset used on | 831 | ports and allows them to be accessed via the new ATA layer. |
806 | most PowerMac models. Some models have multiple busses using | ||
807 | different chipsets, though generally, MacIO is one of them. | ||
808 | 832 | ||
833 | If unsure, say N. | ||
809 | 834 | ||
810 | endif # ATA_SFF | 835 | endif # ATA_SFF |
811 | endif # ATA | 836 | endif # ATA |
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index d0a93c4ad3ec..7ef89d73df63 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile | |||
@@ -1,33 +1,39 @@ | |||
1 | 1 | ||
2 | obj-$(CONFIG_ATA) += libata.o | 2 | obj-$(CONFIG_ATA) += libata.o |
3 | 3 | ||
4 | # non-SFF interface | ||
4 | obj-$(CONFIG_SATA_AHCI) += ahci.o libahci.o | 5 | obj-$(CONFIG_SATA_AHCI) += ahci.o libahci.o |
5 | obj-$(CONFIG_SATA_AHCI_PLATFORM) += ahci_platform.o libahci.o | 6 | obj-$(CONFIG_SATA_AHCI_PLATFORM) += ahci_platform.o libahci.o |
6 | obj-$(CONFIG_SATA_SVW) += sata_svw.o | 7 | obj-$(CONFIG_SATA_FSL) += sata_fsl.o |
8 | obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o | ||
9 | obj-$(CONFIG_SATA_SIL24) += sata_sil24.o | ||
10 | |||
11 | # SFF w/ custom DMA | ||
12 | obj-$(CONFIG_PDC_ADMA) += pdc_adma.o | ||
13 | obj-$(CONFIG_PATA_MPC52xx) += pata_mpc52xx.o | ||
14 | obj-$(CONFIG_PATA_OCTEON_CF) += pata_octeon_cf.o | ||
15 | obj-$(CONFIG_SATA_QSTOR) += sata_qstor.o | ||
16 | obj-$(CONFIG_SATA_SX4) += sata_sx4.o | ||
17 | |||
18 | # SFF SATA w/ BMDMA | ||
7 | obj-$(CONFIG_ATA_PIIX) += ata_piix.o | 19 | obj-$(CONFIG_ATA_PIIX) += ata_piix.o |
20 | obj-$(CONFIG_SATA_MV) += sata_mv.o | ||
21 | obj-$(CONFIG_SATA_NV) += sata_nv.o | ||
8 | obj-$(CONFIG_SATA_PROMISE) += sata_promise.o | 22 | obj-$(CONFIG_SATA_PROMISE) += sata_promise.o |
9 | obj-$(CONFIG_SATA_QSTOR) += sata_qstor.o | ||
10 | obj-$(CONFIG_SATA_SIL) += sata_sil.o | 23 | obj-$(CONFIG_SATA_SIL) += sata_sil.o |
11 | obj-$(CONFIG_SATA_SIL24) += sata_sil24.o | ||
12 | obj-$(CONFIG_SATA_VIA) += sata_via.o | ||
13 | obj-$(CONFIG_SATA_VITESSE) += sata_vsc.o | ||
14 | obj-$(CONFIG_SATA_SIS) += sata_sis.o | 24 | obj-$(CONFIG_SATA_SIS) += sata_sis.o |
15 | obj-$(CONFIG_SATA_SX4) += sata_sx4.o | 25 | obj-$(CONFIG_SATA_SVW) += sata_svw.o |
16 | obj-$(CONFIG_SATA_NV) += sata_nv.o | ||
17 | obj-$(CONFIG_SATA_ULI) += sata_uli.o | 26 | obj-$(CONFIG_SATA_ULI) += sata_uli.o |
18 | obj-$(CONFIG_SATA_MV) += sata_mv.o | 27 | obj-$(CONFIG_SATA_VIA) += sata_via.o |
19 | obj-$(CONFIG_SATA_INIC162X) += sata_inic162x.o | 28 | obj-$(CONFIG_SATA_VITESSE) += sata_vsc.o |
20 | obj-$(CONFIG_PDC_ADMA) += pdc_adma.o | ||
21 | obj-$(CONFIG_SATA_FSL) += sata_fsl.o | ||
22 | obj-$(CONFIG_PATA_MACIO) += pata_macio.o | ||
23 | 29 | ||
30 | # SFF PATA w/ BMDMA | ||
24 | obj-$(CONFIG_PATA_ALI) += pata_ali.o | 31 | obj-$(CONFIG_PATA_ALI) += pata_ali.o |
25 | obj-$(CONFIG_PATA_AMD) += pata_amd.o | 32 | obj-$(CONFIG_PATA_AMD) += pata_amd.o |
26 | obj-$(CONFIG_PATA_ARTOP) += pata_artop.o | 33 | obj-$(CONFIG_PATA_ARTOP) += pata_artop.o |
27 | obj-$(CONFIG_PATA_ATP867X) += pata_atp867x.o | ||
28 | obj-$(CONFIG_PATA_AT32) += pata_at32.o | ||
29 | obj-$(CONFIG_PATA_ATIIXP) += pata_atiixp.o | 34 | obj-$(CONFIG_PATA_ATIIXP) += pata_atiixp.o |
30 | obj-$(CONFIG_PATA_CMD640_PCI) += pata_cmd640.o | 35 | obj-$(CONFIG_PATA_ATP867X) += pata_atp867x.o |
36 | obj-$(CONFIG_PATA_BF54X) += pata_bf54x.o | ||
31 | obj-$(CONFIG_PATA_CMD64X) += pata_cmd64x.o | 37 | obj-$(CONFIG_PATA_CMD64X) += pata_cmd64x.o |
32 | obj-$(CONFIG_PATA_CS5520) += pata_cs5520.o | 38 | obj-$(CONFIG_PATA_CS5520) += pata_cs5520.o |
33 | obj-$(CONFIG_PATA_CS5530) += pata_cs5530.o | 39 | obj-$(CONFIG_PATA_CS5530) += pata_cs5530.o |
@@ -39,47 +45,50 @@ obj-$(CONFIG_PATA_HPT366) += pata_hpt366.o | |||
39 | obj-$(CONFIG_PATA_HPT37X) += pata_hpt37x.o | 45 | obj-$(CONFIG_PATA_HPT37X) += pata_hpt37x.o |
40 | obj-$(CONFIG_PATA_HPT3X2N) += pata_hpt3x2n.o | 46 | obj-$(CONFIG_PATA_HPT3X2N) += pata_hpt3x2n.o |
41 | obj-$(CONFIG_PATA_HPT3X3) += pata_hpt3x3.o | 47 | obj-$(CONFIG_PATA_HPT3X3) += pata_hpt3x3.o |
42 | obj-$(CONFIG_PATA_ISAPNP) += pata_isapnp.o | 48 | obj-$(CONFIG_PATA_ICSIDE) += pata_icside.o |
43 | obj-$(CONFIG_PATA_IT821X) += pata_it821x.o | ||
44 | obj-$(CONFIG_PATA_IT8213) += pata_it8213.o | 49 | obj-$(CONFIG_PATA_IT8213) += pata_it8213.o |
50 | obj-$(CONFIG_PATA_IT821X) += pata_it821x.o | ||
45 | obj-$(CONFIG_PATA_JMICRON) += pata_jmicron.o | 51 | obj-$(CONFIG_PATA_JMICRON) += pata_jmicron.o |
52 | obj-$(CONFIG_PATA_MACIO) += pata_macio.o | ||
53 | obj-$(CONFIG_PATA_MARVELL) += pata_marvell.o | ||
46 | obj-$(CONFIG_PATA_NETCELL) += pata_netcell.o | 54 | obj-$(CONFIG_PATA_NETCELL) += pata_netcell.o |
47 | obj-$(CONFIG_PATA_NINJA32) += pata_ninja32.o | 55 | obj-$(CONFIG_PATA_NINJA32) += pata_ninja32.o |
48 | obj-$(CONFIG_PATA_NS87410) += pata_ns87410.o | ||
49 | obj-$(CONFIG_PATA_NS87415) += pata_ns87415.o | 56 | obj-$(CONFIG_PATA_NS87415) += pata_ns87415.o |
50 | obj-$(CONFIG_PATA_OPTI) += pata_opti.o | ||
51 | obj-$(CONFIG_PATA_OPTIDMA) += pata_optidma.o | ||
52 | obj-$(CONFIG_PATA_MPC52xx) += pata_mpc52xx.o | ||
53 | obj-$(CONFIG_PATA_MARVELL) += pata_marvell.o | ||
54 | obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o | ||
55 | obj-$(CONFIG_PATA_OLDPIIX) += pata_oldpiix.o | 57 | obj-$(CONFIG_PATA_OLDPIIX) += pata_oldpiix.o |
56 | obj-$(CONFIG_PATA_PALMLD) += pata_palmld.o | 58 | obj-$(CONFIG_PATA_OPTIDMA) += pata_optidma.o |
57 | obj-$(CONFIG_PATA_PCMCIA) += pata_pcmcia.o | ||
58 | obj-$(CONFIG_PATA_PDC2027X) += pata_pdc2027x.o | 59 | obj-$(CONFIG_PATA_PDC2027X) += pata_pdc2027x.o |
59 | obj-$(CONFIG_PATA_PDC_OLD) += pata_pdc202xx_old.o | 60 | obj-$(CONFIG_PATA_PDC_OLD) += pata_pdc202xx_old.o |
60 | obj-$(CONFIG_PATA_QDI) += pata_qdi.o | ||
61 | obj-$(CONFIG_PATA_RADISYS) += pata_radisys.o | 61 | obj-$(CONFIG_PATA_RADISYS) += pata_radisys.o |
62 | obj-$(CONFIG_PATA_RB532) += pata_rb532_cf.o | ||
63 | obj-$(CONFIG_PATA_RDC) += pata_rdc.o | 62 | obj-$(CONFIG_PATA_RDC) += pata_rdc.o |
64 | obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o | ||
65 | obj-$(CONFIG_PATA_SC1200) += pata_sc1200.o | 63 | obj-$(CONFIG_PATA_SC1200) += pata_sc1200.o |
64 | obj-$(CONFIG_PATA_SCC) += pata_scc.o | ||
65 | obj-$(CONFIG_PATA_SCH) += pata_sch.o | ||
66 | obj-$(CONFIG_PATA_SERVERWORKS) += pata_serverworks.o | 66 | obj-$(CONFIG_PATA_SERVERWORKS) += pata_serverworks.o |
67 | obj-$(CONFIG_PATA_SIL680) += pata_sil680.o | 67 | obj-$(CONFIG_PATA_SIL680) += pata_sil680.o |
68 | obj-$(CONFIG_PATA_SIS) += pata_sis.o | ||
68 | obj-$(CONFIG_PATA_TOSHIBA) += pata_piccolo.o | 69 | obj-$(CONFIG_PATA_TOSHIBA) += pata_piccolo.o |
70 | obj-$(CONFIG_PATA_TRIFLEX) += pata_triflex.o | ||
69 | obj-$(CONFIG_PATA_VIA) += pata_via.o | 71 | obj-$(CONFIG_PATA_VIA) += pata_via.o |
70 | obj-$(CONFIG_PATA_WINBOND) += pata_sl82c105.o | 72 | obj-$(CONFIG_PATA_WINBOND) += pata_sl82c105.o |
71 | obj-$(CONFIG_PATA_WINBOND_VLB) += pata_winbond.o | 73 | |
72 | obj-$(CONFIG_PATA_SIS) += pata_sis.o | 74 | # SFF PIO only |
73 | obj-$(CONFIG_PATA_TRIFLEX) += pata_triflex.o | 75 | obj-$(CONFIG_PATA_AT32) += pata_at32.o |
76 | obj-$(CONFIG_PATA_AT91) += pata_at91.o | ||
77 | obj-$(CONFIG_PATA_CMD640_PCI) += pata_cmd640.o | ||
78 | obj-$(CONFIG_PATA_ISAPNP) += pata_isapnp.o | ||
74 | obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o | 79 | obj-$(CONFIG_PATA_IXP4XX_CF) += pata_ixp4xx_cf.o |
75 | obj-$(CONFIG_PATA_SCC) += pata_scc.o | 80 | obj-$(CONFIG_PATA_MPIIX) += pata_mpiix.o |
76 | obj-$(CONFIG_PATA_SCH) += pata_sch.o | 81 | obj-$(CONFIG_PATA_NS87410) += pata_ns87410.o |
77 | obj-$(CONFIG_PATA_BF54X) += pata_bf54x.o | 82 | obj-$(CONFIG_PATA_OPTI) += pata_opti.o |
78 | obj-$(CONFIG_PATA_OCTEON_CF) += pata_octeon_cf.o | 83 | obj-$(CONFIG_PATA_PCMCIA) += pata_pcmcia.o |
84 | obj-$(CONFIG_PATA_PALMLD) += pata_palmld.o | ||
79 | obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o | 85 | obj-$(CONFIG_PATA_PLATFORM) += pata_platform.o |
80 | obj-$(CONFIG_PATA_AT91) += pata_at91.o | ||
81 | obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o | 86 | obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o |
82 | obj-$(CONFIG_PATA_ICSIDE) += pata_icside.o | 87 | obj-$(CONFIG_PATA_QDI) += pata_qdi.o |
88 | obj-$(CONFIG_PATA_RB532) += pata_rb532_cf.o | ||
89 | obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o | ||
90 | obj-$(CONFIG_PATA_WINBOND_VLB) += pata_winbond.o | ||
91 | |||
83 | # Should be last but two libata driver | 92 | # Should be last but two libata driver |
84 | obj-$(CONFIG_PATA_ACPI) += pata_acpi.o | 93 | obj-$(CONFIG_PATA_ACPI) += pata_acpi.o |
85 | # Should be last but one libata driver | 94 | # Should be last but one libata driver |
diff --git a/drivers/ata/ata_generic.c b/drivers/ata/ata_generic.c index 33fb614f9784..573158a9668d 100644 --- a/drivers/ata/ata_generic.c +++ b/drivers/ata/ata_generic.c | |||
@@ -155,7 +155,7 @@ static int ata_generic_init_one(struct pci_dev *dev, const struct pci_device_id | |||
155 | return rc; | 155 | return rc; |
156 | pcim_pin_device(dev); | 156 | pcim_pin_device(dev); |
157 | } | 157 | } |
158 | return ata_pci_sff_init_one(dev, ppi, &generic_sht, NULL, 0); | 158 | return ata_pci_bmdma_init_one(dev, ppi, &generic_sht, NULL, 0); |
159 | } | 159 | } |
160 | 160 | ||
161 | static struct pci_device_id ata_generic[] = { | 161 | static struct pci_device_id ata_generic[] = { |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index ec52fc618763..7409f98d2ae6 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -1589,7 +1589,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev, | |||
1589 | hpriv->map = piix_init_sata_map(pdev, port_info, | 1589 | hpriv->map = piix_init_sata_map(pdev, port_info, |
1590 | piix_map_db_table[ent->driver_data]); | 1590 | piix_map_db_table[ent->driver_data]); |
1591 | 1591 | ||
1592 | rc = ata_pci_sff_prepare_host(pdev, ppi, &host); | 1592 | rc = ata_pci_bmdma_prepare_host(pdev, ppi, &host); |
1593 | if (rc) | 1593 | if (rc) |
1594 | return rc; | 1594 | return rc; |
1595 | host->private_data = hpriv; | 1595 | host->private_data = hpriv; |
@@ -1626,7 +1626,7 @@ static int __devinit piix_init_one(struct pci_dev *pdev, | |||
1626 | host->flags |= ATA_HOST_PARALLEL_SCAN; | 1626 | host->flags |= ATA_HOST_PARALLEL_SCAN; |
1627 | 1627 | ||
1628 | pci_set_master(pdev); | 1628 | pci_set_master(pdev); |
1629 | return ata_pci_sff_activate_host(host, ata_sff_interrupt, &piix_sht); | 1629 | return ata_pci_sff_activate_host(host, ata_bmdma_interrupt, &piix_sht); |
1630 | } | 1630 | } |
1631 | 1631 | ||
1632 | static void piix_remove_one(struct pci_dev *pdev) | 1632 | static void piix_remove_one(struct pci_dev *pdev) |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index c47373f01f89..06b7e49e039c 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -160,6 +160,10 @@ int libata_allow_tpm = 0; | |||
160 | module_param_named(allow_tpm, libata_allow_tpm, int, 0444); | 160 | module_param_named(allow_tpm, libata_allow_tpm, int, 0444); |
161 | MODULE_PARM_DESC(allow_tpm, "Permit the use of TPM commands (0=off [default], 1=on)"); | 161 | MODULE_PARM_DESC(allow_tpm, "Permit the use of TPM commands (0=off [default], 1=on)"); |
162 | 162 | ||
163 | static int atapi_an; | ||
164 | module_param(atapi_an, int, 0444); | ||
165 | MODULE_PARM_DESC(atapi_an, "Enable ATAPI AN media presence notification (0=0ff [default], 1=on)"); | ||
166 | |||
163 | MODULE_AUTHOR("Jeff Garzik"); | 167 | MODULE_AUTHOR("Jeff Garzik"); |
164 | MODULE_DESCRIPTION("Library module for ATA devices"); | 168 | MODULE_DESCRIPTION("Library module for ATA devices"); |
165 | MODULE_LICENSE("GPL"); | 169 | MODULE_LICENSE("GPL"); |
@@ -2122,6 +2126,14 @@ retry: | |||
2122 | goto err_out; | 2126 | goto err_out; |
2123 | } | 2127 | } |
2124 | 2128 | ||
2129 | if (dev->horkage & ATA_HORKAGE_DUMP_ID) { | ||
2130 | ata_dev_printk(dev, KERN_DEBUG, "dumping IDENTIFY data, " | ||
2131 | "class=%d may_fallback=%d tried_spinup=%d\n", | ||
2132 | class, may_fallback, tried_spinup); | ||
2133 | print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, | ||
2134 | 16, 2, id, ATA_ID_WORDS * sizeof(*id), true); | ||
2135 | } | ||
2136 | |||
2125 | /* Falling back doesn't make sense if ID data was read | 2137 | /* Falling back doesn't make sense if ID data was read |
2126 | * successfully at least once. | 2138 | * successfully at least once. |
2127 | */ | 2139 | */ |
@@ -2510,7 +2522,8 @@ int ata_dev_configure(struct ata_device *dev) | |||
2510 | * to enable ATAPI AN to discern between PHY status | 2522 | * to enable ATAPI AN to discern between PHY status |
2511 | * changed notifications and ATAPI ANs. | 2523 | * changed notifications and ATAPI ANs. |
2512 | */ | 2524 | */ |
2513 | if ((ap->flags & ATA_FLAG_AN) && ata_id_has_atapi_AN(id) && | 2525 | if (atapi_an && |
2526 | (ap->flags & ATA_FLAG_AN) && ata_id_has_atapi_AN(id) && | ||
2514 | (!sata_pmp_attached(ap) || | 2527 | (!sata_pmp_attached(ap) || |
2515 | sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf) == 0)) { | 2528 | sata_scr_read(&ap->link, SCR_NOTIFICATION, &sntf) == 0)) { |
2516 | unsigned int err_mask; | 2529 | unsigned int err_mask; |
@@ -6372,6 +6385,7 @@ static int __init ata_parse_force_one(char **cur, | |||
6372 | { "3.0Gbps", .spd_limit = 2 }, | 6385 | { "3.0Gbps", .spd_limit = 2 }, |
6373 | { "noncq", .horkage_on = ATA_HORKAGE_NONCQ }, | 6386 | { "noncq", .horkage_on = ATA_HORKAGE_NONCQ }, |
6374 | { "ncq", .horkage_off = ATA_HORKAGE_NONCQ }, | 6387 | { "ncq", .horkage_off = ATA_HORKAGE_NONCQ }, |
6388 | { "dump_id", .horkage_on = ATA_HORKAGE_DUMP_ID }, | ||
6375 | { "pio0", .xfer_mask = 1 << (ATA_SHIFT_PIO + 0) }, | 6389 | { "pio0", .xfer_mask = 1 << (ATA_SHIFT_PIO + 0) }, |
6376 | { "pio1", .xfer_mask = 1 << (ATA_SHIFT_PIO + 1) }, | 6390 | { "pio1", .xfer_mask = 1 << (ATA_SHIFT_PIO + 1) }, |
6377 | { "pio2", .xfer_mask = 1 << (ATA_SHIFT_PIO + 2) }, | 6391 | { "pio2", .xfer_mask = 1 << (ATA_SHIFT_PIO + 2) }, |
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c index 19ddf924944f..efa4a18cfb9d 100644 --- a/drivers/ata/libata-sff.c +++ b/drivers/ata/libata-sff.c | |||
@@ -63,7 +63,6 @@ const struct ata_port_operations ata_sff_port_ops = { | |||
63 | .sff_tf_read = ata_sff_tf_read, | 63 | .sff_tf_read = ata_sff_tf_read, |
64 | .sff_exec_command = ata_sff_exec_command, | 64 | .sff_exec_command = ata_sff_exec_command, |
65 | .sff_data_xfer = ata_sff_data_xfer, | 65 | .sff_data_xfer = ata_sff_data_xfer, |
66 | .sff_irq_clear = ata_sff_irq_clear, | ||
67 | .sff_drain_fifo = ata_sff_drain_fifo, | 66 | .sff_drain_fifo = ata_sff_drain_fifo, |
68 | 67 | ||
69 | .lost_interrupt = ata_sff_lost_interrupt, | 68 | .lost_interrupt = ata_sff_lost_interrupt, |
@@ -395,33 +394,12 @@ void ata_sff_irq_on(struct ata_port *ap) | |||
395 | ata_sff_set_devctl(ap, ap->ctl); | 394 | ata_sff_set_devctl(ap, ap->ctl); |
396 | ata_wait_idle(ap); | 395 | ata_wait_idle(ap); |
397 | 396 | ||
398 | ap->ops->sff_irq_clear(ap); | 397 | if (ap->ops->sff_irq_clear) |
398 | ap->ops->sff_irq_clear(ap); | ||
399 | } | 399 | } |
400 | EXPORT_SYMBOL_GPL(ata_sff_irq_on); | 400 | EXPORT_SYMBOL_GPL(ata_sff_irq_on); |
401 | 401 | ||
402 | /** | 402 | /** |
403 | * ata_sff_irq_clear - Clear PCI IDE BMDMA interrupt. | ||
404 | * @ap: Port associated with this ATA transaction. | ||
405 | * | ||
406 | * Clear interrupt and error flags in DMA status register. | ||
407 | * | ||
408 | * May be used as the irq_clear() entry in ata_port_operations. | ||
409 | * | ||
410 | * LOCKING: | ||
411 | * spin_lock_irqsave(host lock) | ||
412 | */ | ||
413 | void ata_sff_irq_clear(struct ata_port *ap) | ||
414 | { | ||
415 | void __iomem *mmio = ap->ioaddr.bmdma_addr; | ||
416 | |||
417 | if (!mmio) | ||
418 | return; | ||
419 | |||
420 | iowrite8(ioread8(mmio + ATA_DMA_STATUS), mmio + ATA_DMA_STATUS); | ||
421 | } | ||
422 | EXPORT_SYMBOL_GPL(ata_sff_irq_clear); | ||
423 | |||
424 | /** | ||
425 | * ata_sff_tf_load - send taskfile registers to host controller | 403 | * ata_sff_tf_load - send taskfile registers to host controller |
426 | * @ap: Port to which output is sent | 404 | * @ap: Port to which output is sent |
427 | * @tf: ATA taskfile register set | 405 | * @tf: ATA taskfile register set |
@@ -820,11 +798,15 @@ static void atapi_send_cdb(struct ata_port *ap, struct ata_queued_cmd *qc) | |||
820 | case ATAPI_PROT_NODATA: | 798 | case ATAPI_PROT_NODATA: |
821 | ap->hsm_task_state = HSM_ST_LAST; | 799 | ap->hsm_task_state = HSM_ST_LAST; |
822 | break; | 800 | break; |
801 | #ifdef CONFIG_ATA_BMDMA | ||
823 | case ATAPI_PROT_DMA: | 802 | case ATAPI_PROT_DMA: |
824 | ap->hsm_task_state = HSM_ST_LAST; | 803 | ap->hsm_task_state = HSM_ST_LAST; |
825 | /* initiate bmdma */ | 804 | /* initiate bmdma */ |
826 | ap->ops->bmdma_start(qc); | 805 | ap->ops->bmdma_start(qc); |
827 | break; | 806 | break; |
807 | #endif /* CONFIG_ATA_BMDMA */ | ||
808 | default: | ||
809 | BUG(); | ||
828 | } | 810 | } |
829 | } | 811 | } |
830 | 812 | ||
@@ -1491,27 +1473,27 @@ bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc) | |||
1491 | } | 1473 | } |
1492 | EXPORT_SYMBOL_GPL(ata_sff_qc_fill_rtf); | 1474 | EXPORT_SYMBOL_GPL(ata_sff_qc_fill_rtf); |
1493 | 1475 | ||
1494 | /** | 1476 | static unsigned int ata_sff_idle_irq(struct ata_port *ap) |
1495 | * ata_sff_host_intr - Handle host interrupt for given (port, task) | ||
1496 | * @ap: Port on which interrupt arrived (possibly...) | ||
1497 | * @qc: Taskfile currently active in engine | ||
1498 | * | ||
1499 | * Handle host interrupt for given queued command. Currently, | ||
1500 | * only DMA interrupts are handled. All other commands are | ||
1501 | * handled via polling with interrupts disabled (nIEN bit). | ||
1502 | * | ||
1503 | * LOCKING: | ||
1504 | * spin_lock_irqsave(host lock) | ||
1505 | * | ||
1506 | * RETURNS: | ||
1507 | * One if interrupt was handled, zero if not (shared irq). | ||
1508 | */ | ||
1509 | unsigned int ata_sff_host_intr(struct ata_port *ap, | ||
1510 | struct ata_queued_cmd *qc) | ||
1511 | { | 1477 | { |
1512 | struct ata_eh_info *ehi = &ap->link.eh_info; | 1478 | ap->stats.idle_irq++; |
1513 | u8 status, host_stat = 0; | 1479 | |
1514 | bool bmdma_stopped = false; | 1480 | #ifdef ATA_IRQ_TRAP |
1481 | if ((ap->stats.idle_irq % 1000) == 0) { | ||
1482 | ap->ops->sff_check_status(ap); | ||
1483 | if (ap->ops->sff_irq_clear) | ||
1484 | ap->ops->sff_irq_clear(ap); | ||
1485 | ata_port_printk(ap, KERN_WARNING, "irq trap\n"); | ||
1486 | return 1; | ||
1487 | } | ||
1488 | #endif | ||
1489 | return 0; /* irq not handled */ | ||
1490 | } | ||
1491 | |||
1492 | static unsigned int __ata_sff_port_intr(struct ata_port *ap, | ||
1493 | struct ata_queued_cmd *qc, | ||
1494 | bool hsmv_on_idle) | ||
1495 | { | ||
1496 | u8 status; | ||
1515 | 1497 | ||
1516 | VPRINTK("ata%u: protocol %d task_state %d\n", | 1498 | VPRINTK("ata%u: protocol %d task_state %d\n", |
1517 | ap->print_id, qc->tf.protocol, ap->hsm_task_state); | 1499 | ap->print_id, qc->tf.protocol, ap->hsm_task_state); |
@@ -1528,90 +1510,56 @@ unsigned int ata_sff_host_intr(struct ata_port *ap, | |||
1528 | * need to check ata_is_atapi(qc->tf.protocol) again. | 1510 | * need to check ata_is_atapi(qc->tf.protocol) again. |
1529 | */ | 1511 | */ |
1530 | if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) | 1512 | if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) |
1531 | goto idle_irq; | 1513 | return ata_sff_idle_irq(ap); |
1532 | break; | ||
1533 | case HSM_ST_LAST: | ||
1534 | if (qc->tf.protocol == ATA_PROT_DMA || | ||
1535 | qc->tf.protocol == ATAPI_PROT_DMA) { | ||
1536 | /* check status of DMA engine */ | ||
1537 | host_stat = ap->ops->bmdma_status(ap); | ||
1538 | VPRINTK("ata%u: host_stat 0x%X\n", | ||
1539 | ap->print_id, host_stat); | ||
1540 | |||
1541 | /* if it's not our irq... */ | ||
1542 | if (!(host_stat & ATA_DMA_INTR)) | ||
1543 | goto idle_irq; | ||
1544 | |||
1545 | /* before we do anything else, clear DMA-Start bit */ | ||
1546 | ap->ops->bmdma_stop(qc); | ||
1547 | bmdma_stopped = true; | ||
1548 | |||
1549 | if (unlikely(host_stat & ATA_DMA_ERR)) { | ||
1550 | /* error when transfering data to/from memory */ | ||
1551 | qc->err_mask |= AC_ERR_HOST_BUS; | ||
1552 | ap->hsm_task_state = HSM_ST_ERR; | ||
1553 | } | ||
1554 | } | ||
1555 | break; | 1514 | break; |
1556 | case HSM_ST: | 1515 | case HSM_ST: |
1516 | case HSM_ST_LAST: | ||
1557 | break; | 1517 | break; |
1558 | default: | 1518 | default: |
1559 | goto idle_irq; | 1519 | return ata_sff_idle_irq(ap); |
1560 | } | 1520 | } |
1561 | 1521 | ||
1562 | |||
1563 | /* check main status, clearing INTRQ if needed */ | 1522 | /* check main status, clearing INTRQ if needed */ |
1564 | status = ata_sff_irq_status(ap); | 1523 | status = ata_sff_irq_status(ap); |
1565 | if (status & ATA_BUSY) { | 1524 | if (status & ATA_BUSY) { |
1566 | if (bmdma_stopped) { | 1525 | if (hsmv_on_idle) { |
1567 | /* BMDMA engine is already stopped, we're screwed */ | 1526 | /* BMDMA engine is already stopped, we're screwed */ |
1568 | qc->err_mask |= AC_ERR_HSM; | 1527 | qc->err_mask |= AC_ERR_HSM; |
1569 | ap->hsm_task_state = HSM_ST_ERR; | 1528 | ap->hsm_task_state = HSM_ST_ERR; |
1570 | } else | 1529 | } else |
1571 | goto idle_irq; | 1530 | return ata_sff_idle_irq(ap); |
1572 | } | 1531 | } |
1573 | 1532 | ||
1574 | /* clear irq events */ | 1533 | /* clear irq events */ |
1575 | ap->ops->sff_irq_clear(ap); | 1534 | if (ap->ops->sff_irq_clear) |
1535 | ap->ops->sff_irq_clear(ap); | ||
1576 | 1536 | ||
1577 | ata_sff_hsm_move(ap, qc, status, 0); | 1537 | ata_sff_hsm_move(ap, qc, status, 0); |
1578 | 1538 | ||
1579 | if (unlikely(qc->err_mask) && (qc->tf.protocol == ATA_PROT_DMA || | ||
1580 | qc->tf.protocol == ATAPI_PROT_DMA)) | ||
1581 | ata_ehi_push_desc(ehi, "BMDMA stat 0x%x", host_stat); | ||
1582 | |||
1583 | return 1; /* irq handled */ | 1539 | return 1; /* irq handled */ |
1584 | |||
1585 | idle_irq: | ||
1586 | ap->stats.idle_irq++; | ||
1587 | |||
1588 | #ifdef ATA_IRQ_TRAP | ||
1589 | if ((ap->stats.idle_irq % 1000) == 0) { | ||
1590 | ap->ops->sff_check_status(ap); | ||
1591 | ap->ops->sff_irq_clear(ap); | ||
1592 | ata_port_printk(ap, KERN_WARNING, "irq trap\n"); | ||
1593 | return 1; | ||
1594 | } | ||
1595 | #endif | ||
1596 | return 0; /* irq not handled */ | ||
1597 | } | 1540 | } |
1598 | EXPORT_SYMBOL_GPL(ata_sff_host_intr); | ||
1599 | 1541 | ||
1600 | /** | 1542 | /** |
1601 | * ata_sff_interrupt - Default ATA host interrupt handler | 1543 | * ata_sff_port_intr - Handle SFF port interrupt |
1602 | * @irq: irq line (unused) | 1544 | * @ap: Port on which interrupt arrived (possibly...) |
1603 | * @dev_instance: pointer to our ata_host information structure | 1545 | * @qc: Taskfile currently active in engine |
1604 | * | 1546 | * |
1605 | * Default interrupt handler for PCI IDE devices. Calls | 1547 | * Handle port interrupt for given queued command. |
1606 | * ata_sff_host_intr() for each port that is not disabled. | ||
1607 | * | 1548 | * |
1608 | * LOCKING: | 1549 | * LOCKING: |
1609 | * Obtains host lock during operation. | 1550 | * spin_lock_irqsave(host lock) |
1610 | * | 1551 | * |
1611 | * RETURNS: | 1552 | * RETURNS: |
1612 | * IRQ_NONE or IRQ_HANDLED. | 1553 | * One if interrupt was handled, zero if not (shared irq). |
1613 | */ | 1554 | */ |
1614 | irqreturn_t ata_sff_interrupt(int irq, void *dev_instance) | 1555 | unsigned int ata_sff_port_intr(struct ata_port *ap, struct ata_queued_cmd *qc) |
1556 | { | ||
1557 | return __ata_sff_port_intr(ap, qc, false); | ||
1558 | } | ||
1559 | EXPORT_SYMBOL_GPL(ata_sff_port_intr); | ||
1560 | |||
1561 | static inline irqreturn_t __ata_sff_interrupt(int irq, void *dev_instance, | ||
1562 | unsigned int (*port_intr)(struct ata_port *, struct ata_queued_cmd *)) | ||
1615 | { | 1563 | { |
1616 | struct ata_host *host = dev_instance; | 1564 | struct ata_host *host = dev_instance; |
1617 | bool retried = false; | 1565 | bool retried = false; |
@@ -1631,7 +1579,7 @@ retry: | |||
1631 | qc = ata_qc_from_tag(ap, ap->link.active_tag); | 1579 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
1632 | if (qc) { | 1580 | if (qc) { |
1633 | if (!(qc->tf.flags & ATA_TFLAG_POLLING)) | 1581 | if (!(qc->tf.flags & ATA_TFLAG_POLLING)) |
1634 | handled |= ata_sff_host_intr(ap, qc); | 1582 | handled |= port_intr(ap, qc); |
1635 | else | 1583 | else |
1636 | polling |= 1 << i; | 1584 | polling |= 1 << i; |
1637 | } else | 1585 | } else |
@@ -1658,7 +1606,8 @@ retry: | |||
1658 | 1606 | ||
1659 | if (idle & (1 << i)) { | 1607 | if (idle & (1 << i)) { |
1660 | ap->ops->sff_check_status(ap); | 1608 | ap->ops->sff_check_status(ap); |
1661 | ap->ops->sff_irq_clear(ap); | 1609 | if (ap->ops->sff_irq_clear) |
1610 | ap->ops->sff_irq_clear(ap); | ||
1662 | } else { | 1611 | } else { |
1663 | /* clear INTRQ and check if BUSY cleared */ | 1612 | /* clear INTRQ and check if BUSY cleared */ |
1664 | if (!(ap->ops->sff_check_status(ap) & ATA_BUSY)) | 1613 | if (!(ap->ops->sff_check_status(ap) & ATA_BUSY)) |
@@ -1680,6 +1629,25 @@ retry: | |||
1680 | 1629 | ||
1681 | return IRQ_RETVAL(handled); | 1630 | return IRQ_RETVAL(handled); |
1682 | } | 1631 | } |
1632 | |||
1633 | /** | ||
1634 | * ata_sff_interrupt - Default SFF ATA host interrupt handler | ||
1635 | * @irq: irq line (unused) | ||
1636 | * @dev_instance: pointer to our ata_host information structure | ||
1637 | * | ||
1638 | * Default interrupt handler for PCI IDE devices. Calls | ||
1639 | * ata_sff_port_intr() for each port that is not disabled. | ||
1640 | * | ||
1641 | * LOCKING: | ||
1642 | * Obtains host lock during operation. | ||
1643 | * | ||
1644 | * RETURNS: | ||
1645 | * IRQ_NONE or IRQ_HANDLED. | ||
1646 | */ | ||
1647 | irqreturn_t ata_sff_interrupt(int irq, void *dev_instance) | ||
1648 | { | ||
1649 | return __ata_sff_interrupt(irq, dev_instance, ata_sff_port_intr); | ||
1650 | } | ||
1683 | EXPORT_SYMBOL_GPL(ata_sff_interrupt); | 1651 | EXPORT_SYMBOL_GPL(ata_sff_interrupt); |
1684 | 1652 | ||
1685 | /** | 1653 | /** |
@@ -1717,7 +1685,7 @@ void ata_sff_lost_interrupt(struct ata_port *ap) | |||
1717 | status); | 1685 | status); |
1718 | /* Run the host interrupt logic as if the interrupt had not been | 1686 | /* Run the host interrupt logic as if the interrupt had not been |
1719 | lost */ | 1687 | lost */ |
1720 | ata_sff_host_intr(ap, qc); | 1688 | ata_sff_port_intr(ap, qc); |
1721 | } | 1689 | } |
1722 | EXPORT_SYMBOL_GPL(ata_sff_lost_interrupt); | 1690 | EXPORT_SYMBOL_GPL(ata_sff_lost_interrupt); |
1723 | 1691 | ||
@@ -1744,7 +1712,8 @@ void ata_sff_freeze(struct ata_port *ap) | |||
1744 | */ | 1712 | */ |
1745 | ap->ops->sff_check_status(ap); | 1713 | ap->ops->sff_check_status(ap); |
1746 | 1714 | ||
1747 | ap->ops->sff_irq_clear(ap); | 1715 | if (ap->ops->sff_irq_clear) |
1716 | ap->ops->sff_irq_clear(ap); | ||
1748 | } | 1717 | } |
1749 | EXPORT_SYMBOL_GPL(ata_sff_freeze); | 1718 | EXPORT_SYMBOL_GPL(ata_sff_freeze); |
1750 | 1719 | ||
@@ -1761,7 +1730,8 @@ void ata_sff_thaw(struct ata_port *ap) | |||
1761 | { | 1730 | { |
1762 | /* clear & re-enable interrupts */ | 1731 | /* clear & re-enable interrupts */ |
1763 | ap->ops->sff_check_status(ap); | 1732 | ap->ops->sff_check_status(ap); |
1764 | ap->ops->sff_irq_clear(ap); | 1733 | if (ap->ops->sff_irq_clear) |
1734 | ap->ops->sff_irq_clear(ap); | ||
1765 | ata_sff_irq_on(ap); | 1735 | ata_sff_irq_on(ap); |
1766 | } | 1736 | } |
1767 | EXPORT_SYMBOL_GPL(ata_sff_thaw); | 1737 | EXPORT_SYMBOL_GPL(ata_sff_thaw); |
@@ -2349,13 +2319,13 @@ int ata_pci_sff_init_host(struct ata_host *host) | |||
2349 | EXPORT_SYMBOL_GPL(ata_pci_sff_init_host); | 2319 | EXPORT_SYMBOL_GPL(ata_pci_sff_init_host); |
2350 | 2320 | ||
2351 | /** | 2321 | /** |
2352 | * ata_pci_sff_prepare_host - helper to prepare native PCI ATA host | 2322 | * ata_pci_sff_prepare_host - helper to prepare PCI PIO-only SFF ATA host |
2353 | * @pdev: target PCI device | 2323 | * @pdev: target PCI device |
2354 | * @ppi: array of port_info, must be enough for two ports | 2324 | * @ppi: array of port_info, must be enough for two ports |
2355 | * @r_host: out argument for the initialized ATA host | 2325 | * @r_host: out argument for the initialized ATA host |
2356 | * | 2326 | * |
2357 | * Helper to allocate ATA host for @pdev, acquire all native PCI | 2327 | * Helper to allocate PIO-only SFF ATA host for @pdev, acquire |
2358 | * resources and initialize it accordingly in one go. | 2328 | * all PCI resources and initialize it accordingly in one go. |
2359 | * | 2329 | * |
2360 | * LOCKING: | 2330 | * LOCKING: |
2361 | * Inherited from calling layer (may sleep). | 2331 | * Inherited from calling layer (may sleep). |
@@ -2385,9 +2355,6 @@ int ata_pci_sff_prepare_host(struct pci_dev *pdev, | |||
2385 | if (rc) | 2355 | if (rc) |
2386 | goto err_out; | 2356 | goto err_out; |
2387 | 2357 | ||
2388 | /* init DMA related stuff */ | ||
2389 | ata_pci_bmdma_init(host); | ||
2390 | |||
2391 | devres_remove_group(&pdev->dev, NULL); | 2358 | devres_remove_group(&pdev->dev, NULL); |
2392 | *r_host = host; | 2359 | *r_host = host; |
2393 | return 0; | 2360 | return 0; |
@@ -2492,8 +2459,21 @@ out: | |||
2492 | } | 2459 | } |
2493 | EXPORT_SYMBOL_GPL(ata_pci_sff_activate_host); | 2460 | EXPORT_SYMBOL_GPL(ata_pci_sff_activate_host); |
2494 | 2461 | ||
2462 | static const struct ata_port_info *ata_sff_find_valid_pi( | ||
2463 | const struct ata_port_info * const *ppi) | ||
2464 | { | ||
2465 | int i; | ||
2466 | |||
2467 | /* look up the first valid port_info */ | ||
2468 | for (i = 0; i < 2 && ppi[i]; i++) | ||
2469 | if (ppi[i]->port_ops != &ata_dummy_port_ops) | ||
2470 | return ppi[i]; | ||
2471 | |||
2472 | return NULL; | ||
2473 | } | ||
2474 | |||
2495 | /** | 2475 | /** |
2496 | * ata_pci_sff_init_one - Initialize/register PCI IDE host controller | 2476 | * ata_pci_sff_init_one - Initialize/register PIO-only PCI IDE controller |
2497 | * @pdev: Controller to be initialized | 2477 | * @pdev: Controller to be initialized |
2498 | * @ppi: array of port_info, must be enough for two ports | 2478 | * @ppi: array of port_info, must be enough for two ports |
2499 | * @sht: scsi_host_template to use when registering the host | 2479 | * @sht: scsi_host_template to use when registering the host |
@@ -2502,11 +2482,7 @@ EXPORT_SYMBOL_GPL(ata_pci_sff_activate_host); | |||
2502 | * | 2482 | * |
2503 | * This is a helper function which can be called from a driver's | 2483 | * This is a helper function which can be called from a driver's |
2504 | * xxx_init_one() probe function if the hardware uses traditional | 2484 | * xxx_init_one() probe function if the hardware uses traditional |
2505 | * IDE taskfile registers. | 2485 | * IDE taskfile registers and is PIO only. |
2506 | * | ||
2507 | * This function calls pci_enable_device(), reserves its register | ||
2508 | * regions, sets the dma mask, enables bus master mode, and calls | ||
2509 | * ata_device_add() | ||
2510 | * | 2486 | * |
2511 | * ASSUMPTION: | 2487 | * ASSUMPTION: |
2512 | * Nobody makes a single channel controller that appears solely as | 2488 | * Nobody makes a single channel controller that appears solely as |
@@ -2523,20 +2499,13 @@ int ata_pci_sff_init_one(struct pci_dev *pdev, | |||
2523 | struct scsi_host_template *sht, void *host_priv, int hflag) | 2499 | struct scsi_host_template *sht, void *host_priv, int hflag) |
2524 | { | 2500 | { |
2525 | struct device *dev = &pdev->dev; | 2501 | struct device *dev = &pdev->dev; |
2526 | const struct ata_port_info *pi = NULL; | 2502 | const struct ata_port_info *pi; |
2527 | struct ata_host *host = NULL; | 2503 | struct ata_host *host = NULL; |
2528 | int i, rc; | 2504 | int rc; |
2529 | 2505 | ||
2530 | DPRINTK("ENTER\n"); | 2506 | DPRINTK("ENTER\n"); |
2531 | 2507 | ||
2532 | /* look up the first valid port_info */ | 2508 | pi = ata_sff_find_valid_pi(ppi); |
2533 | for (i = 0; i < 2 && ppi[i]; i++) { | ||
2534 | if (ppi[i]->port_ops != &ata_dummy_port_ops) { | ||
2535 | pi = ppi[i]; | ||
2536 | break; | ||
2537 | } | ||
2538 | } | ||
2539 | |||
2540 | if (!pi) { | 2509 | if (!pi) { |
2541 | dev_printk(KERN_ERR, &pdev->dev, | 2510 | dev_printk(KERN_ERR, &pdev->dev, |
2542 | "no valid port_info specified\n"); | 2511 | "no valid port_info specified\n"); |
@@ -2557,7 +2526,6 @@ int ata_pci_sff_init_one(struct pci_dev *pdev, | |||
2557 | host->private_data = host_priv; | 2526 | host->private_data = host_priv; |
2558 | host->flags |= hflag; | 2527 | host->flags |= hflag; |
2559 | 2528 | ||
2560 | pci_set_master(pdev); | ||
2561 | rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht); | 2529 | rc = ata_pci_sff_activate_host(host, ata_sff_interrupt, sht); |
2562 | out: | 2530 | out: |
2563 | if (rc == 0) | 2531 | if (rc == 0) |
@@ -2571,6 +2539,12 @@ EXPORT_SYMBOL_GPL(ata_pci_sff_init_one); | |||
2571 | 2539 | ||
2572 | #endif /* CONFIG_PCI */ | 2540 | #endif /* CONFIG_PCI */ |
2573 | 2541 | ||
2542 | /* | ||
2543 | * BMDMA support | ||
2544 | */ | ||
2545 | |||
2546 | #ifdef CONFIG_ATA_BMDMA | ||
2547 | |||
2574 | const struct ata_port_operations ata_bmdma_port_ops = { | 2548 | const struct ata_port_operations ata_bmdma_port_ops = { |
2575 | .inherits = &ata_sff_port_ops, | 2549 | .inherits = &ata_sff_port_ops, |
2576 | 2550 | ||
@@ -2580,6 +2554,7 @@ const struct ata_port_operations ata_bmdma_port_ops = { | |||
2580 | .qc_prep = ata_bmdma_qc_prep, | 2554 | .qc_prep = ata_bmdma_qc_prep, |
2581 | .qc_issue = ata_bmdma_qc_issue, | 2555 | .qc_issue = ata_bmdma_qc_issue, |
2582 | 2556 | ||
2557 | .sff_irq_clear = ata_bmdma_irq_clear, | ||
2583 | .bmdma_setup = ata_bmdma_setup, | 2558 | .bmdma_setup = ata_bmdma_setup, |
2584 | .bmdma_start = ata_bmdma_start, | 2559 | .bmdma_start = ata_bmdma_start, |
2585 | .bmdma_stop = ata_bmdma_stop, | 2560 | .bmdma_stop = ata_bmdma_stop, |
@@ -2804,6 +2779,75 @@ unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc) | |||
2804 | EXPORT_SYMBOL_GPL(ata_bmdma_qc_issue); | 2779 | EXPORT_SYMBOL_GPL(ata_bmdma_qc_issue); |
2805 | 2780 | ||
2806 | /** | 2781 | /** |
2782 | * ata_bmdma_port_intr - Handle BMDMA port interrupt | ||
2783 | * @ap: Port on which interrupt arrived (possibly...) | ||
2784 | * @qc: Taskfile currently active in engine | ||
2785 | * | ||
2786 | * Handle port interrupt for given queued command. | ||
2787 | * | ||
2788 | * LOCKING: | ||
2789 | * spin_lock_irqsave(host lock) | ||
2790 | * | ||
2791 | * RETURNS: | ||
2792 | * One if interrupt was handled, zero if not (shared irq). | ||
2793 | */ | ||
2794 | unsigned int ata_bmdma_port_intr(struct ata_port *ap, struct ata_queued_cmd *qc) | ||
2795 | { | ||
2796 | struct ata_eh_info *ehi = &ap->link.eh_info; | ||
2797 | u8 host_stat = 0; | ||
2798 | bool bmdma_stopped = false; | ||
2799 | unsigned int handled; | ||
2800 | |||
2801 | if (ap->hsm_task_state == HSM_ST_LAST && ata_is_dma(qc->tf.protocol)) { | ||
2802 | /* check status of DMA engine */ | ||
2803 | host_stat = ap->ops->bmdma_status(ap); | ||
2804 | VPRINTK("ata%u: host_stat 0x%X\n", ap->print_id, host_stat); | ||
2805 | |||
2806 | /* if it's not our irq... */ | ||
2807 | if (!(host_stat & ATA_DMA_INTR)) | ||
2808 | return ata_sff_idle_irq(ap); | ||
2809 | |||
2810 | /* before we do anything else, clear DMA-Start bit */ | ||
2811 | ap->ops->bmdma_stop(qc); | ||
2812 | bmdma_stopped = true; | ||
2813 | |||
2814 | if (unlikely(host_stat & ATA_DMA_ERR)) { | ||
2815 | /* error when transfering data to/from memory */ | ||
2816 | qc->err_mask |= AC_ERR_HOST_BUS; | ||
2817 | ap->hsm_task_state = HSM_ST_ERR; | ||
2818 | } | ||
2819 | } | ||
2820 | |||
2821 | handled = __ata_sff_port_intr(ap, qc, bmdma_stopped); | ||
2822 | |||
2823 | if (unlikely(qc->err_mask) && ata_is_dma(qc->tf.protocol)) | ||
2824 | ata_ehi_push_desc(ehi, "BMDMA stat 0x%x", host_stat); | ||
2825 | |||
2826 | return handled; | ||
2827 | } | ||
2828 | EXPORT_SYMBOL_GPL(ata_bmdma_port_intr); | ||
2829 | |||
2830 | /** | ||
2831 | * ata_bmdma_interrupt - Default BMDMA ATA host interrupt handler | ||
2832 | * @irq: irq line (unused) | ||
2833 | * @dev_instance: pointer to our ata_host information structure | ||
2834 | * | ||
2835 | * Default interrupt handler for PCI IDE devices. Calls | ||
2836 | * ata_bmdma_port_intr() for each port that is not disabled. | ||
2837 | * | ||
2838 | * LOCKING: | ||
2839 | * Obtains host lock during operation. | ||
2840 | * | ||
2841 | * RETURNS: | ||
2842 | * IRQ_NONE or IRQ_HANDLED. | ||
2843 | */ | ||
2844 | irqreturn_t ata_bmdma_interrupt(int irq, void *dev_instance) | ||
2845 | { | ||
2846 | return __ata_sff_interrupt(irq, dev_instance, ata_bmdma_port_intr); | ||
2847 | } | ||
2848 | EXPORT_SYMBOL_GPL(ata_bmdma_interrupt); | ||
2849 | |||
2850 | /** | ||
2807 | * ata_bmdma_error_handler - Stock error handler for BMDMA controller | 2851 | * ata_bmdma_error_handler - Stock error handler for BMDMA controller |
2808 | * @ap: port to handle error for | 2852 | * @ap: port to handle error for |
2809 | * | 2853 | * |
@@ -2848,7 +2892,8 @@ void ata_bmdma_error_handler(struct ata_port *ap) | |||
2848 | /* if we're gonna thaw, make sure IRQ is clear */ | 2892 | /* if we're gonna thaw, make sure IRQ is clear */ |
2849 | if (thaw) { | 2893 | if (thaw) { |
2850 | ap->ops->sff_check_status(ap); | 2894 | ap->ops->sff_check_status(ap); |
2851 | ap->ops->sff_irq_clear(ap); | 2895 | if (ap->ops->sff_irq_clear) |
2896 | ap->ops->sff_irq_clear(ap); | ||
2852 | } | 2897 | } |
2853 | } | 2898 | } |
2854 | 2899 | ||
@@ -2882,6 +2927,28 @@ void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc) | |||
2882 | EXPORT_SYMBOL_GPL(ata_bmdma_post_internal_cmd); | 2927 | EXPORT_SYMBOL_GPL(ata_bmdma_post_internal_cmd); |
2883 | 2928 | ||
2884 | /** | 2929 | /** |
2930 | * ata_bmdma_irq_clear - Clear PCI IDE BMDMA interrupt. | ||
2931 | * @ap: Port associated with this ATA transaction. | ||
2932 | * | ||
2933 | * Clear interrupt and error flags in DMA status register. | ||
2934 | * | ||
2935 | * May be used as the irq_clear() entry in ata_port_operations. | ||
2936 | * | ||
2937 | * LOCKING: | ||
2938 | * spin_lock_irqsave(host lock) | ||
2939 | */ | ||
2940 | void ata_bmdma_irq_clear(struct ata_port *ap) | ||
2941 | { | ||
2942 | void __iomem *mmio = ap->ioaddr.bmdma_addr; | ||
2943 | |||
2944 | if (!mmio) | ||
2945 | return; | ||
2946 | |||
2947 | iowrite8(ioread8(mmio + ATA_DMA_STATUS), mmio + ATA_DMA_STATUS); | ||
2948 | } | ||
2949 | EXPORT_SYMBOL_GPL(ata_bmdma_irq_clear); | ||
2950 | |||
2951 | /** | ||
2885 | * ata_bmdma_setup - Set up PCI IDE BMDMA transaction | 2952 | * ata_bmdma_setup - Set up PCI IDE BMDMA transaction |
2886 | * @qc: Info associated with this ATA transaction. | 2953 | * @qc: Info associated with this ATA transaction. |
2887 | * | 2954 | * |
@@ -3137,7 +3204,100 @@ void ata_pci_bmdma_init(struct ata_host *host) | |||
3137 | } | 3204 | } |
3138 | EXPORT_SYMBOL_GPL(ata_pci_bmdma_init); | 3205 | EXPORT_SYMBOL_GPL(ata_pci_bmdma_init); |
3139 | 3206 | ||
3207 | /** | ||
3208 | * ata_pci_bmdma_prepare_host - helper to prepare PCI BMDMA ATA host | ||
3209 | * @pdev: target PCI device | ||
3210 | * @ppi: array of port_info, must be enough for two ports | ||
3211 | * @r_host: out argument for the initialized ATA host | ||
3212 | * | ||
3213 | * Helper to allocate BMDMA ATA host for @pdev, acquire all PCI | ||
3214 | * resources and initialize it accordingly in one go. | ||
3215 | * | ||
3216 | * LOCKING: | ||
3217 | * Inherited from calling layer (may sleep). | ||
3218 | * | ||
3219 | * RETURNS: | ||
3220 | * 0 on success, -errno otherwise. | ||
3221 | */ | ||
3222 | int ata_pci_bmdma_prepare_host(struct pci_dev *pdev, | ||
3223 | const struct ata_port_info * const * ppi, | ||
3224 | struct ata_host **r_host) | ||
3225 | { | ||
3226 | int rc; | ||
3227 | |||
3228 | rc = ata_pci_sff_prepare_host(pdev, ppi, r_host); | ||
3229 | if (rc) | ||
3230 | return rc; | ||
3231 | |||
3232 | ata_pci_bmdma_init(*r_host); | ||
3233 | return 0; | ||
3234 | } | ||
3235 | EXPORT_SYMBOL_GPL(ata_pci_bmdma_prepare_host); | ||
3236 | |||
3237 | /** | ||
3238 | * ata_pci_bmdma_init_one - Initialize/register BMDMA PCI IDE controller | ||
3239 | * @pdev: Controller to be initialized | ||
3240 | * @ppi: array of port_info, must be enough for two ports | ||
3241 | * @sht: scsi_host_template to use when registering the host | ||
3242 | * @host_priv: host private_data | ||
3243 | * @hflags: host flags | ||
3244 | * | ||
3245 | * This function is similar to ata_pci_sff_init_one() but also | ||
3246 | * takes care of BMDMA initialization. | ||
3247 | * | ||
3248 | * LOCKING: | ||
3249 | * Inherited from PCI layer (may sleep). | ||
3250 | * | ||
3251 | * RETURNS: | ||
3252 | * Zero on success, negative on errno-based value on error. | ||
3253 | */ | ||
3254 | int ata_pci_bmdma_init_one(struct pci_dev *pdev, | ||
3255 | const struct ata_port_info * const * ppi, | ||
3256 | struct scsi_host_template *sht, void *host_priv, | ||
3257 | int hflags) | ||
3258 | { | ||
3259 | struct device *dev = &pdev->dev; | ||
3260 | const struct ata_port_info *pi; | ||
3261 | struct ata_host *host = NULL; | ||
3262 | int rc; | ||
3263 | |||
3264 | DPRINTK("ENTER\n"); | ||
3265 | |||
3266 | pi = ata_sff_find_valid_pi(ppi); | ||
3267 | if (!pi) { | ||
3268 | dev_printk(KERN_ERR, &pdev->dev, | ||
3269 | "no valid port_info specified\n"); | ||
3270 | return -EINVAL; | ||
3271 | } | ||
3272 | |||
3273 | if (!devres_open_group(dev, NULL, GFP_KERNEL)) | ||
3274 | return -ENOMEM; | ||
3275 | |||
3276 | rc = pcim_enable_device(pdev); | ||
3277 | if (rc) | ||
3278 | goto out; | ||
3279 | |||
3280 | /* prepare and activate BMDMA host */ | ||
3281 | rc = ata_pci_bmdma_prepare_host(pdev, ppi, &host); | ||
3282 | if (rc) | ||
3283 | goto out; | ||
3284 | host->private_data = host_priv; | ||
3285 | host->flags |= hflags; | ||
3286 | |||
3287 | pci_set_master(pdev); | ||
3288 | rc = ata_pci_sff_activate_host(host, ata_bmdma_interrupt, sht); | ||
3289 | out: | ||
3290 | if (rc == 0) | ||
3291 | devres_remove_group(&pdev->dev, NULL); | ||
3292 | else | ||
3293 | devres_release_group(&pdev->dev, NULL); | ||
3294 | |||
3295 | return rc; | ||
3296 | } | ||
3297 | EXPORT_SYMBOL_GPL(ata_pci_bmdma_init_one); | ||
3298 | |||
3140 | #endif /* CONFIG_PCI */ | 3299 | #endif /* CONFIG_PCI */ |
3300 | #endif /* CONFIG_ATA_BMDMA */ | ||
3141 | 3301 | ||
3142 | /** | 3302 | /** |
3143 | * ata_sff_port_init - Initialize SFF/BMDMA ATA port | 3303 | * ata_sff_port_init - Initialize SFF/BMDMA ATA port |
diff --git a/drivers/ata/pata_acpi.c b/drivers/ata/pata_acpi.c index 066b9f301ed5..c8d47034d5e9 100644 --- a/drivers/ata/pata_acpi.c +++ b/drivers/ata/pata_acpi.c | |||
@@ -260,7 +260,7 @@ static int pacpi_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
260 | return rc; | 260 | return rc; |
261 | pcim_pin_device(pdev); | 261 | pcim_pin_device(pdev); |
262 | } | 262 | } |
263 | return ata_pci_sff_init_one(pdev, ppi, &pacpi_sht, NULL, 0); | 263 | return ata_pci_bmdma_init_one(pdev, ppi, &pacpi_sht, NULL, 0); |
264 | } | 264 | } |
265 | 265 | ||
266 | static const struct pci_device_id pacpi_pci_tbl[] = { | 266 | static const struct pci_device_id pacpi_pci_tbl[] = { |
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index f306e10c748d..794ec6e3275d 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -583,7 +583,10 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
583 | ppi[0] = &info_20_udma; | 583 | ppi[0] = &info_20_udma; |
584 | } | 584 | } |
585 | 585 | ||
586 | return ata_pci_sff_init_one(pdev, ppi, &ali_sht, NULL, 0); | 586 | if (!ppi[0]->mwdma_mask && !ppi[0]->udma_mask) |
587 | return ata_pci_sff_init_one(pdev, ppi, &ali_sht, NULL, 0); | ||
588 | else | ||
589 | return ata_pci_bmdma_init_one(pdev, ppi, &ali_sht, NULL, 0); | ||
587 | } | 590 | } |
588 | 591 | ||
589 | #ifdef CONFIG_PM | 592 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_amd.c b/drivers/ata/pata_amd.c index d95eca9c547e..620a07cabe31 100644 --- a/drivers/ata/pata_amd.c +++ b/drivers/ata/pata_amd.c | |||
@@ -574,7 +574,7 @@ static int amd_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
574 | } | 574 | } |
575 | 575 | ||
576 | /* And fire it up */ | 576 | /* And fire it up */ |
577 | return ata_pci_sff_init_one(pdev, ppi, &amd_sht, hpriv, 0); | 577 | return ata_pci_bmdma_init_one(pdev, ppi, &amd_sht, hpriv, 0); |
578 | } | 578 | } |
579 | 579 | ||
580 | #ifdef CONFIG_PM | 580 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_artop.c b/drivers/ata/pata_artop.c index 4d066d6c30fa..ba43f0f8c880 100644 --- a/drivers/ata/pata_artop.c +++ b/drivers/ata/pata_artop.c | |||
@@ -421,7 +421,7 @@ static int artop_init_one (struct pci_dev *pdev, const struct pci_device_id *id) | |||
421 | 421 | ||
422 | BUG_ON(ppi[0] == NULL); | 422 | BUG_ON(ppi[0] == NULL); |
423 | 423 | ||
424 | return ata_pci_sff_init_one(pdev, ppi, &artop_sht, NULL, 0); | 424 | return ata_pci_bmdma_init_one(pdev, ppi, &artop_sht, NULL, 0); |
425 | } | 425 | } |
426 | 426 | ||
427 | static const struct pci_device_id artop_pci_tbl[] = { | 427 | static const struct pci_device_id artop_pci_tbl[] = { |
diff --git a/drivers/ata/pata_atiixp.c b/drivers/ata/pata_atiixp.c index 44d88b380ddd..43755616dc5a 100644 --- a/drivers/ata/pata_atiixp.c +++ b/drivers/ata/pata_atiixp.c | |||
@@ -246,8 +246,8 @@ static int atiixp_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
246 | if (!pci_test_config_bits(pdev, &atiixp_enable_bits[i])) | 246 | if (!pci_test_config_bits(pdev, &atiixp_enable_bits[i])) |
247 | ppi[i] = &ata_dummy_port_info; | 247 | ppi[i] = &ata_dummy_port_info; |
248 | 248 | ||
249 | return ata_pci_sff_init_one(pdev, ppi, &atiixp_sht, NULL, | 249 | return ata_pci_bmdma_init_one(pdev, ppi, &atiixp_sht, NULL, |
250 | ATA_HOST_PARALLEL_SCAN); | 250 | ATA_HOST_PARALLEL_SCAN); |
251 | } | 251 | } |
252 | 252 | ||
253 | static const struct pci_device_id atiixp[] = { | 253 | static const struct pci_device_id atiixp[] = { |
diff --git a/drivers/ata/pata_atp867x.c b/drivers/ata/pata_atp867x.c index bb6e0746e07d..95295935dd95 100644 --- a/drivers/ata/pata_atp867x.c +++ b/drivers/ata/pata_atp867x.c | |||
@@ -525,7 +525,7 @@ static int atp867x_init_one(struct pci_dev *pdev, | |||
525 | 525 | ||
526 | pci_set_master(pdev); | 526 | pci_set_master(pdev); |
527 | 527 | ||
528 | rc = ata_host_activate(host, pdev->irq, ata_sff_interrupt, | 528 | rc = ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, |
529 | IRQF_SHARED, &atp867x_sht); | 529 | IRQF_SHARED, &atp867x_sht); |
530 | if (rc) | 530 | if (rc) |
531 | dev_printk(KERN_ERR, &pdev->dev, "failed to activate host\n"); | 531 | dev_printk(KERN_ERR, &pdev->dev, "failed to activate host\n"); |
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c index 6422cfd13d0d..9cae65de750e 100644 --- a/drivers/ata/pata_bf54x.c +++ b/drivers/ata/pata_bf54x.c | |||
@@ -1214,7 +1214,7 @@ static unsigned int bfin_data_xfer(struct ata_device *dev, unsigned char *buf, | |||
1214 | * bfin_irq_clear - Clear ATAPI interrupt. | 1214 | * bfin_irq_clear - Clear ATAPI interrupt. |
1215 | * @ap: Port associated with this ATA transaction. | 1215 | * @ap: Port associated with this ATA transaction. |
1216 | * | 1216 | * |
1217 | * Note: Original code is ata_sff_irq_clear(). | 1217 | * Note: Original code is ata_bmdma_irq_clear(). |
1218 | */ | 1218 | */ |
1219 | 1219 | ||
1220 | static void bfin_irq_clear(struct ata_port *ap) | 1220 | static void bfin_irq_clear(struct ata_port *ap) |
diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c index 4c81a71b8877..9f5da1c7454b 100644 --- a/drivers/ata/pata_cmd64x.c +++ b/drivers/ata/pata_cmd64x.c | |||
@@ -367,7 +367,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
367 | pci_write_config_byte(pdev, UDIDETCR0, 0xF0); | 367 | pci_write_config_byte(pdev, UDIDETCR0, 0xF0); |
368 | #endif | 368 | #endif |
369 | 369 | ||
370 | return ata_pci_sff_init_one(pdev, ppi, &cmd64x_sht, NULL, 0); | 370 | return ata_pci_bmdma_init_one(pdev, ppi, &cmd64x_sht, NULL, 0); |
371 | } | 371 | } |
372 | 372 | ||
373 | #ifdef CONFIG_PM | 373 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_cs5520.c b/drivers/ata/pata_cs5520.c index 17c5f346ff01..030952f1f97c 100644 --- a/drivers/ata/pata_cs5520.c +++ b/drivers/ata/pata_cs5520.c | |||
@@ -221,7 +221,7 @@ static int __devinit cs5520_init_one(struct pci_dev *pdev, const struct pci_devi | |||
221 | continue; | 221 | continue; |
222 | 222 | ||
223 | rc = devm_request_irq(&pdev->dev, irq[ap->port_no], | 223 | rc = devm_request_irq(&pdev->dev, irq[ap->port_no], |
224 | ata_sff_interrupt, 0, DRV_NAME, host); | 224 | ata_bmdma_interrupt, 0, DRV_NAME, host); |
225 | if (rc) | 225 | if (rc) |
226 | return rc; | 226 | return rc; |
227 | 227 | ||
diff --git a/drivers/ata/pata_cs5530.c b/drivers/ata/pata_cs5530.c index e809a4233a81..f792330f0d8e 100644 --- a/drivers/ata/pata_cs5530.c +++ b/drivers/ata/pata_cs5530.c | |||
@@ -324,7 +324,7 @@ static int cs5530_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
324 | ppi[1] = &info_palmax_secondary; | 324 | ppi[1] = &info_palmax_secondary; |
325 | 325 | ||
326 | /* Now kick off ATA set up */ | 326 | /* Now kick off ATA set up */ |
327 | return ata_pci_sff_init_one(pdev, ppi, &cs5530_sht, NULL, 0); | 327 | return ata_pci_bmdma_init_one(pdev, ppi, &cs5530_sht, NULL, 0); |
328 | } | 328 | } |
329 | 329 | ||
330 | #ifdef CONFIG_PM | 330 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_cs5535.c b/drivers/ata/pata_cs5535.c index a02e6459fdcc..03a93186aa19 100644 --- a/drivers/ata/pata_cs5535.c +++ b/drivers/ata/pata_cs5535.c | |||
@@ -198,7 +198,7 @@ static int cs5535_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
198 | rdmsr(ATAC_CH0D1_PIO, timings, dummy); | 198 | rdmsr(ATAC_CH0D1_PIO, timings, dummy); |
199 | if (CS5535_BAD_PIO(timings)) | 199 | if (CS5535_BAD_PIO(timings)) |
200 | wrmsr(ATAC_CH0D1_PIO, 0xF7F4F7F4UL, 0); | 200 | wrmsr(ATAC_CH0D1_PIO, 0xF7F4F7F4UL, 0); |
201 | return ata_pci_sff_init_one(dev, ppi, &cs5535_sht, NULL, 0); | 201 | return ata_pci_bmdma_init_one(dev, ppi, &cs5535_sht, NULL, 0); |
202 | } | 202 | } |
203 | 203 | ||
204 | static const struct pci_device_id cs5535[] = { | 204 | static const struct pci_device_id cs5535[] = { |
diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c index 914ae3506ff5..21ee23f89e88 100644 --- a/drivers/ata/pata_cs5536.c +++ b/drivers/ata/pata_cs5536.c | |||
@@ -260,7 +260,7 @@ static int cs5536_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
260 | return -ENODEV; | 260 | return -ENODEV; |
261 | } | 261 | } |
262 | 262 | ||
263 | return ata_pci_sff_init_one(dev, ppi, &cs5536_sht, NULL, 0); | 263 | return ata_pci_bmdma_init_one(dev, ppi, &cs5536_sht, NULL, 0); |
264 | } | 264 | } |
265 | 265 | ||
266 | static const struct pci_device_id cs5536[] = { | 266 | static const struct pci_device_id cs5536[] = { |
diff --git a/drivers/ata/pata_cypress.c b/drivers/ata/pata_cypress.c index 0fcc096b8dac..6d915b063d93 100644 --- a/drivers/ata/pata_cypress.c +++ b/drivers/ata/pata_cypress.c | |||
@@ -138,7 +138,7 @@ static int cy82c693_init_one(struct pci_dev *pdev, const struct pci_device_id *i | |||
138 | if (PCI_FUNC(pdev->devfn) != 1) | 138 | if (PCI_FUNC(pdev->devfn) != 1) |
139 | return -ENODEV; | 139 | return -ENODEV; |
140 | 140 | ||
141 | return ata_pci_sff_init_one(pdev, ppi, &cy82c693_sht, NULL, 0); | 141 | return ata_pci_bmdma_init_one(pdev, ppi, &cy82c693_sht, NULL, 0); |
142 | } | 142 | } |
143 | 143 | ||
144 | static const struct pci_device_id cy82c693[] = { | 144 | static const struct pci_device_id cy82c693[] = { |
diff --git a/drivers/ata/pata_efar.c b/drivers/ata/pata_efar.c index 3bac0e079691..a08834758ea2 100644 --- a/drivers/ata/pata_efar.c +++ b/drivers/ata/pata_efar.c | |||
@@ -277,8 +277,8 @@ static int efar_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
277 | dev_printk(KERN_DEBUG, &pdev->dev, | 277 | dev_printk(KERN_DEBUG, &pdev->dev, |
278 | "version " DRV_VERSION "\n"); | 278 | "version " DRV_VERSION "\n"); |
279 | 279 | ||
280 | return ata_pci_sff_init_one(pdev, ppi, &efar_sht, NULL, | 280 | return ata_pci_bmdma_init_one(pdev, ppi, &efar_sht, NULL, |
281 | ATA_HOST_PARALLEL_SCAN); | 281 | ATA_HOST_PARALLEL_SCAN); |
282 | } | 282 | } |
283 | 283 | ||
284 | static const struct pci_device_id efar_pci_tbl[] = { | 284 | static const struct pci_device_id efar_pci_tbl[] = { |
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c index 8580eb3cd54d..7688868557b9 100644 --- a/drivers/ata/pata_hpt366.c +++ b/drivers/ata/pata_hpt366.c | |||
@@ -361,7 +361,7 @@ static int hpt36x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
361 | break; | 361 | break; |
362 | } | 362 | } |
363 | /* Now kick off ATA set up */ | 363 | /* Now kick off ATA set up */ |
364 | return ata_pci_sff_init_one(dev, ppi, &hpt36x_sht, hpriv, 0); | 364 | return ata_pci_bmdma_init_one(dev, ppi, &hpt36x_sht, hpriv, 0); |
365 | } | 365 | } |
366 | 366 | ||
367 | #ifdef CONFIG_PM | 367 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index 98b498b6907c..9ae4c0830577 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c | |||
@@ -987,7 +987,7 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
987 | } | 987 | } |
988 | 988 | ||
989 | /* Now kick off ATA set up */ | 989 | /* Now kick off ATA set up */ |
990 | return ata_pci_sff_init_one(dev, ppi, &hpt37x_sht, private_data, 0); | 990 | return ata_pci_bmdma_init_one(dev, ppi, &hpt37x_sht, private_data, 0); |
991 | } | 991 | } |
992 | 992 | ||
993 | static const struct pci_device_id hpt37x[] = { | 993 | static const struct pci_device_id hpt37x[] = { |
diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c index 8b95aeba0e74..32f3463216b8 100644 --- a/drivers/ata/pata_hpt3x2n.c +++ b/drivers/ata/pata_hpt3x2n.c | |||
@@ -548,7 +548,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
548 | outb(inb(iobase + 0x9c) | 0x04, iobase + 0x9c); | 548 | outb(inb(iobase + 0x9c) | 0x04, iobase + 0x9c); |
549 | 549 | ||
550 | /* Now kick off ATA set up */ | 550 | /* Now kick off ATA set up */ |
551 | return ata_pci_sff_init_one(dev, ppi, &hpt3x2n_sht, hpriv, 0); | 551 | return ata_pci_bmdma_init_one(dev, ppi, &hpt3x2n_sht, hpriv, 0); |
552 | } | 552 | } |
553 | 553 | ||
554 | static const struct pci_device_id hpt3x2n[] = { | 554 | static const struct pci_device_id hpt3x2n[] = { |
diff --git a/drivers/ata/pata_hpt3x3.c b/drivers/ata/pata_hpt3x3.c index 727a81ce4c9f..b63d5e2d4628 100644 --- a/drivers/ata/pata_hpt3x3.c +++ b/drivers/ata/pata_hpt3x3.c | |||
@@ -248,7 +248,7 @@ static int hpt3x3_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
248 | ata_port_pbar_desc(ap, 4, offset_cmd[i], "cmd"); | 248 | ata_port_pbar_desc(ap, 4, offset_cmd[i], "cmd"); |
249 | } | 249 | } |
250 | pci_set_master(pdev); | 250 | pci_set_master(pdev); |
251 | return ata_host_activate(host, pdev->irq, ata_sff_interrupt, | 251 | return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, |
252 | IRQF_SHARED, &hpt3x3_sht); | 252 | IRQF_SHARED, &hpt3x3_sht); |
253 | } | 253 | } |
254 | 254 | ||
diff --git a/drivers/ata/pata_icside.c b/drivers/ata/pata_icside.c index b56e8f722d20..9f2889fe43b2 100644 --- a/drivers/ata/pata_icside.c +++ b/drivers/ata/pata_icside.c | |||
@@ -470,7 +470,7 @@ static int __devinit pata_icside_add_ports(struct pata_icside_info *info) | |||
470 | pata_icside_setup_ioaddr(ap, info->base, info, info->port[i]); | 470 | pata_icside_setup_ioaddr(ap, info->base, info, info->port[i]); |
471 | } | 471 | } |
472 | 472 | ||
473 | return ata_host_activate(host, ec->irq, ata_sff_interrupt, 0, | 473 | return ata_host_activate(host, ec->irq, ata_bmdma_interrupt, 0, |
474 | &pata_icside_sht); | 474 | &pata_icside_sht); |
475 | } | 475 | } |
476 | 476 | ||
diff --git a/drivers/ata/pata_it8213.c b/drivers/ata/pata_it8213.c index f971f0de88e6..4d142a2ab8fd 100644 --- a/drivers/ata/pata_it8213.c +++ b/drivers/ata/pata_it8213.c | |||
@@ -273,7 +273,7 @@ static int it8213_init_one (struct pci_dev *pdev, const struct pci_device_id *en | |||
273 | dev_printk(KERN_DEBUG, &pdev->dev, | 273 | dev_printk(KERN_DEBUG, &pdev->dev, |
274 | "version " DRV_VERSION "\n"); | 274 | "version " DRV_VERSION "\n"); |
275 | 275 | ||
276 | return ata_pci_sff_init_one(pdev, ppi, &it8213_sht, NULL, 0); | 276 | return ata_pci_bmdma_init_one(pdev, ppi, &it8213_sht, NULL, 0); |
277 | } | 277 | } |
278 | 278 | ||
279 | static const struct pci_device_id it8213_pci_tbl[] = { | 279 | static const struct pci_device_id it8213_pci_tbl[] = { |
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c index 2bd2b002d14a..bf88f71a21f4 100644 --- a/drivers/ata/pata_it821x.c +++ b/drivers/ata/pata_it821x.c | |||
@@ -933,7 +933,7 @@ static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
933 | else | 933 | else |
934 | ppi[0] = &info_smart; | 934 | ppi[0] = &info_smart; |
935 | } | 935 | } |
936 | return ata_pci_sff_init_one(pdev, ppi, &it821x_sht, NULL, 0); | 936 | return ata_pci_bmdma_init_one(pdev, ppi, &it821x_sht, NULL, 0); |
937 | } | 937 | } |
938 | 938 | ||
939 | #ifdef CONFIG_PM | 939 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c index 565e01e6ac7c..cb3babbb7035 100644 --- a/drivers/ata/pata_jmicron.c +++ b/drivers/ata/pata_jmicron.c | |||
@@ -144,7 +144,7 @@ static int jmicron_init_one (struct pci_dev *pdev, const struct pci_device_id *i | |||
144 | }; | 144 | }; |
145 | const struct ata_port_info *ppi[] = { &info, NULL }; | 145 | const struct ata_port_info *ppi[] = { &info, NULL }; |
146 | 146 | ||
147 | return ata_pci_sff_init_one(pdev, ppi, &jmicron_sht, NULL, 0); | 147 | return ata_pci_bmdma_init_one(pdev, ppi, &jmicron_sht, NULL, 0); |
148 | } | 148 | } |
149 | 149 | ||
150 | static const struct pci_device_id jmicron_pci_tbl[] = { | 150 | static const struct pci_device_id jmicron_pci_tbl[] = { |
diff --git a/drivers/ata/pata_macio.c b/drivers/ata/pata_macio.c index b5b48e703cb7..76640ac76888 100644 --- a/drivers/ata/pata_macio.c +++ b/drivers/ata/pata_macio.c | |||
@@ -1110,7 +1110,7 @@ static int __devinit pata_macio_common_init(struct pata_macio_priv *priv, | |||
1110 | 1110 | ||
1111 | /* Start it up */ | 1111 | /* Start it up */ |
1112 | priv->irq = irq; | 1112 | priv->irq = irq; |
1113 | return ata_host_activate(priv->host, irq, ata_sff_interrupt, 0, | 1113 | return ata_host_activate(priv->host, irq, ata_bmdma_interrupt, 0, |
1114 | &pata_macio_sht); | 1114 | &pata_macio_sht); |
1115 | } | 1115 | } |
1116 | 1116 | ||
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c index e8ca02e5a71d..dd38083dcbeb 100644 --- a/drivers/ata/pata_marvell.c +++ b/drivers/ata/pata_marvell.c | |||
@@ -153,7 +153,7 @@ static int marvell_init_one (struct pci_dev *pdev, const struct pci_device_id *i | |||
153 | return -ENODEV; | 153 | return -ENODEV; |
154 | } | 154 | } |
155 | #endif | 155 | #endif |
156 | return ata_pci_sff_init_one(pdev, ppi, &marvell_sht, NULL, 0); | 156 | return ata_pci_bmdma_init_one(pdev, ppi, &marvell_sht, NULL, 0); |
157 | } | 157 | } |
158 | 158 | ||
159 | static const struct pci_device_id marvell_pci_tbl[] = { | 159 | static const struct pci_device_id marvell_pci_tbl[] = { |
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c index 36afe2c1c747..f087ab55b1df 100644 --- a/drivers/ata/pata_mpc52xx.c +++ b/drivers/ata/pata_mpc52xx.c | |||
@@ -659,7 +659,7 @@ mpc52xx_ata_init_one(struct device *dev, struct mpc52xx_ata_priv *priv, | |||
659 | ata_port_desc(ap, "ata_regs 0x%lx", raw_ata_regs); | 659 | ata_port_desc(ap, "ata_regs 0x%lx", raw_ata_regs); |
660 | 660 | ||
661 | /* activate host */ | 661 | /* activate host */ |
662 | return ata_host_activate(host, priv->ata_irq, ata_sff_interrupt, 0, | 662 | return ata_host_activate(host, priv->ata_irq, ata_bmdma_interrupt, 0, |
663 | &mpc52xx_ata_sht); | 663 | &mpc52xx_ata_sht); |
664 | } | 664 | } |
665 | 665 | ||
diff --git a/drivers/ata/pata_netcell.c b/drivers/ata/pata_netcell.c index 94f979a7f4f7..3eb921c746a1 100644 --- a/drivers/ata/pata_netcell.c +++ b/drivers/ata/pata_netcell.c | |||
@@ -82,7 +82,7 @@ static int netcell_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
82 | ata_pci_bmdma_clear_simplex(pdev); | 82 | ata_pci_bmdma_clear_simplex(pdev); |
83 | 83 | ||
84 | /* And let the library code do the work */ | 84 | /* And let the library code do the work */ |
85 | return ata_pci_sff_init_one(pdev, port_info, &netcell_sht, NULL, 0); | 85 | return ata_pci_bmdma_init_one(pdev, port_info, &netcell_sht, NULL, 0); |
86 | } | 86 | } |
87 | 87 | ||
88 | static const struct pci_device_id netcell_pci_tbl[] = { | 88 | static const struct pci_device_id netcell_pci_tbl[] = { |
diff --git a/drivers/ata/pata_ninja32.c b/drivers/ata/pata_ninja32.c index dd53a66b19e3..cc50bd09aa26 100644 --- a/drivers/ata/pata_ninja32.c +++ b/drivers/ata/pata_ninja32.c | |||
@@ -149,7 +149,7 @@ static int ninja32_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
149 | 149 | ||
150 | ninja32_program(base); | 150 | ninja32_program(base); |
151 | /* FIXME: Should we disable them at remove ? */ | 151 | /* FIXME: Should we disable them at remove ? */ |
152 | return ata_host_activate(host, dev->irq, ata_sff_interrupt, | 152 | return ata_host_activate(host, dev->irq, ata_bmdma_interrupt, |
153 | IRQF_SHARED, &ninja32_sht); | 153 | IRQF_SHARED, &ninja32_sht); |
154 | } | 154 | } |
155 | 155 | ||
diff --git a/drivers/ata/pata_ns87415.c b/drivers/ata/pata_ns87415.c index fdbba2d76d3e..605f198f958c 100644 --- a/drivers/ata/pata_ns87415.c +++ b/drivers/ata/pata_ns87415.c | |||
@@ -380,7 +380,7 @@ static int ns87415_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
380 | 380 | ||
381 | ns87415_fixup(pdev); | 381 | ns87415_fixup(pdev); |
382 | 382 | ||
383 | return ata_pci_sff_init_one(pdev, ppi, &ns87415_sht, NULL, 0); | 383 | return ata_pci_bmdma_init_one(pdev, ppi, &ns87415_sht, NULL, 0); |
384 | } | 384 | } |
385 | 385 | ||
386 | static const struct pci_device_id ns87415_pci_tbl[] = { | 386 | static const struct pci_device_id ns87415_pci_tbl[] = { |
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c index 3001109352ea..06ddd91ffeda 100644 --- a/drivers/ata/pata_octeon_cf.c +++ b/drivers/ata/pata_octeon_cf.c | |||
@@ -750,20 +750,6 @@ static void octeon_cf_dev_config(struct ata_device *dev) | |||
750 | } | 750 | } |
751 | 751 | ||
752 | /* | 752 | /* |
753 | * Trap if driver tries to do standard bmdma commands. They are not | ||
754 | * supported. | ||
755 | */ | ||
756 | static void unreachable_qc(struct ata_queued_cmd *qc) | ||
757 | { | ||
758 | BUG(); | ||
759 | } | ||
760 | |||
761 | static u8 unreachable_port(struct ata_port *ap) | ||
762 | { | ||
763 | BUG(); | ||
764 | } | ||
765 | |||
766 | /* | ||
767 | * We don't do ATAPI DMA so return 0. | 753 | * We don't do ATAPI DMA so return 0. |
768 | */ | 754 | */ |
769 | static int octeon_cf_check_atapi_dma(struct ata_queued_cmd *qc) | 755 | static int octeon_cf_check_atapi_dma(struct ata_queued_cmd *qc) |
@@ -804,10 +790,6 @@ static struct ata_port_operations octeon_cf_ops = { | |||
804 | .sff_dev_select = octeon_cf_dev_select, | 790 | .sff_dev_select = octeon_cf_dev_select, |
805 | .sff_irq_on = octeon_cf_irq_on, | 791 | .sff_irq_on = octeon_cf_irq_on, |
806 | .sff_irq_clear = octeon_cf_irq_clear, | 792 | .sff_irq_clear = octeon_cf_irq_clear, |
807 | .bmdma_setup = unreachable_qc, | ||
808 | .bmdma_start = unreachable_qc, | ||
809 | .bmdma_stop = unreachable_qc, | ||
810 | .bmdma_status = unreachable_port, | ||
811 | .cable_detect = ata_cable_40wire, | 793 | .cable_detect = ata_cable_40wire, |
812 | .set_piomode = octeon_cf_set_piomode, | 794 | .set_piomode = octeon_cf_set_piomode, |
813 | .set_dmamode = octeon_cf_set_dmamode, | 795 | .set_dmamode = octeon_cf_set_dmamode, |
diff --git a/drivers/ata/pata_oldpiix.c b/drivers/ata/pata_oldpiix.c index 988ef2627be3..b811c1636204 100644 --- a/drivers/ata/pata_oldpiix.c +++ b/drivers/ata/pata_oldpiix.c | |||
@@ -248,7 +248,7 @@ static int oldpiix_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
248 | dev_printk(KERN_DEBUG, &pdev->dev, | 248 | dev_printk(KERN_DEBUG, &pdev->dev, |
249 | "version " DRV_VERSION "\n"); | 249 | "version " DRV_VERSION "\n"); |
250 | 250 | ||
251 | return ata_pci_sff_init_one(pdev, ppi, &oldpiix_sht, NULL, 0); | 251 | return ata_pci_bmdma_init_one(pdev, ppi, &oldpiix_sht, NULL, 0); |
252 | } | 252 | } |
253 | 253 | ||
254 | static const struct pci_device_id oldpiix_pci_tbl[] = { | 254 | static const struct pci_device_id oldpiix_pci_tbl[] = { |
diff --git a/drivers/ata/pata_optidma.c b/drivers/ata/pata_optidma.c index 76b7d12b1e8d..0852cd07de08 100644 --- a/drivers/ata/pata_optidma.c +++ b/drivers/ata/pata_optidma.c | |||
@@ -429,7 +429,7 @@ static int optidma_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
429 | if (optiplus_with_udma(dev)) | 429 | if (optiplus_with_udma(dev)) |
430 | ppi[0] = &info_82c700_udma; | 430 | ppi[0] = &info_82c700_udma; |
431 | 431 | ||
432 | return ata_pci_sff_init_one(dev, ppi, &optidma_sht, NULL, 0); | 432 | return ata_pci_bmdma_init_one(dev, ppi, &optidma_sht, NULL, 0); |
433 | } | 433 | } |
434 | 434 | ||
435 | static const struct pci_device_id optidma[] = { | 435 | static const struct pci_device_id optidma[] = { |
diff --git a/drivers/ata/pata_pdc2027x.c b/drivers/ata/pata_pdc2027x.c index 09f1f22c0307..b18351122525 100644 --- a/drivers/ata/pata_pdc2027x.c +++ b/drivers/ata/pata_pdc2027x.c | |||
@@ -754,7 +754,7 @@ static int __devinit pdc2027x_init_one(struct pci_dev *pdev, const struct pci_de | |||
754 | return -EIO; | 754 | return -EIO; |
755 | 755 | ||
756 | pci_set_master(pdev); | 756 | pci_set_master(pdev); |
757 | return ata_host_activate(host, pdev->irq, ata_sff_interrupt, | 757 | return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, |
758 | IRQF_SHARED, &pdc2027x_sht); | 758 | IRQF_SHARED, &pdc2027x_sht); |
759 | } | 759 | } |
760 | 760 | ||
diff --git a/drivers/ata/pata_pdc202xx_old.c b/drivers/ata/pata_pdc202xx_old.c index fa1e2f3bc0fd..c39f213e1bbc 100644 --- a/drivers/ata/pata_pdc202xx_old.c +++ b/drivers/ata/pata_pdc202xx_old.c | |||
@@ -337,7 +337,7 @@ static int pdc202xx_init_one(struct pci_dev *dev, const struct pci_device_id *id | |||
337 | return -ENODEV; | 337 | return -ENODEV; |
338 | } | 338 | } |
339 | } | 339 | } |
340 | return ata_pci_sff_init_one(dev, ppi, &pdc202xx_sht, NULL, 0); | 340 | return ata_pci_bmdma_init_one(dev, ppi, &pdc202xx_sht, NULL, 0); |
341 | } | 341 | } |
342 | 342 | ||
343 | static const struct pci_device_id pdc202xx[] = { | 343 | static const struct pci_device_id pdc202xx[] = { |
diff --git a/drivers/ata/pata_piccolo.c b/drivers/ata/pata_piccolo.c index 981615414849..cb01bf9496fe 100644 --- a/drivers/ata/pata_piccolo.c +++ b/drivers/ata/pata_piccolo.c | |||
@@ -95,7 +95,7 @@ static int ata_tosh_init_one(struct pci_dev *dev, const struct pci_device_id *id | |||
95 | }; | 95 | }; |
96 | const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; | 96 | const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; |
97 | /* Just one port for the moment */ | 97 | /* Just one port for the moment */ |
98 | return ata_pci_sff_init_one(dev, ppi, &tosh_sht, NULL, 0); | 98 | return ata_pci_bmdma_init_one(dev, ppi, &tosh_sht, NULL, 0); |
99 | } | 99 | } |
100 | 100 | ||
101 | static struct pci_device_id ata_tosh[] = { | 101 | static struct pci_device_id ata_tosh[] = { |
diff --git a/drivers/ata/pata_radisys.c b/drivers/ata/pata_radisys.c index a5fa388e5398..8574b31f1773 100644 --- a/drivers/ata/pata_radisys.c +++ b/drivers/ata/pata_radisys.c | |||
@@ -227,7 +227,7 @@ static int radisys_init_one (struct pci_dev *pdev, const struct pci_device_id *e | |||
227 | dev_printk(KERN_DEBUG, &pdev->dev, | 227 | dev_printk(KERN_DEBUG, &pdev->dev, |
228 | "version " DRV_VERSION "\n"); | 228 | "version " DRV_VERSION "\n"); |
229 | 229 | ||
230 | return ata_pci_sff_init_one(pdev, ppi, &radisys_sht, NULL, 0); | 230 | return ata_pci_bmdma_init_one(pdev, ppi, &radisys_sht, NULL, 0); |
231 | } | 231 | } |
232 | 232 | ||
233 | static const struct pci_device_id radisys_pci_tbl[] = { | 233 | static const struct pci_device_id radisys_pci_tbl[] = { |
diff --git a/drivers/ata/pata_rdc.c b/drivers/ata/pata_rdc.c index 37092cfd7bc6..5fbe9b166c69 100644 --- a/drivers/ata/pata_rdc.c +++ b/drivers/ata/pata_rdc.c | |||
@@ -344,7 +344,7 @@ static int __devinit rdc_init_one(struct pci_dev *pdev, | |||
344 | */ | 344 | */ |
345 | pci_read_config_dword(pdev, 0x54, &hpriv->saved_iocfg); | 345 | pci_read_config_dword(pdev, 0x54, &hpriv->saved_iocfg); |
346 | 346 | ||
347 | rc = ata_pci_sff_prepare_host(pdev, ppi, &host); | 347 | rc = ata_pci_bmdma_prepare_host(pdev, ppi, &host); |
348 | if (rc) | 348 | if (rc) |
349 | return rc; | 349 | return rc; |
350 | host->private_data = hpriv; | 350 | host->private_data = hpriv; |
@@ -354,7 +354,7 @@ static int __devinit rdc_init_one(struct pci_dev *pdev, | |||
354 | host->flags |= ATA_HOST_PARALLEL_SCAN; | 354 | host->flags |= ATA_HOST_PARALLEL_SCAN; |
355 | 355 | ||
356 | pci_set_master(pdev); | 356 | pci_set_master(pdev); |
357 | return ata_pci_sff_activate_host(host, ata_sff_interrupt, &rdc_sht); | 357 | return ata_pci_sff_activate_host(host, ata_bmdma_interrupt, &rdc_sht); |
358 | } | 358 | } |
359 | 359 | ||
360 | static void rdc_remove_one(struct pci_dev *pdev) | 360 | static void rdc_remove_one(struct pci_dev *pdev) |
diff --git a/drivers/ata/pata_sc1200.c b/drivers/ata/pata_sc1200.c index 6b5b63a2fd8e..e2c18257adff 100644 --- a/drivers/ata/pata_sc1200.c +++ b/drivers/ata/pata_sc1200.c | |||
@@ -237,7 +237,7 @@ static int sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
237 | }; | 237 | }; |
238 | const struct ata_port_info *ppi[] = { &info, NULL }; | 238 | const struct ata_port_info *ppi[] = { &info, NULL }; |
239 | 239 | ||
240 | return ata_pci_sff_init_one(dev, ppi, &sc1200_sht, NULL, 0); | 240 | return ata_pci_bmdma_init_one(dev, ppi, &sc1200_sht, NULL, 0); |
241 | } | 241 | } |
242 | 242 | ||
243 | static const struct pci_device_id sc1200[] = { | 243 | static const struct pci_device_id sc1200[] = { |
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c index 6f6193b707cb..d9db3f8d60ef 100644 --- a/drivers/ata/pata_scc.c +++ b/drivers/ata/pata_scc.c | |||
@@ -875,7 +875,7 @@ static void scc_postreset(struct ata_link *link, unsigned int *classes) | |||
875 | * scc_irq_clear - Clear PCI IDE BMDMA interrupt. | 875 | * scc_irq_clear - Clear PCI IDE BMDMA interrupt. |
876 | * @ap: Port associated with this ATA transaction. | 876 | * @ap: Port associated with this ATA transaction. |
877 | * | 877 | * |
878 | * Note: Original code is ata_sff_irq_clear(). | 878 | * Note: Original code is ata_bmdma_irq_clear(). |
879 | */ | 879 | */ |
880 | 880 | ||
881 | static void scc_irq_clear (struct ata_port *ap) | 881 | static void scc_irq_clear (struct ata_port *ap) |
@@ -1105,7 +1105,7 @@ static int scc_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1105 | if (rc) | 1105 | if (rc) |
1106 | return rc; | 1106 | return rc; |
1107 | 1107 | ||
1108 | return ata_host_activate(host, pdev->irq, ata_sff_interrupt, | 1108 | return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, |
1109 | IRQF_SHARED, &scc_sht); | 1109 | IRQF_SHARED, &scc_sht); |
1110 | } | 1110 | } |
1111 | 1111 | ||
diff --git a/drivers/ata/pata_sch.c b/drivers/ata/pata_sch.c index 86b3d0133c7c..e97b32f03a6e 100644 --- a/drivers/ata/pata_sch.c +++ b/drivers/ata/pata_sch.c | |||
@@ -179,7 +179,7 @@ static int __devinit sch_init_one(struct pci_dev *pdev, | |||
179 | dev_printk(KERN_DEBUG, &pdev->dev, | 179 | dev_printk(KERN_DEBUG, &pdev->dev, |
180 | "version " DRV_VERSION "\n"); | 180 | "version " DRV_VERSION "\n"); |
181 | 181 | ||
182 | return ata_pci_sff_init_one(pdev, ppi, &sch_sht, NULL, 0); | 182 | return ata_pci_bmdma_init_one(pdev, ppi, &sch_sht, NULL, 0); |
183 | } | 183 | } |
184 | 184 | ||
185 | static int __init sch_init(void) | 185 | static int __init sch_init(void) |
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c index 43ea389df2b3..86dd714e3e1d 100644 --- a/drivers/ata/pata_serverworks.c +++ b/drivers/ata/pata_serverworks.c | |||
@@ -460,7 +460,7 @@ static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id | |||
460 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) | 460 | if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) |
461 | ata_pci_bmdma_clear_simplex(pdev); | 461 | ata_pci_bmdma_clear_simplex(pdev); |
462 | 462 | ||
463 | return ata_pci_sff_init_one(pdev, ppi, &serverworks_sht, NULL, 0); | 463 | return ata_pci_bmdma_init_one(pdev, ppi, &serverworks_sht, NULL, 0); |
464 | } | 464 | } |
465 | 465 | ||
466 | #ifdef CONFIG_PM | 466 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c index 43faf106f647..d3190d7ec304 100644 --- a/drivers/ata/pata_sil680.c +++ b/drivers/ata/pata_sil680.c | |||
@@ -374,11 +374,11 @@ static int __devinit sil680_init_one(struct pci_dev *pdev, | |||
374 | ata_sff_std_ports(&host->ports[1]->ioaddr); | 374 | ata_sff_std_ports(&host->ports[1]->ioaddr); |
375 | 375 | ||
376 | /* Register & activate */ | 376 | /* Register & activate */ |
377 | return ata_host_activate(host, pdev->irq, ata_sff_interrupt, | 377 | return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, |
378 | IRQF_SHARED, &sil680_sht); | 378 | IRQF_SHARED, &sil680_sht); |
379 | 379 | ||
380 | use_ioports: | 380 | use_ioports: |
381 | return ata_pci_sff_init_one(pdev, ppi, &sil680_sht, NULL, 0); | 381 | return ata_pci_bmdma_init_one(pdev, ppi, &sil680_sht, NULL, 0); |
382 | } | 382 | } |
383 | 383 | ||
384 | #ifdef CONFIG_PM | 384 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index b6708032f321..60cea13cccce 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c | |||
@@ -826,7 +826,7 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
826 | 826 | ||
827 | sis_fixup(pdev, chipset); | 827 | sis_fixup(pdev, chipset); |
828 | 828 | ||
829 | return ata_pci_sff_init_one(pdev, ppi, &sis_sht, chipset, 0); | 829 | return ata_pci_bmdma_init_one(pdev, ppi, &sis_sht, chipset, 0); |
830 | } | 830 | } |
831 | 831 | ||
832 | #ifdef CONFIG_PM | 832 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/pata_sl82c105.c b/drivers/ata/pata_sl82c105.c index 733b042a7469..98548f640c8e 100644 --- a/drivers/ata/pata_sl82c105.c +++ b/drivers/ata/pata_sl82c105.c | |||
@@ -316,7 +316,7 @@ static int sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id | |||
316 | val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; | 316 | val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; |
317 | pci_write_config_dword(dev, 0x40, val); | 317 | pci_write_config_dword(dev, 0x40, val); |
318 | 318 | ||
319 | return ata_pci_sff_init_one(dev, ppi, &sl82c105_sht, NULL, 0); | 319 | return ata_pci_bmdma_init_one(dev, ppi, &sl82c105_sht, NULL, 0); |
320 | } | 320 | } |
321 | 321 | ||
322 | static const struct pci_device_id sl82c105[] = { | 322 | static const struct pci_device_id sl82c105[] = { |
diff --git a/drivers/ata/pata_triflex.c b/drivers/ata/pata_triflex.c index 48f50600ed2a..0d1f89e571dd 100644 --- a/drivers/ata/pata_triflex.c +++ b/drivers/ata/pata_triflex.c | |||
@@ -201,7 +201,7 @@ static int triflex_init_one(struct pci_dev *dev, const struct pci_device_id *id) | |||
201 | if (!printed_version++) | 201 | if (!printed_version++) |
202 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); | 202 | dev_printk(KERN_DEBUG, &dev->dev, "version " DRV_VERSION "\n"); |
203 | 203 | ||
204 | return ata_pci_sff_init_one(dev, ppi, &triflex_sht, NULL, 0); | 204 | return ata_pci_bmdma_init_one(dev, ppi, &triflex_sht, NULL, 0); |
205 | } | 205 | } |
206 | 206 | ||
207 | static const struct pci_device_id triflex[] = { | 207 | static const struct pci_device_id triflex[] = { |
diff --git a/drivers/ata/pata_via.c b/drivers/ata/pata_via.c index 7e3e0a5598b7..5e659885de16 100644 --- a/drivers/ata/pata_via.c +++ b/drivers/ata/pata_via.c | |||
@@ -627,7 +627,7 @@ static int via_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
627 | } | 627 | } |
628 | 628 | ||
629 | /* We have established the device type, now fire it up */ | 629 | /* We have established the device type, now fire it up */ |
630 | return ata_pci_sff_init_one(pdev, ppi, &via_sht, (void *)config, 0); | 630 | return ata_pci_bmdma_init_one(pdev, ppi, &via_sht, (void *)config, 0); |
631 | } | 631 | } |
632 | 632 | ||
633 | #ifdef CONFIG_PM | 633 | #ifdef CONFIG_PM |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index f3471bc949d3..a476cd99b95d 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -675,8 +675,6 @@ static struct ata_port_operations mv5_ops = { | |||
675 | .freeze = mv_eh_freeze, | 675 | .freeze = mv_eh_freeze, |
676 | .thaw = mv_eh_thaw, | 676 | .thaw = mv_eh_thaw, |
677 | .hardreset = mv_hardreset, | 677 | .hardreset = mv_hardreset, |
678 | .error_handler = ata_std_error_handler, /* avoid SFF EH */ | ||
679 | .post_internal_cmd = ATA_OP_NULL, | ||
680 | 678 | ||
681 | .scr_read = mv5_scr_read, | 679 | .scr_read = mv5_scr_read, |
682 | .scr_write = mv5_scr_write, | 680 | .scr_write = mv5_scr_write, |
@@ -2813,7 +2811,7 @@ static void mv_port_intr(struct ata_port *ap, u32 port_cause) | |||
2813 | } else if (!edma_was_enabled) { | 2811 | } else if (!edma_was_enabled) { |
2814 | struct ata_queued_cmd *qc = mv_get_active_qc(ap); | 2812 | struct ata_queued_cmd *qc = mv_get_active_qc(ap); |
2815 | if (qc) | 2813 | if (qc) |
2816 | ata_sff_host_intr(ap, qc); | 2814 | ata_bmdma_port_intr(ap, qc); |
2817 | else | 2815 | else |
2818 | mv_unexpected_intr(ap, edma_was_enabled); | 2816 | mv_unexpected_intr(ap, edma_was_enabled); |
2819 | } | 2817 | } |
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index baa8f0d2c86f..6fd114784116 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -920,7 +920,7 @@ static int nv_host_intr(struct ata_port *ap, u8 irq_stat) | |||
920 | } | 920 | } |
921 | 921 | ||
922 | /* handle interrupt */ | 922 | /* handle interrupt */ |
923 | return ata_sff_host_intr(ap, qc); | 923 | return ata_bmdma_port_intr(ap, qc); |
924 | } | 924 | } |
925 | 925 | ||
926 | static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) | 926 | static irqreturn_t nv_adma_interrupt(int irq, void *dev_instance) |
@@ -1100,7 +1100,7 @@ static void nv_adma_irq_clear(struct ata_port *ap) | |||
1100 | u32 notifier_clears[2]; | 1100 | u32 notifier_clears[2]; |
1101 | 1101 | ||
1102 | if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) { | 1102 | if (pp->flags & NV_ADMA_ATAPI_SETUP_COMPLETE) { |
1103 | ata_sff_irq_clear(ap); | 1103 | ata_bmdma_irq_clear(ap); |
1104 | return; | 1104 | return; |
1105 | } | 1105 | } |
1106 | 1106 | ||
@@ -1505,7 +1505,7 @@ static irqreturn_t nv_generic_interrupt(int irq, void *dev_instance) | |||
1505 | 1505 | ||
1506 | qc = ata_qc_from_tag(ap, ap->link.active_tag); | 1506 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
1507 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { | 1507 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING))) { |
1508 | handled += ata_sff_host_intr(ap, qc); | 1508 | handled += ata_bmdma_port_intr(ap, qc); |
1509 | } else { | 1509 | } else { |
1510 | /* | 1510 | /* |
1511 | * No request pending? Clear interrupt status | 1511 | * No request pending? Clear interrupt status |
@@ -2430,7 +2430,7 @@ static int nv_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2430 | 2430 | ||
2431 | ppi[0] = &nv_port_info[type]; | 2431 | ppi[0] = &nv_port_info[type]; |
2432 | ipriv = ppi[0]->private_data; | 2432 | ipriv = ppi[0]->private_data; |
2433 | rc = ata_pci_sff_prepare_host(pdev, ppi, &host); | 2433 | rc = ata_pci_bmdma_prepare_host(pdev, ppi, &host); |
2434 | if (rc) | 2434 | if (rc) |
2435 | return rc; | 2435 | return rc; |
2436 | 2436 | ||
diff --git a/drivers/ata/sata_qstor.c b/drivers/ata/sata_qstor.c index d533b3d20ca1..daeebf19a6a9 100644 --- a/drivers/ata/sata_qstor.c +++ b/drivers/ata/sata_qstor.c | |||
@@ -120,8 +120,6 @@ static void qs_host_stop(struct ata_host *host); | |||
120 | static void qs_qc_prep(struct ata_queued_cmd *qc); | 120 | static void qs_qc_prep(struct ata_queued_cmd *qc); |
121 | static unsigned int qs_qc_issue(struct ata_queued_cmd *qc); | 121 | static unsigned int qs_qc_issue(struct ata_queued_cmd *qc); |
122 | static int qs_check_atapi_dma(struct ata_queued_cmd *qc); | 122 | static int qs_check_atapi_dma(struct ata_queued_cmd *qc); |
123 | static void qs_bmdma_stop(struct ata_queued_cmd *qc); | ||
124 | static u8 qs_bmdma_status(struct ata_port *ap); | ||
125 | static void qs_freeze(struct ata_port *ap); | 123 | static void qs_freeze(struct ata_port *ap); |
126 | static void qs_thaw(struct ata_port *ap); | 124 | static void qs_thaw(struct ata_port *ap); |
127 | static int qs_prereset(struct ata_link *link, unsigned long deadline); | 125 | static int qs_prereset(struct ata_link *link, unsigned long deadline); |
@@ -137,8 +135,6 @@ static struct ata_port_operations qs_ata_ops = { | |||
137 | .inherits = &ata_sff_port_ops, | 135 | .inherits = &ata_sff_port_ops, |
138 | 136 | ||
139 | .check_atapi_dma = qs_check_atapi_dma, | 137 | .check_atapi_dma = qs_check_atapi_dma, |
140 | .bmdma_stop = qs_bmdma_stop, | ||
141 | .bmdma_status = qs_bmdma_status, | ||
142 | .qc_prep = qs_qc_prep, | 138 | .qc_prep = qs_qc_prep, |
143 | .qc_issue = qs_qc_issue, | 139 | .qc_issue = qs_qc_issue, |
144 | 140 | ||
@@ -190,16 +186,6 @@ static int qs_check_atapi_dma(struct ata_queued_cmd *qc) | |||
190 | return 1; /* ATAPI DMA not supported */ | 186 | return 1; /* ATAPI DMA not supported */ |
191 | } | 187 | } |
192 | 188 | ||
193 | static void qs_bmdma_stop(struct ata_queued_cmd *qc) | ||
194 | { | ||
195 | /* nothing */ | ||
196 | } | ||
197 | |||
198 | static u8 qs_bmdma_status(struct ata_port *ap) | ||
199 | { | ||
200 | return 0; | ||
201 | } | ||
202 | |||
203 | static inline void qs_enter_reg_mode(struct ata_port *ap) | 189 | static inline void qs_enter_reg_mode(struct ata_port *ap) |
204 | { | 190 | { |
205 | u8 __iomem *chan = qs_mmio_base(ap->host) + (ap->port_no * 0x4000); | 191 | u8 __iomem *chan = qs_mmio_base(ap->host) + (ap->port_no * 0x4000); |
@@ -454,7 +440,7 @@ static inline unsigned int qs_intr_mmio(struct ata_host *host) | |||
454 | if (!pp || pp->state != qs_state_mmio) | 440 | if (!pp || pp->state != qs_state_mmio) |
455 | continue; | 441 | continue; |
456 | if (!(qc->tf.flags & ATA_TFLAG_POLLING)) | 442 | if (!(qc->tf.flags & ATA_TFLAG_POLLING)) |
457 | handled |= ata_sff_host_intr(ap, qc); | 443 | handled |= ata_sff_port_intr(ap, qc); |
458 | } | 444 | } |
459 | return handled; | 445 | return handled; |
460 | } | 446 | } |
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c index 2dda312b6b9a..3a4f84219719 100644 --- a/drivers/ata/sata_sil.c +++ b/drivers/ata/sata_sil.c | |||
@@ -503,7 +503,7 @@ static void sil_host_intr(struct ata_port *ap, u32 bmdma2) | |||
503 | goto err_hsm; | 503 | goto err_hsm; |
504 | 504 | ||
505 | /* ack bmdma irq events */ | 505 | /* ack bmdma irq events */ |
506 | ata_sff_irq_clear(ap); | 506 | ata_bmdma_irq_clear(ap); |
507 | 507 | ||
508 | /* kick HSM in the ass */ | 508 | /* kick HSM in the ass */ |
509 | ata_sff_hsm_move(ap, qc, status, 0); | 509 | ata_sff_hsm_move(ap, qc, status, 0); |
@@ -584,7 +584,7 @@ static void sil_thaw(struct ata_port *ap) | |||
584 | 584 | ||
585 | /* clear IRQ */ | 585 | /* clear IRQ */ |
586 | ap->ops->sff_check_status(ap); | 586 | ap->ops->sff_check_status(ap); |
587 | ata_sff_irq_clear(ap); | 587 | ata_bmdma_irq_clear(ap); |
588 | 588 | ||
589 | /* turn on SATA IRQ if supported */ | 589 | /* turn on SATA IRQ if supported */ |
590 | if (!(ap->flags & SIL_FLAG_NO_SATA_IRQ)) | 590 | if (!(ap->flags & SIL_FLAG_NO_SATA_IRQ)) |
diff --git a/drivers/ata/sata_sis.c b/drivers/ata/sata_sis.c index f8a91bfd66a8..2bfe3ae03976 100644 --- a/drivers/ata/sata_sis.c +++ b/drivers/ata/sata_sis.c | |||
@@ -279,7 +279,7 @@ static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
279 | break; | 279 | break; |
280 | } | 280 | } |
281 | 281 | ||
282 | rc = ata_pci_sff_prepare_host(pdev, ppi, &host); | 282 | rc = ata_pci_bmdma_prepare_host(pdev, ppi, &host); |
283 | if (rc) | 283 | if (rc) |
284 | return rc; | 284 | return rc; |
285 | 285 | ||
@@ -308,7 +308,7 @@ static int sis_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
308 | 308 | ||
309 | pci_set_master(pdev); | 309 | pci_set_master(pdev); |
310 | pci_intx(pdev, 1); | 310 | pci_intx(pdev, 1); |
311 | return ata_host_activate(host, pdev->irq, ata_sff_interrupt, | 311 | return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, |
312 | IRQF_SHARED, &sis_sht); | 312 | IRQF_SHARED, &sis_sht); |
313 | } | 313 | } |
314 | 314 | ||
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c index 101fd6a19829..7d9db4aaf07e 100644 --- a/drivers/ata/sata_svw.c +++ b/drivers/ata/sata_svw.c | |||
@@ -502,7 +502,7 @@ static int k2_sata_init_one(struct pci_dev *pdev, const struct pci_device_id *en | |||
502 | writel(0x0, mmio_base + K2_SATA_SIM_OFFSET); | 502 | writel(0x0, mmio_base + K2_SATA_SIM_OFFSET); |
503 | 503 | ||
504 | pci_set_master(pdev); | 504 | pci_set_master(pdev); |
505 | return ata_host_activate(host, pdev->irq, ata_sff_interrupt, | 505 | return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, |
506 | IRQF_SHARED, &k2_sata_sht); | 506 | IRQF_SHARED, &k2_sata_sht); |
507 | } | 507 | } |
508 | 508 | ||
diff --git a/drivers/ata/sata_uli.c b/drivers/ata/sata_uli.c index d8dac17dc2c8..b8578c32d344 100644 --- a/drivers/ata/sata_uli.c +++ b/drivers/ata/sata_uli.c | |||
@@ -242,7 +242,7 @@ static int uli_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
242 | 242 | ||
243 | pci_set_master(pdev); | 243 | pci_set_master(pdev); |
244 | pci_intx(pdev, 1); | 244 | pci_intx(pdev, 1); |
245 | return ata_host_activate(host, pdev->irq, ata_sff_interrupt, | 245 | return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, |
246 | IRQF_SHARED, &uli_sht); | 246 | IRQF_SHARED, &uli_sht); |
247 | } | 247 | } |
248 | 248 | ||
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index 08f65492cc81..101d8c219caf 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
@@ -308,7 +308,7 @@ static void svia_noop_freeze(struct ata_port *ap) | |||
308 | * certain way. Leave it alone and just clear pending IRQ. | 308 | * certain way. Leave it alone and just clear pending IRQ. |
309 | */ | 309 | */ |
310 | ap->ops->sff_check_status(ap); | 310 | ap->ops->sff_check_status(ap); |
311 | ata_sff_irq_clear(ap); | 311 | ata_bmdma_irq_clear(ap); |
312 | } | 312 | } |
313 | 313 | ||
314 | /** | 314 | /** |
@@ -463,7 +463,7 @@ static int vt6420_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) | |||
463 | struct ata_host *host; | 463 | struct ata_host *host; |
464 | int rc; | 464 | int rc; |
465 | 465 | ||
466 | rc = ata_pci_sff_prepare_host(pdev, ppi, &host); | 466 | rc = ata_pci_bmdma_prepare_host(pdev, ppi, &host); |
467 | if (rc) | 467 | if (rc) |
468 | return rc; | 468 | return rc; |
469 | *r_host = host; | 469 | *r_host = host; |
@@ -520,7 +520,7 @@ static int vt8251_prepare_host(struct pci_dev *pdev, struct ata_host **r_host) | |||
520 | struct ata_host *host; | 520 | struct ata_host *host; |
521 | int i, rc; | 521 | int i, rc; |
522 | 522 | ||
523 | rc = ata_pci_sff_prepare_host(pdev, ppi, &host); | 523 | rc = ata_pci_bmdma_prepare_host(pdev, ppi, &host); |
524 | if (rc) | 524 | if (rc) |
525 | return rc; | 525 | return rc; |
526 | *r_host = host; | 526 | *r_host = host; |
@@ -628,7 +628,7 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
628 | svia_configure(pdev); | 628 | svia_configure(pdev); |
629 | 629 | ||
630 | pci_set_master(pdev); | 630 | pci_set_master(pdev); |
631 | return ata_host_activate(host, pdev->irq, ata_sff_interrupt, | 631 | return ata_host_activate(host, pdev->irq, ata_bmdma_interrupt, |
632 | IRQF_SHARED, &svia_sht); | 632 | IRQF_SHARED, &svia_sht); |
633 | } | 633 | } |
634 | 634 | ||
diff --git a/drivers/ata/sata_vsc.c b/drivers/ata/sata_vsc.c index 2107952ebff1..b777176ff494 100644 --- a/drivers/ata/sata_vsc.c +++ b/drivers/ata/sata_vsc.c | |||
@@ -245,7 +245,7 @@ static void vsc_port_intr(u8 port_status, struct ata_port *ap) | |||
245 | 245 | ||
246 | qc = ata_qc_from_tag(ap, ap->link.active_tag); | 246 | qc = ata_qc_from_tag(ap, ap->link.active_tag); |
247 | if (qc && likely(!(qc->tf.flags & ATA_TFLAG_POLLING))) | 247 | if (qc && likely(!(qc->tf.flags & ATA_TFLAG_POLLING))) |
248 | handled = ata_sff_host_intr(ap, qc); | 248 | handled = ata_bmdma_port_intr(ap, qc); |
249 | 249 | ||
250 | /* We received an interrupt during a polled command, | 250 | /* We received an interrupt during a polled command, |
251 | * or some other spurious condition. Interrupt reporting | 251 | * or some other spurious condition. Interrupt reporting |
diff --git a/drivers/char/ps3flash.c b/drivers/char/ps3flash.c index 606048b72bcf..85c004a518ee 100644 --- a/drivers/char/ps3flash.c +++ b/drivers/char/ps3flash.c | |||
@@ -305,8 +305,7 @@ static int ps3flash_flush(struct file *file, fl_owner_t id) | |||
305 | return ps3flash_writeback(ps3flash_dev); | 305 | return ps3flash_writeback(ps3flash_dev); |
306 | } | 306 | } |
307 | 307 | ||
308 | static int ps3flash_fsync(struct file *file, struct dentry *dentry, | 308 | static int ps3flash_fsync(struct file *file, int datasync) |
309 | int datasync) | ||
310 | { | 309 | { |
311 | return ps3flash_writeback(ps3flash_dev); | 310 | return ps3flash_writeback(ps3flash_dev); |
312 | } | 311 | } |
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index 72ebb3f06b86..4dfa6b90c21c 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c | |||
@@ -189,8 +189,7 @@ static loff_t vol_cdev_llseek(struct file *file, loff_t offset, int origin) | |||
189 | return new_offset; | 189 | return new_offset; |
190 | } | 190 | } |
191 | 191 | ||
192 | static int vol_cdev_fsync(struct file *file, struct dentry *dentry, | 192 | static int vol_cdev_fsync(struct file *file, int datasync) |
193 | int datasync) | ||
194 | { | 193 | { |
195 | struct ubi_volume_desc *desc = file->private_data; | 194 | struct ubi_volume_desc *desc = file->private_data; |
196 | struct ubi_device *ubi = desc->vol->ubi; | 195 | struct ubi_device *ubi = desc->vol->ubi; |
diff --git a/drivers/net/3c507.c b/drivers/net/3c507.c index 82eaf65d2d85..ea9b7a098c9b 100644 --- a/drivers/net/3c507.c +++ b/drivers/net/3c507.c | |||
@@ -551,8 +551,7 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id) | |||
551 | void __iomem *shmem; | 551 | void __iomem *shmem; |
552 | 552 | ||
553 | if (dev == NULL) { | 553 | if (dev == NULL) { |
554 | pr_err("%s: net_interrupt(): irq %d for unknown device.\n", | 554 | pr_err("net_interrupt(): irq %d for unknown device.\n", irq); |
555 | dev->name, irq); | ||
556 | return IRQ_NONE; | 555 | return IRQ_NONE; |
557 | } | 556 | } |
558 | 557 | ||
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index c911bfb55b19..9d11dbf5e4da 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c | |||
@@ -294,7 +294,7 @@ int be_cmd_POST(struct be_adapter *adapter) | |||
294 | } else { | 294 | } else { |
295 | return 0; | 295 | return 0; |
296 | } | 296 | } |
297 | } while (timeout < 20); | 297 | } while (timeout < 40); |
298 | 298 | ||
299 | dev_err(&adapter->pdev->dev, "POST timeout; stage=0x%x\n", stage); | 299 | dev_err(&adapter->pdev->dev, "POST timeout; stage=0x%x\n", stage); |
300 | return -1; | 300 | return -1; |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index aa065c71ddd8..54b14272f333 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -1861,7 +1861,7 @@ static int be_setup(struct be_adapter *adapter) | |||
1861 | goto if_destroy; | 1861 | goto if_destroy; |
1862 | } | 1862 | } |
1863 | vf++; | 1863 | vf++; |
1864 | } while (vf < num_vfs); | 1864 | } |
1865 | } else if (!be_physfn(adapter)) { | 1865 | } else if (!be_physfn(adapter)) { |
1866 | status = be_cmd_mac_addr_query(adapter, mac, | 1866 | status = be_cmd_mac_addr_query(adapter, mac, |
1867 | MAC_ADDRESS_TYPE_NETWORK, false, adapter->if_handle); | 1867 | MAC_ADDRESS_TYPE_NETWORK, false, adapter->if_handle); |
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index be90d3598bca..fe925663d39a 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -3367,13 +3367,9 @@ static int cnic_cm_shutdown(struct cnic_dev *dev) | |||
3367 | 3367 | ||
3368 | static void cnic_init_context(struct cnic_dev *dev, u32 cid) | 3368 | static void cnic_init_context(struct cnic_dev *dev, u32 cid) |
3369 | { | 3369 | { |
3370 | struct cnic_local *cp = dev->cnic_priv; | ||
3371 | u32 cid_addr; | 3370 | u32 cid_addr; |
3372 | int i; | 3371 | int i; |
3373 | 3372 | ||
3374 | if (CHIP_NUM(cp) == CHIP_NUM_5709) | ||
3375 | return; | ||
3376 | |||
3377 | cid_addr = GET_CID_ADDR(cid); | 3373 | cid_addr = GET_CID_ADDR(cid); |
3378 | 3374 | ||
3379 | for (i = 0; i < CTX_SIZE; i += 4) | 3375 | for (i = 0; i < CTX_SIZE; i += 4) |
@@ -3530,14 +3526,11 @@ static void cnic_init_bnx2_tx_ring(struct cnic_dev *dev) | |||
3530 | 3526 | ||
3531 | sb_id = cp->status_blk_num; | 3527 | sb_id = cp->status_blk_num; |
3532 | tx_cid = 20; | 3528 | tx_cid = 20; |
3533 | cnic_init_context(dev, tx_cid); | ||
3534 | cnic_init_context(dev, tx_cid + 1); | ||
3535 | cp->tx_cons_ptr = &s_blk->status_tx_quick_consumer_index2; | 3529 | cp->tx_cons_ptr = &s_blk->status_tx_quick_consumer_index2; |
3536 | if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) { | 3530 | if (ethdev->drv_state & CNIC_DRV_STATE_USING_MSIX) { |
3537 | struct status_block_msix *sblk = cp->status_blk.bnx2; | 3531 | struct status_block_msix *sblk = cp->status_blk.bnx2; |
3538 | 3532 | ||
3539 | tx_cid = TX_TSS_CID + sb_id - 1; | 3533 | tx_cid = TX_TSS_CID + sb_id - 1; |
3540 | cnic_init_context(dev, tx_cid); | ||
3541 | CNIC_WR(dev, BNX2_TSCH_TSS_CFG, (sb_id << 24) | | 3534 | CNIC_WR(dev, BNX2_TSCH_TSS_CFG, (sb_id << 24) | |
3542 | (TX_TSS_CID << 7)); | 3535 | (TX_TSS_CID << 7)); |
3543 | cp->tx_cons_ptr = &sblk->status_tx_quick_consumer_index; | 3536 | cp->tx_cons_ptr = &sblk->status_tx_quick_consumer_index; |
@@ -3556,6 +3549,9 @@ static void cnic_init_bnx2_tx_ring(struct cnic_dev *dev) | |||
3556 | offset2 = BNX2_L2CTX_TBDR_BHADDR_HI_XI; | 3549 | offset2 = BNX2_L2CTX_TBDR_BHADDR_HI_XI; |
3557 | offset3 = BNX2_L2CTX_TBDR_BHADDR_LO_XI; | 3550 | offset3 = BNX2_L2CTX_TBDR_BHADDR_LO_XI; |
3558 | } else { | 3551 | } else { |
3552 | cnic_init_context(dev, tx_cid); | ||
3553 | cnic_init_context(dev, tx_cid + 1); | ||
3554 | |||
3559 | offset0 = BNX2_L2CTX_TYPE; | 3555 | offset0 = BNX2_L2CTX_TYPE; |
3560 | offset1 = BNX2_L2CTX_CMD_TYPE; | 3556 | offset1 = BNX2_L2CTX_CMD_TYPE; |
3561 | offset2 = BNX2_L2CTX_TBDR_BHADDR_HI; | 3557 | offset2 = BNX2_L2CTX_TBDR_BHADDR_HI; |
diff --git a/drivers/net/cnic_if.h b/drivers/net/cnic_if.h index 110c62072e6f..0c55177db046 100644 --- a/drivers/net/cnic_if.h +++ b/drivers/net/cnic_if.h | |||
@@ -12,8 +12,8 @@ | |||
12 | #ifndef CNIC_IF_H | 12 | #ifndef CNIC_IF_H |
13 | #define CNIC_IF_H | 13 | #define CNIC_IF_H |
14 | 14 | ||
15 | #define CNIC_MODULE_VERSION "2.1.1" | 15 | #define CNIC_MODULE_VERSION "2.1.2" |
16 | #define CNIC_MODULE_RELDATE "Feb 22, 2010" | 16 | #define CNIC_MODULE_RELDATE "May 26, 2010" |
17 | 17 | ||
18 | #define CNIC_ULP_RDMA 0 | 18 | #define CNIC_ULP_RDMA 0 |
19 | #define CNIC_ULP_ISCSI 1 | 19 | #define CNIC_ULP_ISCSI 1 |
diff --git a/drivers/net/fec.c b/drivers/net/fec.c index 326465ffbb23..ddf7a86cd466 100644 --- a/drivers/net/fec.c +++ b/drivers/net/fec.c | |||
@@ -681,6 +681,8 @@ static int fec_enet_mii_probe(struct net_device *dev) | |||
681 | struct phy_device *phy_dev = NULL; | 681 | struct phy_device *phy_dev = NULL; |
682 | int phy_addr; | 682 | int phy_addr; |
683 | 683 | ||
684 | fep->phy_dev = NULL; | ||
685 | |||
684 | /* find the first phy */ | 686 | /* find the first phy */ |
685 | for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) { | 687 | for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) { |
686 | if (fep->mii_bus->phy_map[phy_addr]) { | 688 | if (fep->mii_bus->phy_map[phy_addr]) { |
@@ -711,6 +713,11 @@ static int fec_enet_mii_probe(struct net_device *dev) | |||
711 | fep->link = 0; | 713 | fep->link = 0; |
712 | fep->full_duplex = 0; | 714 | fep->full_duplex = 0; |
713 | 715 | ||
716 | printk(KERN_INFO "%s: Freescale FEC PHY driver [%s] " | ||
717 | "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name, | ||
718 | fep->phy_dev->drv->name, dev_name(&fep->phy_dev->dev), | ||
719 | fep->phy_dev->irq); | ||
720 | |||
714 | return 0; | 721 | return 0; |
715 | } | 722 | } |
716 | 723 | ||
@@ -756,13 +763,8 @@ static int fec_enet_mii_init(struct platform_device *pdev) | |||
756 | if (mdiobus_register(fep->mii_bus)) | 763 | if (mdiobus_register(fep->mii_bus)) |
757 | goto err_out_free_mdio_irq; | 764 | goto err_out_free_mdio_irq; |
758 | 765 | ||
759 | if (fec_enet_mii_probe(dev) != 0) | ||
760 | goto err_out_unregister_bus; | ||
761 | |||
762 | return 0; | 766 | return 0; |
763 | 767 | ||
764 | err_out_unregister_bus: | ||
765 | mdiobus_unregister(fep->mii_bus); | ||
766 | err_out_free_mdio_irq: | 768 | err_out_free_mdio_irq: |
767 | kfree(fep->mii_bus->irq); | 769 | kfree(fep->mii_bus->irq); |
768 | err_out_free_mdiobus: | 770 | err_out_free_mdiobus: |
@@ -915,7 +917,12 @@ fec_enet_open(struct net_device *dev) | |||
915 | if (ret) | 917 | if (ret) |
916 | return ret; | 918 | return ret; |
917 | 919 | ||
918 | /* schedule a link state check */ | 920 | /* Probe and connect to PHY when open the interface */ |
921 | ret = fec_enet_mii_probe(dev); | ||
922 | if (ret) { | ||
923 | fec_enet_free_buffers(dev); | ||
924 | return ret; | ||
925 | } | ||
919 | phy_start(fep->phy_dev); | 926 | phy_start(fep->phy_dev); |
920 | netif_start_queue(dev); | 927 | netif_start_queue(dev); |
921 | fep->opened = 1; | 928 | fep->opened = 1; |
@@ -929,10 +936,12 @@ fec_enet_close(struct net_device *dev) | |||
929 | 936 | ||
930 | /* Don't know what to do yet. */ | 937 | /* Don't know what to do yet. */ |
931 | fep->opened = 0; | 938 | fep->opened = 0; |
932 | phy_stop(fep->phy_dev); | ||
933 | netif_stop_queue(dev); | 939 | netif_stop_queue(dev); |
934 | fec_stop(dev); | 940 | fec_stop(dev); |
935 | 941 | ||
942 | if (fep->phy_dev) | ||
943 | phy_disconnect(fep->phy_dev); | ||
944 | |||
936 | fec_enet_free_buffers(dev); | 945 | fec_enet_free_buffers(dev); |
937 | 946 | ||
938 | return 0; | 947 | return 0; |
@@ -1316,11 +1325,6 @@ fec_probe(struct platform_device *pdev) | |||
1316 | if (ret) | 1325 | if (ret) |
1317 | goto failed_register; | 1326 | goto failed_register; |
1318 | 1327 | ||
1319 | printk(KERN_INFO "%s: Freescale FEC PHY driver [%s] " | ||
1320 | "(mii_bus:phy_addr=%s, irq=%d)\n", ndev->name, | ||
1321 | fep->phy_dev->drv->name, dev_name(&fep->phy_dev->dev), | ||
1322 | fep->phy_dev->irq); | ||
1323 | |||
1324 | return 0; | 1328 | return 0; |
1325 | 1329 | ||
1326 | failed_register: | 1330 | failed_register: |
diff --git a/drivers/net/hamradio/yam.c b/drivers/net/hamradio/yam.c index 694132e04af6..4e7d1d0a2340 100644 --- a/drivers/net/hamradio/yam.c +++ b/drivers/net/hamradio/yam.c | |||
@@ -1151,8 +1151,7 @@ static int __init yam_init_driver(void) | |||
1151 | dev = alloc_netdev(sizeof(struct yam_port), name, | 1151 | dev = alloc_netdev(sizeof(struct yam_port), name, |
1152 | yam_setup); | 1152 | yam_setup); |
1153 | if (!dev) { | 1153 | if (!dev) { |
1154 | printk(KERN_ERR "yam: cannot allocate net device %s\n", | 1154 | pr_err("yam: cannot allocate net device\n"); |
1155 | dev->name); | ||
1156 | err = -ENOMEM; | 1155 | err = -ENOMEM; |
1157 | goto error; | 1156 | goto error; |
1158 | } | 1157 | } |
diff --git a/drivers/net/ll_temac.h b/drivers/net/ll_temac.h index c03358434acb..522abe2ff25a 100644 --- a/drivers/net/ll_temac.h +++ b/drivers/net/ll_temac.h | |||
@@ -295,6 +295,10 @@ This option defaults to enabled (set) */ | |||
295 | 295 | ||
296 | #define MULTICAST_CAM_TABLE_NUM 4 | 296 | #define MULTICAST_CAM_TABLE_NUM 4 |
297 | 297 | ||
298 | /* TEMAC Synthesis features */ | ||
299 | #define TEMAC_FEATURE_RX_CSUM (1 << 0) | ||
300 | #define TEMAC_FEATURE_TX_CSUM (1 << 1) | ||
301 | |||
298 | /* TX/RX CURDESC_PTR points to first descriptor */ | 302 | /* TX/RX CURDESC_PTR points to first descriptor */ |
299 | /* TX/RX TAILDESC_PTR points to last descriptor in linked list */ | 303 | /* TX/RX TAILDESC_PTR points to last descriptor in linked list */ |
300 | 304 | ||
@@ -353,6 +357,7 @@ struct temac_local { | |||
353 | struct mutex indirect_mutex; | 357 | struct mutex indirect_mutex; |
354 | u32 options; /* Current options word */ | 358 | u32 options; /* Current options word */ |
355 | int last_link; | 359 | int last_link; |
360 | unsigned int temac_features; | ||
356 | 361 | ||
357 | /* Buffer descriptors */ | 362 | /* Buffer descriptors */ |
358 | struct cdmac_bd *tx_bd_v; | 363 | struct cdmac_bd *tx_bd_v; |
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c index fa7620e28404..52dcc8495647 100644 --- a/drivers/net/ll_temac_main.c +++ b/drivers/net/ll_temac_main.c | |||
@@ -245,7 +245,7 @@ static int temac_dma_bd_init(struct net_device *ndev) | |||
245 | CHNL_CTRL_IRQ_COAL_EN); | 245 | CHNL_CTRL_IRQ_COAL_EN); |
246 | /* 0x10220483 */ | 246 | /* 0x10220483 */ |
247 | /* 0x00100483 */ | 247 | /* 0x00100483 */ |
248 | lp->dma_out(lp, RX_CHNL_CTRL, 0xff010000 | | 248 | lp->dma_out(lp, RX_CHNL_CTRL, 0xff070000 | |
249 | CHNL_CTRL_IRQ_EN | | 249 | CHNL_CTRL_IRQ_EN | |
250 | CHNL_CTRL_IRQ_DLY_EN | | 250 | CHNL_CTRL_IRQ_DLY_EN | |
251 | CHNL_CTRL_IRQ_COAL_EN | | 251 | CHNL_CTRL_IRQ_COAL_EN | |
@@ -574,6 +574,10 @@ static void temac_start_xmit_done(struct net_device *ndev) | |||
574 | if (cur_p->app4) | 574 | if (cur_p->app4) |
575 | dev_kfree_skb_irq((struct sk_buff *)cur_p->app4); | 575 | dev_kfree_skb_irq((struct sk_buff *)cur_p->app4); |
576 | cur_p->app0 = 0; | 576 | cur_p->app0 = 0; |
577 | cur_p->app1 = 0; | ||
578 | cur_p->app2 = 0; | ||
579 | cur_p->app3 = 0; | ||
580 | cur_p->app4 = 0; | ||
577 | 581 | ||
578 | ndev->stats.tx_packets++; | 582 | ndev->stats.tx_packets++; |
579 | ndev->stats.tx_bytes += cur_p->len; | 583 | ndev->stats.tx_bytes += cur_p->len; |
@@ -589,6 +593,29 @@ static void temac_start_xmit_done(struct net_device *ndev) | |||
589 | netif_wake_queue(ndev); | 593 | netif_wake_queue(ndev); |
590 | } | 594 | } |
591 | 595 | ||
596 | static inline int temac_check_tx_bd_space(struct temac_local *lp, int num_frag) | ||
597 | { | ||
598 | struct cdmac_bd *cur_p; | ||
599 | int tail; | ||
600 | |||
601 | tail = lp->tx_bd_tail; | ||
602 | cur_p = &lp->tx_bd_v[tail]; | ||
603 | |||
604 | do { | ||
605 | if (cur_p->app0) | ||
606 | return NETDEV_TX_BUSY; | ||
607 | |||
608 | tail++; | ||
609 | if (tail >= TX_BD_NUM) | ||
610 | tail = 0; | ||
611 | |||
612 | cur_p = &lp->tx_bd_v[tail]; | ||
613 | num_frag--; | ||
614 | } while (num_frag >= 0); | ||
615 | |||
616 | return 0; | ||
617 | } | ||
618 | |||
592 | static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) | 619 | static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) |
593 | { | 620 | { |
594 | struct temac_local *lp = netdev_priv(ndev); | 621 | struct temac_local *lp = netdev_priv(ndev); |
@@ -603,7 +630,7 @@ static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
603 | start_p = lp->tx_bd_p + sizeof(*lp->tx_bd_v) * lp->tx_bd_tail; | 630 | start_p = lp->tx_bd_p + sizeof(*lp->tx_bd_v) * lp->tx_bd_tail; |
604 | cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; | 631 | cur_p = &lp->tx_bd_v[lp->tx_bd_tail]; |
605 | 632 | ||
606 | if (cur_p->app0 & STS_CTRL_APP0_CMPLT) { | 633 | if (temac_check_tx_bd_space(lp, num_frag)) { |
607 | if (!netif_queue_stopped(ndev)) { | 634 | if (!netif_queue_stopped(ndev)) { |
608 | netif_stop_queue(ndev); | 635 | netif_stop_queue(ndev); |
609 | return NETDEV_TX_BUSY; | 636 | return NETDEV_TX_BUSY; |
@@ -613,29 +640,14 @@ static int temac_start_xmit(struct sk_buff *skb, struct net_device *ndev) | |||
613 | 640 | ||
614 | cur_p->app0 = 0; | 641 | cur_p->app0 = 0; |
615 | if (skb->ip_summed == CHECKSUM_PARTIAL) { | 642 | if (skb->ip_summed == CHECKSUM_PARTIAL) { |
616 | const struct iphdr *ip = ip_hdr(skb); | 643 | unsigned int csum_start_off = skb_transport_offset(skb); |
617 | int length = 0, start = 0, insert = 0; | 644 | unsigned int csum_index_off = csum_start_off + skb->csum_offset; |
618 | 645 | ||
619 | switch (ip->protocol) { | 646 | cur_p->app0 |= 1; /* TX Checksum Enabled */ |
620 | case IPPROTO_TCP: | 647 | cur_p->app1 = (csum_start_off << 16) | csum_index_off; |
621 | start = sizeof(struct iphdr) + ETH_HLEN; | 648 | cur_p->app2 = 0; /* initial checksum seed */ |
622 | insert = sizeof(struct iphdr) + ETH_HLEN + 16; | ||
623 | length = ip->tot_len - sizeof(struct iphdr); | ||
624 | break; | ||
625 | case IPPROTO_UDP: | ||
626 | start = sizeof(struct iphdr) + ETH_HLEN; | ||
627 | insert = sizeof(struct iphdr) + ETH_HLEN + 6; | ||
628 | length = ip->tot_len - sizeof(struct iphdr); | ||
629 | break; | ||
630 | default: | ||
631 | break; | ||
632 | } | ||
633 | cur_p->app1 = ((start << 16) | insert); | ||
634 | cur_p->app2 = csum_tcpudp_magic(ip->saddr, ip->daddr, | ||
635 | length, ip->protocol, 0); | ||
636 | skb->data[insert] = 0; | ||
637 | skb->data[insert + 1] = 0; | ||
638 | } | 649 | } |
650 | |||
639 | cur_p->app0 |= STS_CTRL_APP0_SOP; | 651 | cur_p->app0 |= STS_CTRL_APP0_SOP; |
640 | cur_p->len = skb_headlen(skb); | 652 | cur_p->len = skb_headlen(skb); |
641 | cur_p->phys = dma_map_single(ndev->dev.parent, skb->data, skb->len, | 653 | cur_p->phys = dma_map_single(ndev->dev.parent, skb->data, skb->len, |
@@ -699,6 +711,15 @@ static void ll_temac_recv(struct net_device *ndev) | |||
699 | skb->protocol = eth_type_trans(skb, ndev); | 711 | skb->protocol = eth_type_trans(skb, ndev); |
700 | skb->ip_summed = CHECKSUM_NONE; | 712 | skb->ip_summed = CHECKSUM_NONE; |
701 | 713 | ||
714 | /* if we're doing rx csum offload, set it up */ | ||
715 | if (((lp->temac_features & TEMAC_FEATURE_RX_CSUM) != 0) && | ||
716 | (skb->protocol == __constant_htons(ETH_P_IP)) && | ||
717 | (skb->len > 64)) { | ||
718 | |||
719 | skb->csum = cur_p->app3 & 0xFFFF; | ||
720 | skb->ip_summed = CHECKSUM_COMPLETE; | ||
721 | } | ||
722 | |||
702 | netif_rx(skb); | 723 | netif_rx(skb); |
703 | 724 | ||
704 | ndev->stats.rx_packets++; | 725 | ndev->stats.rx_packets++; |
@@ -883,6 +904,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match) | |||
883 | struct temac_local *lp; | 904 | struct temac_local *lp; |
884 | struct net_device *ndev; | 905 | struct net_device *ndev; |
885 | const void *addr; | 906 | const void *addr; |
907 | __be32 *p; | ||
886 | int size, rc = 0; | 908 | int size, rc = 0; |
887 | 909 | ||
888 | /* Init network device structure */ | 910 | /* Init network device structure */ |
@@ -926,6 +948,18 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match) | |||
926 | goto nodev; | 948 | goto nodev; |
927 | } | 949 | } |
928 | 950 | ||
951 | /* Setup checksum offload, but default to off if not specified */ | ||
952 | lp->temac_features = 0; | ||
953 | p = (__be32 *)of_get_property(op->dev.of_node, "xlnx,txcsum", NULL); | ||
954 | if (p && be32_to_cpu(*p)) { | ||
955 | lp->temac_features |= TEMAC_FEATURE_TX_CSUM; | ||
956 | /* Can checksum TCP/UDP over IPv4. */ | ||
957 | ndev->features |= NETIF_F_IP_CSUM; | ||
958 | } | ||
959 | p = (__be32 *)of_get_property(op->dev.of_node, "xlnx,rxcsum", NULL); | ||
960 | if (p && be32_to_cpu(*p)) | ||
961 | lp->temac_features |= TEMAC_FEATURE_RX_CSUM; | ||
962 | |||
929 | /* Find the DMA node, map the DMA registers, and decode the DMA IRQs */ | 963 | /* Find the DMA node, map the DMA registers, and decode the DMA IRQs */ |
930 | np = of_parse_phandle(op->dev.of_node, "llink-connected", 0); | 964 | np = of_parse_phandle(op->dev.of_node, "llink-connected", 0); |
931 | if (!np) { | 965 | if (!np) { |
@@ -950,7 +984,7 @@ temac_of_probe(struct of_device *op, const struct of_device_id *match) | |||
950 | 984 | ||
951 | lp->rx_irq = irq_of_parse_and_map(np, 0); | 985 | lp->rx_irq = irq_of_parse_and_map(np, 0); |
952 | lp->tx_irq = irq_of_parse_and_map(np, 1); | 986 | lp->tx_irq = irq_of_parse_and_map(np, 1); |
953 | if (!lp->rx_irq || !lp->tx_irq) { | 987 | if ((lp->rx_irq == NO_IRQ) || (lp->tx_irq == NO_IRQ)) { |
954 | dev_err(&op->dev, "could not determine irqs\n"); | 988 | dev_err(&op->dev, "could not determine irqs\n"); |
955 | rc = -ENOMEM; | 989 | rc = -ENOMEM; |
956 | goto nodev; | 990 | goto nodev; |
diff --git a/drivers/staging/pohmelfs/inode.c b/drivers/staging/pohmelfs/inode.c index 9286e863b0e7..e92595eff1b8 100644 --- a/drivers/staging/pohmelfs/inode.c +++ b/drivers/staging/pohmelfs/inode.c | |||
@@ -880,7 +880,7 @@ static struct inode *pohmelfs_alloc_inode(struct super_block *sb) | |||
880 | /* | 880 | /* |
881 | * We want fsync() to work on POHMELFS. | 881 | * We want fsync() to work on POHMELFS. |
882 | */ | 882 | */ |
883 | static int pohmelfs_fsync(struct file *file, struct dentry *dentry, int datasync) | 883 | static int pohmelfs_fsync(struct file *file, int datasync) |
884 | { | 884 | { |
885 | struct inode *inode = file->f_mapping->host; | 885 | struct inode *inode = file->f_mapping->host; |
886 | struct writeback_control wbc = { | 886 | struct writeback_control wbc = { |
diff --git a/drivers/usb/gadget/printer.c b/drivers/usb/gadget/printer.c index 6b8bf8c781c4..43abf55d8c60 100644 --- a/drivers/usb/gadget/printer.c +++ b/drivers/usb/gadget/printer.c | |||
@@ -794,7 +794,7 @@ printer_write(struct file *fd, const char __user *buf, size_t len, loff_t *ptr) | |||
794 | } | 794 | } |
795 | 795 | ||
796 | static int | 796 | static int |
797 | printer_fsync(struct file *fd, struct dentry *dentry, int datasync) | 797 | printer_fsync(struct file *fd, int datasync) |
798 | { | 798 | { |
799 | struct printer_dev *dev = fd->private_data; | 799 | struct printer_dev *dev = fd->private_data; |
800 | unsigned long flags; | 800 | unsigned long flags; |
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index aa88911c9504..0f41c9195e9b 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -593,17 +593,17 @@ static long vhost_net_ioctl(struct file *f, unsigned int ioctl, | |||
593 | int r; | 593 | int r; |
594 | switch (ioctl) { | 594 | switch (ioctl) { |
595 | case VHOST_NET_SET_BACKEND: | 595 | case VHOST_NET_SET_BACKEND: |
596 | r = copy_from_user(&backend, argp, sizeof backend); | 596 | if (copy_from_user(&backend, argp, sizeof backend)) |
597 | if (r < 0) | 597 | return -EFAULT; |
598 | return r; | ||
599 | return vhost_net_set_backend(n, backend.index, backend.fd); | 598 | return vhost_net_set_backend(n, backend.index, backend.fd); |
600 | case VHOST_GET_FEATURES: | 599 | case VHOST_GET_FEATURES: |
601 | features = VHOST_FEATURES; | 600 | features = VHOST_FEATURES; |
602 | return copy_to_user(featurep, &features, sizeof features); | 601 | if (copy_to_user(featurep, &features, sizeof features)) |
602 | return -EFAULT; | ||
603 | return 0; | ||
603 | case VHOST_SET_FEATURES: | 604 | case VHOST_SET_FEATURES: |
604 | r = copy_from_user(&features, featurep, sizeof features); | 605 | if (copy_from_user(&features, featurep, sizeof features)) |
605 | if (r < 0) | 606 | return -EFAULT; |
606 | return r; | ||
607 | if (features & ~VHOST_FEATURES) | 607 | if (features & ~VHOST_FEATURES) |
608 | return -EOPNOTSUPP; | 608 | return -EOPNOTSUPP; |
609 | return vhost_net_set_features(n, features); | 609 | return vhost_net_set_features(n, features); |
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index c6fb8e968f21..3b83382e06eb 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -320,10 +320,8 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m) | |||
320 | { | 320 | { |
321 | struct vhost_memory mem, *newmem, *oldmem; | 321 | struct vhost_memory mem, *newmem, *oldmem; |
322 | unsigned long size = offsetof(struct vhost_memory, regions); | 322 | unsigned long size = offsetof(struct vhost_memory, regions); |
323 | long r; | 323 | if (copy_from_user(&mem, m, size)) |
324 | r = copy_from_user(&mem, m, size); | 324 | return -EFAULT; |
325 | if (r) | ||
326 | return r; | ||
327 | if (mem.padding) | 325 | if (mem.padding) |
328 | return -EOPNOTSUPP; | 326 | return -EOPNOTSUPP; |
329 | if (mem.nregions > VHOST_MEMORY_MAX_NREGIONS) | 327 | if (mem.nregions > VHOST_MEMORY_MAX_NREGIONS) |
@@ -333,15 +331,16 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m) | |||
333 | return -ENOMEM; | 331 | return -ENOMEM; |
334 | 332 | ||
335 | memcpy(newmem, &mem, size); | 333 | memcpy(newmem, &mem, size); |
336 | r = copy_from_user(newmem->regions, m->regions, | 334 | if (copy_from_user(newmem->regions, m->regions, |
337 | mem.nregions * sizeof *m->regions); | 335 | mem.nregions * sizeof *m->regions)) { |
338 | if (r) { | ||
339 | kfree(newmem); | 336 | kfree(newmem); |
340 | return r; | 337 | return -EFAULT; |
341 | } | 338 | } |
342 | 339 | ||
343 | if (!memory_access_ok(d, newmem, vhost_has_feature(d, VHOST_F_LOG_ALL))) | 340 | if (!memory_access_ok(d, newmem, vhost_has_feature(d, VHOST_F_LOG_ALL))) { |
341 | kfree(newmem); | ||
344 | return -EFAULT; | 342 | return -EFAULT; |
343 | } | ||
345 | oldmem = d->memory; | 344 | oldmem = d->memory; |
346 | rcu_assign_pointer(d->memory, newmem); | 345 | rcu_assign_pointer(d->memory, newmem); |
347 | synchronize_rcu(); | 346 | synchronize_rcu(); |
@@ -374,7 +373,7 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) | |||
374 | r = get_user(idx, idxp); | 373 | r = get_user(idx, idxp); |
375 | if (r < 0) | 374 | if (r < 0) |
376 | return r; | 375 | return r; |
377 | if (idx > d->nvqs) | 376 | if (idx >= d->nvqs) |
378 | return -ENOBUFS; | 377 | return -ENOBUFS; |
379 | 378 | ||
380 | vq = d->vqs + idx; | 379 | vq = d->vqs + idx; |
@@ -389,9 +388,10 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) | |||
389 | r = -EBUSY; | 388 | r = -EBUSY; |
390 | break; | 389 | break; |
391 | } | 390 | } |
392 | r = copy_from_user(&s, argp, sizeof s); | 391 | if (copy_from_user(&s, argp, sizeof s)) { |
393 | if (r < 0) | 392 | r = -EFAULT; |
394 | break; | 393 | break; |
394 | } | ||
395 | if (!s.num || s.num > 0xffff || (s.num & (s.num - 1))) { | 395 | if (!s.num || s.num > 0xffff || (s.num & (s.num - 1))) { |
396 | r = -EINVAL; | 396 | r = -EINVAL; |
397 | break; | 397 | break; |
@@ -405,9 +405,10 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) | |||
405 | r = -EBUSY; | 405 | r = -EBUSY; |
406 | break; | 406 | break; |
407 | } | 407 | } |
408 | r = copy_from_user(&s, argp, sizeof s); | 408 | if (copy_from_user(&s, argp, sizeof s)) { |
409 | if (r < 0) | 409 | r = -EFAULT; |
410 | break; | 410 | break; |
411 | } | ||
411 | if (s.num > 0xffff) { | 412 | if (s.num > 0xffff) { |
412 | r = -EINVAL; | 413 | r = -EINVAL; |
413 | break; | 414 | break; |
@@ -419,12 +420,14 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) | |||
419 | case VHOST_GET_VRING_BASE: | 420 | case VHOST_GET_VRING_BASE: |
420 | s.index = idx; | 421 | s.index = idx; |
421 | s.num = vq->last_avail_idx; | 422 | s.num = vq->last_avail_idx; |
422 | r = copy_to_user(argp, &s, sizeof s); | 423 | if (copy_to_user(argp, &s, sizeof s)) |
424 | r = -EFAULT; | ||
423 | break; | 425 | break; |
424 | case VHOST_SET_VRING_ADDR: | 426 | case VHOST_SET_VRING_ADDR: |
425 | r = copy_from_user(&a, argp, sizeof a); | 427 | if (copy_from_user(&a, argp, sizeof a)) { |
426 | if (r < 0) | 428 | r = -EFAULT; |
427 | break; | 429 | break; |
430 | } | ||
428 | if (a.flags & ~(0x1 << VHOST_VRING_F_LOG)) { | 431 | if (a.flags & ~(0x1 << VHOST_VRING_F_LOG)) { |
429 | r = -EOPNOTSUPP; | 432 | r = -EOPNOTSUPP; |
430 | break; | 433 | break; |
@@ -477,9 +480,10 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) | |||
477 | vq->used = (void __user *)(unsigned long)a.used_user_addr; | 480 | vq->used = (void __user *)(unsigned long)a.used_user_addr; |
478 | break; | 481 | break; |
479 | case VHOST_SET_VRING_KICK: | 482 | case VHOST_SET_VRING_KICK: |
480 | r = copy_from_user(&f, argp, sizeof f); | 483 | if (copy_from_user(&f, argp, sizeof f)) { |
481 | if (r < 0) | 484 | r = -EFAULT; |
482 | break; | 485 | break; |
486 | } | ||
483 | eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); | 487 | eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); |
484 | if (IS_ERR(eventfp)) { | 488 | if (IS_ERR(eventfp)) { |
485 | r = PTR_ERR(eventfp); | 489 | r = PTR_ERR(eventfp); |
@@ -492,9 +496,10 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) | |||
492 | filep = eventfp; | 496 | filep = eventfp; |
493 | break; | 497 | break; |
494 | case VHOST_SET_VRING_CALL: | 498 | case VHOST_SET_VRING_CALL: |
495 | r = copy_from_user(&f, argp, sizeof f); | 499 | if (copy_from_user(&f, argp, sizeof f)) { |
496 | if (r < 0) | 500 | r = -EFAULT; |
497 | break; | 501 | break; |
502 | } | ||
498 | eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); | 503 | eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); |
499 | if (IS_ERR(eventfp)) { | 504 | if (IS_ERR(eventfp)) { |
500 | r = PTR_ERR(eventfp); | 505 | r = PTR_ERR(eventfp); |
@@ -510,9 +515,10 @@ static long vhost_set_vring(struct vhost_dev *d, int ioctl, void __user *argp) | |||
510 | filep = eventfp; | 515 | filep = eventfp; |
511 | break; | 516 | break; |
512 | case VHOST_SET_VRING_ERR: | 517 | case VHOST_SET_VRING_ERR: |
513 | r = copy_from_user(&f, argp, sizeof f); | 518 | if (copy_from_user(&f, argp, sizeof f)) { |
514 | if (r < 0) | 519 | r = -EFAULT; |
515 | break; | 520 | break; |
521 | } | ||
516 | eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); | 522 | eventfp = f.fd == -1 ? NULL : eventfd_fget(f.fd); |
517 | if (IS_ERR(eventfp)) { | 523 | if (IS_ERR(eventfp)) { |
518 | r = PTR_ERR(eventfp); | 524 | r = PTR_ERR(eventfp); |
@@ -575,9 +581,10 @@ long vhost_dev_ioctl(struct vhost_dev *d, unsigned int ioctl, unsigned long arg) | |||
575 | r = vhost_set_memory(d, argp); | 581 | r = vhost_set_memory(d, argp); |
576 | break; | 582 | break; |
577 | case VHOST_SET_LOG_BASE: | 583 | case VHOST_SET_LOG_BASE: |
578 | r = copy_from_user(&p, argp, sizeof p); | 584 | if (copy_from_user(&p, argp, sizeof p)) { |
579 | if (r < 0) | 585 | r = -EFAULT; |
580 | break; | 586 | break; |
587 | } | ||
581 | if ((u64)(unsigned long)p != p) { | 588 | if ((u64)(unsigned long)p != p) { |
582 | r = -EFAULT; | 589 | r = -EFAULT; |
583 | break; | 590 | break; |
diff --git a/drivers/video/fb_defio.c b/drivers/video/fb_defio.c index 1105a591dcc1..073c9b408cf7 100644 --- a/drivers/video/fb_defio.c +++ b/drivers/video/fb_defio.c | |||
@@ -66,7 +66,7 @@ static int fb_deferred_io_fault(struct vm_area_struct *vma, | |||
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |
68 | 68 | ||
69 | int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, int datasync) | 69 | int fb_deferred_io_fsync(struct file *file, int datasync) |
70 | { | 70 | { |
71 | struct fb_info *info = file->private_data; | 71 | struct fb_info *info = file->private_data; |
72 | 72 | ||
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 25b300e1c9d7..2bedc6c94fc2 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -257,15 +257,13 @@ v9fs_file_write(struct file *filp, const char __user * data, | |||
257 | return total; | 257 | return total; |
258 | } | 258 | } |
259 | 259 | ||
260 | static int v9fs_file_fsync(struct file *filp, struct dentry *dentry, | 260 | static int v9fs_file_fsync(struct file *filp, int datasync) |
261 | int datasync) | ||
262 | { | 261 | { |
263 | struct p9_fid *fid; | 262 | struct p9_fid *fid; |
264 | struct p9_wstat wstat; | 263 | struct p9_wstat wstat; |
265 | int retval; | 264 | int retval; |
266 | 265 | ||
267 | P9_DPRINTK(P9_DEBUG_VFS, "filp %p dentry %p datasync %x\n", filp, | 266 | P9_DPRINTK(P9_DEBUG_VFS, "filp %p datasync %x\n", filp, datasync); |
268 | dentry, datasync); | ||
269 | 267 | ||
270 | fid = filp->private_data; | 268 | fid = filp->private_data; |
271 | v9fs_blank_wstat(&wstat); | 269 | v9fs_blank_wstat(&wstat); |
diff --git a/fs/adfs/dir.c b/fs/adfs/dir.c index 23aa52f548a0..f4287e4de744 100644 --- a/fs/adfs/dir.c +++ b/fs/adfs/dir.c | |||
@@ -197,7 +197,7 @@ const struct file_operations adfs_dir_operations = { | |||
197 | .read = generic_read_dir, | 197 | .read = generic_read_dir, |
198 | .llseek = generic_file_llseek, | 198 | .llseek = generic_file_llseek, |
199 | .readdir = adfs_readdir, | 199 | .readdir = adfs_readdir, |
200 | .fsync = simple_fsync, | 200 | .fsync = generic_file_fsync, |
201 | }; | 201 | }; |
202 | 202 | ||
203 | static int | 203 | static int |
diff --git a/fs/adfs/file.c b/fs/adfs/file.c index 005ea34d1758..a36da5382b40 100644 --- a/fs/adfs/file.c +++ b/fs/adfs/file.c | |||
@@ -26,7 +26,7 @@ const struct file_operations adfs_file_operations = { | |||
26 | .read = do_sync_read, | 26 | .read = do_sync_read, |
27 | .aio_read = generic_file_aio_read, | 27 | .aio_read = generic_file_aio_read, |
28 | .mmap = generic_file_mmap, | 28 | .mmap = generic_file_mmap, |
29 | .fsync = simple_fsync, | 29 | .fsync = generic_file_fsync, |
30 | .write = do_sync_write, | 30 | .write = do_sync_write, |
31 | .aio_write = generic_file_aio_write, | 31 | .aio_write = generic_file_aio_write, |
32 | .splice_read = generic_file_splice_read, | 32 | .splice_read = generic_file_splice_read, |
diff --git a/fs/adfs/inode.c b/fs/adfs/inode.c index 0f5e30978135..6f850b06ab62 100644 --- a/fs/adfs/inode.c +++ b/fs/adfs/inode.c | |||
@@ -322,8 +322,9 @@ adfs_notify_change(struct dentry *dentry, struct iattr *attr) | |||
322 | if (error) | 322 | if (error) |
323 | goto out; | 323 | goto out; |
324 | 324 | ||
325 | /* XXX: this is missing some actual on-disk truncation.. */ | ||
325 | if (ia_valid & ATTR_SIZE) | 326 | if (ia_valid & ATTR_SIZE) |
326 | error = vmtruncate(inode, attr->ia_size); | 327 | error = simple_setsize(inode, attr->ia_size); |
327 | 328 | ||
328 | if (error) | 329 | if (error) |
329 | goto out; | 330 | goto out; |
diff --git a/fs/affs/affs.h b/fs/affs/affs.h index 861dae68ac12..f05b6155ccc8 100644 --- a/fs/affs/affs.h +++ b/fs/affs/affs.h | |||
@@ -183,7 +183,7 @@ extern int affs_add_entry(struct inode *dir, struct inode *inode, struct dent | |||
183 | 183 | ||
184 | void affs_free_prealloc(struct inode *inode); | 184 | void affs_free_prealloc(struct inode *inode); |
185 | extern void affs_truncate(struct inode *); | 185 | extern void affs_truncate(struct inode *); |
186 | int affs_file_fsync(struct file *, struct dentry *, int); | 186 | int affs_file_fsync(struct file *, int); |
187 | 187 | ||
188 | /* dir.c */ | 188 | /* dir.c */ |
189 | 189 | ||
diff --git a/fs/affs/file.c b/fs/affs/file.c index 184e55c1c9ba..322710c3eedf 100644 --- a/fs/affs/file.c +++ b/fs/affs/file.c | |||
@@ -916,9 +916,9 @@ affs_truncate(struct inode *inode) | |||
916 | affs_free_prealloc(inode); | 916 | affs_free_prealloc(inode); |
917 | } | 917 | } |
918 | 918 | ||
919 | int affs_file_fsync(struct file *filp, struct dentry *dentry, int datasync) | 919 | int affs_file_fsync(struct file *filp, int datasync) |
920 | { | 920 | { |
921 | struct inode * inode = dentry->d_inode; | 921 | struct inode *inode = filp->f_mapping->host; |
922 | int ret, err; | 922 | int ret, err; |
923 | 923 | ||
924 | ret = write_inode_now(inode, 0); | 924 | ret = write_inode_now(inode, 0); |
diff --git a/fs/afs/internal.h b/fs/afs/internal.h index 807f284cc75e..5f679b77ce24 100644 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h | |||
@@ -740,7 +740,7 @@ extern void afs_pages_written_back(struct afs_vnode *, struct afs_call *); | |||
740 | extern ssize_t afs_file_write(struct kiocb *, const struct iovec *, | 740 | extern ssize_t afs_file_write(struct kiocb *, const struct iovec *, |
741 | unsigned long, loff_t); | 741 | unsigned long, loff_t); |
742 | extern int afs_writeback_all(struct afs_vnode *); | 742 | extern int afs_writeback_all(struct afs_vnode *); |
743 | extern int afs_fsync(struct file *, struct dentry *, int); | 743 | extern int afs_fsync(struct file *, int); |
744 | 744 | ||
745 | 745 | ||
746 | /*****************************************************************************/ | 746 | /*****************************************************************************/ |
diff --git a/fs/afs/write.c b/fs/afs/write.c index 3bed54a294d4..3dab9e9948d0 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c | |||
@@ -701,8 +701,9 @@ int afs_writeback_all(struct afs_vnode *vnode) | |||
701 | * - the return status from this call provides a reliable indication of | 701 | * - the return status from this call provides a reliable indication of |
702 | * whether any write errors occurred for this process. | 702 | * whether any write errors occurred for this process. |
703 | */ | 703 | */ |
704 | int afs_fsync(struct file *file, struct dentry *dentry, int datasync) | 704 | int afs_fsync(struct file *file, int datasync) |
705 | { | 705 | { |
706 | struct dentry *dentry = file->f_path.dentry; | ||
706 | struct afs_writeback *wb, *xwb; | 707 | struct afs_writeback *wb, *xwb; |
707 | struct afs_vnode *vnode = AFS_FS_I(dentry->d_inode); | 708 | struct afs_vnode *vnode = AFS_FS_I(dentry->d_inode); |
708 | int ret; | 709 | int ret; |
@@ -527,7 +527,7 @@ static void aio_fput_routine(struct work_struct *data) | |||
527 | 527 | ||
528 | /* Complete the fput(s) */ | 528 | /* Complete the fput(s) */ |
529 | if (req->ki_filp != NULL) | 529 | if (req->ki_filp != NULL) |
530 | __fput(req->ki_filp); | 530 | fput(req->ki_filp); |
531 | 531 | ||
532 | /* Link the iocb into the context's free list */ | 532 | /* Link the iocb into the context's free list */ |
533 | spin_lock_irq(&ctx->ctx_lock); | 533 | spin_lock_irq(&ctx->ctx_lock); |
@@ -560,11 +560,11 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req) | |||
560 | 560 | ||
561 | /* | 561 | /* |
562 | * Try to optimize the aio and eventfd file* puts, by avoiding to | 562 | * Try to optimize the aio and eventfd file* puts, by avoiding to |
563 | * schedule work in case it is not __fput() time. In normal cases, | 563 | * schedule work in case it is not final fput() time. In normal cases, |
564 | * we would not be holding the last reference to the file*, so | 564 | * we would not be holding the last reference to the file*, so |
565 | * this function will be executed w/out any aio kthread wakeup. | 565 | * this function will be executed w/out any aio kthread wakeup. |
566 | */ | 566 | */ |
567 | if (unlikely(atomic_long_dec_and_test(&req->ki_filp->f_count))) { | 567 | if (unlikely(!fput_atomic(req->ki_filp))) { |
568 | get_ioctx(ctx); | 568 | get_ioctx(ctx); |
569 | spin_lock(&fput_lock); | 569 | spin_lock(&fput_lock); |
570 | list_add(&req->ki_list, &fput_head); | 570 | list_add(&req->ki_list, &fput_head); |
diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c index 9bd4b3876c99..e4b75d6eda83 100644 --- a/fs/anon_inodes.c +++ b/fs/anon_inodes.c | |||
@@ -205,7 +205,7 @@ static struct inode *anon_inode_mkinode(void) | |||
205 | * that it already _is_ on the dirty list. | 205 | * that it already _is_ on the dirty list. |
206 | */ | 206 | */ |
207 | inode->i_state = I_DIRTY; | 207 | inode->i_state = I_DIRTY; |
208 | inode->i_mode = S_IFREG | S_IRUSR | S_IWUSR; | 208 | inode->i_mode = S_IRUSR | S_IWUSR; |
209 | inode->i_uid = current_fsuid(); | 209 | inode->i_uid = current_fsuid(); |
210 | inode->i_gid = current_fsgid(); | 210 | inode->i_gid = current_fsgid(); |
211 | inode->i_flags |= S_PRIVATE; | 211 | inode->i_flags |= S_PRIVATE; |
@@ -67,14 +67,14 @@ EXPORT_SYMBOL(inode_change_ok); | |||
67 | * @offset: the new size to assign to the inode | 67 | * @offset: the new size to assign to the inode |
68 | * @Returns: 0 on success, -ve errno on failure | 68 | * @Returns: 0 on success, -ve errno on failure |
69 | * | 69 | * |
70 | * inode_newsize_ok must be called with i_mutex held. | ||
71 | * | ||
70 | * inode_newsize_ok will check filesystem limits and ulimits to check that the | 72 | * inode_newsize_ok will check filesystem limits and ulimits to check that the |
71 | * new inode size is within limits. inode_newsize_ok will also send SIGXFSZ | 73 | * new inode size is within limits. inode_newsize_ok will also send SIGXFSZ |
72 | * when necessary. Caller must not proceed with inode size change if failure is | 74 | * when necessary. Caller must not proceed with inode size change if failure is |
73 | * returned. @inode must be a file (not directory), with appropriate | 75 | * returned. @inode must be a file (not directory), with appropriate |
74 | * permissions to allow truncate (inode_newsize_ok does NOT check these | 76 | * permissions to allow truncate (inode_newsize_ok does NOT check these |
75 | * conditions). | 77 | * conditions). |
76 | * | ||
77 | * inode_newsize_ok must be called with i_mutex held. | ||
78 | */ | 78 | */ |
79 | int inode_newsize_ok(const struct inode *inode, loff_t offset) | 79 | int inode_newsize_ok(const struct inode *inode, loff_t offset) |
80 | { | 80 | { |
@@ -104,17 +104,25 @@ out_big: | |||
104 | } | 104 | } |
105 | EXPORT_SYMBOL(inode_newsize_ok); | 105 | EXPORT_SYMBOL(inode_newsize_ok); |
106 | 106 | ||
107 | int inode_setattr(struct inode * inode, struct iattr * attr) | 107 | /** |
108 | * generic_setattr - copy simple metadata updates into the generic inode | ||
109 | * @inode: the inode to be updated | ||
110 | * @attr: the new attributes | ||
111 | * | ||
112 | * generic_setattr must be called with i_mutex held. | ||
113 | * | ||
114 | * generic_setattr updates the inode's metadata with that specified | ||
115 | * in attr. Noticably missing is inode size update, which is more complex | ||
116 | * as it requires pagecache updates. See simple_setsize. | ||
117 | * | ||
118 | * The inode is not marked as dirty after this operation. The rationale is | ||
119 | * that for "simple" filesystems, the struct inode is the inode storage. | ||
120 | * The caller is free to mark the inode dirty afterwards if needed. | ||
121 | */ | ||
122 | void generic_setattr(struct inode *inode, const struct iattr *attr) | ||
108 | { | 123 | { |
109 | unsigned int ia_valid = attr->ia_valid; | 124 | unsigned int ia_valid = attr->ia_valid; |
110 | 125 | ||
111 | if (ia_valid & ATTR_SIZE && | ||
112 | attr->ia_size != i_size_read(inode)) { | ||
113 | int error = vmtruncate(inode, attr->ia_size); | ||
114 | if (error) | ||
115 | return error; | ||
116 | } | ||
117 | |||
118 | if (ia_valid & ATTR_UID) | 126 | if (ia_valid & ATTR_UID) |
119 | inode->i_uid = attr->ia_uid; | 127 | inode->i_uid = attr->ia_uid; |
120 | if (ia_valid & ATTR_GID) | 128 | if (ia_valid & ATTR_GID) |
@@ -135,6 +143,28 @@ int inode_setattr(struct inode * inode, struct iattr * attr) | |||
135 | mode &= ~S_ISGID; | 143 | mode &= ~S_ISGID; |
136 | inode->i_mode = mode; | 144 | inode->i_mode = mode; |
137 | } | 145 | } |
146 | } | ||
147 | EXPORT_SYMBOL(generic_setattr); | ||
148 | |||
149 | /* | ||
150 | * note this function is deprecated, the new truncate sequence should be | ||
151 | * used instead -- see eg. simple_setsize, generic_setattr. | ||
152 | */ | ||
153 | int inode_setattr(struct inode *inode, const struct iattr *attr) | ||
154 | { | ||
155 | unsigned int ia_valid = attr->ia_valid; | ||
156 | |||
157 | if (ia_valid & ATTR_SIZE && | ||
158 | attr->ia_size != i_size_read(inode)) { | ||
159 | int error; | ||
160 | |||
161 | error = vmtruncate(inode, attr->ia_size); | ||
162 | if (error) | ||
163 | return error; | ||
164 | } | ||
165 | |||
166 | generic_setattr(inode, attr); | ||
167 | |||
138 | mark_inode_dirty(inode); | 168 | mark_inode_dirty(inode); |
139 | 169 | ||
140 | return 0; | 170 | return 0; |
diff --git a/fs/bad_inode.c b/fs/bad_inode.c index a05287a23f62..52e59bf4aa5f 100644 --- a/fs/bad_inode.c +++ b/fs/bad_inode.c | |||
@@ -93,8 +93,7 @@ static int bad_file_release(struct inode *inode, struct file *filp) | |||
93 | return -EIO; | 93 | return -EIO; |
94 | } | 94 | } |
95 | 95 | ||
96 | static int bad_file_fsync(struct file *file, struct dentry *dentry, | 96 | static int bad_file_fsync(struct file *file, int datasync) |
97 | int datasync) | ||
98 | { | 97 | { |
99 | return -EIO; | 98 | return -EIO; |
100 | } | 99 | } |
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c index 8f73841fc974..d967e052b779 100644 --- a/fs/bfs/dir.c +++ b/fs/bfs/dir.c | |||
@@ -78,7 +78,7 @@ static int bfs_readdir(struct file *f, void *dirent, filldir_t filldir) | |||
78 | const struct file_operations bfs_dir_operations = { | 78 | const struct file_operations bfs_dir_operations = { |
79 | .read = generic_read_dir, | 79 | .read = generic_read_dir, |
80 | .readdir = bfs_readdir, | 80 | .readdir = bfs_readdir, |
81 | .fsync = simple_fsync, | 81 | .fsync = generic_file_fsync, |
82 | .llseek = generic_file_llseek, | 82 | .llseek = generic_file_llseek, |
83 | }; | 83 | }; |
84 | 84 | ||
diff --git a/fs/block_dev.c b/fs/block_dev.c index 26e5f5026620..7346c96308a5 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -172,8 +172,9 @@ blkdev_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | |||
172 | struct file *file = iocb->ki_filp; | 172 | struct file *file = iocb->ki_filp; |
173 | struct inode *inode = file->f_mapping->host; | 173 | struct inode *inode = file->f_mapping->host; |
174 | 174 | ||
175 | return blockdev_direct_IO_no_locking(rw, iocb, inode, I_BDEV(inode), | 175 | return blockdev_direct_IO_no_locking_newtrunc(rw, iocb, inode, |
176 | iov, offset, nr_segs, blkdev_get_blocks, NULL); | 176 | I_BDEV(inode), iov, offset, nr_segs, |
177 | blkdev_get_blocks, NULL); | ||
177 | } | 178 | } |
178 | 179 | ||
179 | int __sync_blockdev(struct block_device *bdev, int wait) | 180 | int __sync_blockdev(struct block_device *bdev, int wait) |
@@ -309,8 +310,8 @@ static int blkdev_write_begin(struct file *file, struct address_space *mapping, | |||
309 | struct page **pagep, void **fsdata) | 310 | struct page **pagep, void **fsdata) |
310 | { | 311 | { |
311 | *pagep = NULL; | 312 | *pagep = NULL; |
312 | return block_write_begin(file, mapping, pos, len, flags, pagep, fsdata, | 313 | return block_write_begin_newtrunc(file, mapping, pos, len, flags, |
313 | blkdev_get_block); | 314 | pagep, fsdata, blkdev_get_block); |
314 | } | 315 | } |
315 | 316 | ||
316 | static int blkdev_write_end(struct file *file, struct address_space *mapping, | 317 | static int blkdev_write_end(struct file *file, struct address_space *mapping, |
@@ -358,12 +359,7 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin) | |||
358 | return retval; | 359 | return retval; |
359 | } | 360 | } |
360 | 361 | ||
361 | /* | 362 | int blkdev_fsync(struct file *filp, int datasync) |
362 | * Filp is never NULL; the only case when ->fsync() is called with | ||
363 | * NULL first argument is nfsd_sync_dir() and that's not a directory. | ||
364 | */ | ||
365 | |||
366 | int blkdev_fsync(struct file *filp, struct dentry *dentry, int datasync) | ||
367 | { | 363 | { |
368 | struct inode *bd_inode = filp->f_mapping->host; | 364 | struct inode *bd_inode = filp->f_mapping->host; |
369 | struct block_device *bdev = I_BDEV(bd_inode); | 365 | struct block_device *bdev = I_BDEV(bd_inode); |
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index e9bf86415e86..29c20092847e 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -2434,7 +2434,7 @@ void btrfs_update_iflags(struct inode *inode); | |||
2434 | void btrfs_inherit_iflags(struct inode *inode, struct inode *dir); | 2434 | void btrfs_inherit_iflags(struct inode *inode, struct inode *dir); |
2435 | 2435 | ||
2436 | /* file.c */ | 2436 | /* file.c */ |
2437 | int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync); | 2437 | int btrfs_sync_file(struct file *file, int datasync); |
2438 | int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, | 2438 | int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end, |
2439 | int skip_pinned); | 2439 | int skip_pinned); |
2440 | int btrfs_check_file(struct btrfs_root *root, struct inode *inode); | 2440 | int btrfs_check_file(struct btrfs_root *root, struct inode *inode); |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 79437c5eeb1e..787b50a16a14 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -1101,8 +1101,9 @@ int btrfs_release_file(struct inode *inode, struct file *filp) | |||
1101 | * important optimization for directories because holding the mutex prevents | 1101 | * important optimization for directories because holding the mutex prevents |
1102 | * new operations on the dir while we write to disk. | 1102 | * new operations on the dir while we write to disk. |
1103 | */ | 1103 | */ |
1104 | int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | 1104 | int btrfs_sync_file(struct file *file, int datasync) |
1105 | { | 1105 | { |
1106 | struct dentry *dentry = file->f_path.dentry; | ||
1106 | struct inode *inode = dentry->d_inode; | 1107 | struct inode *inode = dentry->d_inode; |
1107 | struct btrfs_root *root = BTRFS_I(inode)->root; | 1108 | struct btrfs_root *root = BTRFS_I(inode)->root; |
1108 | int ret = 0; | 1109 | int ret = 0; |
diff --git a/fs/buffer.c b/fs/buffer.c index e8aa7081d25c..d54812b198e9 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -1949,14 +1949,11 @@ static int __block_commit_write(struct inode *inode, struct page *page, | |||
1949 | } | 1949 | } |
1950 | 1950 | ||
1951 | /* | 1951 | /* |
1952 | * block_write_begin takes care of the basic task of block allocation and | 1952 | * Filesystems implementing the new truncate sequence should use the |
1953 | * bringing partial write blocks uptodate first. | 1953 | * _newtrunc postfix variant which won't incorrectly call vmtruncate. |
1954 | * | 1954 | * The filesystem needs to handle block truncation upon failure. |
1955 | * If *pagep is not NULL, then block_write_begin uses the locked page | ||
1956 | * at *pagep rather than allocating its own. In this case, the page will | ||
1957 | * not be unlocked or deallocated on failure. | ||
1958 | */ | 1955 | */ |
1959 | int block_write_begin(struct file *file, struct address_space *mapping, | 1956 | int block_write_begin_newtrunc(struct file *file, struct address_space *mapping, |
1960 | loff_t pos, unsigned len, unsigned flags, | 1957 | loff_t pos, unsigned len, unsigned flags, |
1961 | struct page **pagep, void **fsdata, | 1958 | struct page **pagep, void **fsdata, |
1962 | get_block_t *get_block) | 1959 | get_block_t *get_block) |
@@ -1992,20 +1989,50 @@ int block_write_begin(struct file *file, struct address_space *mapping, | |||
1992 | unlock_page(page); | 1989 | unlock_page(page); |
1993 | page_cache_release(page); | 1990 | page_cache_release(page); |
1994 | *pagep = NULL; | 1991 | *pagep = NULL; |
1995 | |||
1996 | /* | ||
1997 | * prepare_write() may have instantiated a few blocks | ||
1998 | * outside i_size. Trim these off again. Don't need | ||
1999 | * i_size_read because we hold i_mutex. | ||
2000 | */ | ||
2001 | if (pos + len > inode->i_size) | ||
2002 | vmtruncate(inode, inode->i_size); | ||
2003 | } | 1992 | } |
2004 | } | 1993 | } |
2005 | 1994 | ||
2006 | out: | 1995 | out: |
2007 | return status; | 1996 | return status; |
2008 | } | 1997 | } |
1998 | EXPORT_SYMBOL(block_write_begin_newtrunc); | ||
1999 | |||
2000 | /* | ||
2001 | * block_write_begin takes care of the basic task of block allocation and | ||
2002 | * bringing partial write blocks uptodate first. | ||
2003 | * | ||
2004 | * If *pagep is not NULL, then block_write_begin uses the locked page | ||
2005 | * at *pagep rather than allocating its own. In this case, the page will | ||
2006 | * not be unlocked or deallocated on failure. | ||
2007 | */ | ||
2008 | int block_write_begin(struct file *file, struct address_space *mapping, | ||
2009 | loff_t pos, unsigned len, unsigned flags, | ||
2010 | struct page **pagep, void **fsdata, | ||
2011 | get_block_t *get_block) | ||
2012 | { | ||
2013 | int ret; | ||
2014 | |||
2015 | ret = block_write_begin_newtrunc(file, mapping, pos, len, flags, | ||
2016 | pagep, fsdata, get_block); | ||
2017 | |||
2018 | /* | ||
2019 | * prepare_write() may have instantiated a few blocks | ||
2020 | * outside i_size. Trim these off again. Don't need | ||
2021 | * i_size_read because we hold i_mutex. | ||
2022 | * | ||
2023 | * Filesystems which pass down their own page also cannot | ||
2024 | * call into vmtruncate here because it would lead to lock | ||
2025 | * inversion problems (*pagep is locked). This is a further | ||
2026 | * example of where the old truncate sequence is inadequate. | ||
2027 | */ | ||
2028 | if (unlikely(ret) && *pagep == NULL) { | ||
2029 | loff_t isize = mapping->host->i_size; | ||
2030 | if (pos + len > isize) | ||
2031 | vmtruncate(mapping->host, isize); | ||
2032 | } | ||
2033 | |||
2034 | return ret; | ||
2035 | } | ||
2009 | EXPORT_SYMBOL(block_write_begin); | 2036 | EXPORT_SYMBOL(block_write_begin); |
2010 | 2037 | ||
2011 | int block_write_end(struct file *file, struct address_space *mapping, | 2038 | int block_write_end(struct file *file, struct address_space *mapping, |
@@ -2324,7 +2351,7 @@ out: | |||
2324 | * For moronic filesystems that do not allow holes in file. | 2351 | * For moronic filesystems that do not allow holes in file. |
2325 | * We may have to extend the file. | 2352 | * We may have to extend the file. |
2326 | */ | 2353 | */ |
2327 | int cont_write_begin(struct file *file, struct address_space *mapping, | 2354 | int cont_write_begin_newtrunc(struct file *file, struct address_space *mapping, |
2328 | loff_t pos, unsigned len, unsigned flags, | 2355 | loff_t pos, unsigned len, unsigned flags, |
2329 | struct page **pagep, void **fsdata, | 2356 | struct page **pagep, void **fsdata, |
2330 | get_block_t *get_block, loff_t *bytes) | 2357 | get_block_t *get_block, loff_t *bytes) |
@@ -2345,11 +2372,30 @@ int cont_write_begin(struct file *file, struct address_space *mapping, | |||
2345 | } | 2372 | } |
2346 | 2373 | ||
2347 | *pagep = NULL; | 2374 | *pagep = NULL; |
2348 | err = block_write_begin(file, mapping, pos, len, | 2375 | err = block_write_begin_newtrunc(file, mapping, pos, len, |
2349 | flags, pagep, fsdata, get_block); | 2376 | flags, pagep, fsdata, get_block); |
2350 | out: | 2377 | out: |
2351 | return err; | 2378 | return err; |
2352 | } | 2379 | } |
2380 | EXPORT_SYMBOL(cont_write_begin_newtrunc); | ||
2381 | |||
2382 | int cont_write_begin(struct file *file, struct address_space *mapping, | ||
2383 | loff_t pos, unsigned len, unsigned flags, | ||
2384 | struct page **pagep, void **fsdata, | ||
2385 | get_block_t *get_block, loff_t *bytes) | ||
2386 | { | ||
2387 | int ret; | ||
2388 | |||
2389 | ret = cont_write_begin_newtrunc(file, mapping, pos, len, flags, | ||
2390 | pagep, fsdata, get_block, bytes); | ||
2391 | if (unlikely(ret)) { | ||
2392 | loff_t isize = mapping->host->i_size; | ||
2393 | if (pos + len > isize) | ||
2394 | vmtruncate(mapping->host, isize); | ||
2395 | } | ||
2396 | |||
2397 | return ret; | ||
2398 | } | ||
2353 | EXPORT_SYMBOL(cont_write_begin); | 2399 | EXPORT_SYMBOL(cont_write_begin); |
2354 | 2400 | ||
2355 | int block_prepare_write(struct page *page, unsigned from, unsigned to, | 2401 | int block_prepare_write(struct page *page, unsigned from, unsigned to, |
@@ -2381,7 +2427,7 @@ EXPORT_SYMBOL(block_commit_write); | |||
2381 | * | 2427 | * |
2382 | * We are not allowed to take the i_mutex here so we have to play games to | 2428 | * We are not allowed to take the i_mutex here so we have to play games to |
2383 | * protect against truncate races as the page could now be beyond EOF. Because | 2429 | * protect against truncate races as the page could now be beyond EOF. Because |
2384 | * vmtruncate() writes the inode size before removing pages, once we have the | 2430 | * truncate writes the inode size before removing pages, once we have the |
2385 | * page lock we can determine safely if the page is beyond EOF. If it is not | 2431 | * page lock we can determine safely if the page is beyond EOF. If it is not |
2386 | * beyond EOF, then the page is guaranteed safe against truncation until we | 2432 | * beyond EOF, then the page is guaranteed safe against truncation until we |
2387 | * unlock the page. | 2433 | * unlock the page. |
@@ -2464,10 +2510,11 @@ static void attach_nobh_buffers(struct page *page, struct buffer_head *head) | |||
2464 | } | 2510 | } |
2465 | 2511 | ||
2466 | /* | 2512 | /* |
2467 | * On entry, the page is fully not uptodate. | 2513 | * Filesystems implementing the new truncate sequence should use the |
2468 | * On exit the page is fully uptodate in the areas outside (from,to) | 2514 | * _newtrunc postfix variant which won't incorrectly call vmtruncate. |
2515 | * The filesystem needs to handle block truncation upon failure. | ||
2469 | */ | 2516 | */ |
2470 | int nobh_write_begin(struct file *file, struct address_space *mapping, | 2517 | int nobh_write_begin_newtrunc(struct file *file, struct address_space *mapping, |
2471 | loff_t pos, unsigned len, unsigned flags, | 2518 | loff_t pos, unsigned len, unsigned flags, |
2472 | struct page **pagep, void **fsdata, | 2519 | struct page **pagep, void **fsdata, |
2473 | get_block_t *get_block) | 2520 | get_block_t *get_block) |
@@ -2500,8 +2547,8 @@ int nobh_write_begin(struct file *file, struct address_space *mapping, | |||
2500 | unlock_page(page); | 2547 | unlock_page(page); |
2501 | page_cache_release(page); | 2548 | page_cache_release(page); |
2502 | *pagep = NULL; | 2549 | *pagep = NULL; |
2503 | return block_write_begin(file, mapping, pos, len, flags, pagep, | 2550 | return block_write_begin_newtrunc(file, mapping, pos, len, |
2504 | fsdata, get_block); | 2551 | flags, pagep, fsdata, get_block); |
2505 | } | 2552 | } |
2506 | 2553 | ||
2507 | if (PageMappedToDisk(page)) | 2554 | if (PageMappedToDisk(page)) |
@@ -2605,8 +2652,34 @@ out_release: | |||
2605 | page_cache_release(page); | 2652 | page_cache_release(page); |
2606 | *pagep = NULL; | 2653 | *pagep = NULL; |
2607 | 2654 | ||
2608 | if (pos + len > inode->i_size) | 2655 | return ret; |
2609 | vmtruncate(inode, inode->i_size); | 2656 | } |
2657 | EXPORT_SYMBOL(nobh_write_begin_newtrunc); | ||
2658 | |||
2659 | /* | ||
2660 | * On entry, the page is fully not uptodate. | ||
2661 | * On exit the page is fully uptodate in the areas outside (from,to) | ||
2662 | */ | ||
2663 | int nobh_write_begin(struct file *file, struct address_space *mapping, | ||
2664 | loff_t pos, unsigned len, unsigned flags, | ||
2665 | struct page **pagep, void **fsdata, | ||
2666 | get_block_t *get_block) | ||
2667 | { | ||
2668 | int ret; | ||
2669 | |||
2670 | ret = nobh_write_begin_newtrunc(file, mapping, pos, len, flags, | ||
2671 | pagep, fsdata, get_block); | ||
2672 | |||
2673 | /* | ||
2674 | * prepare_write() may have instantiated a few blocks | ||
2675 | * outside i_size. Trim these off again. Don't need | ||
2676 | * i_size_read because we hold i_mutex. | ||
2677 | */ | ||
2678 | if (unlikely(ret)) { | ||
2679 | loff_t isize = mapping->host->i_size; | ||
2680 | if (pos + len > isize) | ||
2681 | vmtruncate(mapping->host, isize); | ||
2682 | } | ||
2610 | 2683 | ||
2611 | return ret; | 2684 | return ret; |
2612 | } | 2685 | } |
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index 0dd0b81e64f7..ae3e3a306445 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -1776,9 +1776,9 @@ out: | |||
1776 | spin_unlock(&ci->i_unsafe_lock); | 1776 | spin_unlock(&ci->i_unsafe_lock); |
1777 | } | 1777 | } |
1778 | 1778 | ||
1779 | int ceph_fsync(struct file *file, struct dentry *dentry, int datasync) | 1779 | int ceph_fsync(struct file *file, int datasync) |
1780 | { | 1780 | { |
1781 | struct inode *inode = dentry->d_inode; | 1781 | struct inode *inode = file->f_mapping->host; |
1782 | struct ceph_inode_info *ci = ceph_inode(inode); | 1782 | struct ceph_inode_info *ci = ceph_inode(inode); |
1783 | unsigned flush_tid; | 1783 | unsigned flush_tid; |
1784 | int ret; | 1784 | int ret; |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 4fd30900eff7..0057f4a07347 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -1107,10 +1107,9 @@ static ssize_t ceph_read_dir(struct file *file, char __user *buf, size_t size, | |||
1107 | * an fsync() on a dir will wait for any uncommitted directory | 1107 | * an fsync() on a dir will wait for any uncommitted directory |
1108 | * operations to commit. | 1108 | * operations to commit. |
1109 | */ | 1109 | */ |
1110 | static int ceph_dir_fsync(struct file *file, struct dentry *dentry, | 1110 | static int ceph_dir_fsync(struct file *file, int datasync) |
1111 | int datasync) | ||
1112 | { | 1111 | { |
1113 | struct inode *inode = dentry->d_inode; | 1112 | struct inode *inode = file->f_path.dentry->d_inode; |
1114 | struct ceph_inode_info *ci = ceph_inode(inode); | 1113 | struct ceph_inode_info *ci = ceph_inode(inode); |
1115 | struct list_head *head = &ci->i_unsafe_dirops; | 1114 | struct list_head *head = &ci->i_unsafe_dirops; |
1116 | struct ceph_mds_request *req; | 1115 | struct ceph_mds_request *req; |
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index 3725c9ee9d08..dd1e7add656b 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -811,7 +811,7 @@ extern void ceph_put_cap(struct ceph_cap *cap); | |||
811 | 811 | ||
812 | extern void ceph_queue_caps_release(struct inode *inode); | 812 | extern void ceph_queue_caps_release(struct inode *inode); |
813 | extern int ceph_write_inode(struct inode *inode, struct writeback_control *wbc); | 813 | extern int ceph_write_inode(struct inode *inode, struct writeback_control *wbc); |
814 | extern int ceph_fsync(struct file *file, struct dentry *dentry, int datasync); | 814 | extern int ceph_fsync(struct file *file, int datasync); |
815 | extern void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, | 815 | extern void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc, |
816 | struct ceph_mds_session *session); | 816 | struct ceph_mds_session *session); |
817 | extern int ceph_get_cap_mds(struct inode *inode); | 817 | extern int ceph_get_cap_mds(struct inode *inode); |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 0242ff9cbf41..a7eb65c84b1c 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -84,7 +84,7 @@ extern ssize_t cifs_user_read(struct file *file, char __user *read_data, | |||
84 | extern ssize_t cifs_user_write(struct file *file, const char __user *write_data, | 84 | extern ssize_t cifs_user_write(struct file *file, const char __user *write_data, |
85 | size_t write_size, loff_t *poffset); | 85 | size_t write_size, loff_t *poffset); |
86 | extern int cifs_lock(struct file *, int, struct file_lock *); | 86 | extern int cifs_lock(struct file *, int, struct file_lock *); |
87 | extern int cifs_fsync(struct file *, struct dentry *, int); | 87 | extern int cifs_fsync(struct file *, int); |
88 | extern int cifs_flush(struct file *, fl_owner_t id); | 88 | extern int cifs_flush(struct file *, fl_owner_t id); |
89 | extern int cifs_file_mmap(struct file * , struct vm_area_struct *); | 89 | extern int cifs_file_mmap(struct file * , struct vm_area_struct *); |
90 | extern const struct file_operations cifs_dir_ops; | 90 | extern const struct file_operations cifs_dir_ops; |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index a83541ec9713..f1ff785b2292 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -1676,7 +1676,7 @@ static int cifs_write_end(struct file *file, struct address_space *mapping, | |||
1676 | return rc; | 1676 | return rc; |
1677 | } | 1677 | } |
1678 | 1678 | ||
1679 | int cifs_fsync(struct file *file, struct dentry *dentry, int datasync) | 1679 | int cifs_fsync(struct file *file, int datasync) |
1680 | { | 1680 | { |
1681 | int xid; | 1681 | int xid; |
1682 | int rc = 0; | 1682 | int rc = 0; |
@@ -1688,7 +1688,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync) | |||
1688 | xid = GetXid(); | 1688 | xid = GetXid(); |
1689 | 1689 | ||
1690 | cFYI(1, "Sync file - name: %s datasync: 0x%x", | 1690 | cFYI(1, "Sync file - name: %s datasync: 0x%x", |
1691 | dentry->d_name.name, datasync); | 1691 | file->f_path.dentry->d_name.name, datasync); |
1692 | 1692 | ||
1693 | rc = filemap_write_and_wait(inode->i_mapping); | 1693 | rc = filemap_write_and_wait(inode->i_mapping); |
1694 | if (rc == 0) { | 1694 | if (rc == 0) { |
diff --git a/fs/coda/coda_int.h b/fs/coda/coda_int.h index d99860a33890..6b443ff43a19 100644 --- a/fs/coda/coda_int.h +++ b/fs/coda/coda_int.h | |||
@@ -11,8 +11,7 @@ extern int coda_fake_statfs; | |||
11 | 11 | ||
12 | void coda_destroy_inodecache(void); | 12 | void coda_destroy_inodecache(void); |
13 | int coda_init_inodecache(void); | 13 | int coda_init_inodecache(void); |
14 | int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, | 14 | int coda_fsync(struct file *coda_file, int datasync); |
15 | int datasync); | ||
16 | void coda_sysctl_init(void); | 15 | void coda_sysctl_init(void); |
17 | void coda_sysctl_clean(void); | 16 | void coda_sysctl_clean(void); |
18 | 17 | ||
diff --git a/fs/coda/file.c b/fs/coda/file.c index 7196077b1688..ad3cd2abeeb4 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c | |||
@@ -202,10 +202,10 @@ int coda_release(struct inode *coda_inode, struct file *coda_file) | |||
202 | return 0; | 202 | return 0; |
203 | } | 203 | } |
204 | 204 | ||
205 | int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync) | 205 | int coda_fsync(struct file *coda_file, int datasync) |
206 | { | 206 | { |
207 | struct file *host_file; | 207 | struct file *host_file; |
208 | struct inode *coda_inode = coda_dentry->d_inode; | 208 | struct inode *coda_inode = coda_file->f_path.dentry->d_inode; |
209 | struct coda_file_info *cfi; | 209 | struct coda_file_info *cfi; |
210 | int err = 0; | 210 | int err = 0; |
211 | 211 | ||
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index c8af2d91174b..41645142b88b 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c | |||
@@ -72,16 +72,11 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr) | |||
72 | if (!sd) | 72 | if (!sd) |
73 | return -EINVAL; | 73 | return -EINVAL; |
74 | 74 | ||
75 | sd_iattr = sd->s_iattr; | 75 | error = simple_setattr(dentry, iattr); |
76 | |||
77 | error = inode_change_ok(inode, iattr); | ||
78 | if (error) | ||
79 | return error; | ||
80 | |||
81 | error = inode_setattr(inode, iattr); | ||
82 | if (error) | 76 | if (error) |
83 | return error; | 77 | return error; |
84 | 78 | ||
79 | sd_iattr = sd->s_iattr; | ||
85 | if (!sd_iattr) { | 80 | if (!sd_iattr) { |
86 | /* setting attributes for the first time, allocate now */ | 81 | /* setting attributes for the first time, allocate now */ |
87 | sd_iattr = kzalloc(sizeof(struct iattr), GFP_KERNEL); | 82 | sd_iattr = kzalloc(sizeof(struct iattr), GFP_KERNEL); |
diff --git a/fs/direct-io.c b/fs/direct-io.c index da111aacb46e..7600aacf531d 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -1134,27 +1134,8 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode, | |||
1134 | return ret; | 1134 | return ret; |
1135 | } | 1135 | } |
1136 | 1136 | ||
1137 | /* | ||
1138 | * This is a library function for use by filesystem drivers. | ||
1139 | * | ||
1140 | * The locking rules are governed by the flags parameter: | ||
1141 | * - if the flags value contains DIO_LOCKING we use a fancy locking | ||
1142 | * scheme for dumb filesystems. | ||
1143 | * For writes this function is called under i_mutex and returns with | ||
1144 | * i_mutex held, for reads, i_mutex is not held on entry, but it is | ||
1145 | * taken and dropped again before returning. | ||
1146 | * For reads and writes i_alloc_sem is taken in shared mode and released | ||
1147 | * on I/O completion (which may happen asynchronously after returning to | ||
1148 | * the caller). | ||
1149 | * | ||
1150 | * - if the flags value does NOT contain DIO_LOCKING we don't use any | ||
1151 | * internal locking but rather rely on the filesystem to synchronize | ||
1152 | * direct I/O reads/writes versus each other and truncate. | ||
1153 | * For reads and writes both i_mutex and i_alloc_sem are not held on | ||
1154 | * entry and are never taken. | ||
1155 | */ | ||
1156 | ssize_t | 1137 | ssize_t |
1157 | __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | 1138 | __blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb, struct inode *inode, |
1158 | struct block_device *bdev, const struct iovec *iov, loff_t offset, | 1139 | struct block_device *bdev, const struct iovec *iov, loff_t offset, |
1159 | unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, | 1140 | unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, |
1160 | dio_submit_t submit_io, int flags) | 1141 | dio_submit_t submit_io, int flags) |
@@ -1247,9 +1228,46 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1247 | nr_segs, blkbits, get_block, end_io, | 1228 | nr_segs, blkbits, get_block, end_io, |
1248 | submit_io, dio); | 1229 | submit_io, dio); |
1249 | 1230 | ||
1231 | out: | ||
1232 | return retval; | ||
1233 | } | ||
1234 | EXPORT_SYMBOL(__blockdev_direct_IO_newtrunc); | ||
1235 | |||
1236 | /* | ||
1237 | * This is a library function for use by filesystem drivers. | ||
1238 | * | ||
1239 | * The locking rules are governed by the flags parameter: | ||
1240 | * - if the flags value contains DIO_LOCKING we use a fancy locking | ||
1241 | * scheme for dumb filesystems. | ||
1242 | * For writes this function is called under i_mutex and returns with | ||
1243 | * i_mutex held, for reads, i_mutex is not held on entry, but it is | ||
1244 | * taken and dropped again before returning. | ||
1245 | * For reads and writes i_alloc_sem is taken in shared mode and released | ||
1246 | * on I/O completion (which may happen asynchronously after returning to | ||
1247 | * the caller). | ||
1248 | * | ||
1249 | * - if the flags value does NOT contain DIO_LOCKING we don't use any | ||
1250 | * internal locking but rather rely on the filesystem to synchronize | ||
1251 | * direct I/O reads/writes versus each other and truncate. | ||
1252 | * For reads and writes both i_mutex and i_alloc_sem are not held on | ||
1253 | * entry and are never taken. | ||
1254 | */ | ||
1255 | ssize_t | ||
1256 | __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | ||
1257 | struct block_device *bdev, const struct iovec *iov, loff_t offset, | ||
1258 | unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, | ||
1259 | dio_submit_t submit_io, int flags) | ||
1260 | { | ||
1261 | ssize_t retval; | ||
1262 | |||
1263 | retval = __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, | ||
1264 | offset, nr_segs, get_block, end_io, submit_io, flags); | ||
1250 | /* | 1265 | /* |
1251 | * In case of error extending write may have instantiated a few | 1266 | * In case of error extending write may have instantiated a few |
1252 | * blocks outside i_size. Trim these off again for DIO_LOCKING. | 1267 | * blocks outside i_size. Trim these off again for DIO_LOCKING. |
1268 | * NOTE: DIO_NO_LOCK/DIO_OWN_LOCK callers have to handle this in | ||
1269 | * their own manner. This is a further example of where the old | ||
1270 | * truncate sequence is inadequate. | ||
1253 | * | 1271 | * |
1254 | * NOTE: filesystems with their own locking have to handle this | 1272 | * NOTE: filesystems with their own locking have to handle this |
1255 | * on their own. | 1273 | * on their own. |
@@ -1257,12 +1275,13 @@ __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
1257 | if (flags & DIO_LOCKING) { | 1275 | if (flags & DIO_LOCKING) { |
1258 | if (unlikely((rw & WRITE) && retval < 0)) { | 1276 | if (unlikely((rw & WRITE) && retval < 0)) { |
1259 | loff_t isize = i_size_read(inode); | 1277 | loff_t isize = i_size_read(inode); |
1278 | loff_t end = offset + iov_length(iov, nr_segs); | ||
1279 | |||
1260 | if (end > isize) | 1280 | if (end > isize) |
1261 | vmtruncate(inode, isize); | 1281 | vmtruncate(inode, isize); |
1262 | } | 1282 | } |
1263 | } | 1283 | } |
1264 | 1284 | ||
1265 | out: | ||
1266 | return retval; | 1285 | return retval; |
1267 | } | 1286 | } |
1268 | EXPORT_SYMBOL(__blockdev_direct_IO); | 1287 | EXPORT_SYMBOL(__blockdev_direct_IO); |
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index 3bdddbcc785f..e8fcf4e2ed7d 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
@@ -274,7 +274,7 @@ static int ecryptfs_release(struct inode *inode, struct file *file) | |||
274 | } | 274 | } |
275 | 275 | ||
276 | static int | 276 | static int |
277 | ecryptfs_fsync(struct file *file, struct dentry *dentry, int datasync) | 277 | ecryptfs_fsync(struct file *file, int datasync) |
278 | { | 278 | { |
279 | return vfs_fsync(ecryptfs_file_to_lower(file), datasync); | 279 | return vfs_fsync(ecryptfs_file_to_lower(file), datasync); |
280 | } | 280 | } |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 65dee2f336ae..31ef5252f0fe 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -805,7 +805,7 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia, | |||
805 | - (ia->ia_size & ~PAGE_CACHE_MASK)); | 805 | - (ia->ia_size & ~PAGE_CACHE_MASK)); |
806 | 806 | ||
807 | if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) { | 807 | if (!(crypt_stat->flags & ECRYPTFS_ENCRYPTED)) { |
808 | rc = vmtruncate(inode, ia->ia_size); | 808 | rc = simple_setsize(inode, ia->ia_size); |
809 | if (rc) | 809 | if (rc) |
810 | goto out; | 810 | goto out; |
811 | lower_ia->ia_size = ia->ia_size; | 811 | lower_ia->ia_size = ia->ia_size; |
@@ -830,7 +830,7 @@ static int truncate_upper(struct dentry *dentry, struct iattr *ia, | |||
830 | goto out; | 830 | goto out; |
831 | } | 831 | } |
832 | } | 832 | } |
833 | vmtruncate(inode, ia->ia_size); | 833 | simple_setsize(inode, ia->ia_size); |
834 | rc = ecryptfs_write_inode_size_to_metadata(inode); | 834 | rc = ecryptfs_write_inode_size_to_metadata(inode); |
835 | if (rc) { | 835 | if (rc) { |
836 | printk(KERN_ERR "Problem with " | 836 | printk(KERN_ERR "Problem with " |
diff --git a/fs/exofs/file.c b/fs/exofs/file.c index 839b9dc1e70f..fef6899be397 100644 --- a/fs/exofs/file.c +++ b/fs/exofs/file.c | |||
@@ -40,12 +40,11 @@ static int exofs_release_file(struct inode *inode, struct file *filp) | |||
40 | return 0; | 40 | return 0; |
41 | } | 41 | } |
42 | 42 | ||
43 | static int exofs_file_fsync(struct file *filp, struct dentry *dentry, | 43 | static int exofs_file_fsync(struct file *filp, int datasync) |
44 | int datasync) | ||
45 | { | 44 | { |
46 | int ret; | 45 | int ret; |
47 | struct address_space *mapping = filp->f_mapping; | 46 | struct address_space *mapping = filp->f_mapping; |
48 | struct inode *inode = dentry->d_inode; | 47 | struct inode *inode = mapping->host; |
49 | struct super_block *sb; | 48 | struct super_block *sb; |
50 | 49 | ||
51 | ret = filemap_write_and_wait(mapping); | 50 | ret = filemap_write_and_wait(mapping); |
@@ -66,7 +65,7 @@ static int exofs_file_fsync(struct file *filp, struct dentry *dentry, | |||
66 | 65 | ||
67 | static int exofs_flush(struct file *file, fl_owner_t id) | 66 | static int exofs_flush(struct file *file, fl_owner_t id) |
68 | { | 67 | { |
69 | exofs_file_fsync(file, file->f_path.dentry, 1); | 68 | exofs_file_fsync(file, 1); |
70 | /* TODO: Flush the OSD target */ | 69 | /* TODO: Flush the OSD target */ |
71 | return 0; | 70 | return 0; |
72 | } | 71 | } |
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h index 0b038e47ad2f..52b34f1d2738 100644 --- a/fs/ext2/ext2.h +++ b/fs/ext2/ext2.h | |||
@@ -122,7 +122,6 @@ extern int ext2_write_inode (struct inode *, struct writeback_control *); | |||
122 | extern void ext2_delete_inode (struct inode *); | 122 | extern void ext2_delete_inode (struct inode *); |
123 | extern int ext2_sync_inode (struct inode *); | 123 | extern int ext2_sync_inode (struct inode *); |
124 | extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int); | 124 | extern int ext2_get_block(struct inode *, sector_t, struct buffer_head *, int); |
125 | extern void ext2_truncate (struct inode *); | ||
126 | extern int ext2_setattr (struct dentry *, struct iattr *); | 125 | extern int ext2_setattr (struct dentry *, struct iattr *); |
127 | extern void ext2_set_inode_flags(struct inode *inode); | 126 | extern void ext2_set_inode_flags(struct inode *inode); |
128 | extern void ext2_get_inode_flags(struct ext2_inode_info *); | 127 | extern void ext2_get_inode_flags(struct ext2_inode_info *); |
@@ -155,7 +154,7 @@ extern void ext2_write_super (struct super_block *); | |||
155 | extern const struct file_operations ext2_dir_operations; | 154 | extern const struct file_operations ext2_dir_operations; |
156 | 155 | ||
157 | /* file.c */ | 156 | /* file.c */ |
158 | extern int ext2_fsync(struct file *file, struct dentry *dentry, int datasync); | 157 | extern int ext2_fsync(struct file *file, int datasync); |
159 | extern const struct inode_operations ext2_file_inode_operations; | 158 | extern const struct inode_operations ext2_file_inode_operations; |
160 | extern const struct file_operations ext2_file_operations; | 159 | extern const struct file_operations ext2_file_operations; |
161 | extern const struct file_operations ext2_xip_file_operations; | 160 | extern const struct file_operations ext2_xip_file_operations; |
diff --git a/fs/ext2/file.c b/fs/ext2/file.c index 5d198d0697fb..49eec9456c5b 100644 --- a/fs/ext2/file.c +++ b/fs/ext2/file.c | |||
@@ -40,13 +40,13 @@ static int ext2_release_file (struct inode * inode, struct file * filp) | |||
40 | return 0; | 40 | return 0; |
41 | } | 41 | } |
42 | 42 | ||
43 | int ext2_fsync(struct file *file, struct dentry *dentry, int datasync) | 43 | int ext2_fsync(struct file *file, int datasync) |
44 | { | 44 | { |
45 | int ret; | 45 | int ret; |
46 | struct super_block *sb = dentry->d_inode->i_sb; | 46 | struct super_block *sb = file->f_mapping->host->i_sb; |
47 | struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping; | 47 | struct address_space *mapping = sb->s_bdev->bd_inode->i_mapping; |
48 | 48 | ||
49 | ret = simple_fsync(file, dentry, datasync); | 49 | ret = generic_file_fsync(file, datasync); |
50 | if (ret == -EIO || test_and_clear_bit(AS_EIO, &mapping->flags)) { | 50 | if (ret == -EIO || test_and_clear_bit(AS_EIO, &mapping->flags)) { |
51 | /* We don't really know where the IO error happened... */ | 51 | /* We don't really know where the IO error happened... */ |
52 | ext2_error(sb, __func__, | 52 | ext2_error(sb, __func__, |
@@ -95,7 +95,6 @@ const struct file_operations ext2_xip_file_operations = { | |||
95 | #endif | 95 | #endif |
96 | 96 | ||
97 | const struct inode_operations ext2_file_inode_operations = { | 97 | const struct inode_operations ext2_file_inode_operations = { |
98 | .truncate = ext2_truncate, | ||
99 | #ifdef CONFIG_EXT2_FS_XATTR | 98 | #ifdef CONFIG_EXT2_FS_XATTR |
100 | .setxattr = generic_setxattr, | 99 | .setxattr = generic_setxattr, |
101 | .getxattr = generic_getxattr, | 100 | .getxattr = generic_getxattr, |
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c index 527c46d9bc1f..19214435b752 100644 --- a/fs/ext2/inode.c +++ b/fs/ext2/inode.c | |||
@@ -54,6 +54,18 @@ static inline int ext2_inode_is_fast_symlink(struct inode *inode) | |||
54 | inode->i_blocks - ea_blocks == 0); | 54 | inode->i_blocks - ea_blocks == 0); |
55 | } | 55 | } |
56 | 56 | ||
57 | static void ext2_truncate_blocks(struct inode *inode, loff_t offset); | ||
58 | |||
59 | static void ext2_write_failed(struct address_space *mapping, loff_t to) | ||
60 | { | ||
61 | struct inode *inode = mapping->host; | ||
62 | |||
63 | if (to > inode->i_size) { | ||
64 | truncate_pagecache(inode, to, inode->i_size); | ||
65 | ext2_truncate_blocks(inode, inode->i_size); | ||
66 | } | ||
67 | } | ||
68 | |||
57 | /* | 69 | /* |
58 | * Called at the last iput() if i_nlink is zero. | 70 | * Called at the last iput() if i_nlink is zero. |
59 | */ | 71 | */ |
@@ -71,7 +83,7 @@ void ext2_delete_inode (struct inode * inode) | |||
71 | 83 | ||
72 | inode->i_size = 0; | 84 | inode->i_size = 0; |
73 | if (inode->i_blocks) | 85 | if (inode->i_blocks) |
74 | ext2_truncate (inode); | 86 | ext2_truncate_blocks(inode, 0); |
75 | ext2_free_inode (inode); | 87 | ext2_free_inode (inode); |
76 | 88 | ||
77 | return; | 89 | return; |
@@ -757,8 +769,8 @@ int __ext2_write_begin(struct file *file, struct address_space *mapping, | |||
757 | loff_t pos, unsigned len, unsigned flags, | 769 | loff_t pos, unsigned len, unsigned flags, |
758 | struct page **pagep, void **fsdata) | 770 | struct page **pagep, void **fsdata) |
759 | { | 771 | { |
760 | return block_write_begin(file, mapping, pos, len, flags, pagep, fsdata, | 772 | return block_write_begin_newtrunc(file, mapping, pos, len, flags, |
761 | ext2_get_block); | 773 | pagep, fsdata, ext2_get_block); |
762 | } | 774 | } |
763 | 775 | ||
764 | static int | 776 | static int |
@@ -766,8 +778,25 @@ ext2_write_begin(struct file *file, struct address_space *mapping, | |||
766 | loff_t pos, unsigned len, unsigned flags, | 778 | loff_t pos, unsigned len, unsigned flags, |
767 | struct page **pagep, void **fsdata) | 779 | struct page **pagep, void **fsdata) |
768 | { | 780 | { |
781 | int ret; | ||
782 | |||
769 | *pagep = NULL; | 783 | *pagep = NULL; |
770 | return __ext2_write_begin(file, mapping, pos, len, flags, pagep,fsdata); | 784 | ret = __ext2_write_begin(file, mapping, pos, len, flags, pagep, fsdata); |
785 | if (ret < 0) | ||
786 | ext2_write_failed(mapping, pos + len); | ||
787 | return ret; | ||
788 | } | ||
789 | |||
790 | static int ext2_write_end(struct file *file, struct address_space *mapping, | ||
791 | loff_t pos, unsigned len, unsigned copied, | ||
792 | struct page *page, void *fsdata) | ||
793 | { | ||
794 | int ret; | ||
795 | |||
796 | ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata); | ||
797 | if (ret < len) | ||
798 | ext2_write_failed(mapping, pos + len); | ||
799 | return ret; | ||
771 | } | 800 | } |
772 | 801 | ||
773 | static int | 802 | static int |
@@ -775,13 +804,18 @@ ext2_nobh_write_begin(struct file *file, struct address_space *mapping, | |||
775 | loff_t pos, unsigned len, unsigned flags, | 804 | loff_t pos, unsigned len, unsigned flags, |
776 | struct page **pagep, void **fsdata) | 805 | struct page **pagep, void **fsdata) |
777 | { | 806 | { |
807 | int ret; | ||
808 | |||
778 | /* | 809 | /* |
779 | * Dir-in-pagecache still uses ext2_write_begin. Would have to rework | 810 | * Dir-in-pagecache still uses ext2_write_begin. Would have to rework |
780 | * directory handling code to pass around offsets rather than struct | 811 | * directory handling code to pass around offsets rather than struct |
781 | * pages in order to make this work easily. | 812 | * pages in order to make this work easily. |
782 | */ | 813 | */ |
783 | return nobh_write_begin(file, mapping, pos, len, flags, pagep, fsdata, | 814 | ret = nobh_write_begin_newtrunc(file, mapping, pos, len, flags, pagep, |
784 | ext2_get_block); | 815 | fsdata, ext2_get_block); |
816 | if (ret < 0) | ||
817 | ext2_write_failed(mapping, pos + len); | ||
818 | return ret; | ||
785 | } | 819 | } |
786 | 820 | ||
787 | static int ext2_nobh_writepage(struct page *page, | 821 | static int ext2_nobh_writepage(struct page *page, |
@@ -800,10 +834,15 @@ ext2_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | |||
800 | loff_t offset, unsigned long nr_segs) | 834 | loff_t offset, unsigned long nr_segs) |
801 | { | 835 | { |
802 | struct file *file = iocb->ki_filp; | 836 | struct file *file = iocb->ki_filp; |
803 | struct inode *inode = file->f_mapping->host; | 837 | struct address_space *mapping = file->f_mapping; |
804 | 838 | struct inode *inode = mapping->host; | |
805 | return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, | 839 | ssize_t ret; |
806 | offset, nr_segs, ext2_get_block, NULL); | 840 | |
841 | ret = blockdev_direct_IO_newtrunc(rw, iocb, inode, inode->i_sb->s_bdev, | ||
842 | iov, offset, nr_segs, ext2_get_block, NULL); | ||
843 | if (ret < 0 && (rw & WRITE)) | ||
844 | ext2_write_failed(mapping, offset + iov_length(iov, nr_segs)); | ||
845 | return ret; | ||
807 | } | 846 | } |
808 | 847 | ||
809 | static int | 848 | static int |
@@ -818,7 +857,7 @@ const struct address_space_operations ext2_aops = { | |||
818 | .writepage = ext2_writepage, | 857 | .writepage = ext2_writepage, |
819 | .sync_page = block_sync_page, | 858 | .sync_page = block_sync_page, |
820 | .write_begin = ext2_write_begin, | 859 | .write_begin = ext2_write_begin, |
821 | .write_end = generic_write_end, | 860 | .write_end = ext2_write_end, |
822 | .bmap = ext2_bmap, | 861 | .bmap = ext2_bmap, |
823 | .direct_IO = ext2_direct_IO, | 862 | .direct_IO = ext2_direct_IO, |
824 | .writepages = ext2_writepages, | 863 | .writepages = ext2_writepages, |
@@ -1027,7 +1066,7 @@ static void ext2_free_branches(struct inode *inode, __le32 *p, __le32 *q, int de | |||
1027 | ext2_free_data(inode, p, q); | 1066 | ext2_free_data(inode, p, q); |
1028 | } | 1067 | } |
1029 | 1068 | ||
1030 | void ext2_truncate(struct inode *inode) | 1069 | static void __ext2_truncate_blocks(struct inode *inode, loff_t offset) |
1031 | { | 1070 | { |
1032 | __le32 *i_data = EXT2_I(inode)->i_data; | 1071 | __le32 *i_data = EXT2_I(inode)->i_data; |
1033 | struct ext2_inode_info *ei = EXT2_I(inode); | 1072 | struct ext2_inode_info *ei = EXT2_I(inode); |
@@ -1039,27 +1078,8 @@ void ext2_truncate(struct inode *inode) | |||
1039 | int n; | 1078 | int n; |
1040 | long iblock; | 1079 | long iblock; |
1041 | unsigned blocksize; | 1080 | unsigned blocksize; |
1042 | |||
1043 | if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || | ||
1044 | S_ISLNK(inode->i_mode))) | ||
1045 | return; | ||
1046 | if (ext2_inode_is_fast_symlink(inode)) | ||
1047 | return; | ||
1048 | if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) | ||
1049 | return; | ||
1050 | |||
1051 | blocksize = inode->i_sb->s_blocksize; | 1081 | blocksize = inode->i_sb->s_blocksize; |
1052 | iblock = (inode->i_size + blocksize-1) | 1082 | iblock = (offset + blocksize-1) >> EXT2_BLOCK_SIZE_BITS(inode->i_sb); |
1053 | >> EXT2_BLOCK_SIZE_BITS(inode->i_sb); | ||
1054 | |||
1055 | if (mapping_is_xip(inode->i_mapping)) | ||
1056 | xip_truncate_page(inode->i_mapping, inode->i_size); | ||
1057 | else if (test_opt(inode->i_sb, NOBH)) | ||
1058 | nobh_truncate_page(inode->i_mapping, | ||
1059 | inode->i_size, ext2_get_block); | ||
1060 | else | ||
1061 | block_truncate_page(inode->i_mapping, | ||
1062 | inode->i_size, ext2_get_block); | ||
1063 | 1083 | ||
1064 | n = ext2_block_to_path(inode, iblock, offsets, NULL); | 1084 | n = ext2_block_to_path(inode, iblock, offsets, NULL); |
1065 | if (n == 0) | 1085 | if (n == 0) |
@@ -1127,6 +1147,62 @@ do_indirects: | |||
1127 | ext2_discard_reservation(inode); | 1147 | ext2_discard_reservation(inode); |
1128 | 1148 | ||
1129 | mutex_unlock(&ei->truncate_mutex); | 1149 | mutex_unlock(&ei->truncate_mutex); |
1150 | } | ||
1151 | |||
1152 | static void ext2_truncate_blocks(struct inode *inode, loff_t offset) | ||
1153 | { | ||
1154 | /* | ||
1155 | * XXX: it seems like a bug here that we don't allow | ||
1156 | * IS_APPEND inode to have blocks-past-i_size trimmed off. | ||
1157 | * review and fix this. | ||
1158 | * | ||
1159 | * Also would be nice to be able to handle IO errors and such, | ||
1160 | * but that's probably too much to ask. | ||
1161 | */ | ||
1162 | if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || | ||
1163 | S_ISLNK(inode->i_mode))) | ||
1164 | return; | ||
1165 | if (ext2_inode_is_fast_symlink(inode)) | ||
1166 | return; | ||
1167 | if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) | ||
1168 | return; | ||
1169 | __ext2_truncate_blocks(inode, offset); | ||
1170 | } | ||
1171 | |||
1172 | int ext2_setsize(struct inode *inode, loff_t newsize) | ||
1173 | { | ||
1174 | loff_t oldsize; | ||
1175 | int error; | ||
1176 | |||
1177 | error = inode_newsize_ok(inode, newsize); | ||
1178 | if (error) | ||
1179 | return error; | ||
1180 | |||
1181 | if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || | ||
1182 | S_ISLNK(inode->i_mode))) | ||
1183 | return -EINVAL; | ||
1184 | if (ext2_inode_is_fast_symlink(inode)) | ||
1185 | return -EINVAL; | ||
1186 | if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) | ||
1187 | return -EPERM; | ||
1188 | |||
1189 | if (mapping_is_xip(inode->i_mapping)) | ||
1190 | error = xip_truncate_page(inode->i_mapping, newsize); | ||
1191 | else if (test_opt(inode->i_sb, NOBH)) | ||
1192 | error = nobh_truncate_page(inode->i_mapping, | ||
1193 | newsize, ext2_get_block); | ||
1194 | else | ||
1195 | error = block_truncate_page(inode->i_mapping, | ||
1196 | newsize, ext2_get_block); | ||
1197 | if (error) | ||
1198 | return error; | ||
1199 | |||
1200 | oldsize = inode->i_size; | ||
1201 | i_size_write(inode, newsize); | ||
1202 | truncate_pagecache(inode, oldsize, newsize); | ||
1203 | |||
1204 | __ext2_truncate_blocks(inode, newsize); | ||
1205 | |||
1130 | inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; | 1206 | inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; |
1131 | if (inode_needs_sync(inode)) { | 1207 | if (inode_needs_sync(inode)) { |
1132 | sync_mapping_buffers(inode->i_mapping); | 1208 | sync_mapping_buffers(inode->i_mapping); |
@@ -1134,6 +1210,8 @@ do_indirects: | |||
1134 | } else { | 1210 | } else { |
1135 | mark_inode_dirty(inode); | 1211 | mark_inode_dirty(inode); |
1136 | } | 1212 | } |
1213 | |||
1214 | return 0; | ||
1137 | } | 1215 | } |
1138 | 1216 | ||
1139 | static struct ext2_inode *ext2_get_inode(struct super_block *sb, ino_t ino, | 1217 | static struct ext2_inode *ext2_get_inode(struct super_block *sb, ino_t ino, |
@@ -1474,8 +1552,15 @@ int ext2_setattr(struct dentry *dentry, struct iattr *iattr) | |||
1474 | if (error) | 1552 | if (error) |
1475 | return error; | 1553 | return error; |
1476 | } | 1554 | } |
1477 | error = inode_setattr(inode, iattr); | 1555 | if (iattr->ia_valid & ATTR_SIZE) { |
1478 | if (!error && (iattr->ia_valid & ATTR_MODE)) | 1556 | error = ext2_setsize(inode, iattr->ia_size); |
1557 | if (error) | ||
1558 | return error; | ||
1559 | } | ||
1560 | generic_setattr(inode, iattr); | ||
1561 | if (iattr->ia_valid & ATTR_MODE) | ||
1479 | error = ext2_acl_chmod(inode); | 1562 | error = ext2_acl_chmod(inode); |
1563 | mark_inode_dirty(inode); | ||
1564 | |||
1480 | return error; | 1565 | return error; |
1481 | } | 1566 | } |
diff --git a/fs/ext3/fsync.c b/fs/ext3/fsync.c index fcf7487734b6..d7e9f74dc3a6 100644 --- a/fs/ext3/fsync.c +++ b/fs/ext3/fsync.c | |||
@@ -43,9 +43,9 @@ | |||
43 | * inode to disk. | 43 | * inode to disk. |
44 | */ | 44 | */ |
45 | 45 | ||
46 | int ext3_sync_file(struct file * file, struct dentry *dentry, int datasync) | 46 | int ext3_sync_file(struct file *file, int datasync) |
47 | { | 47 | { |
48 | struct inode *inode = dentry->d_inode; | 48 | struct inode *inode = file->f_mapping->host; |
49 | struct ext3_inode_info *ei = EXT3_I(inode); | 49 | struct ext3_inode_info *ei = EXT3_I(inode); |
50 | journal_t *journal = EXT3_SB(inode->i_sb)->s_journal; | 50 | journal_t *journal = EXT3_SB(inode->i_sb)->s_journal; |
51 | int ret, needs_barrier = 0; | 51 | int ret, needs_barrier = 0; |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 60bd31026e7c..19a4de57128a 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -1519,7 +1519,7 @@ extern int ext4_htree_store_dirent(struct file *dir_file, __u32 hash, | |||
1519 | extern void ext4_htree_free_dir_info(struct dir_private_info *p); | 1519 | extern void ext4_htree_free_dir_info(struct dir_private_info *p); |
1520 | 1520 | ||
1521 | /* fsync.c */ | 1521 | /* fsync.c */ |
1522 | extern int ext4_sync_file(struct file *, struct dentry *, int); | 1522 | extern int ext4_sync_file(struct file *, int); |
1523 | 1523 | ||
1524 | /* hash.c */ | 1524 | /* hash.c */ |
1525 | extern int ext4fs_dirhash(const char *name, int len, struct | 1525 | extern int ext4fs_dirhash(const char *name, int len, struct |
diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c index b6a74f991bf4..592adf2e546e 100644 --- a/fs/ext4/fsync.c +++ b/fs/ext4/fsync.c | |||
@@ -71,9 +71,9 @@ static void ext4_sync_parent(struct inode *inode) | |||
71 | * i_mutex lock is held when entering and exiting this function | 71 | * i_mutex lock is held when entering and exiting this function |
72 | */ | 72 | */ |
73 | 73 | ||
74 | int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync) | 74 | int ext4_sync_file(struct file *file, int datasync) |
75 | { | 75 | { |
76 | struct inode *inode = dentry->d_inode; | 76 | struct inode *inode = file->f_mapping->host; |
77 | struct ext4_inode_info *ei = EXT4_I(inode); | 77 | struct ext4_inode_info *ei = EXT4_I(inode); |
78 | journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; | 78 | journal_t *journal = EXT4_SB(inode->i_sb)->s_journal; |
79 | int ret; | 79 | int ret; |
@@ -81,7 +81,7 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
81 | 81 | ||
82 | J_ASSERT(ext4_journal_current_handle() == NULL); | 82 | J_ASSERT(ext4_journal_current_handle() == NULL); |
83 | 83 | ||
84 | trace_ext4_sync_file(file, dentry, datasync); | 84 | trace_ext4_sync_file(file, datasync); |
85 | 85 | ||
86 | if (inode->i_sb->s_flags & MS_RDONLY) | 86 | if (inode->i_sb->s_flags & MS_RDONLY) |
87 | return 0; | 87 | return 0; |
@@ -91,7 +91,7 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
91 | return ret; | 91 | return ret; |
92 | 92 | ||
93 | if (!journal) { | 93 | if (!journal) { |
94 | ret = simple_fsync(file, dentry, datasync); | 94 | ret = generic_file_fsync(file, datasync); |
95 | if (!ret && !list_empty(&inode->i_dentry)) | 95 | if (!ret && !list_empty(&inode->i_dentry)) |
96 | ext4_sync_parent(inode); | 96 | ext4_sync_parent(inode); |
97 | return ret; | 97 | return ret; |
diff --git a/fs/fat/fat.h b/fs/fat/fat.h index 53dba57b49a1..27ac25725954 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h | |||
@@ -306,11 +306,11 @@ extern long fat_generic_ioctl(struct file *filp, unsigned int cmd, | |||
306 | extern const struct file_operations fat_file_operations; | 306 | extern const struct file_operations fat_file_operations; |
307 | extern const struct inode_operations fat_file_inode_operations; | 307 | extern const struct inode_operations fat_file_inode_operations; |
308 | extern int fat_setattr(struct dentry * dentry, struct iattr * attr); | 308 | extern int fat_setattr(struct dentry * dentry, struct iattr * attr); |
309 | extern void fat_truncate(struct inode *inode); | 309 | extern int fat_setsize(struct inode *inode, loff_t offset); |
310 | extern void fat_truncate_blocks(struct inode *inode, loff_t offset); | ||
310 | extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, | 311 | extern int fat_getattr(struct vfsmount *mnt, struct dentry *dentry, |
311 | struct kstat *stat); | 312 | struct kstat *stat); |
312 | extern int fat_file_fsync(struct file *file, struct dentry *dentry, | 313 | extern int fat_file_fsync(struct file *file, int datasync); |
313 | int datasync); | ||
314 | 314 | ||
315 | /* fat/inode.c */ | 315 | /* fat/inode.c */ |
316 | extern void fat_attach(struct inode *inode, loff_t i_pos); | 316 | extern void fat_attach(struct inode *inode, loff_t i_pos); |
diff --git a/fs/fat/file.c b/fs/fat/file.c index a14c2f6a489e..990dfae022e5 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c | |||
@@ -149,12 +149,12 @@ static int fat_file_release(struct inode *inode, struct file *filp) | |||
149 | return 0; | 149 | return 0; |
150 | } | 150 | } |
151 | 151 | ||
152 | int fat_file_fsync(struct file *filp, struct dentry *dentry, int datasync) | 152 | int fat_file_fsync(struct file *filp, int datasync) |
153 | { | 153 | { |
154 | struct inode *inode = dentry->d_inode; | 154 | struct inode *inode = filp->f_mapping->host; |
155 | int res, err; | 155 | int res, err; |
156 | 156 | ||
157 | res = simple_fsync(filp, dentry, datasync); | 157 | res = generic_file_fsync(filp, datasync); |
158 | err = sync_mapping_buffers(MSDOS_SB(inode->i_sb)->fat_inode->i_mapping); | 158 | err = sync_mapping_buffers(MSDOS_SB(inode->i_sb)->fat_inode->i_mapping); |
159 | 159 | ||
160 | return res ? res : err; | 160 | return res ? res : err; |
@@ -283,7 +283,7 @@ static int fat_free(struct inode *inode, int skip) | |||
283 | return fat_free_clusters(inode, free_start); | 283 | return fat_free_clusters(inode, free_start); |
284 | } | 284 | } |
285 | 285 | ||
286 | void fat_truncate(struct inode *inode) | 286 | void fat_truncate_blocks(struct inode *inode, loff_t offset) |
287 | { | 287 | { |
288 | struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); | 288 | struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb); |
289 | const unsigned int cluster_size = sbi->cluster_size; | 289 | const unsigned int cluster_size = sbi->cluster_size; |
@@ -293,10 +293,10 @@ void fat_truncate(struct inode *inode) | |||
293 | * This protects against truncating a file bigger than it was then | 293 | * This protects against truncating a file bigger than it was then |
294 | * trying to write into the hole. | 294 | * trying to write into the hole. |
295 | */ | 295 | */ |
296 | if (MSDOS_I(inode)->mmu_private > inode->i_size) | 296 | if (MSDOS_I(inode)->mmu_private > offset) |
297 | MSDOS_I(inode)->mmu_private = inode->i_size; | 297 | MSDOS_I(inode)->mmu_private = offset; |
298 | 298 | ||
299 | nr_clusters = (inode->i_size + (cluster_size - 1)) >> sbi->cluster_bits; | 299 | nr_clusters = (offset + (cluster_size - 1)) >> sbi->cluster_bits; |
300 | 300 | ||
301 | fat_free(inode, nr_clusters); | 301 | fat_free(inode, nr_clusters); |
302 | fat_flush_inodes(inode->i_sb, inode, NULL); | 302 | fat_flush_inodes(inode->i_sb, inode, NULL); |
@@ -364,6 +364,18 @@ static int fat_allow_set_time(struct msdos_sb_info *sbi, struct inode *inode) | |||
364 | return 0; | 364 | return 0; |
365 | } | 365 | } |
366 | 366 | ||
367 | int fat_setsize(struct inode *inode, loff_t offset) | ||
368 | { | ||
369 | int error; | ||
370 | |||
371 | error = simple_setsize(inode, offset); | ||
372 | if (error) | ||
373 | return error; | ||
374 | fat_truncate_blocks(inode, offset); | ||
375 | |||
376 | return error; | ||
377 | } | ||
378 | |||
367 | #define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET) | 379 | #define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET) |
368 | /* valid file mode bits */ | 380 | /* valid file mode bits */ |
369 | #define FAT_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXUGO) | 381 | #define FAT_VALID_MODE (S_IFREG | S_IFDIR | S_IRWXUGO) |
@@ -378,7 +390,8 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr) | |||
378 | /* | 390 | /* |
379 | * Expand the file. Since inode_setattr() updates ->i_size | 391 | * Expand the file. Since inode_setattr() updates ->i_size |
380 | * before calling the ->truncate(), but FAT needs to fill the | 392 | * before calling the ->truncate(), but FAT needs to fill the |
381 | * hole before it. | 393 | * hole before it. XXX: this is no longer true with new truncate |
394 | * sequence. | ||
382 | */ | 395 | */ |
383 | if (attr->ia_valid & ATTR_SIZE) { | 396 | if (attr->ia_valid & ATTR_SIZE) { |
384 | if (attr->ia_size > inode->i_size) { | 397 | if (attr->ia_size > inode->i_size) { |
@@ -427,15 +440,20 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr) | |||
427 | attr->ia_valid &= ~ATTR_MODE; | 440 | attr->ia_valid &= ~ATTR_MODE; |
428 | } | 441 | } |
429 | 442 | ||
430 | if (attr->ia_valid) | 443 | if (attr->ia_valid & ATTR_SIZE) { |
431 | error = inode_setattr(inode, attr); | 444 | error = fat_setsize(inode, attr->ia_size); |
445 | if (error) | ||
446 | goto out; | ||
447 | } | ||
448 | |||
449 | generic_setattr(inode, attr); | ||
450 | mark_inode_dirty(inode); | ||
432 | out: | 451 | out: |
433 | return error; | 452 | return error; |
434 | } | 453 | } |
435 | EXPORT_SYMBOL_GPL(fat_setattr); | 454 | EXPORT_SYMBOL_GPL(fat_setattr); |
436 | 455 | ||
437 | const struct inode_operations fat_file_inode_operations = { | 456 | const struct inode_operations fat_file_inode_operations = { |
438 | .truncate = fat_truncate, | ||
439 | .setattr = fat_setattr, | 457 | .setattr = fat_setattr, |
440 | .getattr = fat_getattr, | 458 | .getattr = fat_getattr, |
441 | }; | 459 | }; |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index ed33904926ee..7bf45aee56d7 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -142,14 +142,29 @@ static int fat_readpages(struct file *file, struct address_space *mapping, | |||
142 | return mpage_readpages(mapping, pages, nr_pages, fat_get_block); | 142 | return mpage_readpages(mapping, pages, nr_pages, fat_get_block); |
143 | } | 143 | } |
144 | 144 | ||
145 | static void fat_write_failed(struct address_space *mapping, loff_t to) | ||
146 | { | ||
147 | struct inode *inode = mapping->host; | ||
148 | |||
149 | if (to > inode->i_size) { | ||
150 | truncate_pagecache(inode, to, inode->i_size); | ||
151 | fat_truncate_blocks(inode, inode->i_size); | ||
152 | } | ||
153 | } | ||
154 | |||
145 | static int fat_write_begin(struct file *file, struct address_space *mapping, | 155 | static int fat_write_begin(struct file *file, struct address_space *mapping, |
146 | loff_t pos, unsigned len, unsigned flags, | 156 | loff_t pos, unsigned len, unsigned flags, |
147 | struct page **pagep, void **fsdata) | 157 | struct page **pagep, void **fsdata) |
148 | { | 158 | { |
159 | int err; | ||
160 | |||
149 | *pagep = NULL; | 161 | *pagep = NULL; |
150 | return cont_write_begin(file, mapping, pos, len, flags, pagep, fsdata, | 162 | err = cont_write_begin_newtrunc(file, mapping, pos, len, flags, |
151 | fat_get_block, | 163 | pagep, fsdata, fat_get_block, |
152 | &MSDOS_I(mapping->host)->mmu_private); | 164 | &MSDOS_I(mapping->host)->mmu_private); |
165 | if (err < 0) | ||
166 | fat_write_failed(mapping, pos + len); | ||
167 | return err; | ||
153 | } | 168 | } |
154 | 169 | ||
155 | static int fat_write_end(struct file *file, struct address_space *mapping, | 170 | static int fat_write_end(struct file *file, struct address_space *mapping, |
@@ -159,6 +174,8 @@ static int fat_write_end(struct file *file, struct address_space *mapping, | |||
159 | struct inode *inode = mapping->host; | 174 | struct inode *inode = mapping->host; |
160 | int err; | 175 | int err; |
161 | err = generic_write_end(file, mapping, pos, len, copied, pagep, fsdata); | 176 | err = generic_write_end(file, mapping, pos, len, copied, pagep, fsdata); |
177 | if (err < len) | ||
178 | fat_write_failed(mapping, pos + len); | ||
162 | if (!(err < 0) && !(MSDOS_I(inode)->i_attrs & ATTR_ARCH)) { | 179 | if (!(err < 0) && !(MSDOS_I(inode)->i_attrs & ATTR_ARCH)) { |
163 | inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; | 180 | inode->i_mtime = inode->i_ctime = CURRENT_TIME_SEC; |
164 | MSDOS_I(inode)->i_attrs |= ATTR_ARCH; | 181 | MSDOS_I(inode)->i_attrs |= ATTR_ARCH; |
@@ -172,7 +189,9 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb, | |||
172 | loff_t offset, unsigned long nr_segs) | 189 | loff_t offset, unsigned long nr_segs) |
173 | { | 190 | { |
174 | struct file *file = iocb->ki_filp; | 191 | struct file *file = iocb->ki_filp; |
175 | struct inode *inode = file->f_mapping->host; | 192 | struct address_space *mapping = file->f_mapping; |
193 | struct inode *inode = mapping->host; | ||
194 | ssize_t ret; | ||
176 | 195 | ||
177 | if (rw == WRITE) { | 196 | if (rw == WRITE) { |
178 | /* | 197 | /* |
@@ -193,8 +212,12 @@ static ssize_t fat_direct_IO(int rw, struct kiocb *iocb, | |||
193 | * FAT need to use the DIO_LOCKING for avoiding the race | 212 | * FAT need to use the DIO_LOCKING for avoiding the race |
194 | * condition of fat_get_block() and ->truncate(). | 213 | * condition of fat_get_block() and ->truncate(). |
195 | */ | 214 | */ |
196 | return blockdev_direct_IO(rw, iocb, inode, inode->i_sb->s_bdev, iov, | 215 | ret = blockdev_direct_IO_newtrunc(rw, iocb, inode, inode->i_sb->s_bdev, |
197 | offset, nr_segs, fat_get_block, NULL); | 216 | iov, offset, nr_segs, fat_get_block, NULL); |
217 | if (ret < 0 && (rw & WRITE)) | ||
218 | fat_write_failed(mapping, offset + iov_length(iov, nr_segs)); | ||
219 | |||
220 | return ret; | ||
198 | } | 221 | } |
199 | 222 | ||
200 | static sector_t _fat_bmap(struct address_space *mapping, sector_t block) | 223 | static sector_t _fat_bmap(struct address_space *mapping, sector_t block) |
@@ -429,7 +452,7 @@ static void fat_delete_inode(struct inode *inode) | |||
429 | { | 452 | { |
430 | truncate_inode_pages(&inode->i_data, 0); | 453 | truncate_inode_pages(&inode->i_data, 0); |
431 | inode->i_size = 0; | 454 | inode->i_size = 0; |
432 | fat_truncate(inode); | 455 | fat_truncate_blocks(inode, 0); |
433 | clear_inode(inode); | 456 | clear_inode(inode); |
434 | } | 457 | } |
435 | 458 | ||
diff --git a/fs/file_table.c b/fs/file_table.c index 32d12b78bac8..5c7d10ead4ad 100644 --- a/fs/file_table.c +++ b/fs/file_table.c | |||
@@ -194,14 +194,6 @@ struct file *alloc_file(struct path *path, fmode_t mode, | |||
194 | } | 194 | } |
195 | EXPORT_SYMBOL(alloc_file); | 195 | EXPORT_SYMBOL(alloc_file); |
196 | 196 | ||
197 | void fput(struct file *file) | ||
198 | { | ||
199 | if (atomic_long_dec_and_test(&file->f_count)) | ||
200 | __fput(file); | ||
201 | } | ||
202 | |||
203 | EXPORT_SYMBOL(fput); | ||
204 | |||
205 | /** | 197 | /** |
206 | * drop_file_write_access - give up ability to write to a file | 198 | * drop_file_write_access - give up ability to write to a file |
207 | * @file: the file to which we will stop writing | 199 | * @file: the file to which we will stop writing |
@@ -227,10 +219,9 @@ void drop_file_write_access(struct file *file) | |||
227 | } | 219 | } |
228 | EXPORT_SYMBOL_GPL(drop_file_write_access); | 220 | EXPORT_SYMBOL_GPL(drop_file_write_access); |
229 | 221 | ||
230 | /* __fput is called from task context when aio completion releases the last | 222 | /* the real guts of fput() - releasing the last reference to file |
231 | * last use of a struct file *. Do not use otherwise. | ||
232 | */ | 223 | */ |
233 | void __fput(struct file *file) | 224 | static void __fput(struct file *file) |
234 | { | 225 | { |
235 | struct dentry *dentry = file->f_path.dentry; | 226 | struct dentry *dentry = file->f_path.dentry; |
236 | struct vfsmount *mnt = file->f_path.mnt; | 227 | struct vfsmount *mnt = file->f_path.mnt; |
@@ -268,6 +259,14 @@ void __fput(struct file *file) | |||
268 | mntput(mnt); | 259 | mntput(mnt); |
269 | } | 260 | } |
270 | 261 | ||
262 | void fput(struct file *file) | ||
263 | { | ||
264 | if (atomic_long_dec_and_test(&file->f_count)) | ||
265 | __fput(file); | ||
266 | } | ||
267 | |||
268 | EXPORT_SYMBOL(fput); | ||
269 | |||
271 | struct file *fget(unsigned int fd) | 270 | struct file *fget(unsigned int fd) |
272 | { | 271 | { |
273 | struct file *file; | 272 | struct file *file; |
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 4787ae6c5c1c..3cdc5f78a406 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -1156,10 +1156,9 @@ static int fuse_dir_release(struct inode *inode, struct file *file) | |||
1156 | return 0; | 1156 | return 0; |
1157 | } | 1157 | } |
1158 | 1158 | ||
1159 | static int fuse_dir_fsync(struct file *file, struct dentry *de, int datasync) | 1159 | static int fuse_dir_fsync(struct file *file, int datasync) |
1160 | { | 1160 | { |
1161 | /* nfsd can call this with no file */ | 1161 | return fuse_fsync_common(file, datasync, 1); |
1162 | return file ? fuse_fsync_common(file, de, datasync, 1) : 0; | ||
1163 | } | 1162 | } |
1164 | 1163 | ||
1165 | static bool update_mtime(unsigned ivalid) | 1164 | static bool update_mtime(unsigned ivalid) |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index a9f5e137f1d3..b5fd6f9905e4 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -351,10 +351,9 @@ static void fuse_sync_writes(struct inode *inode) | |||
351 | fuse_release_nowrite(inode); | 351 | fuse_release_nowrite(inode); |
352 | } | 352 | } |
353 | 353 | ||
354 | int fuse_fsync_common(struct file *file, struct dentry *de, int datasync, | 354 | int fuse_fsync_common(struct file *file, int datasync, int isdir) |
355 | int isdir) | ||
356 | { | 355 | { |
357 | struct inode *inode = de->d_inode; | 356 | struct inode *inode = file->f_mapping->host; |
358 | struct fuse_conn *fc = get_fuse_conn(inode); | 357 | struct fuse_conn *fc = get_fuse_conn(inode); |
359 | struct fuse_file *ff = file->private_data; | 358 | struct fuse_file *ff = file->private_data; |
360 | struct fuse_req *req; | 359 | struct fuse_req *req; |
@@ -403,9 +402,9 @@ int fuse_fsync_common(struct file *file, struct dentry *de, int datasync, | |||
403 | return err; | 402 | return err; |
404 | } | 403 | } |
405 | 404 | ||
406 | static int fuse_fsync(struct file *file, struct dentry *de, int datasync) | 405 | static int fuse_fsync(struct file *file, int datasync) |
407 | { | 406 | { |
408 | return fuse_fsync_common(file, de, datasync, 0); | 407 | return fuse_fsync_common(file, datasync, 0); |
409 | } | 408 | } |
410 | 409 | ||
411 | void fuse_read_fill(struct fuse_req *req, struct file *file, loff_t pos, | 410 | void fuse_read_fill(struct fuse_req *req, struct file *file, loff_t pos, |
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 01cc462ff45d..2c0d14a86779 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -568,8 +568,7 @@ void fuse_release_common(struct file *file, int opcode); | |||
568 | /** | 568 | /** |
569 | * Send FSYNC or FSYNCDIR request | 569 | * Send FSYNC or FSYNCDIR request |
570 | */ | 570 | */ |
571 | int fuse_fsync_common(struct file *file, struct dentry *de, int datasync, | 571 | int fuse_fsync_common(struct file *file, int datasync, int isdir); |
572 | int isdir); | ||
573 | 572 | ||
574 | /** | 573 | /** |
575 | * Notify poll wakeup | 574 | * Notify poll wakeup |
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c index a739a0a48067..9f8b52500d63 100644 --- a/fs/gfs2/aops.c +++ b/fs/gfs2/aops.c | |||
@@ -700,8 +700,14 @@ out: | |||
700 | return 0; | 700 | return 0; |
701 | 701 | ||
702 | page_cache_release(page); | 702 | page_cache_release(page); |
703 | |||
704 | /* | ||
705 | * XXX(hch): the call below should probably be replaced with | ||
706 | * a call to the gfs2-specific truncate blocks helper to actually | ||
707 | * release disk blocks.. | ||
708 | */ | ||
703 | if (pos + len > ip->i_inode.i_size) | 709 | if (pos + len > ip->i_inode.i_size) |
704 | vmtruncate(&ip->i_inode, ip->i_inode.i_size); | 710 | simple_setsize(&ip->i_inode, ip->i_inode.i_size); |
705 | out_endtrans: | 711 | out_endtrans: |
706 | gfs2_trans_end(sdp); | 712 | gfs2_trans_end(sdp); |
707 | out_trans_fail: | 713 | out_trans_fail: |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index b20bfcc9fa2d..ed9a94f0ef15 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -554,9 +554,9 @@ static int gfs2_close(struct inode *inode, struct file *file) | |||
554 | * Returns: errno | 554 | * Returns: errno |
555 | */ | 555 | */ |
556 | 556 | ||
557 | static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync) | 557 | static int gfs2_fsync(struct file *file, int datasync) |
558 | { | 558 | { |
559 | struct inode *inode = dentry->d_inode; | 559 | struct inode *inode = file->f_mapping->host; |
560 | int sync_state = inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC); | 560 | int sync_state = inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC); |
561 | int ret = 0; | 561 | int ret = 0; |
562 | 562 | ||
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c index 4e64352d49de..98cdd05f3316 100644 --- a/fs/gfs2/ops_inode.c +++ b/fs/gfs2/ops_inode.c | |||
@@ -1071,6 +1071,9 @@ int gfs2_permission(struct inode *inode, int mask) | |||
1071 | return error; | 1071 | return error; |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | /* | ||
1075 | * XXX: should be changed to have proper ordering by opencoding simple_setsize | ||
1076 | */ | ||
1074 | static int setattr_size(struct inode *inode, struct iattr *attr) | 1077 | static int setattr_size(struct inode *inode, struct iattr *attr) |
1075 | { | 1078 | { |
1076 | struct gfs2_inode *ip = GFS2_I(inode); | 1079 | struct gfs2_inode *ip = GFS2_I(inode); |
@@ -1081,7 +1084,7 @@ static int setattr_size(struct inode *inode, struct iattr *attr) | |||
1081 | error = gfs2_trans_begin(sdp, 0, sdp->sd_jdesc->jd_blocks); | 1084 | error = gfs2_trans_begin(sdp, 0, sdp->sd_jdesc->jd_blocks); |
1082 | if (error) | 1085 | if (error) |
1083 | return error; | 1086 | return error; |
1084 | error = vmtruncate(inode, attr->ia_size); | 1087 | error = simple_setsize(inode, attr->ia_size); |
1085 | gfs2_trans_end(sdp); | 1088 | gfs2_trans_end(sdp); |
1086 | if (error) | 1089 | if (error) |
1087 | return error; | 1090 | return error; |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index 3a029d8f4cf1..87ac1891a185 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -411,9 +411,9 @@ int hostfs_file_open(struct inode *ino, struct file *file) | |||
411 | return 0; | 411 | return 0; |
412 | } | 412 | } |
413 | 413 | ||
414 | int hostfs_fsync(struct file *file, struct dentry *dentry, int datasync) | 414 | int hostfs_fsync(struct file *file, int datasync) |
415 | { | 415 | { |
416 | return fsync_file(HOSTFS_I(dentry->d_inode)->fd, datasync); | 416 | return fsync_file(HOSTFS_I(file->f_mapping->host)->fd, datasync); |
417 | } | 417 | } |
418 | 418 | ||
419 | static const struct file_operations hostfs_file_fops = { | 419 | static const struct file_operations hostfs_file_fops = { |
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c index 3efabff00367..a9ae9bfa752f 100644 --- a/fs/hpfs/file.c +++ b/fs/hpfs/file.c | |||
@@ -19,9 +19,9 @@ static int hpfs_file_release(struct inode *inode, struct file *file) | |||
19 | return 0; | 19 | return 0; |
20 | } | 20 | } |
21 | 21 | ||
22 | int hpfs_file_fsync(struct file *file, struct dentry *dentry, int datasync) | 22 | int hpfs_file_fsync(struct file *file, int datasync) |
23 | { | 23 | { |
24 | /*return file_fsync(file, dentry);*/ | 24 | /*return file_fsync(file, datasync);*/ |
25 | return 0; /* Don't fsync :-) */ | 25 | return 0; /* Don't fsync :-) */ |
26 | } | 26 | } |
27 | 27 | ||
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h index 97bf738cd5d6..75f9d4324851 100644 --- a/fs/hpfs/hpfs_fn.h +++ b/fs/hpfs/hpfs_fn.h | |||
@@ -268,7 +268,7 @@ void hpfs_set_ea(struct inode *, struct fnode *, const char *, | |||
268 | 268 | ||
269 | /* file.c */ | 269 | /* file.c */ |
270 | 270 | ||
271 | int hpfs_file_fsync(struct file *, struct dentry *, int); | 271 | int hpfs_file_fsync(struct file *, int); |
272 | extern const struct file_operations hpfs_file_ops; | 272 | extern const struct file_operations hpfs_file_ops; |
273 | extern const struct inode_operations hpfs_file_iops; | 273 | extern const struct inode_operations hpfs_file_iops; |
274 | extern const struct address_space_operations hpfs_aops; | 274 | extern const struct address_space_operations hpfs_aops; |
diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c index 2e4dfa8593da..826c3f9d29ac 100644 --- a/fs/hppfs/hppfs.c +++ b/fs/hppfs/hppfs.c | |||
@@ -587,7 +587,7 @@ static int hppfs_readdir(struct file *file, void *ent, filldir_t filldir) | |||
587 | return err; | 587 | return err; |
588 | } | 588 | } |
589 | 589 | ||
590 | static int hppfs_fsync(struct file *file, struct dentry *dentry, int datasync) | 590 | static int hppfs_fsync(struct file *file, int datasync) |
591 | { | 591 | { |
592 | return 0; | 592 | return 0; |
593 | } | 593 | } |
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index a0bbd3d1b41a..a4e9a7ec3691 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c | |||
@@ -688,7 +688,7 @@ static void init_once(void *foo) | |||
688 | const struct file_operations hugetlbfs_file_operations = { | 688 | const struct file_operations hugetlbfs_file_operations = { |
689 | .read = hugetlbfs_read, | 689 | .read = hugetlbfs_read, |
690 | .mmap = hugetlbfs_file_mmap, | 690 | .mmap = hugetlbfs_file_mmap, |
691 | .fsync = simple_sync_file, | 691 | .fsync = noop_fsync, |
692 | .get_unmapped_area = hugetlb_get_unmapped_area, | 692 | .get_unmapped_area = hugetlb_get_unmapped_area, |
693 | }; | 693 | }; |
694 | 694 | ||
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index e7291c161a19..813497024437 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c | |||
@@ -26,9 +26,9 @@ static int jffs2_write_begin(struct file *filp, struct address_space *mapping, | |||
26 | struct page **pagep, void **fsdata); | 26 | struct page **pagep, void **fsdata); |
27 | static int jffs2_readpage (struct file *filp, struct page *pg); | 27 | static int jffs2_readpage (struct file *filp, struct page *pg); |
28 | 28 | ||
29 | int jffs2_fsync(struct file *filp, struct dentry *dentry, int datasync) | 29 | int jffs2_fsync(struct file *filp, int datasync) |
30 | { | 30 | { |
31 | struct inode *inode = dentry->d_inode; | 31 | struct inode *inode = filp->f_mapping->host; |
32 | struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); | 32 | struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); |
33 | 33 | ||
34 | /* Trigger GC to flush any pending writes for this inode */ | 34 | /* Trigger GC to flush any pending writes for this inode */ |
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c index 86e0821fc989..8bc2c80ab159 100644 --- a/fs/jffs2/fs.c +++ b/fs/jffs2/fs.c | |||
@@ -169,13 +169,13 @@ int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) | |||
169 | mutex_unlock(&f->sem); | 169 | mutex_unlock(&f->sem); |
170 | jffs2_complete_reservation(c); | 170 | jffs2_complete_reservation(c); |
171 | 171 | ||
172 | /* We have to do the vmtruncate() without f->sem held, since | 172 | /* We have to do the simple_setsize() without f->sem held, since |
173 | some pages may be locked and waiting for it in readpage(). | 173 | some pages may be locked and waiting for it in readpage(). |
174 | We are protected from a simultaneous write() extending i_size | 174 | We are protected from a simultaneous write() extending i_size |
175 | back past iattr->ia_size, because do_truncate() holds the | 175 | back past iattr->ia_size, because do_truncate() holds the |
176 | generic inode semaphore. */ | 176 | generic inode semaphore. */ |
177 | if (ivalid & ATTR_SIZE && inode->i_size > iattr->ia_size) { | 177 | if (ivalid & ATTR_SIZE && inode->i_size > iattr->ia_size) { |
178 | vmtruncate(inode, iattr->ia_size); | 178 | simple_setsize(inode, iattr->ia_size); |
179 | inode->i_blocks = (inode->i_size + 511) >> 9; | 179 | inode->i_blocks = (inode->i_size + 511) >> 9; |
180 | } | 180 | } |
181 | 181 | ||
diff --git a/fs/jffs2/os-linux.h b/fs/jffs2/os-linux.h index 035a767f958b..4791aacf3084 100644 --- a/fs/jffs2/os-linux.h +++ b/fs/jffs2/os-linux.h | |||
@@ -158,7 +158,7 @@ extern const struct inode_operations jffs2_dir_inode_operations; | |||
158 | extern const struct file_operations jffs2_file_operations; | 158 | extern const struct file_operations jffs2_file_operations; |
159 | extern const struct inode_operations jffs2_file_inode_operations; | 159 | extern const struct inode_operations jffs2_file_inode_operations; |
160 | extern const struct address_space_operations jffs2_file_address_operations; | 160 | extern const struct address_space_operations jffs2_file_address_operations; |
161 | int jffs2_fsync(struct file *, struct dentry *, int); | 161 | int jffs2_fsync(struct file *, int); |
162 | int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg); | 162 | int jffs2_do_readpage_unlock (struct inode *inode, struct page *pg); |
163 | 163 | ||
164 | /* ioctl.c */ | 164 | /* ioctl.c */ |
diff --git a/fs/jfs/file.c b/fs/jfs/file.c index 85d9ec659225..127263cc8657 100644 --- a/fs/jfs/file.c +++ b/fs/jfs/file.c | |||
@@ -27,9 +27,9 @@ | |||
27 | #include "jfs_acl.h" | 27 | #include "jfs_acl.h" |
28 | #include "jfs_debug.h" | 28 | #include "jfs_debug.h" |
29 | 29 | ||
30 | int jfs_fsync(struct file *file, struct dentry *dentry, int datasync) | 30 | int jfs_fsync(struct file *file, int datasync) |
31 | { | 31 | { |
32 | struct inode *inode = dentry->d_inode; | 32 | struct inode *inode = file->f_mapping->host; |
33 | int rc = 0; | 33 | int rc = 0; |
34 | 34 | ||
35 | if (!(inode->i_state & I_DIRTY) || | 35 | if (!(inode->i_state & I_DIRTY) || |
diff --git a/fs/jfs/jfs_inode.h b/fs/jfs/jfs_inode.h index 9e6bda30a6e8..11042b1f44b5 100644 --- a/fs/jfs/jfs_inode.h +++ b/fs/jfs/jfs_inode.h | |||
@@ -21,7 +21,7 @@ | |||
21 | struct fid; | 21 | struct fid; |
22 | 22 | ||
23 | extern struct inode *ialloc(struct inode *, umode_t); | 23 | extern struct inode *ialloc(struct inode *, umode_t); |
24 | extern int jfs_fsync(struct file *, struct dentry *, int); | 24 | extern int jfs_fsync(struct file *, int); |
25 | extern long jfs_ioctl(struct file *, unsigned int, unsigned long); | 25 | extern long jfs_ioctl(struct file *, unsigned int, unsigned long); |
26 | extern long jfs_compat_ioctl(struct file *, unsigned int, unsigned long); | 26 | extern long jfs_compat_ioctl(struct file *, unsigned int, unsigned long); |
27 | extern struct inode *jfs_iget(struct super_block *, unsigned long); | 27 | extern struct inode *jfs_iget(struct super_block *, unsigned long); |
diff --git a/fs/libfs.c b/fs/libfs.c index 232bea425b09..09e1016eb774 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/slab.h> | 8 | #include <linux/slab.h> |
9 | #include <linux/mount.h> | 9 | #include <linux/mount.h> |
10 | #include <linux/vfs.h> | 10 | #include <linux/vfs.h> |
11 | #include <linux/quotaops.h> | ||
11 | #include <linux/mutex.h> | 12 | #include <linux/mutex.h> |
12 | #include <linux/exportfs.h> | 13 | #include <linux/exportfs.h> |
13 | #include <linux/writeback.h> | 14 | #include <linux/writeback.h> |
@@ -58,11 +59,6 @@ struct dentry *simple_lookup(struct inode *dir, struct dentry *dentry, struct na | |||
58 | return NULL; | 59 | return NULL; |
59 | } | 60 | } |
60 | 61 | ||
61 | int simple_sync_file(struct file * file, struct dentry *dentry, int datasync) | ||
62 | { | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | int dcache_dir_open(struct inode *inode, struct file *file) | 62 | int dcache_dir_open(struct inode *inode, struct file *file) |
67 | { | 63 | { |
68 | static struct qstr cursor_name = {.len = 1, .name = "."}; | 64 | static struct qstr cursor_name = {.len = 1, .name = "."}; |
@@ -190,7 +186,7 @@ const struct file_operations simple_dir_operations = { | |||
190 | .llseek = dcache_dir_lseek, | 186 | .llseek = dcache_dir_lseek, |
191 | .read = generic_read_dir, | 187 | .read = generic_read_dir, |
192 | .readdir = dcache_readdir, | 188 | .readdir = dcache_readdir, |
193 | .fsync = simple_sync_file, | 189 | .fsync = noop_fsync, |
194 | }; | 190 | }; |
195 | 191 | ||
196 | const struct inode_operations simple_dir_inode_operations = { | 192 | const struct inode_operations simple_dir_inode_operations = { |
@@ -330,6 +326,81 @@ int simple_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
330 | return 0; | 326 | return 0; |
331 | } | 327 | } |
332 | 328 | ||
329 | /** | ||
330 | * simple_setsize - handle core mm and vfs requirements for file size change | ||
331 | * @inode: inode | ||
332 | * @newsize: new file size | ||
333 | * | ||
334 | * Returns 0 on success, -error on failure. | ||
335 | * | ||
336 | * simple_setsize must be called with inode_mutex held. | ||
337 | * | ||
338 | * simple_setsize will check that the requested new size is OK (see | ||
339 | * inode_newsize_ok), and then will perform the necessary i_size update | ||
340 | * and pagecache truncation (if necessary). It will be typically be called | ||
341 | * from the filesystem's setattr function when ATTR_SIZE is passed in. | ||
342 | * | ||
343 | * The inode itself must have correct permissions and attributes to allow | ||
344 | * i_size to be changed, this function then just checks that the new size | ||
345 | * requested is valid. | ||
346 | * | ||
347 | * In the case of simple in-memory filesystems with inodes stored solely | ||
348 | * in the inode cache, and file data in the pagecache, nothing more needs | ||
349 | * to be done to satisfy a truncate request. Filesystems with on-disk | ||
350 | * blocks for example will need to free them in the case of truncate, in | ||
351 | * that case it may be easier not to use simple_setsize (but each of its | ||
352 | * components will likely be required at some point to update pagecache | ||
353 | * and inode etc). | ||
354 | */ | ||
355 | int simple_setsize(struct inode *inode, loff_t newsize) | ||
356 | { | ||
357 | loff_t oldsize; | ||
358 | int error; | ||
359 | |||
360 | error = inode_newsize_ok(inode, newsize); | ||
361 | if (error) | ||
362 | return error; | ||
363 | |||
364 | oldsize = inode->i_size; | ||
365 | i_size_write(inode, newsize); | ||
366 | truncate_pagecache(inode, oldsize, newsize); | ||
367 | |||
368 | return error; | ||
369 | } | ||
370 | EXPORT_SYMBOL(simple_setsize); | ||
371 | |||
372 | /** | ||
373 | * simple_setattr - setattr for simple in-memory filesystem | ||
374 | * @dentry: dentry | ||
375 | * @iattr: iattr structure | ||
376 | * | ||
377 | * Returns 0 on success, -error on failure. | ||
378 | * | ||
379 | * simple_setattr implements setattr for an in-memory filesystem which | ||
380 | * does not store its own file data or metadata (eg. uses the page cache | ||
381 | * and inode cache as its data store). | ||
382 | */ | ||
383 | int simple_setattr(struct dentry *dentry, struct iattr *iattr) | ||
384 | { | ||
385 | struct inode *inode = dentry->d_inode; | ||
386 | int error; | ||
387 | |||
388 | error = inode_change_ok(inode, iattr); | ||
389 | if (error) | ||
390 | return error; | ||
391 | |||
392 | if (iattr->ia_valid & ATTR_SIZE) { | ||
393 | error = simple_setsize(inode, iattr->ia_size); | ||
394 | if (error) | ||
395 | return error; | ||
396 | } | ||
397 | |||
398 | generic_setattr(inode, iattr); | ||
399 | |||
400 | return error; | ||
401 | } | ||
402 | EXPORT_SYMBOL(simple_setattr); | ||
403 | |||
333 | int simple_readpage(struct file *file, struct page *page) | 404 | int simple_readpage(struct file *file, struct page *page) |
334 | { | 405 | { |
335 | clear_highpage(page); | 406 | clear_highpage(page); |
@@ -851,13 +922,22 @@ struct dentry *generic_fh_to_parent(struct super_block *sb, struct fid *fid, | |||
851 | } | 922 | } |
852 | EXPORT_SYMBOL_GPL(generic_fh_to_parent); | 923 | EXPORT_SYMBOL_GPL(generic_fh_to_parent); |
853 | 924 | ||
854 | int simple_fsync(struct file *file, struct dentry *dentry, int datasync) | 925 | /** |
926 | * generic_file_fsync - generic fsync implementation for simple filesystems | ||
927 | * @file: file to synchronize | ||
928 | * @datasync: only synchronize essential metadata if true | ||
929 | * | ||
930 | * This is a generic implementation of the fsync method for simple | ||
931 | * filesystems which track all non-inode metadata in the buffers list | ||
932 | * hanging off the address_space structure. | ||
933 | */ | ||
934 | int generic_file_fsync(struct file *file, int datasync) | ||
855 | { | 935 | { |
856 | struct writeback_control wbc = { | 936 | struct writeback_control wbc = { |
857 | .sync_mode = WB_SYNC_ALL, | 937 | .sync_mode = WB_SYNC_ALL, |
858 | .nr_to_write = 0, /* metadata-only; caller takes care of data */ | 938 | .nr_to_write = 0, /* metadata-only; caller takes care of data */ |
859 | }; | 939 | }; |
860 | struct inode *inode = dentry->d_inode; | 940 | struct inode *inode = file->f_mapping->host; |
861 | int err; | 941 | int err; |
862 | int ret; | 942 | int ret; |
863 | 943 | ||
@@ -872,7 +952,15 @@ int simple_fsync(struct file *file, struct dentry *dentry, int datasync) | |||
872 | ret = err; | 952 | ret = err; |
873 | return ret; | 953 | return ret; |
874 | } | 954 | } |
875 | EXPORT_SYMBOL(simple_fsync); | 955 | EXPORT_SYMBOL(generic_file_fsync); |
956 | |||
957 | /* | ||
958 | * No-op implementation of ->fsync for in-memory filesystems. | ||
959 | */ | ||
960 | int noop_fsync(struct file *file, int datasync) | ||
961 | { | ||
962 | return 0; | ||
963 | } | ||
876 | 964 | ||
877 | EXPORT_SYMBOL(dcache_dir_close); | 965 | EXPORT_SYMBOL(dcache_dir_close); |
878 | EXPORT_SYMBOL(dcache_dir_lseek); | 966 | EXPORT_SYMBOL(dcache_dir_lseek); |
@@ -895,7 +983,7 @@ EXPORT_SYMBOL(simple_release_fs); | |||
895 | EXPORT_SYMBOL(simple_rename); | 983 | EXPORT_SYMBOL(simple_rename); |
896 | EXPORT_SYMBOL(simple_rmdir); | 984 | EXPORT_SYMBOL(simple_rmdir); |
897 | EXPORT_SYMBOL(simple_statfs); | 985 | EXPORT_SYMBOL(simple_statfs); |
898 | EXPORT_SYMBOL(simple_sync_file); | 986 | EXPORT_SYMBOL(noop_fsync); |
899 | EXPORT_SYMBOL(simple_unlink); | 987 | EXPORT_SYMBOL(simple_unlink); |
900 | EXPORT_SYMBOL(simple_read_from_buffer); | 988 | EXPORT_SYMBOL(simple_read_from_buffer); |
901 | EXPORT_SYMBOL(simple_write_to_buffer); | 989 | EXPORT_SYMBOL(simple_write_to_buffer); |
diff --git a/fs/logfs/file.c b/fs/logfs/file.c index 0de524071870..abe1cafbd4c2 100644 --- a/fs/logfs/file.c +++ b/fs/logfs/file.c | |||
@@ -219,9 +219,9 @@ int logfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | |||
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | int logfs_fsync(struct file *file, struct dentry *dentry, int datasync) | 222 | int logfs_fsync(struct file *file, int datasync) |
223 | { | 223 | { |
224 | struct super_block *sb = dentry->d_inode->i_sb; | 224 | struct super_block *sb = file->f_mapping->host->i_sb; |
225 | 225 | ||
226 | logfs_write_anchor(sb); | 226 | logfs_write_anchor(sb); |
227 | return 0; | 227 | return 0; |
diff --git a/fs/logfs/logfs.h b/fs/logfs/logfs.h index 1a9db84f8d8f..c838c4d72111 100644 --- a/fs/logfs/logfs.h +++ b/fs/logfs/logfs.h | |||
@@ -506,7 +506,7 @@ extern const struct address_space_operations logfs_reg_aops; | |||
506 | int logfs_readpage(struct file *file, struct page *page); | 506 | int logfs_readpage(struct file *file, struct page *page); |
507 | int logfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | 507 | int logfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, |
508 | unsigned long arg); | 508 | unsigned long arg); |
509 | int logfs_fsync(struct file *file, struct dentry *dentry, int datasync); | 509 | int logfs_fsync(struct file *file, int datasync); |
510 | 510 | ||
511 | /* gc.c */ | 511 | /* gc.c */ |
512 | u32 get_best_cand(struct super_block *sb, struct candidate_list *list, u32 *ec); | 512 | u32 get_best_cand(struct super_block *sb, struct candidate_list *list, u32 *ec); |
diff --git a/fs/minix/dir.c b/fs/minix/dir.c index 6198731d7fcd..91969589131c 100644 --- a/fs/minix/dir.c +++ b/fs/minix/dir.c | |||
@@ -22,7 +22,7 @@ const struct file_operations minix_dir_operations = { | |||
22 | .llseek = generic_file_llseek, | 22 | .llseek = generic_file_llseek, |
23 | .read = generic_read_dir, | 23 | .read = generic_read_dir, |
24 | .readdir = minix_readdir, | 24 | .readdir = minix_readdir, |
25 | .fsync = simple_fsync, | 25 | .fsync = generic_file_fsync, |
26 | }; | 26 | }; |
27 | 27 | ||
28 | static inline void dir_put_page(struct page *page) | 28 | static inline void dir_put_page(struct page *page) |
@@ -72,11 +72,8 @@ static struct page * dir_get_page(struct inode *dir, unsigned long n) | |||
72 | { | 72 | { |
73 | struct address_space *mapping = dir->i_mapping; | 73 | struct address_space *mapping = dir->i_mapping; |
74 | struct page *page = read_mapping_page(mapping, n, NULL); | 74 | struct page *page = read_mapping_page(mapping, n, NULL); |
75 | if (!IS_ERR(page)) { | 75 | if (!IS_ERR(page)) |
76 | kmap(page); | 76 | kmap(page); |
77 | if (!PageUptodate(page)) | ||
78 | goto fail; | ||
79 | } | ||
80 | return page; | 77 | return page; |
81 | 78 | ||
82 | fail: | 79 | fail: |
diff --git a/fs/minix/file.c b/fs/minix/file.c index 3eec3e607a87..d5320ff23faf 100644 --- a/fs/minix/file.c +++ b/fs/minix/file.c | |||
@@ -19,7 +19,7 @@ const struct file_operations minix_file_operations = { | |||
19 | .write = do_sync_write, | 19 | .write = do_sync_write, |
20 | .aio_write = generic_file_aio_write, | 20 | .aio_write = generic_file_aio_write, |
21 | .mmap = generic_file_mmap, | 21 | .mmap = generic_file_mmap, |
22 | .fsync = simple_fsync, | 22 | .fsync = generic_file_fsync, |
23 | .splice_read = generic_file_splice_read, | 23 | .splice_read = generic_file_splice_read, |
24 | }; | 24 | }; |
25 | 25 | ||
diff --git a/fs/minix/itree_v2.c b/fs/minix/itree_v2.c index f23010969369..13487ad16894 100644 --- a/fs/minix/itree_v2.c +++ b/fs/minix/itree_v2.c | |||
@@ -20,6 +20,9 @@ static inline block_t *i_data(struct inode *inode) | |||
20 | return (block_t *)minix_i(inode)->u.i2_data; | 20 | return (block_t *)minix_i(inode)->u.i2_data; |
21 | } | 21 | } |
22 | 22 | ||
23 | #define DIRCOUNT 7 | ||
24 | #define INDIRCOUNT(sb) (1 << ((sb)->s_blocksize_bits - 2)) | ||
25 | |||
23 | static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) | 26 | static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) |
24 | { | 27 | { |
25 | int n = 0; | 28 | int n = 0; |
@@ -34,21 +37,21 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) | |||
34 | printk("MINIX-fs: block_to_path: " | 37 | printk("MINIX-fs: block_to_path: " |
35 | "block %ld too big on dev %s\n", | 38 | "block %ld too big on dev %s\n", |
36 | block, bdevname(sb->s_bdev, b)); | 39 | block, bdevname(sb->s_bdev, b)); |
37 | } else if (block < 7) { | 40 | } else if (block < DIRCOUNT) { |
38 | offsets[n++] = block; | 41 | offsets[n++] = block; |
39 | } else if ((block -= 7) < 256) { | 42 | } else if ((block -= DIRCOUNT) < INDIRCOUNT(sb)) { |
40 | offsets[n++] = 7; | 43 | offsets[n++] = DIRCOUNT; |
41 | offsets[n++] = block; | 44 | offsets[n++] = block; |
42 | } else if ((block -= 256) < 256*256) { | 45 | } else if ((block -= INDIRCOUNT(sb)) < INDIRCOUNT(sb) * INDIRCOUNT(sb)) { |
43 | offsets[n++] = 8; | 46 | offsets[n++] = DIRCOUNT + 1; |
44 | offsets[n++] = block>>8; | 47 | offsets[n++] = block / INDIRCOUNT(sb); |
45 | offsets[n++] = block & 255; | 48 | offsets[n++] = block % INDIRCOUNT(sb); |
46 | } else { | 49 | } else { |
47 | block -= 256*256; | 50 | block -= INDIRCOUNT(sb) * INDIRCOUNT(sb); |
48 | offsets[n++] = 9; | 51 | offsets[n++] = DIRCOUNT + 2; |
49 | offsets[n++] = block>>16; | 52 | offsets[n++] = (block / INDIRCOUNT(sb)) / INDIRCOUNT(sb); |
50 | offsets[n++] = (block>>8) & 255; | 53 | offsets[n++] = (block / INDIRCOUNT(sb)) % INDIRCOUNT(sb); |
51 | offsets[n++] = block & 255; | 54 | offsets[n++] = block % INDIRCOUNT(sb); |
52 | } | 55 | } |
53 | return n; | 56 | return n; |
54 | } | 57 | } |
diff --git a/fs/namei.c b/fs/namei.c index 48e1f60520ea..868d0cb9d473 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1621,6 +1621,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
1621 | case LAST_DOTDOT: | 1621 | case LAST_DOTDOT: |
1622 | follow_dotdot(nd); | 1622 | follow_dotdot(nd); |
1623 | dir = nd->path.dentry; | 1623 | dir = nd->path.dentry; |
1624 | case LAST_DOT: | ||
1624 | if (nd->path.mnt->mnt_sb->s_type->fs_flags & FS_REVAL_DOT) { | 1625 | if (nd->path.mnt->mnt_sb->s_type->fs_flags & FS_REVAL_DOT) { |
1625 | if (!dir->d_op->d_revalidate(dir, nd)) { | 1626 | if (!dir->d_op->d_revalidate(dir, nd)) { |
1626 | error = -ESTALE; | 1627 | error = -ESTALE; |
@@ -1628,7 +1629,6 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
1628 | } | 1629 | } |
1629 | } | 1630 | } |
1630 | /* fallthrough */ | 1631 | /* fallthrough */ |
1631 | case LAST_DOT: | ||
1632 | case LAST_ROOT: | 1632 | case LAST_ROOT: |
1633 | if (open_flag & O_CREAT) | 1633 | if (open_flag & O_CREAT) |
1634 | goto exit; | 1634 | goto exit; |
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c index b93870892892..3639cc5cbdae 100644 --- a/fs/ncpfs/file.c +++ b/fs/ncpfs/file.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include <linux/ncp_fs.h> | 22 | #include <linux/ncp_fs.h> |
23 | #include "ncplib_kernel.h" | 23 | #include "ncplib_kernel.h" |
24 | 24 | ||
25 | static int ncp_fsync(struct file *file, struct dentry *dentry, int datasync) | 25 | static int ncp_fsync(struct file *file, int datasync) |
26 | { | 26 | { |
27 | return 0; | 27 | return 0; |
28 | } | 28 | } |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index db64854b7b09..782b431ef91c 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -53,7 +53,7 @@ static int nfs_link(struct dentry *, struct inode *, struct dentry *); | |||
53 | static int nfs_mknod(struct inode *, struct dentry *, int, dev_t); | 53 | static int nfs_mknod(struct inode *, struct dentry *, int, dev_t); |
54 | static int nfs_rename(struct inode *, struct dentry *, | 54 | static int nfs_rename(struct inode *, struct dentry *, |
55 | struct inode *, struct dentry *); | 55 | struct inode *, struct dentry *); |
56 | static int nfs_fsync_dir(struct file *, struct dentry *, int); | 56 | static int nfs_fsync_dir(struct file *, int); |
57 | static loff_t nfs_llseek_dir(struct file *, loff_t, int); | 57 | static loff_t nfs_llseek_dir(struct file *, loff_t, int); |
58 | 58 | ||
59 | const struct file_operations nfs_dir_operations = { | 59 | const struct file_operations nfs_dir_operations = { |
@@ -641,8 +641,10 @@ out: | |||
641 | * All directory operations under NFS are synchronous, so fsync() | 641 | * All directory operations under NFS are synchronous, so fsync() |
642 | * is a dummy operation. | 642 | * is a dummy operation. |
643 | */ | 643 | */ |
644 | static int nfs_fsync_dir(struct file *filp, struct dentry *dentry, int datasync) | 644 | static int nfs_fsync_dir(struct file *filp, int datasync) |
645 | { | 645 | { |
646 | struct dentry *dentry = filp->f_path.dentry; | ||
647 | |||
646 | dfprintk(FILE, "NFS: fsync dir(%s/%s) datasync %d\n", | 648 | dfprintk(FILE, "NFS: fsync dir(%s/%s) datasync %d\n", |
647 | dentry->d_parent->d_name.name, dentry->d_name.name, | 649 | dentry->d_parent->d_name.name, dentry->d_name.name, |
648 | datasync); | 650 | datasync); |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index cac96bcc91e4..36a5e74f51b4 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -53,7 +53,7 @@ static ssize_t nfs_file_splice_write(struct pipe_inode_info *pipe, | |||
53 | static ssize_t nfs_file_write(struct kiocb *, const struct iovec *iov, | 53 | static ssize_t nfs_file_write(struct kiocb *, const struct iovec *iov, |
54 | unsigned long nr_segs, loff_t pos); | 54 | unsigned long nr_segs, loff_t pos); |
55 | static int nfs_file_flush(struct file *, fl_owner_t id); | 55 | static int nfs_file_flush(struct file *, fl_owner_t id); |
56 | static int nfs_file_fsync(struct file *, struct dentry *dentry, int datasync); | 56 | static int nfs_file_fsync(struct file *, int datasync); |
57 | static int nfs_check_flags(int flags); | 57 | static int nfs_check_flags(int flags); |
58 | static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl); | 58 | static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl); |
59 | static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl); | 59 | static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl); |
@@ -322,8 +322,9 @@ nfs_file_mmap(struct file * file, struct vm_area_struct * vma) | |||
322 | * whether any write errors occurred for this process. | 322 | * whether any write errors occurred for this process. |
323 | */ | 323 | */ |
324 | static int | 324 | static int |
325 | nfs_file_fsync(struct file *file, struct dentry *dentry, int datasync) | 325 | nfs_file_fsync(struct file *file, int datasync) |
326 | { | 326 | { |
327 | struct dentry *dentry = file->f_path.dentry; | ||
327 | struct nfs_open_context *ctx = nfs_file_open_context(file); | 328 | struct nfs_open_context *ctx = nfs_file_open_context(file); |
328 | struct inode *inode = dentry->d_inode; | 329 | struct inode *inode = dentry->d_inode; |
329 | 330 | ||
diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c index 30292df443ce..c9a30d7ff6fc 100644 --- a/fs/nilfs2/file.c +++ b/fs/nilfs2/file.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "nilfs.h" | 27 | #include "nilfs.h" |
28 | #include "segment.h" | 28 | #include "segment.h" |
29 | 29 | ||
30 | int nilfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | 30 | int nilfs_sync_file(struct file *file, int datasync) |
31 | { | 31 | { |
32 | /* | 32 | /* |
33 | * Called from fsync() system call | 33 | * Called from fsync() system call |
@@ -37,7 +37,7 @@ int nilfs_sync_file(struct file *file, struct dentry *dentry, int datasync) | |||
37 | * This function should be implemented when the writeback function | 37 | * This function should be implemented when the writeback function |
38 | * will be implemented. | 38 | * will be implemented. |
39 | */ | 39 | */ |
40 | struct inode *inode = dentry->d_inode; | 40 | struct inode *inode = file->f_mapping->host; |
41 | int err; | 41 | int err; |
42 | 42 | ||
43 | if (!nilfs_inode_dirty(inode)) | 43 | if (!nilfs_inode_dirty(inode)) |
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h index 8723e5bfd071..47d6d7928122 100644 --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h | |||
@@ -228,7 +228,7 @@ extern void nilfs_set_link(struct inode *, struct nilfs_dir_entry *, | |||
228 | struct page *, struct inode *); | 228 | struct page *, struct inode *); |
229 | 229 | ||
230 | /* file.c */ | 230 | /* file.c */ |
231 | extern int nilfs_sync_file(struct file *, struct dentry *, int); | 231 | extern int nilfs_sync_file(struct file *, int); |
232 | 232 | ||
233 | /* ioctl.c */ | 233 | /* ioctl.c */ |
234 | long nilfs_ioctl(struct file *, unsigned int, unsigned long); | 234 | long nilfs_ioctl(struct file *, unsigned int, unsigned long); |
diff --git a/fs/ntfs/dir.c b/fs/ntfs/dir.c index fe44d3feee4a..0f48e7c5d9e1 100644 --- a/fs/ntfs/dir.c +++ b/fs/ntfs/dir.c | |||
@@ -1527,10 +1527,9 @@ static int ntfs_dir_open(struct inode *vi, struct file *filp) | |||
1527 | * this problem for now. We do write the $BITMAP attribute if it is present | 1527 | * this problem for now. We do write the $BITMAP attribute if it is present |
1528 | * which is the important one for a directory so things are not too bad. | 1528 | * which is the important one for a directory so things are not too bad. |
1529 | */ | 1529 | */ |
1530 | static int ntfs_dir_fsync(struct file *filp, struct dentry *dentry, | 1530 | static int ntfs_dir_fsync(struct file *filp, int datasync) |
1531 | int datasync) | ||
1532 | { | 1531 | { |
1533 | struct inode *bmp_vi, *vi = dentry->d_inode; | 1532 | struct inode *bmp_vi, *vi = filp->f_mapping->host; |
1534 | int err, ret; | 1533 | int err, ret; |
1535 | ntfs_attr na; | 1534 | ntfs_attr na; |
1536 | 1535 | ||
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index a1924a0d2ab0..113ebd9f25a4 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -2133,7 +2133,6 @@ static ssize_t ntfs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
2133 | /** | 2133 | /** |
2134 | * ntfs_file_fsync - sync a file to disk | 2134 | * ntfs_file_fsync - sync a file to disk |
2135 | * @filp: file to be synced | 2135 | * @filp: file to be synced |
2136 | * @dentry: dentry describing the file to sync | ||
2137 | * @datasync: if non-zero only flush user data and not metadata | 2136 | * @datasync: if non-zero only flush user data and not metadata |
2138 | * | 2137 | * |
2139 | * Data integrity sync of a file to disk. Used for fsync, fdatasync, and msync | 2138 | * Data integrity sync of a file to disk. Used for fsync, fdatasync, and msync |
@@ -2149,19 +2148,15 @@ static ssize_t ntfs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
2149 | * Also, if @datasync is true, we do not wait on the inode to be written out | 2148 | * Also, if @datasync is true, we do not wait on the inode to be written out |
2150 | * but we always wait on the page cache pages to be written out. | 2149 | * but we always wait on the page cache pages to be written out. |
2151 | * | 2150 | * |
2152 | * Note: In the past @filp could be NULL so we ignore it as we don't need it | ||
2153 | * anyway. | ||
2154 | * | ||
2155 | * Locking: Caller must hold i_mutex on the inode. | 2151 | * Locking: Caller must hold i_mutex on the inode. |
2156 | * | 2152 | * |
2157 | * TODO: We should probably also write all attribute/index inodes associated | 2153 | * TODO: We should probably also write all attribute/index inodes associated |
2158 | * with this inode but since we have no simple way of getting to them we ignore | 2154 | * with this inode but since we have no simple way of getting to them we ignore |
2159 | * this problem for now. | 2155 | * this problem for now. |
2160 | */ | 2156 | */ |
2161 | static int ntfs_file_fsync(struct file *filp, struct dentry *dentry, | 2157 | static int ntfs_file_fsync(struct file *filp, int datasync) |
2162 | int datasync) | ||
2163 | { | 2158 | { |
2164 | struct inode *vi = dentry->d_inode; | 2159 | struct inode *vi = filp->f_mapping->host; |
2165 | int err, ret = 0; | 2160 | int err, ret = 0; |
2166 | 2161 | ||
2167 | ntfs_debug("Entering for inode 0x%lx.", vi->i_ino); | 2162 | ntfs_debug("Entering for inode 0x%lx.", vi->i_ino); |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 97e54b9e654b..6a13ea64c447 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -175,13 +175,12 @@ static int ocfs2_dir_release(struct inode *inode, struct file *file) | |||
175 | return 0; | 175 | return 0; |
176 | } | 176 | } |
177 | 177 | ||
178 | static int ocfs2_sync_file(struct file *file, | 178 | static int ocfs2_sync_file(struct file *file, int datasync) |
179 | struct dentry *dentry, | ||
180 | int datasync) | ||
181 | { | 179 | { |
182 | int err = 0; | 180 | int err = 0; |
183 | journal_t *journal; | 181 | journal_t *journal; |
184 | struct inode *inode = dentry->d_inode; | 182 | struct dentry *dentry = file->f_path.dentry; |
183 | struct inode *inode = file->f_mapping->host; | ||
185 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 184 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
186 | 185 | ||
187 | mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", file, dentry, datasync, | 186 | mlog_entry("(0x%p, 0x%p, %d, '%.*s')\n", file, dentry, datasync, |
@@ -1053,7 +1052,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr) | |||
1053 | } | 1052 | } |
1054 | 1053 | ||
1055 | /* | 1054 | /* |
1056 | * This will intentionally not wind up calling vmtruncate(), | 1055 | * This will intentionally not wind up calling simple_setsize(), |
1057 | * since all the work for a size change has been done above. | 1056 | * since all the work for a size change has been done above. |
1058 | * Otherwise, we could get into problems with truncate as | 1057 | * Otherwise, we could get into problems with truncate as |
1059 | * ip_alloc_sem is used there to protect against i_size | 1058 | * ip_alloc_sem is used there to protect against i_size |
@@ -2119,9 +2118,13 @@ relock: | |||
2119 | * direct write may have instantiated a few | 2118 | * direct write may have instantiated a few |
2120 | * blocks outside i_size. Trim these off again. | 2119 | * blocks outside i_size. Trim these off again. |
2121 | * Don't need i_size_read because we hold i_mutex. | 2120 | * Don't need i_size_read because we hold i_mutex. |
2121 | * | ||
2122 | * XXX(hch): this looks buggy because ocfs2 did not | ||
2123 | * actually implement ->truncate. Take a look at | ||
2124 | * the new truncate sequence and update this accordingly | ||
2122 | */ | 2125 | */ |
2123 | if (*ppos + count > inode->i_size) | 2126 | if (*ppos + count > inode->i_size) |
2124 | vmtruncate(inode, inode->i_size); | 2127 | simple_setsize(inode, inode->i_size); |
2125 | ret = written; | 2128 | ret = written; |
2126 | goto out_dio; | 2129 | goto out_dio; |
2127 | } | 2130 | } |
diff --git a/fs/omfs/file.c b/fs/omfs/file.c index 399487c09364..6e7a3291bbe8 100644 --- a/fs/omfs/file.c +++ b/fs/omfs/file.c | |||
@@ -329,7 +329,7 @@ const struct file_operations omfs_file_operations = { | |||
329 | .aio_read = generic_file_aio_read, | 329 | .aio_read = generic_file_aio_read, |
330 | .aio_write = generic_file_aio_write, | 330 | .aio_write = generic_file_aio_write, |
331 | .mmap = generic_file_mmap, | 331 | .mmap = generic_file_mmap, |
332 | .fsync = simple_fsync, | 332 | .fsync = generic_file_fsync, |
333 | .splice_read = generic_file_splice_read, | 333 | .splice_read = generic_file_splice_read, |
334 | }; | 334 | }; |
335 | 335 | ||
@@ -1169,14 +1169,18 @@ long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg) | |||
1169 | 1169 | ||
1170 | switch (cmd) { | 1170 | switch (cmd) { |
1171 | case F_SETPIPE_SZ: | 1171 | case F_SETPIPE_SZ: |
1172 | if (!capable(CAP_SYS_ADMIN) && arg > pipe_max_pages) | 1172 | if (!capable(CAP_SYS_ADMIN) && arg > pipe_max_pages) { |
1173 | return -EINVAL; | 1173 | ret = -EINVAL; |
1174 | goto out; | ||
1175 | } | ||
1174 | /* | 1176 | /* |
1175 | * The pipe needs to be at least 2 pages large to | 1177 | * The pipe needs to be at least 2 pages large to |
1176 | * guarantee POSIX behaviour. | 1178 | * guarantee POSIX behaviour. |
1177 | */ | 1179 | */ |
1178 | if (arg < 2) | 1180 | if (arg < 2) { |
1179 | return -EINVAL; | 1181 | ret = -EINVAL; |
1182 | goto out; | ||
1183 | } | ||
1180 | ret = pipe_set_size(pipe, arg); | 1184 | ret = pipe_set_size(pipe, arg); |
1181 | break; | 1185 | break; |
1182 | case F_GETPIPE_SZ: | 1186 | case F_GETPIPE_SZ: |
@@ -1187,6 +1191,7 @@ long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg) | |||
1187 | break; | 1191 | break; |
1188 | } | 1192 | } |
1189 | 1193 | ||
1194 | out: | ||
1190 | mutex_unlock(&pipe->inode->i_mutex); | 1195 | mutex_unlock(&pipe->inode->i_mutex); |
1191 | return ret; | 1196 | return ret; |
1192 | } | 1197 | } |
diff --git a/fs/qnx4/dir.c b/fs/qnx4/dir.c index 3d3fd4692133..6e8fc62b40a8 100644 --- a/fs/qnx4/dir.c +++ b/fs/qnx4/dir.c | |||
@@ -80,7 +80,7 @@ const struct file_operations qnx4_dir_operations = | |||
80 | .llseek = generic_file_llseek, | 80 | .llseek = generic_file_llseek, |
81 | .read = generic_read_dir, | 81 | .read = generic_read_dir, |
82 | .readdir = qnx4_readdir, | 82 | .readdir = qnx4_readdir, |
83 | .fsync = simple_fsync, | 83 | .fsync = generic_file_fsync, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | const struct inode_operations qnx4_dir_inode_operations = | 86 | const struct inode_operations qnx4_dir_inode_operations = |
diff --git a/fs/ramfs/file-mmu.c b/fs/ramfs/file-mmu.c index 78f613cb9c76..4884ac5ae9be 100644 --- a/fs/ramfs/file-mmu.c +++ b/fs/ramfs/file-mmu.c | |||
@@ -43,12 +43,13 @@ const struct file_operations ramfs_file_operations = { | |||
43 | .write = do_sync_write, | 43 | .write = do_sync_write, |
44 | .aio_write = generic_file_aio_write, | 44 | .aio_write = generic_file_aio_write, |
45 | .mmap = generic_file_mmap, | 45 | .mmap = generic_file_mmap, |
46 | .fsync = simple_sync_file, | 46 | .fsync = noop_fsync, |
47 | .splice_read = generic_file_splice_read, | 47 | .splice_read = generic_file_splice_read, |
48 | .splice_write = generic_file_splice_write, | 48 | .splice_write = generic_file_splice_write, |
49 | .llseek = generic_file_llseek, | 49 | .llseek = generic_file_llseek, |
50 | }; | 50 | }; |
51 | 51 | ||
52 | const struct inode_operations ramfs_file_inode_operations = { | 52 | const struct inode_operations ramfs_file_inode_operations = { |
53 | .setattr = simple_setattr, | ||
53 | .getattr = simple_getattr, | 54 | .getattr = simple_getattr, |
54 | }; | 55 | }; |
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c index 5ea4ad81a429..d532c20fc179 100644 --- a/fs/ramfs/file-nommu.c +++ b/fs/ramfs/file-nommu.c | |||
@@ -42,7 +42,7 @@ const struct file_operations ramfs_file_operations = { | |||
42 | .aio_read = generic_file_aio_read, | 42 | .aio_read = generic_file_aio_read, |
43 | .write = do_sync_write, | 43 | .write = do_sync_write, |
44 | .aio_write = generic_file_aio_write, | 44 | .aio_write = generic_file_aio_write, |
45 | .fsync = simple_sync_file, | 45 | .fsync = noop_fsync, |
46 | .splice_read = generic_file_splice_read, | 46 | .splice_read = generic_file_splice_read, |
47 | .splice_write = generic_file_splice_write, | 47 | .splice_write = generic_file_splice_write, |
48 | .llseek = generic_file_llseek, | 48 | .llseek = generic_file_llseek, |
@@ -146,7 +146,7 @@ static int ramfs_nommu_resize(struct inode *inode, loff_t newsize, loff_t size) | |||
146 | return ret; | 146 | return ret; |
147 | } | 147 | } |
148 | 148 | ||
149 | ret = vmtruncate(inode, newsize); | 149 | ret = simple_setsize(inode, newsize); |
150 | 150 | ||
151 | return ret; | 151 | return ret; |
152 | } | 152 | } |
@@ -169,7 +169,8 @@ static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia) | |||
169 | 169 | ||
170 | /* pick out size-changing events */ | 170 | /* pick out size-changing events */ |
171 | if (ia->ia_valid & ATTR_SIZE) { | 171 | if (ia->ia_valid & ATTR_SIZE) { |
172 | loff_t size = i_size_read(inode); | 172 | loff_t size = inode->i_size; |
173 | |||
173 | if (ia->ia_size != size) { | 174 | if (ia->ia_size != size) { |
174 | ret = ramfs_nommu_resize(inode, ia->ia_size, size); | 175 | ret = ramfs_nommu_resize(inode, ia->ia_size, size); |
175 | if (ret < 0 || ia->ia_valid == ATTR_SIZE) | 176 | if (ret < 0 || ia->ia_valid == ATTR_SIZE) |
@@ -182,7 +183,7 @@ static int ramfs_nommu_setattr(struct dentry *dentry, struct iattr *ia) | |||
182 | } | 183 | } |
183 | } | 184 | } |
184 | 185 | ||
185 | ret = inode_setattr(inode, ia); | 186 | generic_setattr(inode, ia); |
186 | out: | 187 | out: |
187 | ia->ia_valid = old_ia_valid; | 188 | ia->ia_valid = old_ia_valid; |
188 | return ret; | 189 | return ret; |
diff --git a/fs/reiserfs/dir.c b/fs/reiserfs/dir.c index 4455fbe269a3..198dabf1b2bb 100644 --- a/fs/reiserfs/dir.c +++ b/fs/reiserfs/dir.c | |||
@@ -14,8 +14,7 @@ | |||
14 | extern const struct reiserfs_key MIN_KEY; | 14 | extern const struct reiserfs_key MIN_KEY; |
15 | 15 | ||
16 | static int reiserfs_readdir(struct file *, void *, filldir_t); | 16 | static int reiserfs_readdir(struct file *, void *, filldir_t); |
17 | static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, | 17 | static int reiserfs_dir_fsync(struct file *filp, int datasync); |
18 | int datasync); | ||
19 | 18 | ||
20 | const struct file_operations reiserfs_dir_operations = { | 19 | const struct file_operations reiserfs_dir_operations = { |
21 | .llseek = generic_file_llseek, | 20 | .llseek = generic_file_llseek, |
@@ -28,10 +27,9 @@ const struct file_operations reiserfs_dir_operations = { | |||
28 | #endif | 27 | #endif |
29 | }; | 28 | }; |
30 | 29 | ||
31 | static int reiserfs_dir_fsync(struct file *filp, struct dentry *dentry, | 30 | static int reiserfs_dir_fsync(struct file *filp, int datasync) |
32 | int datasync) | ||
33 | { | 31 | { |
34 | struct inode *inode = dentry->d_inode; | 32 | struct inode *inode = filp->f_mapping->host; |
35 | int err; | 33 | int err; |
36 | reiserfs_write_lock(inode->i_sb); | 34 | reiserfs_write_lock(inode->i_sb); |
37 | err = reiserfs_commit_for_inode(inode); | 35 | err = reiserfs_commit_for_inode(inode); |
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index 9977df9f3a54..b82cdd8a45dd 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -134,10 +134,9 @@ static void reiserfs_vfs_truncate_file(struct inode *inode) | |||
134 | * be removed... | 134 | * be removed... |
135 | */ | 135 | */ |
136 | 136 | ||
137 | static int reiserfs_sync_file(struct file *filp, | 137 | static int reiserfs_sync_file(struct file *filp, int datasync) |
138 | struct dentry *dentry, int datasync) | ||
139 | { | 138 | { |
140 | struct inode *inode = dentry->d_inode; | 139 | struct inode *inode = filp->f_mapping->host; |
141 | int err; | 140 | int err; |
142 | int barrier_done; | 141 | int barrier_done; |
143 | 142 | ||
diff --git a/fs/smbfs/file.c b/fs/smbfs/file.c index 84ecf0e43f91..8e187a0f94bb 100644 --- a/fs/smbfs/file.c +++ b/fs/smbfs/file.c | |||
@@ -28,8 +28,9 @@ | |||
28 | #include "proto.h" | 28 | #include "proto.h" |
29 | 29 | ||
30 | static int | 30 | static int |
31 | smb_fsync(struct file *file, struct dentry * dentry, int datasync) | 31 | smb_fsync(struct file *file, int datasync) |
32 | { | 32 | { |
33 | struct dentry *dentry = file->f_path.dentry; | ||
33 | struct smb_sb_info *server = server_from_dentry(dentry); | 34 | struct smb_sb_info *server = server_from_dentry(dentry); |
34 | int result; | 35 | int result; |
35 | 36 | ||
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index dfa1d67f8fca..9551cb6f7fe4 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c | |||
@@ -714,7 +714,7 @@ smb_notify_change(struct dentry *dentry, struct iattr *attr) | |||
714 | error = server->ops->truncate(inode, attr->ia_size); | 714 | error = server->ops->truncate(inode, attr->ia_size); |
715 | if (error) | 715 | if (error) |
716 | goto out; | 716 | goto out; |
717 | error = vmtruncate(inode, attr->ia_size); | 717 | error = simple_setsize(inode, attr->ia_size); |
718 | if (error) | 718 | if (error) |
719 | goto out; | 719 | goto out; |
720 | refresh = 1; | 720 | refresh = 1; |
diff --git a/fs/super.c b/fs/super.c index 69688b15f1fa..a67409e5ad94 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -946,8 +946,8 @@ out: | |||
946 | EXPORT_SYMBOL_GPL(vfs_kern_mount); | 946 | EXPORT_SYMBOL_GPL(vfs_kern_mount); |
947 | 947 | ||
948 | /** | 948 | /** |
949 | * freeze_super -- lock the filesystem and force it into a consistent state | 949 | * freeze_super - lock the filesystem and force it into a consistent state |
950 | * @super: the super to lock | 950 | * @sb: the super to lock |
951 | * | 951 | * |
952 | * Syncs the super to make sure the filesystem is consistent and calls the fs's | 952 | * Syncs the super to make sure the filesystem is consistent and calls the fs's |
953 | * freeze_fs. Subsequent calls to this without first thawing the fs will return | 953 | * freeze_fs. Subsequent calls to this without first thawing the fs will return |
@@ -130,12 +130,10 @@ void emergency_sync(void) | |||
130 | 130 | ||
131 | /* | 131 | /* |
132 | * Generic function to fsync a file. | 132 | * Generic function to fsync a file. |
133 | * | ||
134 | * filp may be NULL if called via the msync of a vma. | ||
135 | */ | 133 | */ |
136 | int file_fsync(struct file *filp, struct dentry *dentry, int datasync) | 134 | int file_fsync(struct file *filp, int datasync) |
137 | { | 135 | { |
138 | struct inode * inode = dentry->d_inode; | 136 | struct inode *inode = filp->f_mapping->host; |
139 | struct super_block * sb; | 137 | struct super_block * sb; |
140 | int ret, err; | 138 | int ret, err; |
141 | 139 | ||
@@ -183,7 +181,7 @@ int vfs_fsync_range(struct file *file, loff_t start, loff_t end, int datasync) | |||
183 | * livelocks in fsync_buffers_list(). | 181 | * livelocks in fsync_buffers_list(). |
184 | */ | 182 | */ |
185 | mutex_lock(&mapping->host->i_mutex); | 183 | mutex_lock(&mapping->host->i_mutex); |
186 | err = file->f_op->fsync(file, file->f_path.dentry, datasync); | 184 | err = file->f_op->fsync(file, datasync); |
187 | if (!ret) | 185 | if (!ret) |
188 | ret = err; | 186 | ret = err; |
189 | mutex_unlock(&mapping->host->i_mutex); | 187 | mutex_unlock(&mapping->host->i_mutex); |
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index bbd77e95cf7f..bde1a4c3679a 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -117,13 +117,11 @@ int sysfs_setattr(struct dentry *dentry, struct iattr *iattr) | |||
117 | if (error) | 117 | if (error) |
118 | goto out; | 118 | goto out; |
119 | 119 | ||
120 | iattr->ia_valid &= ~ATTR_SIZE; /* ignore size changes */ | 120 | /* this ignores size changes */ |
121 | 121 | generic_setattr(inode, iattr); | |
122 | error = inode_setattr(inode, iattr); | ||
123 | if (error) | ||
124 | goto out; | ||
125 | 122 | ||
126 | error = sysfs_sd_setattr(sd, iattr); | 123 | error = sysfs_sd_setattr(sd, iattr); |
124 | |||
127 | out: | 125 | out: |
128 | mutex_unlock(&sysfs_mutex); | 126 | mutex_unlock(&sysfs_mutex); |
129 | return error; | 127 | return error; |
diff --git a/fs/sysv/dir.c b/fs/sysv/dir.c index 1dabed286b4c..79941e4964a4 100644 --- a/fs/sysv/dir.c +++ b/fs/sysv/dir.c | |||
@@ -24,7 +24,7 @@ const struct file_operations sysv_dir_operations = { | |||
24 | .llseek = generic_file_llseek, | 24 | .llseek = generic_file_llseek, |
25 | .read = generic_read_dir, | 25 | .read = generic_read_dir, |
26 | .readdir = sysv_readdir, | 26 | .readdir = sysv_readdir, |
27 | .fsync = simple_fsync, | 27 | .fsync = generic_file_fsync, |
28 | }; | 28 | }; |
29 | 29 | ||
30 | static inline void dir_put_page(struct page *page) | 30 | static inline void dir_put_page(struct page *page) |
diff --git a/fs/sysv/file.c b/fs/sysv/file.c index 96340c01f4a7..750cc22349bd 100644 --- a/fs/sysv/file.c +++ b/fs/sysv/file.c | |||
@@ -26,7 +26,7 @@ const struct file_operations sysv_file_operations = { | |||
26 | .write = do_sync_write, | 26 | .write = do_sync_write, |
27 | .aio_write = generic_file_aio_write, | 27 | .aio_write = generic_file_aio_write, |
28 | .mmap = generic_file_mmap, | 28 | .mmap = generic_file_mmap, |
29 | .fsync = simple_fsync, | 29 | .fsync = generic_file_fsync, |
30 | .splice_read = generic_file_splice_read, | 30 | .splice_read = generic_file_splice_read, |
31 | }; | 31 | }; |
32 | 32 | ||
diff --git a/fs/sysv/inode.c b/fs/sysv/inode.c index 4573734d723d..d4a5380b5669 100644 --- a/fs/sysv/inode.c +++ b/fs/sysv/inode.c | |||
@@ -43,6 +43,7 @@ static int sysv_sync_fs(struct super_block *sb, int wait) | |||
43 | * then attach current time stamp. | 43 | * then attach current time stamp. |
44 | * But if the filesystem was marked clean, keep it clean. | 44 | * But if the filesystem was marked clean, keep it clean. |
45 | */ | 45 | */ |
46 | sb->s_dirt = 0; | ||
46 | old_time = fs32_to_cpu(sbi, *sbi->s_sb_time); | 47 | old_time = fs32_to_cpu(sbi, *sbi->s_sb_time); |
47 | if (sbi->s_type == FSTYPE_SYSV4) { | 48 | if (sbi->s_type == FSTYPE_SYSV4) { |
48 | if (*sbi->s_sb_state == cpu_to_fs32(sbi, 0x7c269d38 - old_time)) | 49 | if (*sbi->s_sb_state == cpu_to_fs32(sbi, 0x7c269d38 - old_time)) |
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 5692cf72b807..12f445cee9f7 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c | |||
@@ -967,12 +967,15 @@ static int do_writepage(struct page *page, int len) | |||
967 | * the page locked, and it locks @ui_mutex. However, write-back does take inode | 967 | * the page locked, and it locks @ui_mutex. However, write-back does take inode |
968 | * @i_mutex, which means other VFS operations may be run on this inode at the | 968 | * @i_mutex, which means other VFS operations may be run on this inode at the |
969 | * same time. And the problematic one is truncation to smaller size, from where | 969 | * same time. And the problematic one is truncation to smaller size, from where |
970 | * we have to call 'vmtruncate()', which first changes @inode->i_size, then | 970 | * we have to call 'simple_setsize()', which first changes @inode->i_size, then |
971 | * drops the truncated pages. And while dropping the pages, it takes the page | 971 | * drops the truncated pages. And while dropping the pages, it takes the page |
972 | * lock. This means that 'do_truncation()' cannot call 'vmtruncate()' with | 972 | * lock. This means that 'do_truncation()' cannot call 'simple_setsize()' with |
973 | * @ui_mutex locked, because it would deadlock with 'ubifs_writepage()'. This | 973 | * @ui_mutex locked, because it would deadlock with 'ubifs_writepage()'. This |
974 | * means that @inode->i_size is changed while @ui_mutex is unlocked. | 974 | * means that @inode->i_size is changed while @ui_mutex is unlocked. |
975 | * | 975 | * |
976 | * XXX: with the new truncate the above is not true anymore, the simple_setsize | ||
977 | * calls can be replaced with the individual components. | ||
978 | * | ||
976 | * But in 'ubifs_writepage()' we have to guarantee that we do not write beyond | 979 | * But in 'ubifs_writepage()' we have to guarantee that we do not write beyond |
977 | * inode size. How do we do this if @inode->i_size may became smaller while we | 980 | * inode size. How do we do this if @inode->i_size may became smaller while we |
978 | * are in the middle of 'ubifs_writepage()'? The UBIFS solution is the | 981 | * are in the middle of 'ubifs_writepage()'? The UBIFS solution is the |
@@ -1125,7 +1128,7 @@ static int do_truncation(struct ubifs_info *c, struct inode *inode, | |||
1125 | budgeted = 0; | 1128 | budgeted = 0; |
1126 | } | 1129 | } |
1127 | 1130 | ||
1128 | err = vmtruncate(inode, new_size); | 1131 | err = simple_setsize(inode, new_size); |
1129 | if (err) | 1132 | if (err) |
1130 | goto out_budg; | 1133 | goto out_budg; |
1131 | 1134 | ||
@@ -1214,7 +1217,7 @@ static int do_setattr(struct ubifs_info *c, struct inode *inode, | |||
1214 | 1217 | ||
1215 | if (attr->ia_valid & ATTR_SIZE) { | 1218 | if (attr->ia_valid & ATTR_SIZE) { |
1216 | dbg_gen("size %lld -> %lld", inode->i_size, new_size); | 1219 | dbg_gen("size %lld -> %lld", inode->i_size, new_size); |
1217 | err = vmtruncate(inode, new_size); | 1220 | err = simple_setsize(inode, new_size); |
1218 | if (err) | 1221 | if (err) |
1219 | goto out; | 1222 | goto out; |
1220 | } | 1223 | } |
@@ -1223,7 +1226,7 @@ static int do_setattr(struct ubifs_info *c, struct inode *inode, | |||
1223 | if (attr->ia_valid & ATTR_SIZE) { | 1226 | if (attr->ia_valid & ATTR_SIZE) { |
1224 | /* Truncation changes inode [mc]time */ | 1227 | /* Truncation changes inode [mc]time */ |
1225 | inode->i_mtime = inode->i_ctime = ubifs_current_time(inode); | 1228 | inode->i_mtime = inode->i_ctime = ubifs_current_time(inode); |
1226 | /* 'vmtruncate()' changed @i_size, update @ui_size */ | 1229 | /* 'simple_setsize()' changed @i_size, update @ui_size */ |
1227 | ui->ui_size = inode->i_size; | 1230 | ui->ui_size = inode->i_size; |
1228 | } | 1231 | } |
1229 | 1232 | ||
@@ -1304,9 +1307,9 @@ static void *ubifs_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
1304 | return NULL; | 1307 | return NULL; |
1305 | } | 1308 | } |
1306 | 1309 | ||
1307 | int ubifs_fsync(struct file *file, struct dentry *dentry, int datasync) | 1310 | int ubifs_fsync(struct file *file, int datasync) |
1308 | { | 1311 | { |
1309 | struct inode *inode = dentry->d_inode; | 1312 | struct inode *inode = file->f_mapping->host; |
1310 | struct ubifs_info *c = inode->i_sb->s_fs_info; | 1313 | struct ubifs_info *c = inode->i_sb->s_fs_info; |
1311 | int err; | 1314 | int err; |
1312 | 1315 | ||
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index bd2542dad014..2eef553d50c8 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
@@ -379,7 +379,7 @@ struct ubifs_gced_idx_leb { | |||
379 | * The @ui_size is a "shadow" variable for @inode->i_size and UBIFS uses | 379 | * The @ui_size is a "shadow" variable for @inode->i_size and UBIFS uses |
380 | * @ui_size instead of @inode->i_size. The reason for this is that UBIFS cannot | 380 | * @ui_size instead of @inode->i_size. The reason for this is that UBIFS cannot |
381 | * make sure @inode->i_size is always changed under @ui_mutex, because it | 381 | * make sure @inode->i_size is always changed under @ui_mutex, because it |
382 | * cannot call 'vmtruncate()' with @ui_mutex locked, because it would deadlock | 382 | * cannot call 'simple_setsize()' with @ui_mutex locked, because it would deadlock |
383 | * with 'ubifs_writepage()' (see file.c). All the other inode fields are | 383 | * with 'ubifs_writepage()' (see file.c). All the other inode fields are |
384 | * changed under @ui_mutex, so they do not need "shadow" fields. Note, one | 384 | * changed under @ui_mutex, so they do not need "shadow" fields. Note, one |
385 | * could consider to rework locking and base it on "shadow" fields. | 385 | * could consider to rework locking and base it on "shadow" fields. |
@@ -1678,7 +1678,7 @@ const struct ubifs_lprops *ubifs_fast_find_frdi_idx(struct ubifs_info *c); | |||
1678 | int ubifs_calc_dark(const struct ubifs_info *c, int spc); | 1678 | int ubifs_calc_dark(const struct ubifs_info *c, int spc); |
1679 | 1679 | ||
1680 | /* file.c */ | 1680 | /* file.c */ |
1681 | int ubifs_fsync(struct file *file, struct dentry *dentry, int datasync); | 1681 | int ubifs_fsync(struct file *file, int datasync); |
1682 | int ubifs_setattr(struct dentry *dentry, struct iattr *attr); | 1682 | int ubifs_setattr(struct dentry *dentry, struct iattr *attr); |
1683 | 1683 | ||
1684 | /* dir.c */ | 1684 | /* dir.c */ |
diff --git a/fs/udf/dir.c b/fs/udf/dir.c index 1660c81ffa3d..51552bf50225 100644 --- a/fs/udf/dir.c +++ b/fs/udf/dir.c | |||
@@ -211,5 +211,5 @@ const struct file_operations udf_dir_operations = { | |||
211 | .read = generic_read_dir, | 211 | .read = generic_read_dir, |
212 | .readdir = udf_readdir, | 212 | .readdir = udf_readdir, |
213 | .unlocked_ioctl = udf_ioctl, | 213 | .unlocked_ioctl = udf_ioctl, |
214 | .fsync = simple_fsync, | 214 | .fsync = generic_file_fsync, |
215 | }; | 215 | }; |
diff --git a/fs/udf/file.c b/fs/udf/file.c index baae3a723946..0660280aa180 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -224,7 +224,7 @@ const struct file_operations udf_file_operations = { | |||
224 | .write = do_sync_write, | 224 | .write = do_sync_write, |
225 | .aio_write = udf_file_aio_write, | 225 | .aio_write = udf_file_aio_write, |
226 | .release = udf_release_file, | 226 | .release = udf_release_file, |
227 | .fsync = simple_fsync, | 227 | .fsync = generic_file_fsync, |
228 | .splice_read = generic_file_splice_read, | 228 | .splice_read = generic_file_splice_read, |
229 | .llseek = generic_file_llseek, | 229 | .llseek = generic_file_llseek, |
230 | }; | 230 | }; |
diff --git a/fs/ufs/dir.c b/fs/ufs/dir.c index 317a0d444f6b..ec784756dc65 100644 --- a/fs/ufs/dir.c +++ b/fs/ufs/dir.c | |||
@@ -666,6 +666,6 @@ not_empty: | |||
666 | const struct file_operations ufs_dir_operations = { | 666 | const struct file_operations ufs_dir_operations = { |
667 | .read = generic_read_dir, | 667 | .read = generic_read_dir, |
668 | .readdir = ufs_readdir, | 668 | .readdir = ufs_readdir, |
669 | .fsync = simple_fsync, | 669 | .fsync = generic_file_fsync, |
670 | .llseek = generic_file_llseek, | 670 | .llseek = generic_file_llseek, |
671 | }; | 671 | }; |
diff --git a/fs/ufs/file.c b/fs/ufs/file.c index a8962cecde5b..d4c30d1bef86 100644 --- a/fs/ufs/file.c +++ b/fs/ufs/file.c | |||
@@ -42,6 +42,6 @@ const struct file_operations ufs_file_operations = { | |||
42 | .aio_write = generic_file_aio_write, | 42 | .aio_write = generic_file_aio_write, |
43 | .mmap = generic_file_mmap, | 43 | .mmap = generic_file_mmap, |
44 | .open = dquot_file_open, | 44 | .open = dquot_file_open, |
45 | .fsync = simple_fsync, | 45 | .fsync = generic_file_fsync, |
46 | .splice_read = generic_file_splice_read, | 46 | .splice_read = generic_file_splice_read, |
47 | }; | 47 | }; |
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c index f294c44577dc..3733057e7833 100644 --- a/fs/ufs/truncate.c +++ b/fs/ufs/truncate.c | |||
@@ -501,12 +501,10 @@ out: | |||
501 | return err; | 501 | return err; |
502 | } | 502 | } |
503 | 503 | ||
504 | |||
505 | /* | 504 | /* |
506 | * We don't define our `inode->i_op->truncate', and call it here, | 505 | * TODO: |
507 | * because of: | 506 | * - truncate case should use proper ordering instead of using |
508 | * - there is no way to know old size | 507 | * simple_setsize |
509 | * - there is no way inform user about error, if it happens in `truncate' | ||
510 | */ | 508 | */ |
511 | int ufs_setattr(struct dentry *dentry, struct iattr *attr) | 509 | int ufs_setattr(struct dentry *dentry, struct iattr *attr) |
512 | { | 510 | { |
@@ -530,7 +528,7 @@ int ufs_setattr(struct dentry *dentry, struct iattr *attr) | |||
530 | if (ia_valid & ATTR_SIZE && attr->ia_size != inode->i_size) { | 528 | if (ia_valid & ATTR_SIZE && attr->ia_size != inode->i_size) { |
531 | loff_t old_i_size = inode->i_size; | 529 | loff_t old_i_size = inode->i_size; |
532 | 530 | ||
533 | error = vmtruncate(inode, attr->ia_size); | 531 | error = simple_setsize(inode, attr->ia_size); |
534 | if (error) | 532 | if (error) |
535 | return error; | 533 | return error; |
536 | error = ufs_truncate(inode, old_i_size); | 534 | error = ufs_truncate(inode, old_i_size); |
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index d8fb1b5d6cb5..257a56b127cf 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
@@ -100,10 +100,10 @@ xfs_iozero( | |||
100 | STATIC int | 100 | STATIC int |
101 | xfs_file_fsync( | 101 | xfs_file_fsync( |
102 | struct file *file, | 102 | struct file *file, |
103 | struct dentry *dentry, | ||
104 | int datasync) | 103 | int datasync) |
105 | { | 104 | { |
106 | struct xfs_inode *ip = XFS_I(dentry->d_inode); | 105 | struct inode *inode = file->f_mapping->host; |
106 | struct xfs_inode *ip = XFS_I(inode); | ||
107 | struct xfs_trans *tp; | 107 | struct xfs_trans *tp; |
108 | int error = 0; | 108 | int error = 0; |
109 | int log_flushed = 0; | 109 | int log_flushed = 0; |
@@ -140,8 +140,8 @@ xfs_file_fsync( | |||
140 | * might gets cleared when the inode gets written out via the AIL | 140 | * might gets cleared when the inode gets written out via the AIL |
141 | * or xfs_iflush_cluster. | 141 | * or xfs_iflush_cluster. |
142 | */ | 142 | */ |
143 | if (((dentry->d_inode->i_state & I_DIRTY_DATASYNC) || | 143 | if (((inode->i_state & I_DIRTY_DATASYNC) || |
144 | ((dentry->d_inode->i_state & I_DIRTY_SYNC) && !datasync)) && | 144 | ((inode->i_state & I_DIRTY_SYNC) && !datasync)) && |
145 | ip->i_update_core) { | 145 | ip->i_update_core) { |
146 | /* | 146 | /* |
147 | * Kick off a transaction to log the inode core to get the | 147 | * Kick off a transaction to log the inode core to get the |
@@ -868,7 +868,7 @@ write_retry: | |||
868 | mutex_lock(&inode->i_mutex); | 868 | mutex_lock(&inode->i_mutex); |
869 | xfs_ilock(ip, iolock); | 869 | xfs_ilock(ip, iolock); |
870 | 870 | ||
871 | error2 = -xfs_file_fsync(file, file->f_path.dentry, | 871 | error2 = -xfs_file_fsync(file, |
872 | (file->f_flags & __O_SYNC) ? 0 : 1); | 872 | (file->f_flags & __O_SYNC) ? 0 : 1); |
873 | if (!error) | 873 | if (!error) |
874 | error = error2; | 874 | error = error2; |
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 16ed0284d780..1b9ba193b789 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h | |||
@@ -203,6 +203,9 @@ int block_write_full_page_endio(struct page *page, get_block_t *get_block, | |||
203 | int block_read_full_page(struct page*, get_block_t*); | 203 | int block_read_full_page(struct page*, get_block_t*); |
204 | int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc, | 204 | int block_is_partially_uptodate(struct page *page, read_descriptor_t *desc, |
205 | unsigned long from); | 205 | unsigned long from); |
206 | int block_write_begin_newtrunc(struct file *, struct address_space *, | ||
207 | loff_t, unsigned, unsigned, | ||
208 | struct page **, void **, get_block_t*); | ||
206 | int block_write_begin(struct file *, struct address_space *, | 209 | int block_write_begin(struct file *, struct address_space *, |
207 | loff_t, unsigned, unsigned, | 210 | loff_t, unsigned, unsigned, |
208 | struct page **, void **, get_block_t*); | 211 | struct page **, void **, get_block_t*); |
@@ -214,6 +217,9 @@ int generic_write_end(struct file *, struct address_space *, | |||
214 | struct page *, void *); | 217 | struct page *, void *); |
215 | void page_zero_new_buffers(struct page *page, unsigned from, unsigned to); | 218 | void page_zero_new_buffers(struct page *page, unsigned from, unsigned to); |
216 | int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*); | 219 | int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*); |
220 | int cont_write_begin_newtrunc(struct file *, struct address_space *, loff_t, | ||
221 | unsigned, unsigned, struct page **, void **, | ||
222 | get_block_t *, loff_t *); | ||
217 | int cont_write_begin(struct file *, struct address_space *, loff_t, | 223 | int cont_write_begin(struct file *, struct address_space *, loff_t, |
218 | unsigned, unsigned, struct page **, void **, | 224 | unsigned, unsigned, struct page **, void **, |
219 | get_block_t *, loff_t *); | 225 | get_block_t *, loff_t *); |
@@ -224,7 +230,10 @@ int block_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf, | |||
224 | void block_sync_page(struct page *); | 230 | void block_sync_page(struct page *); |
225 | sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); | 231 | sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *); |
226 | int block_truncate_page(struct address_space *, loff_t, get_block_t *); | 232 | int block_truncate_page(struct address_space *, loff_t, get_block_t *); |
227 | int file_fsync(struct file *, struct dentry *, int); | 233 | int file_fsync(struct file *, int); |
234 | int nobh_write_begin_newtrunc(struct file *, struct address_space *, | ||
235 | loff_t, unsigned, unsigned, | ||
236 | struct page **, void **, get_block_t*); | ||
228 | int nobh_write_begin(struct file *, struct address_space *, | 237 | int nobh_write_begin(struct file *, struct address_space *, |
229 | loff_t, unsigned, unsigned, | 238 | loff_t, unsigned, unsigned, |
230 | struct page **, void **, get_block_t*); | 239 | struct page **, void **, get_block_t*); |
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h index 5f494b465097..7fc62d4550b2 100644 --- a/include/linux/ext3_fs.h +++ b/include/linux/ext3_fs.h | |||
@@ -868,7 +868,7 @@ extern int ext3_htree_store_dirent(struct file *dir_file, __u32 hash, | |||
868 | extern void ext3_htree_free_dir_info(struct dir_private_info *p); | 868 | extern void ext3_htree_free_dir_info(struct dir_private_info *p); |
869 | 869 | ||
870 | /* fsync.c */ | 870 | /* fsync.c */ |
871 | extern int ext3_sync_file (struct file *, struct dentry *, int); | 871 | extern int ext3_sync_file(struct file *, int); |
872 | 872 | ||
873 | /* hash.c */ | 873 | /* hash.c */ |
874 | extern int ext3fs_dirhash(const char *name, int len, struct | 874 | extern int ext3fs_dirhash(const char *name, int len, struct |
diff --git a/include/linux/fb.h b/include/linux/fb.h index f3793ebc241c..907ace3a64c8 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
@@ -4,8 +4,6 @@ | |||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/i2c.h> | 5 | #include <linux/i2c.h> |
6 | 6 | ||
7 | struct dentry; | ||
8 | |||
9 | /* Definitions of frame buffers */ | 7 | /* Definitions of frame buffers */ |
10 | 8 | ||
11 | #define FB_MAX 32 /* sufficient for now */ | 9 | #define FB_MAX 32 /* sufficient for now */ |
@@ -1017,8 +1015,7 @@ extern void fb_deferred_io_open(struct fb_info *info, | |||
1017 | struct inode *inode, | 1015 | struct inode *inode, |
1018 | struct file *file); | 1016 | struct file *file); |
1019 | extern void fb_deferred_io_cleanup(struct fb_info *info); | 1017 | extern void fb_deferred_io_cleanup(struct fb_info *info); |
1020 | extern int fb_deferred_io_fsync(struct file *file, struct dentry *dentry, | 1018 | extern int fb_deferred_io_fsync(struct file *file, int datasync); |
1021 | int datasync); | ||
1022 | 1019 | ||
1023 | static inline bool fb_be_math(struct fb_info *info) | 1020 | static inline bool fb_be_math(struct fb_info *info) |
1024 | { | 1021 | { |
diff --git a/include/linux/file.h b/include/linux/file.h index 5555508fd517..b1e12970f617 100644 --- a/include/linux/file.h +++ b/include/linux/file.h | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | struct file; | 12 | struct file; |
13 | 13 | ||
14 | extern void __fput(struct file *); | ||
15 | extern void fput(struct file *); | 14 | extern void fput(struct file *); |
16 | extern void drop_file_write_access(struct file *file); | 15 | extern void drop_file_write_access(struct file *file); |
17 | 16 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index 85e823adcd4a..3428393942a6 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -954,6 +954,7 @@ extern spinlock_t files_lock; | |||
954 | #define file_list_unlock() spin_unlock(&files_lock); | 954 | #define file_list_unlock() spin_unlock(&files_lock); |
955 | 955 | ||
956 | #define get_file(x) atomic_long_inc(&(x)->f_count) | 956 | #define get_file(x) atomic_long_inc(&(x)->f_count) |
957 | #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1) | ||
957 | #define file_count(x) atomic_long_read(&(x)->f_count) | 958 | #define file_count(x) atomic_long_read(&(x)->f_count) |
958 | 959 | ||
959 | #ifdef CONFIG_DEBUG_WRITECOUNT | 960 | #ifdef CONFIG_DEBUG_WRITECOUNT |
@@ -1497,7 +1498,7 @@ struct file_operations { | |||
1497 | int (*open) (struct inode *, struct file *); | 1498 | int (*open) (struct inode *, struct file *); |
1498 | int (*flush) (struct file *, fl_owner_t id); | 1499 | int (*flush) (struct file *, fl_owner_t id); |
1499 | int (*release) (struct inode *, struct file *); | 1500 | int (*release) (struct inode *, struct file *); |
1500 | int (*fsync) (struct file *, struct dentry *, int datasync); | 1501 | int (*fsync) (struct file *, int datasync); |
1501 | int (*aio_fsync) (struct kiocb *, int datasync); | 1502 | int (*aio_fsync) (struct kiocb *, int datasync); |
1502 | int (*fasync) (int, struct file *, int); | 1503 | int (*fasync) (int, struct file *, int); |
1503 | int (*lock) (struct file *, int, struct file_lock *); | 1504 | int (*lock) (struct file *, int, struct file_lock *); |
@@ -2212,7 +2213,7 @@ extern int generic_segment_checks(const struct iovec *iov, | |||
2212 | /* fs/block_dev.c */ | 2213 | /* fs/block_dev.c */ |
2213 | extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, | 2214 | extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, |
2214 | unsigned long nr_segs, loff_t pos); | 2215 | unsigned long nr_segs, loff_t pos); |
2215 | extern int blkdev_fsync(struct file *filp, struct dentry *dentry, int datasync); | 2216 | extern int blkdev_fsync(struct file *filp, int datasync); |
2216 | 2217 | ||
2217 | /* fs/splice.c */ | 2218 | /* fs/splice.c */ |
2218 | extern ssize_t generic_file_splice_read(struct file *, loff_t *, | 2219 | extern ssize_t generic_file_splice_read(struct file *, loff_t *, |
@@ -2256,6 +2257,10 @@ typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode, | |||
2256 | loff_t file_offset); | 2257 | loff_t file_offset); |
2257 | void dio_end_io(struct bio *bio, int error); | 2258 | void dio_end_io(struct bio *bio, int error); |
2258 | 2259 | ||
2260 | ssize_t __blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb, struct inode *inode, | ||
2261 | struct block_device *bdev, const struct iovec *iov, loff_t offset, | ||
2262 | unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, | ||
2263 | dio_submit_t submit_io, int lock_type); | ||
2259 | ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | 2264 | ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, |
2260 | struct block_device *bdev, const struct iovec *iov, loff_t offset, | 2265 | struct block_device *bdev, const struct iovec *iov, loff_t offset, |
2261 | unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, | 2266 | unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io, |
@@ -2269,6 +2274,24 @@ enum { | |||
2269 | DIO_SKIP_HOLES = 0x02, | 2274 | DIO_SKIP_HOLES = 0x02, |
2270 | }; | 2275 | }; |
2271 | 2276 | ||
2277 | static inline ssize_t blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb, | ||
2278 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, | ||
2279 | loff_t offset, unsigned long nr_segs, get_block_t get_block, | ||
2280 | dio_iodone_t end_io) | ||
2281 | { | ||
2282 | return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset, | ||
2283 | nr_segs, get_block, end_io, NULL, | ||
2284 | DIO_LOCKING | DIO_SKIP_HOLES); | ||
2285 | } | ||
2286 | |||
2287 | static inline ssize_t blockdev_direct_IO_no_locking_newtrunc(int rw, struct kiocb *iocb, | ||
2288 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, | ||
2289 | loff_t offset, unsigned long nr_segs, get_block_t get_block, | ||
2290 | dio_iodone_t end_io) | ||
2291 | { | ||
2292 | return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset, | ||
2293 | nr_segs, get_block, end_io, NULL, 0); | ||
2294 | } | ||
2272 | static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, | 2295 | static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, |
2273 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, | 2296 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, |
2274 | loff_t offset, unsigned long nr_segs, get_block_t get_block, | 2297 | loff_t offset, unsigned long nr_segs, get_block_t get_block, |
@@ -2341,13 +2364,15 @@ extern int dcache_dir_open(struct inode *, struct file *); | |||
2341 | extern int dcache_dir_close(struct inode *, struct file *); | 2364 | extern int dcache_dir_close(struct inode *, struct file *); |
2342 | extern loff_t dcache_dir_lseek(struct file *, loff_t, int); | 2365 | extern loff_t dcache_dir_lseek(struct file *, loff_t, int); |
2343 | extern int dcache_readdir(struct file *, void *, filldir_t); | 2366 | extern int dcache_readdir(struct file *, void *, filldir_t); |
2367 | extern int simple_setattr(struct dentry *, struct iattr *); | ||
2344 | extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 2368 | extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
2345 | extern int simple_statfs(struct dentry *, struct kstatfs *); | 2369 | extern int simple_statfs(struct dentry *, struct kstatfs *); |
2346 | extern int simple_link(struct dentry *, struct inode *, struct dentry *); | 2370 | extern int simple_link(struct dentry *, struct inode *, struct dentry *); |
2347 | extern int simple_unlink(struct inode *, struct dentry *); | 2371 | extern int simple_unlink(struct inode *, struct dentry *); |
2348 | extern int simple_rmdir(struct inode *, struct dentry *); | 2372 | extern int simple_rmdir(struct inode *, struct dentry *); |
2349 | extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); | 2373 | extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); |
2350 | extern int simple_sync_file(struct file *, struct dentry *, int); | 2374 | extern int simple_setsize(struct inode *, loff_t); |
2375 | extern int noop_fsync(struct file *, int); | ||
2351 | extern int simple_empty(struct dentry *); | 2376 | extern int simple_empty(struct dentry *); |
2352 | extern int simple_readpage(struct file *file, struct page *page); | 2377 | extern int simple_readpage(struct file *file, struct page *page); |
2353 | extern int simple_write_begin(struct file *file, struct address_space *mapping, | 2378 | extern int simple_write_begin(struct file *file, struct address_space *mapping, |
@@ -2372,7 +2397,7 @@ extern ssize_t simple_read_from_buffer(void __user *to, size_t count, | |||
2372 | extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, | 2397 | extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos, |
2373 | const void __user *from, size_t count); | 2398 | const void __user *from, size_t count); |
2374 | 2399 | ||
2375 | extern int simple_fsync(struct file *, struct dentry *, int); | 2400 | extern int generic_file_fsync(struct file *, int); |
2376 | 2401 | ||
2377 | #ifdef CONFIG_MIGRATION | 2402 | #ifdef CONFIG_MIGRATION |
2378 | extern int buffer_migrate_page(struct address_space *, | 2403 | extern int buffer_migrate_page(struct address_space *, |
@@ -2383,7 +2408,8 @@ extern int buffer_migrate_page(struct address_space *, | |||
2383 | 2408 | ||
2384 | extern int inode_change_ok(const struct inode *, struct iattr *); | 2409 | extern int inode_change_ok(const struct inode *, struct iattr *); |
2385 | extern int inode_newsize_ok(const struct inode *, loff_t offset); | 2410 | extern int inode_newsize_ok(const struct inode *, loff_t offset); |
2386 | extern int __must_check inode_setattr(struct inode *, struct iattr *); | 2411 | extern int __must_check inode_setattr(struct inode *, const struct iattr *); |
2412 | extern void generic_setattr(struct inode *inode, const struct iattr *attr); | ||
2387 | 2413 | ||
2388 | extern void file_update_time(struct file *file); | 2414 | extern void file_update_time(struct file *file); |
2389 | 2415 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index ee84e7e12039..3bad2701bfa6 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -386,6 +386,7 @@ enum { | |||
386 | ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */ | 386 | ATA_HORKAGE_1_5_GBPS = (1 << 13), /* force 1.5 Gbps */ |
387 | ATA_HORKAGE_NOSETXFER = (1 << 14), /* skip SETXFER, SATA only */ | 387 | ATA_HORKAGE_NOSETXFER = (1 << 14), /* skip SETXFER, SATA only */ |
388 | ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */ | 388 | ATA_HORKAGE_BROKEN_FPDMA_AA = (1 << 15), /* skip AA */ |
389 | ATA_HORKAGE_DUMP_ID = (1 << 16), /* dump IDENTIFY data */ | ||
389 | 390 | ||
390 | /* DMA mask for user DMA control: User visible values; DO NOT | 391 | /* DMA mask for user DMA control: User visible values; DO NOT |
391 | renumber */ | 392 | renumber */ |
@@ -513,7 +514,9 @@ struct ata_ioports { | |||
513 | void __iomem *command_addr; | 514 | void __iomem *command_addr; |
514 | void __iomem *altstatus_addr; | 515 | void __iomem *altstatus_addr; |
515 | void __iomem *ctl_addr; | 516 | void __iomem *ctl_addr; |
517 | #ifdef CONFIG_ATA_BMDMA | ||
516 | void __iomem *bmdma_addr; | 518 | void __iomem *bmdma_addr; |
519 | #endif /* CONFIG_ATA_BMDMA */ | ||
517 | void __iomem *scr_addr; | 520 | void __iomem *scr_addr; |
518 | }; | 521 | }; |
519 | #endif /* CONFIG_ATA_SFF */ | 522 | #endif /* CONFIG_ATA_SFF */ |
@@ -721,8 +724,10 @@ struct ata_port { | |||
721 | u8 ctl; /* cache of ATA control register */ | 724 | u8 ctl; /* cache of ATA control register */ |
722 | u8 last_ctl; /* Cache last written value */ | 725 | u8 last_ctl; /* Cache last written value */ |
723 | struct delayed_work sff_pio_task; | 726 | struct delayed_work sff_pio_task; |
727 | #ifdef CONFIG_ATA_BMDMA | ||
724 | struct ata_bmdma_prd *bmdma_prd; /* BMDMA SG list */ | 728 | struct ata_bmdma_prd *bmdma_prd; /* BMDMA SG list */ |
725 | dma_addr_t bmdma_prd_dma; /* and its DMA mapping */ | 729 | dma_addr_t bmdma_prd_dma; /* and its DMA mapping */ |
730 | #endif /* CONFIG_ATA_BMDMA */ | ||
726 | #endif /* CONFIG_ATA_SFF */ | 731 | #endif /* CONFIG_ATA_SFF */ |
727 | 732 | ||
728 | unsigned int pio_mask; | 733 | unsigned int pio_mask; |
@@ -856,10 +861,12 @@ struct ata_port_operations { | |||
856 | void (*sff_irq_clear)(struct ata_port *); | 861 | void (*sff_irq_clear)(struct ata_port *); |
857 | void (*sff_drain_fifo)(struct ata_queued_cmd *qc); | 862 | void (*sff_drain_fifo)(struct ata_queued_cmd *qc); |
858 | 863 | ||
864 | #ifdef CONFIG_ATA_BMDMA | ||
859 | void (*bmdma_setup)(struct ata_queued_cmd *qc); | 865 | void (*bmdma_setup)(struct ata_queued_cmd *qc); |
860 | void (*bmdma_start)(struct ata_queued_cmd *qc); | 866 | void (*bmdma_start)(struct ata_queued_cmd *qc); |
861 | void (*bmdma_stop)(struct ata_queued_cmd *qc); | 867 | void (*bmdma_stop)(struct ata_queued_cmd *qc); |
862 | u8 (*bmdma_status)(struct ata_port *ap); | 868 | u8 (*bmdma_status)(struct ata_port *ap); |
869 | #endif /* CONFIG_ATA_BMDMA */ | ||
863 | #endif /* CONFIG_ATA_SFF */ | 870 | #endif /* CONFIG_ATA_SFF */ |
864 | 871 | ||
865 | ssize_t (*em_show)(struct ata_port *ap, char *buf); | 872 | ssize_t (*em_show)(struct ata_port *ap, char *buf); |
@@ -1555,7 +1562,6 @@ extern void sata_pmp_error_handler(struct ata_port *ap); | |||
1555 | #ifdef CONFIG_ATA_SFF | 1562 | #ifdef CONFIG_ATA_SFF |
1556 | 1563 | ||
1557 | extern const struct ata_port_operations ata_sff_port_ops; | 1564 | extern const struct ata_port_operations ata_sff_port_ops; |
1558 | extern const struct ata_port_operations ata_bmdma_port_ops; | ||
1559 | extern const struct ata_port_operations ata_bmdma32_port_ops; | 1565 | extern const struct ata_port_operations ata_bmdma32_port_ops; |
1560 | 1566 | ||
1561 | /* PIO only, sg_tablesize and dma_boundary limits can be removed */ | 1567 | /* PIO only, sg_tablesize and dma_boundary limits can be removed */ |
@@ -1564,11 +1570,6 @@ extern const struct ata_port_operations ata_bmdma32_port_ops; | |||
1564 | .sg_tablesize = LIBATA_MAX_PRD, \ | 1570 | .sg_tablesize = LIBATA_MAX_PRD, \ |
1565 | .dma_boundary = ATA_DMA_BOUNDARY | 1571 | .dma_boundary = ATA_DMA_BOUNDARY |
1566 | 1572 | ||
1567 | #define ATA_BMDMA_SHT(drv_name) \ | ||
1568 | ATA_BASE_SHT(drv_name), \ | ||
1569 | .sg_tablesize = LIBATA_MAX_PRD, \ | ||
1570 | .dma_boundary = ATA_DMA_BOUNDARY | ||
1571 | |||
1572 | extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device); | 1573 | extern void ata_sff_dev_select(struct ata_port *ap, unsigned int device); |
1573 | extern u8 ata_sff_check_status(struct ata_port *ap); | 1574 | extern u8 ata_sff_check_status(struct ata_port *ap); |
1574 | extern void ata_sff_pause(struct ata_port *ap); | 1575 | extern void ata_sff_pause(struct ata_port *ap); |
@@ -1593,7 +1594,7 @@ extern int ata_sff_hsm_move(struct ata_port *ap, struct ata_queued_cmd *qc, | |||
1593 | extern void ata_sff_queue_pio_task(struct ata_port *ap, unsigned long delay); | 1594 | extern void ata_sff_queue_pio_task(struct ata_port *ap, unsigned long delay); |
1594 | extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); | 1595 | extern unsigned int ata_sff_qc_issue(struct ata_queued_cmd *qc); |
1595 | extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); | 1596 | extern bool ata_sff_qc_fill_rtf(struct ata_queued_cmd *qc); |
1596 | extern unsigned int ata_sff_host_intr(struct ata_port *ap, | 1597 | extern unsigned int ata_sff_port_intr(struct ata_port *ap, |
1597 | struct ata_queued_cmd *qc); | 1598 | struct ata_queued_cmd *qc); |
1598 | extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance); | 1599 | extern irqreturn_t ata_sff_interrupt(int irq, void *dev_instance); |
1599 | extern void ata_sff_lost_interrupt(struct ata_port *ap); | 1600 | extern void ata_sff_lost_interrupt(struct ata_port *ap); |
@@ -1625,11 +1626,24 @@ extern int ata_pci_sff_init_one(struct pci_dev *pdev, | |||
1625 | struct scsi_host_template *sht, void *host_priv, int hflags); | 1626 | struct scsi_host_template *sht, void *host_priv, int hflags); |
1626 | #endif /* CONFIG_PCI */ | 1627 | #endif /* CONFIG_PCI */ |
1627 | 1628 | ||
1629 | #ifdef CONFIG_ATA_BMDMA | ||
1630 | |||
1631 | extern const struct ata_port_operations ata_bmdma_port_ops; | ||
1632 | |||
1633 | #define ATA_BMDMA_SHT(drv_name) \ | ||
1634 | ATA_BASE_SHT(drv_name), \ | ||
1635 | .sg_tablesize = LIBATA_MAX_PRD, \ | ||
1636 | .dma_boundary = ATA_DMA_BOUNDARY | ||
1637 | |||
1628 | extern void ata_bmdma_qc_prep(struct ata_queued_cmd *qc); | 1638 | extern void ata_bmdma_qc_prep(struct ata_queued_cmd *qc); |
1629 | extern unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc); | 1639 | extern unsigned int ata_bmdma_qc_issue(struct ata_queued_cmd *qc); |
1630 | extern void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc); | 1640 | extern void ata_bmdma_dumb_qc_prep(struct ata_queued_cmd *qc); |
1641 | extern unsigned int ata_bmdma_port_intr(struct ata_port *ap, | ||
1642 | struct ata_queued_cmd *qc); | ||
1643 | extern irqreturn_t ata_bmdma_interrupt(int irq, void *dev_instance); | ||
1631 | extern void ata_bmdma_error_handler(struct ata_port *ap); | 1644 | extern void ata_bmdma_error_handler(struct ata_port *ap); |
1632 | extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc); | 1645 | extern void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc); |
1646 | extern void ata_bmdma_irq_clear(struct ata_port *ap); | ||
1633 | extern void ata_bmdma_setup(struct ata_queued_cmd *qc); | 1647 | extern void ata_bmdma_setup(struct ata_queued_cmd *qc); |
1634 | extern void ata_bmdma_start(struct ata_queued_cmd *qc); | 1648 | extern void ata_bmdma_start(struct ata_queued_cmd *qc); |
1635 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); | 1649 | extern void ata_bmdma_stop(struct ata_queued_cmd *qc); |
@@ -1640,7 +1654,15 @@ extern int ata_bmdma_port_start32(struct ata_port *ap); | |||
1640 | #ifdef CONFIG_PCI | 1654 | #ifdef CONFIG_PCI |
1641 | extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev); | 1655 | extern int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev); |
1642 | extern void ata_pci_bmdma_init(struct ata_host *host); | 1656 | extern void ata_pci_bmdma_init(struct ata_host *host); |
1657 | extern int ata_pci_bmdma_prepare_host(struct pci_dev *pdev, | ||
1658 | const struct ata_port_info * const * ppi, | ||
1659 | struct ata_host **r_host); | ||
1660 | extern int ata_pci_bmdma_init_one(struct pci_dev *pdev, | ||
1661 | const struct ata_port_info * const * ppi, | ||
1662 | struct scsi_host_template *sht, | ||
1663 | void *host_priv, int hflags); | ||
1643 | #endif /* CONFIG_PCI */ | 1664 | #endif /* CONFIG_PCI */ |
1665 | #endif /* CONFIG_ATA_BMDMA */ | ||
1644 | 1666 | ||
1645 | /** | 1667 | /** |
1646 | * ata_sff_busy_wait - Wait for a port status register | 1668 | * ata_sff_busy_wait - Wait for a port status register |
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h index 6cf44866cecd..726cc3536409 100644 --- a/include/net/cls_cgroup.h +++ b/include/net/cls_cgroup.h | |||
@@ -39,7 +39,7 @@ extern int net_cls_subsys_id; | |||
39 | static inline u32 task_cls_classid(struct task_struct *p) | 39 | static inline u32 task_cls_classid(struct task_struct *p) |
40 | { | 40 | { |
41 | int id; | 41 | int id; |
42 | u32 classid; | 42 | u32 classid = 0; |
43 | 43 | ||
44 | if (in_interrupt()) | 44 | if (in_interrupt()) |
45 | return 0; | 45 | return 0; |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 6173c619913a..4b860116e096 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -876,7 +876,7 @@ struct sctp_transport { | |||
876 | 876 | ||
877 | /* Reference counting. */ | 877 | /* Reference counting. */ |
878 | atomic_t refcnt; | 878 | atomic_t refcnt; |
879 | int dead:1, | 879 | __u32 dead:1, |
880 | /* RTO-Pending : A flag used to track if one of the DATA | 880 | /* RTO-Pending : A flag used to track if one of the DATA |
881 | * chunks sent to this address is currently being | 881 | * chunks sent to this address is currently being |
882 | * used to compute a RTT. If this flag is 0, | 882 | * used to compute a RTT. If this flag is 0, |
diff --git a/include/net/sock.h b/include/net/sock.h index d2a71b04a5ae..ca241ea14875 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1026,15 +1026,23 @@ extern void release_sock(struct sock *sk); | |||
1026 | SINGLE_DEPTH_NESTING) | 1026 | SINGLE_DEPTH_NESTING) |
1027 | #define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) | 1027 | #define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) |
1028 | 1028 | ||
1029 | static inline void lock_sock_bh(struct sock *sk) | 1029 | extern bool lock_sock_fast(struct sock *sk); |
1030 | /** | ||
1031 | * unlock_sock_fast - complement of lock_sock_fast | ||
1032 | * @sk: socket | ||
1033 | * @slow: slow mode | ||
1034 | * | ||
1035 | * fast unlock socket for user context. | ||
1036 | * If slow mode is on, we call regular release_sock() | ||
1037 | */ | ||
1038 | static inline void unlock_sock_fast(struct sock *sk, bool slow) | ||
1030 | { | 1039 | { |
1031 | spin_lock_bh(&sk->sk_lock.slock); | 1040 | if (slow) |
1041 | release_sock(sk); | ||
1042 | else | ||
1043 | spin_unlock_bh(&sk->sk_lock.slock); | ||
1032 | } | 1044 | } |
1033 | 1045 | ||
1034 | static inline void unlock_sock_bh(struct sock *sk) | ||
1035 | { | ||
1036 | spin_unlock_bh(&sk->sk_lock.slock); | ||
1037 | } | ||
1038 | 1046 | ||
1039 | extern struct sock *sk_alloc(struct net *net, int family, | 1047 | extern struct sock *sk_alloc(struct net *net, int family, |
1040 | gfp_t priority, | 1048 | gfp_t priority, |
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index 5d60ad4ebf78..f5b1ba90e952 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h | |||
@@ -606,9 +606,9 @@ TRACE_EVENT(ext4_free_blocks, | |||
606 | ); | 606 | ); |
607 | 607 | ||
608 | TRACE_EVENT(ext4_sync_file, | 608 | TRACE_EVENT(ext4_sync_file, |
609 | TP_PROTO(struct file *file, struct dentry *dentry, int datasync), | 609 | TP_PROTO(struct file *file, int datasync), |
610 | 610 | ||
611 | TP_ARGS(file, dentry, datasync), | 611 | TP_ARGS(file, datasync), |
612 | 612 | ||
613 | TP_STRUCT__entry( | 613 | TP_STRUCT__entry( |
614 | __field( dev_t, dev ) | 614 | __field( dev_t, dev ) |
@@ -618,6 +618,8 @@ TRACE_EVENT(ext4_sync_file, | |||
618 | ), | 618 | ), |
619 | 619 | ||
620 | TP_fast_assign( | 620 | TP_fast_assign( |
621 | struct dentry *dentry = file->f_path.dentry; | ||
622 | |||
621 | __entry->dev = dentry->d_inode->i_sb->s_dev; | 623 | __entry->dev = dentry->d_inode->i_sb->s_dev; |
622 | __entry->ino = dentry->d_inode->i_ino; | 624 | __entry->ino = dentry->d_inode->i_ino; |
623 | __entry->datasync = datasync; | 625 | __entry->datasync = datasync; |
@@ -273,16 +273,13 @@ static int shm_release(struct inode *ino, struct file *file) | |||
273 | return 0; | 273 | return 0; |
274 | } | 274 | } |
275 | 275 | ||
276 | static int shm_fsync(struct file *file, struct dentry *dentry, int datasync) | 276 | static int shm_fsync(struct file *file, int datasync) |
277 | { | 277 | { |
278 | int (*fsync) (struct file *, struct dentry *, int datasync); | ||
279 | struct shm_file_data *sfd = shm_file_data(file); | 278 | struct shm_file_data *sfd = shm_file_data(file); |
280 | int ret = -EINVAL; | ||
281 | 279 | ||
282 | fsync = sfd->file->f_op->fsync; | 280 | if (!sfd->file->f_op->fsync) |
283 | if (fsync) | 281 | return -EINVAL; |
284 | ret = fsync(sfd->file, sfd->file->f_path.dentry, datasync); | 282 | return sfd->file->f_op->fsync(sfd->file, datasync); |
285 | return ret; | ||
286 | } | 283 | } |
287 | 284 | ||
288 | static unsigned long shm_get_unmapped_area(struct file *file, | 285 | static unsigned long shm_get_unmapped_area(struct file *file, |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index b9b134b35088..5c69e996bd0f 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -89,7 +89,7 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base) | |||
89 | 89 | ||
90 | do { | 90 | do { |
91 | seq = read_seqbegin(&xtime_lock); | 91 | seq = read_seqbegin(&xtime_lock); |
92 | xts = current_kernel_time(); | 92 | xts = __current_kernel_time(); |
93 | tom = wall_to_monotonic; | 93 | tom = wall_to_monotonic; |
94 | } while (read_seqretry(&xtime_lock, seq)); | 94 | } while (read_seqretry(&xtime_lock, seq)); |
95 | 95 | ||
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index e099650cd249..bd7ce8ca5bb9 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -4999,8 +4999,8 @@ SYSCALL_DEFINE5(perf_event_open, | |||
4999 | struct perf_event_context *ctx; | 4999 | struct perf_event_context *ctx; |
5000 | struct file *event_file = NULL; | 5000 | struct file *event_file = NULL; |
5001 | struct file *group_file = NULL; | 5001 | struct file *group_file = NULL; |
5002 | int event_fd; | ||
5002 | int fput_needed = 0; | 5003 | int fput_needed = 0; |
5003 | int fput_needed2 = 0; | ||
5004 | int err; | 5004 | int err; |
5005 | 5005 | ||
5006 | /* for future expandability... */ | 5006 | /* for future expandability... */ |
@@ -5021,12 +5021,18 @@ SYSCALL_DEFINE5(perf_event_open, | |||
5021 | return -EINVAL; | 5021 | return -EINVAL; |
5022 | } | 5022 | } |
5023 | 5023 | ||
5024 | event_fd = get_unused_fd_flags(O_RDWR); | ||
5025 | if (event_fd < 0) | ||
5026 | return event_fd; | ||
5027 | |||
5024 | /* | 5028 | /* |
5025 | * Get the target context (task or percpu): | 5029 | * Get the target context (task or percpu): |
5026 | */ | 5030 | */ |
5027 | ctx = find_get_context(pid, cpu); | 5031 | ctx = find_get_context(pid, cpu); |
5028 | if (IS_ERR(ctx)) | 5032 | if (IS_ERR(ctx)) { |
5029 | return PTR_ERR(ctx); | 5033 | err = PTR_ERR(ctx); |
5034 | goto err_fd; | ||
5035 | } | ||
5030 | 5036 | ||
5031 | /* | 5037 | /* |
5032 | * Look up the group leader (we will attach this event to it): | 5038 | * Look up the group leader (we will attach this event to it): |
@@ -5066,13 +5072,11 @@ SYSCALL_DEFINE5(perf_event_open, | |||
5066 | if (IS_ERR(event)) | 5072 | if (IS_ERR(event)) |
5067 | goto err_put_context; | 5073 | goto err_put_context; |
5068 | 5074 | ||
5069 | err = anon_inode_getfd("[perf_event]", &perf_fops, event, O_RDWR); | 5075 | event_file = anon_inode_getfile("[perf_event]", &perf_fops, event, O_RDWR); |
5070 | if (err < 0) | 5076 | if (IS_ERR(event_file)) { |
5071 | goto err_free_put_context; | 5077 | err = PTR_ERR(event_file); |
5072 | |||
5073 | event_file = fget_light(err, &fput_needed2); | ||
5074 | if (!event_file) | ||
5075 | goto err_free_put_context; | 5078 | goto err_free_put_context; |
5079 | } | ||
5076 | 5080 | ||
5077 | if (flags & PERF_FLAG_FD_OUTPUT) { | 5081 | if (flags & PERF_FLAG_FD_OUTPUT) { |
5078 | err = perf_event_set_output(event, group_fd); | 5082 | err = perf_event_set_output(event, group_fd); |
@@ -5093,19 +5097,19 @@ SYSCALL_DEFINE5(perf_event_open, | |||
5093 | list_add_tail(&event->owner_entry, ¤t->perf_event_list); | 5097 | list_add_tail(&event->owner_entry, ¤t->perf_event_list); |
5094 | mutex_unlock(¤t->perf_event_mutex); | 5098 | mutex_unlock(¤t->perf_event_mutex); |
5095 | 5099 | ||
5096 | err_fput_free_put_context: | 5100 | fput_light(group_file, fput_needed); |
5097 | fput_light(event_file, fput_needed2); | 5101 | fd_install(event_fd, event_file); |
5102 | return event_fd; | ||
5098 | 5103 | ||
5104 | err_fput_free_put_context: | ||
5105 | fput(event_file); | ||
5099 | err_free_put_context: | 5106 | err_free_put_context: |
5100 | if (err < 0) | 5107 | free_event(event); |
5101 | free_event(event); | ||
5102 | |||
5103 | err_put_context: | 5108 | err_put_context: |
5104 | if (err < 0) | ||
5105 | put_ctx(ctx); | ||
5106 | |||
5107 | fput_light(group_file, fput_needed); | 5109 | fput_light(group_file, fput_needed); |
5108 | 5110 | put_ctx(ctx); | |
5111 | err_fd: | ||
5112 | put_unused_fd(event_fd); | ||
5109 | return err; | 5113 | return err; |
5110 | } | 5114 | } |
5111 | 5115 | ||
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 00d1fda58ab6..ad723420acc3 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
@@ -559,14 +559,7 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, | |||
559 | new_timer->it_id = (timer_t) new_timer_id; | 559 | new_timer->it_id = (timer_t) new_timer_id; |
560 | new_timer->it_clock = which_clock; | 560 | new_timer->it_clock = which_clock; |
561 | new_timer->it_overrun = -1; | 561 | new_timer->it_overrun = -1; |
562 | error = CLOCK_DISPATCH(which_clock, timer_create, (new_timer)); | ||
563 | if (error) | ||
564 | goto out; | ||
565 | 562 | ||
566 | /* | ||
567 | * return the timer_id now. The next step is hard to | ||
568 | * back out if there is an error. | ||
569 | */ | ||
570 | if (copy_to_user(created_timer_id, | 563 | if (copy_to_user(created_timer_id, |
571 | &new_timer_id, sizeof (new_timer_id))) { | 564 | &new_timer_id, sizeof (new_timer_id))) { |
572 | error = -EFAULT; | 565 | error = -EFAULT; |
@@ -597,6 +590,10 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock, | |||
597 | new_timer->sigq->info.si_tid = new_timer->it_id; | 590 | new_timer->sigq->info.si_tid = new_timer->it_id; |
598 | new_timer->sigq->info.si_code = SI_TIMER; | 591 | new_timer->sigq->info.si_code = SI_TIMER; |
599 | 592 | ||
593 | error = CLOCK_DISPATCH(which_clock, timer_create, (new_timer)); | ||
594 | if (error) | ||
595 | goto out; | ||
596 | |||
600 | spin_lock_irq(¤t->sighand->siglock); | 597 | spin_lock_irq(¤t->sighand->siglock); |
601 | new_timer->it_signal = current->signal; | 598 | new_timer->it_signal = current->signal; |
602 | list_add(&new_timer->list, ¤t->signal->posix_timers); | 599 | list_add(&new_timer->list, ¤t->signal->posix_timers); |
diff --git a/kernel/timer.c b/kernel/timer.c index e3b8c697bde4..2454172a80d3 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -752,11 +752,15 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires) | |||
752 | 752 | ||
753 | expires_limit = expires; | 753 | expires_limit = expires; |
754 | 754 | ||
755 | if (timer->slack > -1) | 755 | if (timer->slack >= 0) { |
756 | expires_limit = expires + timer->slack; | 756 | expires_limit = expires + timer->slack; |
757 | else if (time_after(expires, jiffies)) /* auto slack: use 0.4% */ | 757 | } else { |
758 | expires_limit = expires + (expires - jiffies)/256; | 758 | unsigned long now = jiffies; |
759 | 759 | ||
760 | /* No slack, if already expired else auto slack 0.4% */ | ||
761 | if (time_after(expires, now)) | ||
762 | expires_limit = expires + (expires - now)/256; | ||
763 | } | ||
760 | mask = expires ^ expires_limit; | 764 | mask = expires ^ expires_limit; |
761 | if (mask == 0) | 765 | if (mask == 0) |
762 | return expires; | 766 | return expires; |
diff --git a/mm/shmem.c b/mm/shmem.c index 855eaf5b8d5b..7e5030ae18ff 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -727,10 +727,11 @@ done2: | |||
727 | if (inode->i_mapping->nrpages && (info->flags & SHMEM_PAGEIN)) { | 727 | if (inode->i_mapping->nrpages && (info->flags & SHMEM_PAGEIN)) { |
728 | /* | 728 | /* |
729 | * Call truncate_inode_pages again: racing shmem_unuse_inode | 729 | * Call truncate_inode_pages again: racing shmem_unuse_inode |
730 | * may have swizzled a page in from swap since vmtruncate or | 730 | * may have swizzled a page in from swap since |
731 | * generic_delete_inode did it, before we lowered next_index. | 731 | * truncate_pagecache or generic_delete_inode did it, before we |
732 | * Also, though shmem_getpage checks i_size before adding to | 732 | * lowered next_index. Also, though shmem_getpage checks |
733 | * cache, no recheck after: so fix the narrow window there too. | 733 | * i_size before adding to cache, no recheck after: so fix the |
734 | * narrow window there too. | ||
734 | * | 735 | * |
735 | * Recalling truncate_inode_pages_range and unmap_mapping_range | 736 | * Recalling truncate_inode_pages_range and unmap_mapping_range |
736 | * every time for punch_hole (which never got a chance to clear | 737 | * every time for punch_hole (which never got a chance to clear |
@@ -760,19 +761,16 @@ done2: | |||
760 | } | 761 | } |
761 | } | 762 | } |
762 | 763 | ||
763 | static void shmem_truncate(struct inode *inode) | ||
764 | { | ||
765 | shmem_truncate_range(inode, inode->i_size, (loff_t)-1); | ||
766 | } | ||
767 | |||
768 | static int shmem_notify_change(struct dentry *dentry, struct iattr *attr) | 764 | static int shmem_notify_change(struct dentry *dentry, struct iattr *attr) |
769 | { | 765 | { |
770 | struct inode *inode = dentry->d_inode; | 766 | struct inode *inode = dentry->d_inode; |
771 | struct page *page = NULL; | ||
772 | int error; | 767 | int error; |
773 | 768 | ||
774 | if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) { | 769 | if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) { |
775 | if (attr->ia_size < inode->i_size) { | 770 | loff_t newsize = attr->ia_size; |
771 | struct page *page = NULL; | ||
772 | |||
773 | if (newsize < inode->i_size) { | ||
776 | /* | 774 | /* |
777 | * If truncating down to a partial page, then | 775 | * If truncating down to a partial page, then |
778 | * if that page is already allocated, hold it | 776 | * if that page is already allocated, hold it |
@@ -780,9 +778,9 @@ static int shmem_notify_change(struct dentry *dentry, struct iattr *attr) | |||
780 | * truncate_partial_page cannnot miss it were | 778 | * truncate_partial_page cannnot miss it were |
781 | * it assigned to swap. | 779 | * it assigned to swap. |
782 | */ | 780 | */ |
783 | if (attr->ia_size & (PAGE_CACHE_SIZE-1)) { | 781 | if (newsize & (PAGE_CACHE_SIZE-1)) { |
784 | (void) shmem_getpage(inode, | 782 | (void) shmem_getpage(inode, |
785 | attr->ia_size>>PAGE_CACHE_SHIFT, | 783 | newsize >> PAGE_CACHE_SHIFT, |
786 | &page, SGP_READ, NULL); | 784 | &page, SGP_READ, NULL); |
787 | if (page) | 785 | if (page) |
788 | unlock_page(page); | 786 | unlock_page(page); |
@@ -794,24 +792,29 @@ static int shmem_notify_change(struct dentry *dentry, struct iattr *attr) | |||
794 | * if it's being fully truncated to zero-length: the | 792 | * if it's being fully truncated to zero-length: the |
795 | * nrpages check is efficient enough in that case. | 793 | * nrpages check is efficient enough in that case. |
796 | */ | 794 | */ |
797 | if (attr->ia_size) { | 795 | if (newsize) { |
798 | struct shmem_inode_info *info = SHMEM_I(inode); | 796 | struct shmem_inode_info *info = SHMEM_I(inode); |
799 | spin_lock(&info->lock); | 797 | spin_lock(&info->lock); |
800 | info->flags &= ~SHMEM_PAGEIN; | 798 | info->flags &= ~SHMEM_PAGEIN; |
801 | spin_unlock(&info->lock); | 799 | spin_unlock(&info->lock); |
802 | } | 800 | } |
803 | } | 801 | } |
802 | |||
803 | error = simple_setsize(inode, newsize); | ||
804 | if (page) | ||
805 | page_cache_release(page); | ||
806 | if (error) | ||
807 | return error; | ||
808 | shmem_truncate_range(inode, newsize, (loff_t)-1); | ||
804 | } | 809 | } |
805 | 810 | ||
806 | error = inode_change_ok(inode, attr); | 811 | error = inode_change_ok(inode, attr); |
807 | if (!error) | 812 | if (!error) |
808 | error = inode_setattr(inode, attr); | 813 | generic_setattr(inode, attr); |
809 | #ifdef CONFIG_TMPFS_POSIX_ACL | 814 | #ifdef CONFIG_TMPFS_POSIX_ACL |
810 | if (!error && (attr->ia_valid & ATTR_MODE)) | 815 | if (!error && (attr->ia_valid & ATTR_MODE)) |
811 | error = generic_acl_chmod(inode); | 816 | error = generic_acl_chmod(inode); |
812 | #endif | 817 | #endif |
813 | if (page) | ||
814 | page_cache_release(page); | ||
815 | return error; | 818 | return error; |
816 | } | 819 | } |
817 | 820 | ||
@@ -819,11 +822,11 @@ static void shmem_delete_inode(struct inode *inode) | |||
819 | { | 822 | { |
820 | struct shmem_inode_info *info = SHMEM_I(inode); | 823 | struct shmem_inode_info *info = SHMEM_I(inode); |
821 | 824 | ||
822 | if (inode->i_op->truncate == shmem_truncate) { | 825 | if (inode->i_mapping->a_ops == &shmem_aops) { |
823 | truncate_inode_pages(inode->i_mapping, 0); | 826 | truncate_inode_pages(inode->i_mapping, 0); |
824 | shmem_unacct_size(info->flags, inode->i_size); | 827 | shmem_unacct_size(info->flags, inode->i_size); |
825 | inode->i_size = 0; | 828 | inode->i_size = 0; |
826 | shmem_truncate(inode); | 829 | shmem_truncate_range(inode, 0, (loff_t)-1); |
827 | if (!list_empty(&info->swaplist)) { | 830 | if (!list_empty(&info->swaplist)) { |
828 | mutex_lock(&shmem_swaplist_mutex); | 831 | mutex_lock(&shmem_swaplist_mutex); |
829 | list_del_init(&info->swaplist); | 832 | list_del_init(&info->swaplist); |
@@ -2022,7 +2025,6 @@ static const struct inode_operations shmem_symlink_inline_operations = { | |||
2022 | }; | 2025 | }; |
2023 | 2026 | ||
2024 | static const struct inode_operations shmem_symlink_inode_operations = { | 2027 | static const struct inode_operations shmem_symlink_inode_operations = { |
2025 | .truncate = shmem_truncate, | ||
2026 | .readlink = generic_readlink, | 2028 | .readlink = generic_readlink, |
2027 | .follow_link = shmem_follow_link, | 2029 | .follow_link = shmem_follow_link, |
2028 | .put_link = shmem_put_link, | 2030 | .put_link = shmem_put_link, |
@@ -2433,14 +2435,13 @@ static const struct file_operations shmem_file_operations = { | |||
2433 | .write = do_sync_write, | 2435 | .write = do_sync_write, |
2434 | .aio_read = shmem_file_aio_read, | 2436 | .aio_read = shmem_file_aio_read, |
2435 | .aio_write = generic_file_aio_write, | 2437 | .aio_write = generic_file_aio_write, |
2436 | .fsync = simple_sync_file, | 2438 | .fsync = noop_fsync, |
2437 | .splice_read = generic_file_splice_read, | 2439 | .splice_read = generic_file_splice_read, |
2438 | .splice_write = generic_file_splice_write, | 2440 | .splice_write = generic_file_splice_write, |
2439 | #endif | 2441 | #endif |
2440 | }; | 2442 | }; |
2441 | 2443 | ||
2442 | static const struct inode_operations shmem_inode_operations = { | 2444 | static const struct inode_operations shmem_inode_operations = { |
2443 | .truncate = shmem_truncate, | ||
2444 | .setattr = shmem_notify_change, | 2445 | .setattr = shmem_notify_change, |
2445 | .truncate_range = shmem_truncate_range, | 2446 | .truncate_range = shmem_truncate_range, |
2446 | #ifdef CONFIG_TMPFS_POSIX_ACL | 2447 | #ifdef CONFIG_TMPFS_POSIX_ACL |
diff --git a/mm/truncate.c b/mm/truncate.c index f42675a3615d..937571b8b233 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -548,18 +548,18 @@ EXPORT_SYMBOL(truncate_pagecache); | |||
548 | * NOTE! We have to be ready to update the memory sharing | 548 | * NOTE! We have to be ready to update the memory sharing |
549 | * between the file and the memory map for a potential last | 549 | * between the file and the memory map for a potential last |
550 | * incomplete page. Ugly, but necessary. | 550 | * incomplete page. Ugly, but necessary. |
551 | * | ||
552 | * This function is deprecated and simple_setsize or truncate_pagecache | ||
553 | * should be used instead. | ||
551 | */ | 554 | */ |
552 | int vmtruncate(struct inode *inode, loff_t offset) | 555 | int vmtruncate(struct inode *inode, loff_t offset) |
553 | { | 556 | { |
554 | loff_t oldsize; | ||
555 | int error; | 557 | int error; |
556 | 558 | ||
557 | error = inode_newsize_ok(inode, offset); | 559 | error = simple_setsize(inode, offset); |
558 | if (error) | 560 | if (error) |
559 | return error; | 561 | return error; |
560 | oldsize = inode->i_size; | 562 | |
561 | i_size_write(inode, offset); | ||
562 | truncate_pagecache(inode, oldsize, offset); | ||
563 | if (inode->i_op->truncate) | 563 | if (inode->i_op->truncate) |
564 | inode->i_op->truncate(inode); | 564 | inode->i_op->truncate(inode); |
565 | 565 | ||
diff --git a/net/core/datagram.c b/net/core/datagram.c index e0097531417a..f5b6f43a4c2e 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
@@ -229,15 +229,17 @@ EXPORT_SYMBOL(skb_free_datagram); | |||
229 | 229 | ||
230 | void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb) | 230 | void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb) |
231 | { | 231 | { |
232 | bool slow; | ||
233 | |||
232 | if (likely(atomic_read(&skb->users) == 1)) | 234 | if (likely(atomic_read(&skb->users) == 1)) |
233 | smp_rmb(); | 235 | smp_rmb(); |
234 | else if (likely(!atomic_dec_and_test(&skb->users))) | 236 | else if (likely(!atomic_dec_and_test(&skb->users))) |
235 | return; | 237 | return; |
236 | 238 | ||
237 | lock_sock_bh(sk); | 239 | slow = lock_sock_fast(sk); |
238 | skb_orphan(skb); | 240 | skb_orphan(skb); |
239 | sk_mem_reclaim_partial(sk); | 241 | sk_mem_reclaim_partial(sk); |
240 | unlock_sock_bh(sk); | 242 | unlock_sock_fast(sk, slow); |
241 | 243 | ||
242 | /* skb is now orphaned, can be freed outside of locked section */ | 244 | /* skb is now orphaned, can be freed outside of locked section */ |
243 | __kfree_skb(skb); | 245 | __kfree_skb(skb); |
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index bff37908bd55..6ba1c0eece03 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -934,6 +934,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) | |||
934 | kfree_skb(buff); | 934 | kfree_skb(buff); |
935 | NEIGH_CACHE_STAT_INC(neigh->tbl, unres_discards); | 935 | NEIGH_CACHE_STAT_INC(neigh->tbl, unres_discards); |
936 | } | 936 | } |
937 | skb_dst_force(skb); | ||
937 | __skb_queue_tail(&neigh->arp_queue, skb); | 938 | __skb_queue_tail(&neigh->arp_queue, skb); |
938 | } | 939 | } |
939 | rc = 1; | 940 | rc = 1; |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 7ab86f3a1ea4..1a2af24e9e3d 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c | |||
@@ -650,11 +650,12 @@ static inline int rtnl_vfinfo_size(const struct net_device *dev) | |||
650 | if (dev->dev.parent && dev_is_pci(dev->dev.parent)) { | 650 | if (dev->dev.parent && dev_is_pci(dev->dev.parent)) { |
651 | 651 | ||
652 | int num_vfs = dev_num_vf(dev->dev.parent); | 652 | int num_vfs = dev_num_vf(dev->dev.parent); |
653 | size_t size = nlmsg_total_size(sizeof(struct nlattr)); | 653 | size_t size = nla_total_size(sizeof(struct nlattr)); |
654 | size += nlmsg_total_size(num_vfs * sizeof(struct nlattr)); | 654 | size += nla_total_size(num_vfs * sizeof(struct nlattr)); |
655 | size += num_vfs * (sizeof(struct ifla_vf_mac) + | 655 | size += num_vfs * |
656 | sizeof(struct ifla_vf_vlan) + | 656 | (nla_total_size(sizeof(struct ifla_vf_mac)) + |
657 | sizeof(struct ifla_vf_tx_rate)); | 657 | nla_total_size(sizeof(struct ifla_vf_vlan)) + |
658 | nla_total_size(sizeof(struct ifla_vf_tx_rate))); | ||
658 | return size; | 659 | return size; |
659 | } else | 660 | } else |
660 | return 0; | 661 | return 0; |
@@ -722,14 +723,13 @@ static int rtnl_vf_ports_fill(struct sk_buff *skb, struct net_device *dev) | |||
722 | 723 | ||
723 | for (vf = 0; vf < dev_num_vf(dev->dev.parent); vf++) { | 724 | for (vf = 0; vf < dev_num_vf(dev->dev.parent); vf++) { |
724 | vf_port = nla_nest_start(skb, IFLA_VF_PORT); | 725 | vf_port = nla_nest_start(skb, IFLA_VF_PORT); |
725 | if (!vf_port) { | 726 | if (!vf_port) |
726 | nla_nest_cancel(skb, vf_ports); | 727 | goto nla_put_failure; |
727 | return -EMSGSIZE; | ||
728 | } | ||
729 | NLA_PUT_U32(skb, IFLA_PORT_VF, vf); | 728 | NLA_PUT_U32(skb, IFLA_PORT_VF, vf); |
730 | err = dev->netdev_ops->ndo_get_vf_port(dev, vf, skb); | 729 | err = dev->netdev_ops->ndo_get_vf_port(dev, vf, skb); |
730 | if (err == -EMSGSIZE) | ||
731 | goto nla_put_failure; | ||
731 | if (err) { | 732 | if (err) { |
732 | nla_put_failure: | ||
733 | nla_nest_cancel(skb, vf_port); | 733 | nla_nest_cancel(skb, vf_port); |
734 | continue; | 734 | continue; |
735 | } | 735 | } |
@@ -739,6 +739,10 @@ nla_put_failure: | |||
739 | nla_nest_end(skb, vf_ports); | 739 | nla_nest_end(skb, vf_ports); |
740 | 740 | ||
741 | return 0; | 741 | return 0; |
742 | |||
743 | nla_put_failure: | ||
744 | nla_nest_cancel(skb, vf_ports); | ||
745 | return -EMSGSIZE; | ||
742 | } | 746 | } |
743 | 747 | ||
744 | static int rtnl_port_self_fill(struct sk_buff *skb, struct net_device *dev) | 748 | static int rtnl_port_self_fill(struct sk_buff *skb, struct net_device *dev) |
@@ -753,7 +757,7 @@ static int rtnl_port_self_fill(struct sk_buff *skb, struct net_device *dev) | |||
753 | err = dev->netdev_ops->ndo_get_vf_port(dev, PORT_SELF_VF, skb); | 757 | err = dev->netdev_ops->ndo_get_vf_port(dev, PORT_SELF_VF, skb); |
754 | if (err) { | 758 | if (err) { |
755 | nla_nest_cancel(skb, port_self); | 759 | nla_nest_cancel(skb, port_self); |
756 | return err; | 760 | return (err == -EMSGSIZE) ? err : 0; |
757 | } | 761 | } |
758 | 762 | ||
759 | nla_nest_end(skb, port_self); | 763 | nla_nest_end(skb, port_self); |
diff --git a/net/core/sock.c b/net/core/sock.c index 37fe9b6adade..2cf7f9f7e775 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -2007,6 +2007,39 @@ void release_sock(struct sock *sk) | |||
2007 | } | 2007 | } |
2008 | EXPORT_SYMBOL(release_sock); | 2008 | EXPORT_SYMBOL(release_sock); |
2009 | 2009 | ||
2010 | /** | ||
2011 | * lock_sock_fast - fast version of lock_sock | ||
2012 | * @sk: socket | ||
2013 | * | ||
2014 | * This version should be used for very small section, where process wont block | ||
2015 | * return false if fast path is taken | ||
2016 | * sk_lock.slock locked, owned = 0, BH disabled | ||
2017 | * return true if slow path is taken | ||
2018 | * sk_lock.slock unlocked, owned = 1, BH enabled | ||
2019 | */ | ||
2020 | bool lock_sock_fast(struct sock *sk) | ||
2021 | { | ||
2022 | might_sleep(); | ||
2023 | spin_lock_bh(&sk->sk_lock.slock); | ||
2024 | |||
2025 | if (!sk->sk_lock.owned) | ||
2026 | /* | ||
2027 | * Note : We must disable BH | ||
2028 | */ | ||
2029 | return false; | ||
2030 | |||
2031 | __lock_sock(sk); | ||
2032 | sk->sk_lock.owned = 1; | ||
2033 | spin_unlock(&sk->sk_lock.slock); | ||
2034 | /* | ||
2035 | * The sk_lock has mutex_lock() semantics here: | ||
2036 | */ | ||
2037 | mutex_acquire(&sk->sk_lock.dep_map, 0, 0, _RET_IP_); | ||
2038 | local_bh_enable(); | ||
2039 | return true; | ||
2040 | } | ||
2041 | EXPORT_SYMBOL(lock_sock_fast); | ||
2042 | |||
2010 | int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) | 2043 | int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp) |
2011 | { | 2044 | { |
2012 | struct timeval tv; | 2045 | struct timeval tv; |
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 45889103b3e2..856123fe32f9 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c | |||
@@ -1911,7 +1911,7 @@ static int __ipmr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, | |||
1911 | struct rtattr *mp_head; | 1911 | struct rtattr *mp_head; |
1912 | 1912 | ||
1913 | /* If cache is unresolved, don't try to parse IIF and OIF */ | 1913 | /* If cache is unresolved, don't try to parse IIF and OIF */ |
1914 | if (c->mfc_parent > MAXVIFS) | 1914 | if (c->mfc_parent >= MAXVIFS) |
1915 | return -ENOENT; | 1915 | return -ENOENT; |
1916 | 1916 | ||
1917 | if (VIF_EXISTS(mrt, c->mfc_parent)) | 1917 | if (VIF_EXISTS(mrt, c->mfc_parent)) |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index baeec29fe0f1..58585748bdac 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -1063,10 +1063,11 @@ static unsigned int first_packet_length(struct sock *sk) | |||
1063 | spin_unlock_bh(&rcvq->lock); | 1063 | spin_unlock_bh(&rcvq->lock); |
1064 | 1064 | ||
1065 | if (!skb_queue_empty(&list_kill)) { | 1065 | if (!skb_queue_empty(&list_kill)) { |
1066 | lock_sock_bh(sk); | 1066 | bool slow = lock_sock_fast(sk); |
1067 | |||
1067 | __skb_queue_purge(&list_kill); | 1068 | __skb_queue_purge(&list_kill); |
1068 | sk_mem_reclaim_partial(sk); | 1069 | sk_mem_reclaim_partial(sk); |
1069 | unlock_sock_bh(sk); | 1070 | unlock_sock_fast(sk, slow); |
1070 | } | 1071 | } |
1071 | return res; | 1072 | return res; |
1072 | } | 1073 | } |
@@ -1123,6 +1124,7 @@ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | |||
1123 | int peeked; | 1124 | int peeked; |
1124 | int err; | 1125 | int err; |
1125 | int is_udplite = IS_UDPLITE(sk); | 1126 | int is_udplite = IS_UDPLITE(sk); |
1127 | bool slow; | ||
1126 | 1128 | ||
1127 | /* | 1129 | /* |
1128 | * Check any passed addresses | 1130 | * Check any passed addresses |
@@ -1197,10 +1199,10 @@ out: | |||
1197 | return err; | 1199 | return err; |
1198 | 1200 | ||
1199 | csum_copy_err: | 1201 | csum_copy_err: |
1200 | lock_sock_bh(sk); | 1202 | slow = lock_sock_fast(sk); |
1201 | if (!skb_kill_datagram(sk, skb, flags)) | 1203 | if (!skb_kill_datagram(sk, skb, flags)) |
1202 | UDP_INC_STATS_USER(sock_net(sk), UDP_MIB_INERRORS, is_udplite); | 1204 | UDP_INC_STATS_USER(sock_net(sk), UDP_MIB_INERRORS, is_udplite); |
1203 | unlock_sock_bh(sk); | 1205 | unlock_sock_fast(sk, slow); |
1204 | 1206 | ||
1205 | if (noblock) | 1207 | if (noblock) |
1206 | return -EAGAIN; | 1208 | return -EAGAIN; |
@@ -1625,9 +1627,9 @@ int udp_rcv(struct sk_buff *skb) | |||
1625 | 1627 | ||
1626 | void udp_destroy_sock(struct sock *sk) | 1628 | void udp_destroy_sock(struct sock *sk) |
1627 | { | 1629 | { |
1628 | lock_sock_bh(sk); | 1630 | bool slow = lock_sock_fast(sk); |
1629 | udp_flush_pending_frames(sk); | 1631 | udp_flush_pending_frames(sk); |
1630 | unlock_sock_bh(sk); | 1632 | unlock_sock_fast(sk, slow); |
1631 | } | 1633 | } |
1632 | 1634 | ||
1633 | /* | 1635 | /* |
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index cd963f64e27c..89425af0684c 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c | |||
@@ -507,7 +507,7 @@ int ip6_forward(struct sk_buff *skb) | |||
507 | if (mtu < IPV6_MIN_MTU) | 507 | if (mtu < IPV6_MIN_MTU) |
508 | mtu = IPV6_MIN_MTU; | 508 | mtu = IPV6_MIN_MTU; |
509 | 509 | ||
510 | if (skb->len > mtu) { | 510 | if (skb->len > mtu && !skb_is_gso(skb)) { |
511 | /* Again, force OUTPUT device used as source address */ | 511 | /* Again, force OUTPUT device used as source address */ |
512 | skb->dev = dst->dev; | 512 | skb->dev = dst->dev; |
513 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); | 513 | icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); |
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index bd9e7d3e9c8e..073071f2b75b 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c | |||
@@ -2017,7 +2017,7 @@ static int __ip6mr_fill_mroute(struct mr6_table *mrt, struct sk_buff *skb, | |||
2017 | struct rtattr *mp_head; | 2017 | struct rtattr *mp_head; |
2018 | 2018 | ||
2019 | /* If cache is unresolved, don't try to parse IIF and OIF */ | 2019 | /* If cache is unresolved, don't try to parse IIF and OIF */ |
2020 | if (c->mf6c_parent > MAXMIFS) | 2020 | if (c->mf6c_parent >= MAXMIFS) |
2021 | return -ENOENT; | 2021 | return -ENOENT; |
2022 | 2022 | ||
2023 | if (MIF_EXISTS(mrt, c->mf6c_parent)) | 2023 | if (MIF_EXISTS(mrt, c->mf6c_parent)) |
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 3d7a2c0b836a..87be58673b55 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -328,6 +328,7 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk, | |||
328 | int err; | 328 | int err; |
329 | int is_udplite = IS_UDPLITE(sk); | 329 | int is_udplite = IS_UDPLITE(sk); |
330 | int is_udp4; | 330 | int is_udp4; |
331 | bool slow; | ||
331 | 332 | ||
332 | if (addr_len) | 333 | if (addr_len) |
333 | *addr_len=sizeof(struct sockaddr_in6); | 334 | *addr_len=sizeof(struct sockaddr_in6); |
@@ -424,7 +425,7 @@ out: | |||
424 | return err; | 425 | return err; |
425 | 426 | ||
426 | csum_copy_err: | 427 | csum_copy_err: |
427 | lock_sock_bh(sk); | 428 | slow = lock_sock_fast(sk); |
428 | if (!skb_kill_datagram(sk, skb, flags)) { | 429 | if (!skb_kill_datagram(sk, skb, flags)) { |
429 | if (is_udp4) | 430 | if (is_udp4) |
430 | UDP_INC_STATS_USER(sock_net(sk), | 431 | UDP_INC_STATS_USER(sock_net(sk), |
@@ -433,7 +434,7 @@ csum_copy_err: | |||
433 | UDP6_INC_STATS_USER(sock_net(sk), | 434 | UDP6_INC_STATS_USER(sock_net(sk), |
434 | UDP_MIB_INERRORS, is_udplite); | 435 | UDP_MIB_INERRORS, is_udplite); |
435 | } | 436 | } |
436 | unlock_sock_bh(sk); | 437 | unlock_sock_fast(sk, slow); |
437 | 438 | ||
438 | if (flags & MSG_DONTWAIT) | 439 | if (flags & MSG_DONTWAIT) |
439 | return -EAGAIN; | 440 | return -EAGAIN; |
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index c8b4599a752e..9637e45744fa 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c | |||
@@ -1619,7 +1619,7 @@ static void iucv_callback_rx(struct iucv_path *path, struct iucv_message *msg) | |||
1619 | save_message: | 1619 | save_message: |
1620 | save_msg = kzalloc(sizeof(struct sock_msg_q), GFP_ATOMIC | GFP_DMA); | 1620 | save_msg = kzalloc(sizeof(struct sock_msg_q), GFP_ATOMIC | GFP_DMA); |
1621 | if (!save_msg) | 1621 | if (!save_msg) |
1622 | return; | 1622 | goto out_unlock; |
1623 | save_msg->path = path; | 1623 | save_msg->path = path; |
1624 | save_msg->msg = *msg; | 1624 | save_msg->msg = *msg; |
1625 | 1625 | ||
diff --git a/net/netfilter/xt_TEE.c b/net/netfilter/xt_TEE.c index d7920d9f49e9..859d9fd429c8 100644 --- a/net/netfilter/xt_TEE.c +++ b/net/netfilter/xt_TEE.c | |||
@@ -76,7 +76,7 @@ tee_tg_route4(struct sk_buff *skb, const struct xt_tee_tginfo *info) | |||
76 | if (ip_route_output_key(net, &rt, &fl) != 0) | 76 | if (ip_route_output_key(net, &rt, &fl) != 0) |
77 | return false; | 77 | return false; |
78 | 78 | ||
79 | dst_release(skb_dst(skb)); | 79 | skb_dst_drop(skb); |
80 | skb_dst_set(skb, &rt->u.dst); | 80 | skb_dst_set(skb, &rt->u.dst); |
81 | skb->dev = rt->u.dst.dev; | 81 | skb->dev = rt->u.dst.dev; |
82 | skb->protocol = htons(ETH_P_IP); | 82 | skb->protocol = htons(ETH_P_IP); |
@@ -157,7 +157,7 @@ tee_tg_route6(struct sk_buff *skb, const struct xt_tee_tginfo *info) | |||
157 | if (dst == NULL) | 157 | if (dst == NULL) |
158 | return false; | 158 | return false; |
159 | 159 | ||
160 | dst_release(skb_dst(skb)); | 160 | skb_dst_drop(skb); |
161 | skb_dst_set(skb, dst); | 161 | skb_dst_set(skb, dst); |
162 | skb->dev = dst->dev; | 162 | skb->dev = dst->dev; |
163 | skb->protocol = htons(ETH_P_IPV6); | 163 | skb->protocol = htons(ETH_P_IPV6); |