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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no 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 0052EC55179 for ; Tue, 3 Nov 2020 15:24:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 887CC223EA for ; Tue, 3 Nov 2020 15:24:41 +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="m13hV2ZW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 887CC223EA 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 DCCCB6B0036; Tue, 3 Nov 2020 10:24:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D7C9B6B0068; Tue, 3 Nov 2020 10:24:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C6B7F6B006C; Tue, 3 Nov 2020 10:24:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0230.hostedemail.com [216.40.44.230]) by kanga.kvack.org (Postfix) with ESMTP id 9B1BB6B0036 for ; Tue, 3 Nov 2020 10:24:40 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 3938F3623 for ; Tue, 3 Nov 2020 15:24:40 +0000 (UTC) X-FDA: 77443479120.10.music26_03058ce272b9 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 04E6416A0D1 for ; Tue, 3 Nov 2020 15:24:40 +0000 (UTC) X-HE-Tag: music26_03058ce272b9 X-Filterd-Recvd-Size: 2861 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Nov 2020 15:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=IsUXNrto464dQH3Wc9ET6gj2wgCGm2mi1KG8sqhLC/A=; b=m13hV2ZWSI/tCXUSOZFhCkLOn4 M8VHgyvOcL3nKnes4mIOJ78DGf6lJUjAjTINZjEe7jKVaOK4TIYJsmHRpik3hJL4/Af15IaMp4t3U 6CwcF61Oqb2fqlGQ3PaU0F/YXIT25cPGxDqidKM8Tb9Oy5ysCA2MDMQVYnnDJOG8Pg41yn0uj9egz S199wIRG/Yl5AnQphwSDvX9c/i9pb2mFlJv94z4UCnp4NQ9HNfwg3CcJvfjcHHesVBotvCqJSjhTH WKlRVbVgOCaeC/BTzuEm4B4JLsyuIzEn/pex5hw8gnw7HAserzcmGXiyzbdVU4G8nX1LbsdtDxduY jzG5bCyg==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZyAn-0006tA-40; Tue, 03 Nov 2020 15:24:37 +0000 Date: Tue, 3 Nov 2020 15:24:36 +0000 From: Matthew Wilcox To: Christoph Hellwig Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, kent.overstreet@gmail.com Subject: Re: [PATCH 15/17] mm/filemap: Don't relock the page after calling readpage Message-ID: <20201103152436.GA27442@casper.infradead.org> References: <20201102184312.25926-1-willy@infradead.org> <20201102184312.25926-16-willy@infradead.org> <20201103080045.GN8389@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201103080045.GN8389@lst.de> 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: On Tue, Nov 03, 2020 at 09:00:45AM +0100, Christoph Hellwig wrote: > On Mon, Nov 02, 2020 at 06:43:10PM +0000, Matthew Wilcox (Oracle) wrote: > > We don't need to get the page lock again; we just need to wait for > > the I/O to finish, so use wait_on_page_locked_killable() like the > > other callers of ->readpage. > > As that isn't entirely obvious, what about adding a comment next to > the wait_on_page_locked_killable call to document it? The other callers of ->readpage don't document that, so not sure why we should here? > > + error = wait_on_page_locked_killable(page); > > if (error) > > return error; > > + if (PageUptodate(page)) > > + return 0; > > + if (!page->mapping) /* page truncated */ > > + return AOP_TRUNCATED_PAGE; > > + shrink_readahead_size_eio(&file->f_ra); > > + return -EIO; > > You might notice a theme here, but I hate having the fast path exit > early without a good reason, so I'd be much happier with: > > if (!PageUptodate(page)) { > if (!page->mapping) /* page truncated */ > return AOP_TRUNCATED_PAGE; > shrink_readahead_size_eio(&file->f_ra); > return -EIO; > } > return 0; I'm just not a fan of unnecessary indentation.