[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cf7c0f78-abaa-de56-3809-17c510018ed5@linux.alibaba.com>
Date: Fri, 16 Sep 2022 10:02:06 +0800
From: JeffleXu <jefflexu@...ux.alibaba.com>
To: Jia Zhu <zhujia.zj@...edance.com>, linux-erofs@...ts.ozlabs.org
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
yinxin.x@...edance.com
Subject: Re: [PATCH V4 2/6] erofs: code clean up for fscache
On 9/15/22 8:42 PM, Jia Zhu wrote:
> @@ -502,12 +493,19 @@ int erofs_fscache_register_fs(struct super_block *sb)
> volume = fscache_acquire_volume(name, NULL, NULL, 0);
> if (IS_ERR_OR_NULL(volume)) {
> erofs_err(sb, "failed to register volume for %s", name);
> - ret = volume ? PTR_ERR(volume) : -EOPNOTSUPP;
> - volume = NULL;
> + kfree(name);
> + return volume ? PTR_ERR(volume) : -EOPNOTSUPP;
> }
>
> sbi->volume = volume;
> kfree(name);
> +
> + 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);
> +
> + sbi->s_fscache = fscache;
> return ret;
The local variable "ret" is not used in this case.
> @@ -889,7 +885,6 @@ static void erofs_kill_sb(struct super_block *sb)
>
> erofs_free_dev_context(sbi->devs);
> fs_put_dax(sbi->dax_dev, NULL);
> - erofs_fscache_unregister_cookie(&sbi->s_fscache);
> erofs_fscache_unregister_fs(sb);
> kfree(sbi->opt.fsid);
> kfree(sbi);
> @@ -909,7 +904,8 @@ static void erofs_put_super(struct super_block *sb)
> iput(sbi->managed_cache);
> sbi->managed_cache = NULL;
> #endif
> - erofs_fscache_unregister_cookie(&sbi->s_fscache);
> + erofs_fscache_unregister_fs(sb);
> + sbi->s_fscache = NULL;
This line is not needed since we already call
erofs_fscache_unregister_fs() here.
With these fixed:
Reviewed-by: Jingbo Xu <jefflexu@...ux.alibaba.com>
--
Thanks,
Jingbo
Powered by blists - more mailing lists