summaryrefslogtreecommitdiff
path: root/libdm/libdevmapper.h
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2016-06-30 21:46:43 +0100
committerBryn M. Reeves <bmr@redhat.com>2016-07-08 14:34:41 +0100
commite1048259165b09a35c45170cefbbccb4d43a9834 (patch)
treea129e5de6d0e04ad486d244e9cf6260d84edb4e6 /libdm/libdevmapper.h
parent12ecd95965321af194c3d446c0b5205d90994522 (diff)
downloadlvm2-e1048259165b09a35c45170cefbbccb4d43a9834.tar.gz
libdm: add dm_stats_create_regions_from_fd()
Add a call to create dmstats regions that correspond to the extents present in a file descriptor open on a file in a local file system. The file must reside on a file system type that correctly supports physical extent location data in the FIEMAP ioctl. Regions are optionally placed into a group with a user-defined alias. File systems that do not support physical offsets in FIEMAP (btrfs currently) are detected via fstatfs() - although attempting to map a --filemap group on btrfs will fail anyway with the generic error "Not on a device-mapper device" this is confusing; the file system mount is on a device-mapper device, but btrfs' volume layer masks this in the returned st_dev field since the returned logical file extents may span multiple physical devices.
Diffstat (limited to 'libdm/libdevmapper.h')
-rw-r--r--libdm/libdevmapper.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index ec644260c..0f61f9c83 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1286,6 +1286,35 @@ int dm_stats_get_group_descriptor(const struct dm_stats *dms,
uint64_t group_id, char **buf);
/*
+ * Create regions that correspond to the extents of a file in the
+ * filesystem and optionally place them into a group.
+ *
+ * File descriptor fd must reference a regular file, open for reading,
+ * in a local file system that supports the FIEMAP ioctl and that
+ * returns data describing the physical location of extents.
+ *
+ * The file descriptor can be closed by the caller following the call
+ * to dm_stats_create_regions_from_fd().
+ *
+ * The function returns a pointer to an array of uint64_t containing
+ * the IDs of the newly created regions. The array is terminated by the
+ * value DM_STATS_REGIONS_ALL and should be freed using dm_free() when
+ * no longer required.
+ *
+ * Unless nogroup is non-zero the regions will be placed into a group
+ * and the group alias is set to the value supplied.
+ *
+ * The group_id for the new group is equal to the region_id value in
+ * the first array element.
+ *
+ * File mapped histograms will be supported in a future version.
+ */
+uint64_t *dm_stats_create_regions_from_fd(struct dm_stats *dms, int fd,
+ int group, int precise,
+ struct dm_histogram *bounds,
+ const char *alias);
+
+/*
* Call this to actually run the ioctl.
*/
int dm_task_run(struct dm_task *dmt);