Btrfs: btrfs_check_super_valid: Allow 4096 as stripesize
authorChandan Rajendra <chandan@linux.vnet.ibm.com>
Thu, 16 Jun 2016 16:37:58 +0000 (22:07 +0530)
committerDavid Sterba <dsterba@suse.com>
Fri, 17 Jun 2016 16:32:49 +0000 (18:32 +0200)
Older btrfs-progs/mkfs.btrfs sets 4096 as the stripesize. Hence
restricting stripesize to be equal to sectorsize would cause super block
validation to return an error on architectures where PAGE_SIZE is not
equal to 4096.

Hence as a workaround, this commit allows stripesize to be set to 4096
bytes.

Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/disk-io.c

index 789f5f2339402b77b75df4ea637106e7ae2ede96..54cca7a1572bfc25fb7f93b1840eb1752afba113 100644 (file)
@@ -4134,7 +4134,8 @@ static int btrfs_check_super_valid(struct btrfs_fs_info *fs_info,
                ret = -EINVAL;
        }
        if (!is_power_of_2(btrfs_super_stripesize(sb)) ||
-           btrfs_super_stripesize(sb) != sectorsize) {
+               ((btrfs_super_stripesize(sb) != sectorsize) &&
+                       (btrfs_super_stripesize(sb) != 4096))) {
                btrfs_err(fs_info, "invalid stripesize %u",
                       btrfs_super_stripesize(sb));
                ret = -EINVAL;