All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: sysfs: map sysfs files to their path
@ 2021-08-05  1:02 Anand Jain
  2021-08-09 14:36 ` David Sterba
  0 siblings, 1 reply; 4+ messages in thread
From: Anand Jain @ 2021-08-05  1:02 UTC (permalink / raw)
  To: linux-btrfs

Sysfs file has grown big. It takes some time to locate the correct
struct attribute to add new files. Create a table and map the
struct attribute to its sysfs path.

Also, fix the comment about the debug sysfs path.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 fs/btrfs/sysfs.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index bfe5e27617b0..cb00c0c08949 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -22,6 +22,26 @@
 #include "block-group.h"
 #include "qgroup.h"
 
+
+/*
+ * struct attributes (sysfs files)	sysfs path
+ * --------------------------------------------------------------------------
+ * btrfs_supported_static_feature_attrs /sys/fs/btrfs/features
+ * btrfs_supported_feature_attrs        /sys/fs/btrfs/features and
+ *					/sys/fs/btrfs/uuid/features (if visible)
+ * btrfs_debug_feature_attrs		/sys/fs/btrfs/debug
+ * btrfs_debug_mount_attrs		/sys/fs/btrfs/<uuid>/debug
+ * discard_debug_attrs			/sys/fs/btrfs/<uuid>/debug/discard
+ * btrfs_attrs				/sys/fs/btrfs/<uuid>
+ * devid_attrs				/sys/fs/btrfs/<uuid>/devinfo/<devid>
+ * allocation_attrs			/sys/fs/btrfs/<uuid>/allocation
+ * qgroup_attrs				/sys/fs/btrfs/<uuid>/qgroups/<subvol-id>/
+ * space_info_attrs		/sys/fs/btrfs/<uuid>/allocation/<bg-type>
+ * raid_attrs		/sys/fs/btrfs/<uuid>/allocation/<bg-type>/<bg-profile>
+ */
+
+
+
 struct btrfs_feature_attr {
 	struct kobj_attribute kobj_attr;
 	enum btrfs_feature_set feature_set;
@@ -573,7 +593,7 @@ static const struct attribute *discard_debug_attrs[] = {
  * Runtime debugging exported via sysfs
  *
  * /sys/fs/btrfs/debug - applies to module or all filesystems
- * /sys/fs/btrfs/UUID  - applies only to the given filesystem
+ * /sys/fs/btrfs/UUID/debug - applies only to the given filesystem
  */
 static const struct attribute *btrfs_debug_mount_attrs[] = {
 	NULL,
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: sysfs: map sysfs files to their path
  2021-08-05  1:02 [PATCH] btrfs: sysfs: map sysfs files to their path Anand Jain
@ 2021-08-09 14:36 ` David Sterba
  2021-08-10  0:34   ` Anand Jain
  0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2021-08-09 14:36 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs

On Thu, Aug 05, 2021 at 09:02:46AM +0800, Anand Jain wrote:
> Sysfs file has grown big. It takes some time to locate the correct
> struct attribute to add new files. Create a table and map the
> struct attribute to its sysfs path.
> 
> Also, fix the comment about the debug sysfs path.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  fs/btrfs/sysfs.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
> index bfe5e27617b0..cb00c0c08949 100644
> --- a/fs/btrfs/sysfs.c
> +++ b/fs/btrfs/sysfs.c
> @@ -22,6 +22,26 @@
>  #include "block-group.h"
>  #include "qgroup.h"
>  
> +
> +/*
> + * struct attributes (sysfs files)	sysfs path
> + * --------------------------------------------------------------------------
> + * btrfs_supported_static_feature_attrs /sys/fs/btrfs/features
> + * btrfs_supported_feature_attrs        /sys/fs/btrfs/features and
> + *					/sys/fs/btrfs/uuid/features (if visible)
> + * btrfs_debug_feature_attrs		/sys/fs/btrfs/debug
> + * btrfs_debug_mount_attrs		/sys/fs/btrfs/<uuid>/debug
> + * discard_debug_attrs			/sys/fs/btrfs/<uuid>/debug/discard
> + * btrfs_attrs				/sys/fs/btrfs/<uuid>
> + * devid_attrs				/sys/fs/btrfs/<uuid>/devinfo/<devid>
> + * allocation_attrs			/sys/fs/btrfs/<uuid>/allocation
> + * qgroup_attrs				/sys/fs/btrfs/<uuid>/qgroups/<subvol-id>/
> + * space_info_attrs		/sys/fs/btrfs/<uuid>/allocation/<bg-type>
> + * raid_attrs		/sys/fs/btrfs/<uuid>/allocation/<bg-type>/<bg-profile>
> + */

I think this would be better next to the definitions, so you don't have
to repeat the identifier name and it's at the same location once we need
to add more attributes.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: sysfs: map sysfs files to their path
  2021-08-09 14:36 ` David Sterba
@ 2021-08-10  0:34   ` Anand Jain
  2021-08-10  9:48     ` David Sterba
  0 siblings, 1 reply; 4+ messages in thread
From: Anand Jain @ 2021-08-10  0:34 UTC (permalink / raw)
  To: dsterba; +Cc: linux-btrfs



