Skip to contentSkip to conversation

Btrfs: add metadump_v2 support to the kernel

PATCH In review Josef Bacik 2 participants 2 messages Feb 12, 2015 – Feb 13, 2015 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: add metadump_v2 support to the kernel

For newly restored metadumps we can actually mount the fs and use it properly except that the data obviously doesn't match properly. To get around this make us skip csum validation if the metadump_v2 flag is set on the fs, this will allow us to reproduce balance issues with metadumps. Thanks,

---
 fs/btrfs/ctree.h | 1 +
 fs/btrfs/inode.c | 4 ++++
 2 files changed, 5 insertions(+)
fs/btrfs/ctree.h +1 -0
index 1675602..bc16147 100644
@@ -356,6 +356,7 @@ static inline unsigned long btrfs_chunk_item_size(int num_stripes)
 
 #define BTRFS_SUPER_FLAG_SEEDING	(1ULL << 32)
 #define BTRFS_SUPER_FLAG_METADUMP	(1ULL << 33)
+#define BTRFS_SUPER_FLAG_METADUMP_V2	(1ULL << 34)
 
 #define BTRFS_BACKREF_REV_MAX		256
 #define BTRFS_BACKREF_REV_SHIFT		56
fs/btrfs/inode.c +4 -0
index 4564975..70d0af8 100644
@@ -3039,6 +3039,10 @@ static int btrfs_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
 	if (BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)
 		return 0;
 
+	if (btrfs_super_flags(root->fs_info->super_copy) &
+	    BTRFS_SUPER_FLAG_METADUMP_V2)
+		return 0;
+
 	if (root->root_key.objectid == BTRFS_DATA_RELOC_TREE_OBJECTID &&
 	    test_range_bit(io_tree, start, end, EXTENT_NODATASUM, 1, NULL)) {
 		clear_extent_bits(io_tree, start, end, EXTENT_NODATASUM,
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 28 lines · Josef Bacik

For newly restored metadumps we can actually mount the fs and use it properly except that the data obviously doesn't match properly. To get around this make us skip csum validation if the metadump_v2 flag is set on the fs, this will allow us to reproduce balance issues with metadumps. Thanks,

---
 fs/btrfs/ctree.h | 1 +
 fs/btrfs/inode.c | 4 ++++
 2 files changed, 5 insertions(+)
fs/btrfs/ctree.h +1 -0
index 1675602..bc16147 100644
@@ -356,6 +356,7 @@ static inline unsigned long btrfs_chunk_item_size(int num_stripes)
 
 #define BTRFS_SUPER_FLAG_SEEDING	(1ULL << 32)
 #define BTRFS_SUPER_FLAG_METADUMP	(1ULL << 33)
+#define BTRFS_SUPER_FLAG_METADUMP_V2	(1ULL << 34)
 
 #define BTRFS_BACKREF_REV_MAX		256
 #define BTRFS_BACKREF_REV_SHIFT		56
fs/btrfs/inode.c +0 -0
index 4564975..70d0af8 100644

fs/btrfs/inode.c static int btrfs_readpage_end_io_hook(struct btrfs_io_bio *io_bio, · line 3041

Quoted 3 lines
fs/btrfs/inode.c +0 -0
@@ -3039,6 +3039,10 @@ static int btrfs_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
 	if (BTRFS_I(inode)->flags & BTRFS_INODE_NODATASUM)
 		return 0;
 

Please add the text from changelog here as a comment, the flag is not really selfexplanatory.

Quoted 7 lines
fs/btrfs/inode.c +4 -0
+	if (btrfs_super_flags(root->fs_info->super_copy) &
+	    BTRFS_SUPER_FLAG_METADUMP_V2)
+		return 0;
+
 	if (root->root_key.objectid == BTRFS_DATA_RELOC_TREE_OBJECTID &&
 	    test_range_bit(io_tree, start, end, EXTENT_NODATASUM, 1, NULL)) {
 		clear_extent_bits(io_tree, start, end, EXTENT_NODATASUM,