Re: [PATCH v2] exfat: speed up file creation in large directories
From: Namjae Jeon
Date: Tue Sep 01 2026 - 20:41:11 EST
> Test environment:
> QEMU TCG multi-thread, 4 vCPUs, 6 GiB RAM
> 4 GiB exFAT image, 32 KiB clusters
>
> Test script:
> mount -t exfat /dev/vda /mnt/test
> time sh -c '
> i=0
> while [ "$i" -lt 20000 ]; do
> : > "/mnt/test/f.$i" || exit 1
> i=$((i + 1))
> done
> '
>
> The measured results were:
>
> Before After
> real 589.48 s 5.33 s
> user 4.72 s 2.28 s
> sys 584.63 s 3.03 s
>
> The elapsed time was reduced by 99.10%, from 589.48 seconds to
> 5.33 seconds, corresponding to a 110.6-fold speedup.
Looks great!
> + for (len = 0; len < MAX_NAME_LENGTH && name.name[len]; len++)
> + ;
> + if (!len || len == MAX_NAME_LENGTH)
> + goto abort;
exfat allows filenames with 255 UTF16 code units, but this check
aborts filter construction. Any reason ?
> @@ -627,7 +666,8 @@ static int exfat_find(struct inode *dir, const struct qstr *qname,
> ei->hint_stat.clu = cdir.dir;
> ei->hint_stat.eidx = 0;
> ei->version = (inode_peek_iversion_raw(dir) & 0xffffffff);
> - ei->hint_femp.eidx = EXFAT_HINT_NONE;
> + if (!ei->name_filter)
> + ei->hint_femp.eidx = EXFAT_HINT_NONE;
There is no path that moves this hint backwards. exfat_unlink(),
exfat_rmdir(), __exfat_rename(), and the rollback path in
exfat_add_entry() free entries without updating ei->hint_femp. So,
exfat_find_empty_entry() can keep searching from a stale hint and
never reuse earlier holes. Repeated create/unlink operations may grow
the directory until MAX_EXFAT_DENTRIES.