[Concept,07/16] ext4l: Move fstrim_range to linux/fs.h

Message ID 20260119214846.3087611-8-sjg@u-boot.org
State New
Headers
Series ext4l: Move definitions to standard Linux headers |

Commit Message

Simon Glass Jan. 19, 2026, 9:48 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Move struct fstrim_range to include/linux/fs.h where it belongs in the
Linux kernel header hierarchy. This structure is used for FITRIM ioctl.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 fs/ext4l/ext4_uboot.h |  7 +------
 include/linux/fs.h    | 14 ++++++++++++++
 2 files changed, 15 insertions(+), 6 deletions(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index 55a06d01996..91d432d391d 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -395,12 +395,7 @@  typedef long long qsize_t;
 /* mnt_idmap - use linux/mnt_idmapping.h */
 #include <linux/mnt_idmapping.h>
 
-/* fstrim_range - stub */
-struct fstrim_range {
-	u64 start;
-	u64 len;
-	u64 minlen;
-};
+/* fstrim_range is in linux/fs.h */
 
 /* rw_semaphore - defined in linux/rwsem.h, include it */
 #include <linux/rwsem.h>
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 75e4bd3e951..1b0059ca1a7 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -305,4 +305,18 @@  enum {
 #define IS_APPEND(inode)	((inode)->i_flags & S_APPEND)
 #define IS_IMMUTABLE(inode)	((inode)->i_flags & S_IMMUTABLE)
 
+/**
+ * struct fstrim_range - fstrim ioctl argument
+ * @start: first byte to trim
+ * @len: number of bytes to trim
+ * @minlen: minimum extent length
+ *
+ * Used for FITRIM ioctl to trim unused blocks.
+ */
+struct fstrim_range {
+	u64 start;
+	u64 len;
+	u64 minlen;
+};
+
 #endif /* _LINUX_FS_H */