Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4024926pxv; Mon, 5 Jul 2021 11:35:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy9ccy7EfXjleXP+sBvGqS4wXhNI7ZYZAKtVeDxn7SrMU3ybeQ3lM3HYxmIpytbmombPvDn X-Received: by 2002:aa7:d747:: with SMTP id a7mr9759406eds.288.1625510151565; Mon, 05 Jul 2021 11:35:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625510151; cv=none; d=google.com; s=arc-20160816; b=i6uvVpw7rRP5tZbRHvNQxhRAyAKXBo7LeWxV0dHaoA597hBM9tXLRZ8k4BjSU5ZiI+ OFRTd9D5YylDJe/4xXVq09F49uPsd/uvYYIBiRjCNrAK+LXY+r2gyzHH85FgBOllrkPf gbntOX09kFbIAAMVOQ9+g+KkzcKdFG/BAV+T5/F9OVCuEKQn/L+Mh78SpmYrnycwqcE8 f4E6JnWmZov6NWZef6SsYyXuRT+o8oN8ctkzmEPSq3UfQij0MUmmUFU6D86UWfA7qK50 y3yfNa7ugXsMWxJpRNz7DPbPAZ5+vQPtVlD4CoXGum8mA1z6qqdwv75jV6kKVH2Lbofv 8NTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=G6AxBaHeLxKKyjVu6lSVCiOmYQ3K6X9QWypHvIBUrpc=; b=K0P2VsYeo0VcY5QwTr5krSYxb0YJwIt0KsaoMHpQz7R7AJE8TF74ENl/yJ0fD/Mlny AX3q5Vt69lCYqD/QhqdQH3hrjUHm+uUrjKQme9s4Aii8utz0v7s6BGpEbjl9nNu/i1As GQ8XxaYj6nscOyUlIOOiau5lsdVBM5hcf6MLGnHtUIqa4FTsee5wBtCrn08O12/ijRhV hzZnK9ft8K4xH0zyBiIMSrMT5u14cJkG0AtXZaxOBkgUrbOoLn3ozICKtEx9MUNdHBD9 tLfY3SzoQSDc75vgFsiq77QwvjwMuMdMnPvvhP9HlN1uVnRidvmhuG2dYG3Vvz2eFXFc XlWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="U/dHkhRI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w11si13680991ejc.221.2021.07.05.11.35.27; Mon, 05 Jul 2021 11:35:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="U/dHkhRI"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229876AbhGESgS (ORCPT + 99 others); Mon, 5 Jul 2021 14:36:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:53816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229743AbhGESgS (ORCPT ); Mon, 5 Jul 2021 14:36:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 788186196A; Mon, 5 Jul 2021 18:33:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625510020; bh=0U7hZgPxK+V3aSy8+i4BDfGVZnwS/5p/8xyX8R0PyAo=; h=From:To:Cc:Subject:Date:From; b=U/dHkhRIP114pjZGL3oE1D02XBCEVFMcbo+7KjzI7fQpT2yzKzNjdfXLriB/ZwA12 wy5FsGzVC3l2WAYiLsDDj4PYKORS3MBFOgSeFtYOwZO1zA4LneE+nMbNxKW/JLqfgj zNvZoZRHX9GgfDdYRSnM0phBOul84xb4Irbn6ftfAZ1UsGxy9YOhZM7WtuLtaN0jn9 tKY0j9L0LpnlI0H9Ki/9kVAVd2rCV+Qh7xJeWbPF5lmVQgSQ/T9okejqsGih0Jfiqe FtDdk3dcyAZf4bFjUQoCNKKOwPIedvJMNN+xB9v3Ai05mbBHA9O4EcF+5gaP3Auz22 sK2vZxwjisiaQ== From: Gao Xiang To: linux-erofs@lists.ozlabs.org Cc: Matthew Wilcox , LKML , Gao Xiang Subject: [PATCH 1/2] erofs: better comment z_erofs_readahead() Date: Tue, 6 Jul 2021 02:32:52 +0800 Message-Id: <20210705183253.14833-1-xiang@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add some words about the traversal order and its pagepool usage. Cc: Matthew Wilcox Signed-off-by: Gao Xiang --- 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