Commit 5b220b20 authored by Gao Xiang's avatar Gao Xiang
Browse files

erofs: get rid of `enum z_erofs_page_type'

parent 67148551
Loading
Loading
Loading
Loading
+5 −25
Original line number Diff line number Diff line
@@ -27,17 +27,6 @@ static struct z_erofs_pcluster_slab pcluster_pool[] __read_mostly = {
	_PCLP(Z_EROFS_PCLUSTER_MAX_PAGES)
};

/* (obsoleted) page type for online pages */
enum z_erofs_page_type {
	/* including Z_EROFS_VLE_PAGE_TAIL_EXCLUSIVE */
	Z_EROFS_PAGE_TYPE_EXCLUSIVE,

	Z_EROFS_VLE_PAGE_TYPE_TAIL_SHARED,

	Z_EROFS_VLE_PAGE_TYPE_HEAD,
	Z_EROFS_VLE_PAGE_TYPE_MAX
};

struct z_erofs_bvec_iter {
	struct page *bvpage;
	struct z_erofs_bvset *bvset;
@@ -429,7 +418,6 @@ int erofs_try_to_free_cached_page(struct page *page)
	return ret;
}

/* page_type must be Z_EROFS_PAGE_TYPE_EXCLUSIVE */
static bool z_erofs_try_inplace_io(struct z_erofs_decompress_frontend *fe,
				   struct z_erofs_bvec *bvec)
{
@@ -447,13 +435,11 @@ static bool z_erofs_try_inplace_io(struct z_erofs_decompress_frontend *fe,

/* callers must be with pcluster lock held */
static int z_erofs_attach_page(struct z_erofs_decompress_frontend *fe,
			       struct z_erofs_bvec *bvec,
			       enum z_erofs_page_type type)
			       struct z_erofs_bvec *bvec, bool exclusive)
{
	int ret;

	if (fe->mode >= COLLECT_PRIMARY &&
	    type == Z_EROFS_PAGE_TYPE_EXCLUSIVE) {
	if (fe->mode >= COLLECT_PRIMARY && exclusive) {
		/* give priority for inplaceio to use file pages first */
		if (z_erofs_try_inplace_io(fe, bvec))
			return 0;
@@ -718,10 +704,9 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
	struct erofs_sb_info *const sbi = EROFS_I_SB(inode);
	struct erofs_map_blocks *const map = &fe->map;
	const loff_t offset = page_offset(page);
	bool tight = true;
	bool tight = true, exclusive;

	enum z_erofs_cache_alloctype cache_strategy;
	enum z_erofs_page_type page_type;
	unsigned int cur, end, spiltted, index;
	int err = 0;

@@ -798,12 +783,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
		goto next_part;
	}

	/* let's derive page type */
	page_type = cur ? Z_EROFS_VLE_PAGE_TYPE_HEAD :
		(!spiltted ? Z_EROFS_PAGE_TYPE_EXCLUSIVE :
			(tight ? Z_EROFS_PAGE_TYPE_EXCLUSIVE :
				Z_EROFS_VLE_PAGE_TYPE_TAIL_SHARED));

	exclusive = (!cur && (!spiltted || tight));
	if (cur)
		tight &= (fe->mode >= COLLECT_PRIMARY_FOLLOWED);

@@ -812,7 +792,7 @@ static int z_erofs_do_read_page(struct z_erofs_decompress_frontend *fe,
					.page = page,
					.offset = offset - map->m_la,
					.end = end,
				  }), page_type);
				  }), exclusive);
	/* should allocate an additional short-lived page for bvset */
	if (err == -EAGAIN && !fe->candidate_bvpage) {
		fe->candidate_bvpage = alloc_page(GFP_NOFS | __GFP_NOFAIL);