linux/fs/xfs
Christoph Hellwig 33b8f7c247 xfs: improve sync behaviour in the face of aggressive dirtying
The following script from Wu Fengguang shows very bad behaviour in XFS
when aggressively dirtying data during a sync on XFS, with sync times
up to almost 10 times as long as ext4.

A large part of the issue is that XFS writes data out itself two times
in the ->sync_fs method, overriding the livelock protection in the core
writeback code, and another issue is the lock-less xfs_ioend_wait call,
which doesn't prevent new ioend from being queue up while waiting for
the count to reach zero.

This patch removes the XFS-internal sync calls and relies on the VFS
to do it's work just like all other filesystems do.  Note that the
i_iocount wait which is rather suboptimal is simply removed here.
We already do it in ->write_inode, which keeps the current supoptimal
behaviour.  We'll eventually need to remove that as well, but that's
material for a separate commit.

------------------------------ snip ------------------------------
#!/bin/sh

umount /dev/sda7
mkfs.xfs -f /dev/sda7
# mkfs.ext4 /dev/sda7
# mkfs.btrfs /dev/sda7
mount /dev/sda7 /fs

echo $((50<<20)) > /proc/sys/vm/dirty_bytes

pid=
for i in `seq 10`
do
	dd if=/dev/zero of=/fs/zero-$i bs=1M count=1000 &
	pid="$pid $!"
done

sleep 1

tic=$(date +'%s')
sync
tac=$(date +'%s')

echo
echo sync time: $((tac-tic))
egrep '(Dirty|Writeback|NFS_Unstable)' /proc/meminfo

pidof dd > /dev/null && { kill -9 $pid; echo sync NOT livelocked; }
------------------------------ snip ------------------------------

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reported-by: Wu Fengguang <fengguang.wu@intel.com>
Reviewed-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
2011-07-08 14:34:39 +02:00
..
linux-2.6 xfs: improve sync behaviour in the face of aggressive dirtying 2011-07-08 14:34:39 +02:00
quota xfs: split xfs_itruncate_finish 2011-07-08 14:34:34 +02:00
support
Kconfig
Makefile Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs 2011-03-21 14:24:56 -07:00
xfs_acl.h
xfs_ag.h xfs: do not discard alloc btree blocks 2011-05-24 11:17:22 -05:00
xfs_alloc_btree.c xfs: work around bogus gcc warning in xfs_allocbt_init_cursor 2011-07-08 14:34:18 +02:00
xfs_alloc_btree.h
xfs_alloc.c xfs: do not discard alloc btree blocks 2011-05-24 11:17:22 -05:00
xfs_alloc.h xfs: do not discard alloc btree blocks 2011-05-24 11:17:22 -05:00
xfs_arch.h
xfs_attr_leaf.c
xfs_attr_leaf.h
xfs_attr_sf.h
xfs_attr.c xfs: split xfs_itruncate_finish 2011-07-08 14:34:34 +02:00
xfs_attr.h
xfs_bit.c
xfs_bit.h
xfs_bmap_btree.c
xfs_bmap_btree.h
xfs_bmap.c xfs: correctly decrement the extent buffer index in xfs_bmap_del_extent 2011-05-25 10:48:38 -05:00
xfs_bmap.h xfs: remove the unused XFS_BMAPI_RSVBLOCKS flag 2011-05-25 10:48:36 -05:00
xfs_btree_trace.c
xfs_btree_trace.h
xfs_btree.c
xfs_btree.h
xfs_buf_item.c Fix common misspellings 2011-03-31 11:26:23 -03:00
xfs_buf_item.h
xfs_da_btree.c
xfs_da_btree.h
xfs_dfrag.c xfs: cleanup duplicate initializations 2011-04-28 13:25:29 -05:00
xfs_dfrag.h
xfs_dinode.h
xfs_dir2_block.c
xfs_dir2_block.h
xfs_dir2_data.c
xfs_dir2_data.h
xfs_dir2_leaf.c
xfs_dir2_leaf.h
xfs_dir2_node.c
xfs_dir2_node.h
xfs_dir2_sf.c
xfs_dir2_sf.h
xfs_dir2.c
xfs_dir2.h
xfs_error.c
xfs_error.h
xfs_extfree_item.c
xfs_extfree_item.h
xfs_filestream.c
xfs_filestream.h
xfs_fs.h
xfs_fsops.c
xfs_fsops.h
xfs_ialloc_btree.c
xfs_ialloc_btree.h
xfs_ialloc.c
xfs_ialloc.h
xfs_iget.c xfs: reset inode per-lifetime state when recycling it 2011-06-23 22:13:31 -05:00
xfs_inode_item.c xfs: unpin stale inodes directly in IOP_COMMITTED 2011-07-06 15:44:40 -05:00
xfs_inode_item.h
xfs_inode.c xfs: split xfs_itruncate_finish 2011-07-08 14:34:34 +02:00
xfs_inode.h xfs: split xfs_itruncate_finish 2011-07-08 14:34:34 +02:00
xfs_inum.h
xfs_iomap.c
xfs_iomap.h
xfs_itable.c xfs: fix variable set but not used warnings 2011-04-08 08:09:12 -05:00
xfs_itable.h
xfs_log_cil.c xfs: add online discard support 2011-05-24 11:17:13 -05:00
xfs_log_priv.h xfs: exact busy extent tracking 2011-04-28 13:18:04 -05:00
xfs_log_recover.c xfs: reset buffer pointers before freeing them 2011-05-19 12:03:45 -05:00
xfs_log_recover.h
xfs_log.c xfs: make log devices with write back caches work 2011-06-16 10:52:39 -05:00
xfs_log.h xfs: exact busy extent tracking 2011-04-28 13:18:04 -05:00
xfs_mount.c xfs: cleanup duplicate initializations 2011-04-28 13:25:29 -05:00
xfs_mount.h xfs: add online discard support 2011-05-24 11:17:13 -05:00
xfs_mru_cache.c
xfs_mru_cache.h
xfs_quota.h
xfs_rename.c
xfs_rtalloc.c
xfs_rtalloc.h
xfs_rw.c
xfs_rw.h
xfs_sb.h
xfs_trans_ail.c xfs: fix race condition in AIL push trigger 2011-05-09 18:35:04 -05:00
xfs_trans_buf.c xfs: xfs_trans_read_buf() should return an error on failure 2011-03-26 09:14:44 +11:00
xfs_trans_extfree.c
xfs_trans_inode.c Fix common misspellings 2011-03-31 11:26:23 -03:00
xfs_trans_priv.h xfs: push the AIL from memory reclaim and periodic sync 2011-04-08 12:45:07 +10:00
xfs_trans_space.h
xfs_trans.c xfs: unpin stale inodes directly in IOP_COMMITTED 2011-07-06 15:44:40 -05:00
xfs_trans.h
xfs_types.h xfs: exact busy extent tracking 2011-04-28 13:18:04 -05:00
xfs_utils.c
xfs_utils.h
xfs_vnodeops.c xfs: split xfs_itruncate_finish 2011-07-08 14:34:34 +02:00
xfs_vnodeops.h xfs: split xfs_setattr 2011-07-08 14:34:23 +02:00
xfs.h