[PATCH v2] btrfs: remove BTRFS_REF_LAST from btrfs_ref_type

Yangtao Li posted 1 patch 8 months ago
fs/btrfs/delayed-ref.h | 1 -
1 file changed, 1 deletion(-)
[PATCH v2] btrfs: remove BTRFS_REF_LAST from btrfs_ref_type
Posted by Yangtao Li 8 months ago
Commit b28b1f0ce44c ("btrfs: delayed-ref: Introduce better documented
delayed ref structures") introduced BTRFS_REF_LAST, which can be used
for sanity checking.

In btrfs_ref_type() there was an assertion

ASSERT(ref->type == BTRFS_REF_DATA || ref->type == BTRFS_REF_METADATA);

to validate the value. 

And there is currently no enum or switch to use the upper limit,
so let's remove it.

Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/btrfs/delayed-ref.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/btrfs/delayed-ref.h b/fs/btrfs/delayed-ref.h
index f5ae880308d3..78cc23837610 100644
--- a/fs/btrfs/delayed-ref.h
+++ b/fs/btrfs/delayed-ref.h
@@ -262,7 +262,6 @@ enum btrfs_ref_type {
 	BTRFS_REF_NOT_SET,
 	BTRFS_REF_DATA,
 	BTRFS_REF_METADATA,
-	BTRFS_REF_LAST,
 } __packed;
 
 struct btrfs_ref {
-- 
2.39.0
Re: [PATCH v2] btrfs: remove BTRFS_REF_LAST from btrfs_ref_type
Posted by David Sterba 7 months, 3 weeks ago
On Thu, Apr 17, 2025 at 08:26:49AM -0600, Yangtao Li wrote:
> Commit b28b1f0ce44c ("btrfs: delayed-ref: Introduce better documented
> delayed ref structures") introduced BTRFS_REF_LAST, which can be used
> for sanity checking.
> 
> In btrfs_ref_type() there was an assertion
> 
> ASSERT(ref->type == BTRFS_REF_DATA || ref->type == BTRFS_REF_METADATA);
> 
> to validate the value. 
> 
> And there is currently no enum or switch to use the upper limit,
> so let's remove it.
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>

Added to for-next, thanks.