summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2024-08-28 17:54:05 +0300
committerChristian Brauner <brauner@kernel.org>2024-08-28 17:54:05 +0300
commit7fbabbb4ae2a7203861e4db363e3c861a4df260e (patch)
tree4239ed2c4f7f0933e6d9f3a7fc0c86481a8c56a0 /include/linux
parent47ac09b91befbb6a235ab620c32af719f8208399 (diff)
parent4acaddf5d1e78814d26df3ff02d5e410d951ff32 (diff)
downloadlinux-7fbabbb4ae2a7203861e4db363e3c861a4df260e.tar.xz
Merge patch series "Subject: sort out the fallocate mode mess"
Christoph Hellwig <hch@lst.de> says: I've recently been looking at the XFS fallocate implementation and got upset about the messing parsing of the mode argument, which mixes modes and an optional flag in a really confusing way. This series tries to clean this up by better defining what is the operation mode and what is an optional flag, so that both the core code and file systems can use switch statements to switch on the mode. * patches from https://lore.kernel.org/r/20240827065123.1762168-1-hch@lst.de: xfs: refactor xfs_file_fallocate xfs: move the xfs_is_always_cow_inode check into xfs_alloc_file_space xfs: call xfs_flush_unmap_range from xfs_free_file_space fs: sort out the fallocate mode vs flag mess ext4: remove tracing for FALLOC_FL_NO_HIDE_STALE block: remove checks for FALLOC_FL_NO_HIDE_STALE Link: https://lore.kernel.org/r/20240827065123.1762168-1-hch@lst.de Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/falloc.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/include/linux/falloc.h b/include/linux/falloc.h
index f3f0b97b1675..3f49f3df6af5 100644
--- a/include/linux/falloc.h
+++ b/include/linux/falloc.h
@@ -25,12 +25,18 @@ struct space_resv {
#define FS_IOC_UNRESVSP64 _IOW('X', 43, struct space_resv)
#define FS_IOC_ZERO_RANGE _IOW('X', 57, struct space_resv)
-#define FALLOC_FL_SUPPORTED_MASK (FALLOC_FL_KEEP_SIZE | \
- FALLOC_FL_PUNCH_HOLE | \
- FALLOC_FL_COLLAPSE_RANGE | \
- FALLOC_FL_ZERO_RANGE | \
- FALLOC_FL_INSERT_RANGE | \
- FALLOC_FL_UNSHARE_RANGE)
+/*
+ * Mask of all supported fallocate modes. Only one can be set at a time.
+ *
+ * In addition to the mode bit, the mode argument can also encode flags.
+ * FALLOC_FL_KEEP_SIZE is the only supported flag so far.
+ */
+#define FALLOC_FL_MODE_MASK (FALLOC_FL_ALLOCATE_RANGE | \
+ FALLOC_FL_PUNCH_HOLE | \
+ FALLOC_FL_COLLAPSE_RANGE | \
+ FALLOC_FL_ZERO_RANGE | \
+ FALLOC_FL_INSERT_RANGE | \
+ FALLOC_FL_UNSHARE_RANGE)
/* on ia32 l_start is on a 32-bit boundary */
#if defined(CONFIG_X86_64)