On Thu, Mar 07, 2024 at 10:44:59AM +0800, Baokun Li wrote:Totally agree! It does streamline a lot!
+static int erofs_anon_init_fs_context(struct fs_context *fc)
+{
+ fc->ops = &erofs_anon_context_ops;
+ return 0;
+}
ITYM
struct pseudo_fs_context *ctx = init_pseudo(fc, EROFS_SUPER_MAGIC);
return ctx ? 0 : -ENOMEM;
and to hell with erofs_anon_context_ops, along with its fill_super, calls
of simple_fill_super(), etc. Unless I'm missing something, you are not
even creating dentries here, let alone making them possible to look up.
Sure, I'll just use kill_anon_super().+static void erofs_kill_pseudo_sb(struct super_block *sb)*blink*
+{
+ kill_anon_super(sb);
+}
What's wrong with simply using kill_anon_super as ->kill_sb?
The helper function here is to avoid extern erofs_anon_fs_type(), because+int erofs_anon_register_fs(void)What for? The only thing it gives you is an ability to look it up by
+{
+ return register_filesystem(&erofs_anon_fs_type);
+}
name. Which is completely pointless, IMO,
Thanks for having a look!
if (!erofs_pseudo_mnt) {... since you are getting to it by direct reference to file_system_type
- struct vfsmount *mnt = kern_mount(&erofs_fs_type);
+ struct vfsmount *mnt = kern_mount(&erofs_anon_fs_type);
anyway. Same unregistering, of course...