Re: [PATCH] btrfs: remove BTRFS_REF_LAST from btrfs_ref_type
From: David Sterba
Date: Tue Apr 15 2025 - 12:05:24 EST
On Tue, Apr 15, 2025 at 06:46:48PM +0930, Qu Wenruo wrote:
>
>
> 在 2025/4/15 18:26, 李扬韬 写道:
> >> History please.
> >
> > Did you mean change commit msg to below?
> >
> > Commit b28b1f0ce44c ("btrfs: delayed-ref: Introduce better documented delayed ref structures") introduce BTRFS_REF_LAST but never use it,
> > So let's remove it.
>
> It's the common practice to leave a last entry for sanity checks.
>
> But since it's not utilized for anything, I'm fine to remove it.
I think in this case it's ok to remove it, although I agree that we have
the _LAST or _NR elsewhere. In btrfs_ref_type() tere's an assertion
ASSERT(ref->type == BTRFS_REF_DATA || ref->type == BTRFS_REF_METADATA);
which is validating the values. There's no enumeration or switch that
could utilize the upper bound.