]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
mkfs: simplify the default log size ratio computation
authorDarrick J. Wong <djwong@kernel.org>
Fri, 11 Mar 2022 01:34:24 +0000 (17:34 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 17 Mar 2022 21:40:26 +0000 (14:40 -0700)
Now that the minimum default log size is 64MB, we can simplify the ratio
computation because the alternate calculations no longer matter:

fssize oldlogsize newlogsize
16m 3m 3m
256m 5m 64m
512m 5m 64m
1g 10m 64m
4g 10m 64m
8g 10m 64m
16g 10m 64m
32g 16m 64m
64g 32m 64m
128g 64m 64m
220g 110m 110m
256g 128m 128m
512g 256m 256m
1t 512m 512m
10t 2038m 2038m

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
mkfs/xfs_mkfs.c

index 239d529c5cc522f3865778d99dc88c25ca47ad18..15dcf48a03a01c011f6557401c2ea58ad83cdf51 100644 (file)
@@ -3432,28 +3432,14 @@ _("external log device size %lld blocks too small, must be at least %lld blocks\
 
        /* internal log - if no size specified, calculate automatically */
        if (!cfg->logblocks) {
-               if (cfg->dblocks < GIGABYTES(1, cfg->blocklog)) {
-                       /* tiny filesystems get minimum sized logs. */
-                       cfg->logblocks = min_logblocks;
-               } else if (cfg->dblocks < GIGABYTES(16, cfg->blocklog)) {
-
-                       /*
-                        * For small filesystems, we want to use the
-                        * XFS_MIN_LOG_BYTES for filesystems smaller than 16G if
-                        * at all possible, ramping up to 128MB at 256GB.
-                        */
-                       cfg->logblocks = min(XFS_MIN_LOG_BYTES >> cfg->blocklog,
-                                       min_logblocks * XFS_DFL_LOG_FACTOR);
-               } else {
-                       /*
-                        * With a 2GB max log size, default to maximum size
-                        * at 4TB. This keeps the same ratio from the older
-                        * max log size of 128M at 256GB fs size. IOWs,
-                        * the ratio of fs size to log size is 2048:1.
-                        */
-                       cfg->logblocks = (cfg->dblocks << cfg->blocklog) / 2048;
-                       cfg->logblocks = cfg->logblocks >> cfg->blocklog;
-               }
+               /*
+                * With a 2GB max log size, default to maximum size at 4TB.
+                * This keeps the same ratio from the older max log size of
+                * 128M at 256GB fs size. IOWs, the ratio of fs size to log
+                * size is 2048:1.
+                */
+               cfg->logblocks = (cfg->dblocks << cfg->blocklog) / 2048;
+               cfg->logblocks = cfg->logblocks >> cfg->blocklog;
 
                calc_realistic_log_size(cfg);