Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21857158ybl; Mon, 6 Jan 2020 12:44:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxOfIeZ0rdR2jE7lI1qqJ73V34fn3AA9MEBBXxdLprF/TGb/0eBY37jNtbE0nQeSQVkob4j X-Received: by 2002:a9d:1e88:: with SMTP id n8mr119943956otn.369.1578343461672; Mon, 06 Jan 2020 12:44:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578343461; cv=none; d=google.com; s=arc-20160816; b=NBBj4PgttX+RMA50Y0eX/qg9gJAF2diNfNEewsQkDfQuuFhB5k3aSGB+iXE9DtbRC9 hJZDbiStKpGfj/DEuC0pREyh1qYCir78vNd5NkgmD+JLMK6+hMHc3u5hjazhMGjIrjAh zs4BOG6Qc5hCyppZnDFYB7FSo+Zg9dDmGwtylEV3ohQkWOOdSEHxnZazibuMJSOCJg51 Dab6O5ePrM3vOw2C3jQfrDKci6QRr0MUHvzxOBNAIhKNF0c3sIwxNOP7WSQ0FKSDT0zH dvk8hyB5QBsbI3zZbfHgK4Rp7LQ+cxj3xTm6cOG9pn0P5i4uJUpvlWOYphp+IFLgjLct h8Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=c9Z19YOGHQfCJD8ZOfF2zdQhr910bfl12OKzLYcUIQo=; b=NykwqnkcdDhdTuKqDy1YJTGeXZtJA/QM2ekjfPh8HmuYYukbCs2FZGAUZX6RgW4MFI T0lcmLAVNiyBVYLdrEfC13135JgXTyJd0nZScDi//56jrOXA//NSjUWe8NOV0YDXipSA P+eZew4BQSE0HAs20jne25zFakwaqvx6wUcXHPrqVJdfLjLdozwiReAWWiOIkYENfje2 RJoYSB8nHeqsyn6Qv7pNP01jowD7HNVPC8IfIne40BZ1odWCRzW8gkWCrOLMnU7gNyhP v6fH/AUoUScrSbH/LUicMuCGFM+Jd40ejt2hc24xaKSzlXhTB9C/MMnHCAicJwd5wxSY 2l6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kxR3Bbcm; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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. [209.132.180.67]) by mx.google.com with ESMTP id l18si36144546oth.236.2020.01.06.12.44.02; Mon, 06 Jan 2020 12:44:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kxR3Bbcm; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-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 S1726719AbgAFUoB (ORCPT + 99 others); Mon, 6 Jan 2020 15:44:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:38908 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726657AbgAFUoB (ORCPT ); Mon, 6 Jan 2020 15:44:01 -0500 Received: from gmail.com (unknown [104.132.1.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5BADC20731; Mon, 6 Jan 2020 20:44:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578343440; bh=GCDF90PxaFvkCGdMTp6cM9sEWuA1IASP7woryXiIkio=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kxR3BbcmfEd73kXxSYAqfsOmgdQ2Fcysz9TiL5R0c3beHGBb4GmNNZQGIw8h8advw otmHqxecH+g51yMiinkK+sU1bLicbT7jDFfAd82yOqB1479nS8FFz1NO8GvTpKAp5Z Ti9u2rTBVrn+51T4bSV4dyCcTRYh59GowGLGVluc= Date: Mon, 6 Jan 2020 12:43:58 -0800 From: Eric Biggers To: Jaegeuk Kim Cc: linux-fscrypt@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, Victor Hsieh , linux-f2fs-devel@lists.sourceforge.net Subject: Re: [PATCH] fs-verity: implement readahead of Merkle tree pages Message-ID: <20200106204357.GA254289@gmail.com> References: <20191216181112.89304-1-ebiggers@kernel.org> <20200106181508.GA50058@jaegeuk-macbookpro.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200106181508.GA50058@jaegeuk-macbookpro.roam.corp.google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Jan 06, 2020 at 10:15:08AM -0800, Jaegeuk Kim wrote: > > static struct page *f2fs_read_merkle_tree_page(struct inode *inode, > > - pgoff_t index) > > + pgoff_t index, > > + unsigned long num_ra_pages) > > { > > + struct page *page; > > + > > index += f2fs_verity_metadata_pos(inode) >> PAGE_SHIFT; > > > > - return read_mapping_page(inode->i_mapping, index, NULL); > > + page = find_get_page(inode->i_mapping, index); > > + if (!page || !PageUptodate(page)) { > > + if (page) > > + put_page(page); > > + else if (num_ra_pages > 1) > > + f2fs_merkle_tree_readahead(inode->i_mapping, index, > > + num_ra_pages); > > + page = read_mapping_page(inode->i_mapping, index, NULL); > > + if (IS_ERR(page)) > > + return page; > > We don't need to check this, but can use the below return page? > Indeed, I'll remove the unnecessary IS_ERR(page) check. > > + } > > mark_page_accessed(page)? > > > + return page; > > } Good idea, but read_mapping_page() already calls mark_page_accessed(). It's just find_get_page() that doesn't. So after this patch, mark_page_accessed() is no longer called in the case where the page is already cached and Uptodate. I'll change it to use: find_get_page_flags(inode->i_mapping, index, FGP_ACCESSED); - Eric