]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
mkfs: use a sensible log sector size default
authorChristoph Hellwig <hch@lst.de>
Mon, 15 Apr 2024 23:07:47 +0000 (16:07 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 17 Apr 2024 21:06:27 +0000 (14:06 -0700)
Currently the XFS log sector size defaults to the 512 bytes unless
explicitly overriden.  Default to the device logical block size queried
by get_topology instead.  If that is also 512 nothing changes, and if
the device logical block size is larger this prevents a mkfs failure
because the libxfs buffer cache blows up and as we obviously can't
use a smaller than hardware supported sector size.  This fixes xfs/157
with a 4k block size device.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Tested-by: Pankaj Raghav <p.raghav@samsung.com>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
mkfs/xfs_mkfs.c

index 79d6eaa37a1a824fc5abb2f31f0ef5e9d578256e..18084b1cc6d1342ec5000ef136e4f978a0abca86 100644 (file)
@@ -2075,7 +2075,8 @@ static void
 validate_log_sectorsize(
        struct mkfs_params      *cfg,
        struct cli_params       *cli,
-       struct mkfs_default_params *dft)
+       struct mkfs_default_params *dft,
+       struct fs_topology      *ft)
 {
 
        if (cli->loginternal && cli->lsectorsize &&
@@ -2090,7 +2091,7 @@ _("Can't change sector size on internal log!\n"));
        else if (cli->loginternal)
                cfg->lsectorsize = cfg->sectorsize;
        else
-               cfg->lsectorsize = dft->sectorsize;
+               cfg->lsectorsize = ft->log.logical_sector_size;
        cfg->lsectorlog = libxfs_highbit32(cfg->lsectorsize);
 
        if (cfg->lsectorsize < XFS_MIN_SECTORSIZE ||
@@ -4206,7 +4207,7 @@ main(
        blocksize = cfg.blocksize;
        sectorsize = cfg.sectorsize;
 
-       validate_log_sectorsize(&cfg, &cli, &dft);
+       validate_log_sectorsize(&cfg, &cli, &dft, &ft);
        validate_sb_features(&cfg, &cli);
 
        /*