[PATCH v2] erofs-utils: use qsort() to sort dir->i_subdirs

Gao Xiang xiang at kernel.org
Mon Apr 12 00:41:03 AEST 2021


Guifu,

On Sun, Apr 11, 2021 at 10:10:09PM +0800, Li GuiFu via Linux-erofs wrote:
> Hu Weiwen
>   It really do a high sort performance increase,
>   I have a idea that keeping the erofs_prepare_dir_file() function
> paramter stable, Using a independent function to do dirs sort.
> 

I think Weiwen's implementation looks fine to me, if you tend to
not passing nr_subdirs as a cleaner solution, my suggestion would
be:
1) introduce a somewhat erofs_subdirs, which includes
   - a list_head for all subdir dentries generated from d_alloc;
   - a nr_subdirs count;
2) update erofs_d_alloc to
   erofs_d_alloc(struct erofs_subdirs *, const char *);
3) update erofs_prepare_dir_file to
   erofs_prepare_dir_file(struct erofs_inode *, struct erofs_subdir *).

Yet I'd like to apply the current solution first since it helps the
dir creation performance. If someone has interest to the solution
above, new cleanup is always welcomed.

Reviewed-by: Gao Xiang <xiang at kernel.org>

Thanks,
Gao Xiang


More information about the Linux-erofs mailing list