• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * fs/hmdfs/hmdfs_trace.h
4  *
5  * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
6  */
7 
8 #undef TRACE_SYSTEM
9 #define TRACE_SYSTEM hmdfs
10 
11 #if !defined(__HMDFS_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ)
12 
13 #define __HMDFS_TRACE_H__
14 
15 #include <linux/tracepoint.h>
16 #include "comm/protocol.h"
17 #include "hmdfs_dentryfile.h"
18 #include "hmdfs_client.h"
19 #include "hmdfs_device_view.h"
20 #include "hmdfs_merge_view.h"
21 #include "client_writeback.h"
22 
23 TRACE_EVENT(hmdfs_permission,
24 
25 	    TP_PROTO(unsigned long ino),
26 
27 	    TP_ARGS(ino),
28 
29 	    TP_STRUCT__entry(__field(unsigned long, ino)),
30 
31 	    TP_fast_assign(__entry->ino = ino;),
32 
33 	    TP_printk("permission check for ino %lu failed", __entry->ino));
34 
35 /* communication */
36 TRACE_EVENT(hmdfs_recv_mesg_callback,
37 
38 	TP_PROTO(struct hmdfs_head_cmd *cmd),
39 
40 	TP_ARGS(cmd),
41 
42 	TP_STRUCT__entry(
43 		__field(__u32, msg_id)
44 		__field(__u32, magic)
45 		__field(__u16, command)
46 		__field(__u16, cmd_flag)
47 		__field(__u32, data_len)
48 		__field(__u32, ret_code)
49 	),
50 
51 	TP_fast_assign(
52 		__entry->msg_id = le32_to_cpu(cmd->msg_id);
53 		__entry->magic = cmd->magic;
54 		__entry->command = cmd->operations.command;
55 		__entry->cmd_flag = cmd->operations.cmd_flag;
56 		__entry->data_len = cmd->data_len;
57 		__entry->ret_code = cmd->ret_code;
58 	),
59 
60 	TP_printk("msg_id:%u magic:%u command:%hu, cmd_flag:%hu, data_len:%u, ret_code:%u",
61 		__entry->msg_id, __entry->magic, __entry->command,
62 		__entry->cmd_flag, __entry->data_len, __entry->ret_code)
63 );
64 
65 TRACE_EVENT(hmdfs_tcp_send_message,
66 
67 	TP_PROTO(struct hmdfs_head_cmd *cmd),
68 
69 	TP_ARGS(cmd),
70 
71 	TP_STRUCT__entry(
72 		__field(__u32, msg_id)
73 		__field(__u32, magic)
74 		__field(__u16, command)
75 		__field(__u16, cmd_flag)
76 		__field(__u32, data_len)
77 		__field(__u32, ret_code)
78 	),
79 
80 	TP_fast_assign(
81 		__entry->msg_id = le32_to_cpu(cmd->msg_id);
82 		__entry->magic = cmd->magic;
83 		__entry->command = cmd->operations.command;
84 		__entry->cmd_flag = cmd->operations.cmd_flag;
85 		__entry->data_len = cmd->data_len;
86 		__entry->ret_code = cmd->ret_code;
87 	),
88 
89 	TP_printk("msg_id:%u magic:%u command:%hu, cmd_flag:%hu, data_len:%u, ret_code:%u",
90 		__entry->msg_id, __entry->magic, __entry->command,
91 		__entry->cmd_flag, __entry->data_len, __entry->ret_code)
92 );
93 
94 /* file system interface */
95 DECLARE_EVENT_CLASS(hmdfs_iterate_op_end,
96 
97 	TP_PROTO(struct dentry *__d, loff_t start_pos, loff_t end_pos, int err),
98 
99 	TP_ARGS(__d, start_pos, end_pos, err),
100 
101 	TP_STRUCT__entry(
102 		__string(name_str, __d->d_name.name)
103 		__field(loff_t, start)
104 		__field(loff_t, end)
105 		__field(int, err)
106 	),
107 
108 	TP_fast_assign(
109 		__assign_str(name_str, __d->d_name.name);
110 		__entry->start = start_pos;
111 		__entry->end = end_pos;
112 		__entry->err = err;
113 	),
114 
115 	TP_printk("dentry[%s] start_pos:%llx, end_pos:%llx, err:%d",
116 		__get_str(name_str), __entry->start,
117 		__entry->end, __entry->err)
118 );
119 
120 #define define_hmdfs_iterate_op_end_event(event_name)                          \
121 	DEFINE_EVENT(hmdfs_iterate_op_end, event_name,                         \
122 		     TP_PROTO(struct dentry *__d, loff_t start_pos,            \
123 			      loff_t end_pos, int err),                        \
124 		     TP_ARGS(__d, start_pos, end_pos, err))
125 
126 define_hmdfs_iterate_op_end_event(hmdfs_iterate_local);
127 define_hmdfs_iterate_op_end_event(hmdfs_iterate_remote);
128 define_hmdfs_iterate_op_end_event(hmdfs_iterate_merge);
129 
130 
131 TRACE_EVENT(hmdfs_lookup,
132 
133 	TP_PROTO(struct inode *dir, struct dentry *dentry, unsigned int flags),
134 
135 	TP_ARGS(dir, dentry, flags),
136 
137 	TP_STRUCT__entry(
138 		__field(ino_t, ino)
139 		__string(name_str, dentry->d_name.name)
140 		__field(unsigned int, flags)
141 	),
142 
143 	TP_fast_assign(
144 		__entry->ino = dir->i_ino;
145 		__assign_str(name_str, dentry->d_name.name);
146 		__entry->flags = flags;
147 	),
148 
149 	TP_printk("parent_ino = %lu, name:%s, flags:%u",
150 		__entry->ino, __get_str(name_str), __entry->flags)
151 );
152 
153 DECLARE_EVENT_CLASS(hmdfs_lookup_op_end,
154 
155 	TP_PROTO(struct inode *dir, struct dentry *dentry, int err),
156 
157 	TP_ARGS(dir, dentry, err),
158 
159 	TP_STRUCT__entry(
160 		__field(ino_t, ino)
161 		__string(name_str, dentry->d_name.name)
162 		__field(int, err)
163 	),
164 
165 	TP_fast_assign(
166 		__entry->ino = dir->i_ino;
167 		__assign_str(name_str, dentry->d_name.name);
168 		__entry->err = err;
169 	),
170 
171 	TP_printk("parent_ino = %lu, name:%s, err:%d",
172 		__entry->ino, __get_str(name_str), __entry->err)
173 );
174 
175 #define define_hmdfs_lookup_op_end_event(event_name)                           \
176 	DEFINE_EVENT(hmdfs_lookup_op_end, event_name,                          \
177 		     TP_PROTO(struct inode *dir, struct dentry *dentry,        \
178 			      int err),                                        \
179 		     TP_ARGS(dir, dentry, err))
180 
181 
182 define_hmdfs_lookup_op_end_event(hmdfs_root_lookup);
183 define_hmdfs_lookup_op_end_event(hmdfs_root_lookup_end);
184 
185 define_hmdfs_lookup_op_end_event(hmdfs_device_lookup);
186 define_hmdfs_lookup_op_end_event(hmdfs_device_lookup_end);
187 
188 define_hmdfs_lookup_op_end_event(hmdfs_lookup_local);
189 define_hmdfs_lookup_op_end_event(hmdfs_lookup_local_end);
190 define_hmdfs_lookup_op_end_event(hmdfs_mkdir_local);
191 define_hmdfs_lookup_op_end_event(hmdfs_rmdir_local);
192 define_hmdfs_lookup_op_end_event(hmdfs_create_local);
193 
194 define_hmdfs_lookup_op_end_event(hmdfs_lookup_remote);
195 define_hmdfs_lookup_op_end_event(hmdfs_lookup_remote_end);
196 define_hmdfs_lookup_op_end_event(hmdfs_mkdir_remote);
197 define_hmdfs_lookup_op_end_event(hmdfs_rmdir_remote);
198 define_hmdfs_lookup_op_end_event(hmdfs_create_remote);
199 
200 define_hmdfs_lookup_op_end_event(hmdfs_lookup_merge);
201 define_hmdfs_lookup_op_end_event(hmdfs_lookup_merge_end);
202 define_hmdfs_lookup_op_end_event(hmdfs_mkdir_merge);
203 define_hmdfs_lookup_op_end_event(hmdfs_rmdir_merge);
204 define_hmdfs_lookup_op_end_event(hmdfs_create_merge);
205 
206 define_hmdfs_lookup_op_end_event(hmdfs_get_link_local);
207 define_hmdfs_lookup_op_end_event(hmdfs_lookup_share);
208 define_hmdfs_lookup_op_end_event(hmdfs_lookup_share_end);
209 
210 TRACE_EVENT(hmdfs_show_comrade,
211 
212 	TP_PROTO(struct dentry *d, struct dentry *lo_d, uint64_t devid),
213 
214 	TP_ARGS(d, lo_d, devid),
215 
216 	TP_STRUCT__entry(
217 		__string(name, d->d_name.name)
218 		__string(lo_name, lo_d->d_name.name)
219 		__field(uint64_t, devid)
220 	),
221 
222 	TP_fast_assign(
223 		__assign_str(name, d->d_name.name)
224 		__assign_str(lo_name, lo_d->d_name.name)
225 		__entry->devid = devid;
226 	),
227 
228 	TP_printk("parent_name:%s -> lo_d_name:%s, lo_d_devid:%llu",
229 		  __get_str(name), __get_str(lo_name), __entry->devid)
230 );
231 
232 DECLARE_EVENT_CLASS(hmdfs_rename_op_end,
233 
234 	TP_PROTO(struct inode *olddir, struct dentry *olddentry,
235 		 struct inode *newdir, struct dentry *newdentry,
236 		 unsigned int flags),
237 
238 	TP_ARGS(olddir, olddentry, newdir, newdentry, flags),
239 
240 	TP_STRUCT__entry(
241 		__field(ino_t, oldino)
242 		__string(oldname_str, olddentry->d_name.name)
243 		__field(ino_t, newino)
244 		__string(newname_str, newdentry->d_name.name)
245 		__field(unsigned int, flags)
246 	),
247 
248 	TP_fast_assign(
249 		__entry->oldino = olddir->i_ino;
250 		__assign_str(oldname_str, olddentry->d_name.name);
251 		__entry->newino = newdir->i_ino;
252 		__assign_str(newname_str, newdentry->d_name.name);
253 		__entry->flags = flags;
254 	),
255 
256 	TP_printk("old_pino = %lu, oldname:%s; new_pino = %lu, newname:%s, flags:%u",
257 		__entry->oldino, __get_str(oldname_str),
258 		__entry->newino, __get_str(newname_str), __entry->flags)
259 );
260 
261 #define define_hmdfs_rename_op_end_event(event_name)                           \
262 	DEFINE_EVENT(hmdfs_rename_op_end, event_name,                          \
263 		     TP_PROTO(struct inode *olddir, struct dentry *olddentry,  \
264 			      struct inode *newdir, struct dentry *newdentry,  \
265 			      unsigned int flags),                             \
266 		     TP_ARGS(olddir, olddentry, newdir, newdentry, flags))
267 
268 define_hmdfs_rename_op_end_event(hmdfs_rename_local);
269 define_hmdfs_rename_op_end_event(hmdfs_rename_remote);
270 define_hmdfs_rename_op_end_event(hmdfs_rename_merge);
271 
272 TRACE_EVENT(hmdfs_statfs,
273 
274 	TP_PROTO(struct dentry *d, uint8_t type),
275 
276 	TP_ARGS(d, type),
277 
278 	TP_STRUCT__entry(
279 		__string(name, d->d_name.name)
280 		__field(uint8_t, type)
281 	),
282 
283 	TP_fast_assign(
284 		__assign_str(name, d->d_name.name)
285 		__entry->type = type;
286 	),
287 
288 	TP_printk("dentry_name:%s, lo_d_devid:%u",
289 		  __get_str(name), __entry->type)
290 );
291 
292 
293 
294 TRACE_EVENT(hmdfs_balance_dirty_pages_ratelimited,
295 
296 	TP_PROTO(struct hmdfs_sb_info *sbi,
297 		 struct hmdfs_writeback *hwb,
298 		 int bdp_ratelimits),
299 
300 	TP_ARGS(sbi, hwb, bdp_ratelimits),
301 
302 	TP_STRUCT__entry(
303 		__array(char, dst, 128)
304 		__field(int, nr_dirtied)
305 		__field(int, nr_dirtied_pause)
306 		__field(int, dirty_exceeded)
307 		__field(long long, bdp_ratelimits)
308 		__field(long, ratelimit_pages)
309 	),
310 
311 	TP_fast_assign(
312 		    strlcpy(__entry->dst, sbi->local_dst, 128);
313 
314 		    __entry->nr_dirtied	= current->nr_dirtied;
315 		    __entry->nr_dirtied_pause = current->nr_dirtied_pause;
316 		    __entry->dirty_exceeded = hwb->dirty_exceeded;
317 		    __entry->bdp_ratelimits = bdp_ratelimits;
318 		    __entry->ratelimit_pages = hwb->ratelimit_pages;
319 	),
320 
321 	TP_printk("hmdfs dst:%s nr_dirtied=%d nr_dirtied_pause=%d dirty_exceeded=%d bdp_ratelimits=%lld ratelimit_pages=%ld",
322 		  __entry->dst, __entry->nr_dirtied, __entry->nr_dirtied_pause,
323 		  __entry->dirty_exceeded, __entry->bdp_ratelimits,
324 		  __entry->ratelimit_pages)
325 );
326 
327 TRACE_EVENT(hmdfs_balance_dirty_pages,
328 
329 	    TP_PROTO(struct hmdfs_sb_info *sbi,
330 		     struct bdi_writeback *wb,
331 		     struct hmdfs_dirty_throttle_control *hdtc,
332 		     unsigned long pause,
333 		     unsigned long start_time),
334 
335 	    TP_ARGS(sbi, wb, hdtc, pause, start_time),
336 
337 	    TP_STRUCT__entry(
338 		    __array(char, dst, 128)
339 		    __field(unsigned long, write_bw)
340 		    __field(unsigned long, avg_write_bw)
341 		    __field(unsigned long, file_bg_thresh)
342 		    __field(unsigned long, fs_bg_thresh)
343 		    __field(unsigned long, file_thresh)
344 		    __field(unsigned long, fs_thresh)
345 		    __field(unsigned long, file_nr_dirty)
346 		    __field(unsigned long, fs_nr_dirty)
347 		    __field(unsigned long, file_nr_rec)
348 		    __field(unsigned long, fs_nr_rec)
349 		    __field(unsigned long, pause)
350 		    __field(unsigned long, paused)
351 	    ),
352 
353 	    TP_fast_assign(
354 		    strlcpy(__entry->dst, sbi->local_dst, 128);
355 
356 		    __entry->write_bw		= wb->write_bandwidth;
357 		    __entry->avg_write_bw	= wb->avg_write_bandwidth;
358 		    __entry->file_bg_thresh	= hdtc->file_bg_thresh;
359 		    __entry->fs_bg_thresh	= hdtc->fs_bg_thresh;
360 		    __entry->file_thresh	= hdtc->file_thresh;
361 		    __entry->fs_thresh		= hdtc->fs_thresh;
362 		    __entry->file_nr_dirty	= hdtc->file_nr_dirty;
363 		    __entry->fs_nr_dirty	= hdtc->fs_nr_dirty;
364 		    __entry->file_nr_rec	= hdtc->file_nr_reclaimable;
365 		    __entry->fs_nr_rec		= hdtc->fs_nr_reclaimable;
366 		    __entry->pause		= pause * 1000 / HZ;
367 		    __entry->paused		= (jiffies - start_time) *
368 						  1000 / HZ;
369 	    ),
370 
371 	    TP_printk("hmdfs dst:%s write_bw=%lu, awrite_bw=%lu, bg_thresh=%lu,%lu thresh=%lu,%lu dirty=%lu,%lu reclaimable=%lu,%lu pause=%lu paused=%lu",
372 		      __entry->dst, __entry->write_bw, __entry->avg_write_bw,
373 		      __entry->file_bg_thresh, __entry->fs_bg_thresh,
374 		      __entry->file_thresh, __entry->fs_thresh,
375 		      __entry->file_nr_dirty, __entry->fs_nr_dirty,
376 		      __entry->file_nr_rec, __entry->fs_nr_rec,
377 		      __entry->pause, __entry->paused
378 	    )
379 );
380 
381 TRACE_EVENT(hmdfs_start_srv_wb,
382 
383 	    TP_PROTO(struct hmdfs_sb_info *sbi, int dirty_pages,
384 		    unsigned int dirty_thresh_pg),
385 
386 	    TP_ARGS(sbi, dirty_pages, dirty_thresh_pg),
387 
388 	    TP_STRUCT__entry(
389 		     __array(char, src, 128)
390 		     __field(int, dirty_pages)
391 		     __field(unsigned int, dirty_thresh_pg)
392 	    ),
393 
394 	    TP_fast_assign(
395 		    strlcpy(__entry->src, sbi->local_src, 128);
396 		    __entry->dirty_pages = dirty_pages;
397 		    __entry->dirty_thresh_pg = dirty_thresh_pg;
398 	    ),
399 
400 	    TP_printk("hmdfs src: %s, start writeback dirty pages. writeback %d pages dirty_thresh is %d pages",
401 		      __entry->src, __entry->dirty_pages, __entry->dirty_thresh_pg)
402 );
403 
404 TRACE_EVENT(hmdfs_fsync_enter_remote,
405 
406 	TP_PROTO(struct hmdfs_sb_info *sbi, unsigned long long device_id,
407 		 unsigned long long remote_ino, int datasync),
408 
409 	TP_ARGS(sbi, device_id, remote_ino, datasync),
410 
411 	TP_STRUCT__entry(
412 		__array(char, src, 128)
413 		__field(uint64_t, device_id)
414 		__field(uint64_t, remote_ino)
415 		__field(int, datasync)
416 	),
417 
418 	TP_fast_assign(
419 		strlcpy(__entry->src, sbi->local_src, 128);
420 		__entry->device_id = device_id;
421 		__entry->remote_ino = remote_ino;
422 		__entry->datasync = datasync;
423 	),
424 
425 	TP_printk("hmdfs: src %s, start remote fsync file(remote dev_id=%llu,ino=%llu), datasync=%d",
426 		__entry->src, __entry->device_id,
427 		__entry->remote_ino, __entry->datasync)
428 );
429 
430 TRACE_EVENT(hmdfs_fsync_exit_remote,
431 
432 	TP_PROTO(struct hmdfs_sb_info *sbi, unsigned long long device_id,
433 		 unsigned long long remote_ino, unsigned int timeout, int err),
434 
435 	TP_ARGS(sbi, device_id, remote_ino, timeout, err),
436 
437 	TP_STRUCT__entry(
438 		__array(char, src, 128)
439 		__field(uint64_t, device_id)
440 		__field(uint64_t, remote_ino)
441 		__field(uint32_t, timeout)
442 		__field(int, err)
443 	),
444 
445 	TP_fast_assign(
446 		strlcpy(__entry->src, sbi->local_src, 128);
447 		__entry->device_id = device_id;
448 		__entry->remote_ino = remote_ino;
449 		__entry->timeout = timeout;
450 		__entry->err = err;
451 	),
452 
453 	TP_printk("hmdfs: src %s, finish remote fsync file(remote dev_id=%llu,ino=%llu), timeout=%u, err=%d",
454 		__entry->src, __entry->device_id, __entry->remote_ino,
455 		__entry->timeout, __entry->err)
456 );
457 
458 TRACE_EVENT(hmdfs_syncfs_enter,
459 
460 	TP_PROTO(struct hmdfs_sb_info *sbi),
461 
462 	TP_ARGS(sbi),
463 
464 	TP_STRUCT__entry(
465 		__array(char, src, 128)
466 	),
467 
468 	TP_fast_assign(
469 		strlcpy(__entry->src, sbi->local_src, 128);
470 	),
471 
472 	TP_printk("hmdfs: src %s, start syncfs", __entry->src)
473 );
474 
475 TRACE_EVENT(hmdfs_syncfs_exit,
476 
477 	TP_PROTO(struct hmdfs_sb_info *sbi, int remain_count,
478 		 unsigned int timeout, int err),
479 
480 	TP_ARGS(sbi, remain_count, timeout, err),
481 
482 	TP_STRUCT__entry(
483 		__array(char, src, 128)
484 		__field(int, remain_count)
485 		__field(uint32_t, timeout)
486 		__field(int, err)
487 	),
488 
489 	TP_fast_assign(
490 		strlcpy(__entry->src, sbi->local_src, 128);
491 		__entry->remain_count = remain_count;
492 		__entry->timeout = timeout;
493 		__entry->err = err;
494 	),
495 
496 	TP_printk("hmdfs: src %s, finish syncfs(timeout=%u), remain %d remote devices to response, err=%d",
497 		__entry->src, __entry->timeout,
498 		__entry->remain_count, __entry->err)
499 );
500 
501 TRACE_EVENT(hmdfs_server_release,
502 
503 	TP_PROTO(struct hmdfs_peer *con, uint32_t file_id,
504 		uint64_t file_ver, int err),
505 
506 	TP_ARGS(con, file_id, file_ver, err),
507 
508 	TP_STRUCT__entry(
509 		__array(char, src, 128)
510 		__field(uint32_t, file_id)
511 		__field(uint64_t, file_ver)
512 		__field(uint64_t, device_id)
513 		__field(int, err)
514 	),
515 
516 	TP_fast_assign(
517 		strlcpy(__entry->src, con->sbi->local_src, 128);
518 		__entry->file_id = file_id;
519 		__entry->file_ver = file_ver;
520 		__entry->device_id = con->device_id;
521 		__entry->err = err;
522 	),
523 
524 	TP_printk("hmdfs: src %s, server release file, fid=%u, fid_ver=%llu, remote_dev=%llu, err=%d",
525 		__entry->src, __entry->file_id, __entry->file_ver,
526 		__entry->device_id, __entry->err)
527 );
528 
529 TRACE_EVENT(hmdfs_client_recv_readpage,
530 
531 	TP_PROTO(struct hmdfs_peer *con, unsigned long long remote_ino,
532 		unsigned long page_index, int err),
533 
534 	TP_ARGS(con, remote_ino, page_index, err),
535 
536 	TP_STRUCT__entry(
537 		__array(char, src, 128)
538 		__field(uint64_t, remote_ino)
539 		__field(unsigned long, page_index)
540 		__field(uint64_t, device_id)
541 		__field(int, err)
542 	),
543 
544 	TP_fast_assign(
545 		strlcpy(__entry->src, con->sbi->local_src, 128);
546 		__entry->remote_ino = remote_ino;
547 		__entry->page_index = page_index;
548 		__entry->device_id = con->device_id;
549 		__entry->err = err;
550 	),
551 
552 	TP_printk("hmdfs: src %s, client readpage callback from remote device %llu, remote_ino=%llu, page_idx=%lu, err=%d",
553 		__entry->src, __entry->device_id,
554 		__entry->remote_ino, __entry->page_index, __entry->err)
555 );
556 
557 TRACE_EVENT(hmdfs_writepage_cb_enter,
558 
559 	TP_PROTO(struct hmdfs_peer *con, unsigned long long remote_ino,
560 		unsigned long page_index, int err),
561 
562 	TP_ARGS(con, remote_ino, page_index, err),
563 
564 	TP_STRUCT__entry(
565 		__array(char, src, 128)
566 		__field(uint64_t, remote_ino)
567 		__field(unsigned long, page_index)
568 		__field(uint64_t, device_id)
569 		__field(int, err)
570 	),
571 
572 	TP_fast_assign(
573 		strlcpy(__entry->src, con->sbi->local_src, 128);
574 		__entry->remote_ino = remote_ino;
575 		__entry->page_index = page_index;
576 		__entry->device_id = con->device_id;
577 		__entry->err = err;
578 	),
579 
580 	TP_printk("hmdfs: src %s, writepage_cb start, return from remote device %llu, remote_ino=%llu, page_idx=%lu, err=%d",
581 		__entry->src, __entry->device_id,
582 		__entry->remote_ino, __entry->page_index, __entry->err)
583 );
584 
585 TRACE_EVENT(hmdfs_writepage_cb_exit,
586 
587 	TP_PROTO(struct hmdfs_peer *con, unsigned long long remote_ino,
588 		unsigned long page_index, int err),
589 
590 	TP_ARGS(con, remote_ino, page_index, err),
591 
592 	TP_STRUCT__entry(
593 		__array(char, src, 128)
594 		__field(uint64_t, remote_ino)
595 		__field(unsigned long, page_index)
596 		__field(uint64_t, device_id)
597 		__field(int, err)
598 	),
599 
600 	TP_fast_assign(
601 		strlcpy(__entry->src, con->sbi->local_src, 128);
602 		__entry->remote_ino = remote_ino;
603 		__entry->page_index = page_index;
604 		__entry->device_id = con->device_id;
605 		__entry->err = err;
606 	),
607 
608 	TP_printk("hmdfs: src %s, writepage_cb exit, return from remote device %llu, remote_ino=%llu, page_index=%lu, err=%d",
609 		__entry->src, __entry->device_id,
610 		__entry->remote_ino, __entry->page_index, __entry->err)
611 );
612 
613 TRACE_EVENT(hmdfs_server_rebuild_dents,
614 
615 	TP_PROTO(struct hmdfs_dcache_header *__h, int err),
616 
617 	TP_ARGS(__h, err),
618 
619 	TP_STRUCT__entry(
620 		__field(uint64_t, crtime)
621 		__field(uint64_t, crtime_nsec)
622 		__field(uint64_t, ctime)
623 		__field(uint64_t, ctime_nsec)
624 		__field(uint64_t, num)
625 		__field(int, err)
626 	),
627 
628 	TP_fast_assign(
629 		__entry->crtime = le64_to_cpu(__h->dcache_crtime);
630 		__entry->crtime_nsec = le64_to_cpu(__h->dcache_crtime_nsec);
631 		__entry->ctime = le64_to_cpu(__h->dentry_ctime);
632 		__entry->ctime_nsec = le64_to_cpu(__h->dentry_ctime_nsec);
633 		__entry->num = le64_to_cpu(__h->num);
634 		__entry->err = err;
635 	),
636 
637 	TP_printk("dcache crtime %llu:%llu ctime %llu:%llu has %llu dentry err %d",
638 		__entry->crtime, __entry->crtime_nsec, __entry->ctime,
639 		__entry->ctime_nsec, __entry->num, __entry->err)
640 );
641 
642 TRACE_EVENT(hmdfs_server_readdir,
643 
644 	TP_PROTO(struct readdir_request *req),
645 
646 	TP_ARGS(req),
647 
648 	TP_STRUCT__entry(
649 		__string(path, req->path)
650 	),
651 
652 	TP_fast_assign(
653 		__assign_str(path, req->path);
654 	),
655 
656 	TP_printk("hmdfs_server_readdir %s", __get_str(path))
657 );
658 
659 TRACE_EVENT(hmdfs_open_final_remote,
660 
661 	TP_PROTO(struct hmdfs_inode_info *info,
662 		 struct hmdfs_open_ret *open_ret,
663 		 struct file *file,
664 		 int reason),
665 
666 	TP_ARGS(info, open_ret, file, reason),
667 
668 	TP_STRUCT__entry(
669 		__array(char, file_path, MAX_FILTER_STR_VAL)
670 		__field(uint32_t, reason)
671 		__field(uint32_t, file_id)
672 		__field(uint64_t, file_ver)
673 		__field(uint64_t, remote_file_size)
674 		__field(uint64_t, remote_ino)
675 		__field(uint64_t, remote_ctime)
676 		__field(uint64_t, remote_ctime_nsec)
677 		__field(uint64_t, remote_stable_ctime)
678 		__field(uint64_t, remote_stable_ctime_nsec)
679 		__field(uint64_t, local_file_size)
680 		__field(uint64_t, local_ino)
681 		__field(uint64_t, local_ctime)
682 		__field(uint64_t, local_ctime_nsec)
683 		__field(uint64_t, local_stable_ctime)
684 		__field(uint64_t, local_stable_ctime_nsec)
685 	),
686 
687 	TP_fast_assign(
688 		strlcpy(__entry->file_path, file->f_path.dentry->d_name.name,
689 			MAX_FILTER_STR_VAL);
690 		__entry->reason = reason;
691 		__entry->file_id = open_ret->fid.id;
692 		__entry->file_ver = open_ret->fid.ver;
693 		__entry->remote_file_size = open_ret->file_size;
694 		__entry->remote_ino = open_ret->ino;
695 		__entry->remote_ctime = open_ret->remote_ctime.tv_sec;
696 		__entry->remote_ctime_nsec = open_ret->remote_ctime.tv_nsec;
697 		__entry->remote_stable_ctime = open_ret->stable_ctime.tv_sec;
698 		__entry->remote_stable_ctime_nsec =
699 					open_ret->stable_ctime.tv_nsec;
700 		__entry->local_file_size = info->vfs_inode.i_size;
701 		__entry->local_ino = info->remote_ino;
702 		__entry->local_ctime = info->remote_ctime.tv_sec;
703 		__entry->local_ctime_nsec = info->remote_ctime.tv_nsec;
704 		__entry->local_stable_ctime = info->stable_ctime.tv_sec;
705 		__entry->local_stable_ctime_nsec = info->stable_ctime.tv_nsec;
706 	),
707 
708 	TP_printk("file path: %s, file id: %u, file ver: %llu, reason: %d, file size: %llu/%llu, ino: %llu/%llu, ctime: %llu.%llu/%llu.%llu, stable_ctime: %llu.%llu/%llu.%llu from remote/local",
709 		  __entry->file_path, __entry->file_id, __entry->file_ver,
710 		  __entry->reason, __entry->remote_file_size,
711 		  __entry->local_file_size, __entry->remote_ino,
712 		  __entry->local_ino, __entry->remote_ctime,
713 		  __entry->remote_ctime_nsec, __entry->local_ctime,
714 		  __entry->local_ctime_nsec, __entry->remote_stable_ctime,
715 		  __entry->remote_stable_ctime_nsec,
716 		  __entry->local_stable_ctime, __entry->local_stable_ctime_nsec)
717 );
718 
719 TRACE_EVENT(hmdfs_server_open_enter,
720 
721 	TP_PROTO(struct hmdfs_peer *con,
722 		 struct open_request *recv),
723 
724 	TP_ARGS(con, recv),
725 
726 	TP_STRUCT__entry(
727 		__array(char, open_path, MAX_FILTER_STR_VAL)
728 		__array(char, dst_path, MAX_FILTER_STR_VAL)
729 		__field(uint32_t, file_type)
730 	),
731 
732 	TP_fast_assign(
733 		strlcpy(__entry->open_path, recv->buf, MAX_FILTER_STR_VAL);
734 		strlcpy(__entry->dst_path, con->sbi->local_dst,
735 			MAX_FILTER_STR_VAL);
736 		__entry->file_type = recv->file_type;
737 	),
738 
739 	TP_printk("server open file %s from %s, file_type is %u",
740 		  __entry->open_path, __entry->dst_path,
741 		  __entry->file_type)
742 );
743 
744 TRACE_EVENT(hmdfs_server_open_exit,
745 
746 	TP_PROTO(struct hmdfs_peer *con,
747 		 struct open_response *resp,
748 		 struct file *file,
749 		 int ret),
750 
751 	TP_ARGS(con, resp, file, ret),
752 
753 	TP_STRUCT__entry(
754 		__array(char, file_path, MAX_FILTER_STR_VAL)
755 		__array(char, src_path, MAX_FILTER_STR_VAL)
756 		__field(uint32_t, file_id)
757 		__field(uint64_t, file_size)
758 		__field(uint64_t, ino)
759 		__field(uint64_t, ctime)
760 		__field(uint64_t, ctime_nsec)
761 		__field(uint64_t, stable_ctime)
762 		__field(uint64_t, stable_ctime_nsec)
763 		__field(int, retval)
764 	),
765 
766 	TP_fast_assign(
767 		if (file)
768 			strlcpy(__entry->file_path,
769 				file->f_path.dentry->d_name.name,
770 				MAX_FILTER_STR_VAL);
771 		else
772 			strlcpy(__entry->file_path, "null", MAX_FILTER_STR_VAL);
773 		strlcpy(__entry->src_path, con->sbi->local_src,
774 			MAX_FILTER_STR_VAL);
775 		__entry->file_id = resp ? resp->file_id : UINT_MAX;
776 		__entry->file_size = resp ? resp->file_size : ULLONG_MAX;
777 		__entry->ino = resp ? resp->ino : 0;
778 		__entry->ctime = resp ? resp->ctime : 0;
779 		__entry->ctime_nsec = resp ? resp->ctime_nsec : 0;
780 		__entry->stable_ctime = resp ? resp->stable_ctime : 0;
781 		__entry->stable_ctime_nsec = resp ? resp->stable_ctime_nsec : 0;
782 		__entry->retval = ret;
783 	),
784 
785 	TP_printk("server file %s is opened from %s, open result: %d, file id: %u, file size: %llu, ino: %llu, ctime: %llu.%llu, stable ctime: %llu.%llu",
786 		  __entry->file_path, __entry->src_path,
787 		  __entry->retval, __entry->file_id,
788 		  __entry->file_size, __entry->ino, __entry->ctime,
789 		  __entry->ctime_nsec, __entry->stable_ctime,
790 		  __entry->stable_ctime_nsec)
791 );
792 
793 TRACE_EVENT(hmdfs_merge_lookup_work_enter,
794 
795 	TP_PROTO(struct merge_lookup_work *ml_work),
796 
797 	TP_ARGS(ml_work),
798 
799 	TP_STRUCT__entry(
800 		__field(int, 		devid)
801 		__string(name, 		ml_work->name)
802 		__field(unsigned int, 	flags)
803 	),
804 
805 	TP_fast_assign(
806 		__entry->devid 	= ml_work->devid;
807 		__assign_str(name, ml_work->name);
808 		__entry->flags 	= ml_work->flags;
809 	),
810 
811 	TP_printk("devid = %d, name:%s, flags:%u",
812 		__entry->devid,
813 		__get_str(name),
814 		__entry->flags)
815 );
816 
817 TRACE_EVENT(hmdfs_merge_lookup_work_exit,
818 
819 	TP_PROTO(struct merge_lookup_work *ml_work, int found),
820 
821 	TP_ARGS(ml_work, found),
822 
823 	TP_STRUCT__entry(
824 		__field(int, 		devid)
825 		__string(name, 		ml_work->name)
826 		__field(unsigned int, 	flags)
827 		__field(int, 		found)
828 	),
829 
830 	TP_fast_assign(
831 		__entry->devid 	= ml_work->devid;
832 		__assign_str(name, ml_work->name);
833 		__entry->flags 	= ml_work->flags;
834 		__entry->found 	= found;
835 	),
836 
837 	TP_printk("devid = %d, name:%s, flags:%u, found:%d",
838 		__entry->devid,
839 		__get_str(name),
840 		__entry->flags,
841 		__entry->found)
842 );
843 
844 TRACE_EVENT(hmdfs_merge_update_dentry_info_enter,
845 
846 	TP_PROTO(struct dentry *src_dentry, struct dentry *dst_dentry),
847 
848 	TP_ARGS(src_dentry, dst_dentry),
849 
850 	TP_STRUCT__entry(
851 		__string(src_name,	src_dentry->d_name.name)
852 		__string(dst_name,	dst_dentry->d_name.name)
853 	),
854 
855 	TP_fast_assign(
856 		__assign_str(src_name, src_dentry->d_name.name);
857 		__assign_str(dst_name, dst_dentry->d_name.name);
858 	),
859 
860 	TP_printk("src name:%s, dst name:%s",
861 		__get_str(src_name),
862 		__get_str(dst_name))
863 );
864 
865 TRACE_EVENT(hmdfs_merge_update_dentry_info_exit,
866 
867 	TP_PROTO(struct dentry *src_dentry, struct dentry *dst_dentry),
868 
869 	TP_ARGS(src_dentry, dst_dentry),
870 
871 	TP_STRUCT__entry(
872 		__string(src_name,	src_dentry->d_name.name)
873 		__string(dst_name,	dst_dentry->d_name.name)
874 	),
875 
876 	TP_fast_assign(
877 		__assign_str(src_name, src_dentry->d_name.name);
878 		__assign_str(dst_name, dst_dentry->d_name.name);
879 	),
880 
881 	TP_printk("src name:%s, dst name:%s",
882 		__get_str(src_name),
883 		__get_str(dst_name))
884 );
885 
886 #endif
887 
888 #undef TRACE_INCLUDE_PATH
889 #undef TRACE_INCLUDE_FILE
890 #define TRACE_INCLUDE_PATH .
891 #define TRACE_INCLUDE_FILE hmdfs_trace
892 #include <trace/define_trace.h>
893