From 10d3ac346f54ab9526cd352239a5906ee2b92fee Mon Sep 17 00:00:00 2001 From: Mark Tomlinson Date: Wed, 1 Jul 2015 16:38:29 +1200 Subject: JFFS2: Use merge sort when parsing filesystem When building the file system the existing code does an insertion into a linked list. It attempts to speed this up by keeping a pointer to where the last entry was inserted but it's still slow. Now the nodes are just inserted into the list without searching through for the correct place. This unsorted list is then sorted once using mergesort after all the entries have been added to the list. This speeds up the scanning of the flash file system considerably. Signed-off-by: Mark Tomlinson --- fs/jffs2/jffs2_private.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'fs/jffs2/jffs2_private.h') diff --git a/fs/jffs2/jffs2_private.h b/fs/jffs2/jffs2_private.h index 658b325219..06b6ca2919 100644 --- a/fs/jffs2/jffs2_private.h +++ b/fs/jffs2/jffs2_private.h @@ -98,4 +98,8 @@ data_crc(struct jffs2_raw_inode *node) } } +#if defined(CONFIG_SYS_JFFS2_SORT_FRAGMENTS) +/* External merge sort. */ +int sort_list(struct b_list *list); +#endif #endif /* jffs2_private.h */ -- cgit