fs: jffs2: improve one-pass reader and add metadata
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest7 patches 2 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/7 | fs: jffs2: check cached-node reads before dereferencingfs/ | +59 | 0 replies | |
| 2/7 | fs: jffs2: reject missing fragments and fail incomplete loadsfs/ | +10 | 0 replies | |
| 3/7 | fs: jffs2: resolve symlink targets safelyfs/ | +15 | 0 replies | |
| 4/7 | fs: jffs2: release dirents on comparison read errorsfs/ | +3 | 0 replies | |
| 5/7 | fs: jffs2: retain the selected raw dirent when listingfs/ | +4 | 0 replies | |
| 6/7 | fs: jffs2: cache directory metadata during one-pass scansfs/ fs/ fs/ | +214 | 0 replies | |
| 7/7 | fs: jffs2: document post-scan merge sortfs/ fs/ | +6 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/7] fs: jffs2: improve one-pass reader and add metadata
This series improves the robustness of the JFFS2 one-pass reader and introduces CONFIG_JFFS2_CACHE_TO_SPEED_UP, an optional directory metadata cache designed to reduce repeated flash reads during sorting, directory listing, and pathname lookup when loading files.
With the cache enabled, directory entry names are interned in a configurable hash table during both full and summary-based filesystem scans. Cached names, inode numbers, and parent inode numbers allow lookup and sorting to use in-memory metadata. When fragment sorting is enabled, listing can also identify successive versions of the same directory entry through interned-name pointer equality before reading the selected raw node.
The optimization trades additional RAM for fewer directory entry reads. Names are allocated from 10 KiB pools, and CONFIG_JFFS2_CACHE_NAMES_HASH_WIDTH controls the hash table size, defaulting to 256 buckets. Cache memory is released with the filesystem cache, and raw-node comparisons remain available when names are not cached. Listing still reads selected directory entries and inode information, and loading still reads file data.
The preceding fixes address unchecked node reads, missing inode fragments, incomplete file loads incorrectly reported as successful, unsafe symlink target handling, leaked dirents on comparison errors, and incorrect handling of the selected raw dirent during listing. These fixes apply independently of the new cache option.
The final patch corrects the sorting documentation to describe the existing post-scan merge sort with O(n log n) comparisons. This series does not introduce a new sorting algorithm; its performance focus is reducing flash accesses through cached metadata.
Wagner Popov dos Santos (7):
fs: jffs2: check cached-node reads before dereferencing
fs: jffs2: reject missing fragments and fail incomplete loads
fs: jffs2: resolve symlink targets safely
fs: jffs2: release dirents on comparison read errors
fs: jffs2: retain the selected raw dirent when listing
fs: jffs2: cache directory metadata during one-pass scans
fs: jffs2: document post-scan merge sort
fs/jffs2/Kconfig | 29 ++++- fs/jffs2/jffs2_1pass.c | 261 +++++++++++++++++++++++++++++++++++++-- fs/jffs2/jffs2_private.h | 30 +++++ 3 files changed, 308 insertions(+), 12 deletions(-)
Signature · 1 line
2.43.0