From: Tao Cui <cui.tao@linux.dev>
To: David Laight <david.laight.linux@gmail.com>
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: Thu, 16 Jul 2026 23:10:53 +0800 [thread overview]
Message-ID: <476584BB-6659-49D9-B4F6-7C84A35BD73D@linux.dev> (raw)
In-Reply-To: <20260715160109.51f553a7@pumpkin>
于 2026年7月15日 GMT+08:00 23:01:09,David Laight <david.laight.linux@gmail.com> 写道:
>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.
Noted, this will be done in the next version.
Thanks,
Tao
>
> David
>
>>
>> Thanks,
>> Tao
>> > David
>> >
>> >
>> >
>> >>
>> >> tg_conf_updated(tg, false);
>> >> ret = 0;
>> >
>>
>
next prev parent reply other threads:[~2026-07-16 15:13 UTC|newest]
Thread overview: 7+ 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
2026-07-16 15:10 ` Tao Cui [this message]
2026-07-15 16:13 ` Haris Iqbal
2026-07-16 15:12 ` Tao Cui
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=476584BB-6659-49D9-B4F6-7C84A35BD73D@linux.dev \
--to=cui.tao@linux.dev \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=cuitao@kylinos.cn \
--cc=david.laight.linux@gmail.com \
--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