summaryrefslogtreecommitdiff
path: root/fs/bcachefs/trace.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-03-17 21:35:51 -0400
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:09:28 -0400
commit3a306f3c2c303febffefea4caf09b2326107507a (patch)
tree7b8c5fdb8a809a2c57733893b46c2c5a55a7ac3b /fs/bcachefs/trace.h
parentf8494d253534d3c49e80a483b74469bbeb01367f (diff)
downloadlwn-3a306f3c2c303febffefea4caf09b2326107507a.tar.gz
lwn-3a306f3c2c303febffefea4caf09b2326107507a.zip
bcachefs: Fix large key cache keys
Previously, we'd go into an infinite loop when attempting to cache a bkey in the key cache larger than 128 u64s - since we were only using a u8 for the size field, it'd get rounded up to 256 then truncated to 0. Oops. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/trace.h')
-rw-r--r--fs/bcachefs/trace.h40
1 files changed, 37 insertions, 3 deletions
diff --git a/fs/bcachefs/trace.h b/fs/bcachefs/trace.h
index af3785254c71..bb938dd8cdf2 100644
--- a/fs/bcachefs/trace.h
+++ b/fs/bcachefs/trace.h
@@ -918,12 +918,46 @@ TRACE_EVENT(trans_restart_mem_realloced,
__entry->bytes)
);
-DEFINE_EVENT(transaction_restart_iter, trans_restart_key_cache_key_realloced,
+TRACE_EVENT(trans_restart_key_cache_key_realloced,
TP_PROTO(const char *trans_fn,
unsigned long caller_ip,
enum btree_id btree_id,
- struct bpos *pos),
- TP_ARGS(trans_fn, caller_ip, btree_id, pos)
+ struct bpos *pos,
+ unsigned old_u64s,
+ unsigned new_u64s),
+ TP_ARGS(trans_fn, caller_ip, btree_id, pos, old_u64s, new_u64s),
+
+ TP_STRUCT__entry(
+ __array(char, trans_fn, 24 )
+ __field(unsigned long, caller_ip )
+ __field(enum btree_id, btree_id )
+ __field(u64, inode )
+ __field(u64, offset )
+ __field(u32, snapshot )
+ __field(u32, old_u64s )
+ __field(u32, new_u64s )
+ ),
+
+ TP_fast_assign(
+ strncpy(__entry->trans_fn, trans_fn, sizeof(__entry->trans_fn));
+ __entry->caller_ip = caller_ip;
+ __entry->btree_id = btree_id;
+ __entry->inode = pos->inode;
+ __entry->offset = pos->offset;
+ __entry->snapshot = pos->snapshot;
+ __entry->old_u64s = old_u64s;
+ __entry->new_u64s = new_u64s;
+ ),
+
+ TP_printk("%s %pS btree %s pos %llu:%llu:%u old_u64s %u new_u64s %u",
+ __entry->trans_fn,
+ (void *) __entry->caller_ip,
+ bch2_btree_ids[__entry->btree_id],
+ __entry->inode,
+ __entry->offset,
+ __entry->snapshot,
+ __entry->old_u64s,
+ __entry->new_u64s)
);
#endif /* _TRACE_BCACHEFS_H */