BACKPORT: 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 <guochunhai@vivo.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20240401135550.2550043-1-guochunhai@vivo.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Bug: 348591003
Change-Id: Iace477719fb803084955218a3e5ace74338f5ec8
(cherry picked from commit cacd5b04e24c74a813c694ec7b26a1a370b5d666)
[Chunhai: Resolved minor conflict in fs/erofs/Makefile and
fs/erofs/utils.c ]
Signed-off-by: Chunhai Guo <guochunhai@vivo.com>
This commit is contained in:
Chunhai Guo
2024-04-01 07:55:50 -06:00
committed by Matthias Männich
parent bab4765e5f
commit bb687ee6b6
2 changed files with 12 additions and 17 deletions

View File

@@ -1,8 +1,8 @@
# SPDX-License-Identifier: GPL-2.0-only # SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_EROFS_FS) += erofs.o obj-$(CONFIG_EROFS_FS) += erofs.o
erofs-objs := super.o inode.o data.o namei.o dir.o utils.o sysfs.o erofs-objs := super.o inode.o data.o namei.o dir.o sysfs.o
erofs-$(CONFIG_EROFS_FS_XATTR) += xattr.o erofs-$(CONFIG_EROFS_FS_XATTR) += xattr.o
erofs-$(CONFIG_EROFS_FS_ZIP) += decompressor.o zmap.o zdata.o pcpubuf.o erofs-$(CONFIG_EROFS_FS_ZIP) += decompressor.o zmap.o zdata.o pcpubuf.o zutil.o
erofs-$(CONFIG_EROFS_FS_ZIP_LZMA) += decompressor_lzma.o erofs-$(CONFIG_EROFS_FS_ZIP_LZMA) += decompressor_lzma.o
erofs-$(CONFIG_EROFS_FS_ONDEMAND) += fscache.o erofs-$(CONFIG_EROFS_FS_ONDEMAND) += fscache.o

View File

@@ -6,6 +6,14 @@
#include "internal.h" #include "internal.h"
#include <linux/pagevec.h> #include <linux/pagevec.h>
static atomic_long_t erofs_global_shrink_cnt; /* for all mounted instances */
/* protected by 'erofs_sb_list_lock' */
static unsigned int shrinker_run_no;
/* protects the mounted 'erofs_sb_list' */
static DEFINE_SPINLOCK(erofs_sb_list_lock);
static LIST_HEAD(erofs_sb_list);
struct page *erofs_allocpage(struct page **pagepool, gfp_t gfp) struct page *erofs_allocpage(struct page **pagepool, gfp_t gfp)
{ {
struct page *page = *pagepool; struct page *page = *pagepool;
@@ -13,10 +21,9 @@ struct page *erofs_allocpage(struct page **pagepool, gfp_t gfp)
if (page) { if (page) {
DBG_BUGON(page_ref_count(page) != 1); DBG_BUGON(page_ref_count(page) != 1);
*pagepool = (struct page *)page_private(page); *pagepool = (struct page *)page_private(page);
} else { return page;
page = alloc_page(gfp);
} }
return page; return alloc_page(gfp);
} }
void erofs_release_pages(struct page **pagepool) void erofs_release_pages(struct page **pagepool)
@@ -29,10 +36,6 @@ void erofs_release_pages(struct page **pagepool)
} }
} }
#ifdef CONFIG_EROFS_FS_ZIP
/* global shrink count (for all mounted EROFS instances) */
static atomic_long_t erofs_global_shrink_cnt;
static int erofs_workgroup_get(struct erofs_workgroup *grp) static int erofs_workgroup_get(struct erofs_workgroup *grp)
{ {
int o; int o;
@@ -181,13 +184,6 @@ static unsigned long erofs_shrink_workstation(struct erofs_sb_info *sbi,
return freed; return freed;
} }
/* protected by 'erofs_sb_list_lock' */
static unsigned int shrinker_run_no;
/* protects the mounted 'erofs_sb_list' */
static DEFINE_SPINLOCK(erofs_sb_list_lock);
static LIST_HEAD(erofs_sb_list);
void erofs_shrinker_register(struct super_block *sb) void erofs_shrinker_register(struct super_block *sb)
{ {
struct erofs_sb_info *sbi = EROFS_SB(sb); struct erofs_sb_info *sbi = EROFS_SB(sb);
@@ -289,4 +285,3 @@ void erofs_exit_shrinker(void)
{ {
unregister_shrinker(&erofs_shrinker_info); unregister_shrinker(&erofs_shrinker_info);
} }
#endif /* !CONFIG_EROFS_FS_ZIP */