[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210705183253.14833-1-xiang@kernel.org>
Date: Tue, 6 Jul 2021 02:32:52 +0800
From: Gao Xiang <xiang@...nel.org>
To: linux-erofs@...ts.ozlabs.org
Cc: Matthew Wilcox <willy@...radead.org>,
LKML <linux-kernel@...r.kernel.org>, Gao Xiang <xiang@...nel.org>
Subject: [PATCH 1/2] erofs: better comment z_erofs_readahead()
Add some words about the traversal order and its pagepool usage.
Cc: Matthew Wilcox <willy@...radead.org>
Signed-off-by: Gao Xiang <xiang@...nel.org>
---
fs/erofs/zdata.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index cb4d0889eca9..054b9839e9db 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -1424,6 +1424,16 @@ static void z_erofs_readahead(struct readahead_control *rac)
f.readahead = true;
f.headoffset = readahead_pos(rac);
+ /*
+ * All pages are locked in the forward order in advance, so directly
+ * traverse pages in the reverse order since:
+ * 1) more effective to get each extent start offset, calculate partial
+ * decompressed length w/o knowing the full extent length (which is
+ * more metadata costly). If traversing in the normal order, it's
+ * mandatory to get full extent length one-by-one.
+ * 2) submission chain can be then in the forward order since
+ * pclusters are all inserted at head.
+ */
while ((page = readahead_page(rac))) {
prefetchw(&page->flags);
@@ -1460,7 +1470,7 @@ static void z_erofs_readahead(struct readahead_control *rac)
if (f.map.mpage)
put_page(f.map.mpage);
- /* clean up the remaining free pages */
+ /* drain the on-stack pagepool with unused non-LRU temporary pages */
put_pages_list(&pagepool);
}
--
2.20.1
Powered by blists - more mailing lists