hive-c0re: address review on btrfs qgroup usage parsing
Select the level-0 (`0/<subvolid>`) leaf qgroup row explicitly instead of taking the last data line, so usage parsing is unambiguous even if an operator has assigned the subvolume to a higher-level aggregate qgroup. `btrfs qgroup show -f <path>` already scopes the listing to qgroups impacting the given path (excluding ancestral qgroups, per btrfs-qgroup-show(8)); selecting the `0/` leaf among them pins it to the subvolume's own automatic usage qgroup. Also: case-insensitive match on the stable "quota not enabled" error fragment (wording varies across btrfs-progs versions), `# Errors` doc sections on the three public priv_client quota functions, and precise doc comments on the `-f` flag semantics.
This commit is contained in:
parent
9ff55399e5
commit
681e993626
3 changed files with 36 additions and 11 deletions
|
|
@ -715,7 +715,11 @@ async fn quota_show(name: Option<&str>) -> Result<()> {
|
|||
}
|
||||
Err(e) => {
|
||||
let msg = format!("{e:#}");
|
||||
if msg.contains("not enabled") {
|
||||
// btrfs-progs prints "ERROR: ... quota not enabled" to stderr
|
||||
// when qgroups are off; match the stable fragment case-
|
||||
// insensitively rather than an exact line (the surrounding
|
||||
// wording varies across btrfs-progs versions).
|
||||
if msg.to_ascii_lowercase().contains("quota not enabled") {
|
||||
bail!("btrfs quota not enabled — run `hivectl quota enable` first");
|
||||
}
|
||||
// A plain-dir agent (no subvolume) has no qgroup; report it
|
||||
|
|
|
|||
Loading…
Reference in a new issue