On 9/15/22 8:42 PM, Jia Zhu wrote:

>  struct erofs_fscache *erofs_fscache_register_cookie(struct super_block *sb,
>                                                    char *name, bool 
> need_inode)
>  {
> @@ -481,27 +578,18 @@ void erofs_fscache_unregister_cookie(struct 
> erofs_fscache *ctx)
>  int erofs_fscache_register_fs(struct super_block *sb)
>  {
>       struct erofs_sb_info *sbi = EROFS_SB(sb);
> -     struct fscache_volume *volume;
>       struct erofs_fscache *fscache;
> -     char *name;
> -     int ret = 0;
> -
> -     name = kasprintf(GFP_KERNEL, "erofs,%s", sbi->opt.fsid);
> -     if (!name)
> -             return -ENOMEM;
> -
> -     volume = fscache_acquire_volume(name, NULL, NULL, 0);
> -     if (IS_ERR_OR_NULL(volume)) {
> -             erofs_err(sb, "failed to register volume for %s", name);
> -             kfree(name);
> -             return volume ? PTR_ERR(volume) : -EOPNOTSUPP;
> -     }
> +     int ret;
>  
> -     sbi->volume = volume;
> -     kfree(name);
> +     if (sbi->opt.domain_id)
> +             ret = erofs_fscache_register_domain(sb);
> +     else
> +             ret = erofs_fscache_register_volume(sb);
> +     if (ret)
> +             return ret;
>  
> +     /* acquired domain/volume will be relinquished in kill_sb() if error 
> occurs */

"... in kill_sb() on error" is better to make this line within 80 chars
length.


>       fscache = erofs_fscache_register_cookie(sb, sbi->opt.fsid, true);
> -     /* acquired volume will be relinquished in kill_sb() */
>       if (IS_ERR(fscache))
>               return PTR_ERR(fscache);
>  


-- 
Thanks,
Jingbo

Reply via email to