]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
mkfs: autodetect log stripe unit for external log devices
authorDarrick J. Wong <djwong@kernel.org>
Tue, 1 Jul 2025 17:45:14 +0000 (10:45 -0700)
committerAndrey Albershteyn <aalbersh@kernel.org>
Fri, 18 Jul 2025 14:05:10 +0000 (16:05 +0200)
If we're using an external log device and the caller doesn't give us a
lsunit, use the block device geometry (if present) to set it.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: John Garry <john.g.garry@oracle.com>
mkfs/xfs_mkfs.c

index 8b946f3ef817da7c5b50751ab86872b8734793b5..b6de13cebc93ed90f85ee0d9f268d93332c8bef2 100644 (file)
@@ -3615,7 +3615,8 @@ _("log stripe unit (%d) must be a multiple of the block size (%d)\n"),
        }
 
        /*
-        * check that log sunit is modulo fsblksize or default it to dsunit.
+        * check that log sunit is modulo fsblksize; default it to dsunit for
+        * an internal log; or the log device stripe unit if it's external.
         */
        if (lsunit) {
                /* convert from 512 byte blocks to fs blocks */
@@ -3624,6 +3625,10 @@ _("log stripe unit (%d) must be a multiple of the block size (%d)\n"),
                   cfg->loginternal && cfg->dsunit) {
                /* lsunit and dsunit now in fs blocks */
                cfg->lsunit = cfg->dsunit;
+       } else if (cfg->sb_feat.log_version == 2 &&
+                  !cfg->loginternal) {
+               /* use the external log device properties */
+               cfg->lsunit = DTOBT(ft->log.sunit, cfg->blocklog);
        }
 
        if (cfg->sb_feat.log_version == 2 &&