Skip to content

Commit cacd5b0

Browse files
Chunhai Guohsiangkao
authored andcommitted
erofs: rename utils.c to zutil.c
Currently, utils.c is only useful if CONFIG_EROFS_FS_ZIP is on. So let's rename it to zutil.c as well as avoid its inclusion if CONFIG_EROFS_FS_ZIP is explicitly disabled. Signed-off-by: Chunhai Guo <[email protected]> Reviewed-by: Gao Xiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Gao Xiang <[email protected]>
1 parent dd5a440 commit cacd5b0

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

fs/erofs/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22

33
obj-$(CONFIG_EROFS_FS) += erofs.o
4-
erofs-objs := super.o inode.o data.o namei.o dir.o utils.o sysfs.o
4+
erofs-objs := super.o inode.o data.o namei.o dir.o sysfs.o
55
erofs-$(CONFIG_EROFS_FS_XATTR) += xattr.o
6-
erofs-$(CONFIG_EROFS_FS_ZIP) += decompressor.o zmap.o zdata.o pcpubuf.o
6+
erofs-$(CONFIG_EROFS_FS_ZIP) += decompressor.o zmap.o zdata.o pcpubuf.o zutil.o
77
erofs-$(CONFIG_EROFS_FS_ZIP_LZMA) += decompressor_lzma.o
88
erofs-$(CONFIG_EROFS_FS_ZIP_DEFLATE) += decompressor_deflate.o
99
erofs-$(CONFIG_EROFS_FS_ONDEMAND) += fscache.o

fs/erofs/utils.c renamed to fs/erofs/zutil.c

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,25 @@
55
*/
66
#include "internal.h"
77

8+
static atomic_long_t erofs_global_shrink_cnt; /* for all mounted instances */
9+
/* protected by 'erofs_sb_list_lock' */
10+
static unsigned int shrinker_run_no;
11+
12+
/* protects the mounted 'erofs_sb_list' */
13+
static DEFINE_SPINLOCK(erofs_sb_list_lock);
14+
static LIST_HEAD(erofs_sb_list);
15+
static struct shrinker *erofs_shrinker_info;
16+
817
struct page *erofs_allocpage(struct page **pagepool, gfp_t gfp)
918
{
1019
struct page *page = *pagepool;
1120

1221
if (page) {
1322
DBG_BUGON(page_ref_count(page) != 1);
1423
*pagepool = (struct page *)page_private(page);
15-
} else {
16-
page = alloc_page(gfp);
24+
return page;
1725
}
18-
return page;
26+
return alloc_page(gfp);
1927
}
2028

2129
void erofs_release_pages(struct page **pagepool)
@@ -28,10 +36,6 @@ void erofs_release_pages(struct page **pagepool)
2836
}
2937
}
3038

31-
#ifdef CONFIG_EROFS_FS_ZIP
32-
/* global shrink count (for all mounted EROFS instances) */
33-
static atomic_long_t erofs_global_shrink_cnt;
34-
3539
static bool erofs_workgroup_get(struct erofs_workgroup *grp)
3640
{
3741
if (lockref_get_not_zero(&grp->lockref))
@@ -171,13 +175,6 @@ static unsigned long erofs_shrink_workstation(struct erofs_sb_info *sbi,
171175
return freed;
172176
}
173177

174-
/* protected by 'erofs_sb_list_lock' */
175-
static unsigned int shrinker_run_no;
176-
177-
/* protects the mounted 'erofs_sb_list' */
178-
static DEFINE_SPINLOCK(erofs_sb_list_lock);
179-
static LIST_HEAD(erofs_sb_list);
180-
181178
void erofs_shrinker_register(struct super_block *sb)
182179
{
183180
struct erofs_sb_info *sbi = EROFS_SB(sb);
@@ -264,8 +261,6 @@ static unsigned long erofs_shrink_scan(struct shrinker *shrink,
264261
return freed;
265262
}
266263

267-
static struct shrinker *erofs_shrinker_info;
268-
269264
int __init erofs_init_shrinker(void)
270265
{
271266
erofs_shrinker_info = shrinker_alloc(0, "erofs-shrinker");
@@ -274,14 +269,11 @@ int __init erofs_init_shrinker(void)
274269

275270
erofs_shrinker_info->count_objects = erofs_shrink_count;
276271
erofs_shrinker_info->scan_objects = erofs_shrink_scan;
277-
278272
shrinker_register(erofs_shrinker_info);
279-
280273
return 0;
281274
}
282275

283276
void erofs_exit_shrinker(void)
284277
{
285278
shrinker_free(erofs_shrinker_info);
286279
}
287-
#endif /* !CONFIG_EROFS_FS_ZIP */

0 commit comments

Comments
 (0)