.. | .. |
---|
237 | 237 | seq_print_rq_state_bit(m, f & EE_CALL_AL_COMPLETE_IO, &sep, "in-AL"); |
---|
238 | 238 | seq_print_rq_state_bit(m, f & EE_SEND_WRITE_ACK, &sep, "C"); |
---|
239 | 239 | seq_print_rq_state_bit(m, f & EE_MAY_SET_IN_SYNC, &sep, "set-in-sync"); |
---|
| 240 | + seq_print_rq_state_bit(m, f & EE_TRIM, &sep, "trim"); |
---|
| 241 | + seq_print_rq_state_bit(m, f & EE_ZEROOUT, &sep, "zero-out"); |
---|
240 | 242 | seq_print_rq_state_bit(m, f & EE_WRITE_SAME, &sep, "write-same"); |
---|
241 | 243 | seq_putc(m, '\n'); |
---|
242 | 244 | } |
---|
.. | .. |
---|
463 | 465 | void drbd_debugfs_resource_add(struct drbd_resource *resource) |
---|
464 | 466 | { |
---|
465 | 467 | struct dentry *dentry; |
---|
466 | | - if (!drbd_debugfs_resources) |
---|
467 | | - return; |
---|
468 | 468 | |
---|
469 | 469 | dentry = debugfs_create_dir(resource->name, drbd_debugfs_resources); |
---|
470 | | - if (IS_ERR_OR_NULL(dentry)) |
---|
471 | | - goto fail; |
---|
472 | 470 | resource->debugfs_res = dentry; |
---|
473 | 471 | |
---|
474 | 472 | dentry = debugfs_create_dir("volumes", resource->debugfs_res); |
---|
475 | | - if (IS_ERR_OR_NULL(dentry)) |
---|
476 | | - goto fail; |
---|
477 | 473 | resource->debugfs_res_volumes = dentry; |
---|
478 | 474 | |
---|
479 | 475 | dentry = debugfs_create_dir("connections", resource->debugfs_res); |
---|
480 | | - if (IS_ERR_OR_NULL(dentry)) |
---|
481 | | - goto fail; |
---|
482 | 476 | resource->debugfs_res_connections = dentry; |
---|
483 | 477 | |
---|
484 | 478 | dentry = debugfs_create_file("in_flight_summary", 0440, |
---|
485 | 479 | resource->debugfs_res, resource, |
---|
486 | 480 | &in_flight_summary_fops); |
---|
487 | | - if (IS_ERR_OR_NULL(dentry)) |
---|
488 | | - goto fail; |
---|
489 | 481 | resource->debugfs_res_in_flight_summary = dentry; |
---|
490 | | - return; |
---|
491 | | - |
---|
492 | | -fail: |
---|
493 | | - drbd_debugfs_resource_cleanup(resource); |
---|
494 | | - drbd_err(resource, "failed to create debugfs dentry\n"); |
---|
495 | 482 | } |
---|
496 | 483 | |
---|
497 | 484 | static void drbd_debugfs_remove(struct dentry **dp) |
---|
.. | .. |
---|
634 | 621 | { |
---|
635 | 622 | struct dentry *conns_dir = connection->resource->debugfs_res_connections; |
---|
636 | 623 | struct dentry *dentry; |
---|
637 | | - if (!conns_dir) |
---|
638 | | - return; |
---|
639 | 624 | |
---|
640 | 625 | /* Once we enable mutliple peers, |
---|
641 | 626 | * these connections will have descriptive names. |
---|
642 | 627 | * For now, it is just the one connection to the (only) "peer". */ |
---|
643 | 628 | dentry = debugfs_create_dir("peer", conns_dir); |
---|
644 | | - if (IS_ERR_OR_NULL(dentry)) |
---|
645 | | - goto fail; |
---|
646 | 629 | connection->debugfs_conn = dentry; |
---|
647 | 630 | |
---|
648 | 631 | dentry = debugfs_create_file("callback_history", 0440, |
---|
649 | 632 | connection->debugfs_conn, connection, |
---|
650 | 633 | &connection_callback_history_fops); |
---|
651 | | - if (IS_ERR_OR_NULL(dentry)) |
---|
652 | | - goto fail; |
---|
653 | 634 | connection->debugfs_conn_callback_history = dentry; |
---|
654 | 635 | |
---|
655 | 636 | dentry = debugfs_create_file("oldest_requests", 0440, |
---|
656 | 637 | connection->debugfs_conn, connection, |
---|
657 | 638 | &connection_oldest_requests_fops); |
---|
658 | | - if (IS_ERR_OR_NULL(dentry)) |
---|
659 | | - goto fail; |
---|
660 | 639 | connection->debugfs_conn_oldest_requests = dentry; |
---|
661 | | - return; |
---|
662 | | - |
---|
663 | | -fail: |
---|
664 | | - drbd_debugfs_connection_cleanup(connection); |
---|
665 | | - drbd_err(connection, "failed to create debugfs dentry\n"); |
---|
666 | 640 | } |
---|
667 | 641 | |
---|
668 | 642 | void drbd_debugfs_connection_cleanup(struct drbd_connection *connection) |
---|
.. | .. |
---|
807 | 781 | |
---|
808 | 782 | snprintf(vnr_buf, sizeof(vnr_buf), "%u", device->vnr); |
---|
809 | 783 | dentry = debugfs_create_dir(vnr_buf, vols_dir); |
---|
810 | | - if (IS_ERR_OR_NULL(dentry)) |
---|
811 | | - goto fail; |
---|
812 | 784 | device->debugfs_vol = dentry; |
---|
813 | 785 | |
---|
814 | 786 | snprintf(minor_buf, sizeof(minor_buf), "%u", device->minor); |
---|
.. | .. |
---|
817 | 789 | if (!slink_name) |
---|
818 | 790 | goto fail; |
---|
819 | 791 | dentry = debugfs_create_symlink(minor_buf, drbd_debugfs_minors, slink_name); |
---|
| 792 | + device->debugfs_minor = dentry; |
---|
820 | 793 | kfree(slink_name); |
---|
821 | 794 | slink_name = NULL; |
---|
822 | | - if (IS_ERR_OR_NULL(dentry)) |
---|
823 | | - goto fail; |
---|
824 | | - device->debugfs_minor = dentry; |
---|
825 | 795 | |
---|
826 | 796 | #define DCF(name) do { \ |
---|
827 | 797 | dentry = debugfs_create_file(#name, 0440, \ |
---|
828 | 798 | device->debugfs_vol, device, \ |
---|
829 | 799 | &device_ ## name ## _fops); \ |
---|
830 | | - if (IS_ERR_OR_NULL(dentry)) \ |
---|
831 | | - goto fail; \ |
---|
832 | 800 | device->debugfs_vol_ ## name = dentry; \ |
---|
833 | 801 | } while (0) |
---|
834 | 802 | |
---|
.. | .. |
---|
862 | 830 | struct dentry *dentry; |
---|
863 | 831 | char vnr_buf[8]; |
---|
864 | 832 | |
---|
865 | | - if (!conn_dir) |
---|
866 | | - return; |
---|
867 | | - |
---|
868 | 833 | snprintf(vnr_buf, sizeof(vnr_buf), "%u", peer_device->device->vnr); |
---|
869 | 834 | dentry = debugfs_create_dir(vnr_buf, conn_dir); |
---|
870 | | - if (IS_ERR_OR_NULL(dentry)) |
---|
871 | | - goto fail; |
---|
872 | 835 | peer_device->debugfs_peer_dev = dentry; |
---|
873 | | - return; |
---|
874 | | - |
---|
875 | | -fail: |
---|
876 | | - drbd_debugfs_peer_device_cleanup(peer_device); |
---|
877 | | - drbd_err(peer_device, "failed to create debugfs entries\n"); |
---|
878 | 836 | } |
---|
879 | 837 | |
---|
880 | 838 | void drbd_debugfs_peer_device_cleanup(struct drbd_peer_device *peer_device) |
---|
.. | .. |
---|
915 | 873 | drbd_debugfs_remove(&drbd_debugfs_root); |
---|
916 | 874 | } |
---|
917 | 875 | |
---|
918 | | -int __init drbd_debugfs_init(void) |
---|
| 876 | +void __init drbd_debugfs_init(void) |
---|
919 | 877 | { |
---|
920 | 878 | struct dentry *dentry; |
---|
921 | 879 | |
---|
922 | 880 | dentry = debugfs_create_dir("drbd", NULL); |
---|
923 | | - if (IS_ERR_OR_NULL(dentry)) |
---|
924 | | - goto fail; |
---|
925 | 881 | drbd_debugfs_root = dentry; |
---|
926 | 882 | |
---|
927 | 883 | dentry = debugfs_create_file("version", 0444, drbd_debugfs_root, NULL, &drbd_version_fops); |
---|
928 | | - if (IS_ERR_OR_NULL(dentry)) |
---|
929 | | - goto fail; |
---|
930 | 884 | drbd_debugfs_version = dentry; |
---|
931 | 885 | |
---|
932 | 886 | dentry = debugfs_create_dir("resources", drbd_debugfs_root); |
---|
933 | | - if (IS_ERR_OR_NULL(dentry)) |
---|
934 | | - goto fail; |
---|
935 | 887 | drbd_debugfs_resources = dentry; |
---|
936 | 888 | |
---|
937 | 889 | dentry = debugfs_create_dir("minors", drbd_debugfs_root); |
---|
938 | | - if (IS_ERR_OR_NULL(dentry)) |
---|
939 | | - goto fail; |
---|
940 | 890 | drbd_debugfs_minors = dentry; |
---|
941 | | - return 0; |
---|
942 | | - |
---|
943 | | -fail: |
---|
944 | | - drbd_debugfs_cleanup(); |
---|
945 | | - if (dentry) |
---|
946 | | - return PTR_ERR(dentry); |
---|
947 | | - else |
---|
948 | | - return -EINVAL; |
---|
949 | 891 | } |
---|