Skip to contentSkip to conversation

Btrfs: btrfs_check_super_valid: Allow 4096 as stripesize

PATCH In review Chandan Rajendra 2 participants 2 messages Jun 16, 2016 – Jun 17, 2016 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Btrfs: btrfs_check_super_valid: Allow 4096 as stripesize

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.

---
 fs/btrfs/disk-io.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/disk-io.c +2 -1
index 1142127..7f92b4f 100644
@@ -4139,7 +4139,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;
Signature · 1 line
2.5.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Chandan Rajendra

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.

As we've discused on IRC, there's one more place to fix the stripesize, but I'll take this one as it's fixing the validation side.