2022-11-02 16:11 GMT+09:00, Yuezhang.Mo@xxxxxxxx <Yuezhang.Mo@xxxxxxxx>: > After traversing all directory entries, hint the empty directory > entry no matter whether or not there are enough empty directory > entries. > > After this commit, hint the empty directory entries like this: > > 1. Hint the deleted directory entries if enough; > 2. Hint the deleted and unused directory entries which at the > end of the cluster chain no matter whether enough or not(Add > by this commit); > 3. If no any empty directory entries, hint the empty directory > entries in the new cluster(Add by this commit). > > This avoids repeated traversal of directory entries, reduces CPU > usage, and improves the performance of creating files and > directories(especially on low-performance CPUs). > > Test create 5000 files in a class 4 SD card on imx6q-sabrelite > with: > > for ((i=0;i<5;i++)); do > sync > time (for ((j=1;j<=1000;j++)); do touch file$((i*1000+j)); done) > done > > The more files, the more performance improvements. > > Before After Improvement > 1~1000 25.360s 22.168s 14.40% > 1001~2000 38.242s 28.72ss 33.15% > 2001~3000 49.134s 35.037s 40.23% > 3001~4000 62.042s 41.624s 49.05% > 4001~5000 73.629s 46.772s 57.42% > > Signed-off-by: Yuezhang Mo <Yuezhang.Mo@xxxxxxxx> > Reviewed-by: Andy Wu <Andy.Wu@xxxxxxxx> > Reviewed-by: Aoyama Wataru <wataru.aoyama@xxxxxxxx> Applied. Thanks for your patch!