public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v3 0/2] btrfs: re-define btrfs_raid_types
Date: Fri, 22 Apr 2022 22:30:25 +0200	[thread overview]
Message-ID: <20220422203025.GJ18596@twin.jikos.cz> (raw)
In-Reply-To: <cover.1650441750.git.wqu@suse.com>

On Wed, Apr 20, 2022 at 04:08:26PM +0800, Qu Wenruo wrote:
> [CHANGELOG]
> Changelog:
> v2:
> - Fix the start value of BTRFS_RAID_RAID0
> 
> v3:
> - Introduce more static sanity checks
>   They are kinda overkilled, but they are only compile time checks, it
>   should be fine.
> 
> - Keep btrfs_bg_flags_to_raid_index() as regular function
> 
> By the nature of BTRFS_BLOCK_GROUP_* profiles, converting the flag into
> an index should only need one bits AND, one if () check for SINGLE
> profile, one right shift to align the values, one ilog2() call which is
> normally converted into ffs() assembly code.
> 
> But we're using a lot of if () branches to do the convert.
> 
> This patch will re-define btrfs_raid_types by:
> 
> - Move it to volumes.h
>   btrfs_raid_types are only used internally, no need to be exposed
>   through UAPI.
> 
> - Re-order btrfs_raid_types
>   To make them match their value order.
> 
> - Use ilog2() to convert them into index
> 
> - Extra static_assert()s to make sure RAID0 is always the least
>   significant bit in PROFILE_MASK
> 
> 
> Qu Wenruo (2):
>   btrfs: move definition of btrfs_raid_types to volumes.h
>   btrfs: use ilog2() to replace if () branches for
>     btrfs_bg_flags_to_raid_index()

I've added the patches to for-next as it looks good as it is now, feel
free to send an update, either an incremental fixup or full resend.

      parent reply	other threads:[~2022-04-22 21:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20  8:08 [PATCH v3 0/2] btrfs: re-define btrfs_raid_types Qu Wenruo
2022-04-20  8:08 ` [PATCH v3 1/2] btrfs: move definition of btrfs_raid_types to volumes.h Qu Wenruo
2022-04-20  8:13   ` Johannes Thumshirn
2022-04-20  8:08 ` [PATCH v3 2/2] btrfs: use ilog2() to replace if () branches for btrfs_bg_flags_to_raid_index() Qu Wenruo
2022-04-20  8:25   ` Johannes Thumshirn
2022-04-20  8:38     ` Qu Wenruo
2022-04-20  8:41       ` Johannes Thumshirn
2022-04-20  9:45         ` Qu Wenruo
2022-04-20 15:16         ` David Sterba
2022-04-20 23:01           ` Qu Wenruo
2022-04-22 20:30 ` David Sterba [this message]

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=20220422203025.GJ18596@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --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