1
linux/arch/mips/include/asm
Christoph Hellwig 6b2f3d1f76 vfs: Implement proper O_SYNC semantics
While Linux provided an O_SYNC flag basically since day 1, it took until
Linux 2.4.0-test12pre2 to actually get it implemented for filesystems,
since that day we had generic_osync_around with only minor changes and the
great "For now, when the user asks for O_SYNC, we'll actually give
O_DSYNC" comment.  This patch intends to actually give us real O_SYNC
semantics in addition to the O_DSYNC semantics.  After Jan's O_SYNC
patches which are required before this patch it's actually surprisingly
simple, we just need to figure out when to set the datasync flag to
vfs_fsync_range and when not.

This patch renames the existing O_SYNC flag to O_DSYNC while keeping it's
numerical value to keep binary compatibility, and adds a new real O_SYNC
flag.  To guarantee backwards compatiblity it is defined as expanding to
both the O_DSYNC and the new additional binary flag (__O_SYNC) to make
sure we are backwards-compatible when compiled against the new headers.

This also means that all places that don't care about the differences can
just check O_DSYNC and get the right behaviour for O_SYNC, too - only
places that actuall care need to check __O_SYNC in addition.  Drivers and
network filesystems have been updated in a fail safe way to always do the
full sync magic if O_DSYNC is set.  The few places setting O_SYNC for
lower layers are kept that way for now to stay failsafe.

We enforce that O_DSYNC is set when __O_SYNC is set early in the open path
to make sure we always get these sane options.

