aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2016-03-25 13:25:56 -0400
committerDavid Sterba <dsterba@suse.com>2016-07-07 12:45:53 -0400
commitf376df2b7da3a40f62f861a65efdd8c29fa1b877 (patch)
tree80619bff6da54d004aeac46fd58f866c3a543f03 /fs/btrfs
parentf485c9ee32531794e39631437fcedc82d5b8e650 (diff)
Btrfs: add tracepoints for flush events
We want to track when we're triggering flushing from our reservation code and what flushing is being done when we start flushing. Thanks, Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ctree.h9
-rw-r--r--fs/btrfs/extent-tree.c22
2 files changed, 21 insertions, 10 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 2e04c9d6f21d..83a6a931af09 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -2626,6 +2626,15 @@ enum btrfs_reserve_flush_enum {
2626 BTRFS_RESERVE_FLUSH_ALL, 2626 BTRFS_RESERVE_FLUSH_ALL,
2627}; 2627};
2628 2628
2629enum btrfs_flush_state {
2630 FLUSH_DELAYED_ITEMS_NR = 1,
2631 FLUSH_DELAYED_ITEMS = 2,
2632 FLUSH_DELALLOC = 3,
2633 FLUSH_DELALLOC_WAIT = 4,
2634 ALLOC_CHUNK = 5,
2635 COMMIT_TRANS = 6,
2636};
2637
2629int btrfs_check_data_free_space(struct inode *inode, u64 start, u64 len); 2638int btrfs_check_data_free_space(struct inode *inode, u64 start, u64 len);
2630int btrfs_alloc_data_chunk_ondemand(struct inode *inode, u64 bytes); 2639int btrfs_alloc_data_chunk_ondemand(struct inode *inode, u64 bytes);
2631void btrfs_free_reserved_data_space(struct inode *inode, u64 start, u64 len); 2640void btrfs_free_reserved_data_space(struct inode *inode, u64 start, u64 len);
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 5d24ec44d99b..31ded6aae1f0 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4835,15 +4835,6 @@ commit:
4835 return btrfs_commit_transaction(trans, root); 4835 return btrfs_commit_transaction(trans, root);
4836} 4836}
4837 4837
4838enum flush_state {
4839 FLUSH_DELAYED_ITEMS_NR = 1,
4840 FLUSH_DELAYED_ITEMS = 2,
4841 FLUSH_DELALLOC = 3,
4842 FLUSH_DELALLOC_WAIT = 4,
4843 ALLOC_CHUNK = 5,
4844 COMMIT_TRANS = 6,
4845};
4846
4847struct reserve_ticket { 4838struct reserve_ticket {
4848 u64 bytes; 4839 u64 bytes;
4849 int error; 4840 int error;
@@ -4901,6 +4892,8 @@ static int flush_space(struct btrfs_root *root,
4901 break; 4892 break;
4902 } 4893 }
4903 4894
4895 trace_btrfs_flush_space(root->fs_info, space_info->flags, num_bytes,
4896 orig_bytes, state, ret);
4904 return ret; 4897 return ret;
4905} 4898}
4906 4899
@@ -5178,6 +5171,10 @@ static int __reserve_metadata_bytes(struct btrfs_root *root,
5178 list_add_tail(&ticket.list, &space_info->tickets); 5171 list_add_tail(&ticket.list, &space_info->tickets);
5179 if (!space_info->flush) { 5172 if (!space_info->flush) {
5180 space_info->flush = 1; 5173 space_info->flush = 1;
5174 trace_btrfs_trigger_flush(root->fs_info,
5175 space_info->flags,
5176 orig_bytes, flush,
5177 "enospc");
5181 queue_work(system_unbound_wq, 5178 queue_work(system_unbound_wq,
5182 &root->fs_info->async_reclaim_work); 5179 &root->fs_info->async_reclaim_work);
5183 } 5180 }
@@ -5194,9 +5191,14 @@ static int __reserve_metadata_bytes(struct btrfs_root *root,
5194 */ 5191 */
5195 if (!root->fs_info->log_root_recovering && 5192 if (!root->fs_info->log_root_recovering &&
5196 need_do_async_reclaim(space_info, root->fs_info, used) && 5193 need_do_async_reclaim(space_info, root->fs_info, used) &&
5197 !work_busy(&root->fs_info->async_reclaim_work)) 5194 !work_busy(&root->fs_info->async_reclaim_work)) {
5195 trace_btrfs_trigger_flush(root->fs_info,
5196 space_info->flags,
5197 orig_bytes, flush,
5198 "preempt");
5198 queue_work(system_unbound_wq, 5199 queue_work(system_unbound_wq,
5199 &root->fs_info->async_reclaim_work); 5200 &root->fs_info->async_reclaim_work);
5201 }
5200 } 5202 }
5201 spin_unlock(&space_info->lock); 5203 spin_unlock(&space_info->lock);
5202 if (!ret || flush == BTRFS_RESERVE_NO_FLUSH) 5204 if (!ret || flush == BTRFS_RESERVE_NO_FLUSH)