]> git.ipfire.org Git - thirdparty/grub.git/commit
fs/btrfs: Use full btrfs bootloader area
authorMichael Chang <mchang@suse.com>
Mon, 13 Dec 2021 06:25:49 +0000 (14:25 +0800)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 23 Dec 2021 01:55:30 +0000 (02:55 +0100)
commitb0f06a81c6f31b6fa20be67a96b6683bba8210c9
tree18c1afa8a88eeb585454441cc8c9958827c6dffd
parent23e02b0ee46c5c218c296050ead87c759b56008c
fs/btrfs: Use full btrfs bootloader area

Up to now GRUB can only embed to the first 64 KiB before primary
superblock of btrfs, effectively limiting the GRUB core size. That
could consequently pose restrictions to feature enablement like
advanced zstd compression.

This patch attempts to utilize full unused area reserved by btrfs for
the bootloader outlined in the document [1]:

  The first 1MiB on each device is unused with the exception of primary
  superblock that is on the offset 64KiB and spans 4KiB.

Apart from that, adjacent sectors to superblock and first block group
are not used for embedding in case of overflow and logged access to
adjacent sectors could be useful for tracing it up.

This patch has been tested to provide out of the box support for btrfs
zstd compression with which GRUB has been installed to the partition.

[1] https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs(5)#BOOTLOADER_SUPPORT

Signed-off-by: Michael Chang <mchang@suse.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/fs/btrfs.c
include/grub/disk.h