|
@@ -301,12 +301,9 @@ z_erofs_vle_work_lookup(const struct z_erofs_vle_work_finder *f)
|
|
|
grp = container_of(egrp, struct z_erofs_vle_workgroup, obj);
|
|
|
*f->grp_ret = grp;
|
|
|
|
|
|
-#ifndef CONFIG_EROFS_FS_ZIP_MULTIREF
|
|
|
work = z_erofs_vle_grab_work(grp, f->pageofs);
|
|
|
+ /* if multiref is disabled, `primary' is always true */
|
|
|
primary = true;
|
|
|
-#else
|
|
|
- BUG();
|
|
|
-#endif
|
|
|
|
|
|
DBG_BUGON(work->pageofs != f->pageofs);
|
|
|
|
|
@@ -368,12 +365,9 @@ z_erofs_vle_work_register(const struct z_erofs_vle_work_finder *f,
|
|
|
struct z_erofs_vle_workgroup *grp = *f->grp_ret;
|
|
|
struct z_erofs_vle_work *work;
|
|
|
|
|
|
-#ifndef CONFIG_EROFS_FS_ZIP_MULTIREF
|
|
|
+ /* if multiref is disabled, grp should never be nullptr */
|
|
|
BUG_ON(grp != NULL);
|
|
|
-#else
|
|
|
- if (grp != NULL)
|
|
|
- goto skip;
|
|
|
-#endif
|
|
|
+
|
|
|
/* no available workgroup, let's allocate one */
|
|
|
grp = kmem_cache_zalloc(z_erofs_workgroup_cachep, GFP_NOFS);
|
|
|
if (unlikely(grp == NULL))
|
|
@@ -396,13 +390,7 @@ z_erofs_vle_work_register(const struct z_erofs_vle_work_finder *f,
|
|
|
*f->hosted = true;
|
|
|
|
|
|
gnew = true;
|
|
|
-#ifdef CONFIG_EROFS_FS_ZIP_MULTIREF
|
|
|
-skip:
|
|
|
- /* currently unimplemented */
|
|
|
- BUG();
|
|
|
-#else
|
|
|
work = z_erofs_vle_grab_primary_work(grp);
|
|
|
-#endif
|
|
|
work->pageofs = f->pageofs;
|
|
|
|
|
|
mutex_init(&work->lock);
|
|
@@ -797,9 +785,7 @@ static int z_erofs_vle_unzip(struct super_block *sb,
|
|
|
|
|
|
struct z_erofs_pagevec_ctor ctor;
|
|
|
unsigned int nr_pages;
|
|
|
-#ifndef CONFIG_EROFS_FS_ZIP_MULTIREF
|
|
|
unsigned int sparsemem_pages = 0;
|
|
|
-#endif
|
|
|
struct page *pages_onstack[Z_EROFS_VLE_VMAP_ONSTACK_PAGES];
|
|
|
struct page **pages, **compressed_pages, *page;
|
|
|
unsigned int i, llen;
|
|
@@ -811,11 +797,7 @@ static int z_erofs_vle_unzip(struct super_block *sb,
|
|
|
int err;
|
|
|
|
|
|
might_sleep();
|
|
|
-#ifndef CONFIG_EROFS_FS_ZIP_MULTIREF
|
|
|
work = z_erofs_vle_grab_primary_work(grp);
|
|
|
-#else
|
|
|
- BUG();
|
|
|
-#endif
|
|
|
BUG_ON(!READ_ONCE(work->nr_pages));
|
|
|
|
|
|
mutex_lock(&work->lock);
|
|
@@ -866,13 +848,11 @@ repeat:
|
|
|
pagenr = z_erofs_onlinepage_index(page);
|
|
|
|
|
|
BUG_ON(pagenr >= nr_pages);
|
|
|
-
|
|
|
-#ifndef CONFIG_EROFS_FS_ZIP_MULTIREF
|
|
|
BUG_ON(pages[pagenr] != NULL);
|
|
|
- ++sparsemem_pages;
|
|
|
-#endif
|
|
|
+
|
|
|
pages[pagenr] = page;
|
|
|
}
|
|
|
+ sparsemem_pages = i;
|
|
|
|
|
|
z_erofs_pagevec_ctor_exit(&ctor, true);
|
|
|
|
|
@@ -902,10 +882,8 @@ repeat:
|
|
|
pagenr = z_erofs_onlinepage_index(page);
|
|
|
|
|
|
BUG_ON(pagenr >= nr_pages);
|
|
|
-#ifndef CONFIG_EROFS_FS_ZIP_MULTIREF
|
|
|
BUG_ON(pages[pagenr] != NULL);
|
|
|
++sparsemem_pages;
|
|
|
-#endif
|
|
|
pages[pagenr] = page;
|
|
|
|
|
|
overlapped = true;
|
|
@@ -931,12 +909,10 @@ repeat:
|
|
|
if (err != -ENOTSUPP)
|
|
|
goto out_percpu;
|
|
|
|
|
|
-#ifndef CONFIG_EROFS_FS_ZIP_MULTIREF
|
|
|
if (sparsemem_pages >= nr_pages) {
|
|
|
BUG_ON(sparsemem_pages > nr_pages);
|
|
|
goto skip_allocpage;
|
|
|
}
|
|
|
-#endif
|
|
|
|
|
|
for (i = 0; i < nr_pages; ++i) {
|
|
|
if (pages[i] != NULL)
|
|
@@ -945,9 +921,7 @@ repeat:
|
|
|
pages[i] = __stagingpage_alloc(page_pool, GFP_NOFS);
|
|
|
}
|
|
|
|
|
|
-#ifndef CONFIG_EROFS_FS_ZIP_MULTIREF
|
|
|
skip_allocpage:
|
|
|
-#endif
|
|
|
vout = erofs_vmap(pages, nr_pages);
|
|
|
|
|
|
err = z_erofs_vle_unzip_vmap(compressed_pages,
|