From 273488299effe9a9182fffc1a7cd9639b68a0da4 Mon Sep 17 00:00:00 2001 From: David Sterba Date: Fri, 17 Feb 2012 11:44:03 +0100 Subject: [PATCH] btrfs-progs: mkfs: disallow uneven data/metadata blocksize for mixed With support for bigger metadata blocks, we must avoid different block size for mixed block groups, this causes corruption (xfstests/083). Signed-off-by: David Sterba --- mkfs.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/mkfs.c b/mkfs.c index e3ced19..e02efcc 100644 --- a/mkfs.c +++ b/mkfs.c @@ -1313,6 +1313,19 @@ int main(int ac, char **av) "profiles must be the same\n"); exit(1); } + + if (leafsize != nodesize) { + fprintf(stderr, "With mixed block groups node and leaf " + "block sizes must be the same\n"); + exit(1); + } + + if (sectorsize != nodesize) { + fprintf(stderr, "With mixed block groups data and metadata " + "block sizes must be the same\n"); + exit(1); + } + } blocks[0] = BTRFS_SUPER_INFO_OFFSET; -- 1.7.6.233.gd79bc