diff mbox

Btrfs: btrfs_check_super_valid: Allow 4096 as stripesize

Message ID 1466095078-25726-1-git-send-email-chandan@linux.vnet.ibm.com (mailing list archive)
State Accepted
Headers show

Commit Message

Chandan Rajendra June 16, 2016, 4:37 p.m. UTC
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>
---
 fs/btrfs/disk-io.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

David Sterba June 17, 2016, 4:40 p.m. UTC | #1
On Thu, Jun 16, 2016 at 10:07:58PM +0530, Chandan Rajendra wrote:
> 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>

Reviewed-by: David Sterba <dsterba@suse.com>

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.
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index 1142127..7f92b4f 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -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;