On 09/08/2021 22:36, David Sterba wrote:
> On Thu, Aug 05, 2021 at 09:02:46AM +0800, Anand Jain wrote:
>> Sysfs file has grown big. It takes some time to locate the correct
>> struct attribute to add new files. Create a table and map the
>> struct attribute to its sysfs path.
>>
>> Also, fix the comment about the debug sysfs path.
>>
>> Signed-off-by: Anand Jain <anand.jain@oracle.com>
>> ---
>>   fs/btrfs/sysfs.c | 22 +++++++++++++++++++++-
>>   1 file changed, 21 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
>> index bfe5e27617b0..cb00c0c08949 100644
>> --- a/fs/btrfs/sysfs.c
>> +++ b/fs/btrfs/sysfs.c
>> @@ -22,6 +22,26 @@
>>   #include "block-group.h"
>>   #include "qgroup.h"
>>   
>> +
>> +/*
>> + * struct attributes (sysfs files)	sysfs path
>> + * --------------------------------------------------------------------------
>> + * btrfs_supported_static_feature_attrs /sys/fs/btrfs/features
>> + * btrfs_supported_feature_attrs        /sys/fs/btrfs/features and
>> + *					/sys/fs/btrfs/uuid/features (if visible)
>> + * btrfs_debug_feature_attrs		/sys/fs/btrfs/debug
>> + * btrfs_debug_mount_attrs		/sys/fs/btrfs/<uuid>/debug
>> + * discard_debug_attrs			/sys/fs/btrfs/<uuid>/debug/discard
>> + * btrfs_attrs				/sys/fs/btrfs/<uuid>
>> + * devid_attrs				/sys/fs/btrfs/<uuid>/devinfo/<devid>
>> + * allocation_attrs			/sys/fs/btrfs/<uuid>/allocation
>> + * qgroup_attrs				/sys/fs/btrfs/<uuid>/qgroups/<subvol-id>/
>> + * space_info_attrs		/sys/fs/btrfs/<uuid>/allocation/<bg-type>
>> + * raid_attrs		/sys/fs/btrfs/<uuid>/allocation/<bg-type>/<bg-profile>
>> + */
> 
> I think this would be better next to the definitions, so you don't have
> to repeat the identifier name and it's at the same location once we need
> to add more attributes.
> 


  I was thinking to add to both. That is, create a table and also add it 
to the definitions.

  The table provides a big picture and easy to locate the name of the 
attributes list. No?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs: sysfs: map sysfs files to their path
  2021-08-10  0:34   ` Anand Jain
@ 2021-08-10  9:48     ` David Sterba
  0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2021-08-10  9:48 UTC (permalink / raw)
  To: Anand Jain; +Cc: linux-btrfs

On Tue, Aug 10, 2021 at 08:34:33AM +0800, Anand Jain wrote:
> 
> 
> On 09/08/2021 22:36, David Sterba wrote:
> > On Thu, Aug 05, 2021 at 09:02:46AM +0800, Anand Jain wrote:
> >> Sysfs file has grown big. It takes some time to locate the correct
> >> struct attribute to add new files. Create a table and map the
> >> struct attribute to its sysfs path.
> >>
> >> Also, fix the comment about the debug sysfs path.
> >>
> >> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> >> ---
> >>   fs/btrfs/sysfs.c | 22 +++++++++++++++++++++-
> >>   1 file changed, 21 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
> >> index bfe5e27617b0..cb00c0c08949 100644
> >> --- a/fs/btrfs/sysfs.c
> >> +++ b/fs/btrfs/sysfs.c
> >> @@ -22,6 +22,26 @@
> >>   #include "block-group.h"
> >>   #include "qgroup.h"
> >>   
> >> +
> >> +/*
> >> + * struct attributes (sysfs files)	sysfs path
> >> + * --------------------------------------------------------------------------
> >> + * btrfs_supported_static_feature_attrs /sys/fs/btrfs/features
> >> + * btrfs_supported_feature_attrs        /sys/fs/btrfs/features and
> >> + *					/sys/fs/btrfs/uuid/features (if visible)
> >> + * btrfs_debug_feature_attrs		/sys/fs/btrfs/debug
> >> + * btrfs_debug_mount_attrs		/sys/fs/btrfs/<uuid>/debug
> >> + * discard_debug_attrs			/sys/fs/btrfs/<uuid>/debug/discard
> >> + * btrfs_attrs				/sys/fs/btrfs/<uuid>
> >> + * devid_attrs				/sys/fs/btrfs/<uuid>/devinfo/<devid>
> >> + * allocation_attrs			/sys/fs/btrfs/<uuid>/allocation
> >> + * qgroup_attrs				/sys/fs/btrfs/<uuid>/qgroups/<subvol-id>/
> >> + * space_info_attrs		/sys/fs/btrfs/<uuid>/allocation/<bg-type>
> >> + * raid_attrs		/sys/fs/btrfs/<uuid>/allocation/<bg-type>/<bg-profile>
> >> + */
> > 
> > I think this would be better next to the definitions, so you don't have
> > to repeat the identifier name and it's at the same location once we need
> > to add more attributes.
> > 
> 
> 
>   I was thinking to add to both. That is, create a table and also add it 
> to the definitions.
> 
>   The table provides a big picture and easy to locate the name of the 
> attributes list. No?

Yes, makes sense to have both.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-10  9:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05  1:02 [PATCH] btrfs: sysfs: map sysfs files to their path Anand Jain
2021-08-09 14:36 ` David Sterba
2021-08-10  0:34   ` Anand Jain
2021-08-10  9:48     ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.