Linux-EROFS Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 06/45] erofs: dynamically allocate the erofs-shrinker
       [not found] <20230824034304.37411-1-zhengqi.arch@bytedance.com>
@ 2023-08-24  3:42 ` Qi Zheng via Linux-erofs
  2023-08-25  1:18   ` Chao Yu
  2023-08-25  2:54   ` Gao Xiang
  0 siblings, 2 replies; 3+ messages in thread
From: Qi Zheng via Linux-erofs @ 2023-08-24  3:42 UTC (permalink / raw)
  To: akpm, david, tkhai, vbabka, roman.gushchin, djwong, brauner,
	paulmck, tytso, steven.price, cel, senozhatsky, yujie.liu, gregkh,
	muchun.song
  Cc: linux-kernel, Qi Zheng, linux-mm, Yue Hu, Muchun Song,
	linux-fsdevel, linux-erofs

Use new APIs to dynamically allocate the erofs-shrinker.

Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
CC: Gao Xiang <xiang@kernel.org>
CC: Chao Yu <chao@kernel.org>
CC: Yue Hu <huyue2@coolpad.com>
CC: Jeffle Xu <jefflexu@linux.alibaba.com>
CC: linux-erofs@lists.ozlabs.org
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v5 06/45] erofs: dynamically allocate the erofs-shrinker
  2023-08-24  3:42 ` [PATCH v5 06/45] erofs: dynamically allocate the erofs-shrinker Qi Zheng via Linux-erofs
@ 2023-08-25  1:18   ` Chao Yu
  2023-08-25  2:54   ` Gao Xiang
  1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2023-08-25  1:18 UTC (permalink / raw)
  To: Qi Zheng, akpm, david, tkhai, vbabka, roman.gushchin, djwong,
	brauner, paulmck, tytso, steven.price, cel, senozhatsky,
	yujie.liu, gregkh, muchun.song
  Cc: linux-kernel, linux-mm, Yue Hu, Muchun Song, linux-fsdevel,
	linux-erofs

On 2023/8/24 11:42, Qi Zheng wrote:
> Use new APIs to dynamically allocate the erofs-shrinker.
> 
> Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
> Reviewed-by: Muchun Song <songmuchun@bytedance.com>
> CC: Gao Xiang <xiang@kernel.org>
> CC: Chao Yu <chao@kernel.org>
> CC: Yue Hu <huyue2@coolpad.com>
> CC: Jeffle Xu <jefflexu@linux.alibaba.com>
> CC: linux-erofs@lists.ozlabs.org

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v5 06/45] erofs: dynamically allocate the erofs-shrinker
  2023-08-24  3:42 ` [PATCH v5 06/45] erofs: dynamically allocate the erofs-shrinker Qi Zheng via Linux-erofs
  2023-08-25  1:18   ` Chao Yu
@ 2023-08-25  2:54   ` Gao Xiang
  1 sibling, 0 replies; 3+ messages in thread
From: Gao Xiang @ 2023-08-25  2:54 UTC (permalink / raw)
  To: Qi Zheng, akpm, david, tkhai, vbabka, roman.gushchin, djwong,
	brauner, paulmck, tytso, steven.price, cel, senozhatsky,
	yujie.liu, gregkh, muchun.song
  Cc: linux-kernel, linux-mm, Yue Hu, Muchun Song, linux-fsdevel,
	linux-erofs



On 2023/8/24 11:42, Qi Zheng wrote:
> Use new APIs to dynamically allocate the erofs-shrinker.
> 
> Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
> Reviewed-by: Muchun Song <songmuchun@bytedance.com>
> CC: Gao Xiang <xiang@kernel.org>
> CC: Chao Yu <chao@kernel.org>
> CC: Yue Hu <huyue2@coolpad.com>
> CC: Jeffle Xu <jefflexu@linux.alibaba.com>
> CC: linux-erofs@lists.ozlabs.org

Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Thanks,
Gao Xiang

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-25  2:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230824034304.37411-1-zhengqi.arch@bytedance.com>
2023-08-24  3:42 ` [PATCH v5 06/45] erofs: dynamically allocate the erofs-shrinker Qi Zheng via Linux-erofs
2023-08-25  1:18   ` Chao Yu
2023-08-25  2:54   ` Gao Xiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox