All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Gaurav Pathak <gpathak@suse.de>
Cc: Gaurav Pathak <gaurav.pathak@suse.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] syscalls/statx13: Add basic test for STATX_WRITE_ATOMIC on regular file
Date: Thu, 17 Sep 2026 16:23:45 +0200	[thread overview]
Message-ID: <20260917142345.GB1856601@pevik> (raw)
In-Reply-To: <20260917105304.9674-1-gpathak@suse.de>

Hi all,

> This patch adds a new test to validate these atomic write limit fields.
> The test ensures the filesystem correctly advertises the STATX_ATTR_WRITE_ATOMIC
> attribute when queried on a file opened with O_DIRECT. It also verifies that the
> reported optimized maximum is logically consistent by falling within the
> absolute minimum and maximum boundaries. Furthermore, it checks that all
> reported atomic write unit sizes are valid powers of two, adhering to the strict
> requirements of the kernel block layer.

> If the underlying storage hardware or filesystem lacks atomic write
> support, the test gracefully skips with TCONF.

> Fixes: #1224
...
> diff --git a/testcases/kernel/syscalls/statx/statx13.c b/testcases/kernel/syscalls/statx/statx13.c
> new file mode 100644
> index 000000000..ea42a102c
> --- /dev/null
> +++ b/testcases/kernel/syscalls/statx/statx13.c
...
> +#ifdef HAVE_STRUCT_STATX_STX_ATOMIC_WRITE_UNIT_MAX_OPT
Looking at this, I wonder why this and also older statx10.c, statx11.c does not
use ltp_statx added by Andrea in d89a232a7b ("Add SAFE_STATX macro")

Kind regards,
Petr

> +	if (buff.stx_atomic_write_unit_max_opt == 0) {
> +		tst_res(TINFO, "stx_atomic_write_unit_max_opt is 0 (no optimized max reported)");
> +	} else {
> +		if (buff.stx_atomic_write_unit_max_opt > buff.stx_atomic_write_unit_max)
> +			tst_res(TFAIL, "stx_atomic_write_unit_max_opt (%u) exceeds max (%u)",
> +					buff.stx_atomic_write_unit_max_opt,
> +					buff.stx_atomic_write_unit_max);
> +
> +		else if (buff.stx_atomic_write_unit_max_opt < buff.stx_atomic_write_unit_min)
> +			tst_res(TFAIL, "stx_atomic_write_unit_max_opt (%u) is less than min (%u)",
> +					buff.stx_atomic_write_unit_max_opt,
> +					buff.stx_atomic_write_unit_min);
> +		else
> +			tst_res(TPASS, "stx_atomic_write_unit_max_opt (%u) is within valid range [%u, %u]",
> +					buff.stx_atomic_write_unit_max_opt,
> +					buff.stx_atomic_write_unit_min,
> +					buff.stx_atomic_write_unit_max);
> +
> +		if (__builtin_popcount(buff.stx_atomic_write_unit_max_opt) != 1)
> +			tst_res(TFAIL, "stx_atomic_write_unit_max_opt (%u) is not a power of 2",
> +					buff.stx_atomic_write_unit_max_opt);
> +	}
> +#else
> +	tst_res(TCONF, "stx_atomic_write_unit_max_opt is not defined in struct statx");
> +#endif
> +}

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

  parent reply	other threads:[~2026-09-17 14:24 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17  2:56 [LTP] [PATCH] syscalls/statx13: Add basic test for STATX_WRITE_ATOMIC on regular file Gaurav Pathak
2026-09-17 10:53 ` Gaurav Pathak
2026-09-17 11:17   ` [LTP] " linuxtestproject.agent
2026-09-17 14:19   ` [LTP] [PATCH] " Petr Vorel
2026-09-18 11:04     ` gpathak
2026-09-17 14:23   ` Petr Vorel [this message]
2026-09-18 11:12     ` [LTP] [PATCH v3] " Gaurav Pathak
2026-09-18 12:51       ` [LTP] " linuxtestproject.agent
2026-10-05 13:18         ` Andrea Cervesato via ltp
2026-10-08 14:26   ` [LTP] [PATCH] " Andrea Cervesato via ltp
2026-09-17 11:15 ` [LTP] " linuxtestproject.agent
2026-10-12  7:23   ` [LTP] [PATCH v4 0/1] " Gaurav Pathak
2026-10-12  7:23     ` [LTP] [PATCH v4 1/1] " Gaurav Pathak
2026-10-12 12:43       ` Andrea Cervesato via ltp
2026-10-13  9:07         ` [LTP] [PATCH v5] " Gaurav Pathak
2026-10-13 11:27           ` [LTP] " 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=20260917142345.GB1856601@pevik \
    --to=pvorel@suse.cz \
    --cc=gaurav.pathak@suse.com \
    --cc=gpathak@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.