Re: [PATCH v6 03/24] erofs: add super block operations

Christoph Hellwig
2019-09-02T12:51:17Z

On Sun, Sep 01, 2019 at 04:54:55PM +0800, Gao Xiang wrote:
> No modification at this... (some comments already right here...)

> 20 /* 128-byte erofs on-disk super block */
> 21 struct erofs_super_block {
> ...
> 24 __le32 features; /* (aka. feature_compat) */
> ...
> 38 __le32 requirements; /* (aka. feature_incompat) */
> ...
> 41 };

This is only cosmetic, why not stick to feature_compat and
feature_incompat?

> > > + bh = sb_bread(sb, 0);
> >
> > Is there any good reasons to use buffer heads like this in new code
> > vs directly using bios?
>
> As you said, I want it in the page cache.
>
> The reason "why not use read_mapping_page or similar?" is simply
> read_mapping_page -> .readpage -> (for bdev inode) block_read_full_page
> -> create_page_buffers anyway...
>
> sb_bread haven't obsoleted... It has similar function though...

With the different that it keeps you isolated from the buffer_head
internals. This seems to be your only direct use of buffer heads,
which while not deprecated are a bit of an ugly step child. So if
you can easily avoid creating a buffer_head dependency in a new
filesystem I think you should avoid it.

> > > + sbi->build_time = le64_to_cpu(layout->build_time);
> > > + sbi->build_time_nsec = le32_to_cpu(layout->build_time_nsec);
> > > +
> > > + memcpy(&sb->s_uuid, layout->uuid, sizeof(layout->uuid));
> > > + memcpy(sbi->volume_name, layout->volume_name,
> > > + sizeof(layout->volume_name));
> >
> > s_uuid should preferably be a uuid_t (assuming it is a real BE uuid,
> > if it is le it should be a guid_t).
>
> For this case, I have no idea how to deal with...
> I have little knowledge about this uuid stuff, so I just copied
> from f2fs... (Could be no urgent of this field...)

Who fills out this field in the on-disk format and how?

> The background is Al's comments in erofs v2....
> (which simplify erofs_fill_super logic)
> https://lore.kernel.org/r/20190720224955.GD17978@ZenIV.linux.org.uk/
>
> with a specific notation...
> https://lore.kernel.org/r/20190721040547.GF17978@ZenIV.linux.org.uk/
>
> "
> > OTOH, for the case of NULL ->s_root ->put_super() won't be called
> > at all, so in that case you need it directly in ->kill_sb().
> "

Yes. Although none of that is relevant for this initial version,
just after more features are added.