diff options
| author | Lars Ellenberg <lars.ellenberg@linbit.com> | 2014-05-14 14:33:05 -0400 |
|---|---|---|
| committer | Philipp Reisner <philipp.reisner@linbit.com> | 2014-07-10 12:35:21 -0400 |
| commit | cc356f85bb57a3587e4b1d944e669fe39b37cdf2 (patch) | |
| tree | a51d3e10c0ca2ef7167484e791829bd25d5b552e | |
| parent | 3d299f48a9ff82d29093578e937e83e41dc93325 (diff) | |
drbd: debugfs: add per device data_gen_id
The data generation identifiers used to be exposed via sysfs
at /sys/block/drbdX/drbd/meta_data/data_gen_id (out-of-tree),
for advanced policy scripting.
Bring that information over to debugfs.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
| -rw-r--r-- | drivers/block/drbd/drbd_debugfs.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/block/drbd/drbd_debugfs.c b/drivers/block/drbd/drbd_debugfs.c index db70d6caf220..5c20b18540b8 100644 --- a/drivers/block/drbd/drbd_debugfs.c +++ b/drivers/block/drbd/drbd_debugfs.c | |||
| @@ -760,6 +760,25 @@ static int device_oldest_requests_show(struct seq_file *m, void *ignored) | |||
| 760 | return 0; | 760 | return 0; |
| 761 | } | 761 | } |
| 762 | 762 | ||
| 763 | static int device_data_gen_id_show(struct seq_file *m, void *ignored) | ||
| 764 | { | ||
| 765 | struct drbd_device *device = m->private; | ||
| 766 | struct drbd_md *md; | ||
| 767 | enum drbd_uuid_index idx; | ||
| 768 | |||
| 769 | if (!get_ldev_if_state(device, D_FAILED)) | ||
| 770 | return -ENODEV; | ||
| 771 | |||
| 772 | md = &device->ldev->md; | ||
| 773 | spin_lock_irq(&md->uuid_lock); | ||
| 774 | for (idx = UI_CURRENT; idx <= UI_HISTORY_END; idx++) { | ||
| 775 | seq_printf(m, "0x%016llX\n", md->uuid[idx]); | ||
| 776 | } | ||
| 777 | spin_unlock_irq(&md->uuid_lock); | ||
| 778 | put_ldev(device); | ||
| 779 | return 0; | ||
| 780 | } | ||
| 781 | |||
| 763 | #define drbd_debugfs_device_attr(name) \ | 782 | #define drbd_debugfs_device_attr(name) \ |
| 764 | static int device_ ## name ## _open(struct inode *inode, struct file *file) \ | 783 | static int device_ ## name ## _open(struct inode *inode, struct file *file) \ |
| 765 | { \ | 784 | { \ |
| @@ -784,6 +803,7 @@ static const struct file_operations device_ ## name ## _fops = { \ | |||
| 784 | drbd_debugfs_device_attr(oldest_requests) | 803 | drbd_debugfs_device_attr(oldest_requests) |
| 785 | drbd_debugfs_device_attr(act_log_extents) | 804 | drbd_debugfs_device_attr(act_log_extents) |
| 786 | drbd_debugfs_device_attr(resync_extents) | 805 | drbd_debugfs_device_attr(resync_extents) |
| 806 | drbd_debugfs_device_attr(data_gen_id) | ||
| 787 | 807 | ||
| 788 | void drbd_debugfs_device_add(struct drbd_device *device) | 808 | void drbd_debugfs_device_add(struct drbd_device *device) |
| 789 | { | 809 | { |
| @@ -826,6 +846,8 @@ void drbd_debugfs_device_add(struct drbd_device *device) | |||
| 826 | DCF(oldest_requests); | 846 | DCF(oldest_requests); |
| 827 | DCF(act_log_extents); | 847 | DCF(act_log_extents); |
| 828 | DCF(resync_extents); | 848 | DCF(resync_extents); |
| 849 | DCF(data_gen_id); | ||
| 850 | #undef DCF | ||
| 829 | return; | 851 | return; |
| 830 | 852 | ||
| 831 | fail: | 853 | fail: |
