aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2013-01-29 05:10:51 -0500
committerJosef Bacik <jbacik@fusionio.com>2013-02-20 12:59:05 -0500
commit963d678b0f7649300e3a67f2513ca9d830c6e303 (patch)
tree4f7568f541891a7bbe8b279c98d21aec1cabe06f /fs/btrfs/ctree.h
parente2d845211eda9cf296e8edf6724b3d541f4fbfd5 (diff)
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>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 4c476281b66b..50def99f5379 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1392,6 +1392,7 @@ struct btrfs_fs_info {
1392 */ 1392 */
1393 struct list_head ordered_extents; 1393 struct list_head ordered_extents;
1394 1394
1395 spinlock_t delalloc_lock;
1395 /* 1396 /*
1396 * all of the inodes that have delalloc bytes. It is possible for 1397 * all of the inodes that have delalloc bytes. It is possible for
1397 * this list to be empty even when there is still dirty data=ordered 1398 * this list to be empty even when there is still dirty data=ordered
@@ -1452,7 +1453,10 @@ struct btrfs_fs_info {
1452 1453
1453 /* used to keep from writing metadata until there is a nice batch */ 1454 /* used to keep from writing metadata until there is a nice batch */
1454 struct percpu_counter dirty_metadata_bytes; 1455 struct percpu_counter dirty_metadata_bytes;
1456 struct percpu_counter delalloc_bytes;
1455 s32 dirty_metadata_batch; 1457 s32 dirty_metadata_batch;
1458 s32 delalloc_batch;
1459
1456 struct list_head dirty_cowonly_roots; 1460 struct list_head dirty_cowonly_roots;
1457 1461
1458 struct btrfs_fs_devices *fs_devices; 1462 struct btrfs_fs_devices *fs_devices;
@@ -1468,9 +1472,6 @@ struct btrfs_fs_info {
1468 1472
1469 struct reloc_control *reloc_ctl; 1473 struct reloc_control *reloc_ctl;
1470 1474
1471 spinlock_t delalloc_lock;
1472 u64 delalloc_bytes;
1473
1474 /* data_alloc_cluster is only used in ssd mode */ 1475 /* data_alloc_cluster is only used in ssd mode */
1475 struct btrfs_free_cluster data_alloc_cluster; 1476 struct btrfs_free_cluster data_alloc_cluster;
1476 1477