From: Josef Bacik <josef@toxicpanda.com>
To: Goffredo Baroncelli <kreijack@libero.it>
Cc: linux-btrfs@vger.kernel.org,
Zygo Blaxell <ce3g8jdj@umail.furryterror.org>,
David Sterba <dsterba@suse.cz>,
Sinnamohideen Shafeeq <shafeeqs@panasas.com>,
Paul Jones <paul@pauljones.id.au>, Boris Burkov <boris@bur.io>,
Goffredo Baroncelli <kreijack@inwind.it>
Subject: Re: [PATCH 1/5] btrfs: add flags to give an hint to the chunk allocator
Date: Tue, 22 Mar 2022 13:51:29 -0400 [thread overview]
Message-ID: <YjoMoSLf5YE2sXYS@localhost.localdomain> (raw)
In-Reply-To: <b15072e61eac46aa9f61317c59219713a01ff897.1646589622.git.kreijack@inwind.it>
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)
> +
Just a style thing here, format it to match everything else, and have the bit
stuff later, as well as newlines between everything since we're commenting.
Also we don't need the () around the values, generally it's best to follow the
style of the surrounding code when in doubt.
I know Dave probably has stronger opinions on this than I do, but I think
something like this would be better.
/*
* btrfs_dev_item.type values.
*
* The _PREFERRED options indicate we prefer to allocate the respective type on
* this device, but will fall back to allocating any chunk type if we run out of
* space. The _ONLY options indicate we will only allocate the given type from
* this device and no other types.
*/
#define BTRFS_DEV_ALLOCATION_HINT_DATA_PREFERRED 0ULL
#define BTRFS_DEV_ALLOCATION_HINT_METADATA_PREFERRED 1ULL
....
#define BTRFS_DEV_ALLOCATION_HINT_BIT_COUNT 2
#define BTRFS_DEV_ALLOCATION_HINT_MASK \
((1 << BTRFS_DEV_ALLOCATION_HINT_BIT_COUNT) - 1)
This will make it a bit clearer and easier to read. Thanks,
Josef
next prev parent reply other threads:[~2022-03-22 17:51 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 [this message]
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
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=YjoMoSLf5YE2sXYS@localhost.localdomain \
--to=josef@toxicpanda.com \
--cc=boris@bur.io \
--cc=ce3g8jdj@umail.furryterror.org \
--cc=dsterba@suse.cz \
--cc=kreijack@inwind.it \
--cc=kreijack@libero.it \
--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