Aarch64 is an architecture that allows to choose the page size.
There’s an option in the kernel config for that and it has recently changed in linux-aarch64-4.12.5-1.
Here is the change:
- https://archlinuxarm.org/packages/aarch64/linux-aarch64/log?id=0c95644fe932eb0ce2d3474ddba88092dbe85344
- https://github.com/archlinuxarm/PKGBUILDs/commit/0c95644fe932eb0ce2d3474ddba88092dbe85344
-CONFIG_ARM64_PAGE_SHIFT=16
+CONFIG_ARM64_PAGE_SHIFT=12
…
-# CONFIG_ARM64_4K_PAGES is not set
+CONFIG_ARM64_4K_PAGES=y
# CONFIG_ARM64_16K_PAGES is not set
-CONFIG_ARM64_64K_PAGES=y
-# CONFIG_ARM64_VA_BITS_42 is not set
+# CONFIG_ARM64_64K_PAGES is not set
+# CONFIG_ARM64_VA_BITS_39 is not set
')
Whereas linux-aarch64-4.12.4-1 and below used to have page size of 64k, linux-aarch64-4.12.5-1 and above now have page size of 4k.
The problem with btrfs is that the current implementation requires the sectorsize to be equal to the page size:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/btrfs/disk-io.c#n4141
$this->bbcode_second_pass_code('', '
/* Only PAGE SIZE is supported yet */
if (sectorsize != PAGE_SIZE) {
btrfs_err(fs_info,
"sectorsize %llu not supported yet, only support %lu",
sectorsize, PAGE_SIZE);
ret = -EINVAL;
}
')
And the sectorsize impacts the on-disk layout and is persisted in the superblock of the FS.
Concretely, what all this means is that:
if you created a btrfs filesystem while running linux-aarch64-4.12.4-1 or earlier (with 64k pages),
and you update your system to a linux-aarch64-4.12.5-1 or more recent (with 4k pages),
your system is now unable to mount that btrfs filesystem anymore and fails with the following error:
$this->bbcode_second_pass_code('', '
BTRFS error (device sda): sectorsize 65536 not supported yet, only support 4096
BTRFS error (device sda): superblock contains falal error
BTRFS error (device sda): open_ctree failed
')
If you reformat your btrfs filesystem with the new kernel, you’ll be able to mount it, but all your data will be lost.
Changing the PAGE_SIZE broke the backward compatibility of btrfs.
So, I was wondering what were the reasons to switch from 64k pages to 4k pages.
Could we switch back to 64k pages?
Cheers,
Lénaïc.