2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-12-01 06:42:17 +00:00

Use page sized XFS blocks for the zram diskless root

On kernels with pages larger than 4k, such as the RHEL 10 aarch64
kernel-64k, zram never completes a discard that covers only part of a
page. XFS with 4k blocks issues such discards with -o discard, and the
diskless boot hangs in update-ca-trust. Fixed upstream in
https://git.kernel.org/torvalds/c/e3668b371329

zram reports the page size as its physical block size. Using it as the
XFS block size keeps every discard page aligned. Kernels with 4k pages
keep 4k blocks.

Fixes #414
This commit is contained in:
Markus Hilger
2026-11-27 17:46:38 +01:00
parent f12b9fa01f
commit 3b2e2ceae8
7 changed files with 14 additions and 7 deletions
@@ -57,7 +57,8 @@ if [ ! "uncompressed" = "$imagemethod" ]; then
memtot=$(grep ^MemTotal: /proc/meminfo|awk '{print $2}')
memtot=$((memtot/2))$(grep ^MemTotal: /proc/meminfo | awk '{print $3'})
echo $memtot > /sys/block/zram0/disksize
mkfs.xfs /dev/zram0 > /dev/null
# page sized blocks avoid https://git.kernel.org/torvalds/c/e3668b371329
mkfs.xfs -b size=$(cat /sys/block/zram0/queue/physical_block_size) /dev/zram0 > /dev/null
fi
TETHERED=0
if [ "untethered" = "$imagemethod" -o "uncompressed" = "$imagemethod" ]; then
@@ -46,7 +46,8 @@ modprobe zram
memtot=$(grep ^MemTotal: /proc/meminfo|awk '{print $2}')
memtot=$((memtot/2))$(grep ^MemTotal: /proc/meminfo | awk '{print $3'})
echo $memtot > /sys/block/zram0/disksize
mkfs.xfs /dev/zram0 > /dev/null
# page sized blocks avoid https://git.kernel.org/torvalds/c/e3668b371329
mkfs.xfs -b size=$(cat /sys/block/zram0/queue/physical_block_size) /dev/zram0 > /dev/null
mount -o discard /dev/zram0 /mnt/overlay
if [ ! -f /tmp/mountparts.sh ]; then
mkdir -p /mnt/overlay/upper /mnt/overlay/work
@@ -50,7 +50,8 @@ modprobe zram
memtot=$(grep ^MemTotal: /proc/meminfo|awk '{print $2}')
memtot=$((memtot/2))$(grep ^MemTotal: /proc/meminfo | awk '{print $3'})
echo $memtot > /sys/block/zram0/disksize
mkfs.xfs /dev/zram0 > /dev/null
# page sized blocks avoid https://git.kernel.org/torvalds/c/e3668b371329
mkfs.xfs -b size=$(cat /sys/block/zram0/queue/physical_block_size) /dev/zram0 > /dev/null
mount -o discard /dev/zram0 /mnt/overlay
if [ ! -f /tmp/mountparts.sh ]; then
mkdir -p /mnt/overlay/upper /mnt/overlay/work
@@ -56,7 +56,8 @@ if [ ! "uncompressed" = "$imagemethod" ]; then
memtot=$(grep ^MemTotal: /proc/meminfo|awk '{print $2}')
memtot=$((memtot/2))$(grep ^MemTotal: /proc/meminfo | awk '{print $3'})
echo $memtot > /sys/block/zram0/disksize
mkfs.xfs /dev/zram0 > /dev/null
# page sized blocks avoid https://git.kernel.org/torvalds/c/e3668b371329
mkfs.xfs -b size=$(cat /sys/block/zram0/queue/physical_block_size) /dev/zram0 > /dev/null
fi
TETHERED=0
if [ "untethered" = "$imagemethod" -o "uncompressed" = "$imagemethod" ]; then
@@ -39,7 +39,8 @@ modprobe zram
memtot=$(grep ^MemTotal: /proc/meminfo|awk '{print $2}')
memtot=$((memtot/2))$(grep ^MemTotal: /proc/meminfo | awk '{print $3'})
echo $memtot > /sys/block/zram0/disksize
mkfs.xfs /dev/zram0 > /dev/null
# page sized blocks avoid https://git.kernel.org/torvalds/c/e3668b371329
mkfs.xfs -b size=$(cat /sys/block/zram0/queue/physical_block_size) /dev/zram0 > /dev/null
mount -o discard /dev/zram0 /mnt/overlay
if [ ! -f /tmp/mountparts.sh ]; then
mkdir -p /mnt/overlay/upper /mnt/overlay/work
@@ -39,7 +39,8 @@ modprobe zram
memtot=$(grep ^MemTotal: /proc/meminfo|awk '{print $2}')
memtot=$((memtot/2))$(grep ^MemTotal: /proc/meminfo | awk '{print $3'})
echo $memtot > /sys/block/zram0/disksize
mkfs.xfs /dev/zram0 > /dev/null
# page sized blocks avoid https://git.kernel.org/torvalds/c/e3668b371329
mkfs.xfs -b size=$(cat /sys/block/zram0/queue/physical_block_size) /dev/zram0 > /dev/null
mount -o discard /dev/zram0 /mnt/overlay
if [ ! -f /tmp/mountparts.sh ]; then
mkdir -p /mnt/overlay/upper /mnt/overlay/work
@@ -89,7 +89,8 @@ if [ "$imagemethod" != uncompressed ]; then
memtot=$((memtot/2))$(grep ^MemTotal: /proc/meminfo | awk '{print $3'})
echo $memtot > /sys/block/zram0/disksize
modprobe xfs
mkfs.xfs /dev/zram0 > /dev/null
# page sized blocks avoid https://git.kernel.org/torvalds/c/e3668b371329
mkfs.xfs -b size=$(cat /sys/block/zram0/queue/physical_block_size) /dev/zram0 > /dev/null
if [ "$TETHERED" = 1 ]; then
mount -o discard /dev/zram0 /mnt/overlay
else