linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] exfat: drop redundant conversion to bool
@ 2025-08-18  9:28 Xichao Zhao
  2025-08-18 11:28 ` Namjae Jeon
  2025-08-19  1:20 ` Yuezhang.Mo
  0 siblings, 2 replies; 4+ messages in thread
From: Xichao Zhao @ 2025-08-18  9:28 UTC (permalink / raw)
  To: linkinjeon, sj1557.seo
  Cc: yuezhang.mo, linux-fsdevel, linux-kernel, Xichao Zhao

The result of integer comparison already evaluates to bool. No need for
explicit conversion.

No functional impact.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 fs/exfat/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c
index c10844e1e16c..f9501c3a3666 100644
--- a/fs/exfat/inode.c
+++ b/fs/exfat/inode.c
@@ -25,7 +25,7 @@ int __exfat_write_inode(struct inode *inode, int sync)
 	struct super_block *sb = inode->i_sb;
 	struct exfat_sb_info *sbi = EXFAT_SB(sb);
 	struct exfat_inode_info *ei = EXFAT_I(inode);
-	bool is_dir = (ei->type == TYPE_DIR) ? true : false;
+	bool is_dir = (ei->type == TYPE_DIR);
 	struct timespec64 ts;
 
 	if (inode->i_ino == EXFAT_ROOT_INO)
-- 
2.34.1


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

* Re: [PATCH] exfat: drop redundant conversion to bool
  2025-08-18  9:28 [PATCH] exfat: drop redundant conversion to bool Xichao Zhao
@ 2025-08-18 11:28 ` Namjae Jeon
  2025-08-19  1:20 ` Yuezhang.Mo
  1 sibling, 0 replies; 4+ messages in thread
From: Namjae Jeon @ 2025-08-18 11:28 UTC (permalink / raw)
  To: Xichao Zhao; +Cc: sj1557.seo, yuezhang.mo, linux-fsdevel, linux-kernel

On Mon, Aug 18, 2025 at 6:28 PM Xichao Zhao <zhao.xichao@vivo.com> wrote:
>
> The result of integer comparison already evaluates to bool. No need for
> explicit conversion.
>
> No functional impact.
>
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
Applied it to #dev.
Thanks!

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

* Re: [PATCH] exfat: drop redundant conversion to bool
  2025-08-18  9:28 [PATCH] exfat: drop redundant conversion to bool Xichao Zhao
  2025-08-18 11:28 ` Namjae Jeon
@ 2025-08-19  1:20 ` Yuezhang.Mo
  2025-08-19 10:16   ` 赵西超
  1 sibling, 1 reply; 4+ messages in thread
From: Yuezhang.Mo @ 2025-08-19  1:20 UTC (permalink / raw)
  To: Xichao Zhao, linkinjeon@kernel.org, sj1557.seo@samsung.com
  Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org

> The result of integer comparison already evaluates to bool. No need for
> explicit conversion.
> 
> No functional impact.
> 
> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
> ---
>  fs/exfat/inode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c
> index c10844e1e16c..f9501c3a3666 100644
> --- a/fs/exfat/inode.c
> +++ b/fs/exfat/inode.c
> @@ -25,7 +25,7 @@ int __exfat_write_inode(struct inode *inode, int sync)
>         struct super_block *sb = inode->i_sb;
>         struct exfat_sb_info *sbi = EXFAT_SB(sb);
>         struct exfat_inode_info *ei = EXFAT_I(inode);
> -       bool is_dir = (ei->type == TYPE_DIR) ? true : false;
> +       bool is_dir = (ei->type == TYPE_DIR);
>         struct timespec64 ts;
> 
>         if (inode->i_ino == EXFAT_ROOT_INO)

The following two if statements both check whether the directory is the root. 
Can we remove the second if statement? I don't know its background.

        if (inode->i_ino == EXFAT_ROOT_INO)
                return 0;

        if (is_dir && ei->dir.dir == sbi->root_dir && ei->entry == -1) 
                return 0;

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

* Re: [PATCH] exfat: drop redundant conversion to bool
  2025-08-19  1:20 ` Yuezhang.Mo
@ 2025-08-19 10:16   ` 赵西超
  0 siblings, 0 replies; 4+ messages in thread
From: 赵西超 @ 2025-08-19 10:16 UTC (permalink / raw)
  To: Yuezhang.Mo@sony.com, linkinjeon@kernel.org,
	sj1557.seo@samsung.com
  Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org


>> The result of integer comparison already evaluates to bool. No need for
>> explicit conversion.
>>
>> No functional impact.
>>
>> Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
>> ---
>>   fs/exfat/inode.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c
>> index c10844e1e16c..f9501c3a3666 100644
>> --- a/fs/exfat/inode.c
>> +++ b/fs/exfat/inode.c
>> @@ -25,7 +25,7 @@ int __exfat_write_inode(struct inode *inode, int sync)
>>          struct super_block *sb = inode->i_sb;
>>          struct exfat_sb_info *sbi = EXFAT_SB(sb);
>>          struct exfat_inode_info *ei = EXFAT_I(inode);
>> -       bool is_dir = (ei->type == TYPE_DIR) ? true : false;
>> +       bool is_dir = (ei->type == TYPE_DIR);
>>          struct timespec64 ts;
>>
>>          if (inode->i_ino == EXFAT_ROOT_INO)
> The following two if statements both check whether the directory is the root.
> Can we remove the second if statement? I don't know its background.
>
>          if (inode->i_ino == EXFAT_ROOT_INO)
>                  return 0;
>
>          if (is_dir && ei->dir.dir == sbi->root_dir && ei->entry == -1)
>                  return 0;

I agree with your view.

Best regards,


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

end of thread, other threads:[~2025-08-19 10:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-18  9:28 [PATCH] exfat: drop redundant conversion to bool Xichao Zhao
2025-08-18 11:28 ` Namjae Jeon
2025-08-19  1:20 ` Yuezhang.Mo
2025-08-19 10:16   ` 赵西超

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).