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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 99067C55178 for ; Tue, 3 Nov 2020 08:00:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E24C822404 for ; Tue, 3 Nov 2020 08:00:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E24C822404 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 44EAF6B005C; Tue, 3 Nov 2020 03:00:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 38A9E6B005D; Tue, 3 Nov 2020 03:00:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A03D6B006C; Tue, 3 Nov 2020 03:00:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0019.hostedemail.com [216.40.44.19]) by kanga.kvack.org (Postfix) with ESMTP id E90DD6B005C for ; Tue, 3 Nov 2020 03:00:50 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 83C503631 for ; Tue, 3 Nov 2020 08:00:50 +0000 (UTC) X-FDA: 77442360660.17.vest62_1f05e73272b7 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 689C8180D0181 for ; Tue, 3 Nov 2020 08:00:50 +0000 (UTC) X-HE-Tag: vest62_1f05e73272b7 X-Filterd-Recvd-Size: 1900 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Nov 2020 08:00:49 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 7A72868B05; Tue, 3 Nov 2020 09:00:46 +0100 (CET) Date: Tue, 3 Nov 2020 09:00:45 +0100 From: Christoph Hellwig To: "Matthew Wilcox (Oracle)" Cc: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, hch@lst.de, kent.overstreet@gmail.com Subject: Re: [PATCH 15/17] mm/filemap: Don't relock the page after calling readpage Message-ID: <20201103080045.GN8389@lst.de> References: <20201102184312.25926-1-willy@infradead.org> <20201102184312.25926-16-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201102184312.25926-16-willy@infradead.org> User-Agent: Mutt/1.5.17 (2007-11-01) 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 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? > > + 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;