jbd2.h 9.8 KB
Newer Older
1 2 3
#undef TRACE_SYSTEM
#define TRACE_SYSTEM jbd2

4 5 6 7 8 9
#if !defined(_TRACE_JBD2_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_JBD2_H

#include <linux/jbd2.h>
#include <linux/tracepoint.h>

10 11 12
struct transaction_chp_stats_s;
struct transaction_run_stats_s;

13 14 15 16 17 18 19
TRACE_EVENT(jbd2_checkpoint,

	TP_PROTO(journal_t *journal, int result),

	TP_ARGS(journal, result),

	TP_STRUCT__entry(
20
		__field(	dev_t,	dev			)
21 22 23 24
		__field(	int,	result			)
	),

	TP_fast_assign(
25
		__entry->dev		= journal->j_fs_dev->bd_dev;
26 27 28
		__entry->result		= result;
	),

29 30
	TP_printk("dev %d,%d result %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->result)
31 32
);

33
DECLARE_EVENT_CLASS(jbd2_commit,
34 35 36 37 38 39

	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),

	TP_ARGS(journal, commit_transaction),

	TP_STRUCT__entry(
40
		__field(	dev_t,	dev			)
41 42 43 44 45
		__field(	char,	sync_commit		  )
		__field(	int,	transaction		  )
	),

	TP_fast_assign(
46
		__entry->dev		= journal->j_fs_dev->bd_dev;
47 48 49 50
		__entry->sync_commit = commit_transaction->t_synchronous_commit;
		__entry->transaction	= commit_transaction->t_tid;
	),

51 52 53
	TP_printk("dev %d,%d transaction %d sync %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->transaction, __entry->sync_commit)
54 55
);

56
DEFINE_EVENT(jbd2_commit, jbd2_start_commit,
57 58 59

	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),

60
	TP_ARGS(journal, commit_transaction)
61 62
);

63
DEFINE_EVENT(jbd2_commit, jbd2_commit_locking,
64 65 66

	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),

67
	TP_ARGS(journal, commit_transaction)
68 69
);

70
DEFINE_EVENT(jbd2_commit, jbd2_commit_flushing,
71 72 73

	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),

74 75
	TP_ARGS(journal, commit_transaction)
);
76

77
DEFINE_EVENT(jbd2_commit, jbd2_commit_logging,
78

79
	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),
80

81
	TP_ARGS(journal, commit_transaction)
82 83
);

84 85 86 87 88 89 90
DEFINE_EVENT(jbd2_commit, jbd2_drop_transaction,

	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),

	TP_ARGS(journal, commit_transaction)
);

91 92 93 94 95 96
TRACE_EVENT(jbd2_end_commit,
	TP_PROTO(journal_t *journal, transaction_t *commit_transaction),

	TP_ARGS(journal, commit_transaction),

	TP_STRUCT__entry(
97
		__field(	dev_t,	dev			)
98 99 100 101 102 103
		__field(	char,	sync_commit		  )
		__field(	int,	transaction		  )
		__field(	int,	head		  	  )
	),

	TP_fast_assign(
104
		__entry->dev		= journal->j_fs_dev->bd_dev;
105 106 107 108 109
		__entry->sync_commit = commit_transaction->t_synchronous_commit;
		__entry->transaction	= commit_transaction->t_tid;
		__entry->head		= journal->j_tail_sequence;
	),

110 111 112
	TP_printk("dev %d,%d transaction %d sync %d head %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->transaction, __entry->sync_commit, __entry->head)
113 114 115 116 117 118 119 120
);

TRACE_EVENT(jbd2_submit_inode_data,
	TP_PROTO(struct inode *inode),

	TP_ARGS(inode),

	TP_STRUCT__entry(
121
		__field(	dev_t,	dev			)
122 123 124 125
		__field(	ino_t,	ino			)
	),

	TP_fast_assign(
126
		__entry->dev	= inode->i_sb->s_dev;
127 128 129
		__entry->ino	= inode->i_ino;
	),

130 131 132
	TP_printk("dev %d,%d ino %lu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  (unsigned long) __entry->ino)
133 134
);

135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
TRACE_EVENT(jbd2_handle_start,
	TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
		 unsigned int line_no, int requested_blocks),

	TP_ARGS(dev, tid, type, line_no, requested_blocks),

	TP_STRUCT__entry(
		__field(		dev_t,	dev		)
		__field(	unsigned long,	tid		)
		__field(	 unsigned int,	type		)
		__field(	 unsigned int,	line_no		)
		__field(		  int,	requested_blocks)
	),

	TP_fast_assign(
		__entry->dev		  = dev;
		__entry->tid		  = tid;
		__entry->type		  = type;
		__entry->line_no	  = line_no;
		__entry->requested_blocks = requested_blocks;
	),

	TP_printk("dev %d,%d tid %lu type %u line_no %u "
		  "requested_blocks %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
		  __entry->type, __entry->line_no, __entry->requested_blocks)
);

TRACE_EVENT(jbd2_handle_extend,
	TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
		 unsigned int line_no, int buffer_credits,
		 int requested_blocks),

	TP_ARGS(dev, tid, type, line_no, buffer_credits, requested_blocks),

	TP_STRUCT__entry(
		__field(		dev_t,	dev		)
		__field(	unsigned long,	tid		)
		__field(	 unsigned int,	type		)
		__field(	 unsigned int,	line_no		)
		__field(		  int,	buffer_credits  )
		__field(		  int,	requested_blocks)
	),

	TP_fast_assign(
		__entry->dev		  = dev;
		__entry->tid		  = tid;
		__entry->type		  = type;
		__entry->line_no	  = line_no;
		__entry->buffer_credits   = buffer_credits;
		__entry->requested_blocks = requested_blocks;
	),

	TP_printk("dev %d,%d tid %lu type %u line_no %u "
		  "buffer_credits %d requested_blocks %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
		  __entry->type, __entry->line_no, __entry->buffer_credits,
		  __entry->requested_blocks)
);

