Re: [PATCH v3][next] xfs: Replace one-element arrays with flexible-array members

From: Darrick J. Wong
Date: Sat Mar 20 2021 - 16:18:14 EST


On Mon, Mar 15, 2021 at 01:31:17PM -0500, Gustavo A. R. Silva wrote:
>
>
> On 3/10/21 22:47, Darrick J. Wong wrote:
> > On Wed, Mar 10, 2021 at 10:23:02PM -0600, Gustavo A. R. Silva wrote:
> >> There is a regular need in the kernel to provide a way to declare having
> >> a dynamically sized set of trailing elements in a structure. Kernel code
> >> should always use “flexible array members”[1] for these cases. The older
> >> style of one-element or zero-length arrays should no longer be used[2].
> >>
> >> Refactor the code according to the use of flexible-array members in
> >> multiple structures, instead of one-element arrays. Also, make use of
> >> the new struct_size() helper to properly calculate the size of multiple
> >> structures that contain flexible-array members. Additionally, wrap
> >> some calls to the struct_size() helper in multiple inline functions.
> >>
> >> Below are the results of running xfstests for groups shutdown and log
> >> with the following configuration in local.config:
> >>
> >> export TEST_DEV=/dev/sda3
> >> export TEST_DIR=/mnt/test
> >> export SCRATCH_DEV=/dev/sda4
> >> export SCRATCH_MNT=/mnt/scratch
> >>
> >> The size for both partitions /dev/sda3 and /dev/sda4 is 25GB.
> >
> > Looks good to me, will toss it at my fstests cloud and see if anything
> > shakes out. Thanks for cleaning up this goofy thorn-pile!
>
> Great. It's been fun to work on this. :p

Did you run the /entire/ fstests suite? With this patch applied to
5.12-rc2, I keep seeing list corruption assertions about an hour into
the test run, and usually on some test that heavily exercises allocating
and deleting file extents. I'll try to look at this patch more closely
next week, but I figured I should let you know early, on the off chance
something sticks out to you.

--D

> > Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx>
>
> Thanks!
> --
> Gustavo