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

From: Christoph Hellwig
Date: Fri Aug 30 2019 - 12:39:22 EST


On Thu, Aug 29, 2019 at 06:50:48PM +0800, Gao Xiang wrote:
> > Please use an erofs_ prefix for all your functions.
>
> It is already a static function, I have no idea what is wrong here.

Which part of all wasn't clear? Have you looked at the prefixes for
most functions in the various other big filesystems?

> > > + /* be careful RCU symlink path (see ext4_inode_info->i_data)! */
> > > + if (is_inode_fast_symlink(inode))
> > > + kfree(inode->i_link);
> >
> > is_inode_fast_symlink only shows up in a later patch. And really
> > obsfucates the check here in the only caller as you can just do an
> > unconditional kfree here - i_link will be NULL except for the case
> > where you explicitly set it.
>
> I cannot fully understand your point (sorry about my English),
> I will reply you about this later.

With that I mean that you should:

1) remove is_inode_fast_symlink and just opencode it in the few places
using it
2) remove the check in this place entirely as it is not needed
3) remove the comment quoted above as it is more confusing than not
having the comment

> > Is there any good reasons to use buffer heads like this in new code
> > vs directly using bios?
>
> This page can save in bdev page cache, it contains not only the erofs
> superblock so it can be fetched in page cache later.

If you want it in the page cache why not use read_mapping_page or similar?

> > > +/* set up default EROFS parameters */
> > > +static void default_options(struct erofs_sb_info *sbi)
> > > +{
> > > +}
> >
> > No need to add an empty function.
>
> Later patch will fill this function.

Please only add the function in the patch actually adding the
functionality.

> > > +}
> >
> > Why is this needed? You can just free your sb privatte information in
> > ->put_super and wire up kill_block_super as the ->kill_sb method
> > directly.
>
> See Al's comments,
> https://lore.kernel.org/r/20190720224955.GD17978@xxxxxxxxxxxxxxxxxx/

With that code it makes sense. In this paticular patch it does not.
So please add it only when actually needed.