linux/fs/btrfs
Chris Mason 5a3f23d515 Btrfs: add extra flushing for renames and truncates
Renames and truncates are both common ways to replace old data with new
data.  The filesystem can make an effort to make sure the new data is
on disk before actually replacing the old data.

This is especially important for rename, which many application use as
though it were atomic for both the data and the metadata involved.  The
current btrfs code will happily replace a file that is fully on disk
with one that was just created and still has pending IO.

If we crash after transaction commit but before the IO is done, we'll end
up replacing a good file with a zero length file.  The solution used
here is to create a list of inodes that need special ordering and force
them to disk before the commit is done.  This is similar to the
ext3 style data=ordering, except it is only done on selected files.

Btrfs is able to get away with this because it does not wait on commits
very often, even for fsync (which use a sub-commit).

For renames, we order the file when it wasn't already
on disk and when it is replacing an existing file.  Larger files
are sent to filemap_flush right away (before the transaction handle is
opened).

For truncates, we order if the file goes from non-zero size down to
zero size.  This is a little different, because at the time of the
truncate the file has no dirty bytes to order.  But, we flag the inode
so that it is added to the ordered list on close (via release method).  We
also immediately add it to the ordered list of the current transaction
so that we can try to flush down any writes the application sneaks in
before commit.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-03-31 14:27:58 -04:00
..
Kconfig Btrfs: make btrfs acls selectable 2009-02-04 09:28:28 -05:00
Makefile Btrfs: do extent allocation and reference count updates in the background 2009-03-24 16:14:25 -04:00
acl.c Btrfs: Fix checkpatch.pl warnings 2009-01-05 21:25:51 -05:00
async-thread.c Btrfs: async threads should try harder to find work 2009-02-04 09:23:24 -05:00
async-thread.h Btrfs: Add ordered async work queues 2008-11-06 22:03:00 -05:00
btrfs_inode.h Btrfs: add extra flushing for renames and truncates 2009-03-31 14:27:58 -04:00
compat.h Btrfs: drop remaining LINUX_KERNEL_VERSION checks and compat code 2009-01-06 09:38:55 -05:00
compression.c Btrfs: removed unused #include <version.h>'s 2009-01-21 10:49:16 -05:00
compression.h Btrfs: Add zlib compression support 2008-10-29 14:49:59 -04:00
crc32c.h Btrfs: Drop the hardware crc32c asm code 2009-01-07 19:56:59 -05:00
ctree.c Btrfs: limit balancing work while flushing delayed refs 2009-03-24 16:14:51 -04:00
ctree.h Btrfs: add extra flushing for renames and truncates 2009-03-31 14:27:58 -04:00
delayed-ref.c Btrfs: make sure btrfs_update_delayed_ref doesn't increase ref_mod 2009-03-25 09:55:11 -04:00
delayed-ref.h Btrfs: make sure btrfs_update_delayed_ref doesn't increase ref_mod 2009-03-25 09:55:11 -04:00
dir-item.c Btrfs: leave btree locks spinning more often 2009-03-24 16:14:28 -04:00
disk-io.c Btrfs: add extra flushing for renames and truncates 2009-03-31 14:27:58 -04:00
disk-io.h Btrfs: leave btree locks spinning more often 2009-03-24 16:14:28 -04:00
export.c Btrfs: Fix checkpatch.pl warnings 2009-01-05 21:25:51 -05:00
export.h NFS support for btrfs - v3 2008-09-25 11:04:06 -04:00
extent-tree.c Btrfs: tree logging unlink/rename fixes 2009-03-24 16:14:52 -04:00
extent_io.c Btrfs: leave btree locks spinning more often 2009-03-24 16:14:28 -04:00
extent_io.h Btrfs: leave btree locks spinning more often 2009-03-24 16:14:28 -04:00
extent_map.c Btrfs: removed unused #include <version.h>'s 2009-01-21 10:49:16 -05:00
extent_map.h Btrfs: Fix csum error for compressed data 2008-11-10 07:34:43 -05:00
file-item.c Btrfs: leave btree locks spinning more often 2009-03-24 16:14:28 -04:00
file.c Btrfs: add extra flushing for renames and truncates 2009-03-31 14:27:58 -04:00
free-space-cache.c Btrfs: Fix checkpatch.pl warnings 2009-01-05 21:25:51 -05:00
hash.h Switch btrfs_name_hash() to crc32c 2008-09-25 11:04:06 -04:00
inode-item.c Btrfs: leave btree locks spinning more often 2009-03-24 16:14:28 -04:00
inode-map.c Btrfs: remove btrfs_init_path 2009-02-12 14:11:25 -05:00
inode.c Btrfs: add extra flushing for renames and truncates 2009-03-31 14:27:58 -04:00
ioctl.c Btrfs: add better -ENOSPC handling 2009-02-20 11:00:09 -05:00
ioctl.h Btrfs: fix ioctl arg size (userland incompatible change!) 2009-01-16 11:59:08 -05:00
locking.c Btrfs: leave btree locks spinning more often 2009-03-24 16:14:28 -04:00
locking.h Btrfs: fix spinlock assertions on UP systems 2009-03-09 11:45:38 -04:00
ordered-data.c Btrfs: add extra flushing for renames and truncates 2009-03-31 14:27:58 -04:00
ordered-data.h Btrfs: add extra flushing for renames and truncates 2009-03-31 14:27:58 -04:00
orphan.c Btrfs: Create orphan inode records to prevent lost files after a crash 2008-09-25 11:04:05 -04:00
print-tree.c Btrfs: Fix checkpatch.pl warnings 2009-01-05 21:25:51 -05: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
root-tree.c Btrfs: Fix checkpatch.pl warnings 2009-01-05 21:25:51 -05:00
struct-funcs.c Btrfs: Fix checkpatch.pl warnings 2009-01-05 21:25:51 -05:00
super.c Btrfs: don't clean old snapshots on sync(1) 2009-02-12 09:45:08 -05:00
sysfs.c Btrfs: Fix checkpatch.pl warnings 2009-01-05 21:25:51 -05:00
transaction.c Btrfs: add extra flushing for renames and truncates 2009-03-31 14:27:58 -04:00
transaction.h Btrfs: reduce stalls during transaction commit 2009-03-24 16:14:26 -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 Btrfs: optimize fsyncs on old files 2009-03-24 16:14:52 -04:00
tree-log.h Btrfs: tree logging unlink/rename fixes 2009-03-24 16:14:52 -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 Btrfs: Clear space_info full when adding new devices 2009-03-10 13:17:18 -04:00
volumes.h Btrfs: shared seed device 2008-12-12 10:03:26 -05:00
xattr.c Btrfs: selinux support 2009-02-04 09:29:13 -05:00
xattr.h Btrfs: selinux support 2009-02-04 09:29:13 -05:00
zlib.c Btrfs: Fix checkpatch.pl warnings 2009-01-05 21:25:51 -05:00