From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82077C35254 for ; Wed, 19 Feb 2020 21:01:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3F8C6207FD for ; Wed, 19 Feb 2020 21:01:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="biXztY+3" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F8C6207FD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 317956B000A; Wed, 19 Feb 2020 16:01:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 27ADF6B000C; Wed, 19 Feb 2020 16:01:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 11C716B000E; Wed, 19 Feb 2020 16:01:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0055.hostedemail.com [216.40.44.55]) by kanga.kvack.org (Postfix) with ESMTP id E76BF6B000A for ; Wed, 19 Feb 2020 16:01:08 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A5505824805A for ; Wed, 19 Feb 2020 21:01:08 +0000 (UTC) X-FDA: 76508096616.15.body79_9ec670487b28 X-HE-Tag: body79_9ec670487b28 X-Filterd-Recvd-Size: 4571 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Wed, 19 Feb 2020 21:01:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=vmBYSWiADbzhrnAmLI0opbogq5zBVEJUJhOq4kDcPa8=; b=biXztY+3Z9WN5sTV1wTWo+FYtC fyTLTZ2+VVA1QPrvOIzyXZq3siFLwW97EtZ5Hdy/Um6FDkRN/R0v8XLsBlBrMyXp/DHLPmZQf9uBd oWgoSp52Sqhh72al/g5OWZ86Y4OZYKezFsUCtP7/Y6JjTk1KkthUkLhOAHgO+axb4+ZTXyi2MVMdC 1w+jqtDWZsAkWFckpZiNhzBHA1V60OjeOaHUSSltkFLEzv/HuZZ7ynXRe2J9/mNLqA9kETj5kHu2f lfRgSf/ZiGlLtwaAhVPKoSDqInGyKtmCBHAZWydrKjH/INNkasmnjZAiK6s7wD5sniPUvzo3nkaRq 7C1aTKPQ==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1j4WSv-0008UE-9y; Wed, 19 Feb 2020 21:01:05 +0000 From: Matthew Wilcox To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, ocfs2-devel@oss.oracle.com, linux-xfs@vger.kernel.org, Gao Xiang , Dave Chinner Subject: [PATCH v7 16/24] erofs: Convert compressed files from readpages to readahead Date: Wed, 19 Feb 2020 13:00:55 -0800 Message-Id: <20200219210103.32400-17-willy@infradead.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200219210103.32400-1-willy@infradead.org> References: <20200219210103.32400-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: "Matthew Wilcox (Oracle)" Use the new readahead operation in erofs. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Gao Xiang Reviewed-by: Dave Chinner --- fs/erofs/zdata.c | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index 17f45fcb8c5c..e64d8ab0900d 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1303,28 +1303,23 @@ static bool should_decompress_synchronously(struc= t erofs_sb_info *sbi, return nr <=3D sbi->max_sync_decompress_pages; } =20 -static int z_erofs_readpages(struct file *filp, struct address_space *ma= pping, - struct list_head *pages, unsigned int nr_pages) +static void z_erofs_readahead(struct readahead_control *rac) { - struct inode *const inode =3D mapping->host; + struct inode *const inode =3D rac->mapping->host; struct erofs_sb_info *const sbi =3D EROFS_I_SB(inode); =20 - bool sync =3D should_decompress_synchronously(sbi, nr_pages); + bool sync =3D should_decompress_synchronously(sbi, readahead_count(rac)= ); struct z_erofs_decompress_frontend f =3D DECOMPRESS_FRONTEND_INIT(inode= ); - gfp_t gfp =3D mapping_gfp_constraint(mapping, GFP_KERNEL); - struct page *head =3D NULL; + struct page *page, *head =3D NULL; LIST_HEAD(pagepool); =20 - trace_erofs_readpages(mapping->host, lru_to_page(pages)->index, - nr_pages, false); + trace_erofs_readpages(inode, readahead_index(rac), + readahead_count(rac), false); =20 - f.headoffset =3D (erofs_off_t)lru_to_page(pages)->index << PAGE_SHIFT; - - for (; nr_pages; --nr_pages) { - struct page *page =3D lru_to_page(pages); + f.headoffset =3D readahead_pos(rac); =20 + while ((page =3D readahead_page(rac))) { prefetchw(&page->flags); - list_del(&page->lru); =20 /* * A pure asynchronous readahead is indicated if @@ -1333,11 +1328,6 @@ static int z_erofs_readpages(struct file *filp, st= ruct address_space *mapping, */ sync &=3D !(PageReadahead(page) && !head); =20 - if (add_to_page_cache_lru(page, mapping, page->index, gfp)) { - list_add(&page->lru, &pagepool); - continue; - } - set_page_private(page, (unsigned long)head); head =3D page; } @@ -1366,11 +1356,10 @@ static int z_erofs_readpages(struct file *filp, s= truct address_space *mapping, =20 /* clean up the remaining free pages */ put_pages_list(&pagepool); - return 0; } =20 const struct address_space_operations z_erofs_aops =3D { .readpage =3D z_erofs_readpage, - .readpages =3D z_erofs_readpages, + .readahead =3D z_erofs_readahead, }; =20 --=20 2.25.0