Skip to contentSkip to conversation

inode01: Drop redundant 512MB dev_min_size requirement

PATCH In review Wake Liu via ltp 2 participants 5 messages Nov 17 – Nov 19

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 inode01: Drop redundant 512MB dev_min_size requirement

Commit ecf418722780 ("inode01: increase dev_min_size to fit the peak usage in parallel scenario") raised dev_min_size from the default 300MB to 512MB because mkfs.exfat defaulted to a 32KB cluster size on volumes larger than 256MB, providing only ~9,600 clusters on a 300MB device for the ~10,925 objects created across the 5 parallel workers.

Subsequently, commit 4bf4da8c6fda ("inode01: Configure 4KB cluster size on exfat to prevent ENOSPC") explicitly configured mkfs.exfat with a 4KB cluster size (-c 4K). With 4KB clusters, the 10,925 objects consume under 50MB at peak, and the default 300MB loop device provides ~76,800 clusters on exfat, which is more than sufficient for all supported filesystems.

Drop the redundant .dev_min_size = 512 setting so inode01 uses the default 300MB device size and avoids unnecessary ENOSPC failures when allocating the loop backing file on storage-constrained systems.

---
 testcases/kernel/fs/inode/inode01.c | 1 -
 1 file changed, 1 deletion(-)
testcases/kernel/fs/inode/inode01.c +0 -1
index e7190fc99..09e0e9da0 100644
@@ -260,7 +260,6 @@ static struct tst_test test = {
 		{}
 	},
 	.needs_root = 1,
-	.dev_min_size = 512,
 	.forks_child = 1,
 	.needs_checkpoints = 1,
 	.timeout = 300,
Signature · 5 lines
2.56.0.679.gc527c65306-goog


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
In reply to Wake Liu via ltp

Hi,

Quoted 27 lines · Wake Liu via ltp

Commit ecf418722780 ("inode01: increase dev_min_size to fit the peak usage in parallel scenario") raised dev_min_size from the default 300MB to 512MB because mkfs.exfat defaulted to a 32KB cluster size on volumes larger than 256MB, providing only ~9,600 clusters on a 300MB device for the ~10,925 objects created across the 5 parallel workers.

Subsequently, commit 4bf4da8c6fda ("inode01: Configure 4KB cluster size on exfat to prevent ENOSPC") explicitly configured mkfs.exfat with a 4KB cluster size (-c 4K). With 4KB clusters, the 10,925 objects consume under 50MB at peak, and the default 300MB loop device provides ~76,800 clusters on exfat, which is more than sufficient for all supported filesystems.

Drop the redundant .dev_min_size = 512 setting so inode01 uses the default 300MB device size and avoids unnecessary ENOSPC failures when allocating the loop backing file on storage-constrained systems.

---
  testcases/kernel/fs/inode/inode01.c | 1 -
  1 file changed, 1 deletion(-)
testcases/kernel/fs/inode/inode01.c +0 -0
index e7190fc99..09e0e9da0 100644

testcases/kernel/fs/inode/inode01.c static struct tst_test test = { · line 265

Quoted 7 lines
testcases/kernel/fs/inode/inode01.c +0 -1
@@ -260,7 +260,6 @@ static struct tst_test test = {
              {}
      },
      .needs_root = 1,
-     .dev_min_size = 512,
      .forks_child = 1,
      .needs_checkpoints = 1,
      .timeout = 300,

Unfortunately this change breaks things on tmpfs on systems with 64k pagesize, as library sets

        if (!tst_test->dev_min_size)
                tmpfs_size = 32;

tst_test.c:2005: TINFO: === Testing on tmpfs === tst_test.c:1305: TINFO: Skipping mkfs for TMPFS filesystem tst_test.c:1281: TINFO: Limiting tmpfs size to 32MB tst_test.c:1317: TINFO: Mounting ltp-tmpfs to /var/tmp/LTP_inourxWrA/mntpoint fstyp=tmpfs flags=0 inode01.c:241: TINFO: Testing single-process small tree (depth=3 fanout=4 repetitions=100 workers=1)
inode01.c:228: TPASS: Created and verified 28 objects in mntpoint/inode.5861 inode01.c:241: TINFO: Testing parallel larger trees (depth=6 fanout=6 repetitions=8 workers=5)
inode01.c:61: TBROK: write(3,0x7ffffd679118,73) failed: ENOSPC (28)

so either we need to revert this patch or we can do this lib change

(lib/tst_test.c)

- if (!tst_test->dev_min_size)
- tmpfs_size = 32;
- else
+ if (!tst_test->dev_min_size) {
+ /*

+                * tmpfs charges its size in whole pages, so 32MB is only 512
+                * pages with 64kB pages instead of 8192 with 4kB ones. Scale
+                * it to keep the same page budget on every architecture.
+                */
+               tmpfs_size = 32 * MAX(getpagesize() / 4096, 1);
+       } else {
                 tmpfs_size = tdev.size;

+ }

--
Avinesh

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author Reviewed-by Wake Liu
#4 lore raw

Hi Avinesh,

Quoted 4 lines · Avinesh Kumar

Unfortunately this change breaks things on tmpfs on systems with 64k pagesize, as library sets

        if (!tst_test->dev_min_size)
                tmpfs_size = 32;

...

Quoted 7 lines

so either we need to revert this patch or we can do this lib change

(lib/tst_test.c)

(quoted diff) +0 -3
-       if (!tst_test->dev_min_size)
-               tmpfs_size = 32;
-       else

Review

Quoted 10 lines
(quoted diff) +9 -0
+       if (!tst_test->dev_min_size) {
+               /*
+                * tmpfs charges its size in whole pages, so 32MB is only 512
+                * pages with 64kB pages instead of 8192 with 4kB ones. Scale
+                * it to keep the same page budget on every architecture.
+                */
+               tmpfs_size = 32 * MAX(getpagesize() / 4096, 1);
+       } else {
                 tmpfs_size = tdev.size;
+       }

Thanks for catching this!

I agree with updating limit_tmpfs_mount_size() in lib/tst_test.c rather than reverting. Reverting to .dev_min_size = 512 would bring back loop backing file ENOSPC failures on storage-constrained systems (and even .dev_min_size = 300 would only provide 4800 pages with 64kB pages, still short of the 5460 non-empty files created at peak in inode01).

Scaling the default 32MB tmpfs limit by getpagesize() / 4096 keeps a consistent 8192-page budget across 4kB (32MB), 16kB (128MB, which also matters for 16kB-page Android kernels), and 64kB (512MB) systems while preserving the 2x MemAvailable TCONF guard for low-memory machines.

Since the fix and comment are yours, will you be sending this as a formal patch? Feel free to add my:

(Or let me know if you prefer that I send it out with your Suggested-by.)

Thanks,
Wake

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp