#linux #ext4 #traversal #directory #hdd #optimized #sorting

platter-walk

Directory tree traversal optimized for HDDs

3 releases

Uses old Rust 2015

0.1.3 Mar 18, 2021
0.1.2 Jun 20, 2017
0.1.0 May 10, 2017

#959 in Filesystem

Download history 9/week @ 2024-02-19 50/week @ 2024-02-26 6/week @ 2024-03-04 8/week @ 2024-03-11 9/week @ 2024-03-18

73 downloads per month
Used in 2 crates

MPL-2.0 and LGPL-3.0

17KB
342 lines

Version

platter-walk

A recursive directory entry iterator that optimizes traversal based on physical disk layout. Takes block offsets (via FIEMAP[1]), inode tables and disk cache locality into account.

For users (root) who have read access to the underlying block device it also performs readaheads on the directory indicies spanning several directories. This is somewhat of a hack since readahead() and posix_fadvise() do not work on directories directly since they use a separate cache.[2][3]

The largest benefits can be realized on HDDs with ext4 filesystems.

Traversal can be optimized for

  • simple directory entry listing (name and d_type only)
  • detailed entry listing (stat)
  • reading file contents. Entry batches are sorted by physical offset.

See ffcnt and fastar for benchmarks.

Dependencies

~3MB
~60K SLoC