[Concept,13/23] ext4l: Move REQ_OP and SLAB flags to proper headers

Message ID 20260119061529.3383191-14-sjg@u-boot.org
State New
Headers
Series Reduce ext4_uboot.h by moving definitions to linux headers |

Commit Message

Simon Glass Jan. 19, 2026, 6:15 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Move block I/O request operation codes and flags (REQ_OP_READ,
REQ_OP_WRITE, REQ_OP_MASK, REQ_SYNC, REQ_FUA) to include/linux/blk_types.h
where they belong with other block layer types.

Move slab cache creation flags (SLAB_RECLAIM_ACCOUNT, SLAB_ACCOUNT) to
include/linux/slab.h with other slab definitions.

This matches Linux kernel header organisation and reduces duplication
in ext4_uboot.h

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

 fs/ext4l/ext4_uboot.h     | 14 +++-----------
 include/linux/blk_types.h |  9 +++++++++
 include/linux/slab.h      |  4 ++++
 3 files changed, 16 insertions(+), 11 deletions(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index d017d86247b..1622fec4e64 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -1106,8 +1106,8 @@  static inline void end_buffer_read_sync(struct buffer_head *bh, int uptodate)
 		clear_buffer_uptodate(bh);
 	unlock_buffer(bh);
 }
-#define REQ_OP_READ		0
 
+/* REQ_OP_READ is in linux/blk_types.h */
 /* SB_ACTIVE is in linux/fs.h */
 
 /* Part stat - not used in U-Boot. Note: sectors[X] is passed as second arg */
@@ -1127,9 +1127,7 @@  static u64 __attribute__((unused)) __ext4_sectors[2];
 #define DUMP_PREFIX_ADDRESS	0
 #define print_hex_dump(l, p, pt, rg, gc, b, len, a) do { } while (0)
 
-/* Slab flags */
-#define SLAB_RECLAIM_ACCOUNT	0
-#define SLAB_ACCOUNT		0
+/* SLAB_RECLAIM_ACCOUNT, SLAB_ACCOUNT are in linux/slab.h */
 
 /* Forward declarations for super_operations and export_operations */
 struct kstatfs;
@@ -1214,13 +1212,7 @@  void ext4_unregister_li_request(struct super_block *sb);
 #define BLK_OPEN_WRITE			(1 << 1)
 #define BLK_OPEN_RESTRICT_WRITES	(1 << 2)
 
-/* Request operation (bits 0-7) and flags (bits 8+) */
-#define REQ_OP_WRITE			1
-#define REQ_OP_MASK			0xff
-
-/* ensure these values are outside the operations mask */
-#define REQ_SYNC			(1 << 8)
-#define REQ_FUA				(1 << 9)
+/* REQ_OP_*, REQ_SYNC, REQ_FUA are in linux/blk_types.h */
 
 /* blk_holder_ops for block device */
 struct blk_holder_ops {
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index aa7ea50d233..9d770f4bd6e 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -15,4 +15,13 @@ 
 /* Block I/O operation flags */
 typedef __u32 __bitwise blk_opf_t;
 
+/* Block operation codes (bits 0-7) */
+#define REQ_OP_READ		0
+#define REQ_OP_WRITE		1
+#define REQ_OP_MASK		0xff
+
+/* Block request flags (bits 8+) */
+#define REQ_SYNC		(1 << 8)	/* Synchronous I/O */
+#define REQ_FUA			(1 << 9)	/* Forced unit access */
+
 #endif /* _LINUX_BLK_TYPES_H */
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 4f413f93fa3..1b212ca0e4a 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -46,6 +46,10 @@ 
 #define GFP_NOIO	((gfp_t)0)
 #endif
 
+/* Slab cache creation flags */
+#define SLAB_RECLAIM_ACCOUNT	0x00020000UL	/* Track pages reclaimed */
+#define SLAB_ACCOUNT		0x00000000UL	/* Account to memcg (no-op) */
+
 void *kmalloc(size_t size, gfp_t flags);
 
 static inline void *kzalloc(size_t size, gfp_t flags)