All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] btrfs-progs: fsck: Fix a false alert where extent record has wrong metadata flag
@ 2015-11-25  6:19 Qu Wenruo
  2015-11-26 14:27 ` David Sterba
  0 siblings, 1 reply; 5+ messages in thread
From: Qu Wenruo @ 2015-11-25  6:19 UTC (permalink / raw)
  To: linux-btrfs; +Cc: calestyo

In process_extent_item(), it gives 'metadata' initial value 0, but for
non-skinny-metadata case, metadata extent can't be judged just from key
type and it forgot that case.

This causes a lot of false alert in non-skinny-metadata filesystem.

Fix it by set correct metadata value before calling add_extent_rec().

Reported-by: Christoph Anton Mitterer <calestyo@scientia.net>
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
v2:
   Use bit AND instead of equal to check TREE_BLOCK bit.
---
 cmds-check.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cmds-check.c b/cmds-check.c
index fd661d9..938b863 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -5134,6 +5134,10 @@ static int process_extent_item(struct btrfs_root *root,
 
 	ei = btrfs_item_ptr(eb, slot, struct btrfs_extent_item);
 	refs = btrfs_extent_refs(eb, ei);
+	if (btrfs_extent_flags(eb, ei) & BTRFS_EXTENT_FLAG_TREE_BLOCK)
+		metadata = 1;
+	else
+		metadata = 0;
 
 	add_extent_rec(extent_cache, NULL, 0, key.objectid, num_bytes,
 		       refs, 0, 0, 0, metadata, 1, num_bytes);
-- 
2.6.2


-- 
This message has been scanned for viruses and
dangerous content by Fujitsu, and is believed to be clean.


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

end of thread, other threads:[~2015-11-27  0:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-25  6:19 [PATCH v2] btrfs-progs: fsck: Fix a false alert where extent record has wrong metadata flag Qu Wenruo
2015-11-26 14:27 ` David Sterba
2015-11-26 15:20   ` Christoph Anton Mitterer
2015-11-27  0:40     ` Qu Wenruo
2015-11-27  0:54       ` Christoph Anton Mitterer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.