From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Andrey Albershteyn <aalbersh@kernel.org>, linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/4] mkfs: move clearing LIBXFS_DIRECT into check_device_type
Date: Wed, 29 Oct 2025 08:38:23 -0700 [thread overview]
Message-ID: <20251029153823.GX3356773@frogsfrogsfrogs> (raw)
In-Reply-To: <20251029090737.1164049-2-hch@lst.de>
On Wed, Oct 29, 2025 at 10:07:29AM +0100, Christoph Hellwig wrote:
> Keep it close to the block device vs regular file logic and remove
> the checks for each device in the caller.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
I guess it makes sense to move the clearing of LIBXFS_DIRECT to where we
determine that one of the device paths pointed to a regular file...
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> mkfs/xfs_mkfs.c | 27 ++++++++++++++-------------
> 1 file changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> index cb7c20e3aa18..3ccd37920321 100644
> --- a/mkfs/xfs_mkfs.c
> +++ b/mkfs/xfs_mkfs.c
> @@ -1330,6 +1330,7 @@ nr_cpus(void)
>
> static void
> check_device_type(
> + struct cli_params *cli,
> struct libxfs_dev *dev,
> bool no_size,
> bool dry_run,
> @@ -1375,6 +1376,13 @@ check_device_type(
> dev->isfile = 1;
> else if (!dry_run)
> dev->create = 1;
> +
> + /*
> + * Explicitly disable direct IO for image files so we don't
> + * error out on sector size mismatches between the new
> + * filesystem and the underlying host filesystem.
> + */
> + cli->xi->flags &= ~LIBXFS_DIRECT;
> return;
> }
>
> @@ -2378,21 +2386,14 @@ validate_sectorsize(
> * Before anything else, verify that we are correctly operating on
> * files or block devices and set the control parameters correctly.
> */
> - check_device_type(&cli->xi->data, !cli->dsize, dry_run, "data", "d");
> + check_device_type(cli, &cli->xi->data, !cli->dsize, dry_run,
> + "data", "d");
> if (!cli->loginternal)
> - check_device_type(&cli->xi->log, !cli->logsize, dry_run, "log",
> - "l");
> + check_device_type(cli, &cli->xi->log, !cli->logsize, dry_run,
> + "log", "l");
> if (cli->xi->rt.name)
> - check_device_type(&cli->xi->rt, !cli->rtsize, dry_run, "RT",
> - "r");
> -
> - /*
> - * Explicitly disable direct IO for image files so we don't error out on
> - * sector size mismatches between the new filesystem and the underlying
> - * host filesystem.
> - */
> - if (cli->xi->data.isfile || cli->xi->log.isfile || cli->xi->rt.isfile)
> - cli->xi->flags &= ~LIBXFS_DIRECT;
> + check_device_type(cli, &cli->xi->rt, !cli->rtsize, dry_run,
> + "RT", "r");
>
> memset(ft, 0, sizeof(*ft));
> get_topology(cli->xi, ft, force_overwrite);
> --
> 2.47.3
>
>
next prev parent reply other threads:[~2025-10-29 15:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-29 9:07 improve the discard / reset zones code in mkfs Christoph Hellwig
2025-10-29 9:07 ` [PATCH 1/4] mkfs: move clearing LIBXFS_DIRECT into check_device_type Christoph Hellwig
2025-10-29 15:38 ` Darrick J. Wong [this message]
2025-10-29 9:07 ` [PATCH 2/4] libxfs: cleanup get_topology Christoph Hellwig
2025-10-29 15:39 ` Darrick J. Wong
2025-10-29 9:07 ` [PATCH 3/4] mkfs: remove duplicate struct libxfs_init arguments Christoph Hellwig
2025-10-29 15:39 ` Darrick J. Wong
2025-10-29 9:07 ` [PATCH 4/4] mkfs: split zone reset from discard Christoph Hellwig
2025-10-29 15:40 ` Darrick J. Wong
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=20251029153823.GX3356773@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=aalbersh@kernel.org \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/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