From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
Qu Wenruo <wqu@suse.com>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 2/3] btrfs: small improvement for btrfs_io_context structure
Date: Mon, 30 Jan 2023 15:31:00 +0800 [thread overview]
Message-ID: <7215d466-7476-e322-e8cc-d5fd4841ce79@gmx.com> (raw)
In-Reply-To: <e776fcff-3c57-1b77-9c83-bacc0e473f5c@wdc.com>
On 2023/1/30 15:27, Johannes Thumshirn wrote:
> On 28.01.23 09:23, Qu Wenruo wrote:
>> @@ -5888,13 +5888,22 @@ static struct btrfs_io_context *alloc_btrfs_io_context(struct btrfs_fs_info *fs_
>> int total_stripes,
>> int real_stripes)
>> {
>> - struct btrfs_io_context *bioc = kzalloc(
>> + struct btrfs_io_context *bioc;
>> +
>> + /*
>> + * We should have valid number of stripes, larger than U16_MAX(65535)
>> + * indicates something totally wrong, as our on-disk format is only
>> + * at u16.
>> + */
>> + ASSERT(total_stripes < U16_MAX && total_stripes > 0);
>
> Shouldn't we better change 'int total_stripes' and 'int real_stripes' to u16?
> That'll imply above ASSERT()
Right, that is way better.
Thanks,
Qu
next prev parent reply other threads:[~2023-01-30 7:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-28 8:23 [PATCH 0/3] btrfs: reduce the memory usage for replace in btrfs_io_context Qu Wenruo
2023-01-28 8:23 ` [PATCH 1/3] btrfs: simplify the @bioc argument for handle_ops_on_dev_replace() Qu Wenruo
2023-01-30 7:17 ` Johannes Thumshirn
2023-01-31 11:54 ` Anand Jain
2023-01-28 8:23 ` [PATCH 2/3] btrfs: small improvement for btrfs_io_context structure Qu Wenruo
2023-01-30 7:27 ` Johannes Thumshirn
2023-01-30 7:31 ` Qu Wenruo [this message]
2023-02-02 6:28 ` Anand Jain
2023-02-02 6:47 ` Qu Wenruo
2023-02-02 9:12 ` Anand Jain
2023-02-07 2:19 ` Qu Wenruo
2023-02-03 6:19 ` Christoph Hellwig
2023-02-03 6:44 ` Qu Wenruo
2023-01-28 8:23 ` [PATCH 3/3] btrfs: use a more space efficient way to represent the source of duplicated stripes Qu Wenruo
2023-01-30 7:40 ` Johannes Thumshirn
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=7215d466-7476-e322-e8cc-d5fd4841ce79@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=Johannes.Thumshirn@wdc.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.com \
/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