lkml.org 
[lkml]   [2021]   [Jul]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] erofs: better comment z_erofs_readahead()
Date
Add some words about the traversal order and its pagepool usage.

Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Gao Xiang <xiang@kernel.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
\
 
 \ /
  Last update: 2021-07-05 20:35    [W:0.067 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site