Skip to content

Commit f3e75e3

Browse files
josefbacikkdave
authored andcommitted
btrfs: roll tracepoint into btrfs_space_info_update helper
We duplicate this tracepoint everywhere we call these helpers, so update the helper to have the tracepoint as well. Signed-off-by: Josef Bacik <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent ef1317a commit f3e75e3

File tree

6 files changed

+7
-34
lines changed

6 files changed

+7
-34
lines changed

fs/btrfs/block-group.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2696,9 +2696,6 @@ int btrfs_update_block_group(struct btrfs_trans_handle *trans,
26962696
spin_unlock(&cache->lock);
26972697
spin_unlock(&cache->space_info->lock);
26982698

2699-
trace_btrfs_space_reservation(info, "pinned",
2700-
cache->space_info->flags,
2701-
num_bytes, 1);
27022699
percpu_counter_add_batch(
27032700
&cache->space_info->total_bytes_pinned,
27042701
num_bytes,

fs/btrfs/block-rsv.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,11 @@ void btrfs_update_global_block_rsv(struct btrfs_fs_info *fs_info)
283283
block_rsv->reserved += num_bytes;
284284
btrfs_space_info_update_bytes_may_use(fs_info, sinfo,
285285
num_bytes);
286-
trace_btrfs_space_reservation(fs_info, "space_info",
287-
sinfo->flags, num_bytes,
288-
1);
289286
}
290287
} else if (block_rsv->reserved > block_rsv->size) {
291288
num_bytes = block_rsv->reserved - block_rsv->size;
292289
btrfs_space_info_update_bytes_may_use(fs_info, sinfo,
293290
-num_bytes);
294-
trace_btrfs_space_reservation(fs_info, "space_info",
295-
sinfo->flags, num_bytes, 0);
296291
block_rsv->reserved = block_rsv->size;
297292
}
298293

fs/btrfs/delalloc-space.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,6 @@ int btrfs_alloc_data_chunk_ondemand(struct btrfs_inode *inode, u64 bytes)
130130
return -ENOSPC;
131131
}
132132
btrfs_space_info_update_bytes_may_use(fs_info, data_sinfo, bytes);
133-
trace_btrfs_space_reservation(fs_info, "space_info",
134-
data_sinfo->flags, bytes, 1);
135133
spin_unlock(&data_sinfo->lock);
136134

137135
return 0;
@@ -183,8 +181,6 @@ void btrfs_free_reserved_data_space_noquota(struct inode *inode, u64 start,
183181
data_sinfo = fs_info->data_sinfo;
184182
spin_lock(&data_sinfo->lock);
185183
btrfs_space_info_update_bytes_may_use(fs_info, data_sinfo, -len);
186-
trace_btrfs_space_reservation(fs_info, "space_info",
187-
data_sinfo->flags, len, 0);
188184
spin_unlock(&data_sinfo->lock);
189185
}
190186

fs/btrfs/extent-tree.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2583,8 +2583,6 @@ static int pin_down_extent(struct btrfs_block_group_cache *cache,
25832583
spin_unlock(&cache->lock);
25842584
spin_unlock(&cache->space_info->lock);
25852585

2586-
trace_btrfs_space_reservation(fs_info, "pinned",
2587-
cache->space_info->flags, num_bytes, 1);
25882586
percpu_counter_add_batch(&cache->space_info->total_bytes_pinned,
25892587
num_bytes, BTRFS_TOTAL_BYTES_PINNED_BATCH);
25902588
set_extent_dirty(fs_info->pinned_extents, bytenr,
@@ -2842,9 +2840,6 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info,
28422840
spin_lock(&cache->lock);
28432841
cache->pinned -= len;
28442842
btrfs_space_info_update_bytes_pinned(fs_info, space_info, -len);
2845-
2846-
trace_btrfs_space_reservation(fs_info, "pinned",
2847-
space_info->flags, len, 0);
28482843
space_info->max_extent_size = 0;
28492844
percpu_counter_add_batch(&space_info->total_bytes_pinned,
28502845
-len, BTRFS_TOTAL_BYTES_PINNED_BATCH);
@@ -2866,10 +2861,6 @@ static int unpin_extent_range(struct btrfs_fs_info *fs_info,
28662861
space_info, to_add);
28672862
if (global_rsv->reserved >= global_rsv->size)
28682863
global_rsv->full = 1;
2869-
trace_btrfs_space_reservation(fs_info,
2870-
"space_info",
2871-
space_info->flags,
2872-
to_add, 1);
28732864
len -= to_add;
28742865
}
28752866
spin_unlock(&global_rsv->lock);

fs/btrfs/space-info.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,6 @@ void btrfs_space_info_add_old_bytes(struct btrfs_fs_info *fs_info,
279279
goto again;
280280
}
281281
btrfs_space_info_update_bytes_may_use(fs_info, space_info, -num_bytes);
282-
trace_btrfs_space_reservation(fs_info, "space_info",
283-
space_info->flags, num_bytes, 0);
284282
spin_unlock(&space_info->lock);
285283
}
286284

@@ -301,9 +299,6 @@ void btrfs_space_info_add_new_bytes(struct btrfs_fs_info *fs_info,
301299
ticket = list_first_entry(head, struct reserve_ticket,
302300
list);
303301
if (num_bytes >= ticket->bytes) {
304-
trace_btrfs_space_reservation(fs_info, "space_info",
305-
space_info->flags,
306-
ticket->bytes, 1);
307302
list_del_init(&ticket->list);
308303
num_bytes -= ticket->bytes;
309304
btrfs_space_info_update_bytes_may_use(fs_info,
@@ -313,9 +308,6 @@ void btrfs_space_info_add_new_bytes(struct btrfs_fs_info *fs_info,
313308
space_info->tickets_id++;
314309
wake_up(&ticket->wait);
315310
} else {
316-
trace_btrfs_space_reservation(fs_info, "space_info",
317-
space_info->flags,
318-
num_bytes, 1);
319311
btrfs_space_info_update_bytes_may_use(fs_info,
320312
space_info,
321313
num_bytes);
@@ -1014,8 +1006,6 @@ static int __reserve_metadata_bytes(struct btrfs_fs_info *fs_info,
10141006
system_chunk))) {
10151007
btrfs_space_info_update_bytes_may_use(fs_info, space_info,
10161008
orig_bytes);
1017-
trace_btrfs_space_reservation(fs_info, "space_info",
1018-
space_info->flags, orig_bytes, 1);
10191009
ret = 0;
10201010
}
10211011

fs/btrfs/space-info.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,18 @@ static inline bool btrfs_mixed_space_info(struct btrfs_space_info *space_info)
8787
*
8888
* Declare a helper function to detect underflow of various space info members
8989
*/
90-
#define DECLARE_SPACE_INFO_UPDATE(name) \
90+
#define DECLARE_SPACE_INFO_UPDATE(name, trace_name) \
9191
static inline void \
9292
btrfs_space_info_update_##name(struct btrfs_fs_info *fs_info, \
9393
struct btrfs_space_info *sinfo, \
9494
s64 bytes) \
9595
{ \
96+
const u64 abs_bytes = (bytes < 0) ? -bytes : bytes; \
9697
lockdep_assert_held(&sinfo->lock); \
9798
trace_update_##name(fs_info, sinfo, sinfo->name, bytes); \
99+
trace_btrfs_space_reservation(fs_info, trace_name, \
100+
sinfo->flags, abs_bytes, \
101+
bytes > 0); \
98102
if (bytes < 0 && sinfo->name < -bytes) { \
99103
WARN_ON(1); \
100104
sinfo->name = 0; \
@@ -103,8 +107,8 @@ btrfs_space_info_update_##name(struct btrfs_fs_info *fs_info, \
103107
sinfo->name += bytes; \
104108
}
105109

106-
DECLARE_SPACE_INFO_UPDATE(bytes_may_use);
107-
DECLARE_SPACE_INFO_UPDATE(bytes_pinned);
110+
DECLARE_SPACE_INFO_UPDATE(bytes_may_use, "space_info");
111+
DECLARE_SPACE_INFO_UPDATE(bytes_pinned, "pinned");
108112

109113
void btrfs_space_info_add_new_bytes(struct btrfs_fs_info *fs_info,
110114
struct btrfs_space_info *space_info,

0 commit comments

Comments
 (0)