hc
2024-10-12 a5969cabbb4660eab42b6ef0412cbbd1200cf14d
kernel/drivers/block/drbd/drbd_debugfs.c
....@@ -237,6 +237,8 @@
237237 seq_print_rq_state_bit(m, f & EE_CALL_AL_COMPLETE_IO, &sep, "in-AL");
238238 seq_print_rq_state_bit(m, f & EE_SEND_WRITE_ACK, &sep, "C");
239239 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");
240242 seq_print_rq_state_bit(m, f & EE_WRITE_SAME, &sep, "write-same");
241243 seq_putc(m, '\n');
242244 }
....@@ -463,35 +465,20 @@
463465 void drbd_debugfs_resource_add(struct drbd_resource *resource)
464466 {
465467 struct dentry *dentry;
466
- if (!drbd_debugfs_resources)
467
- return;
468468
469469 dentry = debugfs_create_dir(resource->name, drbd_debugfs_resources);
470
- if (IS_ERR_OR_NULL(dentry))
471
- goto fail;
472470 resource->debugfs_res = dentry;
473471
474472 dentry = debugfs_create_dir("volumes", resource->debugfs_res);
475
- if (IS_ERR_OR_NULL(dentry))
476
- goto fail;
477473 resource->debugfs_res_volumes = dentry;
478474
479475 dentry = debugfs_create_dir("connections", resource->debugfs_res);
480
- if (IS_ERR_OR_NULL(dentry))
481
- goto fail;
482476 resource->debugfs_res_connections = dentry;
483477
484478 dentry = debugfs_create_file("in_flight_summary", 0440,
485479 resource->debugfs_res, resource,
486480 &in_flight_summary_fops);
487
- if (IS_ERR_OR_NULL(dentry))
488
- goto fail;
489481 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");
495482 }
496483
497484 static void drbd_debugfs_remove(struct dentry **dp)
....@@ -634,35 +621,22 @@
634621 {
635622 struct dentry *conns_dir = connection->resource->debugfs_res_connections;
636623 struct dentry *dentry;
637
- if (!conns_dir)
638
- return;
639624
640625 /* Once we enable mutliple peers,
641626 * these connections will have descriptive names.
642627 * For now, it is just the one connection to the (only) "peer". */
643628 dentry = debugfs_create_dir("peer", conns_dir);
644
- if (IS_ERR_OR_NULL(dentry))
645
- goto fail;
646629 connection->debugfs_conn = dentry;
647630
648631 dentry = debugfs_create_file("callback_history", 0440,
649632 connection->debugfs_conn, connection,
650633 &connection_callback_history_fops);
651
- if (IS_ERR_OR_NULL(dentry))
652
- goto fail;
653634 connection->debugfs_conn_callback_history = dentry;
654635
655636 dentry = debugfs_create_file("oldest_requests", 0440,
656637 connection->debugfs_conn, connection,
657638 &connection_oldest_requests_fops);
658
- if (IS_ERR_OR_NULL(dentry))
659
- goto fail;
660639 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");
666640 }
667641
668642 void drbd_debugfs_connection_cleanup(struct drbd_connection *connection)
....@@ -807,8 +781,6 @@
807781
808782 snprintf(vnr_buf, sizeof(vnr_buf), "%u", device->vnr);
809783 dentry = debugfs_create_dir(vnr_buf, vols_dir);
810
- if (IS_ERR_OR_NULL(dentry))
811
- goto fail;
812784 device->debugfs_vol = dentry;
813785
814786 snprintf(minor_buf, sizeof(minor_buf), "%u", device->minor);
....@@ -817,18 +789,14 @@
817789 if (!slink_name)
818790 goto fail;
819791 dentry = debugfs_create_symlink(minor_buf, drbd_debugfs_minors, slink_name);
792
+ device->debugfs_minor = dentry;
820793 kfree(slink_name);
821794 slink_name = NULL;
822
- if (IS_ERR_OR_NULL(dentry))
823
- goto fail;
824
- device->debugfs_minor = dentry;
825795
826796 #define DCF(name) do { \
827797 dentry = debugfs_create_file(#name, 0440, \
828798 device->debugfs_vol, device, \
829799 &device_ ## name ## _fops); \
830
- if (IS_ERR_OR_NULL(dentry)) \
831
- goto fail; \
832800 device->debugfs_vol_ ## name = dentry; \
833801 } while (0)
834802
....@@ -862,19 +830,9 @@
862830 struct dentry *dentry;
863831 char vnr_buf[8];
864832
865
- if (!conn_dir)
866
- return;
867
-
868833 snprintf(vnr_buf, sizeof(vnr_buf), "%u", peer_device->device->vnr);
869834 dentry = debugfs_create_dir(vnr_buf, conn_dir);
870
- if (IS_ERR_OR_NULL(dentry))
871
- goto fail;
872835 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");
878836 }
879837
880838 void drbd_debugfs_peer_device_cleanup(struct drbd_peer_device *peer_device)
....@@ -915,35 +873,19 @@
915873 drbd_debugfs_remove(&drbd_debugfs_root);
916874 }
917875
918
-int __init drbd_debugfs_init(void)
876
+void __init drbd_debugfs_init(void)
919877 {
920878 struct dentry *dentry;
921879
922880 dentry = debugfs_create_dir("drbd", NULL);
923
- if (IS_ERR_OR_NULL(dentry))
924
- goto fail;
925881 drbd_debugfs_root = dentry;
926882
927883 dentry = debugfs_create_file("version", 0444, drbd_debugfs_root, NULL, &drbd_version_fops);
928
- if (IS_ERR_OR_NULL(dentry))
929
- goto fail;
930884 drbd_debugfs_version = dentry;
931885
932886 dentry = debugfs_create_dir("resources", drbd_debugfs_root);
933
- if (IS_ERR_OR_NULL(dentry))
934
- goto fail;
935887 drbd_debugfs_resources = dentry;
936888
937889 dentry = debugfs_create_dir("minors", drbd_debugfs_root);
938
- if (IS_ERR_OR_NULL(dentry))
939
- goto fail;
940890 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;
949891 }