diff mbox series

[RFC,09/17] progs: pass in a btrfs_mkfs_config to write_temp_extent_buffer

Message ID 042f116c565320bc134a6bca5b5d91b0754a19a8.1564046972.git.jthumshirn@suse.de (mailing list archive)
State New, archived
Headers show
Series Support xxhash64 checksums | expand

Commit Message

Johannes Thumshirn July 25, 2019, 9:33 a.m. UTC
Pass in a btrfs_mkfs_config to write_temp_extent_buffer(), this is needed
so we can grab the checksum type for checksum buffer verification in later
patches.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
---
 convert/common.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

Comments

David Sterba July 30, 2019, 5:38 p.m. UTC | #1
On Thu, Jul 25, 2019 at 11:33:56AM +0200, Johannes Thumshirn wrote:
> Pass in a btrfs_mkfs_config to write_temp_extent_buffer(), this is needed
> so we can grab the checksum type for checksum buffer verification in later
> patches.
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>

Added to devel.
Nikolay Borisov Aug. 12, 2019, 9:56 a.m. UTC | #2
On 25.07.19 г. 12:33 ч., Johannes Thumshirn wrote:
> Pass in a btrfs_mkfs_config to write_temp_extent_buffer(), this is needed
> so we can grab the checksum type for checksum buffer verification in later
> patches.
> 
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>

Reviewed-by: Nikolay Borisov <nborisov@suse.com>

