Btrfs: use percpu counter for fs_info->delalloc_bytes
authorMiao Xie <miaox@cn.fujitsu.com>
Tue, 29 Jan 2013 10:10:51 +0000 (10:10 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Wed, 20 Feb 2013 17:59:05 +0000 (12:59 -0500)
commit963d678b0f7649300e3a67f2513ca9d830c6e303
tree4f7568f541891a7bbe8b279c98d21aec1cabe06f
parente2d845211eda9cf296e8edf6724b3d541f4fbfd5
Btrfs: use percpu counter for fs_info->delalloc_bytes

fs_info->delalloc_bytes is accessed very frequently, so use percpu
counter instead of the u64 variant for it to reduce the lock
contention.

This patch also fixed the problem that we access the variant
without the lock protection.At worst, we would not flush the
delalloc inodes, and just return ENOSPC error when we still have
some free space in the fs.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/extent-tree.c
fs/btrfs/inode.c