Skip to contentSkip to conversation

Cleanup 2 sysfs flags

PATCH In review Nikolay Borisov 4 participants 12 messages Jun 24, 2022 – Jul 12, 2022 Btrfs file system

lore
Share & tools
lore
#0 lore raw

cover Cleanup 2 sysfs flags

This series removes MIXED_BACKREF/BIG_METADATA sysfs files. While discussing flags with David it transpired that those 2 have been merged for quite some time and practically all modern (created in the last 9 years) filesystem will have them set. They are not opt-in so let's use this fact to simplify our list of sysfs flags.

Nikolay Borisov (2):
btrfs: remove MIXED_BACKREF sysfs file
btrfs: remove BIG_METADATA syfs file

 fs/btrfs/sysfs.c | 4 ----
 1 file changed, 4 deletions(-)

--
2.25.1

#1 lore raw

PATCH 1/2 btrfs: remove MIXED_BACKREF sysfs file

This feature has been the default for about 13 year. At this point it's safe to consider it an indispensable feature of BTRFS as such there's no need to advertise it in sysfs. Simply remove the sysfs file.

---
 fs/btrfs/sysfs.c | 2 --
 1 file changed, 2 deletions(-)
fs/btrfs/sysfs.c +0 -2
index d4502f0e4fca..715d1e725f2a 100644
@@ -276,7 +276,6 @@ static umode_t btrfs_feature_visible(struct kobject *kobj,
 	return mode;
 }
 
-BTRFS_FEAT_ATTR_INCOMPAT(mixed_backref, MIXED_BACKREF);
 BTRFS_FEAT_ATTR_INCOMPAT(default_subvol, DEFAULT_SUBVOL);
 BTRFS_FEAT_ATTR_INCOMPAT(mixed_groups, MIXED_GROUPS);
 BTRFS_FEAT_ATTR_INCOMPAT(compress_lzo, COMPRESS_LZO);
@@ -308,7 +307,6 @@ BTRFS_FEAT_ATTR_COMPAT_RO(verity, VERITY);
  *                               can be changed on a mounted filesystem.
  */
 static struct attribute *btrfs_supported_feature_attrs[] = {
-	BTRFS_FEAT_ATTR_PTR(mixed_backref),
 	BTRFS_FEAT_ATTR_PTR(default_subvol),
 	BTRFS_FEAT_ATTR_PTR(mixed_groups),
 	BTRFS_FEAT_ATTR_PTR(compress_lzo),
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH 1/2] btrfs: remove MIXED_BACKREF sysfs file

Quoted 3 lines · Nikolay Borisov

This feature has been the default for about 13 year. At this point it's safe to consider it an indispensable feature of BTRFS as such there's no need to advertise it in sysfs. Simply remove the sysfs file.

I don't think that's the correct way to go.

In fact, I think sysfs should have everything, no matter how long supported it is.

Thanks,
Qu

Quoted 26 lines
---
  fs/btrfs/sysfs.c | 2 --
  1 file changed, 2 deletions(-)
fs/btrfs/sysfs.c +0 -2
index d4502f0e4fca..715d1e725f2a 100644
@@ -276,7 +276,6 @@ static umode_t btrfs_feature_visible(struct kobject *kobj,
  	return mode;
  }
 
-BTRFS_FEAT_ATTR_INCOMPAT(mixed_backref, MIXED_BACKREF);
  BTRFS_FEAT_ATTR_INCOMPAT(default_subvol, DEFAULT_SUBVOL);
  BTRFS_FEAT_ATTR_INCOMPAT(mixed_groups, MIXED_GROUPS);
  BTRFS_FEAT_ATTR_INCOMPAT(compress_lzo, COMPRESS_LZO);
