UPSTREAM: erofs: clean up z_erofs_pcluster_readmore()
`end` parameter is no needed since it's pointless for !backmost, we can
handle it with backmost internally. And we only expand the trailing
edge, so the newstart can be replaced with ->headoffset.
Also, remove linux/prefetch.h inclusion since that is not used anymore
after commit 386292919c ("erofs: introduce readmore decompression
strategy").
Signed-off-by: Yue Hu <huyue2@coolpad.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230525072605.17857-1-zbestahu@gmail.com
[ Gao Xiang: update commit description. ]
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Bug: 318378021
(cherry picked from commit 796e9149a2fcdba5543e247abd8d911a399bb9a6)
Change-Id: I9412c4111800077c876a43c4256ce9760a7d902e
Signed-off-by: Sandeep Dhavale <dhavale@google.com>
This commit is contained in:
parent
5e861fa97e
commit
bed20ed1d3
1 changed files with 12 additions and 15 deletions
|
|
@ -5,7 +5,6 @@
|
|||
* Copyright (C) 2022 Alibaba Cloud
|
||||
*/
|
||||
#include "compress.h"
|
||||
#include <linux/prefetch.h>
|
||||
#include <linux/psi.h>
|
||||
#include <linux/cpuhotplug.h>
|
||||
#include <linux/kthread.h>
|
||||
|
|
@ -1785,28 +1784,28 @@ static void z_erofs_runqueue(struct z_erofs_decompress_frontend *f,
|
|||
*/
|
||||
static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend *f,
|
||||
struct readahead_control *rac,
|
||||
erofs_off_t end,
|
||||
struct page **pagepool,
|
||||
bool backmost)
|
||||
struct page **pagepool, bool backmost)
|
||||
{
|
||||
struct inode *inode = f->inode;
|
||||
struct erofs_map_blocks *map = &f->map;
|
||||
erofs_off_t cur;
|
||||
erofs_off_t cur, end, headoffset = f->headoffset;
|
||||
int err;
|
||||
|
||||
if (backmost) {
|
||||
if (rac)
|
||||
end = headoffset + readahead_length(rac) - 1;
|
||||
else
|
||||
end = headoffset + PAGE_SIZE - 1;
|
||||
map->m_la = end;
|
||||
err = z_erofs_map_blocks_iter(inode, map,
|
||||
EROFS_GET_BLOCKS_READMORE);
|
||||
if (err)
|
||||
return;
|
||||
|
||||
/* expend ra for the trailing edge if readahead */
|
||||
/* expand ra for the trailing edge if readahead */
|
||||
if (rac) {
|
||||
loff_t newstart = readahead_pos(rac);
|
||||
|
||||
cur = round_up(map->m_la + map->m_llen, PAGE_SIZE);
|
||||
readahead_expand(rac, newstart, cur - newstart);
|
||||
readahead_expand(rac, headoffset, cur - headoffset);
|
||||
return;
|
||||
}
|
||||
end = round_up(end, PAGE_SIZE);
|
||||
|
|
@ -1854,10 +1853,9 @@ static int z_erofs_read_folio(struct file *file, struct folio *folio)
|
|||
trace_erofs_readpage(page, false);
|
||||
f.headoffset = (erofs_off_t)page->index << PAGE_SHIFT;
|
||||
|
||||
z_erofs_pcluster_readmore(&f, NULL, f.headoffset + PAGE_SIZE - 1,
|
||||
&pagepool, true);
|
||||
z_erofs_pcluster_readmore(&f, NULL, &pagepool, true);
|
||||
err = z_erofs_do_read_page(&f, page, &pagepool);
|
||||
z_erofs_pcluster_readmore(&f, NULL, 0, &pagepool, false);
|
||||
z_erofs_pcluster_readmore(&f, NULL, &pagepool, false);
|
||||
|
||||
(void)z_erofs_collector_end(&f);
|
||||
|
||||
|
|
@ -1883,8 +1881,7 @@ static void z_erofs_readahead(struct readahead_control *rac)
|
|||
|
||||
f.headoffset = readahead_pos(rac);
|
||||
|
||||
z_erofs_pcluster_readmore(&f, rac, f.headoffset +
|
||||
readahead_length(rac) - 1, &pagepool, true);
|
||||
z_erofs_pcluster_readmore(&f, rac, &pagepool, true);
|
||||
nr_pages = readahead_count(rac);
|
||||
trace_erofs_readpages(inode, readahead_index(rac), nr_pages, false);
|
||||
|
||||
|
|
@ -1907,7 +1904,7 @@ static void z_erofs_readahead(struct readahead_control *rac)
|
|||
page->index, EROFS_I(inode)->nid);
|
||||
put_page(page);
|
||||
}
|
||||
z_erofs_pcluster_readmore(&f, rac, 0, &pagepool, false);
|
||||
z_erofs_pcluster_readmore(&f, rac, &pagepool, false);
|
||||
(void)z_erofs_collector_end(&f);
|
||||
|
||||
z_erofs_runqueue(&f, &pagepool,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue