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 2/4] libxfs: cleanup get_topology
Date: Wed, 29 Oct 2025 08:39:21 -0700 [thread overview]
Message-ID: <20251029153921.GY3356773@frogsfrogsfrogs> (raw)
In-Reply-To: <20251029090737.1164049-3-hch@lst.de>
On Wed, Oct 29, 2025 at 10:07:30AM +0100, Christoph Hellwig wrote:
> Add a libxfs_ prefix to the name, clear the structure in the helper
> instead of in the callers, and use a bool to pass a boolean argument.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks good,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> libxfs/topology.c | 9 +++++----
> libxfs/topology.h | 7 ++-----
> mkfs/xfs_mkfs.c | 3 +--
> repair/sb.c | 3 +--
> 4 files changed, 9 insertions(+), 13 deletions(-)
>
> diff --git a/libxfs/topology.c b/libxfs/topology.c
> index 7764687beac0..366165719c84 100644
> --- a/libxfs/topology.c
> +++ b/libxfs/topology.c
> @@ -224,7 +224,7 @@ static void
> blkid_get_topology(
> const char *device,
> struct device_topology *dt,
> - int force_overwrite)
> + bool force_overwrite)
> {
> blkid_topology tp;
> blkid_probe pr;
> @@ -317,7 +317,7 @@ static void
> get_device_topology(
> struct libxfs_dev *dev,
> struct device_topology *dt,
> - int force_overwrite)
> + bool force_overwrite)
> {
> struct stat st;
>
> @@ -364,11 +364,12 @@ get_device_topology(
> }
>
> void
> -get_topology(
> +libxfs_get_topology(
> struct libxfs_init *xi,
> struct fs_topology *ft,
> - int force_overwrite)
> + bool force_overwrite)
> {
> + memset(ft, 0, sizeof(*ft));
> get_device_topology(&xi->data, &ft->data, force_overwrite);
> get_device_topology(&xi->rt, &ft->rt, force_overwrite);
> get_device_topology(&xi->log, &ft->log, force_overwrite);
> diff --git a/libxfs/topology.h b/libxfs/topology.h
> index f0ca65f3576e..3688d56b542f 100644
> --- a/libxfs/topology.h
> +++ b/libxfs/topology.h
> @@ -25,11 +25,8 @@ struct fs_topology {
> struct device_topology log;
> };
>
> -void
> -get_topology(
> - struct libxfs_init *xi,
> - struct fs_topology *ft,
> - int force_overwrite);
> +void libxfs_get_topology(struct libxfs_init *xi, struct fs_topology *ft,
> + bool force_overwrite);
>
> extern void
> calc_default_ag_geometry(
> diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
> index 3ccd37920321..0ba7798eccf6 100644
> --- a/mkfs/xfs_mkfs.c
> +++ b/mkfs/xfs_mkfs.c
> @@ -2395,8 +2395,7 @@ validate_sectorsize(
> 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);
> + libxfs_get_topology(cli->xi, ft, force_overwrite);
>
> /* set configured sector sizes in preparation for checks */
> if (!cli->sectorsize) {
> diff --git a/repair/sb.c b/repair/sb.c
> index 0e4827e04678..ee1cc63fae64 100644
> --- a/repair/sb.c
> +++ b/repair/sb.c
> @@ -184,8 +184,7 @@ guess_default_geometry(
> uint64_t dblocks;
> int multidisk;
>
> - memset(&ft, 0, sizeof(ft));
> - get_topology(x, &ft, 1);
> + libxfs_get_topology(x, &ft, true);
>
> /*
> * get geometry from get_topology result.
> --
> 2.47.3
>
>
next prev parent reply other threads:[~2025-10-29 15:39 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
2025-10-29 9:07 ` [PATCH 2/4] libxfs: cleanup get_topology Christoph Hellwig
2025-10-29 15:39 ` Darrick J. Wong [this message]
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=20251029153921.GY3356773@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