From: David Laight <david.laight.linux@gmail.com>
To: Tao Cui <cui.tao@linux.dev>
Cc: axboe@kernel.dk, tj@kernel.org, josef@toxicpanda.com,
cgroups@vger.kernel.org, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, Tao Cui <cuitao@kylinos.cn>
Subject: Re: [PATCH] blk-throttle: fix divide-by-zero on legacy iops limit of 0
Date: Wed, 15 Jul 2026 16:01:09 +0100 [thread overview]
Message-ID: <20260715160109.51f553a7@pumpkin> (raw)
In-Reply-To: <882fbac2-bd42-44a7-8fba-b387b3f0fb2b@linux.dev>
On Wed, 15 Jul 2026 20:44:19 +0800
Tao Cui <cui.tao@linux.dev> wrote:
> 在 2026/7/14 19:37, David Laight 写道:
...
> >> tg_update_slice(tg, rw);
> >> @@ -1386,7 +1391,8 @@ static ssize_t tg_set_conf(struct kernfs_open_file *of,
> >> if (is_u64)
> >> *(u64 *)((void *)tg + of_cft(of)->private) = v;
> >> else
> >> - *(unsigned int *)((void *)tg + of_cft(of)->private) = v;
> >> + *(unsigned int *)((void *)tg + of_cft(of)->private) =
> >> + min_t(u64, v, UINT_MAX);
> >
> > The LHS casts look horrid - there has to be a nicer way to do that.
> >
> > And you don't need min_t() a plain min() will be fine.
> >
> Hi David,
>
> Both done in v2 — introduced a void *field local so the writes read
> *(u64 *)field / *(unsigned int *)field, and switched to
> min(v, (u64)UINT_MAX).
You don't need the cast either.
David
>
> Thanks,
> Tao
> > David
> >
> >
> >
> >>
> >> tg_conf_updated(tg, false);
> >> ret = 0;
> >
>
next prev parent reply other threads:[~2026-07-15 15:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 10:35 [PATCH] blk-throttle: fix divide-by-zero on legacy iops limit of 0 Tao Cui
2026-07-14 11:37 ` David Laight
2026-07-15 12:44 ` Tao Cui
2026-07-15 15:01 ` David Laight [this message]
2026-07-15 16:13 ` Haris Iqbal
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=20260715160109.51f553a7@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=cui.tao@linux.dev \
--cc=cuitao@kylinos.cn \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
/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