You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently for --inode-flags parameter, we save the full path of the host
fs into rootdir_inode_flags_entry sturcture, then compare each inode we hit
with that saved full path.
This string comparison can be time consuming (up to PATH_MAX
characters), and we're doing it for every inode.
On the other hand, nftw() also provides a stat structure of the current
inode, stat::st_dev and stat::st_ino pair can always uniquely locate an
inode in the host filesystem.
With that said, we can just save the st_dev/st_ino pair when validating
the inode flag parameters, and use st_dev/st_ino to check if we hit the
target inode.
This has two benefits:
- Reduce the memory usage of each rootdir_inode_flags_entry
Now we need no full_path member, replacing it with two u64.
This saves (4K - 16) bytes per rootdir_inode_flags_entry.
- Reduce the runtime of inode comparison
Instead of doing strcmp() for up to 4K bytes, it's just two u64
comparison.
Signed-off-by: Qu Wenruo <[email protected]>
0 commit comments