diff mbox series

[03/10] btrfs: add a comment for new_bytenr in bacref_cache_node

Message ID 822af146718551c3f2ba248ba9df9092ba022160.1727970063.git.josef@toxicpanda.com (mailing list archive)
State New, archived
Headers show
Series btrfs: backref cache cleanups | expand

Commit Message

Josef Bacik Oct. 3, 2024, 3:43 p.m. UTC
Add a comment for this field so we know what it is used for.  Previously
we used it to update the backref cache, so people may mistakenly think
it is useless, but in fact exists to make sure the backref cache makes
sense.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
---
 fs/btrfs/backref.h | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Boris Burkov Oct. 3, 2024, 9:34 p.m. UTC | #1
On Thu, Oct 03, 2024 at 11:43:05AM -0400, Josef Bacik wrote:

s/bacref/backref/
in the commit title

> Add a comment for this field so we know what it is used for.  Previously
> we used it to update the backref cache, so people may mistakenly think
> it is useless, but in fact exists to make sure the backref cache makes
> sense.
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
>  fs/btrfs/backref.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/btrfs/backref.h b/fs/btrfs/backref.h
> index a810253d7b8a..754c71bdc9ce 100644
> --- a/fs/btrfs/backref.h
> +++ b/fs/btrfs/backref.h
> @@ -318,6 +318,12 @@ struct btrfs_backref_node {
>  		u64 bytenr;
>  	}; /* Use rb_simple_node for search/insert */
>  
> +	/*
> +	 * This is a sanity check, whenever we cow a block we will update
> +	 * new_bytenr with it's current location, and we will check this in
> +	 * various places to validate that the cache makes sense, it shouldn't
> +	 * be used for anything else.
> +	 */
>  	u64 new_bytenr;
>  	/* Objectid of tree block owner, can be not uptodate */
>  	u64 owner;
> -- 
> 2.43.0
>
diff mbox series

Patch

diff --git a/fs/btrfs/backref.h b/fs/btrfs/backref.h
index a810253d7b8a..754c71bdc9ce 100644
--- a/fs/btrfs/backref.h
+++ b/fs/btrfs/backref.h
@@ -318,6 +318,12 @@  struct btrfs_backref_node {
 		u64 bytenr;
 	}; /* Use rb_simple_node for search/insert */
 
+	/*
+	 * This is a sanity check, whenever we cow a block we will update
+	 * new_bytenr with it's current location, and we will check this in
+	 * various places to validate that the cache makes sense, it shouldn't
+	 * be used for anything else.
+	 */
 	u64 new_bytenr;
 	/* Objectid of tree block owner, can be not uptodate */
 	u64 owner;