linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Btrfs: check_int: use the known block location
@ 2014-10-16 15:48 Stefan Behrens
  2014-10-16 15:48 ` [PATCH 2/2] Btrfs: check-int: don't complain about balanced blocks Stefan Behrens
  2014-10-17  7:15 ` [PATCH 1/2] Btrfs: check_int: use the known block location Wang Shilong
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Behrens @ 2014-10-16 15:48 UTC (permalink / raw)
  To: linux-btrfs

The xfstest btrfs/014 which tests the balance operation caused issues with
the check_int module. The attempt was made to use btrfs_map_block() to
find the physical location for a written block. However, this was not
at all needed since the location of the written block was known since
a hook to submit_bio() was the reason for entering the check_int module.
Additionally, after a block relocation it happened that btrfs_map_block()
failed causing misleading error messages afterwards.

This patch changes the check_int module to use the known information of
the physical location from the bio.

Reported-by: Wang Shilong <wangshilong1991@gmail.com>
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
---
 fs/btrfs/check-integrity.c | 66 ++++++++--------------------------------------
 1 file changed, 11 insertions(+), 55 deletions(-)

diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index ce92ae30250f..65fc2e0bbc4a 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -326,9 +326,6 @@ static int btrfsic_handle_extent_data(struct btrfsic_state *state,
 static int btrfsic_map_block(struct btrfsic_state *state, u64 bytenr, u32 len,
 			     struct btrfsic_block_data_ctx *block_ctx_out,
 			     int mirror_num);
-static int btrfsic_map_superblock(struct btrfsic_state *state, u64 bytenr,
-				  u32 len, struct block_device *bdev,
-				  struct btrfsic_block_data_ctx *block_ctx_out);
 static void btrfsic_release_block_ctx(struct btrfsic_block_data_ctx *block_ctx);
 static int btrfsic_read_block(struct btrfsic_state *state,
 			      struct btrfsic_block_data_ctx *block_ctx);
@@ -1609,25 +1606,6 @@ static int btrfsic_map_block(struct btrfsic_state *state, u64 bytenr, u32 len,
 	return ret;
 }
 
-static int btrfsic_map_superblock(struct btrfsic_state *state, u64 bytenr,
-				  u32 len, struct block_device *bdev,
-				  struct btrfsic_block_data_ctx *block_ctx_out)
-{
-	block_ctx_out->dev = btrfsic_dev_state_lookup(bdev);
-	block_ctx_out->dev_bytenr = bytenr;
-	block_ctx_out->start = bytenr;
-	block_ctx_out->len = len;
-	block_ctx_out->datav = NULL;
-	block_ctx_out->pagev = NULL;
-	block_ctx_out->mem_to_free = NULL;
-	if (NULL != block_ctx_out->dev) {
-		return 0;
-	} else {
-		printk(KERN_INFO "btrfsic: error, cannot lookup dev (#2)!\n");
-		return -ENXIO;
-	}
-}
-
 static void btrfsic_release_block_ctx(struct btrfsic_block_data_ctx *block_ctx)
 {
 	if (block_ctx->mem_to_free) {
@@ -2004,24 +1982,13 @@ again:
 			}
 		}
 
-		if (block->is_superblock)
-			ret = btrfsic_map_superblock(state, bytenr,
-						     processed_len,
-						     bdev, &block_ctx);
-		else
-			ret = btrfsic_map_block(state, bytenr, processed_len,
-						&block_ctx, 0);
-		if (ret) {
-			printk(KERN_INFO
-			       "btrfsic: btrfsic_map_block(root @%llu)"
-			       " failed!\n", bytenr);
-			goto continue_loop;
-		}
-		block_ctx.datav = mapped_datav;
-		/* the following is required in case of writes to mirrors,
-		 * use the same that was used for the lookup */
 		block_ctx.dev = dev_state;
 		block_ctx.dev_bytenr = dev_bytenr;
+		block_ctx.start = bytenr;
+		block_ctx.len = processed_len;
+		block_ctx.pagev = NULL;
+		block_ctx.mem_to_free = NULL;
+		block_ctx.datav = mapped_datav;
 
 		if (is_metadata || state->include_extent_data) {
 			block->never_written = 0;
@@ -2135,10 +2102,6 @@ again:
 			/* this is getting ugly for the
 			 * include_extent_data case... */
 			bytenr = 0;	/* unknown */
-			block_ctx.start = bytenr;
-			block_ctx.len = processed_len;
-			block_ctx.mem_to_free = NULL;
-			block_ctx.pagev = NULL;
 		} else {
 			processed_len = state->metablock_size;
 			bytenr = btrfs_stack_header_bytenr(
@@ -2151,22 +2114,15 @@ again:
 				       "Written block @%llu (%s/%llu/?)"
 				       " !found in hash table, M.\n",
 				       bytenr, dev_state->name, dev_bytenr);
-
-			ret = btrfsic_map_block(state, bytenr, processed_len,
-						&block_ctx, 0);
-			if (ret) {
-				printk(KERN_INFO
-				       "btrfsic: btrfsic_map_block(root @%llu)"
-				       " failed!\n",
-				       dev_bytenr);
-				goto continue_loop;
-			}
 		}
-		block_ctx.datav = mapped_datav;
-		/* the following is required in case of writes to mirrors,
-		 * use the same that was used for the lookup */
+
 		block_ctx.dev = dev_state;
 		block_ctx.dev_bytenr = dev_bytenr;
+		block_ctx.start = bytenr;
+		block_ctx.len = processed_len;
+		block_ctx.pagev = NULL;
+		block_ctx.mem_to_free = NULL;
+		block_ctx.datav = mapped_datav;
 
 		block = btrfsic_block_alloc();
 		if (NULL == block) {
-- 
2.1.1


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

* [PATCH 2/2] Btrfs: check-int: don't complain about balanced blocks
  2014-10-16 15:48 [PATCH 1/2] Btrfs: check_int: use the known block location Stefan Behrens
@ 2014-10-16 15:48 ` Stefan Behrens
  2014-10-17  7:16   ` Wang Shilong
  2014-10-17  8:06   ` Miao Xie
  2014-10-17  7:15 ` [PATCH 1/2] Btrfs: check_int: use the known block location Wang Shilong
  1 sibling, 2 replies; 5+ messages in thread
From: Stefan Behrens @ 2014-10-16 15:48 UTC (permalink / raw)
  To: linux-btrfs

The xfstest btrfs/014 which tests the balance operation caused that the
check_int module complained that known blocks changed their physical
location. Since this is not an error in this case, only print such
message if the verbose mode was enabled.

Reported-by: Wang Shilong <wangshilong1991@gmail.com>
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
---
 fs/btrfs/check-integrity.c | 87 ++++++++++++++++++++++++++--------------------
 1 file changed, 49 insertions(+), 38 deletions(-)

diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 65fc2e0bbc4a..65226d7c9fe0 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -1325,24 +1325,28 @@ static int btrfsic_create_link_to_next_block(
 		l = NULL;
 		next_block->generation = BTRFSIC_GENERATION_UNKNOWN;
 	} else {
-		if (next_block->logical_bytenr != next_bytenr &&
-		    !(!next_block->is_metadata &&
-		      0 == next_block->logical_bytenr)) {
-			printk(KERN_INFO
-			       "Referenced block @%llu (%s/%llu/%d)"
-			       " found in hash table, %c,"
-			       " bytenr mismatch (!= stored %llu).\n",
-			       next_bytenr, next_block_ctx->dev->name,
-			       next_block_ctx->dev_bytenr, *mirror_nump,
-			       btrfsic_get_block_type(state, next_block),
-			       next_block->logical_bytenr);
-		} else if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
-			printk(KERN_INFO
-			       "Referenced block @%llu (%s/%llu/%d)"
-			       " found in hash table, %c.\n",
-			       next_bytenr, next_block_ctx->dev->name,
-			       next_block_ctx->dev_bytenr, *mirror_nump,
-			       btrfsic_get_block_type(state, next_block));
+		if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE) {
+			if (next_block->logical_bytenr != next_bytenr &&
+			    !(!next_block->is_metadata &&
+			      0 == next_block->logical_bytenr))
+				printk(KERN_INFO
+				       "Referenced block @%llu (%s/%llu/%d)"
+				       " found in hash table, %c,"
+				       " bytenr mismatch (!= stored %llu).\n",
+				       next_bytenr, next_block_ctx->dev->name,
+				       next_block_ctx->dev_bytenr, *mirror_nump,
+				       btrfsic_get_block_type(state,
+							      next_block),
+				       next_block->logical_bytenr);
+			else
+				printk(KERN_INFO
+				       "Referenced block @%llu (%s/%llu/%d)"
+				       " found in hash table, %c.\n",
+				       next_bytenr, next_block_ctx->dev->name,
+				       next_block_ctx->dev_bytenr, *mirror_nump,
+				       btrfsic_get_block_type(state,
+							      next_block));
+		}
 		next_block->logical_bytenr = next_bytenr;
 
 		next_block->mirror_num = *mirror_nump;
@@ -1528,7 +1532,9 @@ static int btrfsic_handle_extent_data(
 				return -1;
 			}
 			if (!block_was_created) {
-				if (next_block->logical_bytenr != next_bytenr &&
+				if ((state->print_mask &
+				     BTRFSIC_PRINT_MASK_VERBOSE) &&
+				    next_block->logical_bytenr != next_bytenr &&
 				    !(!next_block->is_metadata &&
 				      0 == next_block->logical_bytenr)) {
 					printk(KERN_INFO
@@ -1881,25 +1887,30 @@ again:
 							       dev_state,
 							       dev_bytenr);
 			}
-			if (block->logical_bytenr != bytenr &&
-			    !(!block->is_metadata &&
-			      block->logical_bytenr == 0))
-				printk(KERN_INFO
-				       "Written block @%llu (%s/%llu/%d)"
-				       " found in hash table, %c,"
-				       " bytenr mismatch"
-				       " (!= stored %llu).\n",
-				       bytenr, dev_state->name, dev_bytenr,
-				       block->mirror_num,
-				       btrfsic_get_block_type(state, block),
-				       block->logical_bytenr);
-			else if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
-				printk(KERN_INFO
-				       "Written block @%llu (%s/%llu/%d)"
-				       " found in hash table, %c.\n",
-				       bytenr, dev_state->name, dev_bytenr,
-				       block->mirror_num,
-				       btrfsic_get_block_type(state, block));
+			if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE) {
+				if (block->logical_bytenr != bytenr &&
+				    !(!block->is_metadata &&
+				      block->logical_bytenr == 0))
+					printk(KERN_INFO
+					       "Written block @%llu (%s/%llu/%d)"
+					       " found in hash table, %c,"
+					       " bytenr mismatch"
+					       " (!= stored %llu).\n",
+					       bytenr, dev_state->name,
+					       dev_bytenr,
+					       block->mirror_num,
+					       btrfsic_get_block_type(state,
+								      block),
+					       block->logical_bytenr);
+				else
+					printk(KERN_INFO
+					       "Written block @%llu (%s/%llu/%d)"
+					       " found in hash table, %c.\n",
+					       bytenr, dev_state->name,
+					       dev_bytenr, block->mirror_num,
+					       btrfsic_get_block_type(state,
+								      block));
+			}
 			block->logical_bytenr = bytenr;
 		} else {
 			if (num_pages * PAGE_CACHE_SIZE <
-- 
2.1.1


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

* Re: [PATCH 1/2] Btrfs: check_int: use the known block location
  2014-10-16 15:48 [PATCH 1/2] Btrfs: check_int: use the known block location Stefan Behrens
  2014-10-16 15:48 ` [PATCH 2/2] Btrfs: check-int: don't complain about balanced blocks Stefan Behrens
@ 2014-10-17  7:15 ` Wang Shilong
  1 sibling, 0 replies; 5+ messages in thread
From: Wang Shilong @ 2014-10-17  7:15 UTC (permalink / raw)
  To: Stefan Behrens; +Cc: linux-btrfs


> The xfstest btrfs/014 which tests the balance operation caused issues with
> the check_int module. The attempt was made to use btrfs_map_block() to
> find the physical location for a written block. However, this was not
> at all needed since the location of the written block was known since
> a hook to submit_bio() was the reason for entering the check_int module.
> Additionally, after a block relocation it happened that btrfs_map_block()
> failed causing misleading error messages afterwards.
> 
> This patch changes the check_int module to use the known information of
> the physical location from the bio.
> 
> Reported-by: Wang Shilong <wangshilong1991@gmail.com>
> Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>

This passed my Tests after applying both patches.

Tested-by: Wang Shilong <wangshilong1991@gmail.com>


> ---
> fs/btrfs/check-integrity.c | 66 ++++++++--------------------------------------
> 1 file changed, 11 insertions(+), 55 deletions(-)
> 
> diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
> index ce92ae30250f..65fc2e0bbc4a 100644
> --- a/fs/btrfs/check-integrity.c
> +++ b/fs/btrfs/check-integrity.c
> @@ -326,9 +326,6 @@ static int btrfsic_handle_extent_data(struct btrfsic_state *state,
> static int btrfsic_map_block(struct btrfsic_state *state, u64 bytenr, u32 len,
> 			     struct btrfsic_block_data_ctx *block_ctx_out,
> 			     int mirror_num);
> -static int btrfsic_map_superblock(struct btrfsic_state *state, u64 bytenr,
> -				  u32 len, struct block_device *bdev,
> -				  struct btrfsic_block_data_ctx *block_ctx_out);
> static void btrfsic_release_block_ctx(struct btrfsic_block_data_ctx *block_ctx);
> static int btrfsic_read_block(struct btrfsic_state *state,
> 			      struct btrfsic_block_data_ctx *block_ctx);
> @@ -1609,25 +1606,6 @@ static int btrfsic_map_block(struct btrfsic_state *state, u64 bytenr, u32 len,
> 	return ret;
> }
> 
> -static int btrfsic_map_superblock(struct btrfsic_state *state, u64 bytenr,
> -				  u32 len, struct block_device *bdev,
> -				  struct btrfsic_block_data_ctx *block_ctx_out)
> -{
> -	block_ctx_out->dev = btrfsic_dev_state_lookup(bdev);
> -	block_ctx_out->dev_bytenr = bytenr;
> -	block_ctx_out->start = bytenr;
> -	block_ctx_out->len = len;
> -	block_ctx_out->datav = NULL;
> -	block_ctx_out->pagev = NULL;
> -	block_ctx_out->mem_to_free = NULL;
> -	if (NULL != block_ctx_out->dev) {
> -		return 0;
> -	} else {
> -		printk(KERN_INFO "btrfsic: error, cannot lookup dev (#2)!\n");
> -		return -ENXIO;
> -	}
> -}
> -
> static void btrfsic_release_block_ctx(struct btrfsic_block_data_ctx *block_ctx)
> {
> 	if (block_ctx->mem_to_free) {
> @@ -2004,24 +1982,13 @@ again:
> 			}
> 		}
> 
> -		if (block->is_superblock)
> -			ret = btrfsic_map_superblock(state, bytenr,
> -						     processed_len,
> -						     bdev, &block_ctx);
> -		else
> -			ret = btrfsic_map_block(state, bytenr, processed_len,
> -						&block_ctx, 0);
> -		if (ret) {
> -			printk(KERN_INFO
> -			       "btrfsic: btrfsic_map_block(root @%llu)"
> -			       " failed!\n", bytenr);
> -			goto continue_loop;
> -		}
> -		block_ctx.datav = mapped_datav;
> -		/* the following is required in case of writes to mirrors,
> -		 * use the same that was used for the lookup */
> 		block_ctx.dev = dev_state;
> 		block_ctx.dev_bytenr = dev_bytenr;
> +		block_ctx.start = bytenr;
> +		block_ctx.len = processed_len;
> +		block_ctx.pagev = NULL;
> +		block_ctx.mem_to_free = NULL;
> +		block_ctx.datav = mapped_datav;
> 
> 		if (is_metadata || state->include_extent_data) {
> 			block->never_written = 0;
> @@ -2135,10 +2102,6 @@ again:
> 			/* this is getting ugly for the
> 			 * include_extent_data case... */
> 			bytenr = 0;	/* unknown */
> -			block_ctx.start = bytenr;
> -			block_ctx.len = processed_len;
> -			block_ctx.mem_to_free = NULL;
> -			block_ctx.pagev = NULL;
> 		} else {
> 			processed_len = state->metablock_size;
> 			bytenr = btrfs_stack_header_bytenr(
> @@ -2151,22 +2114,15 @@ again:
> 				       "Written block @%llu (%s/%llu/?)"
> 				       " !found in hash table, M.\n",
> 				       bytenr, dev_state->name, dev_bytenr);
> -
> -			ret = btrfsic_map_block(state, bytenr, processed_len,
> -						&block_ctx, 0);
> -			if (ret) {
> -				printk(KERN_INFO
> -				       "btrfsic: btrfsic_map_block(root @%llu)"
> -				       " failed!\n",
> -				       dev_bytenr);
> -				goto continue_loop;
> -			}
> 		}
> -		block_ctx.datav = mapped_datav;
> -		/* the following is required in case of writes to mirrors,
> -		 * use the same that was used for the lookup */
> +
> 		block_ctx.dev = dev_state;
> 		block_ctx.dev_bytenr = dev_bytenr;
> +		block_ctx.start = bytenr;
> +		block_ctx.len = processed_len;
> +		block_ctx.pagev = NULL;
> +		block_ctx.mem_to_free = NULL;
> +		block_ctx.datav = mapped_datav;
> 
> 		block = btrfsic_block_alloc();
> 		if (NULL == block) {
> -- 
> 2.1.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Best Regards,
Wang Shilong


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

* Re: [PATCH 2/2] Btrfs: check-int: don't complain about balanced blocks
  2014-10-16 15:48 ` [PATCH 2/2] Btrfs: check-int: don't complain about balanced blocks Stefan Behrens
@ 2014-10-17  7:16   ` Wang Shilong
  2014-10-17  8:06   ` Miao Xie
  1 sibling, 0 replies; 5+ messages in thread
From: Wang Shilong @ 2014-10-17  7:16 UTC (permalink / raw)
  To: Stefan Behrens; +Cc: linux-btrfs

 The xfstest btrfs/014 which tests the balance operation caused that the
> check_int module complained that known blocks changed their physical
> location. Since this is not an error in this case, only print such
> message if the verbose mode was enabled.
> 
> Reported-by: Wang Shilong <wangshilong1991@gmail.com>
> Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>

This passed my Tests after applying both patches.

Tested-by: Wang Shilong <wangshilong1991@gmail.com>

> ---
> fs/btrfs/check-integrity.c | 87 ++++++++++++++++++++++++++--------------------
> 1 file changed, 49 insertions(+), 38 deletions(-)
> 
> diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
> index 65fc2e0bbc4a..65226d7c9fe0 100644
> --- a/fs/btrfs/check-integrity.c
> +++ b/fs/btrfs/check-integrity.c
> @@ -1325,24 +1325,28 @@ static int btrfsic_create_link_to_next_block(
> 		l = NULL;
> 		next_block->generation = BTRFSIC_GENERATION_UNKNOWN;
> 	} else {
> -		if (next_block->logical_bytenr != next_bytenr &&
> -		    !(!next_block->is_metadata &&
> -		      0 == next_block->logical_bytenr)) {
> -			printk(KERN_INFO
> -			       "Referenced block @%llu (%s/%llu/%d)"
> -			       " found in hash table, %c,"
> -			       " bytenr mismatch (!= stored %llu).\n",
> -			       next_bytenr, next_block_ctx->dev->name,
> -			       next_block_ctx->dev_bytenr, *mirror_nump,
> -			       btrfsic_get_block_type(state, next_block),
> -			       next_block->logical_bytenr);
> -		} else if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
> -			printk(KERN_INFO
> -			       "Referenced block @%llu (%s/%llu/%d)"
> -			       " found in hash table, %c.\n",
> -			       next_bytenr, next_block_ctx->dev->name,
> -			       next_block_ctx->dev_bytenr, *mirror_nump,
> -			       btrfsic_get_block_type(state, next_block));
> +		if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE) {
> +			if (next_block->logical_bytenr != next_bytenr &&
> +			    !(!next_block->is_metadata &&
> +			      0 == next_block->logical_bytenr))
> +				printk(KERN_INFO
> +				       "Referenced block @%llu (%s/%llu/%d)"
> +				       " found in hash table, %c,"
> +				       " bytenr mismatch (!= stored %llu).\n",
> +				       next_bytenr, next_block_ctx->dev->name,
> +				       next_block_ctx->dev_bytenr, *mirror_nump,
> +				       btrfsic_get_block_type(state,
> +							      next_block),
> +				       next_block->logical_bytenr);
> +			else
> +				printk(KERN_INFO
> +				       "Referenced block @%llu (%s/%llu/%d)"
> +				       " found in hash table, %c.\n",
> +				       next_bytenr, next_block_ctx->dev->name,
> +				       next_block_ctx->dev_bytenr, *mirror_nump,
> +				       btrfsic_get_block_type(state,
> +							      next_block));
> +		}
> 		next_block->logical_bytenr = next_bytenr;
> 
> 		next_block->mirror_num = *mirror_nump;
> @@ -1528,7 +1532,9 @@ static int btrfsic_handle_extent_data(
> 				return -1;
> 			}
> 			if (!block_was_created) {
> -				if (next_block->logical_bytenr != next_bytenr &&
> +				if ((state->print_mask &
> +				     BTRFSIC_PRINT_MASK_VERBOSE) &&
> +				    next_block->logical_bytenr != next_bytenr &&
> 				    !(!next_block->is_metadata &&
> 				      0 == next_block->logical_bytenr)) {
> 					printk(KERN_INFO
> @@ -1881,25 +1887,30 @@ again:
> 							       dev_state,
> 							       dev_bytenr);
> 			}
> -			if (block->logical_bytenr != bytenr &&
> -			    !(!block->is_metadata &&
> -			      block->logical_bytenr == 0))
> -				printk(KERN_INFO
> -				       "Written block @%llu (%s/%llu/%d)"
> -				       " found in hash table, %c,"
> -				       " bytenr mismatch"
> -				       " (!= stored %llu).\n",
> -				       bytenr, dev_state->name, dev_bytenr,
> -				       block->mirror_num,
> -				       btrfsic_get_block_type(state, block),
> -				       block->logical_bytenr);
> -			else if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
> -				printk(KERN_INFO
> -				       "Written block @%llu (%s/%llu/%d)"
> -				       " found in hash table, %c.\n",
> -				       bytenr, dev_state->name, dev_bytenr,
> -				       block->mirror_num,
> -				       btrfsic_get_block_type(state, block));
> +			if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE) {
> +				if (block->logical_bytenr != bytenr &&
> +				    !(!block->is_metadata &&
> +				      block->logical_bytenr == 0))
> +					printk(KERN_INFO
> +					       "Written block @%llu (%s/%llu/%d)"
> +					       " found in hash table, %c,"
> +					       " bytenr mismatch"
> +					       " (!= stored %llu).\n",
> +					       bytenr, dev_state->name,
> +					       dev_bytenr,
> +					       block->mirror_num,
> +					       btrfsic_get_block_type(state,
> +								      block),
> +					       block->logical_bytenr);
> +				else
> +					printk(KERN_INFO
> +					       "Written block @%llu (%s/%llu/%d)"
> +					       " found in hash table, %c.\n",
> +					       bytenr, dev_state->name,
> +					       dev_bytenr, block->mirror_num,
> +					       btrfsic_get_block_type(state,
> +								      block));
> +			}
> 			block->logical_bytenr = bytenr;
> 		} else {
> 			if (num_pages * PAGE_CACHE_SIZE <
> -- 
> 2.1.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Best Regards,
Wang Shilong


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

* Re: [PATCH 2/2] Btrfs: check-int: don't complain about balanced blocks
  2014-10-16 15:48 ` [PATCH 2/2] Btrfs: check-int: don't complain about balanced blocks Stefan Behrens
  2014-10-17  7:16   ` Wang Shilong
@ 2014-10-17  8:06   ` Miao Xie
  1 sibling, 0 replies; 5+ messages in thread
From: Miao Xie @ 2014-10-17  8:06 UTC (permalink / raw)
  To: Stefan Behrens, linux-btrfs

On Thu, 16 Oct 2014 17:48:49 +0200, Stefan Behrens wrote:
> The xfstest btrfs/014 which tests the balance operation caused that the
> check_int module complained that known blocks changed their physical
> location. Since this is not an error in this case, only print such
> message if the verbose mode was enabled.
> 
> Reported-by: Wang Shilong <wangshilong1991@gmail.com>
> Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
> ---
>  fs/btrfs/check-integrity.c | 87 ++++++++++++++++++++++++++--------------------
>  1 file changed, 49 insertions(+), 38 deletions(-)
> 
> diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
> index 65fc2e0bbc4a..65226d7c9fe0 100644
> --- a/fs/btrfs/check-integrity.c
> +++ b/fs/btrfs/check-integrity.c
> @@ -1325,24 +1325,28 @@ static int btrfsic_create_link_to_next_block(
>  		l = NULL;
>  		next_block->generation = BTRFSIC_GENERATION_UNKNOWN;
>  	} else {
> -		if (next_block->logical_bytenr != next_bytenr &&
> -		    !(!next_block->is_metadata &&
> -		      0 == next_block->logical_bytenr)) {
> -			printk(KERN_INFO
> -			       "Referenced block @%llu (%s/%llu/%d)"
> -			       " found in hash table, %c,"
> -			       " bytenr mismatch (!= stored %llu).\n",
> -			       next_bytenr, next_block_ctx->dev->name,
> -			       next_block_ctx->dev_bytenr, *mirror_nump,
> -			       btrfsic_get_block_type(state, next_block),
> -			       next_block->logical_bytenr);
> -		} else if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
> -			printk(KERN_INFO
> -			       "Referenced block @%llu (%s/%llu/%d)"
> -			       " found in hash table, %c.\n",
> -			       next_bytenr, next_block_ctx->dev->name,
> -			       next_block_ctx->dev_bytenr, *mirror_nump,
> -			       btrfsic_get_block_type(state, next_block));
> +		if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE) {
> +			if (next_block->logical_bytenr != next_bytenr &&
> +			    !(!next_block->is_metadata &&
> +			      0 == next_block->logical_bytenr))
> +				printk(KERN_INFO
> +				       "Referenced block @%llu (%s/%llu/%d)"
> +				       " found in hash table, %c,"
> +				       " bytenr mismatch (!= stored %llu).\n",

According to the coding style, we don't expect the user-visible strings are broken.

Thanks
Miao

> +				       next_bytenr, next_block_ctx->dev->name,
> +				       next_block_ctx->dev_bytenr, *mirror_nump,
> +				       btrfsic_get_block_type(state,
> +							      next_block),
> +				       next_block->logical_bytenr);
> +			else
> +				printk(KERN_INFO
> +				       "Referenced block @%llu (%s/%llu/%d)"
> +				       " found in hash table, %c.\n",
> +				       next_bytenr, next_block_ctx->dev->name,
> +				       next_block_ctx->dev_bytenr, *mirror_nump,
> +				       btrfsic_get_block_type(state,
> +							      next_block));
> +		}
>  		next_block->logical_bytenr = next_bytenr;
>  
>  		next_block->mirror_num = *mirror_nump;
> @@ -1528,7 +1532,9 @@ static int btrfsic_handle_extent_data(
>  				return -1;
>  			}
>  			if (!block_was_created) {
> -				if (next_block->logical_bytenr != next_bytenr &&
> +				if ((state->print_mask &
> +				     BTRFSIC_PRINT_MASK_VERBOSE) &&
> +				    next_block->logical_bytenr != next_bytenr &&
>  				    !(!next_block->is_metadata &&
>  				      0 == next_block->logical_bytenr)) {
>  					printk(KERN_INFO
> @@ -1881,25 +1887,30 @@ again:
>  							       dev_state,
>  							       dev_bytenr);
>  			}
> -			if (block->logical_bytenr != bytenr &&
> -			    !(!block->is_metadata &&
> -			      block->logical_bytenr == 0))
> -				printk(KERN_INFO
> -				       "Written block @%llu (%s/%llu/%d)"
> -				       " found in hash table, %c,"
> -				       " bytenr mismatch"
> -				       " (!= stored %llu).\n",
> -				       bytenr, dev_state->name, dev_bytenr,
> -				       block->mirror_num,
> -				       btrfsic_get_block_type(state, block),
> -				       block->logical_bytenr);
> -			else if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE)
> -				printk(KERN_INFO
> -				       "Written block @%llu (%s/%llu/%d)"
> -				       " found in hash table, %c.\n",
> -				       bytenr, dev_state->name, dev_bytenr,
> -				       block->mirror_num,
> -				       btrfsic_get_block_type(state, block));
> +			if (state->print_mask & BTRFSIC_PRINT_MASK_VERBOSE) {
> +				if (block->logical_bytenr != bytenr &&
> +				    !(!block->is_metadata &&
> +				      block->logical_bytenr == 0))
> +					printk(KERN_INFO
> +					       "Written block @%llu (%s/%llu/%d)"
> +					       " found in hash table, %c,"
> +					       " bytenr mismatch"
> +					       " (!= stored %llu).\n",
> +					       bytenr, dev_state->name,
> +					       dev_bytenr,
> +					       block->mirror_num,
> +					       btrfsic_get_block_type(state,
> +								      block),
> +					       block->logical_bytenr);
> +				else
> +					printk(KERN_INFO
> +					       "Written block @%llu (%s/%llu/%d)"
> +					       " found in hash table, %c.\n",
> +					       bytenr, dev_state->name,
> +					       dev_bytenr, block->mirror_num,
> +					       btrfsic_get_block_type(state,
> +								      block));
> +			}
>  			block->logical_bytenr = bytenr;
>  		} else {
>  			if (num_pages * PAGE_CACHE_SIZE <
> 


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

end of thread, other threads:[~2014-10-17  8:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-16 15:48 [PATCH 1/2] Btrfs: check_int: use the known block location Stefan Behrens
2014-10-16 15:48 ` [PATCH 2/2] Btrfs: check-int: don't complain about balanced blocks Stefan Behrens
2014-10-17  7:16   ` Wang Shilong
2014-10-17  8:06   ` Miao Xie
2014-10-17  7:15 ` [PATCH 1/2] Btrfs: check_int: use the known block location Wang Shilong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).