diff options
author | Josef Bacik <josef@redhat.com> | 2011-11-10 08:29:20 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2012-01-16 15:29:42 -0500 |
commit | 3f7de037fb3727b20bc27332cdcf2488b702394c (patch) | |
tree | 7e355b7e60b584ca7aaaf7c8abfa1f2408c15ff2 /fs/btrfs | |
parent | 45a8090e626ab470c91142954431a93846030b0d (diff) |
Btrfs: add allocator tracepoints
I used these tracepoints when figuring out what the cluster stuff was doing, so
add them to mainline in case we need to profile this stuff again. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/extent-tree.c | 9 | ||||
-rw-r--r-- | fs/btrfs/free-space-cache.c | 12 |
2 files changed, 20 insertions, 1 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a44072a692ab..ad1a20bc834d 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -5256,6 +5256,8 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, | |||
5256 | ins->objectid = 0; | 5256 | ins->objectid = 0; |
5257 | ins->offset = 0; | 5257 | ins->offset = 0; |
5258 | 5258 | ||
5259 | trace_find_free_extent(orig_root, num_bytes, empty_size, data); | ||
5260 | |||
5259 | space_info = __find_space_info(root->fs_info, data); | 5261 | space_info = __find_space_info(root->fs_info, data); |
5260 | if (!space_info) { | 5262 | if (!space_info) { |
5261 | printk(KERN_ERR "No space info for %llu\n", data); | 5263 | printk(KERN_ERR "No space info for %llu\n", data); |
@@ -5432,6 +5434,8 @@ alloc: | |||
5432 | if (offset) { | 5434 | if (offset) { |
5433 | /* we have a block, we're done */ | 5435 | /* we have a block, we're done */ |
5434 | spin_unlock(&last_ptr->refill_lock); | 5436 | spin_unlock(&last_ptr->refill_lock); |
5437 | trace_btrfs_reserve_extent_cluster(root, | ||
5438 | block_group, search_start, num_bytes); | ||
5435 | goto checks; | 5439 | goto checks; |
5436 | } | 5440 | } |
5437 | 5441 | ||
@@ -5490,6 +5494,9 @@ refill_cluster: | |||
5490 | if (offset) { | 5494 | if (offset) { |
5491 | /* we found one, proceed */ | 5495 | /* we found one, proceed */ |
5492 | spin_unlock(&last_ptr->refill_lock); | 5496 | spin_unlock(&last_ptr->refill_lock); |
5497 | trace_btrfs_reserve_extent_cluster(root, | ||
5498 | block_group, search_start, | ||
5499 | num_bytes); | ||
5493 | goto checks; | 5500 | goto checks; |
5494 | } | 5501 | } |
5495 | } else if (!cached && loop > LOOP_CACHING_NOWAIT | 5502 | } else if (!cached && loop > LOOP_CACHING_NOWAIT |
@@ -5576,6 +5583,8 @@ checks: | |||
5576 | ins->objectid = search_start; | 5583 | ins->objectid = search_start; |
5577 | ins->offset = num_bytes; | 5584 | ins->offset = num_bytes; |
5578 | 5585 | ||
5586 | trace_btrfs_reserve_extent(orig_root, block_group, | ||
5587 | search_start, num_bytes); | ||
5579 | if (offset < search_start) | 5588 | if (offset < search_start) |
5580 | btrfs_add_free_space(used_block_group, offset, | 5589 | btrfs_add_free_space(used_block_group, offset, |
5581 | search_start - offset); | 5590 | search_start - offset); |
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c index 6c7887a7770c..efe20032e4a1 100644 --- a/fs/btrfs/free-space-cache.c +++ b/fs/btrfs/free-space-cache.c | |||
@@ -2346,6 +2346,8 @@ again: | |||
2346 | &entry->offset_index, 1); | 2346 | &entry->offset_index, 1); |
2347 | BUG_ON(ret); | 2347 | BUG_ON(ret); |
2348 | 2348 | ||
2349 | trace_btrfs_setup_cluster(block_group, cluster, | ||
2350 | total_found * block_group->sectorsize, 1); | ||
2349 | return 0; | 2351 | return 0; |
2350 | } | 2352 | } |
2351 | 2353 | ||
@@ -2368,6 +2370,7 @@ setup_cluster_no_bitmap(struct btrfs_block_group_cache *block_group, | |||
2368 | u64 window_start; | 2370 | u64 window_start; |
2369 | u64 window_free; | 2371 | u64 window_free; |
2370 | u64 max_extent; | 2372 | u64 max_extent; |
2373 | u64 total_size = 0; | ||
2371 | 2374 | ||
2372 | entry = tree_search_offset(ctl, offset, 0, 1); | 2375 | entry = tree_search_offset(ctl, offset, 0, 1); |
2373 | if (!entry) | 2376 | if (!entry) |
@@ -2433,11 +2436,12 @@ setup_cluster_no_bitmap(struct btrfs_block_group_cache *block_group, | |||
2433 | rb_erase(&entry->offset_index, &ctl->free_space_offset); | 2436 | rb_erase(&entry->offset_index, &ctl->free_space_offset); |
2434 | ret = tree_insert_offset(&cluster->root, entry->offset, | 2437 | ret = tree_insert_offset(&cluster->root, entry->offset, |
2435 | &entry->offset_index, 0); | 2438 | &entry->offset_index, 0); |
2439 | total_size += entry->bytes; | ||
2436 | BUG_ON(ret); | 2440 | BUG_ON(ret); |
2437 | } while (node && entry != last); | 2441 | } while (node && entry != last); |
2438 | 2442 | ||
2439 | cluster->max_size = max_extent; | 2443 | cluster->max_size = max_extent; |
2440 | 2444 | trace_btrfs_setup_cluster(block_group, cluster, total_size, 0); | |
2441 | return 0; | 2445 | return 0; |
2442 | } | 2446 | } |
2443 | 2447 | ||
@@ -2542,6 +2546,10 @@ int btrfs_find_space_cluster(struct btrfs_trans_handle *trans, | |||
2542 | goto out; | 2546 | goto out; |
2543 | } | 2547 | } |
2544 | 2548 | ||
2549 | trace_btrfs_find_cluster(block_group, offset, bytes, empty_size, | ||
2550 | min_bytes); | ||
2551 | |||
2552 | INIT_LIST_HEAD(&bitmaps); | ||
2545 | ret = setup_cluster_no_bitmap(block_group, cluster, &bitmaps, offset, | 2553 | ret = setup_cluster_no_bitmap(block_group, cluster, &bitmaps, offset, |
2546 | bytes + empty_size, | 2554 | bytes + empty_size, |
2547 | cont1_bytes, min_bytes); | 2555 | cont1_bytes, min_bytes); |
@@ -2559,6 +2567,8 @@ int btrfs_find_space_cluster(struct btrfs_trans_handle *trans, | |||
2559 | list_add_tail(&cluster->block_group_list, | 2567 | list_add_tail(&cluster->block_group_list, |
2560 | &block_group->cluster_list); | 2568 | &block_group->cluster_list); |
2561 | cluster->block_group = block_group; | 2569 | cluster->block_group = block_group; |
2570 | } else { | ||
2571 | trace_btrfs_failed_cluster_setup(block_group); | ||
2562 | } | 2572 | } |
2563 | out: | 2573 | out: |
2564 | spin_unlock(&cluster->lock); | 2574 | spin_unlock(&cluster->lock); |