Btrfs: fix missing skinny metadata check in scrub_stripe()
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>
Sun, 12 Jan 2014 13:38:32 +0000 (21:38 +0800)
committerChris Mason <clm@fb.com>
Tue, 28 Jan 2014 21:20:32 +0000 (13:20 -0800)
Check if we support skinny metadata firstly and fix to use
right type to search.

Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Chris Mason <clm@fb.com>
fs/btrfs/scrub.c

index 7806e2c..e0677e4 100644 (file)
@@ -2373,8 +2373,11 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
                        scrub_blocked_if_needed(fs_info);
                }
 
+               if (btrfs_fs_incompat(fs_info, SKINNY_METADATA))
+                       key.type = BTRFS_METADATA_ITEM_KEY;
+               else
+                       key.type = BTRFS_EXTENT_ITEM_KEY;
                key.objectid = logical;
-               key.type = BTRFS_EXTENT_ITEM_KEY;
                key.offset = (u64)-1;
 
                ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);