[Concept,13/15] ext4l: Use percpu_counter initialized field

Message ID 20251230234134.906477-14-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>

Update the percpu_counter_initialized() and percpu_counter_init()
macros in ext4_uboot.h to use the new initialized field.

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

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

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index 18ea2b1bcd4..2d0e817be40 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -368,7 +368,7 @@  struct buffer_head *sb_getblk(struct super_block *sb, sector_t block);
 #define percpu_counter_add(fbc, amount)		((fbc)->count += (amount))
 #define percpu_counter_inc(fbc)			((fbc)->count++)
 #define percpu_counter_dec(fbc)			((fbc)->count--)
-#define percpu_counter_initialized(fbc)		(1)
+#define percpu_counter_initialized(fbc)		((fbc)->initialized)
 
 /* Group permission - stub */
 #define in_group_p(gid)			(0)
@@ -1216,7 +1216,8 @@  static inline ktime_t ktime_add_ns(ktime_t kt, s64 ns)
 #define write_trylock(lock)		({ (void)(lock); 1; })
 
 /* percpu counter init/destroy */
-#define percpu_counter_init(fbc, val, gfp)	({ (fbc)->count = (val); 0; })
+#define percpu_counter_init(fbc, val, gfp)	\
+	({ (fbc)->count = (val); (fbc)->initialized = true; 0; })
 #define percpu_counter_destroy(fbc)		do { } while (0)
 
 /* ratelimit macros */