summaryrefslogtreecommitdiff
path: root/include/uapi/linux/falloc.h
diff options
context:
space:
mode:
authorDarrick J. Wong <djwong@kernel.org>2021-09-01 11:25:39 -0700
committerDarrick J. Wong <djwong@kernel.org>2021-12-15 17:29:29 -0800
commit9ce7cdaa061e17128626e0b880adfed00455931d (patch)
treefb53e2ea4d95e13a23e512f19d15dc8f78d77c55 /include/uapi/linux/falloc.h
parentb68950039f7467e0f1e439cfa144211b23b9dc61 (diff)
xfs: fallocate free space into a file
Add a new fallocate mode to map free physical space into a file, at the same file offset as if the file were a sparse image of the physical device backing the filesystem. The intent here is to use this to prototype a free space defragmentation tool. Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'include/uapi/linux/falloc.h')
-rw-r--r--include/uapi/linux/falloc.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/uapi/linux/falloc.h b/include/uapi/linux/falloc.h
index 51398fa57f6c..326597f54087 100644
--- a/include/uapi/linux/falloc.h
+++ b/include/uapi/linux/falloc.h
@@ -2,6 +2,14 @@
#ifndef _UAPI_FALLOC_H_
#define _UAPI_FALLOC_H_
+/*
+ * FALLOC_FL_MAP_FREE_SPACE maps all the free physical space in the
+ * filesystem into the file at the same offsets. This flag requires
+ * CAP_SYS_ADMIN, and cannot be used with any other flags. It probably
+ * only works on filesystems that are backed by physical media.
+ */
+#define FALLOC_FL_MAP_FREE_SPACE 0x8000
+
#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */
#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
#define FALLOC_FL_NO_HIDE_STALE 0x04 /* reserved codepoint */