From: Goffredo Baroncelli <kreijack@libero.it>
To: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
Cc: linux-btrfs@vger.kernel.org, Josef Bacik <josef@toxicpanda.com>,
Goffredo Baroncelli <kreijack@inwind.it>
Subject: Re: [PATCH 5/5] btrfs: add allocator_hint mode
Date: Fri, 5 Feb 2021 19:01:52 +0100 [thread overview]
Message-ID: <9b4fc7b1-750c-643d-8487-153e5cf7cebd@libero.it> (raw)
In-Reply-To: <20210204232445.GC32440@hungrycats.org>
On 2/5/21 12:24 AM, Zygo Blaxell wrote:
> On Mon, Feb 01, 2021 at 10:28:20PM +0100, Goffredo Baroncelli wrote:
>> From: Goffredo Baroncelli <kreijack@inwind.it>
[...]
Hi Zygo
>
> Well, I guess if you're going to keep putting the mount option in each
> new patch version, then I'm going to keep saying "please remove the
> mount option" from each new patch version.
>
> The right side of this || can be deleted, and the entire patch 4/5
> (which adds the mount option).
In the next iteration I will move the "mount option" patch at the end of the chain; this will help you to remove this part of the patch that you don't like.
[...]
> (gdb) l *(btrfs_alloc_chunk+0x74b)
> 0xffffffff8190c3ab is in btrfs_alloc_chunk (fs/btrfs/volumes.c:5047).
> 5042 ndevs = 0;
> 5043 while (ndevs < ctl->ndevs) {
> 5044 hint = devices_info[ndevs++].alloc_hint;
> 5045 while (devices_info[ndevs].alloc_hint == hint &&
> 5046 ndevs < ctl->ndevs)
this check is WRONG. The left and right side of && have to be swapped. Otherwise it is possible
an access to the last element+1 of the array before the out of bound check.
My fault.
> 5047 ndevs++;
> 5048 if (ndevs >= ctl->devs_min)
> 5049 break;
> 5050 }
> 5051
BR
G.Baroncelli
>
>> + if (ndevs >= ctl->devs_min)
>> + break;
>> + }
>> +
>> + BUG_ON(ndevs > ctl->ndevs);
>> + ctl->ndevs = ndevs;
>> +
>> return 0;
>> }
>>
>> diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h
>> index d776b7f55d56..31a3e4cf93b5 100644
>> --- a/fs/btrfs/volumes.h
>> +++ b/fs/btrfs/volumes.h
>> @@ -364,6 +364,7 @@ struct btrfs_device_info {
>> u64 dev_offset;
>> u64 max_avail;
>> u64 total_avail;
>> + int alloc_hint;
>> };
>>
>> struct btrfs_raid_attr {
>> --
>> 2.30.0
>>
--
gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it>
Key fingerprint BBF5 1610 0B64 DAC6 5F7D 17B2 0EDA 9B37 8B82 E0B5
next prev parent reply other threads:[~2021-02-05 18:06 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-01 21:28 [RFC][PATCH V6] btrfs: allocation_hint mode Goffredo Baroncelli
2021-02-01 21:28 ` [PATCH 1/5] btrfs: add ioctl BTRFS_IOC_DEV_PROPERTIES Goffredo Baroncelli
2021-02-10 16:08 ` Josef Bacik
2021-02-11 18:47 ` Goffredo Baroncelli
2021-02-01 21:28 ` [PATCH 2/5] btrfs: add flags to give an hint to the chunk allocator Goffredo Baroncelli
2021-02-10 16:09 ` Josef Bacik
2021-02-11 18:47 ` Goffredo Baroncelli
2021-02-01 21:28 ` [PATCH 3/5] btrfs: export dev_item.type in /sys/fs/btrfs/<uuid>/devinfo/<devid>/type Goffredo Baroncelli
2021-02-01 21:28 ` [PATCH 4/5] btrfs: add allocation_hint option Goffredo Baroncelli
2021-02-10 16:14 ` Josef Bacik
2021-02-11 18:46 ` Goffredo Baroncelli
2021-02-01 21:28 ` [PATCH 5/5] btrfs: add allocator_hint mode Goffredo Baroncelli
2021-02-04 23:24 ` Zygo Blaxell
2021-02-05 18:01 ` Goffredo Baroncelli [this message]
2021-02-10 16:12 ` Josef Bacik
2021-02-11 18:46 ` Goffredo Baroncelli
2021-02-19 18:51 ` Goffredo Baroncelli
2021-02-10 16:04 ` [RFC][PATCH V6] btrfs: allocation_hint mode Josef Bacik
2021-02-11 18:47 ` Goffredo Baroncelli
2021-02-11 18:58 ` Josef Bacik
2021-02-16 22:27 ` Josef Bacik
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=9b4fc7b1-750c-643d-8487-153e5cf7cebd@libero.it \
--to=kreijack@libero.it \
--cc=ce3g8jdj@umail.furryterror.org \
--cc=josef@toxicpanda.com \
--cc=kreijack@inwind.it \
--cc=linux-btrfs@vger.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