linux/fs/btrfs
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
..
acl.c Btrfs: fix btrfs acl #ifdef checks 2009-10-13 13:51:39 -04:00
async-thread.c Btrfs: fix deadlock on async thread startup 2009-10-05 09:44:45 -04:00
async-thread.h Btrfs: fix deadlock on async thread startup 2009-10-05 09:44:45 -04:00
btrfs_inode.h Btrfs: avoid tree log commit when there are no changes 2009-10-13 13:35:12 -04:00
compat.h Btrfs: drop remaining LINUX_KERNEL_VERSION checks and compat code 2009-01-06 09:38:55 -05:00
compression.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable 2009-09-11 19:07:25 -04:00
compression.h Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
ctree.c Btrfs: check size of inode backref before adding hardlink 2009-09-24 09:17:31 -04:00
ctree.h Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable 2009-10-15 15:06:37 -07:00
delayed-ref.c Btrfs: Mixed back reference (FORWARD ROLLING FORMAT CHANGE) 2009-06-10 11:29:46 -04:00
delayed-ref.h Btrfs: Mixed back reference (FORWARD ROLLING FORMAT CHANGE) 2009-06-10 11:29:46 -04:00
dir-item.c Btrfs: change how subvolumes are organized 2009-09-21 15:56:00 -04:00
disk-io.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable 2009-10-15 15:06:37 -07:00
disk-io.h Btrfs: leave btree locks spinning more often 2009-03-24 16:14:28 -04:00
export.c Btrfs: add snapshot/subvolume destroy ioctl 2009-09-21 16:00:26 -04:00
export.h NFS support for btrfs - v3 2008-09-25 11:04:06 -04:00
extent-tree.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable 2009-11-11 13:38:59 -08:00
extent_io.c Btrfs: release delalloc reservations on extent item insertion 2009-10-08 15:21:10 -04:00
extent_io.h Btrfs: release delalloc reservations on extent item insertion 2009-10-08 15:21:10 -04:00
extent_map.c Merge branch 'for-next' into for-linus 2009-12-07 18:36:35 +01:00
extent_map.h Btrfs: search for an allocation hint while filling file COW 2009-09-18 16:08:52 -04:00
file-item.c Btrfs: leave btree locks spinning more often 2009-03-24 16:14:28 -04:00
file.c vfs: Implement proper O_SYNC semantics 2009-12-10 15:02:50 +01:00
free-space-cache.c Btrfs: fix how we set max_size for free space clusters 2009-11-11 14:20:17 -05:00
free-space-cache.h Btrfs: use hybrid extents+bitmap rb tree for free space 2009-07-24 09:23:30 -04:00
hash.h Btrfs: remove crc32c.h and use libcrc32c directly. 2009-06-10 11:29:53 -04:00
inode-item.c Btrfs: check size of inode backref before adding hardlink 2009-09-24 09:17:31 -04:00
inode-map.c Btrfs: do not reuse objectid of deleted snapshot/subvol 2009-09-21 15:56:00 -04:00
inode.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable 2009-11-11 13:38:59 -08:00
ioctl.c Btrfs: fix file clone ioctl for bookend extents 2009-10-09 11:29:53 -04:00
ioctl.h Btrfs: add snapshot/subvolume destroy ioctl 2009-09-21 16:00:26 -04:00
Kconfig Btrfs: make btrfs acls selectable 2009-02-04 09:28:28 -05:00
locking.c Btrfs: fix typos in comments 2009-04-02 16:46:06 -04:00
locking.h Btrfs: fix spinlock assertions on UP systems 2009-03-09 11:45:38 -04:00
Makefile Btrfs: Mixed back reference (FORWARD ROLLING FORMAT CHANGE) 2009-06-10 11:29:46 -04:00
ordered-data.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable 2009-10-11 11:23:13 -07:00
ordered-data.h Btrfs: remove duplicates of filemap_ helpers 2009-10-01 12:58:30 -04:00
orphan.c Btrfs: change how subvolumes are organized 2009-09-21 15:56:00 -04:00
print-tree.c Btrfs: remove of redundant btrfs_header_level 2009-07-22 16:52:13 -04:00
print-tree.h Btrfs: Create extent_buffer interface for large blocksizes 2008-09-25 11:03:56 -04:00
ref-cache.c Btrfs: Make btrfs_drop_snapshot work in larger and more efficient chunks 2009-02-04 09:27:02 -05:00
ref-cache.h Btrfs: Make btrfs_drop_snapshot work in larger and more efficient chunks 2009-02-04 09:27:02 -05:00
relocation.c Btrfs: fix deadlock on async thread startup 2009-10-05 09:44:45 -04:00
root-tree.c Btrfs: skip btrfs_release_path in btrfs_update_root and btrfs_del_root 2009-11-11 14:20:18 -05:00
struct-funcs.c Btrfs: Fix checkpatch.pl warnings 2009-01-05 21:25:51 -05:00
super.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable 2009-10-15 15:06:37 -07:00
sysfs.c Btrfs: Fix checkpatch.pl warnings 2009-01-05 21:25:51 -05:00
transaction.c Btrfs: cleanup transaction starting and fix journal_info usage 2009-11-11 14:20:16 -05:00
transaction.h Btrfs: streamline tree-log btree block writeout 2009-10-13 13:35:12 -04:00
tree-defrag.c Btrfs: do extent allocation and reference count updates in the background 2009-03-24 16:14:25 -04:00
tree-log.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable 2009-10-15 15:06:37 -07:00
tree-log.h Btrfs: avoid tree log commit when there are no changes 2009-10-13 13:35:12 -04:00
version.h Update Btrfs files for in-kernel usage 2008-09-25 15:41:59 -04:00
version.sh Btrfs: Fixes for 2.6.28-rc API changes 2008-11-19 21:17:22 -05:00
volumes.c Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable into for-linus 2009-10-01 12:58:13 -04:00
volumes.h Btrfs: make balance code choose more wisely when relocating 2009-09-21 19:23:48 -04:00
xattr.c Btrfs: fix btrfs acl #ifdef checks 2009-10-13 13:51:39 -04:00
xattr.h Btrfs: selinux support 2009-02-04 09:29:13 -05:00
zlib.c Btrfs: correct error-handling zlib error handling 2009-08-07 13:51:33 -04:00