From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org
Cc: huyue2@coolpad.com, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: [PATCH v3 1/9] erofs: support readahead in meta routine
Date: Fri, 3 Feb 2023 11:01:35 +0800 [thread overview]
Message-ID: <20230203030143.73105-2-jefflexu@linux.alibaba.com> (raw)
In-Reply-To: <20230203030143.73105-1-jefflexu@linux.alibaba.com>
In prep for the following support for readahead for page cache sharing,
add support for readahead in meta routine.
Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
---
fs/erofs/fscache.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c
index 014e20962376..e2ebe8f7dbe9 100644
--- a/fs/erofs/fscache.c
+++ b/fs/erofs/fscache.c
@@ -193,6 +193,30 @@ static int erofs_fscache_meta_read_folio(struct file *data, struct folio *folio)
return ret;
}
+static void erofs_fscache_meta_readahead(struct readahead_control *rac)
+{
+ int ret;
+ struct erofs_fscache *ctx = rac->mapping->host->i_private;
+ struct erofs_fscache_request *req;
+
+ if (!readahead_count(rac))
+ return;
+
+ req = erofs_fscache_req_alloc(rac->mapping,
+ readahead_pos(rac), readahead_length(rac));
+ if (IS_ERR(req))
+ return;
+
+ /* The request completion will drop refs on the folios. */
+ while (readahead_folio(rac))
+ ;
+
+ ret = erofs_fscache_read_folios_async(ctx->cookie, req, req->start, req->len);
+ if (ret)
+ req->error = ret;
+ erofs_fscache_req_put(req);
+}
+
static int erofs_fscache_data_read_slice(struct erofs_fscache_request *primary)
{
struct address_space *mapping = primary->mapping;
@@ -319,6 +343,7 @@ static void erofs_fscache_readahead(struct readahead_control *rac)
static const struct address_space_operations erofs_fscache_meta_aops = {
.read_folio = erofs_fscache_meta_read_folio,
+ .readahead = erofs_fscache_meta_readahead,
};
const struct address_space_operations erofs_fscache_access_aops = {
--
2.19.1.6.gb485710b
next prev parent reply other threads:[~2023-02-03 3:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-03 3:01 [PATCH v3 0/9] erofs: support page cache sharing between EROFS images in fscache mode Jingbo Xu
2023-02-03 3:01 ` Jingbo Xu [this message]
2023-02-03 3:01 ` [PATCH v3 2/9] erofs: remove unused device mapping in the meta routine Jingbo Xu
2023-02-03 3:01 ` [PATCH v3 3/9] erofs: unify anonymous inodes for blob Jingbo Xu
2023-02-03 3:01 ` [PATCH v3 4/9] erofs: allocate anonymous file of blob for page cache sharing Jingbo Xu
2023-02-03 3:01 ` [PATCH v3 5/9] erofs: set accurate anony inode size " Jingbo Xu
2023-02-03 3:01 ` [PATCH v3 6/9] erofs: implement .read_iter " Jingbo Xu
2023-02-03 3:01 ` [PATCH v3 7/9] erofs: implement .mmap " Jingbo Xu
2023-02-03 15:12 ` kernel test robot
2023-02-03 3:01 ` [PATCH v3 8/9] erofs: add helper checking if page cache sharing shall be enabled Jingbo Xu
2023-02-03 3:01 ` [PATCH v3 9/9] erofs: introduce 'sharecache' mount option Jingbo Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230203030143.73105-2-jefflexu@linux.alibaba.com \
--to=jefflexu@linux.alibaba.com \
--cc=chao@kernel.org \
--cc=huyue2@coolpad.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiang@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).