Note that parisc really screwed up their headers as they already define a
O_DSYNC that has always been a no-op.  We try to repair it by using it for
the new O_DSYNC and redefinining O_SYNC to send both the traditional
O_SYNC numerical value _and_ the O_DSYNC one.

Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Grant Grundler <grundler@parisc-linux.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andreas Dilger <adilger@sun.com>
Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: Kyle McMartin <kyle@mcmartin.ca>
Acked-by: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jan Kara <jack@suse.cz>
2009-12-10 15:02:50 +01:00
..
dec
emma MIPS: Eleminate filenames from comments 2009-08-03 17:52:40 +01:00
fw
ip32
lasat MIPS: Lasat: Fix compilation 2009-09-17 20:07:42 +02:00
mach-ar7 MIPS: AR7: register watchdog device only if enabled in hw configuration 2009-11-02 12:00:03 +01:00
mach-au1x00 MIPS: AU1000: Fix build failure for db1x00 configured for Au1100 SoC 2009-11-02 12:00:03 +01:00
mach-bcm47xx MIPS: BCM47xx: Fix gpio_direction_output 2009-06-17 11:06:28 +01:00
mach-bcm63xx MIPS: BCM63xx: Make bcm63xx_uart_register an initfunc 2009-11-02 12:00:03 +01:00
mach-cavium-octeon MIPS: Octeon: Set kernel_uses_llsc to false on non-SMP builds. 2009-09-17 20:07:50 +02:00
mach-cobalt Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
mach-db1x00
mach-dec
mach-emma2rh
mach-excite
mach-generic MIPS: Pass struct device to plat_dma_addr_to_phys() 2009-06-17 11:06:24 +01:00
mach-ip22 MIPS: IP22/28: Switch over to RTC class driver 2008-10-15 12:46:51 +01:00
mach-ip27 MIPS: IP27: Fix build 2009-11-02 12:00:01 +01:00
mach-ip28 MIPS: IP22/28: Switch over to RTC class driver 2008-10-15 12:46:51 +01:00
mach-ip32 MIPS: Pass struct device to plat_dma_addr_to_phys() 2009-06-17 11:06:24 +01:00
mach-jazz MIPS: Pass struct device to plat_dma_addr_to_phys() 2009-06-17 11:06:24 +01:00
mach-lasat
mach-loongson MIPS: Loongson 2: Set cpu_has_dc_aliases and cpu_icache_snoops_remote_store 2009-11-02 12:00:07 +01:00
mach-malta MIPS: Malta: Remove pointless use use of CONFIG_CPU_HAS_LLSC 2009-09-17 20:07:49 +02:00
mach-mipssim
mach-pb1x00
mach-pnx833x tree-wide: fix assorted typos all over the place 2009-12-04 15:39:55 +01:00
mach-pnx8550
mach-rc32434 MIPS: RB532: Cleanup cpu-features-overrides 2009-06-17 11:06:26 +01:00
mach-rm
mach-sibyte
mach-tx39xx
mach-tx49xx MIPS: RBTX4939: Add smc91x support 2008-10-27 16:18:27 +00:00
mach-vr41xx
mach-wrppmc
mach-yosemite
mips-boards MIPS: Loongson: Change naming methods 2009-09-17 20:07:47 +02:00
octeon MIPS: Octeon: Add hardware RNG platform device. 2009-09-17 20:07:51 +02:00
pci
pmc-sierra/msp71xx MIPS: MSPxxxx: define MIPS34K_MISSED_ITLB_WAR for other PMC-Sierra SoC 2009-08-03 17:52:43 +01:00
sgi tree-wide: fix assorted typos all over the place 2009-12-04 15:39:55 +01:00
sibyte tree-wide: fix assorted typos all over the place 2009-12-04 15:39:55 +01:00
sn tree-wide: fix assorted typos all over the place 2009-12-04 15:39:55 +01:00
txx9 MIPS: TXx9: Add TX4939 RNG support 2009-06-17 11:06:27 +01:00
vr41xx Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
xtalk
abi.h
addrspace.h
amon.h MIPS: CMP: activate CMP support 2009-07-03 15:45:26 +01:00
asm.h
asmmacro-32.h
asmmacro-64.h
asmmacro.h MIPS: Use EI/DI for MIPS R2. 2008-12-12 18:12:23 +00:00
atomic.h MIPS: Allow kernel use of LL/SC to be separate from the presence of LL/SC. 2009-09-17 20:07:50 +02:00
auxvec.h
barrier.h
bcache.h
bitops.h MIPS: Allow kernel use of LL/SC to be separate from the presence of LL/SC. 2009-09-17 20:07:50 +02:00
bitsperlong.h asm-generic: introduce asm/bitsperlong.h 2009-06-11 21:02:14 +02:00
bootinfo.h MIPS: Loongson: Add a machtype kernel command line argument 2009-09-17 20:07:47 +02:00
branch.h
break.h MIPS: Switch FPU emulator trap to BREAK instruction. 2008-10-30 14:44:34 +00:00
bug.h MIPS: Convert BUG() to use unreachable() 2009-12-05 09:10:12 -08:00
bugs.h MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
byteorder.h byteorder: make swab.h include asm/swab.h like a regular header 2009-01-14 19:56:50 -08:00
cache.h
cachectl.h
cacheflush.h block: add helpers to run flush_dcache_page() against a bio and a request's pages 2009-11-26 09:16:19 +01:00
cacheops.h
cevt-r4k.h MIPS: Have a heart for a lonely, lost header file ... 2008-10-15 12:46:49 +01:00
checksum.h MIPS: uaccess: Switch lock annotations to might_fault(). 2009-05-14 13:50:28 +01:00
cmp.h
cmpxchg.h MIPS: Allow kernel use of LL/SC to be separate from the presence of LL/SC. 2009-09-17 20:07:50 +02:00
compat-signal.h
compat.h MIPS: Do not include seccomp.h from compat.h 2009-05-14 13:50:26 +01:00
compiler.h
cpu-features.h MIPS: Allow kernel use of LL/SC to be separate from the presence of LL/SC. 2009-09-17 20:07:50 +02:00
cpu-info.h MIPS: Outline udelay and fix a few issues. 2009-06-08 16:57:51 +01:00
cpu.h MIPS: BCM63xx: Add Broadcom 63xx CPU definitions. 2009-09-17 20:07:52 +02:00
cputime.h
current.h
debug.h
delay.h MIPS: Fix potencial build error in <asm/delay.h> 2009-09-17 20:07:41 +02:00
device.h
div64.h MIPS: Rewrite <asm/div64.h> to work with gcc 4.4.0. 2009-05-14 13:50:29 +01:00
dma-mapping.h MIPS: Add DMA declare coherent memory support 2009-11-13 18:10:37 +01:00
dma.h
ds1287.h Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
dsp.h
edac.h
elf.h MIPS: 64-bit: Fix o32 core dump 2009-07-03 15:45:27 +01:00
emergency-restart.h
errno.h cfg80211: errno.h: define ERFKILL 2009-06-07 05:01:00 -07:00
fb.h
fcntl.h vfs: Implement proper O_SYNC semantics 2009-12-10 15:02:50 +01:00
fixmap.h MIPS: Fix machine check exception in kmap_coherent() 2009-11-02 12:00:04 +01:00
floppy.h
fpregdef.h
fpu_emulator.h MIPS: Switch FPU emulator trap to BREAK instruction. 2008-10-30 14:44:34 +00:00
fpu.h
ftrace.h tracing: make CALLER_ADDRx overwriteable 2009-03-02 16:49:37 -05:00
futex.h
gcmpregs.h MIPS: GIC: Random fixes and enhancements. 2009-11-02 12:00:06 +01:00
gic.h MIPS: GIC: Random fixes and enhancements. 2009-11-02 12:00:06 +01:00
gpio.h
gt64120.h
hardirq.h MIPS: Convert to asm-generic/hardirq.h 2009-09-17 20:07:48 +02:00
hazards.h MIPS: Loongson 2 needs no hazard barriers. 2009-05-14 13:50:26 +01:00
highmem.h MIPS: Fix highmem. 2009-05-14 13:50:29 +01:00
hugetlb.h MIPS: Add support files for hugetlbfs. 2009-06-17 11:06:30 +01:00
hw_irq.h
i8253.h time: move PIT_TICK_RATE to linux/timex.h 2009-06-16 19:47:27 -07:00
i8259.h
ide.h
inst.h
io.h MIPS: Modify core io.h macros to account for the Octeon Errata Core-301. 2009-01-11 09:57:22 +00:00
ioctl.h MIPS: ioctl.h: Cleanup. 2009-06-17 11:06:28 +01:00
ioctls.h
ipcbuf.h
irq_cpu.h
irq_gt641xx.h Update Yoichi Yuasa's e-mail address 2009-07-03 15:45:29 +01:00
irq_regs.h
irq.h MIPS: Build fix - include <linux/smp.h> into all smp_processor_id() users. 2009-06-24 18:34:39 +01:00
irqflags.h
isadep.h
jazz.h
jazzdma.h
Kbuild byteorder: make swab.h include asm/swab.h like a regular header 2009-01-14 19:56:50 -08:00
kdebug.h
kexec.h
kgdb.h
kmap_types.h kmap_types: make most arches use generic header file 2009-06-16 19:47:51 -07:00
kspd.h
linkage.h
local.h MIPS: Allow kernel use of LL/SC to be separate from the presence of LL/SC. 2009-09-17 20:07:50 +02:00
m48t37.h
mc146818-time.h mips: use bcd2bin/bin2bcd 2008-10-20 08:52:41 -07:00
mc146818rtc.h
mips_mt.h
mipsmtregs.h
mipsprom.h
mipsregs.h MIPS: Add hugetlbfs page defines. 2009-06-17 11:06:30 +01:00
mman.h MIPS: Add missing definition for MADV_HWPOISON. 2009-12-01 16:21:25 +00:00
mmu_context.h MIPS: Avoid potential hazard on Context register 2009-11-02 12:00:07 +01:00
mmu.h
mmzone.h
module.h MIPS: Add Cavium OCTEON processor constants and CPU probe. 2009-01-11 09:57:22 +00:00
msc01_ic.h
msgbuf.h
mutex.h
nile4.h
paccess.h
page.h MIPS: make page.h constants available to assembly. 2009-09-17 20:07:42 +02:00
param.h
parport.h
pci.h PCI: remove pcibios_scan_all_fns() 2009-09-09 13:29:18 -07:00
percpu.h
pgalloc.h mm: Remove duplicate definitions in MIPS and SH 2009-07-27 17:26:44 -07:00
pgtable-32.h
pgtable-64.h MIPS: Shrink the size of tlb handler 2009-09-17 20:07:51 +02:00
pgtable-bits.h MIPS: Add hugetlbfs page defines. 2009-06-17 11:06:30 +01:00
pgtable.h mm: ZERO_PAGE without PTE_SPECIAL 2009-09-22 07:17:41 -07:00
pmon.h
poll.h
posix_types.h
prefetch.h MIPS: NEC VR5500 processor support fixup 2009-03-11 21:11:07 +01:00
processor.h MIPS: Avoid clobbering struct pt_regs in kthreads 2009-08-03 17:52:41 +01:00
ptrace.h MIPS: Fix a typo in watchpoint register structure. 2009-01-30 21:32:58 +00:00
r4k-timer.h
r4kcache.h MIPS: Support 64-byte D-cache line size 2009-06-17 11:06:24 +01:00
reboot.h
reg.h MIPS: 64-bit: Fix o32 core dump 2009-07-03 15:45:27 +01:00
regdef.h
resource.h
rm9k-ocd.h
rtlx.h
scatterlist.h
seccomp.h MIPS: Fix TIF_32BIT undefined problem when seccomp is disabled 2009-03-13 23:07:59 +01:00
sections.h
segment.h
sembuf.h
serial.h
setup.h MIPS: Extend COMMAND_LINE_SIZE 2009-11-02 12:00:01 +01:00
sgialib.h
sgiarcs.h
sgidefs.h
shmbuf.h
shmparam.h
sigcontext.h headers_check fix: mips, sigcontext.h 2009-02-01 11:01:26 +05:30
siginfo.h
signal.h asm-generic: rename termios.h, signal.h and mman.h 2009-06-11 21:01:52 +02:00
sim.h
smp-ops.h cpumask: arch_send_call_function_ipi_mask: mips 2009-09-24 09:34:45 +09:30
smp.h MIPS: SMP: Inline arch_send_call_function_{single_ipi,ipi_mask} 2009-09-30 21:47:00 +02:00
smtc_ipi.h MIPS: SMTC: Avoid queing multiple reschedule IPIs 2009-11-02 12:00:06 +01:00
smtc_proc.h
smtc.h
smvp.h
sni.h
socket.h net: Generalize socket rx gap / receive queue overflow cmsg 2009-10-12 13:26:31 -07:00
sockios.h
sparsemem.h
spinlock_types.h
spinlock.h Allow rwlocks to re-enable interrupts 2009-04-02 19:05:11 -07:00
spram.h MIPS: SPRAM: Clean up support code a little 2009-11-02 12:00:05 +01:00
stackframe.h MIPS: Cavium OCTEON multiplier state preservation. 2009-01-11 09:57:24 +00:00
stacktrace.h
stat.h
statfs.h
string.h
suspend.h MIPS: Add hibernation support 2009-06-17 11:06:31 +01:00
swab.h MIPS: Define __arch_swab64 for all mips r2 cpus 2009-07-03 15:45:25 +01:00
sysmips.h
system.h MIPS: Fix build error if __xchg() is not getting inlined. 2009-12-01 16:21:25 +00:00
termbits.h
termios.h MIPS: Add return value checks to user_termio_to_kernel_termios() 2009-01-30 21:32:57 +00:00
thread_info.h MIPS: Cleanup CONFIG_DEBUG_STACK_USAGE version of alloc_thread_info. 2009-11-02 12:00:01 +01:00
time.h mips: Use generic mult/shift factor calculation for clocks 2009-11-13 20:46:24 +01:00
timex.h
titan_dep.h
tlb.h
tlbdebug.h
tlbflush.h
topology.h
traps.h
txx9irq.h
txx9pio.h
txx9tmr.h
types.h asm-generic: introduce asm/bitsperlong.h 2009-06-11 21:02:14 +02:00
uaccess.h MIPS: Fix sparse warning in incompatiable argument type of clear_user. 2009-05-22 13:52:05 +01:00
ucontext.h
unaligned.h MIPS: Avoid spurious make includecheck message 2009-09-30 21:47:02 +02:00
unistd.h MIPS: Wire up recvmmsg syscall 2009-12-01 16:15:49 -08:00
user.h
vga.h
vpe.h
war.h
watch.h
wbflush.h
xor.h