aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2008-07-28 15:32:51 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:05 -0400
commit017e5369eb353559d68a11d4a718faa634533821 (patch)
treec339f2f4a59e403c7f9bfa8d137663c6bf260537 /fs/btrfs/disk-io.c
parent31153d81284934601d08110ac7698fd9a535e4c0 (diff)
Btrfs: Leaf reference cache update
This changes the reference cache to make a single cache per root instead of one cache per transaction, and to key by the byte number of the disk block instead of the keys inside. This makes it much less likely to have cache misses if a snapshot or something has an extra reference on a higher node or a leaf while the first transaction that added the leaf into the cache is dropping. Some throttling is added to functions that free blocks heavily so they wait for old transactions to drop. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 4f0e1d06c384..eccdf13a95ac 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -40,6 +40,7 @@
40#include "print-tree.h" 40#include "print-tree.h"
41#include "async-thread.h" 41#include "async-thread.h"
42#include "locking.h" 42#include "locking.h"
43#include "ref-cache.h"
43 44
44#if 0 45#if 0
45static int check_tree_block(struct btrfs_root *root, struct extent_buffer *buf) 46static int check_tree_block(struct btrfs_root *root, struct extent_buffer *buf)
@@ -737,6 +738,10 @@ static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
737 spin_lock_init(&root->node_lock); 738 spin_lock_init(&root->node_lock);
738 spin_lock_init(&root->orphan_lock); 739 spin_lock_init(&root->orphan_lock);
739 mutex_init(&root->objectid_mutex); 740 mutex_init(&root->objectid_mutex);
741
742 btrfs_leaf_ref_tree_init(&root->ref_tree_struct);
743 root->ref_tree = &root->ref_tree_struct;
744
740 memset(&root->root_key, 0, sizeof(root->root_key)); 745 memset(&root->root_key, 0, sizeof(root->root_key));
741 memset(&root->root_item, 0, sizeof(root->root_item)); 746 memset(&root->root_item, 0, sizeof(root->root_item));
742 memset(&root->defrag_progress, 0, sizeof(root->defrag_progress)); 747 memset(&root->defrag_progress, 0, sizeof(root->defrag_progress));
@@ -1176,9 +1181,6 @@ static int transaction_kthread(void *arg)
1176 goto sleep; 1181 goto sleep;
1177 } 1182 }
1178 1183
1179 printk("btrfs: running reference cache size %Lu\n",
1180 root->fs_info->running_ref_cache_size);
1181
1182 now = get_seconds(); 1184 now = get_seconds();
1183 if (now < cur->start_time || now - cur->start_time < 30) { 1185 if (now < cur->start_time || now - cur->start_time < 30) {
1184 mutex_unlock(&root->fs_info->trans_mutex); 1186 mutex_unlock(&root->fs_info->trans_mutex);