From patchwork Sat Jan 25 01:35:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11351377 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0E912924 for ; Sat, 25 Jan 2020 01:36:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CFF472072C for ; Sat, 25 Jan 2020 01:36:04 +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="COEUCYCq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CFF472072C 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 667846B000C; Fri, 24 Jan 2020 20:35:59 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 5E5F16B0269; Fri, 24 Jan 2020 20:35:59 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4B35F6B0266; Fri, 24 Jan 2020 20:35:59 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0069.hostedemail.com [216.40.44.69]) by kanga.kvack.org (Postfix) with ESMTP id 01C4F6B000C for ; Fri, 24 Jan 2020 20:35:58 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id A2B4E180AD807 for ; Sat, 25 Jan 2020 01:35:58 +0000 (UTC) X-FDA: 76414440396.14.hose37_170b1d1013809 X-Spam-Summary: 2,0,0,f16435faea9cf014,d41d8cd98f00b204,willy@infradead.org,:linux-fsdevel@vger.kernel.org:willy@infradead.org::linux-kernel@vger.kernel.org:linux-erofs@lists.ozlabs.org,RULES_HIT:41:69:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1542:1711:1730:1747:1777:1792:2393:2559:2562:2898:3138:3139:3140:3141:3142:3353:3865:3870:3871:4321:4605:5007:6117:6119:6261:6653:7576:7903:7904:8957:9592:10004:11026:11473:11658:11914:12043:12296:12297:12438:12555:12895:12986:13894:14096:14181:14394:14721:21080:21451:21627:21990:30054:30070,0,RBL:198.137.202.133:@infradead.org:.lbl8.mailshell.net-62.8.0.100 64.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:27,LUA_SUMMARY:none X-HE-Tag: hose37_170b1d1013809 X-Filterd-Recvd-Size: 4212 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Sat, 25 Jan 2020 01:35:58 +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:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=04UCiG/20t3FCGYn9DWPtGoOuyQcfxr5hH9Iq5Vewm4=; b=COEUCYCqKEjyVamYeoH8fXaTOX 9KTszdyPH+LaFUpmmD9eVqUTOJ16y/yVdI6WF6/nMDNEQv+mxhDYCizNvwn1iGCpcLGsSgpqdnqAZ Nsuu1+5POYrllMfRGKyj7/bBG2c1opmtREx1IKmq5G1Ppqyb8ORrfys48Pahlfr1VQmZM7qU3Kb0b 79V8GJOsUg8MyhWViXRWt0GL3sqcd01ohY41EWHI/3DaX5GMQof8exvHWhbBYGxu2JpG5R2epSiH3 /lHrqA38FKS9CKpnlLy/IQRWWWpW97JEjF1FqjUBt90RiJWBFxwt0sSJ7w315eLm6DzGPEf2bzQY/ e9hA3Vqg==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1ivAMd-0006Vp-EK; Sat, 25 Jan 2020 01:35:55 +0000 From: Matthew Wilcox To: linux-fsdevel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-erofs@lists.ozlabs.org Subject: [PATCH 08/12] erofs: Convert compressed files from readpages to readahead Date: Fri, 24 Jan 2020 17:35:49 -0800 Message-Id: <20200125013553.24899-9-willy@infradead.org> X-Mailer: git-send-email 2.21.1 In-Reply-To: <20200125013553.24899-1-willy@infradead.org> References: <20200125013553.24899-1-willy@infradead.org> MIME-Version: 1.0 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) Cc: linux-erofs@lists.ozlabs.org --- fs/erofs/zdata.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c index d3dd8cf1fc01..20efb87dd957 100644 --- a/fs/erofs/zdata.c +++ b/fs/erofs/zdata.c @@ -1328,28 +1328,26 @@ static bool should_decompress_synchronously(struct erofs_sb_info *sbi, return nr <= sbi->max_sync_decompress_pages; } -static int z_erofs_readpages(struct file *filp, struct address_space *mapping, - struct list_head *pages, unsigned int nr_pages) +static +unsigned z_erofs_readahead(struct file *file, struct address_space *mapping, + pgoff_t start, unsigned int nr_pages) { struct inode *const inode = mapping->host; struct erofs_sb_info *const sbi = EROFS_I_SB(inode); bool sync = should_decompress_synchronously(sbi, nr_pages); struct z_erofs_decompress_frontend f = DECOMPRESS_FRONTEND_INIT(inode); - gfp_t gfp = mapping_gfp_constraint(mapping, GFP_KERNEL); struct page *head = NULL; LIST_HEAD(pagepool); - trace_erofs_readpages(mapping->host, lru_to_page(pages)->index, - nr_pages, false); + trace_erofs_readpages(inode, start, nr_pages, false); - f.headoffset = (erofs_off_t)lru_to_page(pages)->index << PAGE_SHIFT; + f.headoffset = (erofs_off_t)start << PAGE_SHIFT; for (; nr_pages; --nr_pages) { - struct page *page = lru_to_page(pages); + struct page *page = readahead_page(mapping, start); prefetchw(&page->flags); - list_del(&page->lru); /* * A pure asynchronous readahead is indicated if @@ -1358,11 +1356,6 @@ static int z_erofs_readpages(struct file *filp, struct address_space *mapping, */ sync &= !(PageReadahead(page) && !head); - 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 = page; } @@ -1396,6 +1389,6 @@ static int z_erofs_readpages(struct file *filp, struct address_space *mapping, const struct address_space_operations z_erofs_aops = { .readpage = z_erofs_readpage, - .readpages = z_erofs_readpages, + .readahead = z_erofs_readahead, };