aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2014-05-06 09:05:23 -0400
committerPhilipp Reisner <philipp.reisner@linbit.com>2014-07-10 12:35:19 -0400
commitb44e1184fc3158821a74c870f777a39e4aac2ce5 (patch)
treea839d29f8598bd8f3c58eaea0daa007b7c4ab6b7 /drivers/block
parent54e6fc38e888a54b016e1e04e1eceea78ddf7ace (diff)
drbd: debugfs: add version tag to debugfs files
Make the first line of debugfs files a version number, starting now with "v: 0". If we change content of presentation, we will bump that. Monitoring or diagnostic scritps that may parse these files can then easily know when they need to be reviewed. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/drbd/drbd_debugfs.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_debugfs.c b/drivers/block/drbd/drbd_debugfs.c
index 45b52056f88d..a4d0666a5931 100644
--- a/drivers/block/drbd/drbd_debugfs.c
+++ b/drivers/block/drbd/drbd_debugfs.c
@@ -11,7 +11,13 @@
11#include "drbd_req.h" 11#include "drbd_req.h"
12#include "drbd_debugfs.h" 12#include "drbd_debugfs.h"
13 13
14
15/**********************************************************************
16 * Whenever you change the file format, remember to bump the version. *
17 **********************************************************************/
18
14static struct dentry *drbd_debugfs_root; 19static struct dentry *drbd_debugfs_root;
20static struct dentry *drbd_debugfs_version;
15static struct dentry *drbd_debugfs_resources; 21static struct dentry *drbd_debugfs_resources;
16static struct dentry *drbd_debugfs_minors; 22static struct dentry *drbd_debugfs_minors;
17 23
@@ -368,6 +374,9 @@ static int in_flight_summary_show(struct seq_file *m, void *pos)
368 if (!connection || !kref_get_unless_zero(&connection->kref)) 374 if (!connection || !kref_get_unless_zero(&connection->kref))
369 return -ESTALE; 375 return -ESTALE;
370 376
377 /* BUMP me if you change the file format/content/presentation */
378 seq_printf(m, "v: %u\n\n", 0);
379
371 seq_puts(m, "oldest bitmap IO\n"); 380 seq_puts(m, "oldest bitmap IO\n");
372 seq_print_resource_pending_bitmap_io(m, resource, jif); 381 seq_print_resource_pending_bitmap_io(m, resource, jif);
373 seq_putc(m, '\n'); 382 seq_putc(m, '\n');
@@ -562,6 +571,9 @@ static int callback_history_show(struct seq_file *m, void *ignored)
562 struct drbd_connection *connection = m->private; 571 struct drbd_connection *connection = m->private;
563 unsigned long jif = jiffies; 572 unsigned long jif = jiffies;
564 573
574 /* BUMP me if you change the file format/content/presentation */
575 seq_printf(m, "v: %u\n\n", 0);
576
565 seq_puts(m, "n\tage\tcallsite\tfn\n"); 577 seq_puts(m, "n\tage\tcallsite\tfn\n");
566 seq_print_timing_details(m, "worker", connection->w_cb_nr, connection->w_timing_details, jif); 578 seq_print_timing_details(m, "worker", connection->w_cb_nr, connection->w_timing_details, jif);
567 seq_print_timing_details(m, "receiver", connection->r_cb_nr, connection->r_timing_details, jif); 579 seq_print_timing_details(m, "receiver", connection->r_cb_nr, connection->r_timing_details, jif);
@@ -686,6 +698,10 @@ static void resync_dump_detail(struct seq_file *m, struct lc_element *e)
686static int device_resync_extents_show(struct seq_file *m, void *ignored) 698static int device_resync_extents_show(struct seq_file *m, void *ignored)
687{ 699{
688 struct drbd_device *device = m->private; 700 struct drbd_device *device = m->private;
701
702 /* BUMP me if you change the file format/content/presentation */
703 seq_printf(m, "v: %u\n\n", 0);
704
689 if (get_ldev_if_state(device, D_FAILED)) { 705 if (get_ldev_if_state(device, D_FAILED)) {
690 lc_seq_printf_stats(m, device->resync); 706 lc_seq_printf_stats(m, device->resync);
691 lc_seq_dump_details(m, device->resync, "rs_left flags", resync_dump_detail); 707 lc_seq_dump_details(m, device->resync, "rs_left flags", resync_dump_detail);
@@ -697,6 +713,10 @@ static int device_resync_extents_show(struct seq_file *m, void *ignored)
697static int device_act_log_extents_show(struct seq_file *m, void *ignored) 713static int device_act_log_extents_show(struct seq_file *m, void *ignored)
698{ 714{
699 struct drbd_device *device = m->private; 715 struct drbd_device *device = m->private;
716
717 /* BUMP me if you change the file format/content/presentation */
718 seq_printf(m, "v: %u\n\n", 0);
719
700 if (get_ldev_if_state(device, D_FAILED)) { 720 if (get_ldev_if_state(device, D_FAILED)) {
701 lc_seq_printf_stats(m, device->act_log); 721 lc_seq_printf_stats(m, device->act_log);
702 lc_seq_dump_details(m, device->act_log, "", NULL); 722 lc_seq_dump_details(m, device->act_log, "", NULL);
@@ -713,6 +733,9 @@ static int device_oldest_requests_show(struct seq_file *m, void *ignored)
713 struct drbd_request *r1, *r2; 733 struct drbd_request *r1, *r2;
714 int i; 734 int i;
715 735
736 /* BUMP me if you change the file format/content/presentation */
737 seq_printf(m, "v: %u\n\n", 0);
738
716 seq_puts(m, RQ_HDR); 739 seq_puts(m, RQ_HDR);
717 spin_lock_irq(&resource->req_lock); 740 spin_lock_irq(&resource->req_lock);
718 /* WRITE, then READ */ 741 /* WRITE, then READ */
@@ -839,12 +862,36 @@ void drbd_debugfs_peer_device_cleanup(struct drbd_peer_device *peer_device)
839 drbd_debugfs_remove(&peer_device->debugfs_peer_dev); 862 drbd_debugfs_remove(&peer_device->debugfs_peer_dev);
840} 863}
841 864
865static int drbd_version_show(struct seq_file *m, void *ignored)
866{
867 seq_printf(m, "# %s\n", drbd_buildtag());
868 seq_printf(m, "VERSION=%s\n", REL_VERSION);
869 seq_printf(m, "API_VERSION=%u\n", API_VERSION);
870 seq_printf(m, "PRO_VERSION_MIN=%u\n", PRO_VERSION_MIN);
871 seq_printf(m, "PRO_VERSION_MAX=%u\n", PRO_VERSION_MAX);
872 return 0;
873}
874
875static int drbd_version_open(struct inode *inode, struct file *file)
876{
877 return single_open(file, drbd_version_show, NULL);
878}
879
880static struct file_operations drbd_version_fops = {
881 .owner = THIS_MODULE,
882 .open = drbd_version_open,
883 .llseek = seq_lseek,
884 .read = seq_read,
885 .release = single_release,
886};
887
842/* not __exit, may be indirectly called 888/* not __exit, may be indirectly called
843 * from the module-load-failure path as well. */ 889 * from the module-load-failure path as well. */
844void drbd_debugfs_cleanup(void) 890void drbd_debugfs_cleanup(void)
845{ 891{
846 drbd_debugfs_remove(&drbd_debugfs_resources); 892 drbd_debugfs_remove(&drbd_debugfs_resources);
847 drbd_debugfs_remove(&drbd_debugfs_minors); 893 drbd_debugfs_remove(&drbd_debugfs_minors);
894 drbd_debugfs_remove(&drbd_debugfs_version);
848 drbd_debugfs_remove(&drbd_debugfs_root); 895 drbd_debugfs_remove(&drbd_debugfs_root);
849} 896}
850 897
@@ -857,6 +904,11 @@ int __init drbd_debugfs_init(void)
857 goto fail; 904 goto fail;
858 drbd_debugfs_root = dentry; 905 drbd_debugfs_root = dentry;
859 906
907 dentry = debugfs_create_file("version", 0444, drbd_debugfs_root, NULL, &drbd_version_fops);
908 if (IS_ERR_OR_NULL(dentry))
909 goto fail;
910 drbd_debugfs_version = dentry;
911
860 dentry = debugfs_create_dir("resources", drbd_debugfs_root); 912 dentry = debugfs_create_dir("resources", drbd_debugfs_root);
861 if (IS_ERR_OR_NULL(dentry)) 913 if (IS_ERR_OR_NULL(dentry))
862 goto fail; 914 goto fail;