[PATCH] xfs_copy: accept XFS_ABTB_CRC_MAGIC

Eric Sandeen
2014-02-26T02:03:26Z

xfs_copy needs a fair bit of work for CRCs because it rewrites
UUIDs by default, but this change will get it working properly
with the "-d" (duplicate) option which keeps the same UUID.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

However, I wonder if we should fail CRC filesystems outright
for now if -d isn't specified, because it will invalidate every
CRC and generally make a mess of things...

diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index 9986fbf..7c807a4 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -957,7 +957,9 @@ main(int argc, char **argv)
((char *)btree_buf.data +
pos - btree_buf.position);

- ASSERT(be32_to_cpu(block->bb_magic) == XFS_ABTB_MAGIC);
+ ASSERT(be32_to_cpu(block->bb_magic) ==
+ (xfs_sb_version_hascrc(&mp->m_sb) ?
+ XFS_ABTB_CRC_MAGIC : XFS_ABTB_MAGIC));

if (be16_to_cpu(block->bb_level) == 0)
break;