* [LTP] [PATCH] zram: skip exfat on systems with large page size
@ 2026-04-02 8:12 Soma Das
2026-04-03 1:47 ` Li Wang via ltp
0 siblings, 1 reply; 5+ messages in thread
From: Soma Das @ 2026-04-02 8:12 UTC (permalink / raw)
To: ltp; +Cc: somadas1
exfat requires cluster size >= sector size, but defaults to 4KB.
On systems with large page sizes (e.g., 64KB on POWER),
zram uses page size as sector size, causing mkfs.exfat to fail.
Skip exfat filesystem creation when page size > 4096 to avoid test failure.
Signed-off-by: Soma Das <somadas1@linux.ibm.com>
---
.../kernel/device-drivers/zram/zram01.sh | 91 +++++++++++++++++++
1 file changed, 91 insertions(+)
diff --git a/testcases/kernel/device-drivers/zram/zram01.sh b/testcases/kernel/device-drivers/zram/zram01.sh
index 793f6603c..6afba21f0 100755
--- a/testcases/kernel/device-drivers/zram/zram01.sh
+++ b/testcases/kernel/device-drivers/zram/zram01.sh
@@ -11,6 +11,10 @@ TST_TESTFUNC="do_test"
TST_NEEDS_CMDS="awk bc dd"
TST_SETUP="setup"
+# Track devices that were skipped due to sector size incompatibility
+# Format: space-separated list of device numbers (e.g., "2 5" if zram2 and zram5 were skipped)
+skipped_devices=""
+
check_space_for_fs()
{
local fs="$1"
@@ -72,15 +76,59 @@ setup()
zram_load
}
+check_fs_sector_support()
+{
+ local fs="$1"
+ local dev="$2"
+ local page_size
+ local sector_size
+
+ # Get the system page size - zram uses this as sector size
+ page_size=$(getconf PAGE_SIZE 2>/dev/null)
+
+ if [ -z "$page_size" ] || [ "$page_size" -lt 4096 ]; then
+ # Default to 4KB if we can't determine page size
+ page_size=4096
+ fi
+
+ tst_res TINFO "check_fs_sector_support: $fs on zram$dev system_page_size=$page_size"
+
+ # CHECK: exfat requires cluster size >= sector size, but defaults to 4KB
+ # On systems with large page sizes (e.g., 64KB on POWER), sector size > 4KB
+ # This causes exfat filesystem creation to fail, so we skip it with TCONF
+ if [ "$fs" = "exfat" ] && [ "$page_size" -gt 4096 ]; then
+ tst_res TINFO "check_fs_sector_support: $fs on zram$dev has page_size=$page_size (> 4096), skipping"
+ return 1 # Return failure (skip this filesystem)
+ fi
+
+ return 0 # All other filesystems pass this check
+}
+
zram_makefs()
{
local i=$dev_start
local fs
+ local sector_size
+ # Loop through each filesystem assigned to each zram device
for fs in $zram_filesystems; do
+ tst_res TINFO "zram_makefs: checking device zram$i for filesystem $fs"
+
+ # Check if this filesystem is compatible with the device's sector size
+ if ! check_fs_sector_support "$fs" "$i"; then
+ # Filesystem not supported on this device - mark device as skipped
+ sector_size=$(cat /sys/block/zram${i}/queue/logical_block_size)
+ tst_res TCONF "mkfs.$fs does not support sector size $sector_size"
+ skipped_devices="$skipped_devices $i" # Add to skipped list
+ i=$(($i + 1))
+ continue # Skip to next filesystem
+ fi
+
+ # Filesystem is supported - attempt to create it
tst_res TINFO "make $fs filesystem on /dev/zram$i"
mkfs.$fs /dev/zram$i > err.log 2>&1
if [ $? -ne 0 ]; then
+ # Filesystem creation failed
cat err.log
tst_res TFAIL "Failed to make $fs on /dev/zram$i"
tst_brk TBROK "Can't continue with mounting the FS"
@@ -95,8 +143,27 @@ zram_makefs()
zram_mount()
{
local i
+ local skip
+ # Attempt to mount all zram devices
for i in $(seq $dev_start $dev_end); do
+ skip=0
+
+ # Check if this device was marked as skipped during filesystem creation
+ for dev in $skipped_devices; do
+ if [ "$dev" = "$i" ]; then
+ skip=1
+ break
+ fi
+ done
+
+ # Skip mounting devices that don't have filesystems
+ if [ $skip -eq 1 ]; then
+ tst_res TINFO "skipping mount of /dev/zram$i (filesystem not created)"
+ continue
+ fi
+
+ # Mount the filesystem that was created in zram_makefs
tst_res TINFO "mount /dev/zram$i"
mkdir zram$i
ROD mount /dev/zram$i zram$i
@@ -130,8 +197,27 @@ zram_fill_fs()
{
local mem_used_total
local b i r v
+ local skip
+ # Fill each mounted filesystem with data to test compression
for i in $(seq $dev_start $dev_end); do
+ skip=0
+
+ # Check if this device was marked as skipped (has no filesystem)
+ for dev in $skipped_devices; do
+ if [ "$dev" = "$i" ]; then
+ skip=1
+ break
+ fi
+ done
+
+ # Skip filling devices that don't have filesystems
+ if [ $skip -eq 1 ]; then
+ tst_res TINFO "skipping fill of zram$i (filesystem not created)"
+ continue
+ fi
+
+ # Fill this zram device with zeros to test compression ratio
tst_res TINFO "filling zram$i (it can take long time)"
b=0
while true; do
@@ -140,12 +226,15 @@ zram_fill_fs()
>/dev/null 2>err.txt || break
b=$(($b + 1))
done
+
+ # Verify that at least some data was written
if [ $b -eq 0 ]; then
[ -s err.txt ] && tst_res TWARN "dd error: $(cat err.txt)"
tst_brk TBROK "cannot fill zram $i"
fi
tst_res TPASS "zram$i was filled with '$b' KB"
+ # Check if compression statistics are available (requires mm_stat)
if [ ! -f "/sys/block/zram$i/mm_stat" ]; then
if [ $i -eq 0 ]; then
tst_res TCONF "zram compression ratio test requires zram mm_stat sysfs file"
@@ -154,6 +243,7 @@ zram_fill_fs()
continue
fi
+ # Read and verify the compression ratio
TST_RETRY_FN_EXP_BACKOFF "check_read_mem_used_total /sys/block/zram$i/mm_stat" 0 10
mem_used_total=$(read_mem_used_total /sys/block/zram$i/mm_stat)
tst_res TINFO "mem_used_total: $mem_used_total"
@@ -161,6 +251,7 @@ zram_fill_fs()
v=$((100 * 1024 * $b / $mem_used_total))
r=$(echo "scale=2; $v / 100 " | bc)
+ # Fail if compression ratio is less than 1:1 (data grew instead of compressed)
if [ "$v" -lt 100 ]; then
tst_res TFAIL "compression ratio: $r:1"
break
--
2.39.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [LTP] [PATCH] zram: skip exfat on systems with large page size
2026-04-02 8:12 [LTP] [PATCH] zram: skip exfat on systems with large page size Soma Das
@ 2026-04-03 1:47 ` Li Wang via ltp
2026-04-03 16:59 ` Soma Das
0 siblings, 1 reply; 5+ messages in thread
From: Li Wang via ltp @ 2026-04-03 1:47 UTC (permalink / raw)
To: Soma Das; +Cc: ltp
> exfat requires cluster size >= sector size, but defaults to 4KB.
> On systems with large page sizes (e.g., 64KB on POWER),
> zram uses page size as sector size, causing mkfs.exfat to fail.
>
> Skip exfat filesystem creation when page size > 4096 to avoid test failure.
Or, can we specify the sector size with 'mkfs.$fs -c $page_size'
when detecting a large pagesize system?
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH] zram: skip exfat on systems with large page size
2026-04-03 1:47 ` Li Wang via ltp
@ 2026-04-03 16:59 ` Soma Das
2026-04-04 1:14 ` Li Wang via ltp
0 siblings, 1 reply; 5+ messages in thread
From: Soma Das @ 2026-04-03 16:59 UTC (permalink / raw)
To: liwang; +Cc: somadas1, ltp
On Fri, Apr 03, 2026 at 09:47:33AM +0800, Li Wang wrote:
> Or, can we specify the sector size with 'mkfs.$fs -c $page_size'
> when detecting a large pagesize system?
Thanks for the review.
Using mkfs.exfat -c $page_size would technically work, but I avoided
it because:
1. zram01 tests zram behaviour, not filesystem configuration -- using
a non-default cluster size feels out of scope.
2. The cluster size must be valid for the disk size (only 25MB here),
so large cluster sizes could hit additional constraints.
Skipping with TCONF honestly reflects that default exfat tooling does
not support this hardware configuration, which is useful signal.
Happy to send a v2 with the -c approach if you prefer.
Thanks,
Soma
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [LTP] [PATCH] zram: skip exfat on systems with large page size
2026-04-03 16:59 ` Soma Das
@ 2026-04-04 1:14 ` Li Wang via ltp
2026-04-04 17:20 ` Soma Das
0 siblings, 1 reply; 5+ messages in thread
From: Li Wang via ltp @ 2026-04-04 1:14 UTC (permalink / raw)
To: Soma Das; +Cc: ltp
Thanks for the explanation.
I still think we should go with the -c approach rather than skipping.
A couple of points:
On 1, I don't think this changes the scope of the test. zram01 already
invokes mkfs.$fs as a means to exercise zram, adjusting a parameter so
that mkfs actually succeeds is just making the test work, not turning
it into a filesystem configuration test.
On 2, 25MB with a 64KB cluster size gives roughly 390 clusters, which
is well within exfat's limits. Could you point out a concrete constraint
that would actually fail here? If there isn't one, I'd prefer not to
use a hypothetical concern as justification for skipping.
On the TCONF, reporting TCONF here would make it look like exfat on
zram is fundamentally broken on 64K-page systems, when in reality it
works with a one-line change. That is a false negative we should
avoid in a test suite.
Please send a v2 with the -c approach.
On Fri, Apr 03, 2026 at 04:59:47PM +0000, Soma Das wrote:
> On Fri, Apr 03, 2026 at 09:47:33AM +0800, Li Wang wrote:
> > Or, can we specify the sector size with 'mkfs.$fs -c $page_size'
> > when detecting a large pagesize system?
>
> Thanks for the review.
>
> Using mkfs.exfat -c $page_size would technically work, but I avoided
> it because:
>
> 1. zram01 tests zram behaviour, not filesystem configuration -- using
> a non-default cluster size feels out of scope.
> 2. The cluster size must be valid for the disk size (only 25MB here),
> so large cluster sizes could hit additional constraints.
>
> Skipping with TCONF honestly reflects that default exfat tooling does
> not support this hardware configuration, which is useful signal.
>
> Happy to send a v2 with the -c approach if you prefer.
>
> Thanks,
> Soma
>
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-04-04 16:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-02 8:12 [LTP] [PATCH] zram: skip exfat on systems with large page size Soma Das
2026-04-03 1:47 ` Li Wang via ltp
2026-04-03 16:59 ` Soma Das
2026-04-04 1:14 ` Li Wang via ltp
2026-04-04 17:20 ` Soma Das
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox