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

Commit 8d8a09b0 authored by Gao Xiang's avatar Gao Xiang Committed by Greg Kroah-Hartman
Browse files

erofs: remove all likely/unlikely annotations

parent 5cf89673
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ static inline void read_endio(struct bio *bio)
		/* page is already locked */
		DBG_BUGON(PageUptodate(page));

		if (unlikely(err))
		if (err)
			SetPageError(page);
		else
			SetPageUptodate(page);
@@ -53,7 +53,7 @@ struct page *__erofs_get_meta_page(struct super_block *sb,

repeat:
	page = find_or_create_page(mapping, blkaddr, gfp);
	if (unlikely(!page)) {
	if (!page) {
		DBG_BUGON(nofail);
		return ERR_PTR(-ENOMEM);
	}
@@ -70,7 +70,7 @@ struct page *__erofs_get_meta_page(struct super_block *sb,
		}

		err = bio_add_page(bio, page, PAGE_SIZE, 0);
		if (unlikely(err != PAGE_SIZE)) {
		if (err != PAGE_SIZE) {
			err = -EFAULT;
			goto err_out;
		}
@@ -81,7 +81,7 @@ struct page *__erofs_get_meta_page(struct super_block *sb,
		lock_page(page);

		/* this page has been truncated by others */
		if (unlikely(page->mapping != mapping)) {
		if (page->mapping != mapping) {
unlock_repeat:
			unlock_page(page);
			put_page(page);
@@ -89,7 +89,7 @@ struct page *__erofs_get_meta_page(struct super_block *sb,
		}

		/* more likely a read error */
		if (unlikely(!PageUptodate(page))) {
		if (!PageUptodate(page)) {
			if (io_retries) {
				--io_retries;
				goto unlock_repeat;
@@ -120,7 +120,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
	nblocks = DIV_ROUND_UP(inode->i_size, PAGE_SIZE);
	lastblk = nblocks - is_inode_flat_inline(inode);

	if (unlikely(offset >= inode->i_size)) {
	if (offset >= inode->i_size) {
		/* leave out-of-bound access unmapped */
		map->m_flags = 0;
		map->m_plen = 0;
@@ -170,7 +170,7 @@ static int erofs_map_blocks_flatmode(struct inode *inode,
int erofs_map_blocks(struct inode *inode,
		     struct erofs_map_blocks *map, int flags)
{
	if (unlikely(is_inode_layout_compression(inode))) {
	if (is_inode_layout_compression(inode)) {
		int err = z_erofs_map_blocks_iter(inode, map, flags);

		if (map->mpage) {
@@ -218,11 +218,11 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio,
		unsigned int blkoff;

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

		/* zero out the holed page */
		if (unlikely(!(map.m_flags & EROFS_MAP_MAPPED))) {
		if (!(map.m_flags & EROFS_MAP_MAPPED)) {
			zero_user_segment(page, 0, PAGE_SIZE);
			SetPageUptodate(page);

@@ -315,7 +315,7 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio,
submit_bio_out:
		__submit_bio(bio, REQ_OP_READ, 0);

	return unlikely(err) ? ERR_PTR(err) : NULL;
	return err ? ERR_PTR(err) : NULL;
}

/*
@@ -377,7 +377,7 @@ static int erofs_raw_access_readpages(struct file *filp,
	DBG_BUGON(!list_empty(pages));

	/* the rare case (end in gaps) */
	if (unlikely(bio))
	if (bio)
		__submit_bio(bio, REQ_OP_READ, 0);
	return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ static int lz4_prepare_destpages(struct z_erofs_decompress_req *rq,
			get_page(victim);
		} else {
			victim = erofs_allocpage(pagepool, GFP_KERNEL, false);
			if (unlikely(!victim))
			if (!victim)
				return -ENOMEM;
			victim->mapping = Z_EROFS_MAPPING_STAGING;
		}
+7 −7
Original line number Diff line number Diff line
@@ -45,8 +45,8 @@ static int erofs_fill_dentries(struct inode *dir, struct dir_context *ctx,
			de_namelen = le16_to_cpu(de[1].nameoff) - nameoff;

		/* a corrupted entry is found */
		if (unlikely(nameoff + de_namelen > maxsize ||
			     de_namelen > EROFS_NAME_LEN)) {
		if (nameoff + de_namelen > maxsize ||
		    de_namelen > EROFS_NAME_LEN) {
			errln("bogus dirent @ nid %llu", EROFS_V(dir)->nid);
			DBG_BUGON(1);
			return -EFSCORRUPTED;
@@ -94,8 +94,8 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)

		nameoff = le16_to_cpu(de->nameoff);

		if (unlikely(nameoff < sizeof(struct erofs_dirent) ||
			     nameoff >= PAGE_SIZE)) {
		if (nameoff < sizeof(struct erofs_dirent) ||
		    nameoff >= PAGE_SIZE) {
			errln("%s, invalid de[0].nameoff %u @ nid %llu",
			      __func__, nameoff, EROFS_V(dir)->nid);
			err = -EFSCORRUPTED;
@@ -106,11 +106,11 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)
				dirsize - ctx->pos + ofs, PAGE_SIZE);

		/* search dirents at the arbitrary position */
		if (unlikely(initial)) {
		if (initial) {
			initial = false;

			ofs = roundup(ofs, sizeof(struct erofs_dirent));
			if (unlikely(ofs >= nameoff))
			if (ofs >= nameoff)
				goto skip_this;
		}

@@ -123,7 +123,7 @@ static int erofs_readdir(struct file *f, struct dir_context *ctx)

		ctx->pos = blknr_to_addr(i) + ofs;

		if (unlikely(err))
		if (err)
			break;
		++i;
		ofs = 0;
+5 −5
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ static int read_inode(struct inode *inode, void *data)

	vi->datamode = __inode_data_mapping(advise);

	if (unlikely(vi->datamode >= EROFS_INODE_LAYOUT_MAX)) {
	if (vi->datamode >= EROFS_INODE_LAYOUT_MAX) {
		errln("unsupported data mapping %u of nid %llu",
		      vi->datamode, vi->nid);
		DBG_BUGON(1);
@@ -133,13 +133,13 @@ static int fill_inline_data(struct inode *inode, void *data,
	if (S_ISLNK(inode->i_mode) && inode->i_size < PAGE_SIZE) {
		char *lnk = erofs_kmalloc(sbi, inode->i_size + 1, GFP_KERNEL);

		if (unlikely(!lnk))
		if (!lnk)
			return -ENOMEM;

		m_pofs += vi->inode_isize + vi->xattr_isize;

		/* inline symlink data shouldn't across page boundary as well */
		if (unlikely(m_pofs + inode->i_size > PAGE_SIZE)) {
		if (m_pofs + inode->i_size > PAGE_SIZE) {
			kfree(lnk);
			errln("inline data cross block boundary @ nid %llu",
			      vi->nid);
@@ -268,7 +268,7 @@ struct inode *erofs_iget(struct super_block *sb,
{
	struct inode *inode = erofs_iget_locked(sb, nid);

	if (unlikely(!inode))
	if (!inode)
		return ERR_PTR(-ENOMEM);

	if (inode->i_state & I_NEW) {
@@ -278,7 +278,7 @@ struct inode *erofs_iget(struct super_block *sb,
		vi->nid = nid;

		err = fill_inode(inode, isdir);
		if (likely(!err))
		if (!err)
			unlock_new_inode(inode);
		else {
			iget_failed(inode);
+2 −2
Original line number Diff line number Diff line
@@ -424,7 +424,7 @@ static inline struct bio *erofs_grab_bio(struct super_block *sb,
	do {
		if (nr_pages == 1) {
			bio = bio_alloc(gfp | (nofail ? __GFP_NOFAIL : 0), 1);
			if (unlikely(!bio)) {
			if (!bio) {
				DBG_BUGON(nofail);
				return ERR_PTR(-ENOMEM);
			}
@@ -432,7 +432,7 @@ static inline struct bio *erofs_grab_bio(struct super_block *sb,
		}
		bio = bio_alloc(gfp, nr_pages);
		nr_pages /= 2;
	} while (unlikely(!bio));
	} while (!bio);

	bio->bi_end_io = endio;
	bio_set_dev(bio, sb->s_bdev);
Loading