From patchwork Wed Dec 16 18:23:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11978389 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 5AD87C0018C for ; Wed, 16 Dec 2020 18:46:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C05CA233F6 for ; Wed, 16 Dec 2020 18:46:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C05CA233F6 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 472F16B0072; Wed, 16 Dec 2020 13:46:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3FB1E8D0002; Wed, 16 Dec 2020 13:46:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 313376B0074; Wed, 16 Dec 2020 13:46:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0036.hostedemail.com [216.40.44.36]) by kanga.kvack.org (Postfix) with ESMTP id 1D1FD6B0072 for ; Wed, 16 Dec 2020 13:46:55 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D714F180AD81A for ; Wed, 16 Dec 2020 18:46:54 +0000 (UTC) X-FDA: 77600027148.09.day55_4006f532742e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id B8979180AD817 for ; Wed, 16 Dec 2020 18:46:54 +0000 (UTC) X-HE-Tag: day55_4006f532742e X-Filterd-Recvd-Size: 3128 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Wed, 16 Dec 2020 18:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=0L6frvK+PnSLx5jvqHgY9tuRpy+KHxsnXUNvK+DbpUk=; b=HubEENrtOSbGlDjpvv3rjiMat7 7R0jq9qAUTsQ/rw0e6ewdl63KB2nKUI77P98C8B+M/aG8oxVgd6aJQqDPW45r/+ju+JMIIRrOCcCs gaQqqCLzprxCA9/2Y1Fq5hWuGHNHxQKVAjBas0UDKi8gX7H0ZKLxrgg43kAKVY1kN1b8wH87A+/Ic wyKliWFFqWlR1PuiAdyvtfFiyg57wbDQoMIhvLaDDL1hAGUIWQIl8Zyof7Sw56w234KkwHEkz6VWZ TkzFSqTRwC7nKsx7kZhAv4kuk4D0tuv2QfXAN+8Hlgd+nbs5ymgzn1c5cjDQKTSRiizkPj0IG65x6 THlLso2g==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpbSi-00078s-7g; Wed, 16 Dec 2020 18:23:44 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org Subject: [PATCH 22/25] mm: Add wait_on_folio_locked & wait_on_folio_locked_killable Date: Wed, 16 Dec 2020 18:23:32 +0000 Message-Id: <20201216182335.27227-23-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201216182335.27227-1-willy@infradead.org> References: <20201216182335.27227-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: Turn wait_on_page_locked() and wait_on_page_locked_killable() into wrappers. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index ac4d3e2ac86c..22f9774d8a83 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -727,21 +727,29 @@ extern int wait_on_folio_bit_killable(struct folio *folio, int bit_nr); * ie with increased "page->count" so that the page won't * go away during the wait.. */ -static inline void wait_on_page_locked(struct page *page) +static inline void wait_on_folio_locked(struct folio *folio) { - struct folio *folio = page_folio(page); if (FolioLocked(folio)) wait_on_folio_bit(folio, PG_locked); } -static inline int wait_on_page_locked_killable(struct page *page) +static inline int wait_on_folio_locked_killable(struct folio *folio) { - struct folio *folio = page_folio(page); if (!FolioLocked(folio)) return 0; return wait_on_folio_bit_killable(folio, PG_locked); } +static inline void wait_on_page_locked(struct page *page) +{ + wait_on_folio_locked(page_folio(page)); +} + +static inline int wait_on_page_locked_killable(struct page *page) +{ + return wait_on_folio_locked_killable(page_folio(page)); +} + extern void put_and_wait_on_page_locked(struct page *page); void wait_on_page_writeback(struct page *page);