public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v1] swapoff01.c: Adjust blocks size base on pagesize
@ 2024-02-22  4:41 Wei Gao via ltp
  2024-02-22  7:57 ` Li Wang
  2024-02-22  8:39 ` Cyril Hrubis
  0 siblings, 2 replies; 8+ messages in thread
From: Wei Gao via ltp @ 2024-02-22  4:41 UTC (permalink / raw)
  To: ltp

The make_swapfile function will encounter no space error if pagesize
is bigger then 4096, such as ppc64 system use default pagesize 65535.

Signed-off-by: Wei Gao <wegao@suse.com>
---
 testcases/kernel/syscalls/swapoff/swapoff01.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/swapoff/swapoff01.c b/testcases/kernel/syscalls/swapoff/swapoff01.c
index c303588df..71d6c6c04 100644
--- a/testcases/kernel/syscalls/swapoff/swapoff01.c
+++ b/testcases/kernel/syscalls/swapoff/swapoff01.c
@@ -44,7 +44,12 @@ static void setup(void)
 {
 	is_swap_supported(TEST_FILE);
 
-	if (make_swapfile(SWAP_FILE, 65536, 1))
+	int blocks = 65535;
+
+	if (getpagesize() > 4096)
+		blocks = 65535 * 4096 / getpagesize();
+
+	if (make_swapfile(SWAP_FILE, blocks, 1))
 		tst_brk(TBROK, "Failed to create file for swap");
 }
 
-- 
2.35.3


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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-02-23  8:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-22  4:41 [LTP] [PATCH v1] swapoff01.c: Adjust blocks size base on pagesize Wei Gao via ltp
2024-02-22  7:57 ` Li Wang
2024-02-22 13:46   ` Wei Gao via ltp
2024-02-22  8:39 ` Cyril Hrubis
2024-02-22 13:37   ` Wei Gao via ltp
2024-02-22 13:50     ` Cyril Hrubis
2024-02-23  4:11     ` Li Wang
2024-02-23  8:32       ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox