aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorYan Zheng <zheng.yan@oracle.com>2008-07-28 15:32:19 -0400
committerChris Mason <chris.mason@oracle.com>2008-09-25 11:04:05 -0400
commit31153d81284934601d08110ac7698fd9a535e4c0 (patch)
tree38f873fea3012a58d2a8f4d439a9546443617878 /fs/btrfs/disk-io.c
parent3a115f520f391b4ab14041bdd6eedb370d944fa6 (diff)
Btrfs: Add a leaf reference cache
Much of the IO done while dropping snapshots is done looking up leaves in the filesystem trees to see if they point to any extents and to drop the references on any extents found. This creates a cache so that IO isn't required. Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index d60923967347..4f0e1d06c384 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -716,6 +716,7 @@ static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
716 root->node = NULL; 716 root->node = NULL;
717 root->inode = NULL; 717 root->inode = NULL;
718 root->commit_root = NULL; 718 root->commit_root = NULL;
719 root->ref_tree = NULL;
719 root->sectorsize = sectorsize; 720 root->sectorsize = sectorsize;
720 root->nodesize = nodesize; 721 root->nodesize = nodesize;
721 root->leafsize = leafsize; 722 root->leafsize = leafsize;
@@ -1165,12 +1166,19 @@ static int transaction_kthread(void *arg)
1165 vfs_check_frozen(root->fs_info->sb, SB_FREEZE_WRITE); 1166 vfs_check_frozen(root->fs_info->sb, SB_FREEZE_WRITE);
1166 mutex_lock(&root->fs_info->transaction_kthread_mutex); 1167 mutex_lock(&root->fs_info->transaction_kthread_mutex);
1167 1168
1169 printk("btrfs: total reference cache size %Lu\n",
1170 root->fs_info->total_ref_cache_size);
1171
1168 mutex_lock(&root->fs_info->trans_mutex); 1172 mutex_lock(&root->fs_info->trans_mutex);
1169 cur = root->fs_info->running_transaction; 1173 cur = root->fs_info->running_transaction;
1170 if (!cur) { 1174 if (!cur) {
1171 mutex_unlock(&root->fs_info->trans_mutex); 1175 mutex_unlock(&root->fs_info->trans_mutex);
1172 goto sleep; 1176 goto sleep;
1173 } 1177 }
1178
1179 printk("btrfs: running reference cache size %Lu\n",
1180 root->fs_info->running_ref_cache_size);
1181
1174 now = get_seconds(); 1182 now = get_seconds();
1175 if (now < cur->start_time || now - cur->start_time < 30) { 1183 if (now < cur->start_time || now - cur->start_time < 30) {
1176 mutex_unlock(&root->fs_info->trans_mutex); 1184 mutex_unlock(&root->fs_info->trans_mutex);
@@ -1233,6 +1241,7 @@ struct btrfs_root *open_ctree(struct super_block *sb,
1233 spin_lock_init(&fs_info->hash_lock); 1241 spin_lock_init(&fs_info->hash_lock);
1234 spin_lock_init(&fs_info->delalloc_lock); 1242 spin_lock_init(&fs_info->delalloc_lock);
1235 spin_lock_init(&fs_info->new_trans_lock); 1243 spin_lock_init(&fs_info->new_trans_lock);
1244 spin_lock_init(&fs_info->ref_cache_lock);
1236 1245
1237 init_completion(&fs_info->kobj_unregister); 1246 init_completion(&fs_info->kobj_unregister);
1238 fs_info->tree_root = tree_root; 1247 fs_info->tree_root = tree_root;
@@ -1699,6 +1708,11 @@ int close_ctree(struct btrfs_root *root)
1699 printk("btrfs: at unmount delalloc count %Lu\n", 1708 printk("btrfs: at unmount delalloc count %Lu\n",
1700 fs_info->delalloc_bytes); 1709 fs_info->delalloc_bytes);
1701 } 1710 }
1711 if (fs_info->total_ref_cache_size) {
1712 printk("btrfs: at umount reference cache size %Lu\n",
1713 fs_info->total_ref_cache_size);
1714 }
1715
1702 if (fs_info->extent_root->node) 1716 if (fs_info->extent_root->node)
1703 free_extent_buffer(fs_info->extent_root->node); 1717 free_extent_buffer(fs_info->extent_root->node);
1704 1718