"Fossies" - the Fresh Open Source Software Archive

Member "drbd-9.0.21-1/drbd/drbd_kref_debug.c" (28 Oct 2019, 2572 Bytes) of package /linux/misc/drbd-9.0.21-1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "drbd_kref_debug.c" see the Fossies "Dox" file reference documentation.

    1 #include <drbd_kref_debug.h>
    2 #include "drbd_int.h"
    3 
    4 
    5 static void get_resource_name(const struct kref_debug_info *debug_info, char *name)
    6 {
    7     struct drbd_resource *resource = container_of(debug_info, struct drbd_resource, kref_debug);
    8     if (resource->name)
    9         strcpy(name, resource->name);
   10     else
   11         strcpy(name, "unnamed");
   12 }
   13 
   14 static void get_connection_name(const struct kref_debug_info *debug_info, char *name)
   15 {
   16     struct drbd_connection *connection = container_of(debug_info, struct drbd_connection, kref_debug);
   17     struct net_conf *nc;
   18     const char *resource_n =
   19         connection->resource && connection->resource->name ? connection->resource->name : "unknown";
   20 
   21     rcu_read_lock();
   22     nc = rcu_dereference(connection->transport.net_conf);
   23     sprintf(name, "%s:%s", resource_n , nc ? nc->name : "unnamed");
   24     rcu_read_unlock();
   25 }
   26 
   27 static void get_device_name(const struct kref_debug_info *debug_info, char *name)
   28 {
   29     struct drbd_device *device = container_of(debug_info, struct drbd_device, kref_debug);
   30     const char *resource_n =
   31         device->resource && device->resource->name ? device->resource->name : "unknown";
   32 
   33     sprintf(name, "%s/%d minor-%d", resource_n, device->vnr, device->minor);
   34 }
   35 
   36 struct kref_debug_class kref_class_resource = {
   37     "resource",
   38     get_resource_name,
   39     {
   40         [1] = "kthread",
   41         [2] = "drbd_adm_prepare()/drbd_adm_finish()",
   42         [3] = "struct drbd_connection",
   43         [4] = "struct drbd_device",
   44         [5] = "struct drbd_state_change",
   45         [6] = "drbd_adm_dump_connections()",
   46         [7] = "drbd_adm_dump_devices()",
   47         [8] = "free",
   48         [9] = "drbd_adm_dump_peer_devices()",
   49     }
   50 };
   51 
   52 struct kref_debug_class kref_class_connection = {
   53     "connection",
   54     get_connection_name,
   55     {
   56         [1] = "kthread",
   57         [2] = "drbd_adm_prepare()/drbd_adm_finish()",
   58         [3] = "struct drbd_peer_device",
   59         [4] = "conn_try_outdate_peer_async()",
   60         [5] = "remember_state_change()forget_state_change()",
   61         [6] = "change_cluster_wide_state()",
   62         [7] = "struct drbd_state_change",
   63         [8] = "target_connection/change_cluster_wide_state()",
   64         [9] = "resource->twopc_parent",
   65         [10] = "free",
   66         [11] = "connect_timer",
   67         [12] = "receive_peer_dagtag()",
   68         [13] = "for_each_connection_ref()",
   69         [14] = "w_update_peers",
   70         [15] = "for_each_peer_device_ref()",
   71         [16] = "queue_twopc",
   72     }
   73 };
   74 
   75 
   76 
   77 struct kref_debug_class kref_class_device = {
   78     "device",
   79     get_device_name,
   80     {
   81         [1] = "struct drbd_peer_device / free",
   82         [2] = "struct drbd_state_change",
   83         [3] = "open / release",
   84         [4] = "drbd_adm_prepare()/drbd_adm_finish()",
   85         [5] = "w_update_peers",
   86         [6] = "drbd_request",
   87         [7] = "flush_after_epoch",
   88         [8] = "send_acks_wf",
   89     }
   90 };
   91 
   92