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

Commit b859aa7d authored by Sumit Semwal's avatar Sumit Semwal Committed by Greg Kroah-Hartman
Browse files

ANDROID: squashfs: resolve merge conflict with 4.14.68



Commit a3f94cb99a854fa381fe7fadd97c4f61633717a5 upstream changes the way
expected length is calculated for squashfs_readpage. This got merged to
stable 4.14.68.

Android adds .readpages path to make things faster, but the above commit
conflicts with it.

We try to adapt as close to upstream as possible, while not touching the
squashfs_readpages_block() mechanism.

Signed-off-by: default avatarSumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 6fff4be4
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -453,7 +453,8 @@ static int squashfs_readpage_fragment(struct page *page, int expected)
}

static int squashfs_readpages_fragment(struct page *page,
	struct list_head *readahead_pages, struct address_space *mapping)
	struct list_head *readahead_pages, struct address_space *mapping,
	int expected)
{
	if (!page) {
		page = lru_to_page(readahead_pages);
@@ -464,18 +465,18 @@ static int squashfs_readpages_fragment(struct page *page,
			return 0;
		}
	}
	return squashfs_readpage_fragment(page);
	return squashfs_readpage_fragment(page, expected);
}

static int squashfs_readpage_sparse(struct page *page, int index, int file_end)
static int squashfs_readpage_sparse(struct page *page, int expected)
{
	squashfs_copy_cache(page, NULL, expected, 0);
	return 0;
}

static int squashfs_readpages_sparse(struct page *page,
	struct list_head *readahead_pages, int index, int file_end,
	struct address_space *mapping)
	struct list_head *readahead_pages, struct address_space *mapping,
	int expected)
{
	if (!page) {
		page = lru_to_page(readahead_pages);
@@ -486,7 +487,7 @@ static int squashfs_readpages_sparse(struct page *page,
			return 0;
		}
	}
	return squashfs_readpage_sparse(page, index, file_end);
	return squashfs_readpage_sparse(page, expected);
}

static int __squashfs_readpages(struct file *file, struct page *page,
@@ -496,9 +497,6 @@ static int __squashfs_readpages(struct file *file, struct page *page,
	struct inode *inode = mapping->host;
	struct squashfs_sb_info *msblk = inode->i_sb->s_fs_info;
	int file_end = i_size_read(inode) >> msblk->block_log;
	int expected = index == file_end ?
			(i_size_read(inode) & (msblk->block_size - 1)) :
			 msblk->block_size;
	int res;

	do {
@@ -506,6 +504,9 @@ static int __squashfs_readpages(struct file *file, struct page *page,
					     : lru_to_page(readahead_pages);
		int page_index = cur_page->index;
		int index = page_index >> (msblk->block_log - PAGE_SHIFT);
		int expected = index == file_end ?
			(i_size_read(inode) & (msblk->block_size - 1)) :
			 msblk->block_size;

		if (page_index >= ((i_size_read(inode) + PAGE_SIZE - 1) >>
						PAGE_SHIFT))
@@ -521,8 +522,7 @@ static int __squashfs_readpages(struct file *file, struct page *page,

			if (bsize == 0) {
				res = squashfs_readpages_sparse(page,
					readahead_pages, index, file_end,
					mapping);
					readahead_pages, mapping, expected);
			} else {
				res = squashfs_readpages_block(page,
					readahead_pages, &nr_pages, mapping,
@@ -530,7 +530,7 @@ static int __squashfs_readpages(struct file *file, struct page *page,
			}
		} else {
			res = squashfs_readpages_fragment(page,
				readahead_pages, mapping);
				readahead_pages, mapping, expected);
		}
		if (res)
			return 0;