@@ -308,7 +307,6 @@ BTRFS_FEAT_ATTR_COMPAT_RO(verity, VERITY);
   *                               can be changed on a mounted filesystem.
   */
  static struct attribute *btrfs_supported_feature_attrs[] = {
-	BTRFS_FEAT_ATTR_PTR(mixed_backref),
  	BTRFS_FEAT_ATTR_PTR(default_subvol),
  	BTRFS_FEAT_ATTR_PTR(mixed_groups),
  	BTRFS_FEAT_ATTR_PTR(compress_lzo),
#3 lore raw

Re: [PATCH 1/2] btrfs: remove MIXED_BACKREF sysfs file

Quoted 5 lines · Qu Wenruo

I don't think that's the correct way to go.

In fact, I think sysfs should have everything, no matter how long supported it is.

I disagree, for things which are considered stand alone features - yes. Like free space tree 2, but for something like backrefs, heck I think we've even removed code which predates mixed backrefs so I'm not entirely use the filesystem can function with that feature turned off, actually it's not possible to create a non-mixedbackref file system since this behavior is hard-coded in btrfs-progs. Also the commit for the backrefs states:

This commit introduces a new kind of back reference for btrfs metadata. Once a filesystem has been mounted with this commit, IT WILL NO LONGER BE MOUNTABLE BY OLDER KERNELS.

#4 lore raw

Re: [PATCH 1/2] btrfs: remove MIXED_BACKREF sysfs file

Quoted 19 lines · Nikolay Borisov
Quoted 5 lines · Qu Wenruo

I don't think that's the correct way to go.

In fact, I think sysfs should have everything, no matter how long supported it is.

I disagree, for things which are considered stand alone features - yes. Like free space tree 2, but for something like backrefs, heck I think we've even removed code which predates mixed backrefs so I'm not entirely use the filesystem can function with that feature turned off, actually it's not possible to create a non-mixedbackref file system since this behavior is hard-coded in btrfs-progs. Also the commit for the backrefs states:

Quoted 4 lines

This commit introduces a new kind of back reference for btrfs metadata. Once a filesystem has been mounted with this commit, IT WILL NO LONGER BE MOUNTABLE BY OLDER KERNELS.

That means we're hiding incompat features from the user.

Even if it's not tunable and should always be enabled, we still need to add that.

History can not be forgotten.

Thanks,
Qu

#5 lore raw

Re: [PATCH 1/2] btrfs: remove MIXED_BACKREF sysfs file

Quoted 17 lines · Qu Wenruo
Quoted 16 lines · Nikolay Borisov
Quoted 5 lines · Qu Wenruo

I don't think that's the correct way to go.

In fact, I think sysfs should have everything, no matter how long supported it is.

I disagree, for things which are considered stand alone features - yes. Like free space tree 2, but for something like backrefs, heck I think we've even removed code which predates mixed backrefs so I'm not entirely use the filesystem can function with that feature turned off, actually it's not possible to create a non-mixedbackref file system since this behavior is hard-coded in btrfs-progs. Also the commit for the backrefs states:

Quoted 8 lines
Quoted 3 lines

This commit introduces a new kind of back reference for btrfs metadata. Once a filesystem has been mounted with this commit, IT WILL NO LONGER BE MOUNTABLE BY OLDER KERNELS.

That means we're hiding incompat features from the user.

Even if it's not tunable and should always be enabled, we still need to add that.

I think the mixed_backref is an exception because it's been part of the default format for so long that we don't even remember there was something else. For users it does not mean anything today, moreover it could be confused with mixed block groups.

#6 lore raw

Re: [PATCH 1/2] btrfs: remove MIXED_BACKREF sysfs file

Quoted 24 lines · David Sterba
Quoted 23 lines · Qu Wenruo
Quoted 16 lines · Nikolay Borisov
Quoted 5 lines · Qu Wenruo

I don't think that's the correct way to go.

In fact, I think sysfs should have everything, no matter how long supported it is.

I disagree, for things which are considered stand alone features - yes. Like free space tree 2, but for something like backrefs, heck I think we've even removed code which predates mixed backrefs so I'm not entirely use the filesystem can function with that feature turned off, actually it's not possible to create a non-mixedbackref file system since this behavior is hard-coded in btrfs-progs. Also the commit for the backrefs states:

Quoted 3 lines

This commit introduces a new kind of back reference for btrfs metadata. Once a filesystem has been mounted with this commit, IT WILL NO LONGER BE MOUNTABLE BY OLDER KERNELS.

That means we're hiding incompat features from the user.

Quoted 7 lines
Quoted 2 lines

Even if it's not tunable and should always be enabled, we still need to add that.

I think the mixed_backref is an exception because it's been part of the default format for so long that we don't even remember there was something else. For users it does not mean anything today, moreover it could be confused with mixed block groups.

Then after some time, there will be some "smart" users find that we have one incompat bit without any explanation.

Thanks,
Qu

#7 lore raw

Re: [PATCH 1/2] btrfs: remove MIXED_BACKREF sysfs file

Quoted 30 lines · Qu Wenruo
Quoted 27 lines · David Sterba
Quoted 25 lines · Qu Wenruo
Quoted 16 lines · Nikolay Borisov
Quoted 5 lines · Qu Wenruo

I don't think that's the correct way to go.

In fact, I think sysfs should have everything, no matter how long supported it is.

I disagree, for things which are considered stand alone features - yes. Like free space tree 2, but for something like backrefs, heck I think we've even removed code which predates mixed backrefs so I'm not entirely use the filesystem can function with that feature turned off, actually it's not possible to create a non-mixedbackref file system since this behavior is hard-coded in btrfs-progs. Also the commit for the backrefs states:

Quoted 3 lines

This commit introduces a new kind of back reference for btrfs metadata. Once a filesystem has been mounted with this commit, IT WILL NO LONGER BE MOUNTABLE BY OLDER KERNELS.

That means we're hiding incompat features from the user.

Even if it's not tunable and should always be enabled, we still need to add that.

Quoted 7 lines
Quoted 4 lines

I think the mixed_backref is an exception because it's been part of the default format for so long that we don't even remember there was something else. For users it does not mean anything today, moreover it could be confused with mixed block groups.

Then after some time, there will be some "smart" users find that we have one incompat bit without any explanation.

Removed functionality is documented, the sysfs feature files are in manual pages and we can add a notice in which version it was removed.

#8 lore raw

Re: [PATCH 1/2] btrfs: remove MIXED_BACKREF sysfs file

Quoted 36 lines · David Sterba
Quoted 35 lines · Qu Wenruo
Quoted 31 lines · David Sterba
Quoted 17 lines · Qu Wenruo
Quoted 16 lines · Nikolay Borisov
Quoted 5 lines · Qu Wenruo

I don't think that's the correct way to go.

In fact, I think sysfs should have everything, no matter how long supported it is.

I disagree, for things which are considered stand alone features - yes. Like free space tree 2, but for something like backrefs, heck I think we've even removed code which predates mixed backrefs so I'm not entirely use the filesystem can function with that feature turned off, actually it's not possible to create a non-mixedbackref file system since this behavior is hard-coded in btrfs-progs. Also the commit for the backrefs states:

Quoted 8 lines
Quoted 3 lines

This commit introduces a new kind of back reference for btrfs metadata. Once a filesystem has been mounted with this commit, IT WILL NO LONGER BE MOUNTABLE BY OLDER KERNELS.

That means we're hiding incompat features from the user.

Even if it's not tunable and should always be enabled, we still need to add that.

I think the mixed_backref is an exception because it's been part of the default format for so long that we don't even remember there was something else. For users it does not mean anything today, moreover it could be confused with mixed block groups.

Quoted 5 lines
Quoted 2 lines

Then after some time, there will be some "smart" users find that we have one incompat bit without any explanation.

Removed functionality is documented, the sysfs feature files are in manual pages and we can add a notice in which version it was removed.

Then have all the old features get removed one by one, until one day we have a dozen of bits set, but only one or two still show in sysfs features?

No, this definitely doesn't look sane to me.

It's just trying to hide some bad behaviors which we didn't get it right in the first place.
It's fine to didn't get those things done correct in the first place, but not fine to hide them.

Especially those sysfs is already hidden to most users, way less invasive than the dmesg output/mkfs features/etc, why we still want to remove them?

Thanks,
Qu

#9 lore raw

Re: [PATCH 1/2] btrfs: remove MIXED_BACKREF sysfs file

Quoted 7 lines · Qu Wenruo
Quoted 2 lines

Removed functionality is documented, the sysfs feature files are in manual pages and we can add a notice in which version it was removed.

Then have all the old features get removed one by one, until one day we have a dozen of bits set, but only one or two still show in sysfs features?

No, this definitely doesn't look sane to me.

And nobody is suggesting that either, the big data and mixed backrefs are something that's exceptional in this regard. Removing other features would take some significant time to remove and a check if it would still not break some testing setups.

Quoted 8 lines

It's just trying to hide some bad behaviors which we didn't get it right in the first place.
It's fine to didn't get those things done correct in the first place, but not fine to hide them.

Especially those sysfs is already hidden to most users, way less invasive than the dmesg output/mkfs features/etc, why we still want to remove them?

To unclutter the namespace a bit, in case of the mixed_backrefs it's a bit confusing with the mixed block groups but I think I've mentioned that already.

#10 lore raw

Re: [PATCH 1/2] btrfs: remove MIXED_BACKREF sysfs file

Quoted 10 lines · David Sterba
Quoted 7 lines · Qu Wenruo
Quoted 2 lines

Removed functionality is documented, the sysfs feature files are in manual pages and we can add a notice in which version it was removed.

Then have all the old features get removed one by one, until one day we have a dozen of bits set, but only one or two still show in sysfs features?

No, this definitely doesn't look sane to me.

And nobody is suggesting that either,

Doesn't the patch just remove the sysfs file for both global and per-fs features?
Or did I miss something?

Quoted 10 lines

the big data and mixed backrefs
are something that's exceptional in this regard. Removing other features would take some significant time to remove and a check if it would still not break some testing setups.

Quoted 5 lines

It's just trying to hide some bad behaviors which we didn't get it right in the first place.
It's fine to didn't get those things done correct in the first place, but not fine to hide them.

Quoted 7 lines
Quoted 3 lines

Especially those sysfs is already hidden to most users, way less invasive than the dmesg output/mkfs features/etc, why we still want to remove them?

To unclutter the namespace a bit, in case of the mixed_backrefs it's a bit confusing with the mixed block groups but I think I've mentioned that already.

If you're just to avoid the namespace conflicts/confusion, then just rename them with some prefix like "__always_on_" or something similar.

Thanks,
Qu

#11 lore raw

PATCH 2/2 btrfs: remove BIG_METADATA syfs file

In reply to Nikolay Borisov

This flag has been merged in 3.10 and is effectively always-on. As such it can be considered an indispensable feature of the filesystem. Simply remove it from sysfs.

---
 fs/btrfs/sysfs.c | 2 --
 1 file changed, 2 deletions(-)
fs/btrfs/sysfs.c +0 -2
index 715d1e725f2a..e13792214325 100644
@@ -280,7 +280,6 @@ BTRFS_FEAT_ATTR_INCOMPAT(default_subvol, DEFAULT_SUBVOL);
 BTRFS_FEAT_ATTR_INCOMPAT(mixed_groups, MIXED_GROUPS);
 BTRFS_FEAT_ATTR_INCOMPAT(compress_lzo, COMPRESS_LZO);
 BTRFS_FEAT_ATTR_INCOMPAT(compress_zstd, COMPRESS_ZSTD);
-BTRFS_FEAT_ATTR_INCOMPAT(big_metadata, BIG_METADATA);
 BTRFS_FEAT_ATTR_INCOMPAT(extended_iref, EXTENDED_IREF);
 BTRFS_FEAT_ATTR_INCOMPAT(raid56, RAID56);
 BTRFS_FEAT_ATTR_INCOMPAT(skinny_metadata, SKINNY_METADATA);
@@ -311,7 +310,6 @@ static struct attribute *btrfs_supported_feature_attrs[] = {
 	BTRFS_FEAT_ATTR_PTR(mixed_groups),
 	BTRFS_FEAT_ATTR_PTR(compress_lzo),
 	BTRFS_FEAT_ATTR_PTR(compress_zstd),
-	BTRFS_FEAT_ATTR_PTR(big_metadata),
 	BTRFS_FEAT_ATTR_PTR(extended_iref),
 	BTRFS_FEAT_ATTR_PTR(raid56),
 	BTRFS_FEAT_ATTR_PTR(skinny_metadata),
Signature · 1 line
2.25.1