LLNL / lmt

Lustre Monitoring Tools
GNU General Public License v2.0
67 stars 21 forks source link

libproc: look in /sys and /proc as necessary #36

Closed ofaaland closed 5 years ago

ofaaland commented 5 years ago

Rather than always looking under /proc for a given subdirectory, look under /sys and then if that is not found, look under /proc. Use whichever path is found first.

This was done to allow lmt to find Lustre 2.12 metrics, some of which were moved to /sys, but with the path under /sys the same as the old path under /proc.

With this patch there are some additional stat() calls, so the metric does slightly more I/O than was required previously. However since these are stats of /proc or /sys files, they should be cheap. In return we have much less lustre-version specific code to handle this transition in the lustre codebase.

ofaaland commented 5 years ago

Hi Ned, Chris, and Brian, Would one of you mind reviewing this PR? One review is fine, so whoever goes first loses :).

This passes make check and hand-testing. It also works correctly on slag, which has both lustre 2.10 and lustre 2.12 file systems running. Thanks!

ofaaland commented 5 years ago

fixes: #35

ofaaland commented 5 years ago

Refreshed the patch to update the commit message. The patch checks /sys first and /proc second. Also added my assertion that the added I/O is relatively inexpensive.

ofaaland commented 5 years ago

cherry-picked to master as