[Concept,34/34] ext4l: Move buffer migration stubs to linux/buffer_head.h

Message ID 20260114225635.3407989-35-sjg@u-boot.org
State New
Headers
Series ext4l: Clean up ext4_uboot.h by moving definitions to standard headers |

Commit Message

Simon Glass Jan. 14, 2026, 10:56 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Move buffer and folio migration stubs from ext4_uboot.h to
linux/buffer_head.h where they belong:

- buffer_migrate_folio(): folio migration stub (returns -EOPNOTSUPP)
- buffer_migrate_folio_norefs(): no-refs folio migration stub
- noop_dirty_folio(): no-op dirty folio handler

U-Boot doesn't support memory migration, so these remain as stubs.

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

 fs/ext4l/ext4_uboot.h       | 22 +---------------------
 include/linux/buffer_head.h | 27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 21 deletions(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index 87cc561538e..91e0ce95467 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -1142,27 +1142,7 @@  struct readahead_control {
 #define readahead_length(rac)		({ (void)(rac); 0UL; })
 
 /* address_space_operations is in linux/fs.h */
-
-/* Stub for buffer_migrate_folio */
-static inline int buffer_migrate_folio(struct address_space *mapping,
-				       struct folio *dst, struct folio *src, int mode)
-{
-	return -EOPNOTSUPP;
-}
-
-/* Stub for buffer_migrate_folio_norefs */
-static inline int buffer_migrate_folio_norefs(struct address_space *mapping,
-					      struct folio *dst, struct folio *src, int mode)
-{
-	return -EOPNOTSUPP;
-}
-
-/* Stub for noop_dirty_folio */
-static inline bool noop_dirty_folio(struct address_space *mapping,
-				    struct folio *folio)
-{
-	return false;
-}
+/* buffer_migrate_folio, buffer_migrate_folio_norefs, noop_dirty_folio are in linux/buffer_head.h */
 
 /* Stub implementations for address_space_operations callbacks */
 static inline bool block_is_partially_uptodate(struct folio *folio,
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 94bd2bab96a..a160b7d1a67 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -12,6 +12,7 @@ 
 #include <linux/types.h>
 #include <linux/list.h>
 #include <linux/spinlock.h>
+#include <linux/errno.h>
 #include <asm-generic/atomic.h>
 
 enum bh_state_bits {
@@ -186,4 +187,30 @@  void __brelse(struct buffer_head *bh);
 #define unlock_buffer(bh)		clear_buffer_locked(bh)
 #define test_clear_buffer_dirty(bh)	({ (void)(bh); 0; })
 
+/*
+ * Folio migration stubs - U-Boot doesn't support memory migration
+ */
+static inline int buffer_migrate_folio(struct address_space *mapping,
+				       struct folio *dst, struct folio *src,
+				       int mode)
+{
+	return -EOPNOTSUPP;
+}
+
+static inline int buffer_migrate_folio_norefs(struct address_space *mapping,
+					      struct folio *dst,
+					      struct folio *src, int mode)
+{
+	return -EOPNOTSUPP;
+}
+
+/*
+ * noop_dirty_folio - no-op dirty folio handler
+ */
+static inline bool noop_dirty_folio(struct address_space *mapping,
+				    struct folio *folio)
+{
+	return false;
+}
+
 #endif /* _LINUX_BUFFER_HEAD_H */