From: Dave Kleikamp <dave.kleikamp@oracle.com>
To: Jiangshan Yi <13667453960@163.com>
Cc: jfs-discussion@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
Jiangshan Yi <yijiangshan@kylinos.cn>
Subject: Re: [PATCH] fs/jfs: replace ternary operator with min_t()
Date: Mon, 17 Oct 2022 15:03:15 -0500 [thread overview]
Message-ID: <162aa836-339e-80e2-3d55-7e6bdcb89296@oracle.com> (raw)
In-Reply-To: <20220714025656.1685439-1-13667453960@163.com>
Catching up on old patches. Sorry this took so long. Looks good to me.
I'll push it to mainline.
Thanks,
Shaggy
On 7/13/22 9:56PM, Jiangshan Yi wrote:
> From: Jiangshan Yi <yijiangshan@kylinos.cn>
>
> Fix the following coccicheck warning:
>
> fs/jfs/super.c:748: WARNING opportunity for min().
> fs/jfs/super.c:788: WARNING opportunity for min().
>
> min_t() macro is defined in include/linux/minmax.h. It avoids
> multiple evaluations of the arguments when non-constant and performs
> strict type-checking.
>
> Signed-off-by: Jiangshan Yi <yijiangshan@kylinos.cn>
> ---
> fs/jfs/super.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/fs/jfs/super.c b/fs/jfs/super.c
> index 85d4f44f2ac4..d2f82cb7db1b 100644
> --- a/fs/jfs/super.c
> +++ b/fs/jfs/super.c
> @@ -745,8 +745,7 @@ static ssize_t jfs_quota_read(struct super_block *sb, int type, char *data,
> len = i_size-off;
> toread = len;
> while (toread > 0) {
> - tocopy = sb->s_blocksize - offset < toread ?
> - sb->s_blocksize - offset : toread;
> + tocopy = min_t(size_t, sb->s_blocksize - offset, toread);
>
> tmp_bh.b_state = 0;
> tmp_bh.b_size = i_blocksize(inode);
> @@ -785,8 +784,7 @@ static ssize_t jfs_quota_write(struct super_block *sb, int type,
>
> inode_lock(inode);
> while (towrite > 0) {
> - tocopy = sb->s_blocksize - offset < towrite ?
> - sb->s_blocksize - offset : towrite;
> + tocopy = min_t(size_t, sb->s_blocksize - offset, towrite);
>
> tmp_bh.b_state = 0;
> tmp_bh.b_size = i_blocksize(inode);
prev parent reply other threads:[~2022-10-17 20:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-14 2:56 Jiangshan Yi
2022-10-17 20:03 ` Dave Kleikamp [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=162aa836-339e-80e2-3d55-7e6bdcb89296@oracle.com \
--to=dave.kleikamp@oracle.com \
--cc=13667453960@163.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=yijiangshan@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®