diff options
author | Yan Zheng <zheng.yan@oracle.com> | 2009-01-21 12:54:03 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-01-21 12:54:03 -0500 |
commit | 7237f1833601dcc435a64176c2c347ec4bd959f9 (patch) | |
tree | 5e12b9a7655f03181605e02fd91b42e68ee92c2e /fs/btrfs/ctree.h | |
parent | 7e6628544abad773222d8b177f738ac2db1859de (diff) |
Btrfs: fix tree logs parallel sync
To improve performance, btrfs_sync_log merges tree log sync
requests. But it wrongly merges sync requests for different
tree logs. If multiple tree logs are synced at the same time,
only one of them actually gets synced.
This patch has following changes to fix the bug:
Move most tree log related fields in btrfs_fs_info to
btrfs_root. This allows merging sync requests separately
for each tree log.
Don't insert root item into the log root tree immediately
after log tree is allocated. Root item for log tree is
inserted when log tree get synced for the first time. This
allows syncing the log root tree without first syncing all
log trees.
At tree-log sync, btrfs_sync_log first sync the log tree;
then updates corresponding root item in the log root tree;
sync the log root tree; then update the super block.
Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index e1fec636f37f..de103a8a815e 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -695,9 +695,7 @@ struct btrfs_fs_info { | |||
695 | struct btrfs_transaction *running_transaction; | 695 | struct btrfs_transaction *running_transaction; |
696 | wait_queue_head_t transaction_throttle; | 696 | wait_queue_head_t transaction_throttle; |
697 | wait_queue_head_t transaction_wait; | 697 | wait_queue_head_t transaction_wait; |
698 | |||
699 | wait_queue_head_t async_submit_wait; | 698 | wait_queue_head_t async_submit_wait; |
700 | wait_queue_head_t tree_log_wait; | ||
701 | 699 | ||
702 | struct btrfs_super_block super_copy; | 700 | struct btrfs_super_block super_copy; |
703 | struct btrfs_super_block super_for_commit; | 701 | struct btrfs_super_block super_for_commit; |
@@ -724,10 +722,6 @@ struct btrfs_fs_info { | |||
724 | atomic_t async_submit_draining; | 722 | atomic_t async_submit_draining; |
725 | atomic_t nr_async_bios; | 723 | atomic_t nr_async_bios; |
726 | atomic_t async_delalloc_pages; | 724 | atomic_t async_delalloc_pages; |
727 | atomic_t tree_log_writers; | ||
728 | atomic_t tree_log_commit; | ||
729 | unsigned long tree_log_batch; | ||
730 | u64 tree_log_transid; | ||
731 | 725 | ||
732 | /* | 726 | /* |
733 | * this is used by the balancing code to wait for all the pending | 727 | * this is used by the balancing code to wait for all the pending |
@@ -827,7 +821,14 @@ struct btrfs_root { | |||
827 | struct kobject root_kobj; | 821 | struct kobject root_kobj; |
828 | struct completion kobj_unregister; | 822 | struct completion kobj_unregister; |
829 | struct mutex objectid_mutex; | 823 | struct mutex objectid_mutex; |
824 | |||
830 | struct mutex log_mutex; | 825 | struct mutex log_mutex; |
826 | wait_queue_head_t log_writer_wait; | ||
827 | wait_queue_head_t log_commit_wait[2]; | ||
828 | atomic_t log_writers; | ||
829 | atomic_t log_commit[2]; | ||
830 | unsigned long log_transid; | ||
831 | unsigned long log_batch; | ||
831 | 832 | ||
832 | u64 objectid; | 833 | u64 objectid; |
833 | u64 last_trans; | 834 | u64 last_trans; |