btrfs: create example debugfs file only in debugging build
authorDavid Sterba <dsterba@suse.com>
Thu, 1 Sep 2016 12:37:53 +0000 (14:37 +0200)
committerDavid Sterba <dsterba@suse.com>
Mon, 26 Sep 2016 15:59:49 +0000 (17:59 +0200)
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/sysfs.c

index 804bd1c..e498a47 100644 (file)
@@ -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;
 }