Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BTRFS] Support for sqgroups / simple qgroups #354

Open
modzilla99 opened this issue Oct 12, 2024 · 0 comments
Open

[BTRFS] Support for sqgroups / simple qgroups #354

modzilla99 opened this issue Oct 12, 2024 · 0 comments

Comments

@modzilla99
Copy link

Is your feature request related to a problem? Please describe.
When using normal qgroups, the full filesystem freezes from time to time, resulting in a complete halt of any input. Nothing works for a couple of seconds (up to a minute). On an NVMe this imho is unacceptable. For this reason simple qgroups (sqgroups) exists now. btrfs quota enable -s $Path

Describe the solution you'd like
When deleting subvolumes the qgroups will be cleaned up asynchronously and take a couple of seconds to become stale.

0/3189        16.00KiB     16.00KiB   timeshift-btrfs/snapshots/2024-10-12_21-56-06/@home

0/3189        16.00KiB     16.00KiB   <under deletion>

0/3198       112.00KiB    112.00KiB   <squota space holder>

0/3198           0.00B        0.00B   <stale>

In that time frame it is impossible to delete that qgroup. Unfortuately timeshift will try to do just that and delete it while it's still under deletion and thus fail. When you wait a bit and make sure the entry is stale, the deletion will work fine.

Describe alternatives you've considered
Disabling qgroups would be an alternative, but since I use my machine with subvolumes that need to have quotas enabled to constraint it's maximum size, it is not a real alternative.

Additional context
I have no idea about vala, but before executing the qgroup destroy here

cmd = "btrfs qgroup destroy 0/%ld '%s'".printf(id, repo.mount_paths[name]);
a check should be done to ensure the qgroup is stale.

This can be done with the json output of the btrfs cli. Before deletion the referenced and exclusive count is high and the path populated. It becomes stale when they are either 0 or empty.

# before deletion
$ btrfs --format json  qgr show / | jq '."qgroup-show".[-1]'
{
  "qgroupid": "0/3199",
  "referenced": 278528,
  "max_referenced": "none",
  "exclusive": 278528,
  "max_exclusive": "none",
  "path": "timeshift-btrfs/snapshots/2024-10-12_22-14-16/@home",
  "parents": [],
  "children": []
}

# under deletion
$ btrfs --format json  qgr show / | jq '."qgroup-show".[-1]'
{
  "qgroupid": "0/3199",
  "referenced": 278528,
  "max_referenced": "none",
  "exclusive": 278528,
  "max_exclusive": "none",
  "path": "",
  "parents": [],
  "children": []
}

# after deletion
$ btrfs --format json  qgr show / | jq '."qgroup-show".[-1]'
{
  "qgroupid": "0/3199",
  "referenced": 0,
  "max_referenced": "none",
  "exclusive": 0,
  "max_exclusive": "none",
  "path": "",
  "parents": [],
  "children": []
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant