Skip to content

inode01: Configure 4KB cluster size on exfat to prevent ENOSPC - #1340

Open
kinshu-mangal wants to merge 1 commit into
linux-test-project:masterfrom
kinshu-mangal:fix-inode01-exfat-4k
Open

inode01: Configure 4KB cluster size on exfat to prevent ENOSPC#1340
kinshu-mangal wants to merge 1 commit into
linux-test-project:masterfrom
kinshu-mangal:fix-inode01-exfat-4k

Conversation

@kinshu-mangal

@kinshu-mangal kinshu-mangal commented Aug 18, 2026

Copy link
Copy Markdown

In the multi-process scenario, inode01 creates 10,920 objects (files and directories) across 5 parallel workers.

On Android, mkfs.exfat (exfatprogs) defaults to a 128KB cluster size on volumes <= 32GB. On a 512MB test volume, this provides only 4,080 clusters, causing the test to run out of clusters and fail with ENOSPC.

Fix this by configuring exfat to format with a 4KB cluster size (-c 4K) via the struct tst_fs mkfs_opts field.

@kinshu-mangal

kinshu-mangal commented Aug 18, 2026

Copy link
Copy Markdown
Author

@pevik @metan-ucw Hi! This fixes an ENOSPC failure when running inode01 on exfat filesystems formatted by exfatprogs.

exfatprogs defaults to a 128KB cluster size on volumes <= 32GB, which leaves only 4,080 clusters on a 512MB test device (failing inode01's 10,920 file creation). Explicitly setting -c 4K in .mkfs_opts prevents this. Thanks!

@Avinesh

Avinesh commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Hi @kinshu-mangal , I had tried to address this issue here by changing dev_min_size to fit the 32K clusters exfat normally picks for a volume this size. Probably I should have changed it to 255M instead to make cluster size default to 4KB (https://github.com/exfatprogs/exfatprogs/blob/8b427483164888f0a5af5e4ba92da4981f1094e2/lib/libexfat.c#L203)

Anyway, your fix looks like the better approach.
But I wonder why with 512M volume, cluster size is defaulting to 128KB instead of 32KB on android.

In the multi-process scenario, inode01 creates tens of thousands of
objects (files and directories) across 5 parallel workers.

mkfs.exfat (exfatprogs) defaults to a 32KB cluster size on a 512MB
test volume (256MB < size <= 32GB). This provides only ~16,000 clusters,
causing the test to run out of clusters and fail with ENOSPC.

Fix this by configuring exfat to format with a 4KB cluster size (-c 4K)
via the struct tst_fs mkfs_opts field, providing ~130,000 clusters.

Signed-off-by: Kinshu Agrawal <kinshu@google.com>
@kinshu-mangal

Copy link
Copy Markdown
Author

Hi @Avinesh, thank you for the review!

You are completely right—on Android (using standard exfatprogs), exfat_set_default_cluster_size() also selects 32KB clusters for a 512MB volume (256MB < size <= 32GB). Mentioning 128KB in the commit message was a typo on my part.

Even with the 32KB default, a 512MB volume only provides ~16,000 clusters. In tcases[1] ("parallel larger trees" with depth = 6, fanout = 6, workers = 5), the test creates tens of thousands of objects across the 5 workers. Since every file and directory in exFAT consumes at least one whole cluster (32KB), the 16,000 clusters are quickly exhausted, triggering ENOSPC.

Setting -c 4K provides ~130,000 clusters (an 8x increase), allowing all parallel trees to fit cleanly.

I have updated the commit message to correct the 32KB default description!

pevik referenced this pull request Aug 19, 2026
…ario

The parallel scenario keeps every worker's tree on the device at the same
time. On exfat each object costs a full cluster and mkfs.exfat defaults to
32K cluster size for a volume above 256M, causing ENOSPC on a 300M device.
Increase the dev_min_size to 512M.

tst_test.c:1985: TINFO: === Testing on exfat ===
tst_test.c:1291: TINFO: Formatting /dev/loop0 with exfat opts='' extra opts=''
tst_test.c:1303: TINFO: Mounting /dev/loop0 to /var/tmp/LTP_inoLqT9T5/mntpoint fstyp=exfat 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.5827
inode01.c:241: TINFO: Testing parallel larger trees (depth=6 fanout=6 repetitions=8 workers=5)
inode01.c:61: TBROK: write(3,0x7ffcea2c2370,73) failed: ENOSPC (28)
tst_test.c:478: TINFO: Child process reported TBROK killing the test
inode01.c:64: TBROK: mkdir(mntpoint/inode.5832/00001457/00001701/00001862/00001890/00001907/00001911, 0777) failed: ENOSPC (28)

Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com>
Fixes: 8ea9553 ("inode: convert to new API and merge into a single test")
Signed-off-by: Avinesh Kumar <avinesh.kumar@suse.com>
Link: https://lore.kernel.org/20260730134102.132477-1-avinesh.kumar@suse.com
@pevik

pevik commented Aug 19, 2026

Copy link
Copy Markdown
Member
Reviewed-by: Petr Vorel <pvorel@suse.cz>

LGTM. I see a small issue with formatting with non-default option, but we can hardly do anything about it.

@kinshu-mangal

Copy link
Copy Markdown
Author

Thank you @pevik for the review and approval!

@pevik

pevik commented Aug 19, 2026

Copy link
Copy Markdown
Member

@kinshu-mangal FYI (as noted in PR) LTP is really mail based project, if you can, please send next patches on LTP ML.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants