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(-)
@@ -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,
@@ -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 */