> ---
>  convert/common.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/convert/common.c b/convert/common.c
> index af4f8d372299..dea5f5b20d50 100644
> --- a/convert/common.c
> +++ b/convert/common.c
> @@ -218,7 +218,8 @@ static void insert_temp_root_item(struct extent_buffer *buf,
>   * Setup an extent buffer for tree block.
>   */
>  static inline int write_temp_extent_buffer(int fd, struct extent_buffer *buf,
> -					   u64 bytenr)
> +					   u64 bytenr,
> +					   struct btrfs_mkfs_config *cfg)
>  {
>  	int ret;
>  
> @@ -281,7 +282,7 @@ static int setup_temp_root_tree(int fd, struct btrfs_mkfs_config *cfg,
>  	insert_temp_root_item(buf, cfg, &slot, &itemoff,
>  			      BTRFS_CSUM_TREE_OBJECTID, csum_bytenr);
>  
> -	ret = write_temp_extent_buffer(fd, buf, root_bytenr);
> +	ret = write_temp_extent_buffer(fd, buf, root_bytenr, cfg);
>  out:
>  	free(buf);
>  	return ret;
> @@ -456,7 +457,7 @@ static int setup_temp_chunk_tree(int fd, struct btrfs_mkfs_config *cfg,
>  				     BTRFS_BLOCK_GROUP_METADATA);
>  	if (ret < 0)
>  		goto out;
> -	ret = write_temp_extent_buffer(fd, buf, chunk_bytenr);
> +	ret = write_temp_extent_buffer(fd, buf, chunk_bytenr, cfg);
>  
>  out:
>  	free(buf);
> @@ -515,7 +516,7 @@ static int setup_temp_dev_tree(int fd, struct btrfs_mkfs_config *cfg,
>  			       BTRFS_MKFS_SYSTEM_GROUP_SIZE);
>  	insert_temp_dev_extent(buf, &slot, &itemoff, meta_chunk_start,
>  			       BTRFS_CONVERT_META_GROUP_SIZE);
> -	ret = write_temp_extent_buffer(fd, buf, dev_bytenr);
> +	ret = write_temp_extent_buffer(fd, buf, dev_bytenr, cfg);
>  out:
>  	free(buf);
>  	return ret;
> @@ -537,7 +538,7 @@ static int setup_temp_fs_tree(int fd, struct btrfs_mkfs_config *cfg,
>  	/*
>  	 * Temporary fs tree is completely empty.
>  	 */
> -	ret = write_temp_extent_buffer(fd, buf, fs_bytenr);
> +	ret = write_temp_extent_buffer(fd, buf, fs_bytenr, cfg);
>  out:
>  	free(buf);
>  	return ret;
> @@ -559,7 +560,7 @@ static int setup_temp_csum_tree(int fd, struct btrfs_mkfs_config *cfg,
>  	/*
>  	 * Temporary csum tree is completely empty.
>  	 */
> -	ret = write_temp_extent_buffer(fd, buf, csum_bytenr);
> +	ret = write_temp_extent_buffer(fd, buf, csum_bytenr, cfg);
>  out:
>  	free(buf);
>  	return ret;
> @@ -765,7 +766,7 @@ static int setup_temp_extent_tree(int fd, struct btrfs_mkfs_config *cfg,
>  	if (ret < 0)
>  		goto out;
>  
> -	ret = write_temp_extent_buffer(fd, buf, extent_bytenr);
> +	ret = write_temp_extent_buffer(fd, buf, extent_bytenr, cfg);
>  out:
>  	free(buf);
>  	return ret;
>
diff mbox series

Patch

diff --git a/convert/common.c b/convert/common.c
index af4f8d372299..dea5f5b20d50 100644
--- a/convert/common.c
+++ b/convert/common.c
@@ -218,7 +218,8 @@  static void insert_temp_root_item(struct extent_buffer *buf,
  * Setup an extent buffer for tree block.
  */
 static inline int write_temp_extent_buffer(int fd, struct extent_buffer *buf,
-					   u64 bytenr)
+					   u64 bytenr,
+					   struct btrfs_mkfs_config *cfg)
 {
 	int ret;
 
@@ -281,7 +282,7 @@  static int setup_temp_root_tree(int fd, struct btrfs_mkfs_config *cfg,
 	insert_temp_root_item(buf, cfg, &slot, &itemoff,
 			      BTRFS_CSUM_TREE_OBJECTID, csum_bytenr);
 
-	ret = write_temp_extent_buffer(fd, buf, root_bytenr);
+	ret = write_temp_extent_buffer(fd, buf, root_bytenr, cfg);
 out:
 	free(buf);
 	return ret;
@@ -456,7 +457,7 @@  static int setup_temp_chunk_tree(int fd, struct btrfs_mkfs_config *cfg,
 				     BTRFS_BLOCK_GROUP_METADATA);
 	if (ret < 0)
 		goto out;
-	ret = write_temp_extent_buffer(fd, buf, chunk_bytenr);
+	ret = write_temp_extent_buffer(fd, buf, chunk_bytenr, cfg);
 
 out:
 	free(buf);
@@ -515,7 +516,7 @@  static int setup_temp_dev_tree(int fd, struct btrfs_mkfs_config *cfg,
 			       BTRFS_MKFS_SYSTEM_GROUP_SIZE);
 	insert_temp_dev_extent(buf, &slot, &itemoff, meta_chunk_start,
 			       BTRFS_CONVERT_META_GROUP_SIZE);
-	ret = write_temp_extent_buffer(fd, buf, dev_bytenr);
+	ret = write_temp_extent_buffer(fd, buf, dev_bytenr, cfg);
 out:
 	free(buf);
 	return ret;
@@ -537,7 +538,7 @@  static int setup_temp_fs_tree(int fd, struct btrfs_mkfs_config *cfg,
 	/*
 	 * Temporary fs tree is completely empty.
 	 */
-	ret = write_temp_extent_buffer(fd, buf, fs_bytenr);
+	ret = write_temp_extent_buffer(fd, buf, fs_bytenr, cfg);
 out:
 	free(buf);
 	return ret;
@@ -559,7 +560,7 @@  static int setup_temp_csum_tree(int fd, struct btrfs_mkfs_config *cfg,
 	/*
 	 * Temporary csum tree is completely empty.
 	 */
-	ret = write_temp_extent_buffer(fd, buf, csum_bytenr);
+	ret = write_temp_extent_buffer(fd, buf, csum_bytenr, cfg);
 out:
 	free(buf);
 	return ret;
@@ -765,7 +766,7 @@  static int setup_temp_extent_tree(int fd, struct btrfs_mkfs_config *cfg,
 	if (ret < 0)
 		goto out;
 
-	ret = write_temp_extent_buffer(fd, buf, extent_bytenr);
+	ret = write_temp_extent_buffer(fd, buf, extent_bytenr, cfg);
 out:
 	free(buf);
 	return ret;