From: Li Wang <li.wang@linux.dev>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: Linux Test Project <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v2 2/3] swapon04: Add test for discard flags
Date: Fri, 28 Aug 2026 17:37:49 +0800 [thread overview]
Message-ID: <apFW1UGbwKuhPyoU@linux.dev> (raw)
In-Reply-To: <20260828-swapon_discard_coverage-v2-2-e55a86dad729@suse.com>
Andrea Cervesato wrote:
> +static void verify_swapon(unsigned int n)
> +{
> + struct tcase *tc = &tcases[n];
> + int fd;
> + struct stat st;
> + blkcnt_t blocks_before, blocks_after;
> + const char *const mkswap_argv[] = {"mkswap", loop_dev, NULL};
> +
> + tst_res(TINFO, "Testing swapon(%s, %s)", loop_dev, tc->desc);
> +
> + tst_fill_file(BACKING_FILE, 'A', TST_MB, SWAP_SIZE_MB);
> +
Or, we need to confirm with an XFS developer/expert whether this
should be treated as a minor bug or is worth fixing on 6.6.
If not, then the code comment below is needed.
/*
* Flush the backing file to disk before formatting it with mkswap.
* XFS uses delayed allocation, and without fsync the blocks written
* by tst_fill_file() may remain as unwritten extents in page cache.
* If swapon(2) with SWAP_FLAG_DISCARD is called while such extents
* are still pending, the discard request may not cover the whole
* swap area, causing the test to fail spuriously.
*
* This is especially visible on kernel 6.6, where the XFS/swap
* discard path does not force delalloc extents to be resolved.
*/
> + fd = SAFE_OPEN(BACKING_FILE, O_RDONLY);
> + SAFE_FSYNC(fd);
> + SAFE_CLOSE(fd);
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-08-28 9:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 9:05 [LTP] [PATCH v2 0/3] Increase coverage for swapon syscall Andrea Cervesato
2026-08-28 9:05 ` [LTP] [PATCH v2 1/3] lapi: fallback definitions " Andrea Cervesato
2026-08-28 9:46 ` [LTP] " linuxtestproject.agent
2026-08-28 11:07 ` Andrea Cervesato via ltp
2026-08-28 9:05 ` [LTP] [PATCH v2 2/3] swapon04: Add test for discard flags Andrea Cervesato
2026-08-28 9:37 ` Li Wang [this message]
2026-08-28 9:05 ` [LTP] [PATCH v2 3/3] swapon02: Add test cases for invalid swapflags Andrea Cervesato
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=apFW1UGbwKuhPyoU@linux.dev \
--to=li.wang@linux.dev \
--cc=andrea.cervesato@suse.de \
--cc=ltp@lists.linux.it \
/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