All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>
Cc: Johannes Thumshirn <jth@kernel.org>, Chris Mason <clm@fb.com>,
	Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] btrfs: rst: remove encoding field from stripe_extent
Date: Sun, 16 Jun 2024 20:19:08 +0200	[thread overview]
Message-ID: <20240616181908.GE25756@suse.cz> (raw)
In-Reply-To: <d6cf3e45-aaf0-4256-92c1-bb8780c76da2@wdc.com>

On Fri, Jun 14, 2024 at 09:36:34AM +0000, Johannes Thumshirn wrote:
> On 13.06.24 23:23, David Sterba wrote:
> > On Tue, Jun 11, 2024 at 04:33:19PM +0000, Johannes Thumshirn wrote:
> >> On 11.06.24 16:37, David Sterba wrote:
> >>> On Mon, Jun 10, 2024 at 10:40:25AM +0200, Johannes Thumshirn wrote:
> >>>> -#define BTRFS_STRIPE_RAID5	5
> >>>> -#define BTRFS_STRIPE_RAID6	6
> >>>> -#define BTRFS_STRIPE_RAID1C3	7
> >>>> -#define BTRFS_STRIPE_RAID1C4	8
> >>>> -
> >>>>    struct btrfs_stripe_extent {
> >>>> -	__u8 encoding;
> >>>> -	__u8 reserved[7];
> >>>>    	/* An array of raid strides this stripe is composed of. */
> >>>> -	struct btrfs_raid_stride strides[];
> >>>> +	__DECLARE_FLEX_ARRAY(struct btrfs_raid_stride, strides);
> >>>
> >>> Is there a reason to use the __ underscore macro? I see no difference
> >>> between that and DECLARE_FLEX_ARRAY and underscore usually means that
> >>> it's special in some way.
> >>>
> >>
> >> Yes, the __ version is for UAPI, like __u8 or __le32 and so on.
> > 
> > I see, though I'd rather keep the on-disk definitions free of wrappers
> > that hide the types. We use the __ int types but that's all and quite
> > clear what it means.
> > 
> > There already are flexible members (btrfs_leaf, btrfs_node,
> > btrfs_inode_extref), using the empty[] syntax. The macro wraps the
> > distinction that c++ needs but so far the existing declarations have't
> > been problematic.  So I'd rather keep the declarations consistent.
> > 
> 
> Yes but all these examples have other members as well. After this patch, 
> btrfs_stripe_extent is a container for btrfs_raid_stride, and C doesn't 
> allow a flexmember only struct:
> 
> In file included from fs/btrfs/ctree.h:18,
>                   from fs/btrfs/delayed-inode.h:19,
>                   from fs/btrfs/super.c:32:
> ./include/uapi/linux/btrfs_tree.h:753:34: error: flexible array member 
> in a struct with no named members
>    753 |         struct btrfs_raid_stride strides[];
>        |                                  ^~~~~~~

To fix that __DECLARE_FLEX_ARRAY adds the layer of an anonymous struct
and an empty other member. We'd have to duplicate that so let's use the
macro.

  reply	other threads:[~2024-06-16 18:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-10  8:40 [PATCH 0/3] btrfs: rst: updates for RAID stripe tree Johannes Thumshirn
2024-06-10  8:40 ` [PATCH 1/3] btrfs: rst: remove encoding field from stripe_extent Johannes Thumshirn
2024-06-11 14:36   ` David Sterba
2024-06-11 16:33     ` Johannes Thumshirn
2024-06-13 21:23       ` David Sterba
2024-06-14  9:36         ` Johannes Thumshirn
2024-06-16 18:19           ` David Sterba [this message]
2024-06-17  6:27   ` Qu Wenruo
2024-06-10  8:40 ` [PATCH 2/3] btrfs: replace stripe extents Johannes Thumshirn
2024-06-10 19:43   ` Josef Bacik
2024-06-11  6:27     ` Johannes Thumshirn
2024-06-10  8:40 ` [PATCH 3/3] btrfs: split RAID stripes on deletion Johannes Thumshirn
2024-06-10 19:45   ` Josef Bacik
2024-06-11  6:39     ` 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=20240616181908.GE25756@suse.cz \
    --to=dsterba@suse.cz \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=jth@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.