diff mbox series

[1/3] btrfs-progs: print-tree: use ARRAY_SIZE() to replace open-coded ones

Message ID ab1b8425469a6ccb386d7d2c05bdee72c9deb59b.1728020867.git.wqu@suse.com (mailing list archive)
State New, archived
Headers show
Series btrfs-progs: print-tree: cleanup for regular bitmap based flags print | expand

Commit Message

Qu Wenruo Oct. 4, 2024, 5:52 a.m. UTC
For compat_ro_flags_num and incompat_flags_num, just use ARRAY_SIZE().

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 kernel-shared/print-tree.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/kernel-shared/print-tree.c b/kernel-shared/print-tree.c
index ab85432e2807..14f7dcdf0ee9 100644
--- a/kernel-shared/print-tree.c
+++ b/kernel-shared/print-tree.c
@@ -1889,8 +1889,7 @@  static struct readable_flag_entry compat_ro_flags_array[] = {
 	DEF_COMPAT_RO_FLAG_ENTRY(FREE_SPACE_TREE_VALID),
 	DEF_COMPAT_RO_FLAG_ENTRY(BLOCK_GROUP_TREE),
 };
-static const int compat_ro_flags_num = sizeof(compat_ro_flags_array) /
-				       sizeof(struct readable_flag_entry);
+static const int compat_ro_flags_num = ARRAY_SIZE(compat_ro_flags_array);
 
 #define DEF_INCOMPAT_FLAG_ENTRY(bit_name)		\
 	{BTRFS_FEATURE_INCOMPAT_##bit_name, #bit_name}
@@ -1913,8 +1912,7 @@  static struct readable_flag_entry incompat_flags_array[] = {
 	DEF_INCOMPAT_FLAG_ENTRY(RAID_STRIPE_TREE),
 	DEF_INCOMPAT_FLAG_ENTRY(SIMPLE_QUOTA),
 };
-static const int incompat_flags_num = sizeof(incompat_flags_array) /
-				      sizeof(struct readable_flag_entry);
+static const int incompat_flags_num = ARRAY_SIZE(incompat_flags_array);
 
 #define DEF_HEADER_FLAG_ENTRY(bit_name)			\
 	{BTRFS_HEADER_FLAG_##bit_name, #bit_name}