diff mbox series

[2/4] btrfs: tests: move testing members of struct btrfs_root to the end

Message ID f8b15d6ea41fc91c7e8608352cd242722c4c1b3b.1536599879.git.dsterba@suse.com (mailing list archive)
State New, archived
Headers show
Series Self-test cleanups | expand

Commit Message

David Sterba Sept. 10, 2018, 5:22 p.m. UTC
The data used only for tests are better placed at the end of the
structure so that they don't change the structure layout. All new
members of btrfs_root should be placed before.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/btrfs/ctree.h | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Omar Sandoval Sept. 10, 2018, 11:37 p.m. UTC | #1
On Mon, Sep 10, 2018 at 07:22:26PM +0200, David Sterba wrote:
> The data used only for tests are better placed at the end of the
> structure so that they don't change the structure layout. All new
> members of btrfs_root should be placed before.

Reviewed-by: Omar Sandoval <osandov@fb.com>

> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>  fs/btrfs/ctree.h | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
> index 45b7029d0f23..ee05857cc8ac 100644
> --- a/fs/btrfs/ctree.h
> +++ b/fs/btrfs/ctree.h
> @@ -1203,11 +1203,6 @@ struct btrfs_root {
>  
>  	u64 highest_objectid;
>  
> -#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
> -	/* only used with CONFIG_BTRFS_FS_RUN_SANITY_TESTS is enabled */
> -	u64 alloc_bytenr;
> -#endif
> -
>  	u64 defrag_trans_start;
>  	struct btrfs_key defrag_progress;
>  	struct btrfs_key defrag_max;
> @@ -1280,6 +1275,10 @@ struct btrfs_root {
>  	spinlock_t qgroup_meta_rsv_lock;
>  	u64 qgroup_meta_rsv_pertrans;
>  	u64 qgroup_meta_rsv_prealloc;
> +
> +#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
> +	u64 alloc_bytenr;
> +#endif
>  };
>  
>  struct btrfs_file_private {
> -- 
> 2.18.0
>
diff mbox series

Patch

diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 45b7029d0f23..ee05857cc8ac 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1203,11 +1203,6 @@  struct btrfs_root {
 
 	u64 highest_objectid;
 
-#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
-	/* only used with CONFIG_BTRFS_FS_RUN_SANITY_TESTS is enabled */
-	u64 alloc_bytenr;
-#endif
-
 	u64 defrag_trans_start;
 	struct btrfs_key defrag_progress;
 	struct btrfs_key defrag_max;
@@ -1280,6 +1275,10 @@  struct btrfs_root {
 	spinlock_t qgroup_meta_rsv_lock;
 	u64 qgroup_meta_rsv_pertrans;
 	u64 qgroup_meta_rsv_prealloc;
+
+#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
+	u64 alloc_bytenr;
+#endif
 };
 
 struct btrfs_file_private {