LWN.net Logo

The fanotify API

The fanotify API

Posted Aug 18, 2009 5:49 UTC (Tue) by rawler (guest, #60308)
Parent article: The fanotify API

I can also see two relevant use-cases not mentioned here;

File-system-optimisation; While ext4 now have aquired defragmentation, I
still haven't seen any way in Linux other than the old tar/untar-way to
re-optimise files and directories for proximity to reduce seek-time.
(Say, for the apt/dpkg database). With this, it seems it would be
possible having a low-priority daemon tracking file-access-order, and on
system-idle (say, screensaver-time) simulate a tar/untar in frequent-
access-order to reorder them into better-on-disk positions.

Clutter removal; Now with the atime defaulting to relatime, it's getting
a bit harder to find old unused stuff, and wipe unused packages etc. This
new API should allow creating an ionice:d daemon with lax disk-queuing
track usage of files in the system, mapped to apt-packages, and track how
often packages are actually used. Given that accessing-process-info is
now also monitored, it may even be possible to prune indexers, grep and
friend from polluting the data. (By name, or by tracking access-patterns.
If something walks every file in a directory, we could probably ignore
it)


(Log in to post comments)

The fanotify API

Posted May 19, 2011 0:27 UTC (Thu) by anjwicks (guest, #75008) [Link]

A use case you mentioned is exactly why I'm interested in fanotify. I tried very hard to make inotify work for this purpose but could not get the information I needed (scan and parse /proc) in time (the event would be gone by the time I got around to finding it). The problem is, inotify simply didn't provide the pid of the process who triggered the event.

I am excited about fanotify and found out about it just in time. I want to thank Eric and the other guys who put in the work and provided the capabilities.

I'm going to try to use fanotify to help tune a Linux installation based on what software is actually being used. There is a tool out there like this called popcon, but it is difficult to get proper precision based on atime accesses.

Currently, I'm only interested in OPEN events and don't yet care about blocking events. So, this will work just fine.

The reason I mentioned all of this is because I'm under the impression the tool I need doesn't exist. So I'm off to try to make it. If anybody knows of something already completed, please stop me now! :) -jeff wicks

The fanotify API

Posted May 19, 2011 4:04 UTC (Thu) by dtlin (✭ supporter ✭, #36537) [Link]

Kinda expensive/verbose, but auditd would work, wouldn't it?

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds