The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] ext4: use str_plural() instead of custom macro
@ 2026-07-11  6:38 Joshua Crofts
  2026-07-12 16:33 ` Jan Kara
  0 siblings, 1 reply; 2+ messages in thread
From: Joshua Crofts @ 2026-07-11  6:38 UTC (permalink / raw)
  To: Theodore Ts'o, Andreas Dilger, Baokun Li, Jan Kara,
	Ojaswin Mujoo, Ritesh Harjani (IBM), Zhang Yi
  Cc: linux-ext4, linux-kernel, Joshua Crofts

Remove the custom PLURAL() macro and use str_plural() from
string_choices.h instead.

Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>
---
 fs/ext4/orphan.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/orphan.c b/fs/ext4/orphan.c
index 64ea47624233..e307d6d55451 100644
--- a/fs/ext4/orphan.c
+++ b/fs/ext4/orphan.c
@@ -4,6 +4,7 @@
 #include <linux/fs.h>
 #include <linux/quotaops.h>
 #include <linux/buffer_head.h>
+#include <linux/string_choices.h>
 
 #include "ext4.h"
 #include "ext4_jbd2.h"
@@ -486,14 +487,13 @@ void ext4_orphan_cleanup(struct super_block *sb, struct ext4_super_block *es)
 		}
 	}
 
-#define PLURAL(x) (x), ((x) == 1) ? "" : "s"
 
 	if (nr_orphans)
 		ext4_msg(sb, KERN_INFO, "%d orphan inode%s deleted",
-		       PLURAL(nr_orphans));
+			 nr_orphans, str_plural(nr_orphans));
 	if (nr_truncates)
 		ext4_msg(sb, KERN_INFO, "%d truncate%s cleaned up",
-		       PLURAL(nr_truncates));
+			 nr_truncates, str_plural(nr_truncates));
 #ifdef CONFIG_QUOTA
 	/* Turn off quotas if they were enabled for orphan cleanup */
 	if (quota_update) {

---
base-commit: c143957520c6c9b5cd72e0de8b52b814f0c576fe
change-id: 20260711-remove-plural-macro-7ecfa879fcae

Best regards,
-- 
Kind regards

CJD


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: use str_plural() instead of custom macro
  2026-07-11  6:38 [PATCH] ext4: use str_plural() instead of custom macro Joshua Crofts
@ 2026-07-12 16:33 ` Jan Kara
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kara @ 2026-07-12 16:33 UTC (permalink / raw)
  To: Joshua Crofts
  Cc: Theodore Ts'o, Andreas Dilger, Baokun Li, Jan Kara,
	Ojaswin Mujoo, Ritesh Harjani (IBM), Zhang Yi, linux-ext4,
	linux-kernel

On Sat 11-07-26 08:38:18, Joshua Crofts wrote:
> Remove the custom PLURAL() macro and use str_plural() from
> string_choices.h instead.
> 
> Signed-off-by: Joshua Crofts <joshua.crofts1@gmail.com>

Yeah, I guess it's cleaner this way. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/orphan.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/ext4/orphan.c b/fs/ext4/orphan.c
> index 64ea47624233..e307d6d55451 100644
> --- a/fs/ext4/orphan.c
> +++ b/fs/ext4/orphan.c
> @@ -4,6 +4,7 @@
>  #include <linux/fs.h>
>  #include <linux/quotaops.h>
>  #include <linux/buffer_head.h>
> +#include <linux/string_choices.h>
>  
>  #include "ext4.h"
>  #include "ext4_jbd2.h"
> @@ -486,14 +487,13 @@ void ext4_orphan_cleanup(struct super_block *sb, struct ext4_super_block *es)
>  		}
>  	}
>  
> -#define PLURAL(x) (x), ((x) == 1) ? "" : "s"
>  
>  	if (nr_orphans)
>  		ext4_msg(sb, KERN_INFO, "%d orphan inode%s deleted",
> -		       PLURAL(nr_orphans));
> +			 nr_orphans, str_plural(nr_orphans));
>  	if (nr_truncates)
>  		ext4_msg(sb, KERN_INFO, "%d truncate%s cleaned up",
> -		       PLURAL(nr_truncates));
> +			 nr_truncates, str_plural(nr_truncates));
>  #ifdef CONFIG_QUOTA
>  	/* Turn off quotas if they were enabled for orphan cleanup */
>  	if (quota_update) {
> 
> ---
> base-commit: c143957520c6c9b5cd72e0de8b52b814f0c576fe
> change-id: 20260711-remove-plural-macro-7ecfa879fcae
> 
> Best regards,
> -- 
> Kind regards
> 
> CJD
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-12 16:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-11  6:38 [PATCH] ext4: use str_plural() instead of custom macro Joshua Crofts
2026-07-12 16:33 ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox