The daemon is normally launched automatically by the dmstats create command, but can be run manually, either to create a new daemon where one did not previously exist, or to change the options previously used, by killing the existing daemon and starting a new one.
The process that executes dmfilemapd is responsible for opening the file descriptor that is handed to the daemon.
In both modes, the daemon will always shut down when the group being monitored is deleted.
Follow inode
The daemon follows the inode of the file, as it was at the time the daemon started. The file descriptor referencing the file is kept open at all times, and the daemon will exit when it detects that the file has been unlinked and it is the last holder of a reference to the file.
This mode is useful if the file is expected to be renamed, or moved within the file system, while it is being monitored.
Follow path
The daemon follows the path that was given on the daemon command line. The file descriptor referencing the file is re-opened on each iteration of the daemon, and the daemon will exit if no file exists at this location (a tolerance is allowed so that a brief delay between removal and replacement is permitted).
This mode is useful if the file is updated by unlinking the original and placing a new file at the same path.
There is a further loss of events in that there is currently no way to atomically resize a dmstats region and preserve its current counter values. This affects files when they grow by extending the final extent, rather than allocating a new extent: any events that had accumulated in the region between any prior operation and the resize are lost.
File mapping is currently most effective in cases where the majority of IO does not trigger extent allocation. Future updates may address these limitations when kernel support is available.
Start the daemon in the background, in follow-path mode
#
dmfilemapd 3 0 /srv/images/vm.img path 0 0 3< /srv/images/vm.img
Start the daemon in follow-inode mode, disable forking and enable
verbose logging
#
dmfilemapd 3 0 /var/tmp/data inode 1 3 3< /var/tmp/data
Starting dmfilemapd with fd=3, group_id=0 mode=inode, path=/var/tmp/data
dm version [ opencount flush ] [16384] (*1)
dm info (253:0) [ opencount flush ] [16384] (*1)
dm message (253:0) [ opencount flush ] @stats_list dmstats [16384] (*1)
Read alias 'data' from aux_data
Found group_id 0: alias="data"
dm_stats_walk_init: initialised flags to 4000000000000
starting stats walk with GROUP
exiting _filemap_monitor_get_events() with deleted=0, check=0
Waiting for check interval
LVM2 resource page: https://www.sourceware.org/lvm2/
Device-mapper resource page: http://sources.redhat.com/dm/