Message ID | 20211210073619.21667-10-jefflexu@linux.alibaba.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fscache,erofs: fscache-based demand-read semantics | expand |
Jeffle Xu <jefflexu@linux.alibaba.com> wrote:
> In demand-read case, the input folio of netfs API is may not the page
"is may not the page"? I think you're missing a verb (and you have too many
auxiliary verbs;-)
David
On 12/10/21 11:41 PM, David Howells wrote: > Jeffle Xu <jefflexu@linux.alibaba.com> wrote: > >> In demand-read case, the input folio of netfs API is may not the page > > "is may not the page"? I think you're missing a verb (and you have too many > auxiliary verbs;-) > Sorry for my poor English... What I want to express is that "In demand-read case, the input folio of netfs API may not be the page cache inside the address space of the netfs file."
On 12/11/21 1:23 PM, JeffleXu wrote: > > > On 12/10/21 11:41 PM, David Howells wrote: >> Jeffle Xu <jefflexu@linux.alibaba.com> wrote: >> >>> In demand-read case, the input folio of netfs API is may not the page >> >> "is may not the page"? I think you're missing a verb (and you have too many >> auxiliary verbs;-) >> > > Sorry for my poor English... What I want to express is that > > "In demand-read case, the input folio of netfs API may not be the page > cache inside the address space of the netfs file." > By the way, can we change the current address_space based netfs API to folio-based, which shall be more general? That is, the current implementation of netfs API uses (address_space, page_offset, len) tuple to describe the destination where the read data shall be store into. While in the demand-read case, the input folio may not be the page cache, and thus there's no address_space attached with it.
Hi Jeffle, On Sat, Dec 11, 2021 at 01:44:47PM +0800, JeffleXu wrote: > > > On 12/11/21 1:23 PM, JeffleXu wrote: > > > > > > On 12/10/21 11:41 PM, David Howells wrote: > >> Jeffle Xu <jefflexu@linux.alibaba.com> wrote: > >> > >>> In demand-read case, the input folio of netfs API is may not the page > >> > >> "is may not the page"? I think you're missing a verb (and you have too many > >> auxiliary verbs;-) > >> > > > > Sorry for my poor English... What I want to express is that > > > > "In demand-read case, the input folio of netfs API may not be the page > > cache inside the address space of the netfs file." > > > > By the way, can we change the current address_space based netfs API to > folio-based, which shall be more general? That is, the current > implementation of netfs API uses (address_space, page_offset, len) tuple > to describe the destination where the read data shall be store into. > While in the demand-read case, the input folio may not be the page > cache, and thus there's no address_space attached with it. Thanks for your hard effort on this! Just a rough look. Could we use a pseudo inode (actually the current managed_inode can be used as this) to retain metadata for fscache scenarios? (since it's better to cache all metadata rather than drop directly, also the alloc_page() - free_page() cycle takes more time). Also if my own limited understanding is correct, you could directly use file inode pages with netfs_readpage_demand() rather than get_meta_page and then memcpy to the file inode pages. Thanks, Gao Xiang > > -- > Thanks, > Jeffle
diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c index 04d0cc2fca83..af12a7996672 100644 --- a/fs/netfs/read_helper.c +++ b/fs/netfs/read_helper.c @@ -414,6 +414,22 @@ static void netfs_rreq_unlock(struct netfs_read_request *rreq) pgoff_t last_page = ((rreq->start + rreq->len) / PAGE_SIZE) - 1; bool subreq_failed = false; + if (rreq->type == NETFS_TYPE_DEMAND) { + folio = rreq->folio; + + list_for_each_entry(subreq, &rreq->subrequests, rreq_link) { + subreq_failed = (subreq->error < 0); + if (subreq_failed) + break; + } + + if (!subreq_failed) + folio_mark_uptodate(folio); + + if (!test_bit(NETFS_RREQ_DONT_UNLOCK_FOLIOS, &rreq->flags)) + folio_unlock(folio); + } else { + XA_STATE(xas, &rreq->mapping->i_pages, start_page); if (test_bit(NETFS_RREQ_FAILED, &rreq->flags)) { @@ -480,6 +496,7 @@ static void netfs_rreq_unlock(struct netfs_read_request *rreq) } } rcu_read_unlock(); + } task_io_account_read(account); if (rreq->netfs_ops->done)
In demand-read case, the input folio of netfs API is may not the page cache inside the address space of the netfs file. Instead it may be just a temporary page used to contain the data. Thus iterate corresponding pages through rreq->folio directly. Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com> --- fs/netfs/read_helper.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)