Skip to content

Commit bda17a4

Browse files
author
Gao Xiang
committed
erofs: remove dead code since managed cache is now built-in
After commit 4279f3f ("staging: erofs: turn cache strategies into mount options"), cache strategies are changed into mount options rather than old build configs. Let's kill useless code for obsoleted build options. Link: https://lore.kernel.org/r/20191008125616.183715-2-gaoxiang25@huawei.com Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
1 parent 9e579fc commit bda17a4

2 files changed

Lines changed: 10 additions & 28 deletions

File tree

‎fs/erofs/utils.c‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ static void erofs_workgroup_unfreeze_final(struct erofs_workgroup *grp)
149149
}
150150

151151
static bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi,
152-
struct erofs_workgroup *grp,
153-
bool cleanup)
152+
struct erofs_workgroup *grp)
154153
{
155154
/*
156155
* If managed cache is on, refcount of workgroups
@@ -188,8 +187,7 @@ static bool erofs_try_to_release_workgroup(struct erofs_sb_info *sbi,
188187
}
189188

190189
static unsigned long erofs_shrink_workstation(struct erofs_sb_info *sbi,
191-
unsigned long nr_shrink,
192-
bool cleanup)
190+
unsigned long nr_shrink)
193191
{
194192
pgoff_t first_index = 0;
195193
void *batch[PAGEVEC_SIZE];
@@ -208,7 +206,7 @@ static unsigned long erofs_shrink_workstation(struct erofs_sb_info *sbi,
208206
first_index = grp->index + 1;
209207

210208
/* try to shrink each valid workgroup */
211-
if (!erofs_try_to_release_workgroup(sbi, grp, cleanup))
209+
if (!erofs_try_to_release_workgroup(sbi, grp))
212210
continue;
213211

214212
++freed;
@@ -245,7 +243,8 @@ void erofs_shrinker_unregister(struct super_block *sb)
245243
struct erofs_sb_info *const sbi = EROFS_SB(sb);
246244

247245
mutex_lock(&sbi->umount_mutex);
248-
erofs_shrink_workstation(sbi, ~0UL, true);
246+
/* clean up all remaining workgroups in memory */
247+
erofs_shrink_workstation(sbi, ~0UL);
249248

250249
spin_lock(&erofs_sb_list_lock);
251250
list_del(&sbi->list);
@@ -294,7 +293,7 @@ static unsigned long erofs_shrink_scan(struct shrinker *shrink,
294293
spin_unlock(&erofs_sb_list_lock);
295294
sbi->shrinker_run_no = run_no;
296295

297-
freed += erofs_shrink_workstation(sbi, nr, false);
296+
freed += erofs_shrink_workstation(sbi, nr);
298297

299298
spin_lock(&erofs_sb_list_lock);
300299
/* Get the next list element before we move this one */

‎fs/erofs/zdata.c‎

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
574574
struct list_head *pagepool)
575575
{
576576
struct inode *const inode = fe->inode;
577-
struct erofs_sb_info *const sbi __maybe_unused = EROFS_I_SB(inode);
577+
struct erofs_sb_info *const sbi = EROFS_I_SB(inode);
578578
struct erofs_map_blocks *const map = &fe->map;
579579
struct z_erofs_collector *const clt = &fe->clt;
580580
const loff_t offset = page_offset(page);
@@ -997,8 +997,6 @@ static struct page *pickup_page_for_submission(struct z_erofs_pcluster *pcl,
997997
struct address_space *mc,
998998
gfp_t gfp)
999999
{
1000-
/* determined at compile time to avoid too many #ifdefs */
1001-
const bool nocache = __builtin_constant_p(mc) ? !mc : false;
10021000
const pgoff_t index = pcl->obj.index;
10031001
bool tocache = false;
10041002

@@ -1019,7 +1017,7 @@ static struct page *pickup_page_for_submission(struct z_erofs_pcluster *pcl,
10191017
* the cached page has not been allocated and
10201018
* an placeholder is out there, prepare it now.
10211019
*/
1022-
if (!nocache && page == PAGE_UNALLOCATED) {
1020+
if (page == PAGE_UNALLOCATED) {
10231021
tocache = true;
10241022
goto out_allocpage;
10251023
}
@@ -1031,21 +1029,6 @@ static struct page *pickup_page_for_submission(struct z_erofs_pcluster *pcl,
10311029

10321030
mapping = READ_ONCE(page->mapping);
10331031

1034-
/*
1035-
* if managed cache is disabled, it's no way to
1036-
* get such a cached-like page.
1037-
*/
1038-
if (nocache) {
1039-
/* if managed cache is disabled, it is impossible `justfound' */
1040-
DBG_BUGON(justfound);
1041-
1042-
/* and it should be locked, not uptodate, and not truncated */
1043-
DBG_BUGON(!PageLocked(page));
1044-
DBG_BUGON(PageUptodate(page));
1045-
DBG_BUGON(!mapping);
1046-
goto out;
1047-
}
1048-
10491032
/*
10501033
* unmanaged (file) pages are all locked solidly,
10511034
* therefore it is impossible for `mapping' to be NULL.
@@ -1102,7 +1085,7 @@ static struct page *pickup_page_for_submission(struct z_erofs_pcluster *pcl,
11021085
cpu_relax();
11031086
goto repeat;
11041087
}
1105-
if (nocache || !tocache)
1088+
if (!tocache)
11061089
goto out;
11071090
if (add_to_page_cache_lru(page, mc, index + nr, gfp)) {
11081091
page->mapping = Z_EROFS_MAPPING_STAGING;
@@ -1208,7 +1191,7 @@ static bool z_erofs_vle_submit_all(struct super_block *sb,
12081191
struct z_erofs_unzip_io *fgq,
12091192
bool force_fg)
12101193
{
1211-
struct erofs_sb_info *const sbi __maybe_unused = EROFS_SB(sb);
1194+
struct erofs_sb_info *const sbi = EROFS_SB(sb);
12121195
z_erofs_next_pcluster_t qtail[NR_JOBQUEUES];
12131196
struct z_erofs_unzip_io *q[NR_JOBQUEUES];
12141197
struct bio *bio;

0 commit comments

Comments
 (0)