Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 33efea02 authored by Yue Hu's avatar Yue Hu Committed by Michael Bestas
Browse files

UPSTREAM: erofs: don't use erofs_map_blocks() any more

Currently, erofs_map_blocks() will be called only from
erofs_{bmap, read_raw_page} which are all for uncompressed files.
So, the compression branch in erofs_map_blocks() is pointless. Let's
remove it and use erofs_map_blocks_flatmode() directly. Also update
related comments.

Link: https://lore.kernel.org/r/20210325071008.573-1-zbestahu@gmail.com


Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarYue Hu <huyue2@yulong.com>
Signed-off-by: default avatarGao Xiang <hsiangkao@redhat.com>

Bug: 201372112
Change-Id: Ic3362c62d7c917f05f1cd11120ee6280a22221b8
(cherry picked from commit 8137824eddd2e790c61c70c20d70a087faca95fa)
Signed-off-by: default avatarHuang Jianan <huangjianan@oppo.com>
parent 8ccbd0ca
Loading
Loading
Loading
Loading
+2 −17
Original line number Original line Diff line number Diff line
@@ -109,21 +109,6 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
	return err;
	return err;
}
}


int erofs_map_blocks(struct inode *inode,
		     struct erofs_map_blocks *map, int flags)
{
	if (erofs_inode_is_data_compressed(EROFS_I(inode)->datalayout)) {
		int err = z_erofs_map_blocks_iter(inode, map, flags);

		if (map->mpage) {
			put_page(map->mpage);
			map->mpage = NULL;
		}
		return err;
	}
	return erofs_map_blocks_flatmode(inode, map, flags);
}

static inline struct bio *erofs_read_raw_page(struct bio *bio,
static inline struct bio *erofs_read_raw_page(struct bio *bio,
					      struct address_space *mapping,
					      struct address_space *mapping,
					      struct page *page,
					      struct page *page,
@@ -159,7 +144,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio,
		erofs_blk_t blknr;
		erofs_blk_t blknr;
		unsigned int blkoff;
		unsigned int blkoff;


		err = erofs_map_blocks(inode, &map, EROFS_GET_BLOCKS_RAW);
		err = erofs_map_blocks_flatmode(inode, &map, EROFS_GET_BLOCKS_RAW);
		if (err)
		if (err)
			goto err_out;
			goto err_out;


@@ -337,7 +322,7 @@ static sector_t erofs_bmap(struct address_space *mapping, sector_t block)
			return 0;
			return 0;
	}
	}


	if (!erofs_map_blocks(inode, &map, EROFS_GET_BLOCKS_RAW))
	if (!erofs_map_blocks_flatmode(inode, &map, EROFS_GET_BLOCKS_RAW))
		return erofs_blknr(map.m_pa);
		return erofs_blknr(map.m_pa);


	return 0;
	return 0;
+2 −4
Original line number Original line Diff line number Diff line
@@ -297,7 +297,7 @@ extern const struct address_space_operations erofs_raw_access_aops;
extern const struct address_space_operations z_erofs_aops;
extern const struct address_space_operations z_erofs_aops;


/*
/*
 * Logical to physical block mapping, used by erofs_map_blocks()
 * Logical to physical block mapping
 *
 *
 * Different with other file systems, it is used for 2 access modes:
 * Different with other file systems, it is used for 2 access modes:
 *
 *
@@ -344,7 +344,7 @@ struct erofs_map_blocks {
	struct page *mpage;
	struct page *mpage;
};
};


/* Flags used by erofs_map_blocks() */
/* Flags used by erofs_map_blocks_flatmode() */
#define EROFS_GET_BLOCKS_RAW    0x0001
#define EROFS_GET_BLOCKS_RAW    0x0001


/* zmap.c */
/* zmap.c */
@@ -366,8 +366,6 @@ static inline int z_erofs_map_blocks_iter(struct inode *inode,
/* data.c */
/* data.c */
struct page *erofs_get_meta_page(struct super_block *sb, erofs_blk_t blkaddr);
struct page *erofs_get_meta_page(struct super_block *sb, erofs_blk_t blkaddr);


int erofs_map_blocks(struct inode *, struct erofs_map_blocks *, int);

/* inode.c */
/* inode.c */
static inline unsigned long erofs_inode_hash(erofs_nid_t nid)
static inline unsigned long erofs_inode_hash(erofs_nid_t nid)
{
{