[Concept,11/15] ext4l: Return boot-relative time from ktime_get_real_seconds()

Message ID 20251230234134.906477-12-sjg@u-boot.org
State New
Headers
Series ext4l: Infrastructure and fixes for write support (part K) |

Commit Message

Simon Glass Dec. 30, 2025, 11:41 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

The ktime_get_real_seconds() stub returns 0, causing deleted inodes
to have zero i_dtime. This causes fsck to complain about deleted
inodes with zero deletion time.

Instead, use the boot-relative time in seconds. While not a real
wall-clock timestamp, it provides a non-zero value that satisfies
filesystem-consistency checks.

Future work can improve on this, perhaps using an on-board RTC.

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

 fs/ext4l/ext4_uboot.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index c5eddca3aef..5c66e35662d 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -402,8 +402,8 @@  struct buffer_head *sb_getblk(struct super_block *sb, sector_t block);
 #define sb_find_get_block(sb, block)		((struct buffer_head *)NULL)
 #define sync_dirty_buffer(bh)			submit_bh(REQ_OP_WRITE, bh)
 
-/* Time functions */
-#define ktime_get_real_seconds()		(0)
+/* Time functions - use boot-relative time for timestamps */
+#define ktime_get_real_seconds()		(get_timer(0) / 1000)
 #define time_before32(a, b)			(0)
 
 /* Inode operations - iget_locked and new_inode are in interface.c */