18
18
#include "dlm_internal.h"
19
19
#include "midcomms.h"
20
20
#include "lock.h"
21
+ #include "ast.h"
21
22
22
23
#define DLM_DEBUG_BUF_LEN 4096
23
24
static char debug_buf [DLM_DEBUG_BUF_LEN ];
@@ -365,6 +366,52 @@ static void print_format4(struct dlm_rsb *r, struct seq_file *s)
365
366
unlock_rsb (r );
366
367
}
367
368
369
+ static void print_format5_lock (struct seq_file * s , struct dlm_lkb * lkb )
370
+ {
371
+ struct dlm_callback * cb ;
372
+
373
+ /* lkb_id lkb_flags mode flags sb_status sb_flags */
374
+
375
+ spin_lock (& lkb -> lkb_cb_lock );
376
+ list_for_each_entry (cb , & lkb -> lkb_callbacks , list ) {
377
+ seq_printf (s , "%x %x %d %x %d %x\n" ,
378
+ lkb -> lkb_id ,
379
+ dlm_iflags_val (lkb ),
380
+ cb -> mode ,
381
+ cb -> flags ,
382
+ cb -> sb_status ,
383
+ cb -> sb_flags );
384
+ }
385
+ spin_unlock (& lkb -> lkb_cb_lock );
386
+ }
387
+
388
+ static void print_format5 (struct dlm_rsb * r , struct seq_file * s )
389
+ {
390
+ struct dlm_lkb * lkb ;
391
+
392
+ lock_rsb (r );
393
+
394
+ list_for_each_entry (lkb , & r -> res_grantqueue , lkb_statequeue ) {
395
+ print_format5_lock (s , lkb );
396
+ if (seq_has_overflowed (s ))
397
+ goto out ;
398
+ }
399
+
400
+ list_for_each_entry (lkb , & r -> res_convertqueue , lkb_statequeue ) {
401
+ print_format5_lock (s , lkb );
402
+ if (seq_has_overflowed (s ))
403
+ goto out ;
404
+ }
405
+
406
+ list_for_each_entry (lkb , & r -> res_waitqueue , lkb_statequeue ) {
407
+ print_format5_lock (s , lkb );
408
+ if (seq_has_overflowed (s ))
409
+ goto out ;
410
+ }
411
+ out :
412
+ unlock_rsb (r );
413
+ }
414
+
368
415
struct rsbtbl_iter {
369
416
struct dlm_rsb * rsb ;
370
417
unsigned bucket ;
@@ -408,6 +455,13 @@ static int table_seq_show(struct seq_file *seq, void *iter_ptr)
408
455
}
409
456
print_format4 (ri -> rsb , seq );
410
457
break ;
458
+ case 5 :
459
+ if (ri -> header ) {
460
+ seq_puts (seq , "lkb_id lkb_flags mode flags sb_status sb_flags\n" );
461
+ ri -> header = 0 ;
462
+ }
463
+ print_format5 (ri -> rsb , seq );
464
+ break ;
411
465
}
412
466
413
467
return 0 ;
@@ -417,6 +471,7 @@ static const struct seq_operations format1_seq_ops;
417
471
static const struct seq_operations format2_seq_ops ;
418
472
static const struct seq_operations format3_seq_ops ;
419
473
static const struct seq_operations format4_seq_ops ;
474
+ static const struct seq_operations format5_seq_ops ;
420
475
421
476
static void * table_seq_start (struct seq_file * seq , loff_t * pos )
422
477
{
@@ -448,6 +503,8 @@ static void *table_seq_start(struct seq_file *seq, loff_t *pos)
448
503
ri -> format = 3 ;
449
504
if (seq -> op == & format4_seq_ops )
450
505
ri -> format = 4 ;
506
+ if (seq -> op == & format5_seq_ops )
507
+ ri -> format = 5 ;
451
508
452
509
tree = toss ? & ls -> ls_rsbtbl [bucket ].toss : & ls -> ls_rsbtbl [bucket ].keep ;
453
510
@@ -602,10 +659,18 @@ static const struct seq_operations format4_seq_ops = {
602
659
.show = table_seq_show ,
603
660
};
604
661
662
+ static const struct seq_operations format5_seq_ops = {
663
+ .start = table_seq_start ,
664
+ .next = table_seq_next ,
665
+ .stop = table_seq_stop ,
666
+ .show = table_seq_show ,
667
+ };
668
+
605
669
static const struct file_operations format1_fops ;
606
670
static const struct file_operations format2_fops ;
607
671
static const struct file_operations format3_fops ;
608
672
static const struct file_operations format4_fops ;
673
+ static const struct file_operations format5_fops ;
609
674
610
675
static int table_open1 (struct inode * inode , struct file * file )
611
676
{
@@ -683,7 +748,21 @@ static int table_open4(struct inode *inode, struct file *file)
683
748
struct seq_file * seq ;
684
749
int ret ;
685
750
686
- ret = seq_open (file , & format4_seq_ops );
751
+ ret = seq_open (file , & format5_seq_ops );
752
+ if (ret )
753
+ return ret ;
754
+
755
+ seq = file -> private_data ;
756
+ seq -> private = inode -> i_private ; /* the dlm_ls */
757
+ return 0 ;
758
+ }
759
+
760
+ static int table_open5 (struct inode * inode , struct file * file )
761
+ {
762
+ struct seq_file * seq ;
763
+ int ret ;
764
+
765
+ ret = seq_open (file , & format5_seq_ops );
687
766
if (ret )
688
767
return ret ;
689
768
@@ -725,6 +804,14 @@ static const struct file_operations format4_fops = {
725
804
.release = seq_release
726
805
};
727
806
807
+ static const struct file_operations format5_fops = {
808
+ .owner = THIS_MODULE ,
809
+ .open = table_open5 ,
810
+ .read = seq_read ,
811
+ .llseek = seq_lseek ,
812
+ .release = seq_release
813
+ };
814
+
728
815
/*
729
816
* dump lkb's on the ls_waiters list
730
817
*/
@@ -793,6 +880,7 @@ void dlm_delete_debug_file(struct dlm_ls *ls)
793
880
debugfs_remove (ls -> ls_debug_locks_dentry );
794
881
debugfs_remove (ls -> ls_debug_all_dentry );
795
882
debugfs_remove (ls -> ls_debug_toss_dentry );
883
+ debugfs_remove (ls -> ls_debug_queued_asts_dentry );
796
884
}
797
885
798
886
static int dlm_state_show (struct seq_file * file , void * offset )
@@ -936,6 +1024,17 @@ void dlm_create_debug_file(struct dlm_ls *ls)
936
1024
dlm_root ,
937
1025
ls ,
938
1026
& waiters_fops );
1027
+
1028
+ /* format 5 */
1029
+
1030
+ memset (name , 0 , sizeof (name ));
1031
+ snprintf (name , DLM_LOCKSPACE_LEN + 8 , "%s_queued_asts" , ls -> ls_name );
1032
+
1033
+ ls -> ls_debug_queued_asts_dentry = debugfs_create_file (name ,
1034
+ 0644 ,
1035
+ dlm_root ,
1036
+ ls ,
1037
+ & format5_fops );
939
1038
}
940
1039
941
1040
void __init dlm_register_debugfs (void )
0 commit comments