From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 1B96C1FF13F for ; Thu, 07 May 2026 10:01:09 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id F0F88DC4D; Thu, 7 May 2026 10:01:08 +0200 (CEST) Date: Thu, 07 May 2026 10:00:31 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= Subject: Re: [PATCH proxmox-backup v2 1/2] zfs: status: add `VDevStats` struct instead of 3 optional u64s To: Nicolas Frey , pbs-devel@lists.proxmox.com References: <20260505141606.438908-1-n.frey@proxmox.com> <20260505141606.438908-2-n.frey@proxmox.com> In-Reply-To: <20260505141606.438908-2-n.frey@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.17.0 (https://github.com/astroidmail/astroid) Message-Id: <1778140433.30e1wc8usw.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1778140726659 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.054 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: C6JGPH7MF622X7MSWK5HEX3BMKG4HEMR X-Message-ID-Hash: C6JGPH7MF622X7MSWK5HEX3BMKG4HEMR X-MailFrom: f.gruenbichler@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Thomas Lamprecht X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On May 5, 2026 4:16 pm, Nicolas Frey wrote: > in order to reduce a bit of boilerplate. Keeps (de)serialization the > same by flattening `stats`. No functional change intended >=20 > Suggested-by: Fabian Gr=C3=BCnbichler > Signed-off-by: Nicolas Frey > --- > New in v2 > src/tools/disks/zpool_status.rs | 30 +++++++++++++----------------- > 1 file changed, 13 insertions(+), 17 deletions(-) >=20 > diff --git a/src/tools/disks/zpool_status.rs b/src/tools/disks/zpool_stat= us.rs > index 05ef5d80..9427f6d4 100644 > --- a/src/tools/disks/zpool_status.rs > +++ b/src/tools/disks/zpool_status.rs > @@ -24,15 +24,19 @@ pub struct ZFSPoolVDevState { > #[serde(skip_serializing_if =3D "Option::is_none")] > pub state: Option, > #[serde(skip_serializing_if =3D "Option::is_none")] > - pub read: Option, > - #[serde(skip_serializing_if =3D "Option::is_none")] > - pub write: Option, > - #[serde(skip_serializing_if =3D "Option::is_none")] > - pub cksum: Option, > + #[serde(flatten)] > + pub stats: Option, > #[serde(skip_serializing_if =3D "Option::is_none")] > pub msg: Option, > } this is also duplicated/already moved to proxmox-disks, and changing it there would be a breaking change since the struct is not only consumed via deserialization, but crosses package/crate boundaries.. so if we do it, we should also do it there - if we want to avoid that churn, we need to keep the actual members separate. >=20 > +#[derive(Debug, Serialize, Deserialize)] > +pub struct VDevStats { > + read: u64, > + write: u64, > + cksum: u64, > +} > + > fn expand_tab_length(input: &str) -> usize { > input.chars().map(|c| if c =3D=3D '\t' { 8 } else { 1 }).sum() > } > @@ -57,9 +61,7 @@ fn parse_zpool_status_vdev(i: &str) -> IResult<&str, ZF= SPoolVDevState> { > name: vdev_name.to_string(), > lvl: indent_level, > state: None, > - read: None, > - write: None, > - cksum: None, > + stats: None, > msg: None, > }; > return Ok((n, vdev)); > @@ -72,9 +74,7 @@ fn parse_zpool_status_vdev(i: &str) -> IResult<&str, ZF= SPoolVDevState> { > name: vdev_name.to_string(), > lvl: indent_level, > state: Some(state.to_string()), > - read: None, > - write: None, > - cksum: None, > + stats: None, > msg: None, > }; > return Ok((n, vdev)); > @@ -90,9 +90,7 @@ fn parse_zpool_status_vdev(i: &str) -> IResult<&str, ZF= SPoolVDevState> { > name: vdev_name.to_string(), > lvl: indent_level, > state: Some(state.to_string()), > - read: Some(read), > - write: Some(write), > - cksum: Some(cksum), > + stats: Some(VDevStats { read, write, cksum }), > msg: msg.map(String::from), > }; >=20 > @@ -283,9 +281,7 @@ fn test_vdev_list_to_tree() { > name: String::new(), > lvl: 0, > state: None, > - read: None, > - write: None, > - cksum: None, > + stats: None, > msg: None, > }; >=20 > -- > 2.47.3 >=20 >=20 >=20 >=20