[LTP] [PATCH v1] swapoff01.c: Adjust blocks size base on pagesize
Li Wang
liwang@redhat.com
Thu Feb 22 08:57:57 CET 2024
On Thu, Feb 22, 2024 at 12:41 PM Wei Gao via ltp <ltp@lists.linux.it> wrote:
> The make_swapfile function will encounter no space error if pagesize
> is bigger then 4096, such as ppc64 system use default pagesize 65535.
>
What erros does it shows in the log?
I can't reproduce this on my aarch64 (pagesize == 65536).
Seems the '.dev_min_size = 350' is large enough for testing.
>
> 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
>
>
--
Regards,
Li Wang
More information about the ltp
mailing list