public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: remove BTRFS_REF_LAST from btrfs_ref_type
@ 2025-04-15  8:38 Yangtao Li
  2025-04-15  8:43 ` Qu Wenruo
  0 siblings, 1 reply; 8+ messages in thread
From: Yangtao Li @ 2025-04-15  8:38 UTC (permalink / raw)
  To: clm, josef, dsterba; +Cc: linux-btrfs, linux-kernel, Yangtao Li

It seems that it has never been used, so 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


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] btrfs: remove BTRFS_REF_LAST from btrfs_ref_type
  2025-04-15  8:38 [PATCH] btrfs: remove BTRFS_REF_LAST from btrfs_ref_type Yangtao Li
@ 2025-04-15  8:43 ` Qu Wenruo
  2025-04-15  8:56   ` 回复: " 李扬韬
  0 siblings, 1 reply; 8+ messages in thread
From: Qu Wenruo @ 2025-04-15  8:43 UTC (permalink / raw)
  To: Yangtao Li, clm, josef, dsterba; +Cc: linux-btrfs, linux-kernel



在 2025/4/15 18:08, Yangtao Li 写道:
> It seems that it has never been used, so remove it.

History please.

> 
> 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,

The _LAST or _NR suffix can be utilized to do sanity checks, and this is 
not part of the on-disk format.

And if this exposed by some automatic tools, please also mention it.

>   } __packed;
>   
>   struct btrfs_ref {


^ permalink raw reply	[flat|nested] 8+ messages in thread

* 回复: [PATCH] btrfs: remove BTRFS_REF_LAST from btrfs_ref_type
  2025-04-15  8:43 ` Qu Wenruo
@ 2025-04-15  8:56   ` 李扬韬
  2025-04-15  9:16     ` Qu Wenruo
  0 siblings, 1 reply; 8+ messages in thread
From: 李扬韬 @ 2025-04-15  8:56 UTC (permalink / raw)
  To: Qu Wenruo, clm@fb.com, josef@toxicpanda.com, dsterba@suse.com
  Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org

> 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.

> The _LAST or _NR suffix can be utilized to do sanity checks, and this is not part of the on-disk format.

IIRC, delayed ref belongs to the extent tree memory kv cache.

> And if this exposed by some automatic tools, please also mention it.

I'm just looking at this code.

Thx,
Yangtao

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] btrfs: remove BTRFS_REF_LAST from btrfs_ref_type
  2025-04-15  8:56   ` 回复: " 李扬韬
@ 2025-04-15  9:16     ` Qu Wenruo
  2025-04-15 15:46       ` Sun YangKai
  2025-04-15 16:05       ` David Sterba
  0 siblings, 2 replies; 8+ messages in thread
From: Qu Wenruo @ 2025-04-15  9:16 UTC (permalink / raw)
  To: 李扬韬, clm@fb.com, josef@toxicpanda.com,
	dsterba@suse.com
  Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org



在 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.

>
>> The _LAST or _NR suffix can be utilized to do sanity checks, and this is not part of the on-disk format.
>
> IIRC, delayed ref belongs to the extent tree memory kv cache.
>
>> And if this exposed by some automatic tools, please also mention it.
>
> I'm just looking at this code.
>
> Thx,
> Yangtao


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] btrfs: remove BTRFS_REF_LAST from btrfs_ref_type
  2025-04-15  9:16     ` Qu Wenruo
@ 2025-04-15 15:46       ` Sun YangKai
  2025-04-15 16:05       ` David Sterba
  1 sibling, 0 replies; 8+ messages in thread
From: Sun YangKai @ 2025-04-15 15:46 UTC (permalink / raw)
  To: quwenruo.btrfs
  Cc: clm, dsterba, frank.li, josef, linux-btrfs, linux-kernel,
	sunk67188

> >> 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.
We can also add comments for all this kind of codes,
so that further readers will understand this common practice better.
> 
> >> The _LAST or _NR suffix can be utilized to do sanity checks, and this is
> >> not part of the on-disk format.> > 
> > IIRC, delayed ref belongs to the extent tree memory kv cache.
> > 
> >> And if this exposed by some automatic tools, please also mention it.
> > 
> > I'm just looking at this code.
> > 
> > Thx,
> > Yangtao



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] btrfs: remove BTRFS_REF_LAST from btrfs_ref_type
  2025-04-15  9:16     ` Qu Wenruo
  2025-04-15 15:46       ` Sun YangKai
@ 2025-04-15 16:05       ` David Sterba
  2025-04-16 13:25         ` 回复: " 李扬韬
  1 sibling, 1 reply; 8+ messages in thread
From: David Sterba @ 2025-04-15 16:05 UTC (permalink / raw)
  To: Qu Wenruo
  Cc: 李扬韬, clm@fb.com, josef@toxicpanda.com,
	dsterba@suse.com, linux-btrfs@vger.kernel.org,
	linux-kernel@vger.kernel.org

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* 回复: [PATCH] btrfs: remove BTRFS_REF_LAST from btrfs_ref_type
  2025-04-15 16:05       ` David Sterba
@ 2025-04-16 13:25         ` 李扬韬
  2025-04-16 19:18           ` David Sterba
  0 siblings, 1 reply; 8+ messages in thread
From: 李扬韬 @ 2025-04-16 13:25 UTC (permalink / raw)
  To: dsterba@suse.cz, Qu Wenruo
  Cc: clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org

> 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.

Do I need to modify the submission information and resend this patch?

Thx,
Yangtao

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: 回复: [PATCH] btrfs: remove BTRFS_REF_LAST from btrfs_ref_type
  2025-04-16 13:25         ` 回复: " 李扬韬
@ 2025-04-16 19:18           ` David Sterba
  0 siblings, 0 replies; 8+ messages in thread
From: David Sterba @ 2025-04-16 19:18 UTC (permalink / raw)
  To: 李扬韬
  Cc: Qu Wenruo, clm@fb.com, josef@toxicpanda.com, dsterba@suse.com,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org

On Wed, Apr 16, 2025 at 01:25:34PM +0000, 李扬韬 wrote:
> > 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.
> 
> Do I need to modify the submission information and resend this patch?

Yes please, the reasoning was missing from the original patch, we've
come to a conclusion in the discussion so this should be summarized in
v2.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-04-16 19:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-15  8:38 [PATCH] btrfs: remove BTRFS_REF_LAST from btrfs_ref_type Yangtao Li
2025-04-15  8:43 ` Qu Wenruo
2025-04-15  8:56   ` 回复: " 李扬韬
2025-04-15  9:16     ` Qu Wenruo
2025-04-15 15:46       ` Sun YangKai
2025-04-15 16:05       ` David Sterba
2025-04-16 13:25         ` 回复: " 李扬韬
2025-04-16 19:18           ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox