aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/dlm/debug_fs.c82
-rw-r--r--fs/dlm/dlm_internal.h2
2 files changed, 43 insertions, 41 deletions
diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
index 9f5de37706a9..12c3bfd5e660 100644
--- a/fs/dlm/debug_fs.c
+++ b/fs/dlm/debug_fs.c
@@ -27,7 +27,7 @@ static struct dentry *dlm_root;
27 27
28struct rsb_iter { 28struct rsb_iter {
29 int entry; 29 int entry;
30 int master; 30 int locks;
31 int header; 31 int header;
32 struct dlm_ls *ls; 32 struct dlm_ls *ls;
33 struct list_head *next; 33 struct list_head *next;
@@ -60,8 +60,8 @@ static char *print_lockmode(int mode)
60 } 60 }
61} 61}
62 62
63static void print_lock(struct seq_file *s, struct dlm_lkb *lkb, 63static void print_resource_lock(struct seq_file *s, struct dlm_lkb *lkb,
64 struct dlm_rsb *res) 64 struct dlm_rsb *res)
65{ 65{
66 seq_printf(s, "%08x %s", lkb->lkb_id, print_lockmode(lkb->lkb_grmode)); 66 seq_printf(s, "%08x %s", lkb->lkb_id, print_lockmode(lkb->lkb_grmode));
67 67
@@ -134,15 +134,15 @@ static int print_resource(struct dlm_rsb *res, struct seq_file *s)
134 /* Print the locks attached to this resource */ 134 /* Print the locks attached to this resource */
135 seq_printf(s, "Granted Queue\n"); 135 seq_printf(s, "Granted Queue\n");
136 list_for_each_entry(lkb, &res->res_grantqueue, lkb_statequeue) 136 list_for_each_entry(lkb, &res->res_grantqueue, lkb_statequeue)
137 print_lock(s, lkb, res); 137 print_resource_lock(s, lkb, res);
138 138
139 seq_printf(s, "Conversion Queue\n"); 139 seq_printf(s, "Conversion Queue\n");
140 list_for_each_entry(lkb, &res->res_convertqueue, lkb_statequeue) 140 list_for_each_entry(lkb, &res->res_convertqueue, lkb_statequeue)
141 print_lock(s, lkb, res); 141 print_resource_lock(s, lkb, res);
142 142
143 seq_printf(s, "Waiting Queue\n"); 143 seq_printf(s, "Waiting Queue\n");
144 list_for_each_entry(lkb, &res->res_waitqueue, lkb_statequeue) 144 list_for_each_entry(lkb, &res->res_waitqueue, lkb_statequeue)
145 print_lock(s, lkb, res); 145 print_resource_lock(s, lkb, res);
146 146
147 if (list_empty(&res->res_lookup)) 147 if (list_empty(&res->res_lookup))
148 goto out; 148 goto out;
@@ -160,8 +160,7 @@ static int print_resource(struct dlm_rsb *res, struct seq_file *s)
160 return 0; 160 return 0;
161} 161}
162 162
163static void print_master_lock(struct seq_file *s, struct dlm_lkb *lkb, 163static void print_lock(struct seq_file *s, struct dlm_lkb *lkb, struct dlm_rsb *r)
164 struct dlm_rsb *r)
165{ 164{
166 struct dlm_user_args *ua; 165 struct dlm_user_args *ua;
167 unsigned int waiting = 0; 166 unsigned int waiting = 0;
@@ -176,37 +175,40 @@ static void print_master_lock(struct seq_file *s, struct dlm_lkb *lkb,
176 if (lkb->lkb_timestamp) 175 if (lkb->lkb_timestamp)
177 waiting = jiffies_to_msecs(jiffies - lkb->lkb_timestamp); 176 waiting = jiffies_to_msecs(jiffies - lkb->lkb_timestamp);
178 177
179 /* id nodeid remid pid xid flags sts grmode rqmode time_ms len name */ 178 /* id nodeid remid pid xid exflags flags sts grmode rqmode time_ms
179 r_nodeid r_len r_name */
180 180
181 seq_printf(s, "%x %d %x %u %llu %x %d %d %d %u %d \"%s\"\n", 181 seq_printf(s, "%x %d %x %u %llu %x %x %d %d %d %u %u %d \"%s\"\n",
182 lkb->lkb_id, 182 lkb->lkb_id,
183 lkb->lkb_nodeid, 183 lkb->lkb_nodeid,
184 lkb->lkb_remid, 184 lkb->lkb_remid,
185 lkb->lkb_ownpid, 185 lkb->lkb_ownpid,
186 (unsigned long long)xid, 186 (unsigned long long)xid,
187 lkb->lkb_exflags, 187 lkb->lkb_exflags,
188 lkb->lkb_flags,
188 lkb->lkb_status, 189 lkb->lkb_status,
189 lkb->lkb_grmode, 190 lkb->lkb_grmode,
190 lkb->lkb_rqmode, 191 lkb->lkb_rqmode,
191 waiting, 192 waiting,
193 r->res_nodeid,
192 r->res_length, 194 r->res_length,
193 r->res_name); 195 r->res_name);
194} 196}
195 197
196static int print_master_resource(struct dlm_rsb *r, struct seq_file *s) 198static int print_locks(struct dlm_rsb *r, struct seq_file *s)
197{ 199{
198 struct dlm_lkb *lkb; 200 struct dlm_lkb *lkb;
199 201
200 lock_rsb(r); 202 lock_rsb(r);
201 203
202 list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) 204 list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue)
203 print_master_lock(s, lkb, r); 205 print_lock(s, lkb, r);
204 206
205 list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) 207 list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue)
206 print_master_lock(s, lkb, r); 208 print_lock(s, lkb, r);
207 209
208 list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) 210 list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue)
209 print_master_lock(s, lkb, r); 211 print_lock(s, lkb, r);
210 212
211 unlock_rsb(r); 213 unlock_rsb(r);
212 return 0; 214 return 0;
@@ -325,14 +327,14 @@ static int rsb_seq_show(struct seq_file *file, void *iter_ptr)
325{ 327{
326 struct rsb_iter *ri = iter_ptr; 328 struct rsb_iter *ri = iter_ptr;
327 329
328 if (ri->master) { 330 if (ri->locks) {
329 if (ri->header) { 331 if (ri->header) {
330 seq_printf(file, "id nodeid remid pid xid flags sts " 332 seq_printf(file, "id nodeid remid pid xid exflags flags "
331 "grmode rqmode time_ms len name\n"); 333 "sts grmode rqmode time_ms r_nodeid "
334 "r_len r_name\n");
332 ri->header = 0; 335 ri->header = 0;
333 } 336 }
334 if (is_master(ri->rsb)) 337 print_locks(ri->rsb, file);
335 print_master_resource(ri->rsb, file);
336 } else { 338 } else {
337 print_resource(ri->rsb, file); 339 print_resource(ri->rsb, file);
338 } 340 }
@@ -371,10 +373,10 @@ static const struct file_operations rsb_fops = {
371}; 373};
372 374
373/* 375/*
374 * Dump master lock state 376 * Dump state in compact per-lock listing
375 */ 377 */
376 378
377static struct rsb_iter *master_iter_init(struct dlm_ls *ls, loff_t *pos) 379static struct rsb_iter *locks_iter_init(struct dlm_ls *ls, loff_t *pos)
378{ 380{
379 struct rsb_iter *ri; 381 struct rsb_iter *ri;
380 382
@@ -385,7 +387,7 @@ static struct rsb_iter *master_iter_init(struct dlm_ls *ls, loff_t *pos)
385 ri->ls = ls; 387 ri->ls = ls;
386 ri->entry = 0; 388 ri->entry = 0;
387 ri->next = NULL; 389 ri->next = NULL;
388 ri->master = 1; 390 ri->locks = 1;
389 391
390 if (*pos == 0) 392 if (*pos == 0)
391 ri->header = 1; 393 ri->header = 1;
@@ -398,12 +400,12 @@ static struct rsb_iter *master_iter_init(struct dlm_ls *ls, loff_t *pos)
398 return ri; 400 return ri;
399} 401}
400 402
401static void *master_seq_start(struct seq_file *file, loff_t *pos) 403static void *locks_seq_start(struct seq_file *file, loff_t *pos)
402{ 404{
403 struct rsb_iter *ri; 405 struct rsb_iter *ri;
404 loff_t n = *pos; 406 loff_t n = *pos;
405 407
406 ri = master_iter_init(file->private, pos); 408 ri = locks_iter_init(file->private, pos);
407 if (!ri) 409 if (!ri)
408 return NULL; 410 return NULL;
409 411
@@ -417,19 +419,19 @@ static void *master_seq_start(struct seq_file *file, loff_t *pos)
417 return ri; 419 return ri;
418} 420}
419 421
420static struct seq_operations master_seq_ops = { 422static struct seq_operations locks_seq_ops = {
421 .start = master_seq_start, 423 .start = locks_seq_start,
422 .next = rsb_seq_next, 424 .next = rsb_seq_next,
423 .stop = rsb_seq_stop, 425 .stop = rsb_seq_stop,
424 .show = rsb_seq_show, 426 .show = rsb_seq_show,
425}; 427};
426 428
427static int master_open(struct inode *inode, struct file *file) 429static int locks_open(struct inode *inode, struct file *file)
428{ 430{
429 struct seq_file *seq; 431 struct seq_file *seq;
430 int ret; 432 int ret;
431 433
432 ret = seq_open(file, &master_seq_ops); 434 ret = seq_open(file, &locks_seq_ops);
433 if (ret) 435 if (ret)
434 return ret; 436 return ret;
435 437
@@ -439,9 +441,9 @@ static int master_open(struct inode *inode, struct file *file)
439 return 0; 441 return 0;
440} 442}
441 443
442static const struct file_operations master_fops = { 444static const struct file_operations locks_fops = {
443 .owner = THIS_MODULE, 445 .owner = THIS_MODULE,
444 .open = master_open, 446 .open = locks_open,
445 .read = seq_read, 447 .read = seq_read,
446 .llseek = seq_lseek, 448 .llseek = seq_lseek,
447 .release = seq_release 449 .release = seq_release
@@ -515,14 +517,14 @@ int dlm_create_debug_file(struct dlm_ls *ls)
515 } 517 }
516 518
517 memset(name, 0, sizeof(name)); 519 memset(name, 0, sizeof(name));
518 snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_master", ls->ls_name); 520 snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_locks", ls->ls_name);
519 521
520 ls->ls_debug_master_dentry = debugfs_create_file(name, 522 ls->ls_debug_locks_dentry = debugfs_create_file(name,
521 S_IFREG | S_IRUGO, 523 S_IFREG | S_IRUGO,
522 dlm_root, 524 dlm_root,
523 ls, 525 ls,
524 &master_fops); 526 &locks_fops);
525 if (!ls->ls_debug_master_dentry) { 527 if (!ls->ls_debug_locks_dentry) {
526 debugfs_remove(ls->ls_debug_waiters_dentry); 528 debugfs_remove(ls->ls_debug_waiters_dentry);
527 debugfs_remove(ls->ls_debug_rsb_dentry); 529 debugfs_remove(ls->ls_debug_rsb_dentry);
528 return -ENOMEM; 530 return -ENOMEM;
@@ -537,8 +539,8 @@ void dlm_delete_debug_file(struct dlm_ls *ls)
537 debugfs_remove(ls->ls_debug_rsb_dentry); 539 debugfs_remove(ls->ls_debug_rsb_dentry);
538 if (ls->ls_debug_waiters_dentry) 540 if (ls->ls_debug_waiters_dentry)
539 debugfs_remove(ls->ls_debug_waiters_dentry); 541 debugfs_remove(ls->ls_debug_waiters_dentry);
540 if (ls->ls_debug_master_dentry) 542 if (ls->ls_debug_locks_dentry)
541 debugfs_remove(ls->ls_debug_master_dentry); 543 debugfs_remove(ls->ls_debug_locks_dentry);
542} 544}
543 545
544int dlm_register_debugfs(void) 546int dlm_register_debugfs(void)
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
index 8ac081882c78..74901e981e10 100644
--- a/fs/dlm/dlm_internal.h
+++ b/fs/dlm/dlm_internal.h
@@ -471,7 +471,7 @@ struct dlm_ls {
471 471
472 struct dentry *ls_debug_rsb_dentry; /* debugfs */ 472 struct dentry *ls_debug_rsb_dentry; /* debugfs */
473 struct dentry *ls_debug_waiters_dentry; /* debugfs */ 473 struct dentry *ls_debug_waiters_dentry; /* debugfs */
474 struct dentry *ls_debug_master_dentry; /* debugfs */ 474 struct dentry *ls_debug_locks_dentry; /* debugfs */
475 475
476 wait_queue_head_t ls_uevent_wait; /* user part of join/leave */ 476 wait_queue_head_t ls_uevent_wait; /* user part of join/leave */
477 int ls_uevent_result; 477 int ls_uevent_result;