summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/sysfs.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-09-01 14:37:53 +0200
committerDavid Sterba <dsterba@suse.com>2016-09-26 17:59:49 +0200
commitb0de6c4c81099494d7863a31db06366f74395cda (patch)
treef792d52b7a9b09dd00eedaed99dafa8757e197a8 /fs/btrfs/sysfs.c
parent07f6a480436595394a06a69d0ebc18fef6736197 (diff)
downloadlinux-stable-b0de6c4c81099494d7863a31db06366f74395cda.tar.gz
linux-stable-b0de6c4c81099494d7863a31db06366f74395cda.tar.bz2
linux-stable-b0de6c4c81099494d7863a31db06366f74395cda.zip
btrfs: create example debugfs file only in debugging build
Reviewed-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/sysfs.c')
-rw-r--r--fs/btrfs/sysfs.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 804bd1c42e47..e498a472ac20 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -836,9 +836,18 @@ static int btrfs_init_debugfs(void)
if (!btrfs_debugfs_root_dentry)
return -ENOMEM;
+ /*
+ * Example code, how to export data through debugfs.
+ *
+ * file: /sys/kernel/debug/btrfs/test
+ * contents of: btrfs_debugfs_test
+ */
+#ifdef CONFIG_BTRFS_DEBUG
debugfs_create_u64("test", S_IRUGO | S_IWUSR, btrfs_debugfs_root_dentry,
&btrfs_debugfs_test);
#endif
+
+#endif
return 0;
}