lkml.org 
[lkml]   [2021]   [Dec]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 09/19] netfs: refactor netfs_rreq_unlock()
Date
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(+)

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)
--
2.27.0
\
 
 \ /
  Last update: 2021-12-10 08:38    [W:0.133 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site