TRACE_EVENT(jbd2_handle_stats,
	TP_PROTO(dev_t dev, unsigned long tid, unsigned int type,
		 unsigned int line_no, int interval, int sync,
		 int requested_blocks, int dirtied_blocks),

	TP_ARGS(dev, tid, type, line_no, interval, sync,
		requested_blocks, dirtied_blocks),

	TP_STRUCT__entry(
		__field(		dev_t,	dev		)
		__field(	unsigned long,	tid		)
		__field(	 unsigned int,	type		)
		__field(	 unsigned int,	line_no		)
		__field(		  int,	interval	)
		__field(		  int,	sync		)
		__field(		  int,	requested_blocks)
		__field(		  int,	dirtied_blocks	)
	),

	TP_fast_assign(
		__entry->dev		  = dev;
		__entry->tid		  = tid;
		__entry->type		  = type;
		__entry->line_no	  = line_no;
		__entry->interval	  = interval;
		__entry->sync		  = sync;
		__entry->requested_blocks = requested_blocks;
		__entry->dirtied_blocks	  = dirtied_blocks;
	),

	TP_printk("dev %d,%d tid %lu type %u line_no %u interval %d "
		  "sync %d requested_blocks %d dirtied_blocks %d",
		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
		  __entry->type, __entry->line_no, __entry->interval,
		  __entry->sync, __entry->requested_blocks,
		  __entry->dirtied_blocks)
);

233 234 235 236 237 238 239
TRACE_EVENT(jbd2_run_stats,
	TP_PROTO(dev_t dev, unsigned long tid,
		 struct transaction_run_stats_s *stats),

	TP_ARGS(dev, tid, stats),

	TP_STRUCT__entry(
240
		__field(		dev_t,	dev		)
241 242
		__field(	unsigned long,	tid		)
		__field(	unsigned long,	wait		)
243
		__field(	unsigned long,	request_delay	)
244 245 246 247 248 249 250 251 252 253
		__field(	unsigned long,	running		)
		__field(	unsigned long,	locked		)
		__field(	unsigned long,	flushing	)
		__field(	unsigned long,	logging		)
		__field(		__u32,	handle_count	)
		__field(		__u32,	blocks		)
		__field(		__u32,	blocks_logged	)
	),

	TP_fast_assign(
254
		__entry->dev		= dev;
255 256
		__entry->tid		= tid;
		__entry->wait		= stats->rs_wait;
257
		__entry->request_delay	= stats->rs_request_delay;
258 259 260 261 262 263 264 265 266
		__entry->running	= stats->rs_running;
		__entry->locked		= stats->rs_locked;
		__entry->flushing	= stats->rs_flushing;
		__entry->logging	= stats->rs_logging;
		__entry->handle_count	= stats->rs_handle_count;
		__entry->blocks		= stats->rs_blocks;
		__entry->blocks_logged	= stats->rs_blocks_logged;
	),

267 268 269
	TP_printk("dev %d,%d tid %lu wait %u request_delay %u running %u "
		  "locked %u flushing %u logging %u handle_count %u "
		  "blocks %u blocks_logged %u",
270
		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
271
		  jiffies_to_msecs(__entry->wait),
272
		  jiffies_to_msecs(__entry->request_delay),
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287
		  jiffies_to_msecs(__entry->running),
		  jiffies_to_msecs(__entry->locked),
		  jiffies_to_msecs(__entry->flushing),
		  jiffies_to_msecs(__entry->logging),
		  __entry->handle_count, __entry->blocks,
		  __entry->blocks_logged)
);

