summaryrefslogtreecommitdiffstats
path: root/net/ceph/debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ceph/debugfs.c')
-rw-r--r--net/ceph/debugfs.c33
1 files changed, 4 insertions, 29 deletions
diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c
index 63aef9915f75..7cb992e55475 100644
--- a/net/ceph/debugfs.c
+++ b/net/ceph/debugfs.c
@@ -389,12 +389,9 @@ CEPH_DEFINE_SHOW_FUNC(monc_show)
389CEPH_DEFINE_SHOW_FUNC(osdc_show) 389CEPH_DEFINE_SHOW_FUNC(osdc_show)
390CEPH_DEFINE_SHOW_FUNC(client_options_show) 390CEPH_DEFINE_SHOW_FUNC(client_options_show)
391 391
392int __init ceph_debugfs_init(void) 392void __init ceph_debugfs_init(void)
393{ 393{
394 ceph_debugfs_dir = debugfs_create_dir("ceph", NULL); 394 ceph_debugfs_dir = debugfs_create_dir("ceph", NULL);
395 if (!ceph_debugfs_dir)
396 return -ENOMEM;
397 return 0;
398} 395}
399 396
400void ceph_debugfs_cleanup(void) 397void ceph_debugfs_cleanup(void)
@@ -402,9 +399,8 @@ void ceph_debugfs_cleanup(void)
402 debugfs_remove(ceph_debugfs_dir); 399 debugfs_remove(ceph_debugfs_dir);
403} 400}
404 401
405int ceph_debugfs_client_init(struct ceph_client *client) 402void ceph_debugfs_client_init(struct ceph_client *client)
406{ 403{
407 int ret = -ENOMEM;
408 char name[80]; 404 char name[80];
409 405
410 snprintf(name, sizeof(name), "%pU.client%lld", &client->fsid, 406 snprintf(name, sizeof(name), "%pU.client%lld", &client->fsid,
@@ -412,56 +408,37 @@ int ceph_debugfs_client_init(struct ceph_client *client)
412 408
413 dout("ceph_debugfs_client_init %p %s\n", client, name); 409 dout("ceph_debugfs_client_init %p %s\n", client, name);
414 410
415 BUG_ON(client->debugfs_dir);
416 client->debugfs_dir = debugfs_create_dir(name, ceph_debugfs_dir); 411 client->debugfs_dir = debugfs_create_dir(name, ceph_debugfs_dir);
417 if (!client->debugfs_dir)
418 goto out;
419 412
420 client->monc.debugfs_file = debugfs_create_file("monc", 413 client->monc.debugfs_file = debugfs_create_file("monc",
421 0400, 414 0400,
422 client->debugfs_dir, 415 client->debugfs_dir,
423 client, 416 client,
424 &monc_show_fops); 417 &monc_show_fops);
425 if (!client->monc.debugfs_file)
426 goto out;
427 418
428 client->osdc.debugfs_file = debugfs_create_file("osdc", 419 client->osdc.debugfs_file = debugfs_create_file("osdc",
429 0400, 420 0400,
430 client->debugfs_dir, 421 client->debugfs_dir,
431 client, 422 client,
432 &osdc_show_fops); 423 &osdc_show_fops);
433 if (!client->osdc.debugfs_file)
434 goto out;
435 424
436 client->debugfs_monmap = debugfs_create_file("monmap", 425 client->debugfs_monmap = debugfs_create_file("monmap",
437 0400, 426 0400,
438 client->debugfs_dir, 427 client->debugfs_dir,
439 client, 428 client,
440 &monmap_show_fops); 429 &monmap_show_fops);
441 if (!client->debugfs_monmap)
442 goto out;
443 430
444 client->debugfs_osdmap = debugfs_create_file("osdmap", 431 client->debugfs_osdmap = debugfs_create_file("osdmap",
445 0400, 432 0400,
446 client->debugfs_dir, 433 client->debugfs_dir,
447 client, 434 client,
448 &osdmap_show_fops); 435 &osdmap_show_fops);
449 if (!client->debugfs_osdmap)
450 goto out;
451 436
452 client->debugfs_options = debugfs_create_file("client_options", 437 client->debugfs_options = debugfs_create_file("client_options",
453 0400, 438 0400,
454 client->debugfs_dir, 439 client->debugfs_dir,
455 client, 440 client,
456 &client_options_show_fops); 441 &client_options_show_fops);
457 if (!client->debugfs_options)
458 goto out;
459
460 return 0;
461
462out:
463 ceph_debugfs_client_cleanup(client);
464 return ret;
465} 442}
466 443
467void ceph_debugfs_client_cleanup(struct ceph_client *client) 444void ceph_debugfs_client_cleanup(struct ceph_client *client)
@@ -477,18 +454,16 @@ void ceph_debugfs_client_cleanup(struct ceph_client *client)
477 454
478#else /* CONFIG_DEBUG_FS */ 455#else /* CONFIG_DEBUG_FS */
479 456
480int __init ceph_debugfs_init(void) 457void __init ceph_debugfs_init(void)
481{ 458{
482 return 0;
483} 459}
484 460
485void ceph_debugfs_cleanup(void) 461void ceph_debugfs_cleanup(void)
486{ 462{
487} 463}
488 464
489int ceph_debugfs_client_init(struct ceph_client *client) 465void ceph_debugfs_client_init(struct ceph_client *client)
490{ 466{
491 return 0;
492} 467}
493 468
494void ceph_debugfs_client_cleanup(struct ceph_client *client) 469void ceph_debugfs_client_cleanup(struct ceph_client *client)