public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Wei Gao via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v1] swapoff01.c: Adjust blocks size base on pagesize
Date: Wed, 21 Feb 2024 23:41:19 -0500	[thread overview]
Message-ID: <20240222044119.28500-1-wegao@suse.com> (raw)

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

             reply	other threads:[~2024-02-22  4:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22  4:41 Wei Gao via ltp [this message]
2024-02-22  7:57 ` [LTP] [PATCH v1] swapoff01.c: Adjust blocks size base on pagesize 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

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=20240222044119.28500-1-wegao@suse.com \
    --to=ltp@lists.linux.it \
    --cc=wegao@suse.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