Skip to contentSkip to conversation

reduce directory scans during file creation

PATCH Superseded Yang Wen 1 participant 1 message Jun 10 VFS

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Yang Wen

author
#0 lore raw

cover reduce directory scans during file creation

Creating files in a large exfat directory may require repeated linear directory scans.

First, a negative dentry obtained by an existence check is currently invalidated for LOOKUP_CREATE. The subsequent create operation therefore looks up the same name again, even though exfat does not generate FAT-style 8.3 aliases.

Second, after an empty-entry hint is used successfully, the remaining contiguous empty entries are not retained for the next create operation. This can cause subsequent operations to rediscover available directory space.

This series makes the following changes:

1. Reuse a valid negative dentry for LOOKUP_CREATE when the parent directory version has not changed.
2. Advance and preserve the empty-entry hint after directory entries have been allocated.

In a test creating 20,000 files with random names and sizes between 1 KiB and 4 KiB in one directory, the elapsed time changed as follows:

Before: 3879 seconds
After: 3050 seconds

Yang Wen (2):
exfat: reuse valid negative dentries for file creation preserve the next empty-entry hint after allocation

 fs/exfat/namei.c | 56 ++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 47 insertions(+), 9 deletions(-)
Signature · 1 line
2.34.1