diff mbox

btrfs: create example debugfs file only in debugging build

Message ID 1472733872-32549-1-git-send-email-dsterba@suse.com (mailing list archive)
State Accepted
Headers show

Commit Message

David Sterba Sept. 1, 2016, 12:44 p.m. UTC
Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/sysfs.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Eric Sandeen Sept. 1, 2016, 2:33 p.m. UTC | #1
On 9/1/16 7:44 AM, David Sterba wrote:
> Signed-off-by: David Sterba <dsterba@suse.com>

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  fs/btrfs/sysfs.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
> index 804bd1c42e47..31f09564e170 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 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;
>  }
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 804bd1c42e47..31f09564e170 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 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;
 }