Linux Test Project
 help / color / mirror / Atom feed
From: Wake Liu via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Cc: Wake Liu <wakel@google.com>
Subject: [LTP] [PATCH 1/2] swapoff01: Create 64MB swapfile instead of 65536 blocks
Date: Mon, 23 Nov 2026 12:36:24 +0000	[thread overview]
Message-ID: <20261123123626.1499705-1-wakel@google.com> (raw)

Before commit 6249e87b5fcf ("libswap: customize swapfile size"),
swapoff01 created a 64MB swapfile (65536 * 1024 bytes). Converting that
count directly to filesystem blocks made the swapfile size scale with
f_bsize: 256MB on 4KB filesystems (requiring .dev_min_size = 350), 1GiB
on 16KB block filesystems, 2GiB on exfat (32KB clusters on a 350MB loop
device), and 4GiB on 64KB block filesystems, exceeding the loop backing
device and failing with TCONF.

Use SAFE_MAKE_SWAPFILE_SIZE(SWAP_FILE, 64) to restore a fixed 64MB
swapfile independent of filesystem block size, and drop the now
unnecessary .dev_min_size = 350 override since 64MB fits comfortably in
the default 300MB loop device.

Fixes: 6249e87b5fcf ("libswap: customize swapfile size")
Signed-off-by: Wake Liu <wakel@google.com>
---
 testcases/kernel/syscalls/swapoff/swapoff01.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/swapoff/swapoff01.c b/testcases/kernel/syscalls/swapoff/swapoff01.c
index 065b5edbc..781fe75d6 100644
--- a/testcases/kernel/syscalls/swapoff/swapoff01.c
+++ b/testcases/kernel/syscalls/swapoff/swapoff01.c
@@ -41,13 +41,12 @@ static void verify_swapoff(void)
 static void setup(void)
 {
 	is_swap_supported(TEST_FILE);
-	SAFE_MAKE_SWAPFILE_BLKS(SWAP_FILE, 65536);
+	SAFE_MAKE_SWAPFILE_SIZE(SWAP_FILE, 64);
 }
 
 static struct tst_test test = {
 	.mntpoint = MNTPOINT,
 	.mount_device = 1,
-	.dev_min_size = 350,
 	.all_filesystems = 1,
 	.needs_root = 1,
 	.test_all = verify_swapoff,
-- 
2.56.1.750.gf70dc682cf-goog


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2026-11-23 12:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 12:36 Wake Liu via ltp [this message]
2026-11-23 12:36 ` [LTP] [PATCH 2/2] tse_swap: Stat target directory instead of "." in make_swapfile() Wake Liu via ltp
2026-11-23 20:38 ` [LTP] swapoff01: Create 64MB swapfile instead of 65536 blocks linuxtestproject.agent

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261123123626.1499705-1-wakel@google.com \
    --to=ltp@lists.linux.it \
    --cc=wakel@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox