lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-Id: <20230807110936.21819-10-zhengqi.arch@bytedance.com> Date: Mon, 7 Aug 2023 19:08:57 +0800 From: Qi Zheng <zhengqi.arch@...edance.com> To: akpm@...ux-foundation.org, david@...morbit.com, tkhai@...ru, vbabka@...e.cz, roman.gushchin@...ux.dev, djwong@...nel.org, brauner@...nel.org, paulmck@...nel.org, tytso@....edu, steven.price@....com, cel@...nel.org, senozhatsky@...omium.org, yujie.liu@...el.com, gregkh@...uxfoundation.org, muchun.song@...ux.dev, simon.horman@...igine.com, dlemoal@...nel.org Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org, x86@...nel.org, kvm@...r.kernel.org, xen-devel@...ts.xenproject.org, linux-erofs@...ts.ozlabs.org, linux-f2fs-devel@...ts.sourceforge.net, cluster-devel@...hat.com, linux-nfs@...r.kernel.org, linux-mtd@...ts.infradead.org, rcu@...r.kernel.org, netdev@...r.kernel.org, dri-devel@...ts.freedesktop.org, linux-arm-msm@...r.kernel.org, dm-devel@...hat.com, linux-raid@...r.kernel.org, linux-bcache@...r.kernel.org, virtualization@...ts.linux-foundation.org, linux-fsdevel@...r.kernel.org, linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org, linux-btrfs@...r.kernel.org, Qi Zheng <zhengqi.arch@...edance.com>, Muchun Song <songmuchun@...edance.com> Subject: [PATCH v4 09/48] erofs: dynamically allocate the erofs-shrinker Use new APIs to dynamically allocate the erofs-shrinker. Signed-off-by: Qi Zheng <zhengqi.arch@...edance.com> Reviewed-by: Muchun Song <songmuchun@...edance.com> --- fs/erofs/utils.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/fs/erofs/utils.c b/fs/erofs/utils.c index cc6fb9e98899..6e1a828e6ca3 100644 --- a/fs/erofs/utils.c +++ b/fs/erofs/utils.c @@ -270,19 +270,25 @@ static unsigned long erofs_shrink_scan(struct shrinker *shrink, return freed; } -static struct shrinker erofs_shrinker_info = { - .scan_objects = erofs_shrink_scan, - .count_objects = erofs_shrink_count, - .seeks = DEFAULT_SEEKS, -}; +static struct shrinker *erofs_shrinker_info; int __init erofs_init_shrinker(void) { - return register_shrinker(&erofs_shrinker_info, "erofs-shrinker"); + erofs_shrinker_info = shrinker_alloc(0, "erofs-shrinker"); + if (!erofs_shrinker_info) + return -ENOMEM; + + erofs_shrinker_info->count_objects = erofs_shrink_count; + erofs_shrinker_info->scan_objects = erofs_shrink_scan; + erofs_shrinker_info->seeks = DEFAULT_SEEKS; + + shrinker_register(erofs_shrinker_info); + + return 0; } void erofs_exit_shrinker(void) { - unregister_shrinker(&erofs_shrinker_info); + shrinker_free(erofs_shrinker_info); } #endif /* !CONFIG_EROFS_FS_ZIP */ -- 2.30.2
Powered by blists - more mailing lists