TRACE_EVENT(jbd2_checkpoint_stats,
	TP_PROTO(dev_t dev, unsigned long tid,
		 struct transaction_chp_stats_s *stats),

	TP_ARGS(dev, tid, stats),

	TP_STRUCT__entry(
288
		__field(		dev_t,	dev		)
289 290 291 292 293 294 295 296
		__field(	unsigned long,	tid		)
		__field(	unsigned long,	chp_time	)
		__field(		__u32,	forced_to_close	)
		__field(		__u32,	written		)
		__field(		__u32,	dropped		)
	),

	TP_fast_assign(
297
		__entry->dev		= dev;
298 299 300 301 302 303 304
		__entry->tid		= tid;
		__entry->chp_time	= stats->cs_chp_time;
		__entry->forced_to_close= stats->cs_forced_to_close;
		__entry->written	= stats->cs_written;
		__entry->dropped	= stats->cs_dropped;
	),

305
	TP_printk("dev %d,%d tid %lu chp_time %u forced_to_close %u "
306
		  "written %u dropped %u",
307
		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->tid,
308 309 310 311
		  jiffies_to_msecs(__entry->chp_time),
		  __entry->forced_to_close, __entry->written, __entry->dropped)
);

312
TRACE_EVENT(jbd2_update_log_tail,
313 314 315 316 317 318 319

	TP_PROTO(journal_t *journal, tid_t first_tid,
		 unsigned long block_nr, unsigned long freed),

	TP_ARGS(journal, first_tid, block_nr, freed),

	TP_STRUCT__entry(
320
		__field(	dev_t,	dev			)
321 322 323 324 325 326 327
		__field(	tid_t,	tail_sequence		)
		__field(	tid_t,	first_tid		)
		__field(unsigned long,	block_nr		)
		__field(unsigned long,	freed			)
	),

	TP_fast_assign(
328
		__entry->dev		= journal->j_fs_dev->bd_dev;
329 330 331 332 333 334
		__entry->tail_sequence	= journal->j_tail_sequence;
		__entry->first_tid	= first_tid;
		__entry->block_nr	= block_nr;
		__entry->freed		= freed;
	),

335 336 337 338
	TP_printk("dev %d,%d from %u to %u offset %lu freed %lu",
		  MAJOR(__entry->dev), MINOR(__entry->dev),
		  __entry->tail_sequence, __entry->first_tid,
		  __entry->block_nr, __entry->freed)
339 340
);

341
TRACE_EVENT(jbd2_write_superblock,
342

343
	TP_PROTO(journal_t *journal, int write_op),
344

345
	TP_ARGS(journal, write_op),
346 347 348

	TP_STRUCT__entry(
		__field(	dev_t,  dev			)
349
		__field(	  int,  write_op		)
350 351 352 353
	),

	TP_fast_assign(
		__entry->dev		= journal->j_fs_dev->bd_dev;
354
		__entry->write_op	= write_op;
355 356
	),

357 358
	TP_printk("dev %d,%d write_op %x", MAJOR(__entry->dev),
		  MINOR(__entry->dev), __entry->write_op)
359 360
);

361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381
TRACE_EVENT(jbd2_lock_buffer_stall,

	TP_PROTO(dev_t dev, unsigned long stall_ms),

	TP_ARGS(dev, stall_ms),

	TP_STRUCT__entry(
		__field(        dev_t, dev	)
		__field(unsigned long, stall_ms	)
	),

	TP_fast_assign(
		__entry->dev		= dev;
		__entry->stall_ms	= stall_ms;
	),

	TP_printk("dev %d,%d stall_ms %lu",
		MAJOR(__entry->dev), MINOR(__entry->dev),
		__entry->stall_ms)
);

382 383 384 385
#endif /* _TRACE_JBD2_H */

/* This part must be outside protection */
#include <trace/define_trace.h>