[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220209060108.43051-21-jefflexu@linux.alibaba.com>
Date: Wed, 9 Feb 2022 14:01:06 +0800
From: Jeffle Xu <jefflexu@...ux.alibaba.com>
To: dhowells@...hat.com, linux-cachefs@...hat.com, xiang@...nel.org,
chao@...nel.org, linux-erofs@...ts.ozlabs.org
Cc: torvalds@...ux-foundation.org, gregkh@...uxfoundation.org,
willy@...radead.org, linux-fsdevel@...r.kernel.org,
joseph.qi@...ux.alibaba.com, bo.liu@...ux.alibaba.com,
tao.peng@...ux.alibaba.com, gerry@...ux.alibaba.com,
eguan@...ux.alibaba.com, linux-kernel@...r.kernel.org
Subject: [PATCH v3 20/22] erofs: implement fscache-based data readahead for non-inline layout
Signed-off-by: Jeffle Xu <jefflexu@...ux.alibaba.com>
---
fs/erofs/fscache.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c
index c8a0851230e5..ef5eef33e3d5 100644
--- a/fs/erofs/fscache.c
+++ b/fs/erofs/fscache.c
@@ -197,6 +197,7 @@ static int erofs_fscache_readpage(struct file *file, struct page *page)
enum erofs_fscache_readahead_type {
EROFS_FSCACHE_READAHEAD_TYPE_HOLE,
+ EROFS_FSCACHE_READAHEAD_TYPE_NOINLINE,
};
static int erofs_fscache_do_readahead(struct readahead_control *rac,
@@ -205,10 +206,14 @@ static int erofs_fscache_do_readahead(struct readahead_control *rac,
{
size_t offset, length, done;
struct page *page;
+ int ret = 0;
/*
- * 1) For CHUNK_BASED (HOLE), the output map.m_la is rounded down to
- * the nearest chunk boundary, and thus offset will be non-zero.
+ * 1) For CHUNK_BASED (HOLE/NOINLINE), the output map.m_la is rounded
+ * down to the nearest chunk boundary, and thus offset will be
+ * non-zero.
+ * 2) For the other cases, the output map.m_la shall be equal to o_la,
+ * and thus offset will be zero.
*/
offset = fsmap->o_la - fsmap->m_la;
length = fsmap->m_llen - offset;
@@ -222,11 +227,18 @@ static int erofs_fscache_do_readahead(struct readahead_control *rac,
case EROFS_FSCACHE_READAHEAD_TYPE_HOLE:
zero_user(page, 0, PAGE_SIZE);
break;
+ case EROFS_FSCACHE_READAHEAD_TYPE_NOINLINE:
+ ret = erofs_fscache_readpage_noinline(page, fsmap);
+ fsmap->m_pa += EROFS_BLKSIZ;
+ break;
default:
DBG_BUGON(1);
return -EINVAL;
}
+ if (ret)
+ return ret;
+
SetPageUptodate(page);
unlock_page(page);
}
@@ -263,7 +275,16 @@ static void erofs_fscache_readahead(struct readahead_control *rac)
ret = erofs_fscache_do_readahead(rac, &fsmap,
EROFS_FSCACHE_READAHEAD_TYPE_HOLE);
} else {
+ ret = erofs_fscache_get_map(&fsmap, &map, sb);
+ if (ret)
+ return;
+
switch (vi->datalayout) {
+ case EROFS_INODE_FLAT_PLAIN:
+ case EROFS_INODE_CHUNK_BASED:
+ ret = erofs_fscache_do_readahead(rac, &fsmap,
+ EROFS_FSCACHE_READAHEAD_TYPE_NOINLINE);
+ break;
default:
DBG_BUGON(1);
return;
--
2.27.0
Powered by blists - more mailing lists