From: Goffredo Baroncelli <kreijack@inwind.it>
To: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
Cc: Josef Bacik <josef@toxicpanda.com>,
linux-btrfs@vger.kernel.org, David Sterba <dsterba@suse.cz>,
Sinnamohideen Shafeeq <shafeeqs@panasas.com>,
Paul Jones <paul@pauljones.id.au>, Boris Burkov <boris@bur.io>
Subject: Re: [PATCH 1/5] btrfs: add flags to give an hint to the chunk allocator
Date: Thu, 24 Mar 2022 20:05:58 +0100 [thread overview]
Message-ID: <ee73fbf4-8126-01dd-c740-88b6cbdd3d86@inwind.it> (raw)
In-Reply-To: <YjqMXjn1wLAXVwKl@hungrycats.org>
On 23/03/2022 03.56, Zygo Blaxell wrote:
> On Tue, Mar 22, 2022 at 09:25:45PM +0100, Goffredo Baroncelli wrote:
>> On 22/03/2022 20.52, Josef Bacik wrote:
>>> On Sun, Mar 06, 2022 at 07:14:39PM +0100, Goffredo Baroncelli wrote:
>>>> From: Goffredo Baroncelli <kreijack@inwind.it>
>>>>
>>>> Add the following flags to give an hint about which chunk should be
>>>> allocated in which disk:
>>>>
>>>> - BTRFS_DEV_ALLOCATION_HINT_DATA_PREFERRED
>>>> preferred for data chunk, but metadata chunk allowed
>>>> - BTRFS_DEV_ALLOCATION_HINT_METADATA_PREFERRED
>>>> preferred for metadata chunk, but data chunk allowed
>>>> - BTRFS_DEV_ALLOCATION_HINT_METADATA_ONLY
>>>> only metadata chunk allowed
>>>> - BTRFS_DEV_ALLOCATION_HINT_DATA_ONLY
>>>> only data chunk allowed
>>>>
>>>> Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
>>>> ---
>>>> include/uapi/linux/btrfs_tree.h | 16 ++++++++++++++++
>>>> 1 file changed, 16 insertions(+)
>>>>
>>>> diff --git a/include/uapi/linux/btrfs_tree.h b/include/uapi/linux/btrfs_tree.h
>>>> index b069752a8ecf..e0d842c2e616 100644
>>>> --- a/include/uapi/linux/btrfs_tree.h
>>>> +++ b/include/uapi/linux/btrfs_tree.h
>>>> @@ -389,6 +389,22 @@ struct btrfs_key {
>>>> __u64 offset;
>>>> } __attribute__ ((__packed__));
>>>> +/* dev_item.type */
>>>> +
>>>> +/* btrfs chunk allocation hint */
>>>> +#define BTRFS_DEV_ALLOCATION_HINT_BIT_COUNT 2
>>>> +/* btrfs chunk allocation hint mask */
>>>> +#define BTRFS_DEV_ALLOCATION_HINT_MASK \
>>>> + ((1 << BTRFS_DEV_ALLOCATION_HINT_BIT_COUNT) - 1)
>>>> +/* preferred data chunk, but metadata chunk allowed */
>>>> +#define BTRFS_DEV_ALLOCATION_HINT_DATA_PREFERRED (0ULL)
>>>> +/* preferred metadata chunk, but data chunk allowed */
>>>> +#define BTRFS_DEV_ALLOCATION_HINT_METADATA_PREFERRED (1ULL)
>>>> +/* only metadata chunk are allowed */
>>>> +#define BTRFS_DEV_ALLOCATION_HINT_METADATA_ONLY (2ULL)
>>>> +/* only data chunk allowed */
>>>> +#define BTRFS_DEV_ALLOCATION_HINT_DATA_ONLY (3ULL)
>>>> +
>>>
>>> I also just realized you're using these as flags, so they need to be
>>>
>>> (1ULL << 0)
>>> (1ULL << 1)
>>> (1ULL << 2)
>>> (1ULL << 3)
>>>
>>
>> Could you elaborate a bit ? These are mutual exclusive values...
>
> One of the comments I had on earlier versions was that these should
> be bit values. Bit 0 is data (0) or metadata (1), bit 1 is preferred
> (0) or only (2). Thus "metadata only" is 3, "data preferred" is 0,
> "data only" is 2, and "metadata preferred" is 1. This maintained on-disk
> compatibility with the earliest versions that only had the two "preferred"
> options encoded as 0 and 1.
At this point I would prefer to not change this part.
> At some point this got lost. Between one of the patch versions and
> another I had to change the type numbers on all of my devices.
I remember that in the first iterations I used 3 bits, when now I use
only two bits. So it is possible that I changed the values.
>
>>> Thanks,
>>>
>>> Josef
>>
>>
>> --
>> gpg @keyserver.linux.it: Goffredo Baroncelli <kreijackATinwind.it>
>> Key fingerprint BBF5 1610 0B64 DAC6 5F7D 17B2 0EDA 9B37 8B82 E0B5
>>
--
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:[~2022-03-24 19:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-06 18:14 [PATCH 0/5][V12] btrfs: allocation_hint Goffredo Baroncelli
2022-03-06 18:14 ` [PATCH 1/5] btrfs: add flags to give an hint to the chunk allocator Goffredo Baroncelli
2022-03-22 17:51 ` Josef Bacik
2022-03-22 17:56 ` Josef Bacik
2022-03-22 18:49 ` Goffredo Baroncelli
2022-04-06 19:32 ` Goffredo Baroncelli
2022-03-23 3:26 ` Zygo Blaxell
2022-03-22 19:52 ` Josef Bacik
2022-03-22 20:25 ` Goffredo Baroncelli
2022-03-23 2:56 ` Zygo Blaxell
2022-03-24 19:05 ` Goffredo Baroncelli [this message]
2022-03-25 14:59 ` Josef Bacik
2022-03-25 18:55 ` Goffredo Baroncelli
2022-03-06 18:14 ` [PATCH 2/5] btrfs: export the device allocation_hint property in sysfs Goffredo Baroncelli
2022-03-08 13:25 ` kernel test robot
2022-03-22 18:05 ` Josef Bacik
2022-03-22 19:02 ` Goffredo Baroncelli
2022-03-06 18:14 ` [PATCH 3/5] btrfs: change the device allocation_hint property via sysfs Goffredo Baroncelli
2022-03-22 19:19 ` Josef Bacik
2022-03-22 19:52 ` Goffredo Baroncelli
2022-03-06 18:14 ` [PATCH 4/5] btrfs: add allocation_hint mode Goffredo Baroncelli
2022-03-22 19:47 ` Josef Bacik
2022-03-22 20:56 ` Goffredo Baroncelli
2022-03-06 18:14 ` [PATCH 5/5] btrfs: rename dev_item->type to dev_item->flags Goffredo Baroncelli
2022-03-21 20:29 ` [PATCH 0/5][V12] btrfs: allocation_hint Goffredo Baroncelli
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=ee73fbf4-8126-01dd-c740-88b6cbdd3d86@inwind.it \
--to=kreijack@inwind.it \
--cc=boris@bur.io \
--cc=ce3g8jdj@umail.furryterror.org \
--cc=dsterba@suse.cz \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=paul@pauljones.id.au \
--cc=shafeeqs@panasas.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