[Concept,08/17] ext4l: Move buffer and filesystem helpers to standard headers
Commit Message
From: Simon Glass <simon.glass@canonical.com>
Move several definitions to their canonical Linux header locations:
- MAX_LFS_FILESIZE to linux/fs.h
- end_buffer_read_sync() to linux/buffer_head.h
This continues reducing ext4_uboot.h by placing these definitions in
their proper locations in the Linux header hierarchy.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
fs/ext4l/ext4_uboot.h | 13 ++-----------
include/linux/buffer_head.h | 14 ++++++++++++++
include/linux/fs.h | 3 +++
3 files changed, 19 insertions(+), 11 deletions(-)
@@ -979,15 +979,7 @@ static inline const char *simple_get_link(struct dentry *dentry,
/* QFMT_VFS_* quota format constants are in linux/quotaops.h */
-/* Buffer read sync */
-static inline void end_buffer_read_sync(struct buffer_head *bh, int uptodate)
-{
- if (uptodate)
- set_buffer_uptodate(bh);
- else
- clear_buffer_uptodate(bh);
- unlock_buffer(bh);
-}
+/* end_buffer_read_sync is in linux/buffer_head.h */
/* REQ_OP_READ is in linux/blk_types.h */
/* SB_ACTIVE is in linux/fs.h */
@@ -1103,8 +1095,7 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
/* EXT4 magic number */
#define EXT4_SUPER_MAGIC 0xEF53
-/* Max file size for large files */
-#define MAX_LFS_FILESIZE ((loff_t)LLONG_MAX)
+/* MAX_LFS_FILESIZE is in linux/fs.h */
/* blockgroup_lock - use linux/blockgroup_lock.h */
#include <linux/blockgroup_lock.h>
@@ -213,4 +213,18 @@ static inline bool noop_dirty_folio(struct address_space *mapping,
return false;
}
+/*
+ * end_buffer_read_sync - completion handler for synchronous buffer reads
+ * @bh: buffer head that completed
+ * @uptodate: whether the read was successful
+ */
+static inline void end_buffer_read_sync(struct buffer_head *bh, int uptodate)
+{
+ if (uptodate)
+ set_buffer_uptodate(bh);
+ else
+ clear_buffer_uptodate(bh);
+ unlock_buffer(bh);
+}
+
#endif /* _LINUX_BUFFER_HEAD_H */
@@ -318,6 +318,9 @@ enum {
#define I_DIRTY_DATASYNC (1 << 2)
#define I_DIRTY_TIME (1 << 3)
+/* Maximum file size for large files */
+#define MAX_LFS_FILESIZE ((loff_t)LLONG_MAX)
+
/**
* struct fstrim_range - fstrim ioctl argument
* @start: first byte to trim