Re: [PATCH v6 01/24] erofs: add on-disk layout

From: Gao Xiang
Date: Fri Aug 30 2019 - 08:18:24 EST


Hi David,

On Fri, Aug 30, 2019 at 02:07:14PM +0200, David Sterba wrote:
> On Thu, Aug 29, 2019 at 08:58:17AM -0700, Joe Perches wrote:
> > On Thu, 2019-08-29 at 18:32 +0800, Gao Xiang wrote:
> > > Hi Christoph,
> > >
> > > On Thu, Aug 29, 2019 at 02:59:54AM -0700, Christoph Hellwig wrote:
> > > > > --- /dev/null
> > > > > +++ b/fs/erofs/erofs_fs.h
> > > > > @@ -0,0 +1,316 @@
> > > > > +/* SPDX-License-Identifier: GPL-2.0-only OR Apache-2.0 */
> > > > > +/*
> > > > > + * linux/fs/erofs/erofs_fs.h
> > > >
> > > > Please remove the pointless file names in the comment headers.
> > >
> > > Already removed in the latest version.
> > >
> > > > > +struct erofs_super_block {
> > > > > +/* 0 */__le32 magic; /* in the little endian */
> > > > > +/* 4 */__le32 checksum; /* crc32c(super_block) */
> > > > > +/* 8 */__le32 features; /* (aka. feature_compat) */
> > > > > +/* 12 */__u8 blkszbits; /* support block_size == PAGE_SIZE only */
> > > >
> > > > Please remove all the byte offset comments. That is something that can
> > > > easily be checked with gdb or pahole.
> > >
> > > I have no idea the actual issue here.
> > > It will help all developpers better add fields or calculate
> > > these offsets in their mind, and with care.
> > >
> > > Rather than they didn't run "gdb" or "pahole" and change it by mistake.
> >
> > I think Christoph is not right here.
> >
> > Using external tools for validation is extra work
> > when necessary for understanding the code.
>
> The advantage of using the external tools that the information about
> offsets is provably correct ...
>
> > The expected offset is somewhat valuable, but
> > perhaps the form is a bit off given the visual
> > run-in to the field types.
> >
> > The extra work with this form is manipulating all
> > the offsets whenever a structure change occurs.
>
> ... while this is error prone.

I will redo a full patchset and comments addressing
what Christoph all said yesterday.

Either form is fine with me for this case, let's remove
them instead.

Thanks,
Gao Xiang

>
> > The comments might be better with a form more like:
> >
> > struct erofs_super_block { /* offset description */
> > __le32 magic; /* 0 */
> > __le32 checksum; /* 4 crc32c(super_block) */
> > __le32 features; /* 8 (aka. feature_compat) */
> > __u8 blkszbits; /* 12 support block_size == PAGE_SIZE only */